SQCSimulator2023/SQCSim-srv/connection.h

42 lines
863 B
C
Raw Normal View History

2023-09-24 11:07:03 -04:00
#ifndef CONNECTION_H__
#define CONNECTION_H__
2023-09-24 08:45:40 -04:00
#include <deque>
2023-09-24 11:07:03 -04:00
#include <map>
2023-09-24 08:45:40 -04:00
#include "../SQCSim-common/player.h"
#include "../SQCSim-common/vector3.h"
2023-09-25 08:23:52 -04:00
#include "../SQCSim-common/serialization.h"
2023-09-24 08:45:40 -04:00
#include "define.h"
class Connection {
public:
Connection(
in_addr addr,
std::string name,
2023-09-25 08:23:52 -04:00
uint64_t hash,
uint64_t self_hash,
uint64_t team_hash);
2023-09-24 08:45:40 -04:00
~Connection();
Player* player = nullptr;
in_addr GetAddr() const;
2023-09-25 08:23:52 -04:00
uint64_t GetHash(bool self = true) const;
uint64_t GetTeamHash() const;
2023-09-24 08:45:40 -04:00
std::string GetName() const;
2023-09-24 11:07:03 -04:00
void AddInput(Input in);
Output* getOutput(Timestamp time);
Sync getSync(Timestamp time);
void CleanInputManifest(Timestamp time);
2023-09-24 08:45:40 -04:00
private:
2023-09-24 11:07:03 -04:00
std::map<Timestamp, Input> m_input_manifest;
std::map<Timestamp, Output> m_output_manifest;
2023-09-24 08:45:40 -04:00
in_addr m_addr;
2023-09-25 08:23:52 -04:00
uint64_t m_id,
2023-09-24 11:07:03 -04:00
m_sid,
m_tid;
2023-09-24 08:45:40 -04:00
std::string m_name;
};
#endif