core/include/set.h File Reference

Optimized set of items. More...

Defines

#define OS_SET_MAX_ITEMS   16
 Maximum items in a set.
#define OS_SET_EMPTY_ID   0xFF
 The value returned from minimum test when the set is empty.
#define os_set_add(set, item_id)   DOC_HIDDEN
 This macro adds item to the set.
#define os_set_remove(set, item_id)   DOC_HIDDEN
 This macro removes item from the set.
#define os_set_is(set, item_id)   DOC_HIDDEN
 This macro checks if the item is present in the set.
#define os_set_is_empty(set)   DOC_HIDDEN
 This macro checks if the set is empty.

Functions

unsigned char os_set_min (os_set_t set)
 Finds item with minimum identifier present in the set.

Detailed Description

Optimized set of items.

Author:
Piotr Romaniuk, (c) ELESOFTROM
Version:
1.0 Feb 4, 2011

This type is used to store the set of items.

Note:
1. Maximum 16 items can be stored inside.
2. Items must be distinguished and appear only once in the set.
3. Items are identified by identifiers 0...15

Define Documentation

#define os_set_add (   set,
  item_id 
)    DOC_HIDDEN

This macro adds item to the set.

The Macro performs add operator on the set.

Warning:
It is not protected from concurrent access. Use only in safe sections.
Parameters:
[in,out]setthe set of items.
[in]item_iditem identification (number 0...15)
Returns:
not used, but returns set contents.
#define os_set_is (   set,
  item_id 
)    DOC_HIDDEN

This macro checks if the item is present in the set.

Parameters:
[in]setthe set of items.
[in]item_iditem identification (number 0...15)
Returns:
logical value of the test
#define os_set_is_empty (   set)    DOC_HIDDEN

This macro checks if the set is empty.

The macro can be used in conditional commands like if.

Parameters:
[in]setthe set of items.
Returns:
logical value of the test.
#define os_set_remove (   set,
  item_id 
)    DOC_HIDDEN

This macro removes item from the set.

The Macro performs delete operator on the set.

Warning:
It is not protected from concurrent access. Use only in safe sections.
Parameters:
[in,out]setthe set of items.
[in]item_iditem identification (number 0...15)
Returns:
not used, but returns set contents.

Function Documentation

unsigned char os_set_min ( os_set_t  set)

Finds item with minimum identifier present in the set.

The function implements min( ) operator on the set.

Parameters:
[in]setthe set of items.
Returns:
identifier of the searched item (0...15) or OS_SET_EMPTY_ID if the set is empty.
Warning:
Use it only in safe sections (when state of the set is frozen during the function execution)