OC Updated for version 2.0
Defines | Typedefs | Enumerations | Functions
oc.h File Reference
#include <stdlib.h>
#include <stdio.h>

Go to the source code of this file.

Defines

#define OC_MAX_DIMENSIONS   1024
#define OCDATA   OCDATADDS
#define OCONDISK   1
#define OCLOGNOTE   0
#define OCLOGWARN   1
#define OCLOGERR   2
#define OCLOGDBG   3
#define oc_dds_octype   oc_dds_class
#define oc_dds_type   oc_dds_class

Typedefs

typedef enum OCdxd OCdxd
typedef int OCflags
typedef enum OCtype OCtype
typedef enum OCerror OCerror
typedef void * OCobject
typedef OCobject OCddsnode
typedef OCobject OCdatanode
typedef OCobject OClink

Enumerations

enum  OCdxd { OCDDS = 1, OCDAS = 2, OCDATADDS = 3 }
enum  OCtype {
  OC_NAT = 0, OC_Char = 1, OC_Byte = 2, OC_UByte = 3,
  OC_Int16 = 4, OC_UInt16 = 5, OC_Int32 = 6, OC_UInt32 = 7,
  OC_Int64 = 8, OC_UInt64 = 9, OC_Float32 = 10, OC_Float64 = 11,
  OC_String = 12, OC_URL = 13, OC_Atomic = 100, OC_Dataset = 101,
  OC_Sequence = 102, OC_Grid = 103, OC_Structure = 104, OC_Dimension = 105,
  OC_Attribute = 106, OC_Attributeset = 107
}
enum  OCerror {
  OC_NOERR = 0, OC_EBADID = -1, OC_ECHAR = -2, OC_EDIMSIZE = -3,
  OC_EEDGE = -4, OC_EINVAL = -5, OC_EINVALCOORDS = -6, OC_ENOMEM = -7,
  OC_ENOTVAR = -8, OC_EPERM = -9, OC_ESTRIDE = -10, OC_EDAP = -11,
  OC_EXDR = -12, OC_ECURL = -13, OC_EBADURL = -14, OC_EBADVAR = -15,
  OC_EOPEN = -16, OC_EIO = -17, OC_ENODATA = -18, OC_EDAPSVC = -19,
  OC_ENAMEINUSE = -20, OC_EDAS = -21, OC_EDDS = -22, OC_EDATADDS = -23,
  OC_ERCFILE = -24, OC_ENOFILE = -25, OC_EINDEX = -26, OC_EBADTYPE = -27,
  OC_ESCALAR = -28
}

Functions

OCerror oc_open (const char *url, OClink *)
OCerror oc_close (OClink)
OCerror oc_fetch (OClink, const char *constraints, OCdxd, OCflags, OCddsnode *)
OCerror oc_root_free (OClink, OCddsnode root)
const char * oc_tree_text (OClink, OCddsnode root)
OCerror oc_dds_properties (OClink, OCddsnode, char **namep, OCtype *typep, OCtype *atomictypep, OCddsnode *containerp, size_t *rankp, size_t *nsubnodesp, size_t *nattrp)
OCerror oc_dds_name (OClink, OCddsnode, char **)
OCerror oc_dds_class (OClink, OCddsnode, OCtype *)
OCerror oc_dds_atomictype (OClink, OCddsnode, OCtype *)
OCerror oc_dds_nsubnodes (OClink, OCddsnode, size_t *)
OCerror oc_dds_rank (OClink, OCddsnode, size_t *)
OCerror oc_dds_attr_count (OClink, OCddsnode, size_t *)
OCerror oc_dds_root (OClink, OCddsnode, OCddsnode *)
OCerror oc_dds_container (OClink, OCddsnode, OCddsnode *)
OCerror oc_dds_ithfield (OClink, OCddsnode, size_t index, OCddsnode *dimids)
OCerror oc_dds_dimensions (OClink, OCddsnode, OCddsnode *dimids)
OCerror oc_dds_ithdimension (OClink, OCddsnode, size_t, OCddsnode *)
OCerror oc_dimension_properties (OClink, OCddsnode, size_t *, char **)
OCerror oc_dds_dimensionsizes (OClink, OCddsnode, size_t *dimsizes)
OCerror oc_dds_attr (OClink, OCddsnode, size_t i, char **name, OCtype *octype, size_t *nvalues, char **strings)
OCerror oc_das_attr_count (OClink, OCddsnode, size_t *countp)
OCerror oc_das_attr (OClink, OCddsnode, size_t, OCtype *, char **)
OCerror oc_dds_free (OClink, OCddsnode)
OCerror oc_data_getroot (OClink, OCddsnode treeroot, OCdatanode *rootp)
OCerror oc_data_ithfield (OClink, OCdatanode container, size_t index, OCdatanode *fieldp)
OCerror oc_data_gridarray (OClink, OCdatanode grid, OCdatanode *arrayp)
OCerror oc_data_gridmap (OClink, OCdatanode grid, size_t index, OCdatanode *mapp)
OCerror oc_data_container (OClink, OCdatanode data, OCdatanode *containerp)
OCerror oc_data_root (OClink, OCdatanode data, OCdatanode *rootp)
OCerror oc_data_ithelement (OClink, OCdatanode data, size_t *indices, OCdatanode *elementp)
OCerror oc_data_ithrecord (OClink, OCdatanode data, size_t index, OCdatanode *recordp)
OCerror oc_data_free (OClink, OCdatanode data)
OCerror oc_data_recordcount (OClink, OCdatanode, size_t *)
OCerror oc_data_read (OClink, OCdatanode, size_t *, size_t *, size_t, void *)
OCerror oc_data_position (OClink, OCdatanode data, size_t *indices)
OCerror oc_data_ddsnode (OClink, OCdatanode data, OCddsnode *)
OCerror oc_data_octype (OClink, OCdatanode data, OCtype *)
int oc_data_indexed (OClink link, OCdatanode datanode)
int oc_data_indexable (OClink, OCdatanode)
size_t oc_typesize (OCtype)
const char * oc_typetostring (OCtype)
OCerror oc_typeprint (OCtype, void *value, size_t bufsize, char *buf)
void oc_loginit (void)
int oc_setlogging (int onoff)
int oc_logopen (const char *logfilename)
void oc_logclose (void)
void oc_log (int tag, const char *fmt,...)
void oc_logtext (int tag, const char *text)
void oc_reclaim_strings (size_t n, char **svec)
const char * oc_errstring (OCerror err)
const char * oc_clientparam_get (OClink, const char *param)
OCerror oc_merge_das (OClink, OCddsnode dasroot, OCddsnode ddsroot)
OCerror oc_svcerrordata (OClink link, char **codep, char **msgp, long *httpp)
OCerror oc_update_lastmodified_data (OClink)
long oc_get_lastmodified_data (OClink)

Detailed Description

Definition in file oc.h.


Define Documentation

#define oc_dds_octype   oc_dds_class

Definition at line 234 of file oc.h.

#define oc_dds_type   oc_dds_class

Definition at line 235 of file oc.h.


Function Documentation

OCerror oc_data_container ( OCobject  link,
OCobject  datanode,
OCobject containerp 
)

Obtain the data instance corresponding to the container of a specied instance object.

Parameters:
[in]linkThe link through which the server is accessed.
[in]datanodeThe data instance of interest
[out]containerpA pointer into which the container instance is stored.
Return values:
OC_NOERRThe procedure executed normally.
OC_EINVALThe data object has no container (=> it is a Dataset instance).
OtherErrorOne of the arguments (link, etc.) was invalid.

Definition at line 929 of file oc.c.

References OC_EINVAL, OC_NOERR, OCDEREF, and OCVERIFY.

OCerror oc_data_ddsnode ( OCobject  link,
OCobject  datanode,
OCobject nodep 
)

Return the dds node that is the "template" for this data instance.

Parameters:
[in]linkThe link through which the server is accessed.
[in]datanodeThe data node instance of interest.
[out]nodepA pointer into which the ddsnode is stored.
Return values:
OC_NOERRThe procedure executed normally.
OtherErrorOne of the arguments (link, etc.) was invalid.

Definition at line 1123 of file oc.c.

References OC_EINVAL, OC_NOERR, OCDEREF, and OCVERIFY.

OCerror oc_data_free ( OClink  ,
OCdatanode  data 
)

Definition at line 1636 of file oc.c.

References OC_NOERR.

OCerror oc_data_getroot ( OCobject  link,
OCobject  ddsroot,
OCobject datarootp 
)

Data Management

Obtain the datanode root associated with a DataDDS tree.

Parameters:
[in]linkThe link through which the server is accessed.
[in]ddsrootThe DataDDS tree root.
[out]datarootpA pointer into which the datanode root is stored.
Return values:
OC_NOERRThe procedure executed normally.
OtherErrorOne of the arguments (link, etc.) was invalid.

Definition at line 822 of file oc.c.

References OC_EINVAL, OC_NOERR, OCDEREF, and OCVERIFY.

OCerror oc_data_gridarray ( OCobject  link,
OCobject  grid,
OCobject arraydatap 
)

Obtain the data instance corresponding to the array field of a Grid container instance. Equivalent to oc_data_ithfield(link,grid,0,arraydata).

Parameters:
[in]linkThe link through which the server is accessed.
[in]gridThe grid container instance of interest.
[out]arraydatapA pointer into which the grid array instance is stored.
Return values:
OC_NOERRThe procedure executed normally.
OtherErrorOne of the arguments (link, etc.) was invalid.

Definition at line 888 of file oc.c.

References oc_data_ithfield().

OCerror oc_data_gridmap ( OCobject  link,
OCobject  grid,
size_t  index,
OCobject mapdatap 
)

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.

Parameters:
[in]linkThe link through which the server is accessed.
[in]gridThe grid container instance of interest.
[in]indexThe map index of the map to return.
[out]mapdatapA pointer into which the grid map instance is stored.
Return values:
OC_NOERRThe procedure executed normally.
OtherErrorOne of the arguments (link, etc.) was invalid.

Definition at line 909 of file oc.c.

References oc_data_ithfield().

int oc_data_indexable ( OCobject  link,
OCobject  datanode 
)

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).

Parameters:
[in]linkThe link through which the server is accessed.
[in]datanodeThe data node instance of interest.
Return values:
one(1)if the specified data instance is indexable.
zero(0)otherwise.

Definition at line 1178 of file oc.c.

References OCDEREF, and OCVERIFY.

int oc_data_indexed ( OClink  link,
OCdatanode  datanode 
)

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.

Parameters:
[in]linkThe link through which the server is accessed.
[in]datanodeThe data node instance of interest.
Return values:
one(1)if the specified data instance has an index.
zero(0)otherwise.

Definition at line 1202 of file oc.c.

References OCDEREF, and OCVERIFY.

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.

Parameters:
[in]linkThe link through which the server is accessed.
[in]datanodeThe data node instance of interest.
[in]indicesA vector of indices specifying the element instance to return. This vector must be allocated and free'd by the caller.
[out]elementpA pointer into which the element instance is stored.
Return values:
OC_NOERRThe procedure executed normally.
OC_EBADTYPEThe data instance was not of type OC_Structure or was a scalar.
OC_EINDEXThe indices specified an illegal element.
OtherErrorOne of the arguments (link, etc.) was invalid.

Definition at line 996 of file oc.c.

References OC_EINVAL, OC_NOERR, OCDEREF, and OCVERIFY.

OCerror oc_data_ithfield ( OCobject  link,
OCobject  datanode,
size_t  index,
OCobject fieldp 
)

Obtain the data instance corresponding to the i'th field of a data node instance that itself is a container instance.

Parameters:
[in]linkThe link through which the server is accessed.
[in]datanodeThe container data node instance of interest.
[in]indexThe index (starting at zero) of the field instance to return.
[out]fieldpA pointer into which the i'th field instance is stored.
Return values:
OC_NOERRThe procedure executed normally.
OC_EINDEXThe index was greater than the number of fields.
OtherErrorOne 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().

OCerror oc_data_ithrecord ( OCobject  link,
OCobject  datanode,
size_t  index,
OCobject recordp 
)

Return the i'th record instance of a Sequence data instance.

Parameters:
[in]linkThe link through which the server is accessed.
[in]datanodeThe data node instance of interest.
[in]indexThe record instance to return.
[out]recordpA pointer into which the record instance is stored.
Return values:
OC_NOERRThe procedure executed normally.
OC_EBADTYPEThe data instance was not of type OC_Sequence
OC_EINDEXThe indices is larger than the number of records of the Sequence.
OtherErrorOne of the arguments (link, etc.) was invalid.

Definition at line 1030 of file oc.c.

References OC_EINVAL, OC_NOERR, OCDEREF, and OCVERIFY.

OCerror oc_data_octype ( OCobject  link,
OCobject  datanode,
OCtype typep 
)

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.

Parameters:
[in]linkThe link through which the server is accessed.
[in]datanodeThe data node instance of interest.
[out]typepA pointer into which the OCtype value is stored.
Return values:
OC_NOERRThe procedure executed normally.
OtherErrorOne of the arguments (link, etc.) was invalid.

Definition at line 1151 of file oc.c.

References OC_EINVAL, OC_NOERR, OCDEREF, and OCVERIFY.

OCerror oc_data_position ( OCobject  link,
OCobject  datanode,
size_t *  indices 
)

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.

Parameters:
[in]linkThe link through which the server is accessed.
[in]datanodeThe data node instance of interest.
[out]indicesA vector into which the indices of the data instance are stored. If the data instance is a record, then only indices[0] is used.
Return values:
OC_NOERRThe procedure executed normally.
OC_EBADTYPEThe data instance was not of type OC_Sequence or it was not a dimensioned instance of OC_Structure.
OtherErrorOne of the arguments (link, etc.) was invalid.

Definition at line 1067 of file oc.c.

References OC_EINVAL, OCDEREF, and OCVERIFY.

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.

Parameters:
[in]linkThe link through which the server is accessed.
[in]datanodeThe data node instance of interest.
[in]startA vector of indices specifying the starting element to return.
[in]edgesA vector of indices specifying the count in each dimension of the number of elements to return.
[in]memsizeThe size (in bytes) of the memory argument.
[out]memoryUser allocated memory into which the extracted data is to be stored. The caller is responsible for allocating and free'ing this argument.
Return values:
OC_NOERRThe procedure executed normally.
OC_EINVALThe memsize argument is too small to hold the specified data.
OC_EINVALCOORDSThe start and/or edges argument is outside the range of legal indices.
OC_EDATADDSThe data retrieved from the server was malformed and the read request cannot be completed.
OtherErrorOne 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.

OCerror oc_data_recordcount ( OCobject  link,
OCobject  datanode,
size_t *  countp 
)

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.

Parameters:
[in]linkThe link through which the server is accessed.
[in]datanodeThe data node instance of interest.
[out]countpA pointer into which the record count is stored.
Return values:
OC_NOERRThe procedure executed normally.
OC_EBADTYPEThe data instance was not of type OC_Sequence or it was a record data instance.
OtherErrorOne of the arguments (link, etc.) was invalid.

Definition at line 1098 of file oc.c.

References OC_EINVAL, OCDEREF, and OCVERIFY.

OCerror oc_data_root ( OCobject  link,
OCobject  datanode,
OCobject rootp 
)

Obtain the data instance corresponding to the root of the tree of which the specified instance object is a part.

Parameters:
[in]linkThe link through which the server is accessed.
[in]datanodeThe data instance of interest
[out]rootpA pointer into which the root instance is stored.
Return values:
OC_NOERRThe procedure executed normally.
OtherErrorOne of the arguments (link, etc.) was invalid.

Definition at line 960 of file oc.c.

References OC_EINVAL, OC_NOERR, OCDEREF, and OCVERIFY.

OCerror oc_dds_free ( OClink  ,
OCddsnode   
)

Definition at line 1645 of file oc.c.

References OC_NOERR.

long oc_get_lastmodified_data ( OClink  )

Definition at line 1534 of file oc.c.

References OCDEREF, and OCVERIFY.

OCerror oc_merge_das ( OCobject  link,
OCobject  dasroot,
OCobject  ddsroot 
)

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.

Parameters:
[in]linkThe link through which the server is accessed.
[in]dasrootThe root object of a DAS tree.
[in]ddsrootThe root object of a DDS (or DataDDS) tree.
Return values:
OC_NOERRThe procedure executed normally.
OtherErrorOne of the arguments (link, etc.) was invalid.

Definition at line 788 of file oc.c.

References OCDEREF, and OCVERIFY.

OCerror oc_update_lastmodified_data ( OClink  )

Definition at line 1525 of file oc.c.

References OCDEREF, and OCVERIFY.