In file gdsdatum.h:

class gdsDatum

Class to store a basic data field.

Inheritance:


Public Classes

enum encodingtype
Type describing the encoding scheme used to put and get the data value(s) to and from a stream
ascii
ascii
binary
binary
uuencode
uuencoding
base64
base64 encoding

Public Fields

typedef std::vector <int> dimension_t
Type describing the dimensions of an array
gdsDataType datatype
Describes the type of the data field.
dimension_t dimension
Contains the information of the dimensions of the data field.
void* value
Pointer to the data field.
encodingtype encoding
encoding type for stream operations

Public Methods

friend std::istream& operator >> (std::istream&, gdsDatum&)
Input operator.
friend std::ostream& operator << (std::ostream&, const gdsDatum&)
Output operator.
gdsDatum ()
Default constructor.
gdsDatum (gdsDataType DataType, const void* Value, int dim1 = 1, int dim2 = 0, int dim3 = 0, int dim4 = 0)
Constructor.
virtual ~gdsDatum ()
Destructor.
gdsDatum (const gdsDatum& dat)
Copy constructor.
virtual bool assignDatum (const gdsDatum& dat)
Assignment.
static bool encode (std::ostream& os, const char* val, int len, encodingtype ctype = base64, int indent = 0)
Encode method.
static bool decode (std::istream& is, char* val, int len, encodingtype ctype = base64)
Decode method.
static bool decode (const char* code, int codelen, char* val, int len, encodingtype ctype = base64)
Decode method.
static std::string codeName (encodingtype ctype)
Code name method.
static encodingtype code (std::string name)
Code name method.
gdsDatum& operator= (const gdsDatum& dat)
Assignment oparator.
bool resize (int dim1, int dim2 = 0, int dim3 = 0, int dim4 = 0)
Returns the size of an element (in bytes).
int elSize () const
Returns the size of an element (in bytes).
int elNumber () const
Returns the number of elements.
int size () const
Returns the total size (in bytes) of the data field.
int readValues (const string& txt)
Reads value(s) from input stream.
void lock (bool writeaccess = false) const
Lock object.
bool trylock (bool writeaccess = false) const
Try lock object.
void unlock () const
Unlock object.

Protected Fields

mutable readwritelock rwlock
read wrote lock for datum

Documentation

This class is used to store data fields. It is self describing and contains the data type, the number of elements (array dimensions) and a pointer to the data.
friend std::istream& operator >> (std::istream&, gdsDatum&)
This function reads the data field from an input stream.
Returns:
input stream
Parameters:
istream - input stream
gdsDatum - class

friend std::ostream& operator << (std::ostream&, const gdsDatum&)
This function writes the data field to an output stream following the LigoLW XML specification.
Returns:
input stream
Parameters:
ostream - output stream
gdsDatum - class

enum encodingtype
Type describing the encoding scheme used to put and get the data value(s) to and from a stream

ascii
ascii

binary
binary

uuencode
uuencoding

base64
base64 encoding

typedef std::vector <int> dimension_t
Type describing the dimensions of an array. If the list contains two integers, say dim1 and dim2, the corresponding array has the dimension [dim1][dim2].

gdsDataType datatype
Describes the type of the data field.

dimension_t dimension
Contains the information of the dimensions of the data field.

void* value
Pointer to the data field.

encodingtype encoding
encoding type for stream operations

gdsDatum()
Constructs a data field which contains no data.
Returns:
void

gdsDatum(gdsDataType DataType, const void* Value, int dim1 = 1, int dim2 = 0, int dim3 = 0, int dim4 = 0)
Constructs a data field. Data is copied.
Returns:
void
Parameters:
DataType - data type of field
Value - pointer to data field
dim1 - first dimension
dim2 - second dimension
dim3 - third dimension
dim4 - fourth dimension

virtual ~gdsDatum()
Destructs a data field.
Returns:
void

gdsDatum(const gdsDatum& dat)
Constructs and copies a data field.
Returns:
void
Parameters:
gdsDatum - data field which will be copied

virtual bool assignDatum(const gdsDatum& dat)
Copies a data field.
Returns:
this data field
Parameters:
gdsDatum - data field which will be copied

static bool encode(std::ostream& os, const char* val, int len, encodingtype ctype = base64, int indent = 0)
Encodes value(s) of a datum object onto a stream. Works only with UU and base64 encoding.
Returns:
true if succesful
Parameters:
os - output stream
val - pointer to value(s)
len - length of value array (in bytes)
ctype - encoding type
indent - indent use at each newline

static bool decode(std::istream& is, char* val, int len, encodingtype ctype = base64)
Decodes value(s) of a datum object from a stream. Works only with UU and base64 encoding.
Returns:
true if succesful
Parameters:
is - input stream
val - pointer to value(s) (return)
len - length of value array (in bytes)
ctype - encoding type

static bool decode(const char* code, int codelen, char* val, int len, encodingtype ctype = base64)
Decodes value(s) of a datum object from a char buffer. Works only with UU and base64 encoding.
Returns:
true if succesful
Parameters:
code - input array
codelen - Length of input array
val - pointer to value(s) (return)
len - length of value array (in bytes)
ctype - encoding type

static std::string codeName(encodingtype ctype)
Returns the name of the specified encodeing scheme.
Returns:
name of encoding scheme
Parameters:
ctype - encoding type

static encodingtype code(std::string name)
Returns the name of the specified encodeing scheme.
Returns:
name of encoding scheme
Parameters:
ctype - encoding type

gdsDatum& operator= (const gdsDatum& dat)
Assignment oparator.
Returns:
this data field
Parameters:
gdsDatum - data field which will be copied

bool resize(int dim1, int dim2 = 0, int dim3 = 0, int dim4 = 0)
Returns the size of an element of the data field.
Returns:
size of an element (in bytes)

int elSize() const
Returns the size of an element of the data field.
Returns:
size of an element (in bytes)

int elNumber() const
Returns the number of elements in the data field.
Returns:
number of elements

int size() const
Returns the total size (in bytes) of the data field.
Returns:
size of the data field (in bytes)

int readValues(const string& txt)
Reads value(s) from an input stream. Returns the number of read values if successful. If value is not 0 the associated memory will be released before allocating new memory. The dimension of the value array has to be set before calling this function.
Returns:
number of elements read; <0 on error
Parameters:
is - input stream

void lock(bool writeaccess = false) const
Applies a read-write lock to make sure that the object isn't changed while accessing it.
Returns:
void
Parameters:
write - if true locks for exclusive use

bool trylock(bool writeaccess = false) const
Tries to apply a read-write lock. Returns true if successfully locked, false otherwise.
Returns:
void
Parameters:
write - if true locks for exclusive use

void unlock() const
Removes the read-write lock.
Returns:
void

mutable readwritelock rwlock
read wrote lock for datum


Direct child classes:
gdsNamedDatum
Author:
DS, November 98
See Also:
Diagnostics storage API

alphabetic index hierarchy of classes


Please send questions and comments to sigg_d@ligo-wa.caltech.edu


generated by doc++