cta_tree.h File Reference
Interface description of the COSTA tree component.
More...
#include "cta_system.h"
#include "cta_handles.h"
#include "cta_datatypes.h"
Go to the source code of this file.
Typedefs |
typedef CTA_Handle | CTA_Tree |
Functions |
CTAEXPORT int | CTA_Tree_Create (CTA_Tree *htree) |
| Create a new COSTA tree instance.
|
CTAEXPORT int | CTA_Tree_Free (CTA_Tree *htree) |
| Free the COSTA tree instance.
|
CTAEXPORT int | CTA_Tree_AddHandle (CTA_Tree htree, const char *name, CTA_Handle hitem) |
| Add a COSTA handle to the COSTA tree.
|
CTAEXPORT int | CTA_Tree_CountHandles (CTA_Tree htree, CTA_String path, int *count) |
| Count the number of COSTA handles specified by the given path.
|
CTAEXPORT int | CTA_Tree_CountHandlesStr (CTA_Tree htree, char *path, int *count) |
| Count the number of COSTA handles specified by the given path.
|
CTAEXPORT int | CTA_Tree_GetHandle (CTA_Tree htree, CTA_String path, CTA_Handle *hitem) |
| Get a COSTA handle from the COSTA tree (by path).
|
CTAEXPORT int | CTA_Tree_GetValue (CTA_Tree htree, CTA_String path, void *value, CTA_Datatype datatype) |
| Get the value of a COSTA handle from the COSTA tree (by path).
|
CTAEXPORT int | CTA_Tree_GetHandleStr (CTA_Tree htree, char *str, CTA_Handle *hitem) |
| Get a COSTA handle from the COSTA tree (by path).
|
CTAEXPORT int | CTA_Tree_GetValueStr (CTA_Tree htree, char *str, void *value, CTA_Datatype datatype) |
| Get the value of a COSTA handle from the COSTA tree (by path).
|
CTAEXPORT int | CTA_Tree_CountItems (CTA_Tree htree, int *count) |
| Count the number of elements on the current level of the COSTA tree.
|
CTAEXPORT int | CTA_Tree_GetItem (CTA_Tree htree, int index, CTA_Handle *hitem) |
| Get a handle (by index) on the current level of the COSTA tree.
|
CTAEXPORT int | CTA_Tree_GetItemValue (CTA_Tree htree, int index, void *value, CTA_Datatype datatype) |
| Get the value of a COSTA handle from the COSTA tree (by index).
|
CTAEXPORT int | CTA_Tree_Print (CTA_Tree htree) |
| Print a COSTA tree to STDOUT.
|
Detailed Description
Interface description of the COSTA tree component.
Store data in a CTA_Tree object in tree form. Access the members in the following way: branch1\subbranch\member or branch1/branch2/member
Definition in file cta_tree.h.
Typedef Documentation
Function Documentation
Add a COSTA handle to the COSTA tree.
- Note:
- Parameters:
-
| htree | IO handle of the tree object (parent) |
| name | I name of the COSTA item |
| hitem | I handle of the COSTA item to add (do not free the object after adding it to the tree) |
- Returns:
- CTA_OK if successful
Count the number of COSTA handles specified by the given path.
- Parameters:
-
| htree | I handle of the tree object |
| path | I path of the item, separated by / or \ |
| count | O receives the number of items found |
- Returns:
- CTA_OK if successful or CTA_ITEM_NOT_FOUND in case of not found
CTAEXPORT int CTA_Tree_CountHandlesStr |
( |
CTA_Tree |
htree, |
|
|
char * |
path, |
|
|
int * |
count | |
|
) |
| | |
Count the number of COSTA handles specified by the given path.
- Parameters:
-
| htree | I handle of the tree object |
| path | I path of the item, separated by / or \ |
| count | O receives the number of items found |
- Returns:
- CTA_OK if successful or CTA_ITEM_NOT_FOUND in case of not found
CTAEXPORT int CTA_Tree_CountItems |
( |
CTA_Tree |
htree, |
|
|
int * |
count | |
|
) |
| | |
Count the number of elements on the current level of the COSTA tree.
- Parameters:
-
| htree | I handle of the tree level |
| count | O receives the number of elements on the current tree level |
- Returns:
- CTA_OK if successful
CTAEXPORT int CTA_Tree_Create |
( |
CTA_Tree * |
htree |
) |
|
Create a new COSTA tree instance.
- Note:
- Parameters:
-
| htree | O receives handle of created tree |
- Returns:
- CTA_OK if successful
CTAEXPORT int CTA_Tree_Free |
( |
CTA_Tree * |
htree |
) |
|
Free the COSTA tree instance.
- Note:
- Parameters:
-
| htree | IO handle of the tree instance, replaced by CTA_NULL on return |
- Returns:
- CTA_OK if successful
Get a COSTA handle from the COSTA tree (by path).
- Note:
- In case of trees with default values, returns the default value.
-
The returned handle must not be freed.
- Parameters:
-
| htree | I handle of the tree object |
| path | I path of the item, separated by / or \ |
| hitem | O receives the handle of the COSTA item, or CTA_NULL in case not found, do not free this handle. |
- Returns:
- CTA_OK if successful or CTA_ITEM_NOT_FOUND in case of not found
Get a COSTA handle from the COSTA tree (by path).
- Note:
- In case of trees with default values, returns the default value.
-
The returned handle must not be freed.
- Parameters:
-
| htree | I handle of the tree object |
| str | I C string describing path of the item, separated by / or \ |
| hitem | O receives the handle of the COSTA item, or CTA_NULL in case of not found, do not free this handle |
- Returns:
- CTA_OK if successful or CTA_ITEM_NOT_FOUND in case of not found
Get a handle (by index) on the current level of the COSTA tree.
- Parameters:
-
| htree | I handle of the tree level |
| index | I index of the item to return, 1 <= index <= CTA_Tree_CountItems() |
| hitem | O receives handle of the item at given index |
- Returns:
- CTA_OK if successful
CTAEXPORT int CTA_Tree_GetItemValue |
( |
CTA_Tree |
htree, |
|
|
int |
index, |
|
|
void * |
value, |
|
|
CTA_Datatype |
datatype | |
|
) |
| | |
Get the value of a COSTA handle from the COSTA tree (by index).
- Note:
- In case of trees with default values, returns the default value.
- Parameters:
-
| htree | I handle of the tree instance |
| index | I index of the item |
| value | O receives value of the COSTA item, or CTA_NULL in case of not found |
| datatype | I data type of the value specified |
- Returns:
- CTA_OK if successful or CTA_ITEM_NOT_FOUND in case not found
Get the value of a COSTA handle from the COSTA tree (by path).
- Note:
- In case of trees with default values, returns the default value.
- Parameters:
-
| htree | I handle of the tree object |
| path | I COSTA string describing path of the item, separated by / or \ |
| value | O receives the value of the COSTA item, or CTA_NULL in case of not found |
| datatype | I data type of parameter value, must be the same as item in tree |
- Returns:
- CTA_OK if successful or CTA_ITEM_NOT_FOUND in case of not found
CTAEXPORT int CTA_Tree_GetValueStr |
( |
CTA_Tree |
htree, |
|
|
char * |
str, |
|
|
void * |
value, |
|
|
CTA_Datatype |
datatype | |
|
) |
| | |
Get the value of a COSTA handle from the COSTA tree (by path).
- Note:
- In case of trees with default values, returns the default value.
- Parameters:
-
| htree | I handle of the tree instance |
| str | I C string describing path of the item, separated by / or \ |
| value | O receives the value of the COSTA item, or CTA_NULL in case of not found |
| datatype | I data type of the value specified |
- Returns:
- CTA_OK if successful or CTA_ITEM_NOT_FOUND in case of not found
CTAEXPORT int CTA_Tree_Print |
( |
CTA_Tree |
htree |
) |
|
Print a COSTA tree to STDOUT.
- Note:
- Parameters:
-
| htree | I handle of the tree |
- Returns:
- CTA_OK if successful