|
protobuf-c 1.5.1
Protocol Buffers implementation in C
|
Simple buffer "subclass" of ProtobufCBuffer.
More...
Data Fields | |
| ProtobufCBuffer | base |
| "Base class". | |
| size_t | alloced |
Number of bytes allocated in data. | |
| size_t | len |
Number of bytes currently stored in data. | |
| uint8_t * | data |
| Data bytes. | |
| protobuf_c_boolean | must_free_data |
Whether data must be freed. | |
| ProtobufCAllocator * | allocator |
| Allocator to use. | |
Simple buffer "subclass" of ProtobufCBuffer.
A ProtobufCBufferSimple object is declared on the stack and uses a scratch buffer provided by the user for the initial allocation. It performs exponential resizing, using dynamically allocated memory. A ProtobufCBufferSimple object can be created and used as follows:
buffer can now be used with protobuf_c_message_pack_to_buffer(). Once a message has been serialized to a ProtobufCBufferSimple object, the serialized data bytes can be accessed from the .data field.
To free the memory allocated by a ProtobufCBufferSimple object, if any, call PROTOBUF_C_BUFFER_SIMPLE_CLEAR() on the object, for example:
| ProtobufCBuffer ProtobufCBufferSimple::base |
"Base class".
| size_t ProtobufCBufferSimple::alloced |
Number of bytes allocated in data.
| size_t ProtobufCBufferSimple::len |
Number of bytes currently stored in data.
| uint8_t* ProtobufCBufferSimple::data |
Data bytes.
| protobuf_c_boolean ProtobufCBufferSimple::must_free_data |
Whether data must be freed.
| ProtobufCAllocator* ProtobufCBufferSimple::allocator |
Allocator to use.
May be NULL to indicate the system allocator.