25 #ifndef NRG_SNAPSHOT_H
26 #define NRG_SNAPSHOT_H
42 uint16_t getID()
const {
return id; }
43 void setID(uint16_t
id){ this->
id = id; }
45 void removeEntityById(uint16_t
id);
46 void writeToPacket(
Packet& p)
const;
51 std::vector<size_t> field_sizes;
53 off_t getFieldOffset(
int num)
const;
54 size_t getTotalBytes()
const;
57 std::map<uint16_t, EntityData> edata;
65 uint16_t getID()
const {
return id; }
66 void setID(uint16_t
id){ this->
id = id; }
68 void removeEntityById(uint16_t
id);
70 void writeToPacket(
Packet& p)
const;
78 const uint8_t*
get(
const Packet& p)
const {
81 bool operator<(uint16_t v)
const {
return entity < v; }
82 bool operator==(uint16_t v)
const {
return entity == v; }
89 bool operator<(
const EntityInfo& other)
const {
return id < other.id; }
90 bool operator==(
const EntityInfo& other)
const {
return id == other.id; }
91 bool operator==(uint16_t v)
const {
return id == v; }
95 std::vector<EntityInfo> entities;
96 std::vector<FieldInfo> fields, tmp_fields;
97 size_t full_count, del_count, upd_count;
103 enum class Action { Get, Create, Destroy, Update };
104 typedef std::function<Entity*(Action, uint16_t eid, uint16_t etype)> CSnapFunc;
106 bool readFromPacket(
Packet& p,
const CSnapFunc& f);
Definition: nrg_snapshot.h:38
Definition: nrg_snapshot.h:102
Class for storing data to be sent / received across the network.
Definition: nrg_packet.h:58
Functionality to notify users of Client and Server occurances.
Abstract class to be inherited by users of the library which acts as a container of one or more Field...
Definition: nrg_entity.h:37
Contains classes related to nrg's Entity data-replication abstraction.
Definition: nrg_snapshot.h:62
const uint8_t * getBasePointer() const
Returns the base address of the packet's data without affecting the internal pointer.
Definition: nrg_packet.h:140
Simple implementation of a ring / circular buffer.
Common defines and includes used by all the other nrg header files.