gramods
DataSync.hh
1 
2 #ifndef GRAMODS_NETWORK_DATASYNC
3 #define GRAMODS_NETWORK_DATASYNC
4 
5 #include <gmNetwork/Protocol.hh>
6 #include <gmNetwork/SyncData.hh>
7 
8 BEGIN_NAMESPACE_GMNETWORK;
9 
69 class DataSync
70  : public Protocol {
71 
72 public:
73 
74  DataSync();
75  virtual ~DataSync();
76 
87  void addData(std::shared_ptr<SyncData> d);
88 
102  void addData(SyncData * d);
103 
108  void update();
109 
113  void processMessage(Message m) override;
114 
120  void send(SyncData * d);
121 
127  char getProtocolFlag() override { return 11; }
128 
129 private:
130 
131  struct Impl;
132  std::unique_ptr<Impl> _impl;
133 };
134 
135 END_NAMESPACE_GMNETWORK;
136 
137 #endif
Synchronization of simple data, such as boolean, float or integer values, over network.
Definition: DataSync.hh:70
char getProtocolFlag() override
Returns the header byte associated with the protocol, sent in the header of messages to indicate whic...
Definition: DataSync.hh:127
TODO: write this.
Definition: Protocol.hh:21
Simple synchronizeable data container.
Definition: SyncData.hh:17
Data entity communicated by the connection to the designated protocol.
Definition: Protocol.hh:43