libcollection 0.6.2
Loading...
Searching...
No Matches
Data Structures | Macros | Functions
TOOLS interface

Data Structures

struct  col_serial_data
 Structure is used to incrementaly serialize collection. More...
 

Macros

#define COL_TYPE_NAME_STRING   "string"
 Name used for string type.
 
#define COL_TYPE_NAME_BINARY   "bin"
 Name used for binary type.
 
#define COL_TYPE_NAME_INTEGER   "int"
 Name used for integer type.
 
#define COL_TYPE_NAME_UNSIGNED   "uint"
 Name used for unsigned integer type.
 
#define COL_TYPE_NAME_LONG   "long"
 Name used for long type.
 
#define COL_TYPE_NAME_ULONG   "ulong"
 Name used for unsigned long type.
 
#define COL_TYPE_NAME_DOUBLE   "double"
 Name used for floating point type.
 
#define COL_TYPE_NAME_BOOL   "bool"
 Name used for boolean type.
 
#define COL_TYPE_NAME_UNKNOWN   "unknown"
 Name used for unknown type.
 
#define TEXT_COLLECTION   "SET"
 Literal used in the default serialization.
 
#define TEXT_COLLEN   3
 Length of the TEXT_COLLECTION literal.
 
#define BLOCK_SIZE   1024
 The data will be allocated in BLOCK_SIZE blocks during serialization.
 

Functions

int col_get_data_len (int type, int length)
 Calculate the potential size of the item.
 
int col_grow_buffer (struct col_serial_data *buf_data, int len)
 Grow serialization buffer.
 
int col_put_marker (struct col_serial_data *buf_data, const void *data, int len)
 Add special data to the serialization output.
 
int col_serialize (const char *property_in, int property_len_in, int type, void *data_in, int length_in, void *custom_data, int *dummy)
 Serialization of data callback.
 
int col_debug_handle (const char *property, int property_len, int type, void *data, int length, void *custom_data, int *dummy)
 Debug property callback.
 
int col_debug_item (struct collection_item *item)
 Convenience function to debug an item.
 
int col_debug_collection (struct collection_item *handle, int flag)
 Print collection for debugging purposes.
 
int col_print_collection (struct collection_item *handle)
 Print collection data.
 
int col_print_collection2 (struct collection_item *handle)
 Print collection data.
 
int col_print_item (struct collection_item *handle, const char *name)
 Find and print one property.
 
char ** col_collection_to_list (struct collection_item *handle, int *size, int *error)
 Convert collection to the array of properties.
 
void col_free_property_list (char **str_list)
 Free list of properties.
 

Detailed Description

Additional functions retaed to tracing, printing, debugging and serializaing collections.

Functions in this module are more a sample implementation than a part of the interface. There is a chance they will change over time.

Function Documentation

◆ col_get_data_len()

int col_get_data_len ( int type,
int length )

Calculate the potential size of the item.

Parameters
[in]typeType of the value.
[in]lengthLength of the value.
Returns
Maximum length the value would occupy when serialized.

◆ col_grow_buffer()

int col_grow_buffer ( struct col_serial_data * buf_data,
int len )

Grow serialization buffer.

Parameters
[in]buf_dataSerialization object.
[in]lenFor how much the serialization storage should be incrementally increased.
Returns
0 - Success.
ENOMEM - No memory.

◆ col_put_marker()

int col_put_marker ( struct col_serial_data * buf_data,
const void * data,
int len )

Add special data to the serialization output.

Parameters
[in]buf_dataSerialization object.
[in]dataPointer to special data.
[in]lenLength of the data to insert.
Returns
0 - Success.
ENOMEM - No memory.

◆ col_serialize()

int col_serialize ( const char * property_in,
int property_len_in,
int type,
void * data_in,
int length_in,
void * custom_data,
int * dummy )

Serialization of data callback.

Parameters
[in]property_inProperty to serialize.
[in]property_len_inLength of the property to serialize.
[in]typeType of the value.
[in]data_inValue to serialize.
[in]length_inLength of the value.
[in]custom_dataState data passed to callback. It is actually a serialization object.
[in]dummyNot used. It is here because the callback needs to comply to the functions signature.
Returns
0 - Success.
ENOMEM - No memory.

◆ col_debug_handle()

int col_debug_handle ( const char * property,
int property_len,
int type,
void * data,
int length,
void * custom_data,
int * dummy )

Debug property callback.

Parameters
[in]propertyProperty to debug.
[in]property_lenLength of the property to debug.
[in]typeType of the value.
[in]dataValue to serialize.
[in]lengthLength of the value.
[in]custom_dataState data passed to the callback.
[in]dummyNot used. It is here because the callback needs to comply to the functions signature.
Returns
0 - Success.
ENOMEM - No memory.

◆ col_debug_item()

int col_debug_item ( struct collection_item * item)
inline

Convenience function to debug an item.

Prints item internals.

Parameters
[in]itemItem to print.
Returns
0 - Success.
ENOMEM - No memory.

◆ col_debug_collection()

int col_debug_collection ( struct collection_item * handle,
int flag )

Print collection for debugging purposes.

Prints collection internals.

Parameters
[in]handleCollection to debug.
[in]flagSee traverse flags.
Returns
0 - Success.
ENOMEM - No memory.

◆ col_print_collection()

int col_print_collection ( struct collection_item * handle)

Print collection data.

Prints collection data. Uses traverse function to iterate through the collection.

Parameters
[in]handleCollection to print.
Returns
0 - Success.
ENOMEM - No memory.

◆ col_print_collection2()

int col_print_collection2 ( struct collection_item * handle)

Print collection data.

Prints collection data. Uses iterator to process the collection.

Parameters
[in]handleCollection to print.
Returns
0 - Success.
ENOMEM - No memory.

◆ col_print_item()

int col_print_item ( struct collection_item * handle,
const char * name )

Find and print one property.

Prints item data.

Parameters
[in]handleCollection to search.
[in]nameItem to find and print.
Returns
0 - Success.
ENOMEM - No memory.

◆ col_collection_to_list()

char ** col_collection_to_list ( struct collection_item * handle,
int * size,
int * error )

Convert collection to the array of properties.

Parameters
[in]handleCollection to convert.
[in]sizeWill receive the number of the strings in the array. Can be NULL if caller is not interested in the size of the array.
[in]errorWill receive error value if any. Can be NULL if the caller does not care about error codes.
  • 0 - Success.
  • ENOMEM - No memory.
Returns
List of strings that constitute the properties in the collection. Collection name is not included.

◆ col_free_property_list()

void col_free_property_list ( char ** str_list)

Free list of properties.

Parameters
[in]str_listList to free.