Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Version 2 (modified by landauf, 17 years ago) (diff)

Synchronizeable

This is an archived page!
This page is very old and the content is not up to date.
Not everything (if any) which is written here will be in the final game!

Short description of the module and its functions:

Next steps:

  • Implement the changes of the interface



/* general notes:
   - the function names write/read are choosen from the observers point of view (outside the module) 
*/

 /* public functions */
 public:

 /*
  * Constructor, Deconstructor
  */
 Synchronizeable();
 ~Synchronizeable();

 /*
  * This function writes the binary representation of the synchronizeable objects state into
  * the object. The binary data is a sufficient represenation of the object's next state.
  * This function is virtual and therefore needs to be extended by the derived class
  *
  * @param data: the binary data array
  * @param length: the length of the data array
  */
 virtual void writeBytes(byte* data, int length) = 0;


 /*
  * This function converts the current state of the synchronizeable object into binary 
  * representation. This binary representation contains a sufficient (not more) description of the 
  * current object state and will be sent through the NetworkStream to the remote host.
  * This function is virtual and therefore needs to be extended by the derived class
  *
  * @param data: the binary array
  * @param length: the length of the array: the synchronizeable object can never write more than <length> bytes
  * return: the actual number of bytes that has been read
  */
 virtual int readBytes(byte* data, int length) = 0;


 /*
  * This function writes the incoming byte stream as human readable text into the STDOUT.
  * It is been called by the writeByteStream(...) function.
  * This function is virtual and therefore needs to be extended by the derived class
  */
 virtual void writeDebug() = 0;


 /*
  * This function writes the outgoing byte stream as human readable text into the STDOUT.
  * It is been called by the readByteStream(...) function.
  * This function is virtual and therefore needs to be extended by the derived class
  */
 virtual void readDebug() = 0;