itom
|
basic data container for class ByteArray that is implicitly shared over multiple instances of ByteArray of the same content More...
Public Attributes | |
int | m_ref |
char * | m_pData |
char | m_buffer [1] |
basic data container for class ByteArray that is implicitly shared over multiple instances of ByteArray of the same content
The address of the real character array is stored in m_pData. The data buffer itself starts at m_buffer and continues at the end of the struct. Therefore, ByteArray allocates memory for Data that has the length of data + the length of the character array to store. The number of ByteArray instances that have access to exactly the same Data container is stored in the reference counter m_ref.
The basic principle of the implicit sharing is taken from QByteArray.
char ito::ByteArray::Data::m_buffer[1] |
start of character array buffer. The real buffer is longer than one char value, therefore no member must be appended after this point.
char* ito::ByteArray::Data::m_pData |
pointer to character array that begins at m_buffer
int ito::ByteArray::Data::m_ref |
reference counter for implicit sharing (0: means one reference, ...)