Serialbox  2.2.0
Data serialization library and tools for C/C++, Python and Fortran
Meta-info methods

Classes

struct  serialboxMetainfoElementInfo_t
 Data-structure to query the info of the elements (keys and corresponding types) in the meta-information. More...
 
SERIALBOX_API serialboxMetainfo_tserialboxMetainfoCreate (void)
 Construct an empty meta-information. More...
 
SERIALBOX_API serialboxMetainfo_tserialboxMetainfoCreateFromMetainfo (const serialboxMetainfo_t *other)
 Copy construct the meta-information. More...
 
SERIALBOX_API void serialboxMetainfoDestroy (serialboxMetainfo_t *metaInfo)
 Destroy the meta-information and deallocate all memory. More...
 
SERIALBOX_API int serialboxMetainfoGetSize (const serialboxMetainfo_t *metaInfo)
 Get number of elemenets in the meta-information. More...
 
SERIALBOX_API int serialboxMetainfoIsEmpty (const serialboxMetainfo_t *metaInfo)
 Check if meta information is empty. More...
 
SERIALBOX_API void serialboxMetainfoClear (serialboxMetainfo_t *metaInfo)
 All the elements in the Metainfo are dropped: their destructors are called, and they are removed from the container, leaving it with a size of 0. More...
 
SERIALBOX_API int serialboxMetainfoEqual (const serialboxMetainfo_t *m1, const serialboxMetainfo_t *m2)
 Check if Metainfo m1 is equal to Metainfo m2 More...
 
SERIALBOX_API int serialboxMetainfoHasKey (const serialboxMetainfo_t *metaInfo, const char *key)
 Check if and element with key key exists. More...
 
SERIALBOX_API enum serialboxTypeID serialboxMetainfoGetTypeIDOfKey (const serialboxMetainfo_t *metaInfo, const char *key)
 Get TypeID of element with key key More...
 
SERIALBOX_API char * serialboxMetainfoToString (const serialboxMetainfo_t *metaInfo)
 Convert to string. More...
 
SERIALBOX_API serialboxMetainfoElementInfo_tserialboxMetainfoCreateElementInfo (const serialboxMetainfo_t *metaInfo)
 Allocate and intialize the element-info. More...
 
SERIALBOX_API void serialboxMetainfoDestroyElementInfo (serialboxMetainfoElementInfo_t *elementInfo)
 Destroy the element-information and deallocate all memory. More...
 
SERIALBOX_API int serialboxMetainfoDeleteKey (serialboxMetainfo_t *metaInfo, const char *key)
 Delete element given by key More...
 
SERIALBOX_API int serialboxMetainfoAddBoolean (serialboxMetainfo_t *metaInfo, const char *key, serialboxBoolean_t value)
 Add a new element in the form key=value pair to the meta-information. More...
 
SERIALBOX_API int serialboxMetainfoAddInt32 (serialboxMetainfo_t *metaInfo, const char *key, serialboxInt32_t value)
 
SERIALBOX_API int serialboxMetainfoAddInt64 (serialboxMetainfo_t *metaInfo, const char *key, serialboxInt64_t value)
 
SERIALBOX_API int serialboxMetainfoAddFloat32 (serialboxMetainfo_t *metaInfo, const char *key, serialboxFloat32_t value)
 
SERIALBOX_API int serialboxMetainfoAddFloat64 (serialboxMetainfo_t *metaInfo, const char *key, serialboxFloat64_t value)
 
SERIALBOX_API int serialboxMetainfoAddString (serialboxMetainfo_t *metaInfo, const char *key, const char *value)
 
SERIALBOX_API int serialboxMetainfoAddArrayOfBoolean (serialboxMetainfo_t *metaInfo, const char *key, const serialboxArrayOfBoolean_t *array)
 Add a new element in the form key=[array] to the meta-information. More...
 
SERIALBOX_API int serialboxMetainfoAddArrayOfInt32 (serialboxMetainfo_t *metaInfo, const char *key, const serialboxArrayOfInt32_t *array)
 
SERIALBOX_API int serialboxMetainfoAddArrayOfInt64 (serialboxMetainfo_t *metaInfo, const char *key, const serialboxArrayOfInt64_t *array)
 
SERIALBOX_API int serialboxMetainfoAddArrayOfFloat32 (serialboxMetainfo_t *metaInfo, const char *key, const serialboxArrayOfFloat32_t *array)
 
SERIALBOX_API int serialboxMetainfoAddArrayOfFloat64 (serialboxMetainfo_t *metaInfo, const char *key, const serialboxArrayOfFloat64_t *array)
 
SERIALBOX_API int serialboxMetainfoAddArrayOfString (serialboxMetainfo_t *metaInfo, const char *key, const serialboxArrayOfString_t *array)
 
SERIALBOX_API serialboxBoolean_t serialboxMetainfoGetBoolean (const serialboxMetainfo_t *metaInfo, const char *key)
 Convert value of element with key key to type T (where T is given by the suffix of thefunction. More...
 
SERIALBOX_API serialboxInt32_t serialboxMetainfoGetInt32 (const serialboxMetainfo_t *metaInfo, const char *key)
 
SERIALBOX_API serialboxInt64_t serialboxMetainfoGetInt64 (const serialboxMetainfo_t *metaInfo, const char *key)
 
SERIALBOX_API serialboxFloat32_t serialboxMetainfoGetFloat32 (const serialboxMetainfo_t *metaInfo, const char *key)
 
SERIALBOX_API serialboxFloat64_t serialboxMetainfoGetFloat64 (const serialboxMetainfo_t *metaInfo, const char *key)
 
SERIALBOX_API serialboxString_t serialboxMetainfoGetString (const serialboxMetainfo_t *metaInfo, const char *key)
 
SERIALBOX_API serialboxArrayOfBoolean_tserialboxMetainfoGetArrayOfBoolean (const serialboxMetainfo_t *metaInfo, const char *key)
 Convert value of element with key key to a newly allocated array array of type T More...
 
SERIALBOX_API serialboxArrayOfInt32_tserialboxMetainfoGetArrayOfInt32 (const serialboxMetainfo_t *metaInfo, const char *key)
 
SERIALBOX_API serialboxArrayOfInt64_tserialboxMetainfoGetArrayOfInt64 (const serialboxMetainfo_t *metaInfo, const char *key)
 
SERIALBOX_API serialboxArrayOfFloat32_tserialboxMetainfoGetArrayOfFloat32 (const serialboxMetainfo_t *metaInfo, const char *key)
 
SERIALBOX_API serialboxArrayOfFloat64_tserialboxMetainfoGetArrayOfFloat64 (const serialboxMetainfo_t *metaInfo, const char *key)
 
SERIALBOX_API serialboxArrayOfString_tserialboxMetainfoGetArrayOfString (const serialboxMetainfo_t *metaInfo, const char *key)
 

Detailed Description

Function Documentation

◆ serialboxMetainfoAddArrayOfBoolean()

SERIALBOX_API int serialboxMetainfoAddArrayOfBoolean ( serialboxMetainfo_t metaInfo,
const char *  key,
const serialboxArrayOfBoolean_t array 
)

Add a new element in the form key=[array] to the meta-information.

The element is inserted only if its key is not equivalent to the key of any other element already in the meta-information struct (i.e keys must be unique).

Parameters
metaInfoMeta-information to use
keyKey of the new element
arrayArray to be copied to the value of the new element
Returns
0 if the element was inserted successfully, 1 otherwise

◆ serialboxMetainfoAddBoolean()

SERIALBOX_API int serialboxMetainfoAddBoolean ( serialboxMetainfo_t metaInfo,
const char *  key,
serialboxBoolean_t  value 
)

Add a new element in the form key=value pair to the meta-information.

The element is inserted only if its key is not equivalent to the key of any other element already in the meta-information struct (i.e keys must be unique).

Parameters
metaInfoMeta-information to use
keyKey of the new element
valueObject to be copied to the value of the new element
Returns
0 if the element was inserted successfully, 1 otherwise

◆ serialboxMetainfoClear()

SERIALBOX_API void serialboxMetainfoClear ( serialboxMetainfo_t metaInfo)

All the elements in the Metainfo are dropped: their destructors are called, and they are removed from the container, leaving it with a size of 0.

Parameters
metaInfoMeta-information to use

Definition at line 75 of file Metainfo.cpp.

◆ serialboxMetainfoCreate()

SERIALBOX_API serialboxMetainfo_t* serialboxMetainfoCreate ( void  )

Construct an empty meta-information.

Returns
refrence pointer to the newly constructed meta-information or NULL if an error occurred

Definition at line 25 of file Metainfo.cpp.

◆ serialboxMetainfoCreateElementInfo()

SERIALBOX_API serialboxMetainfoElementInfo_t* serialboxMetainfoCreateElementInfo ( const serialboxMetainfo_t metaInfo)

Allocate and intialize the element-info.

To free the data-structure use serialboxMetainfoDestroyElementInfo.

Parameters
metaInfoMeta-information to use
Returns
allocated and initialized serialboxMetainfoElementInfo_t

Definition at line 111 of file Metainfo.cpp.

◆ serialboxMetainfoCreateFromMetainfo()

SERIALBOX_API serialboxMetainfo_t* serialboxMetainfoCreateFromMetainfo ( const serialboxMetainfo_t other)

Copy construct the meta-information.

Parameters
otherMetainfo to copy from
Returns
refrence pointer to the newly constructed meta-information or NULL if an error occurred

Definition at line 38 of file Metainfo.cpp.

◆ serialboxMetainfoDeleteKey()

SERIALBOX_API int serialboxMetainfoDeleteKey ( serialboxMetainfo_t metaInfo,
const char *  key 
)

Delete element given by key

Parameters
metaInfoMeta-information to use
keyKey of element to delete
Returns
1 if element was deleted, 0 otherwise

Definition at line 148 of file Metainfo.cpp.

◆ serialboxMetainfoDestroy()

SERIALBOX_API void serialboxMetainfoDestroy ( serialboxMetainfo_t metaInfo)

Destroy the meta-information and deallocate all memory.

Parameters
metaInfoPointer to meta-information to use

Definition at line 52 of file Metainfo.cpp.

◆ serialboxMetainfoDestroyElementInfo()

SERIALBOX_API void serialboxMetainfoDestroyElementInfo ( serialboxMetainfoElementInfo_t elementInfo)

Destroy the element-information and deallocate all memory.

Parameters
elementInfoElement-information to deallcate

Definition at line 133 of file Metainfo.cpp.

◆ serialboxMetainfoEqual()

SERIALBOX_API int serialboxMetainfoEqual ( const serialboxMetainfo_t m1,
const serialboxMetainfo_t m2 
)

Check if Metainfo m1 is equal to Metainfo m2

Parameters
m1First Metainfo to use
m2Second Metainfo to use
Returns
1 if m1 == m2, 0 otherwise

Definition at line 80 of file Metainfo.cpp.

◆ serialboxMetainfoGetArrayOfBoolean()

SERIALBOX_API serialboxArrayOfBoolean_t* serialboxMetainfoGetArrayOfBoolean ( const serialboxMetainfo_t metaInfo,
const char *  key 
)

Convert value of element with key key to a newly allocated array array of type T

If the type T of the elements is different than the internally stored type, the function does its best to convert the individual elements to T in a meaningful way.

The allocated array should be freed using the corresponding serialboxArrayOfXDestroy methods.

Parameters
metaInfoMeta-information to use
keyKey of the element
Returns
pointer to the newly allocated array
Exceptions
FatalErrorKey key does not exist, conversion results in truncation of the value or conversions from primitive to array type

◆ serialboxMetainfoGetBoolean()

SERIALBOX_API serialboxBoolean_t serialboxMetainfoGetBoolean ( const serialboxMetainfo_t metaInfo,
const char *  key 
)

Convert value of element with key key to type T (where T is given by the suffix of thefunction.

If the type T is different than the internally stored type, the function does its best to convert the value to T in a meaningful way.

The string version will allocate a sufficiently large char buffer (using malloc()) which needs be freed by the user using free().

Parameters
metaInfoMeta-information to use
keyKey of the element
Returns
copy of the value of the element as type T
Exceptions
FatalErrorKey key does not exist, conversion results in truncation of the value

◆ serialboxMetainfoGetSize()

SERIALBOX_API int serialboxMetainfoGetSize ( const serialboxMetainfo_t metaInfo)

Get number of elemenets in the meta-information.

Parameters
metaInfoMeta-information to use
Returns
Number of elemenets in the meta-information

Definition at line 65 of file Metainfo.cpp.

◆ serialboxMetainfoGetTypeIDOfKey()

SERIALBOX_API enum serialboxTypeID serialboxMetainfoGetTypeIDOfKey ( const serialboxMetainfo_t metaInfo,
const char *  key 
)

Get TypeID of element with key key

Parameters
metaInfoMeta-information to use
keyKey used for lookup
Returns
TypeID of the element

Definition at line 91 of file Metainfo.cpp.

◆ serialboxMetainfoHasKey()

SERIALBOX_API int serialboxMetainfoHasKey ( const serialboxMetainfo_t metaInfo,
const char *  key 
)

Check if and element with key key exists.

Parameters
metaInfoMeta-information to use
keyKey to be searched for
Returns
1 if elements exists, 0 otherwise

Definition at line 86 of file Metainfo.cpp.

◆ serialboxMetainfoIsEmpty()

SERIALBOX_API int serialboxMetainfoIsEmpty ( const serialboxMetainfo_t metaInfo)

Check if meta information is empty.

Parameters
metaInfoMeta-information to use
Returns
1 if empty, 0 otherwise

Definition at line 70 of file Metainfo.cpp.

◆ serialboxMetainfoToString()

SERIALBOX_API char* serialboxMetainfoToString ( const serialboxMetainfo_t metaInfo)

Convert to string.

The function will allocate a sufficiently large char buffer (using malloc()) which needs be freed by the user using free().

Parameters
metaInfoMeta-information to use
Returns
C-string representation of the meta-information

Definition at line 103 of file Metainfo.cpp.