Buffers

Different types of memory buffers are needed for different work. We need a simple and convenient method of memory management (allocation and reallocation of buffers), simple routins of buffer update, and some additional data related to buffer stored together with it.

1. With Run-time C library, we need buffers as arrays of char. What kind of char is used (signed or unsigned) depends on a compiler setting. These arrays are used to store ASCI strings and sequences of bytes of different content.

Class SrtBuffer provides this kind of a buffer: its interface and implementation.

2. When we communicate data across a network or store it in a file, we often encode it and add some headers to it. We do not want to be confused with signed and unsigned chars, we want to deal with array of bytes. In addition, we need a pointer to a last byte, which was read before a current operation, and we want to store conveniently an encoding type.

Class CommBuffer provides this kind of a buffer: its interface and implementation. Encoding types are stored separatelly. Object which can encode and decode their content using CommBuffer are derived from DatatHook.

Back to Group List