IXWebSocket/ixwebsocket/IXConnectionState.h

37 lines
725 B
C
Raw Normal View History

/*
* IXConnectionState.h
* Author: Benjamin Sergeant
* Copyright (c) 2019 Machine Zone, Inc. All rights reserved.
*/
#pragma once
#include <atomic>
#include <memory>
2019-05-30 17:46:50 +02:00
#include <stdint.h>
#include <string>
namespace ix
{
2019-05-30 17:46:50 +02:00
class ConnectionState
{
public:
ConnectionState();
virtual ~ConnectionState() = default;
virtual void computeId();
virtual const std::string& getId() const;
void setTerminated();
bool isTerminated() const;
static std::shared_ptr<ConnectionState> createConnectionState();
protected:
std::atomic<bool> _terminated;
std::string _id;
static std::atomic<uint64_t> _globalId;
};
2019-05-30 17:46:50 +02:00
} // namespace ix