OC Updated for version 2.0
|
#include "config.h"
#include <stdlib.h>
#include <assert.h>
#include <string.h>
#include "ocinternal.h"
#include "ocdebug.h"
#include "ocdump.h"
#include "oclog.h"
#include "occlientparams.h"
Go to the source code of this file.
Defines | |
#define | ocverify(o) ((o) != NULL && (((OCheader*)(o))->magic == OCMAGIC)?1:0) |
#define | ocverifyclass(o, cl) ((o) != NULL && (((OCheader*)(o))->occlass == cl)?1:0) |
#define | OCVERIFYX(k, x, r) if(!ocverify(x)||!ocverifyclass(x,k)) {return (r);} |
#define | OCVERIFY(k, x) OCVERIFYX(k,x,OCTHROW(OC_EINVAL)) |
#define | OCDEREF(T, s, x) (s)=(T)(x) |
Functions | |
OCerror | oc_open (const char *url, OCobject *linkp) |
OCerror | oc_close (OCobject link) |
OCerror | oc_fetch (OCobject link, const char *constraint, OCdxd dxdkind, OCflags flags, OCobject *rootp) |
OCerror | oc_root_free (OCobject link, OCobject ddsroot) |
const char * | oc_tree_text (OCobject link, OCobject ddsroot) |
OCerror | oc_dds_properties (OCobject link, OCobject ddsnode, char **namep, OCtype *octypep, OCtype *atomtypep, OCobject *containerp, size_t *rankp, size_t *nsubnodesp, size_t *nattrp) |
OCerror | oc_dds_name (OCobject link, OCobject ddsnode, char **namep) |
OCerror | oc_dds_nsubnodes (OCobject link, OCobject ddsnode, size_t *nsubnodesp) |
OCerror | oc_dds_atomictype (OCobject link, OCobject ddsnode, OCtype *typep) |
OCerror | oc_dds_class (OCobject link, OCobject ddsnode, OCtype *typep) |
OCerror | oc_dds_rank (OCobject link, OCobject ddsnode, size_t *rankp) |
OCerror | oc_dds_attr_count (OCobject link, OCobject ddsnode, size_t *nattrp) |
OCerror | oc_dds_root (OCobject link, OCobject ddsnode, OCobject *rootp) |
OCerror | oc_dds_container (OCobject link, OCobject ddsnode, OCobject *containerp) |
OCerror | oc_dds_ithfield (OCobject link, OCobject ddsnode, size_t index, OCobject *fieldnodep) |
OCerror | oc_dds_gridarray (OCobject link, OCobject grid, OCobject *arraynodep) |
OCerror | oc_dds_gridmap (OCobject link, OCobject grid, size_t index, OCobject *mapnodep) |
OCerror | oc_dds_dimensions (OCobject link, OCobject ddsnode, OCobject *dims) |
OCerror | oc_dds_ithdimension (OCobject link, OCobject ddsnode, size_t index, OCobject *dimidp) |
OCerror | oc_dimension_properties (OCobject link, OCobject ddsnode, size_t *sizep, char **namep) |
OCerror | oc_dds_dimensionsizes (OCobject link, OCobject ddsnode, size_t *dimsizes) |
OCerror | oc_dds_attr (OCobject link, OCobject ddsnode, size_t index, char **namep, OCtype *octypep, size_t *nvaluesp, char **strings) |
void | oc_reclaim_strings (size_t n, char **svec) |
OCerror | oc_das_attr_count (OCobject link, OCobject dasnode, size_t *nvaluesp) |
OCerror | oc_das_attr (OCobject link, OCobject dasnode, size_t index, OCtype *etypep, char **valuep) |
size_t | oc_typesize (OCtype etype) |
const char * | oc_typetostring (OCtype octype) |
OCerror | oc_typeprint (OCtype etype, void *value, size_t bufsize, char *buffer) |
const char * | oc_errstring (OCerror err) |
const char * | oc_clientparam_get (OCobject link, const char *param) |
OCerror | oc_svcerrordata (OCobject link, char **codep, char **msgp, long *httpp) |
OCerror | oc_raw_xdrsize (OCobject link, OCobject ddsroot, size_t *sizep) |
OCerror | oc_update_lastmodified_data (OCobject link) |
long | oc_get_lastmodified_data (OCobject link) |
int | oc_dumpnode (OCobject link, OCobject ddsroot) |
OCerror | oc_dds_dd (OCobject link, OCobject ddsroot, int level) |
OCerror | oc_dds_ddnode (OCobject link, OCobject ddsroot) |
OCerror | oc_data_ddpath (OCobject link, OCobject datanode, char **resultp) |
OCerror | oc_data_ddtree (OCobject link, OCobject ddsroot) |
OCDT | oc_data_mode (OCobject link, OCobject datanode) |
OCerror | oc_data_free (OCobject link, OCobject datanode) |
OCerror | oc_dds_free (OCobject link, OCobject dds0) |
OCerror | oc_merge_das (OCobject link, OCobject dasroot, OCobject ddsroot) |
OCerror | oc_data_getroot (OCobject link, OCobject ddsroot, OCobject *datarootp) |
OCerror | oc_data_ithfield (OCobject link, OCobject datanode, size_t index, OCobject *fieldp) |
OCerror | oc_data_gridarray (OCobject link, OCobject grid, OCobject *arraydatap) |
OCerror | oc_data_gridmap (OCobject link, OCobject grid, size_t index, OCobject *mapdatap) |
OCerror | oc_data_container (OCobject link, OCobject datanode, OCobject *containerp) |
OCerror | oc_data_root (OCobject link, OCobject datanode, OCobject *rootp) |
OCerror | oc_data_ithelement (OCobject link, OCobject datanode, size_t *indices, OCobject *elementp) |
OCerror | oc_data_ithrecord (OCobject link, OCobject datanode, size_t index, OCobject *recordp) |
OCerror | oc_data_position (OCobject link, OCobject datanode, size_t *indices) |
OCerror | oc_data_recordcount (OCobject link, OCobject datanode, size_t *countp) |
OCerror | oc_data_ddsnode (OCobject link, OCobject datanode, OCobject *nodep) |
OCerror | oc_data_octype (OCobject link, OCobject datanode, OCtype *typep) |
int | oc_data_indexable (OCobject link, OCobject datanode) |
int | oc_data_indexed (OCobject link, OCobject datanode) |
OCerror | oc_data_read (OCobject link, OCobject datanode, size_t *start, size_t *edges, size_t memsize, void *memory) |
Definition in file oc.c.
#define OCDEREF | ( | T, | |
s, | |||
x | |||
) | (s)=(T)(x) |
Definition at line 31 of file oc.c.
Referenced by oc_clientparam_get(), oc_close(), oc_das_attr(), oc_das_attr_count(), oc_data_container(), oc_data_ddpath(), oc_data_ddsnode(), oc_data_ddtree(), oc_data_getroot(), oc_data_indexable(), oc_data_indexed(), oc_data_ithelement(), oc_data_ithfield(), oc_data_ithrecord(), oc_data_mode(), oc_data_octype(), oc_data_position(), oc_data_read(), oc_data_recordcount(), oc_data_root(), oc_dds_atomictype(), oc_dds_attr(), oc_dds_attr_count(), oc_dds_class(), oc_dds_container(), oc_dds_dd(), oc_dds_ddnode(), oc_dds_dimensions(), oc_dds_dimensionsizes(), oc_dds_ithdimension(), oc_dds_ithfield(), oc_dds_name(), oc_dds_nsubnodes(), oc_dds_properties(), oc_dds_rank(), oc_dds_root(), oc_dimension_properties(), oc_dumpnode(), oc_fetch(), oc_get_lastmodified_data(), oc_merge_das(), oc_raw_xdrsize(), oc_root_free(), oc_svcerrordata(), oc_tree_text(), and oc_update_lastmodified_data().
#define OCVERIFY | ( | k, | |
x | |||
) | OCVERIFYX(k,x,OCTHROW(OC_EINVAL)) |
Definition at line 29 of file oc.c.
Referenced by oc_close(), oc_das_attr(), oc_das_attr_count(), oc_data_container(), oc_data_ddpath(), oc_data_ddsnode(), oc_data_ddtree(), oc_data_getroot(), oc_data_indexable(), oc_data_indexed(), oc_data_ithelement(), oc_data_ithfield(), oc_data_ithrecord(), oc_data_mode(), oc_data_octype(), oc_data_position(), oc_data_read(), oc_data_recordcount(), oc_data_root(), oc_dds_atomictype(), oc_dds_attr(), oc_dds_attr_count(), oc_dds_class(), oc_dds_container(), oc_dds_dd(), oc_dds_ddnode(), oc_dds_dimensions(), oc_dds_dimensionsizes(), oc_dds_ithdimension(), oc_dds_ithfield(), oc_dds_name(), oc_dds_nsubnodes(), oc_dds_properties(), oc_dds_rank(), oc_dds_root(), oc_dimension_properties(), oc_dumpnode(), oc_fetch(), oc_get_lastmodified_data(), oc_merge_das(), oc_raw_xdrsize(), oc_root_free(), oc_svcerrordata(), and oc_update_lastmodified_data().
#define ocverify | ( | o | ) | ((o) != NULL && (((OCheader*)(o))->magic == OCMAGIC)?1:0) |
#define ocverifyclass | ( | o, | |
cl | |||
) | ((o) != NULL && (((OCheader*)(o))->occlass == cl)?1:0) |
#define OCVERIFYX | ( | k, | |
x, | |||
r | |||
) | if(!ocverify(x)||!ocverifyclass(x,k)) {return (r);} |
Definition at line 28 of file oc.c.
Referenced by oc_clientparam_get(), and oc_tree_text().
Obtain the data instance corresponding to the container of a specied instance object.
[in] | link | The link through which the server is accessed. |
[in] | datanode | The data instance of interest |
[out] | containerp | A pointer into which the container instance is stored. |
OC_NOERR | The procedure executed normally. |
OC_EINVAL | The data object has no container (=> it is a Dataset instance). |
OtherError | One of the arguments (link, etc.) was invalid. |
Return the dds node that is the "template" for this data instance.
[in] | link | The link through which the server is accessed. |
[in] | datanode | The data node instance of interest. |
[out] | nodep | A pointer into which the ddsnode is stored. |
OC_NOERR | The procedure executed normally. |
OtherError | One of the arguments (link, etc.) was invalid. |
Data Management
Obtain the datanode root associated with a DataDDS tree.
[in] | link | The link through which the server is accessed. |
[in] | ddsroot | The DataDDS tree root. |
[out] | datarootp | A pointer into which the datanode root is stored. |
OC_NOERR | The procedure executed normally. |
OtherError | One of the arguments (link, etc.) was invalid. |
Obtain the data instance corresponding to the array field of a Grid container instance. Equivalent to oc_data_ithfield(link,grid,0,arraydata).
[in] | link | The link through which the server is accessed. |
[in] | grid | The grid container instance of interest. |
[out] | arraydatap | A pointer into which the grid array instance is stored. |
OC_NOERR | The procedure executed normally. |
OtherError | One of the arguments (link, etc.) was invalid. |
Definition at line 888 of file oc.c.
References oc_data_ithfield().
Obtain the data instance corresponding to the ith map field of a Grid container instance. Equivalent to oc_data_ithfield(link,grid-container,index+1,mapdata). Note that Map indices start at zero.
[in] | link | The link through which the server is accessed. |
[in] | grid | The grid container instance of interest. |
[in] | index | The map index of the map to return. |
[out] | mapdatap | A pointer into which the grid map instance is stored. |
OC_NOERR | The procedure executed normally. |
OtherError | One of the arguments (link, etc.) was invalid. |
Definition at line 909 of file oc.c.
References oc_data_ithfield().
Return the value one (1) if the specified data instance is indexable. Indexable means that the data instance is a dimensioned Structure or it is a Sequence (but not a record in a Sequence).
[in] | link | The link through which the server is accessed. |
[in] | datanode | The data node instance of interest. |
one(1) | if the specified data instance is indexable. |
zero(0) | otherwise. |
Return the value one (1) if the specified data instance was obtained by applying either the procedure oc_data_ithelement or oc_data_ithrecord. This means that the operation oc_data_position() will succeed when applied to this data instance.
[in] | link | The link through which the server is accessed. |
[in] | datanode | The data node instance of interest. |
one(1) | if the specified data instance has an index. |
zero(0) | otherwise. |
OCerror oc_data_ithelement | ( | OCobject | link, |
OCobject | datanode, | ||
size_t * | indices, | ||
OCobject * | elementp | ||
) |
Return the data of a dimensioned Structure corresponding to the element instance specified by the indices argument.
[in] | link | The link through which the server is accessed. |
[in] | datanode | The data node instance of interest. |
[in] | indices | A vector of indices specifying the element instance to return. This vector must be allocated and free'd by the caller. |
[out] | elementp | A pointer into which the element instance is stored. |
OC_NOERR | The procedure executed normally. |
OC_EBADTYPE | The data instance was not of type OC_Structure or was a scalar. |
OC_EINDEX | The indices specified an illegal element. |
OtherError | One of the arguments (link, etc.) was invalid. |
Obtain the data instance corresponding to the i'th field of a data node instance that itself is a container instance.
[in] | link | The link through which the server is accessed. |
[in] | datanode | The container data node instance of interest. |
[in] | index | The index (starting at zero) of the field instance to return. |
[out] | fieldp | A pointer into which the i'th field instance is stored. |
OC_NOERR | The procedure executed normally. |
OC_EINDEX | The index was greater than the number of fields. |
OtherError | One of the arguments (link, etc.) was invalid. |
Definition at line 856 of file oc.c.
References OC_EINVAL, OC_NOERR, OCDEREF, and OCVERIFY.
Referenced by oc_data_gridarray(), and oc_data_gridmap().
Return the i'th record instance of a Sequence data instance.
[in] | link | The link through which the server is accessed. |
[in] | datanode | The data node instance of interest. |
[in] | index | The record instance to return. |
[out] | recordp | A pointer into which the record instance is stored. |
OC_NOERR | The procedure executed normally. |
OC_EBADTYPE | The data instance was not of type OC_Sequence |
OC_EINDEX | The indices is larger than the number of records of the Sequence. |
OtherError | One of the arguments (link, etc.) was invalid. |
Return the OCtype of the ddsnode that is the "template" for this data instance. This is a convenience function since it can be obtained using a combination of other API procedures.
[in] | link | The link through which the server is accessed. |
[in] | datanode | The data node instance of interest. |
[out] | typep | A pointer into which the OCtype value is stored. |
OC_NOERR | The procedure executed normally. |
OtherError | One of the arguments (link, etc.) was invalid. |
Return the i'th record instance of a Sequence data instance. Return the indices for this data instance; Assumes the data was obtained using oc_data_ithelement or oc_data_ithrecord.
[in] | link | The link through which the server is accessed. |
[in] | datanode | The data node instance of interest. |
[out] | indices | A vector into which the indices of the data instance are stored. If the data instance is a record, then only indices[0] is used. |
OC_NOERR | The procedure executed normally. |
OC_EBADTYPE | The data instance was not of type OC_Sequence or it was not a dimensioned instance of OC_Structure. |
OtherError | One of the arguments (link, etc.) was invalid. |
OCerror oc_data_read | ( | OCobject | link, |
OCobject | datanode, | ||
size_t * | start, | ||
size_t * | edges, | ||
size_t | memsize, | ||
void * | memory | ||
) |
This procedure does the work of actually extracting data from a leaf instance of a data tree and storing it into memory for use by the calling code. The data instance must be referencing either a scalar primitive value or an array of primitive values. That is, its oc_data_octype() value must be OCatomic. If the variable is a scalar, then the index and count vectors will be ignored.
[in] | link | The link through which the server is accessed. |
[in] | datanode | The data node instance of interest. |
[in] | start | A vector of indices specifying the starting element to return. |
[in] | edges | A vector of indices specifying the count in each dimension of the number of elements to return. |
[in] | memsize | The size (in bytes) of the memory argument. |
[out] | memory | User allocated memory into which the extracted data is to be stored. The caller is responsible for allocating and free'ing this argument. |
OC_NOERR | The procedure executed normally. |
OC_EINVAL | The memsize argument is too small to hold the specified data. |
OC_EINVALCOORDS | The start and/or edges argument is outside the range of legal indices. |
OC_EDATADDS | The data retrieved from the server was malformed and the read request cannot be completed. |
OtherError | One of the arguments (link, etc.) was invalid. |
Definition at line 1246 of file oc.c.
References OC_EDATADDS, OC_EINVAL, OC_EINVALCOORDS, OC_NOERR, OCDEREF, and OCVERIFY.
Return the number of records associated with a Sequence data object. Be warned that applying this procedure to a record data instance (as opposed to an instance representing a whole Sequence) will return an error. More succinctly, the data object's OCtype must be of type OC_Sequence and oc_data_indexable() must be true.
[in] | link | The link through which the server is accessed. |
[in] | datanode | The data node instance of interest. |
[out] | countp | A pointer into which the record count is stored. |
OC_NOERR | The procedure executed normally. |
OC_EBADTYPE | The data instance was not of type OC_Sequence or it was a record data instance. |
OtherError | One of the arguments (link, etc.) was invalid. |
Obtain the data instance corresponding to the root of the tree of which the specified instance object is a part.
[in] | link | The link through which the server is accessed. |
[in] | datanode | The data instance of interest |
[out] | rootp | A pointer into which the root instance is stored. |
OC_NOERR | The procedure executed normally. |
OtherError | One of the arguments (link, etc.) was invalid. |
long oc_get_lastmodified_data | ( | OCobject | link | ) |
Node Interconnection Management
As a rule, the attributes of an object are accessed using the oc_dds_attr procedure rather than by traversing a DAS. In order to support this, the oc_merge_das procedure annotates a DDS node with attribute values taken from a specified DAS node.
[in] | link | The link through which the server is accessed. |
[in] | dasroot | The root object of a DAS tree. |
[in] | ddsroot | The root object of a DDS (or DataDDS) tree. |
OC_NOERR | The procedure executed normally. |
OtherError | One of the arguments (link, etc.) was invalid. |