| 1 | = Synchronizeable = |
| 2 | |
| 3 | Short description of the module and its functions: |
| 4 | |
| 5 | Next steps: |
| 6 | * Implement the changes of the interface |
| 7 | |
| 8 | [[br]] |
| 9 | [[br]] |
| 10 | {{{ |
| 11 | |
| 12 | /* general notes: |
| 13 | - the function names write/read are choosen from the observers point of view (outside the module) |
| 14 | */ |
| 15 | |
| 16 | /* public functions */ |
| 17 | public: |
| 18 | |
| 19 | /* |
| 20 | * Constructor, Deconstructor |
| 21 | */ |
| 22 | Synchronizeable(); |
| 23 | ~Synchronizeable(); |
| 24 | |
| 25 | /* |
| 26 | * This function writes the binary representation of the synchronizeable objects state into |
| 27 | * the object. The binary data is a sufficient represenation of the object's next state. |
| 28 | * This function is virtual and therefore needs to be extended by the derived class |
| 29 | * |
| 30 | * @param data: the binary data array |
| 31 | * @param length: the length of the data array |
| 32 | */ |
| 33 | virtual void writeBytes(byte* data, int length) = 0; |
| 34 | |
| 35 | |
| 36 | /* |
| 37 | * This function converts the current state of the synchronizeable object into binary |
| 38 | * representation. This binary representation contains a sufficient (not more) description of the |
| 39 | * current object state and will be sent through the NetworkStream to the remote host. |
| 40 | * This function is virtual and therefore needs to be extended by the derived class |
| 41 | * |
| 42 | * @param data: the binary array |
| 43 | * @param length: the length of the array: the synchronizeable object can never write more than <length> bytes |
| 44 | * return: the actual number of bytes that has been read |
| 45 | */ |
| 46 | virtual int readBytes(byte* data, int length) = 0; |
| 47 | |
| 48 | |
| 49 | /* |
| 50 | * This function writes the incoming byte stream as human readable text into the STDOUT. |
| 51 | * It is been called by the writeByteStream(...) function. |
| 52 | * This function is virtual and therefore needs to be extended by the derived class |
| 53 | */ |
| 54 | virtual void writeDebug() = 0; |
| 55 | |
| 56 | |
| 57 | /* |
| 58 | * This function writes the outgoing byte stream as human readable text into the STDOUT. |
| 59 | * It is been called by the readByteStream(...) function. |
| 60 | * This function is virtual and therefore needs to be extended by the derived class |
| 61 | */ |
| 62 | virtual void readDebug() = 0; |
| 63 | }}} |