/* ZBufferUpdate.hpp Author: James Russell Created: 9/13/2015 Purpose: Buffer updates are created by the property buffer when synchronization happens. They are then passed along to the network service to be serialized and sent across the wire. License: TODO */ #pragma once #ifndef _ZPROPERTYBUFFERUPDATE_HPP #define _ZPROPERTYBUFFERUPDATE_HPP #include #include "ZSimulationDefs.hpp" class ZPropertyBufferUpdate { public: // update marker for a single bit of data in the buffer struct Update { uint16_t SubPage; // sub property page uint16_t Offset; // offset into buffer (NOT into Data) size_t Size; // size of the data void* Data; // pointer to the data uint8_t Local[ZSIM_SYNCBUFFER_MAX]; // local storage for Data (if copy is required) }; eID Id; // entity we are updating in this packet ZArray Updates; // the updates in the data array int Delay; // simulated lag // c'tor ZPropertyBufferUpdate(); // parameterized c'tor ZPropertyBufferUpdate(eID id); // d'tor ~ZPropertyBufferUpdate(); // called by the network system to serialize this update into binary form void Serialize(ZBinaryBufferWriter& writer); // called by the network system to deserialize this update from binary form bool Deserialize(ZBinaryBufferReader& reader); // called to get the serialized size of this update size_t GetSerializedSize(); }; #endif