libcollection 0.6.2
Loading...
Searching...
No Matches
Macros | Functions
QUEUE interface

Macros

#define COL_CLASS_QUEUE   40000
 Class for the queue object.
 
#define COL_NAME_QUEUE   "queue"
 All queues use this name as the name of the collection.
 

Functions

int col_create_queue (struct collection_item **queue)
 Create queue.
 
void col_destroy_queue (struct collection_item *queue)
 Destroy queue.
 
int col_enqueue_str_property (struct collection_item *queue, const char *property, const char *string, int length)
 Add string to the queue.
 
int col_enqueue_binary_property (struct collection_item *queue, const char *property, void *binary_data, int length)
 Add binary value to the queue.
 
int col_enqueue_int_property (struct collection_item *queue, const char *property, int32_t number)
 Add integer value to the queue.
 
int col_enqueue_unsigned_property (struct collection_item *queue, const char *property, uint32_t number)
 Add unsigned value to the queue.
 
int col_enqueue_long_property (struct collection_item *queue, const char *property, int64_t number)
 Add long integer value to the queue.
 
int col_enqueue_ulong_property (struct collection_item *queue, const char *property, uint64_t number)
 Add unsigned long value to the queue.
 
int col_enqueue_double_property (struct collection_item *queue, const char *property, double number)
 Add floating point value to the queue.
 
int col_enqueue_bool_property (struct collection_item *queue, const char *property, unsigned char logical)
 Add Boolean value to the queue.
 
int col_enqueue_any_property (struct collection_item *queue, const char *property, int type, void *data, int length)
 Add value of any type to the queue.
 
int col_enqueue_item (struct collection_item *queue, struct collection_item *item)
 Push item into the queue.
 
int col_dequeue_item (struct collection_item *queue, struct collection_item **item)
 Get item from the queue.
 

Detailed Description

Queue interface is a wrapper on top of the COLLECTION interface interface. It implements a queue using a collection object.

Function Documentation

◆ col_create_queue()

int col_create_queue ( struct collection_item **  queue)

Create queue.

Function that creates a queue object.

Parameters
[out]queueNewly created queue object.
Returns
0 - Queue was created successfully.
ENOMEM - No memory.

◆ col_destroy_queue()

void col_destroy_queue ( struct collection_item queue)

Destroy queue.

Function that destroys a queue object.

Parameters
[in]queueQueue object to destroy.

◆ col_enqueue_str_property()

int col_enqueue_str_property ( struct collection_item queue,
const char *  property,
const char *  string,
int  length 
)

Add string to the queue.

Parameters
[in]queueQueue 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 added successfully.
ENOMEM - No memory.
EINVAL - Invalid characters in the property name. Value argument is invalid in some way.
EMSGSIZE - Property name is too long.

◆ col_enqueue_binary_property()

int col_enqueue_binary_property ( struct collection_item queue,
const char *  property,
void *  binary_data,
int  length 
)

Add binary value to the queue.

Parameters
[in]queueQueue 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 added successfully.
ENOMEM - No memory.
EINVAL - Invalid argument.
EMSGSIZE - Property name is too long.

◆ col_enqueue_int_property()

int col_enqueue_int_property ( struct collection_item queue,
const char *  property,
int32_t  number 
)

Add integer value to the queue.

Parameters
[in]queueQueue 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 added successfully.
ENOMEM - No memory.
EINVAL - Invalid argument.
EMSGSIZE - Property name is too long.

◆ col_enqueue_unsigned_property()

int col_enqueue_unsigned_property ( struct collection_item queue,
const char *  property,
uint32_t  number 
)

Add unsigned value to the queue.

Parameters
[in]queueQueue 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 added successfully.
ENOMEM - No memory.
EINVAL - Invalid argument.
EMSGSIZE - Property name is too long.

◆ col_enqueue_long_property()

int col_enqueue_long_property ( struct collection_item queue,
const char *  property,
int64_t  number 
)

Add long integer value to the queue.

Parameters
[in]queueQueue 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 added successfully.
ENOMEM - No memory.
EINVAL - Invalid argument.
EMSGSIZE - Property name is too long.

◆ col_enqueue_ulong_property()

int col_enqueue_ulong_property ( struct collection_item queue,
const char *  property,
uint64_t  number 
)

Add unsigned long value to the queue.

Parameters
[in]queueQueue 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 added successfully.
ENOMEM - No memory.
EINVAL - Invalid argument.
EMSGSIZE - Property name is too long.

◆ col_enqueue_double_property()

int col_enqueue_double_property ( struct collection_item queue,
const char *  property,
double  number 
)

Add floating point value to the queue.

Parameters
[in]queueQueue 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 added successfully.
ENOMEM - No memory.
EINVAL - Invalid argument.
EMSGSIZE - Property name is too long.

◆ col_enqueue_bool_property()

int col_enqueue_bool_property ( struct collection_item queue,
const char *  property,
unsigned char  logical 
)

Add Boolean value to the queue.

Parameters
[in]queueQueue 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 added successfully.
ENOMEM - No memory.
EINVAL - Invalid argument.
EMSGSIZE - Property name is too long.

◆ col_enqueue_any_property()

int col_enqueue_any_property ( struct collection_item queue,
const char *  property,
int  type,
void *  data,
int  length 
)

Add value of any type to the queue.

Parameters
[in]queueQueue 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 added successfully.
ENOMEM - No memory.
EINVAL - Invalid characters in the property name. Value argument is invalid in some way.
EMSGSIZE - Property name is too long.

◆ col_enqueue_item()

int col_enqueue_item ( struct collection_item queue,
struct collection_item item 
)

Push item into the queue.

Parameters
[in]queueQueue object.
[in]itemItem to push.
Returns
0 - Item was added successfully.
ENOMEM - No memory.
EINVAL - Invalid argument.

◆ col_dequeue_item()

int col_dequeue_item ( struct collection_item queue,
struct collection_item **  item 
)

Get item from the queue.

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