![]() |
smax-clib v1.0
A C/C++ client library for SMA-X
|
A set of utility functions for manipulating optional static metadata. More...
Functions | |
| XCoordinateSystem * | smaxCreateCoordinateSystem (int nAxis) |
| void | smaxDestroyCoordinateSystem (XCoordinateSystem *coords) |
| XCoordinateAxis * | smaxGetCoordinateAxis (const char *id, int n) |
| XCoordinateSystem * | smaxGetCoordinateSystem (const char *table, const char *key) |
| char * | smaxGetDescription (const char *table, const char *key) |
| char * | smaxGetUnits (const char *table, const char *key) |
| char * | smaxPullMeta (const char *meta, const char *table, const char *key, int *len) |
| double | smaxPullTime (const char *table, const char *key) |
| XType | smaxPullTypeDimension (const char *table, const char *key, int *ndim, int *sizes) |
| int | smaxPushMeta (const char *meta, const char *table, const char *key, const char *value) |
| int | smaxSetCoordinateAxis (const char *id, int n, const XCoordinateAxis *axis) |
| int | smaxSetCoordinateSystem (const char *table, const char *key, const XCoordinateSystem *coords) |
| int | smaxSetDescription (const char *table, const char *key, const char *description) |
| int | smaxSetUnits (const char *table, const char *key, const char *unit) |
A set of utility functions for manipulating optional static metadata.
| XCoordinateSystem * smaxCreateCoordinateSystem | ( | int | nAxis | ) |
Creates a coordinate system with the desired dimension, and standard Cartesian coordinates with no labels, or units specified (NULL).
| nAxis | Dimension of the coordiante system, i.e. number of axes. |
References XCoordinateSystem::axis, XCoordinateSystem::nAxis, and XCoordinateAxis::step.
| void smaxDestroyCoordinateSystem | ( | XCoordinateSystem * | coords | ) |
Deallocates a coordinate system structure.
| coords | Pointer to the coordinate system to discard. |
References XCoordinateSystem::axis.
| XCoordinateAxis * smaxGetCoordinateAxis | ( | const char * | id, |
| int | n ) |
Returns the n'th coordinate axis for a given SMA-X coordinate system table id.
| id | Fully qualified SMA-X coordinate system ID. |
| n | The (0-based) index of the coordinate axis |
References XCoordinateAxis::name, XCoordinateAxis::refIndex, XCoordinateAxis::refValue, smaxError(), smaxGetRedis(), XCoordinateAxis::step, and XCoordinateAxis::unit.
| XCoordinateSystem * smaxGetCoordinateSystem | ( | const char * | table, |
| const char * | key ) |
Returns the coordinate system, if any, associated to a given SMA-X variable.
| table | Hash table name. |
| key | Variable / field name in table. |
References XCoordinateSystem::axis, META_COORDS, XCoordinateSystem::nAxis, and smaxGetCoordinateAxis().
| char * smaxGetDescription | ( | const char * | table, |
| const char * | key ) |
Returns a concise description of a variable.
| table | Hash table name. |
| key | Variable / field name in table. |
References META_DESCRIPTION, and smaxPullMeta().
| char * smaxGetUnits | ( | const char * | table, |
| const char * | key ) |
Returns the physical unit name, if any, for the given variable.
| table | Hash table name. |
| key | Variable / field name in table. |
References META_UNIT, and smaxPullMeta().
| char * smaxPullMeta | ( | const char * | meta, |
| const char * | table, | ||
| const char * | key, | ||
| int * | len ) |
Retrieves a metadata string value for a given variable from the database
| meta | Root meta table name, usually something like "<metaname>". | |
| table | Hash table name. | |
| key | Variable / field name in table. | |
| [out] | len | The length of the returned string (>=0), or else an error code (<0). |
References smaxError(), and smaxGetRedis().
| double smaxPullTime | ( | const char * | table, |
| const char * | key ) |
Retrieves the timestamp for a given variable from the database.
| [in] | table | Hash table name (or NULL if key is an aggregate ID). |
| [in] | key | Variable / field name in table. |
References SMAX_TIMESTAMPS, and smaxPullMeta().
| XType smaxPullTypeDimension | ( | const char * | table, |
| const char * | key, | ||
| int * | ndim, | ||
| int * | sizes ) |
Retrieves the timestamp for a given variable from the database.
| [in] | table | Hash table name (or NULL if key is an aggregate ID). |
| [in] | key | Variable / field name in table. |
| [out] | ndim | Pointer to integer in which to return the dimensionality of the variable, or NULL if not requested. |
| [out] | sizes | Array to store sizes along each dimension, which should hold X_MAX_DIMS integers, or NULL if dimensions are not requested. |
References SMAX_DIMS, SMAX_TYPES, smaxPullMeta(), and smaxTypeForString().
| int smaxPushMeta | ( | const char * | meta, |
| const char * | table, | ||
| const char * | key, | ||
| const char * | value ) |
Adds/updates metadata associated with an SMA-X variable. The data will be pushed via the Redis pipeline channel.
| meta | Root meta table name, usually something like "<metaname>". |
| table | Hash table name. |
| key | Variable / field name in table. |
| value | Metadata string value. |
References smaxError(), smaxGetProgramID(), and smaxGetRedis().
| int smaxSetCoordinateAxis | ( | const char * | id, |
| int | n, | ||
| const XCoordinateAxis * | axis ) |
Defines the n'th coordinate axis for a given SMA-X coordinate system table id.
| id | Fully qualified SMA-X coordinate system ID. |
| n | The (0-based) index of the coordinate axis |
| axis | Pointer to the structure describing the coordinate axis. |
References RedisEntry::key, XCoordinateAxis::name, XCoordinateAxis::refIndex, XCoordinateAxis::refValue, smaxGetRedis(), XCoordinateAxis::step, XCoordinateAxis::unit, and RedisEntry::value.
| int smaxSetCoordinateSystem | ( | const char * | table, |
| const char * | key, | ||
| const XCoordinateSystem * | coords ) |
Sets the coordinate system metadata for data in the database.
| table | Hash table name. |
| key | Variable / field name in table. |
| coords | Pointer to the coordinate system structure associated to this variable. |
References XCoordinateSystem::axis, META_COORDS, XCoordinateSystem::nAxis, and smaxSetCoordinateAxis().
| int smaxSetDescription | ( | const char * | table, |
| const char * | key, | ||
| const char * | description ) |
Sets the static description for a given SMA-X variable.
| table | Hash table name. |
| key | Variable / field name in table. |
| description | Concise but descriptive summary of the meaning of the variable. |
References META_DESCRIPTION, and smaxPushMeta().
| int smaxSetUnits | ( | const char * | table, |
| const char * | key, | ||
| const char * | unit ) |
Sets the physical unit name for a given SMA-X variable.
| table | Hash table name. |
| key | Variable / field name in table. |
| unit | Standard unit specification, e.g. "W / Hz" or "W Hz**{-1}". |
References META_UNIT, and smaxPushMeta().