In file diagdatum.h:

class diagStorage : public gdsStorage

Class to store a diagnostics data.

Inheritance:


Public Fields

typedef std::vector <gdsDataObject*> gdsDataObjectList
list of data objects
gdsParameter* TestType
Test class
gdsParameter* TestName
Test name
gdsParameter* Supervisory
Test supervisory
gdsParameter* TestIterator
Test iterator
gdsParameter* TestTime
Test time GPS
gdsParameter* TestTimeUTC
Test time UTC
gdsDataObject* Def
defaults data object
gdsDataObject* Sync
synchronization data object
gdsDataObjectList Env
environment objects
gdsDataObjectList Scan
scan objects
gdsDataObject* Find
find object
gdsDataObject* Test
test object
gdsDataObjectList Channel
Channel objects
gdsDataObject* Index
Index objects
gdsDataObjectList Result
Result objects
gdsDataObjectList Plot
Plot objects
gdsDataObjectList Calibration
Calibration records
gdsDataObjectList ReferenceTraces
Reference trace list

Public Methods

explicit diagStorage (const string& test = fftname)
Deafult constructor.
virtual ~diagStorage ()
Destructor.
bool isAuxiliaryResult (gdsDataObject& obj)
Is auxiliary function.
virtual bool fsave (string filename, ioflags saveflags = ioStandard, filetype FileType = LigoLW_XML)
File save function.
virtual bool frestore (string filename, ioflags restoreflags = ioExtended, filetype FileType = LigoLW_XML)
File restore function.
virtual bool updateTest (const string& newtest)
update test method.
virtual bool addData (gdsDataObject& dat, bool copy = true)
Add a data object.
virtual bool eraseData (const string& objname)
Remove a data object.
virtual bool eraseResults ()
erase result method.
virtual bool eraseReferenceTraces ()
erase reference traces method.
virtual bool erasePlotSettings ()
erase plot settings method.
virtual bool eraseCalibration ()
erase calibration record method.
virtual bool purgeChannelData (int left = 0)
purge channel data method.
virtual bool getChannelNames (std::vector<string>& names)
Channel names method.
virtual bool getAuxiliaryResultNames (std::vector<string>& names)
Auxiliary names method.
virtual bool getReferenceTraceNames (std::vector<string>& names)
Reference names method.
static bool analyzeName (const string& name, string& n, int& index1, int& index2)
analyze name method.
static bool analyzeName (const string& name, string& nameA, int& indexA1, int& indexA2, string& nameB, int& indexB1, int& indexB2)
analyze name method.
virtual bool set (const string& var, const string& val)
set method.
virtual bool erase (const string& var, string* norm = 0)
erase method.
virtual bool get (const string& var, gdsDatum& dat, string* norm = 0) const
get method.
virtual bool get (const string& var, string& val, string* norm = 0) const
get method.
virtual bool getMultiple (const string& var, string& info, bool brief = true, bool nameonly = false) const
get method.
virtual bool getData (const string& name, int datatype, int len, int ofs, float*& data, int& datalength) const
get data method.
virtual bool putData (const string& name, int datatype, int len, int ofs, const float* data, int datalength, int* newindex = 0)
put data method.

Protected Methods

virtual void init (const string& test)
init method.

Inherited from gdsStorage:

Public Classes

enum filetype
LigoLW_XML
Ligo light-weight data format (XML based)
ASCII
Straight ASCII format

Public Fields

typedef data_storage_ptr gdsDataObjectPtr
typedef std::vector <gdsDataObjectPtr> gdsObjectList
typedef gdsDataObject::gdsParameterList::iterator prm_iterator
typedef gdsDataObject::gdsParameterList::const_iterator const_prm_iterator
typedef gdsObjectList::iterator data_iterator
typedef gdsObjectList::const_iterator const_data_iterator
typedef std::set <objflag, std::less<objflag> > ioflags
static const ioflags ioEverything
static const ioflags ioExtended
static const ioflags ioStandard
static const ioflags ioParamOnly
mutable recursivemutex mux
string creator
string date
gdsObjectList objects

Public Methods

friend std::istream& operator >> (std::istream&, gdsStorage&)
friend std::ostream& operator << (std::ostream&, gdsStorage&)
bool operator ! () const
string errmsg() const
static bool isTempFile(const string& filename)
static void registerTempFile(const string& filename)
static void unregisterTempFile(const string& filename)
virtual bool addParameter(const string& objname, gdsParameter& prm, bool copy = true)
virtual bool addParameter(gdsParameter& prm, bool copy = true)
virtual bool eraseParameter(const string& objname, const string& prmname)
virtual bool eraseParameter(const string& prmname)
virtual gdsParameter* findParameter(const string& objname, const string& prmname) const
virtual gdsParameter* findParameter(const string& prmname) const
virtual gdsDataObject* findData(const string& objname) const
virtual gdsDataObject* newChannel(const string& objname, tainsec_t start, double dt, bool cmplx = false, bool memmap = false)
virtual float* allocateChannelMem(const string& objname, int length)
virtual void notifyChannelMem(const string& objname, bool error = false)
gdsDataObject* lockData(const string& objname, bool write = false)
gdsDataObject* trylockData(const string& objname, bool write = false)
void unlockData(gdsDataObject* dat)

Protected Classes

class tempnames: public std vector<string>

Protected Fields

typedef std::map <string, stringcase> attrtype
static mutex tempfilemux
static tempnames tempfiles
bool XML_fini
bool XML_init
int XML_Skip
string XML_Key
string XML_Key2
gdsParameter* XML_Param
gdsDataObject* XML_Obj
bool XML_fast
string XML_Error

Protected Methods

void fwriteXML(std::ostream& os)
bool fwriteBinary(std::ostream& os)
int ffixRef(int XML_Length)
virtual void startElement(const string& elName, const attrtype& atts)
virtual void endElement(const string& elName)
virtual void textHandler(std::stringstream& text)

Inherited from gdsDataObject:

Public Classes

enum objflag
parameterObj
global diganostics test parameters
settingsObj
the user settings of a diagnostics test
resultObj
results of a diganotics test
rawdataObj
the raw data of a diagnostics test
imageObj
the plots of a diagnostics test

Public Fields

typedef std::vector <gdsParameterPtr> gdsParameterList
gdsParameterList parameters
gdsDataReference link
bool error

Public Methods

gdsDataObject& operator= (const gdsDataObject& dat)
virtual bool assignDatum(const gdsDatum& dat)
static objflag gdsObjectFlag(const string& oflag)
static string gdsObjectFlagName(objflag oflag)
string getType() const
objflag getFlag() const
void setType(const string& otype)
void setFlag(objflag oflag)
void setFlag(const string& oflag)
bool isRef() const

Inherited from gdsNamedDatum:

Public Fields

string unit
int level

Inherited from gdsNamedStorage:

Public Fields

string name
string comment

Public Methods

bool operator == (const gdsNamedStorage& x) const
bool operator == (const string& x) const
bool operator != (const string& x) const
bool operator != (const gdsNamedStorage& x) const
bool operator <= (const gdsNamedStorage& x) const
bool operator < (const gdsNamedStorage& x) const
bool operator < (const string& x) const
bool operator >= (const gdsNamedStorage& x) const
bool operator > (const gdsNamedStorage& x) const

Inherited from gdsDatum:

Public Classes

enum encodingtype
ascii
ascii
binary
binary
uuencode
uuencoding
base64
base64 encoding

Public Fields

typedef std::vector <int> dimension_t
gdsDataType datatype
dimension_t dimension
void* value
encodingtype encoding

Public Methods

static bool encode(std::ostream& os, const char* val, int len, encodingtype ctype = base64, int indent = 0)
static bool decode(std::istream& is, char* val, int len, encodingtype ctype = base64)
static bool decode(const char* code, int codelen, char* val, int len, encodingtype ctype = base64)
static std::string codeName(encodingtype ctype)
static encodingtype code(std::string name)
bool resize(int dim1, int dim2 = 0, int dim3 = 0, int dim4 = 0)
int elSize() const
int elNumber() const
int size() const
int readValues(const string& txt)
void lock(bool writeaccess = false) const
bool trylock(bool writeaccess = false) const
void unlock() const

Protected Fields

mutable readwritelock rwlock

Documentation

This class is used to store diagnostics data. A storage object contains a list of data objects which have both data and parameters associated with them. Additionally, a parameter can be stored in global context. Every data object is characterized by its name which must be unique. Every parameter is characterized by its name and an associated data object (if it isn't in global context). The paramter name has to be unique within its context.

MT safe: All public methods of the storage object are multi-thread safe and can be called from independently running tasks. Direct access to its public data member should be avoided and should always guared by the mutex of the storage object.

typedef std::vector <gdsDataObject*> gdsDataObjectList
list of data objects

gdsParameter* TestType
Test class

gdsParameter* TestName
Test name

gdsParameter* Supervisory
Test supervisory

gdsParameter* TestIterator
Test iterator

gdsParameter* TestTime
Test time GPS

gdsParameter* TestTimeUTC
Test time UTC

gdsDataObject* Def
defaults data object

gdsDataObject* Sync
synchronization data object

gdsDataObjectList Env
environment objects

gdsDataObjectList Scan
scan objects

gdsDataObject* Find
find object

gdsDataObject* Test
test object

gdsDataObjectList Channel
Channel objects

gdsDataObject* Index
Index objects

gdsDataObjectList Result
Result objects

gdsDataObjectList Plot
Plot objects

gdsDataObjectList Calibration
Calibration records

gdsDataObjectList ReferenceTraces
Reference trace list

explicit diagStorage(const string& test = fftname)
Constructs a diagnostics storage object.
Returns:
void
Parameters:
test - name of test class

virtual ~diagStorage()
Destructs the storage object.
Returns:
void

bool isAuxiliaryResult(gdsDataObject& obj)
Determines ifdata object is auxiliary or part of the main. All result objects which are not listed in the index are considered auxiliarly.
Returns:
true if auxiliary
Parameters:
obj - Data object

virtual bool fsave(string filename, ioflags saveflags = ioStandard, filetype FileType = LigoLW_XML)
Saves a storage object to a file.
Returns:
true if successful
Parameters:
filename - name of the output file
saveflags - specifies what to save
filetype - specifies the filetype

virtual bool frestore(string filename, ioflags restoreflags = ioExtended, filetype FileType = LigoLW_XML)
Reads in data objects and parameters from a file and appends them to the storage object. Use the corresponding constructor if teh storage object should be created newly.)
Returns:
true if successful
Parameters:
filename - name of the input file
restoreflags - specifies what to restore
filetype - specifies the filetype

virtual bool updateTest(const string& newtest)
Updates the diagnostics test. If a new test is selected the parameters of the test object have to be updated.

Returns:
true if successful
Parameters:
newtest - name of new test

virtual bool addData(gdsDataObject& dat, bool copy = true)
Adds a data object. The data object will be copied if copy is true and stored in global context.
Returns:
true if successful
Parameters:
dat - data object
copy - copy object if true, otherwise transfer ownership

virtual bool eraseData(const string& objname)
Removes a data object. The specified data object is removed from its global context.
Returns:
true if successful
Parameters:
objname - name of data object

virtual bool eraseResults()
Erases all result objects.

Returns:
true if successful

virtual bool eraseReferenceTraces()
erase reference traces method.
Returns:
true if successful

virtual bool erasePlotSettings()
Erases all plot settings objects.

Returns:
true if successful

virtual bool eraseCalibration()
Erases all calibration record objects.

Returns:
true if successful

virtual bool purgeChannelData(int left = 0)
Purges channel data objects. This method deletes the oldest channel data object until no more than the specified amount are left.

Returns:
true if successful
Parameters:
left - number of channel data objects kept

virtual bool getChannelNames(std::vector<string>& names)
Returns channel object names. This function returns the names of the currently available raw data objects describing channel data (i.e., a time series object).

Returns:
true if successful
Parameters:
names - List of channel names

virtual bool getAuxiliaryResultNames(std::vector<string>& names)
Returns the names of the auxiliary result obejcts.

Returns:
true if successful
Parameters:
names - List of auxiliary results

virtual bool getReferenceTraceNames(std::vector<string>& names)
Returns reference trace names. This function returns the names of the currently available reference traces.

Returns:
true if successful
Parameters:
names - List of reference traces

static bool analyzeName(const string& name, string& n, int& index1, int& index2)
Separates a name into its short name and its indices.

Returns:
true if successful
Parameters:
name - name of data object or parameter
n - short name (return)
index1 - first index (return)
index2 - second index (return)

static bool analyzeName(const string& name, string& nameA, int& indexA1, int& indexA2, string& nameB, int& indexB1, int& indexB2)
Separates a hierarchical name first into its two parts and the into the corresponding short names and indices.

Returns:
true if successful
Parameters:
name - name of data object.parameter
nameA - short name of data object (return)
indexA1 - first index of data object (return)
indexA2 - second index of data object (return)
nameB - short name of parameter (return)
indexB1 - first index of parameter (return)
indexB2 - second index of parameter (return)

virtual bool set(const string& var, const string& val)
Sets a parameter or a data object value(s). The supplied name either describes a data object name, a global parameter or a hierarchical name of a data object with a parameter.

Returns:
true if successful
Parameters:
var - name of data object or one of its parameter
val - value to be set (string encoded)

virtual bool erase(const string& var, string* norm = 0)
Erases a parameter or a data object. The supplied name either describes a data object name, a global parameter or a hierarchical name of a data object with a parameter.

Returns:
true if successful
Parameters:
var - name of data object or one of its parameter
norm - normalized name

virtual bool get(const string& var, gdsDatum& dat, string* norm = 0) const
Gets a parameter or a data object value(s). The supplied name either describes a data object name, a global parameter or a hierarchical name of a data object with a parameter.

Returns:
true if successful
Parameters:
var - name of data object or one of its parameter
dat - datum (return)
norm - normalized name

virtual bool get(const string& var, string& val, string* norm = 0) const
Gets a parameter or a data object value(s). The supplied name either describes a data object name, a global parameter or a hierarchical name of a data object with a parameter.

Returns:
true if successful
Parameters:
var - name of data object or one of its parameter
dat - datum (string encoded) (return)
norm - normalized name

virtual bool getMultiple(const string& var, string& info, bool brief = true, bool nameonly = false) const
Gets a multiple parameter or a data object value(s). The supplied name either describes a data object name, a global parameter or a hierarchical name of a data object with a parameter. The wild card character '*' can be used to search all parameters and data objects which match the supplied name fragment. The wild card has to be the last character in the supplied name fragment.

Returns:
true if successful
Parameters:
var - name of data object or one of its parameter
info - parameter and data object names with value(s) (return)
brief - if true, each value is limited to one line
nameonly - if true, only names are returned

virtual bool getData(const string& name, int datatype, int len, int ofs, float*& data, int& datalength) const
Gets data from a data object in binary form. The supplied name must describes a data object name. The data type is either: 0 - asis, 1 - complex, 2 - real part, and 3 - imaginary part. Additionally, the data length and the offset into the data object have to be specified in number of points (i.e. 1 complex number point = 2 floating point numbers). This method will allocate a new data array and the caller is responsible to free it. The data block is allocated with malloc!

Returns:
true if successful
Parameters:
datatype - type of data
len - Number of data points
ofs - Offset into data object
data - pointer to data array (return)
datalen - Number of float values in data array (return)

virtual bool putData(const string& name, int datatype, int len, int ofs, const float* data, int datalength, int* newindex = 0)
Writes data to a data object in binary form. The supplied name must describes a data object name of the form "Result[]" or "Reference[]"; or it can be empty, in which case a new "Result[]" is chosen. The data type is either: 1 - complex, 2 - real. When a new data object is requested the following has to be added: 10 for time series, 20 - for spectrum, 30 - for transfer function, 40 - for list of coefficient. Additionally, the data length and the offset into the data object have to be specified in number of points (i.e. 1 complex number point = 2 floating point numbers). When successful, this method will add the data to the storage object.

Returns:
true if successful
Parameters:
datatype - type of data
len - Number of data points
ofs - Offset into data object
data - pointer to data array
datalen - Number of float values in data array
newindex - new Result index if empty name was supplied

virtual void init(const string& test)
Initializes the diagnostics test object.
Parameters:
test - name of test


This class has no child classes.
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++