libcollection  0.5.0
Macros | Functions
STACK interface

Macros

#define COL_CLASS_STACK   30000
 Class for the stack object.
 
#define COL_NAME_STACK   "stack"
 All stacks use this name as the name of the collection.
 

Functions

int col_create_stack (struct collection_item **stack)
 Create stack. More...
 
void col_destroy_stack (struct collection_item *stack)
 Destroy stack. More...
 
int col_push_str_property (struct collection_item *stack, const char *property, const char *string, int length)
 Push string to the stack. More...
 
int col_push_binary_property (struct collection_item *stack, const char *property, void *binary_data, int length)
 Push binary value to the stack. More...
 
int col_push_int_property (struct collection_item *stack, const char *property, int32_t number)
 Push integer value to the stack. More...
 
int col_push_unsigned_property (struct collection_item *stack, const char *property, uint32_t number)
 Push unsigned value to the stack. More...
 
int col_push_long_property (struct collection_item *stack, const char *property, int64_t number)
 Push long integer value to the stack. More...
 
int col_push_ulong_property (struct collection_item *stack, const char *property, uint64_t number)
 Push unsigned long value to the stack. More...
 
int col_push_double_property (struct collection_item *stack, const char *property, double number)
 Push floating point value to the stack. More...
 
int col_push_bool_property (struct collection_item *stack, const char *property, unsigned char logical)
 Push Boolean value to the stack. More...
 
int col_push_any_property (struct collection_item *stack, const char *property, int type, void *data, int length)
 Push value of any type to the stack. More...
 
int col_push_item (struct collection_item *stack, struct collection_item *item)
 Push item into the stack. More...
 
int col_pop_item (struct collection_item *stack, struct collection_item **item)
 Pop item from the stack. More...
 

Detailed Description

Stack interface is a wrapper on top of the COLLECTION interface interface. It implements a stack using a collection object.

Function Documentation

int col_create_stack ( struct collection_item **  stack)

Create stack.

Function that creates a stack object.

Parameters
[out]stackNewly created stack object.
Returns
0 - Stack was created successfully.
ENOMEM - No memory.
void col_destroy_stack ( struct collection_item stack)

Destroy stack.

Function that destroys a stack object.

Parameters
[in]stackStack object to destroy.
int col_push_str_property ( struct collection_item stack,
const char *  property,
const char *  string,
int  length 
)

Push string to the stack.

Parameters
[in]stackStack object.
[in]propertyName of the property.
Name should consist of the ASCII characters with codes non less than space. Exclamation mark character is a special character and can't be used in name of collection or property.
Maximum allowed length is defined at compile time. The default value is 64k.
[in]stringNull terminated string to add.
[in]lengthLength of the string. Should include the length of the terminating 0. If the length is shorter than the full string the string will be truncated. If the length is longer than the actual string there might be garbage at end of the actual string. Library will always properly NULL terminate the string at the given position dictated by length but in no way will inspect the validity of the passed in data. This is left to the calling application.
Returns
0 - Property was pushed successfully.
ENOMEM - No memory.
EINVAL - Invalid characters in the property name. Value argument is invalid in some way.
EMSGSIZE - Property name is too long.
int col_push_binary_property ( struct collection_item stack,
const char *  property,
void *  binary_data,
int  length 
)

Push binary value to the stack.

Parameters
[in]stackStack object.
[in]propertyName of the property.
Name should consist of the ASCII characters with codes non less than space. Exclamation mark character is a special character and can't be used in name of collection or property.
Maximum allowed length is defined at compile time. The default value is 64k.
[in]binary_dataData to add.
[in]lengthLength of the binary data.
Returns
0 - Property was pushed successfully.
ENOMEM - No memory.
EINVAL - Invalid argument.
EMSGSIZE - Property name is too long.
int col_push_int_property ( struct collection_item stack,
const char *  property,
int32_t  number 
)

Push integer value to the stack.

Parameters
[in]stackStack object.
[in]propertyName of the property.
Name should consist of the ASCII characters with codes non less than space. Exclamation mark character is a special character and can't be used in name of collection or property.
Maximum allowed length is defined at compile time. The default value is 64k.
[in]numberValue to add.
Returns
0 - Property was pushed successfully.
ENOMEM - No memory.
EINVAL - Invalid argument.
EMSGSIZE - Property name is too long.
int col_push_unsigned_property ( struct collection_item stack,
const char *  property,
uint32_t  number 
)

Push unsigned value to the stack.

Parameters
[in]stackStack object.
[in]propertyName of the property.
Name should consist of the ASCII characters with codes non less than space. Exclamation mark character is a special character and can't be used in name of collection or property.
Maximum allowed length is defined at compile time. The default value is 64k.
[in]numberValue to add.
Returns
0 - Property was pushed successfully.
ENOMEM - No memory.
EINVAL - Invalid argument.
EMSGSIZE - Property name is too long.
int col_push_long_property ( struct collection_item stack,
const char *  property,
int64_t  number 
)

Push long integer value to the stack.

Parameters
[in]stackStack object.
[in]propertyName of the property.
Name should consist of the ASCII characters with codes non less than space. Exclamation mark character is a special character and can't be used in name of collection or property.
Maximum allowed length is defined at compile time. The default value is 64k.
[in]numberValue to add.
Returns
0 - Property was pushed successfully.
ENOMEM - No memory.
EINVAL - Invalid argument.
EMSGSIZE - Property name is too long.
int col_push_ulong_property ( struct collection_item stack,
const char *  property,
uint64_t  number 
)

Push unsigned long value to the stack.

Parameters
[in]stackStack object.
[in]propertyName of the property.
Name should consist of the ASCII characters with codes non less than space. Exclamation mark character is a special character and can't be used in name of collection or property.
Maximum allowed length is defined at compile time. The default value is 64k.
[in]numberValue to add.
Returns
0 - Property was pushed successfully.
ENOMEM - No memory.
EINVAL - Invalid argument.
EMSGSIZE - Property name is too long.
int col_push_double_property ( struct collection_item stack,
const char *  property,
double  number 
)

Push floating point value to the stack.

Parameters
[in]stackStack object.
[in]propertyName of the property.
Name should consist of the ASCII characters with codes non less than space. Exclamation mark character is a special character and can't be used in name of collection or property.
Maximum allowed length is defined at compile time. The default value is 64k.
[in]numberValue to add.
Returns
0 - Property was pushed successfully.
ENOMEM - No memory.
EINVAL - Invalid argument.
EMSGSIZE - Property name is too long.
int col_push_bool_property ( struct collection_item stack,
const char *  property,
unsigned char  logical 
)

Push Boolean value to the stack.

Parameters
[in]stackStack object.
[in]propertyName of the property.
Name should consist of the ASCII characters with codes non less than space. Exclamation mark character is a special character and can't be used in name of collection or property.
Maximum allowed length is defined at compile time. The default value is 64k.
[in]logicalValue to add.
Returns
0 - Property was pushed successfully.
ENOMEM - No memory.
EINVAL - Invalid argument.
EMSGSIZE - Property name is too long.
int col_push_any_property ( struct collection_item stack,
const char *  property,
int  type,
void *  data,
int  length 
)

Push value of any type to the stack.

Parameters
[in]stackStack object.
[in]propertyName of the property.
Name should consist of the ASCII characters with codes non less than space. Exclamation mark character is a special character and can't be used in name of collection or property.
Maximum allowed length is defined at compile time. The default value is 64k.
[in]typeType to use.
[in]dataData to add.
[in]lengthLength of the data.
Returns
0 - Property was pushed successfully.
ENOMEM - No memory.
EINVAL - Invalid characters in the property name. Value argument is invalid in some way.
EMSGSIZE - Property name is too long.
int col_push_item ( struct collection_item stack,
struct collection_item item 
)

Push item into the stack.

Parameters
[in]stackStack object.
[in]itemItem to push.
Returns
0 - Item was pushed successfully.
ENOMEM - No memory.
EINVAL - Invalid argument.
int col_pop_item ( struct collection_item stack,
struct collection_item **  item 
)

Pop item from the stack.

Parameters
[in]stackStack object.
[out]itemVariable receives the value of the retrieved item. Will be set to NULL if there are no more items in the stack.
Returns
0 - No internal issues detected.
ENOMEM - No memory.
EINVAL - Invalid argument.