2019-03-21 02:34:24 +01:00
|
|
|
/*
|
|
|
|
* 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>
|
2019-03-21 02:34:24 +01:00
|
|
|
|
|
|
|
namespace ix
|
|
|
|
{
|
2019-05-30 17:46:50 +02:00
|
|
|
class ConnectionState
|
|
|
|
{
|
2019-03-21 02:34:24 +01:00
|
|
|
public:
|
|
|
|
ConnectionState();
|
|
|
|
virtual ~ConnectionState() = default;
|
|
|
|
|
|
|
|
virtual void computeId();
|
|
|
|
virtual const std::string& getId() const;
|
|
|
|
|
2019-04-18 05:35:00 +02:00
|
|
|
void setTerminated();
|
2019-04-18 01:23:24 +02:00
|
|
|
bool isTerminated() const;
|
|
|
|
|
2019-03-21 02:34:24 +01:00
|
|
|
static std::shared_ptr<ConnectionState> createConnectionState();
|
|
|
|
|
|
|
|
protected:
|
2019-04-18 01:23:24 +02:00
|
|
|
std::atomic<bool> _terminated;
|
2019-03-21 02:34:24 +01:00
|
|
|
std::string _id;
|
|
|
|
|
|
|
|
static std::atomic<uint64_t> _globalId;
|
|
|
|
};
|
2019-05-30 17:46:50 +02:00
|
|
|
} // namespace ix
|