YYYPOSTMAN CONCEPTS ******************* binbuffer --------- typedef index // some signed integer type const uint8 &operator[] (const index) // even though the returned reference is constant, // it must point onto the real representation of the // object! uint8 &operator[] (const index) // the addresses returned must be linearly connected // in both the operator[] functions! // i.e. if x is a binbuff then it is true to say // &x[40] == (&x[41]) - 1 const index size() const void add_end (const index amount) void remove_end (const index amount) void remove_begin (const index amount) // add_end, remove_end and remove_begin may invalidate the // addresses returned by the two operator[] functions ! // all other functions may not invalidate them! binstream --------- typedef binbuffer // the type of the used binbuffer binbuffer receivebuffer, sendbuffer; SigC::Signal1 receive() // - this is emitted when new data was appended to the receivebuffer void send(); // - call this when you appended the sendbuffer encodable --------- default constructor leaving everything undefined the following functions are not part of the encodable class, but declared globally instead. this makes it possible to encode classes you cannot manipulate. i.e. int, float or other classes from libraries you may not change. dontcare appendtobinbuffer (const encodable &e, binbuffer &x) // - does not erase or manipulate the current binbuffer, // instead it must _append_ data to it! // - you can leave out the '&' and or the 'const' in 'const encodable &e' // but you may not manipulate e if you chose 'encodable &e' // anyway, 'const encodable &e' should be prefered due to const correctness and speed issues. const binbuffer::index readfrombinbuffer (encodable &, const binbuffer &x, const binbuffer::index startpos) // - returns the size of the read message if successful. // - returns -2 if the data is corrupt // - returns -1 if not enough data ready. // - returning 0 is perfectly ok if this is a dummy message with size 0. // - must not do anything with the bytes before the startpos // - if the data could not be read, the value of the encodable may be undefined. encodables must be able to encode themselfes in a way so that they know how long they are, because when decoding, nobody tells them how many bytes they are long. messagekind ----------- is a refinement of encodable copy constructor must be sortable with operator < message ------- is a refinement of encodable but it has the meaning of being the content of a message.