LRAUV  revA
Slate Class Reference

Code unit that represents the slate. More...

#include <Slate.h>

Collaboration diagram for Slate:

Classes

class  StaticDestructor
 Makes sure that static objects are deleted on shutdown. More...
 

Public Member Functions

template<>
bool WriteOnce (const Str &uriPart, Component *owner, const Unit &unit, const float &writeThis)
 
template<>
bool WriteOnce (const Str &uriPart, Component *owner, const Unit &unit, const double &writeThis)
 
template<>
bool WriteOnce (const unsigned short &uriCode, Component *actor, const Unit &unit, const float &writeThis)
 
template<>
bool WriteOnce (const unsigned short &uriCode, Component *actor, const Unit &unit, const double &writeThis)
 

Static Public Member Functions

static void Construct ()
 static Constructor More...
 
static DataAccess * GetDataAccess (const unsigned short &code)
 Returns the DataAccess with the code, or NULL if none. More...
 
static DataAccess * GetDataAccess (const DataAccessor &dataAccessor, UniversalDataElement *universal=NULL)
 Returns a DataAccess with the specified attributes. More...
 
static unsigned short GetDataAccessCount ()
 Returns the number of DataAccess element currently registered. More...
 
static DataAccess * RegisterDataAccess (DataAccess *dataAccess)
 Adds the supplied DataAccess to the registries. More...
 
static DataElement * GetElement (const unsigned short &uriCode)
 Returns the DataElement of the uriCode, or NULL. More...
 
static DataElement * GetElement (const ElementURI &elementURI)
 Returns the DataElement matching the supplied ElementURI. More...
 
static ElementURI * GetElementURI (const unsigned short &code)
 Returns the ElementURI with the code, or NULL if none. More...
 
static ElementURI * GetElementURI (const ElementURI &elementURI)
 Returns the registered ElementURI matching the supplied ElementURI. More...
 
static unsigned int GetElementURICount ()
 Returns the number of registered ElementURIs. More...
 
static void CodifyElementURI (ElementURI &elementURI)
 Adds a unique code to the elementURI. More...
 
static ElementURI * RegisterElementURI (ElementURI *elementURI)
 Adds the supplied ElementURI to the registries. More...
 
static void DeRegisterElementURI (ElementURI *elementURI)
 Removes the supplied ElementURI to the registries. More...
 
static ElementURI * FindElementURI (const Str &str)
 Returns a ElementURI that matches the supplied str. More...
 
static unsigned short GetElementURICode (const char *chars)
 Returns a ElementURI code for the ElementURI that matches the supplied chars. More...
 
static CodedStr * GetName (const unsigned short &code)
 Returns the CodedStr with the code, or NULL if none. More...
 
static CodedStr * FindCodedName (const Str &name)
 Returns the CodedStr like the supplied string. More...
 
static CodedStr & GetCodedName (const Str &name)
 Returns the CodedStr like the supplied string. More...
 
static void MapDataElement (ElementURI *elementURI, DataElement *dataElement)
 Maps the supplied DataElement to the suplied Uri. More...
 
static CodedStr * RegisterCodedName (CodedStr *name)
 Adds the supplied CodedStr to the registries. More...
 
static DataReader * NewInputReader (const Str &uriPart, Component *owner, const DataValue *defaultValue, bool deleteDefaultValue=true)
 Creates a reader for this component's input (and a dataElement) Doesn't take a ComponentName, assumes it's being created in the owner's namespace. More...
 
static DataReader * NewInputReader (const ElementURI &elementURI, Component *owner, const DataValue *defaultValue, bool deleteDefaultValue=true)
 
static DataWriter * NewOutputWriter (const Str &uriPart, Component *owner, DataValue *initialValue)
 
static DataWriter * NewOutputWriter (const ElementURI &elementURI, Component *owner, DataValue *initialValue)
 
static DataReader * NewReader (const Str &componentName, const Str &uriPart, Component *owner, const DataValue *defaultValue, bool deleteDefaultValue=true)
 
static DataReader * NewReader (const ElementURI &elementURI, Component *owner, const DataValue *defaultValue, bool deleteDefaultValue=true)
 
static UniversalDataReader * NewUniversalReader (const UniversalURI &universalURI, Component *owner, const DataValue *defaultValue, bool deleteDefaultValue=true)
 
static UniversalDataWriter * NewUniversalWriter (const UniversalURI &universalURI, Component *owner, DataValue *initialValue, const float accuracy=DataElement::NO_ACCURACY)
 
static DataWriter * NewWriter (const Str &componentName, const Str &uriPart, Component *owner)
 
static DataWriter * NewWriter (const ElementURI &elementURI, Component *owner)
 
static DataElement * NewDataElement (const ElementURI &elementURI, Component *owner, const Unit &unit, BinaryDataType binaryType, const float accuracy=DataElement::NO_ACCURACY)
 
static UniversalDataElement * NewUniversalElement (const UniversalURI &universalURI, Component *owner, const Unit &unit, BinaryDataType binaryType)
 
template<typename T >
static bool ReadOnce (const Str &componentName, const Str &uriPart, const Unit &unit, T &readTo, Logger &logger, Syslog::Severity severity=Syslog::CRITICAL)
 If the value is only going to be read once, it's probably not worth providing a DataReader. More...
 
template<typename T >
static bool ReadOnce (const ElementURI &elementURI, const Unit &unit, T &readTo, Logger &logger, Syslog::Severity severity=Syslog::CRITICAL)
 
static bool ReadOnce (const Str &componentName, const Str &uriPart, DataValue &readTo, Logger &logger, Syslog::Severity severity=Syslog::CRITICAL)
 
static bool ReadOnce (const ElementURI &elementURI, DataValue &readTo, Logger &logger, Syslog::Severity severity=Syslog::CRITICAL)
 
template<typename T >
static bool ReadOnce (const unsigned short &uriCode, const Unit &unit, T &readTo, Logger &logger, Syslog::Severity severity=Syslog::CRITICAL)
 
template<typename T >
static bool WriteOnce (const Str &uriPart, Component *owner, const Unit &unit, const T &writeThis)
 If the value is only going to be written once, it's probably not worth providing a DataWriter. More...
 
static bool WriteOnce (const Str &uriPart, Component *owner, const DataValue &writeThis)
 
template<typename T >
static bool WriteOnce (const unsigned short &uriCode, Component *actor, const Unit &unit, const T &writeThis)
 
static bool WriteOnce (const unsigned short &uriCode, Component *actor, const DataValue &writeThis)
 
static void ReadDirectory (const Str &dirFilename)
 
static void ClearDirectory ()
 
static bool IsDirectoryRead ()
 
static void EnableDirectoryWrites ()
 
static void SimulateDirectoryWrites ()
 
static void WriteDirectory (LogWriter *rewriteTo=NULL, bool forceLog=false)
 

Static Public Attributes

static const unsigned short NO_LOG_FORMAT = 0x0000
 

Private Member Functions

 Slate ()
 Private Constructor for static class. More...
 

Static Private Member Functions

static DataElement * NewDataElement (const ElementURI &elementURI, Component *owner, DataValue *initialValue, float accuracy=DataElement::NO_ACCURACY)
 
static UniversalDataElement * NewUniversalElement (const UniversalURI &universalURI, Component *owner, const DataValue *testValue)
 
static bool ReadHeader (InStream &inStream)
 Read and process a header frame. More...
 
static void WriteDataAccessEntry (DataAccess *dataAccess, LogWriter *rewriteTo=NULL, bool forceWrite=false)
 Helper functions that write directory information. More...
 
static void WriteElementURIEntry (ElementURI *elementURI, LogWriter *rewriteTo=NULL, bool forceWrite=false)
 
static void WriteNameEntry (CodedStr *codeName, LogWriter *rewriteTo=NULL, bool forceWrite=false)
 
static void ConfigureNewDataElement (Component *owner, const ElementURI &elementURI, DataElement *&dataElement)
 
static void Uninitialize ()
 

Static Private Attributes

static bool DirectoryWritesEnabled_
 
static bool DirectoryWritesSimulated_
 
static unsigned short NextDataAccessCode_
 
static unsigned short NextElementURICode_
 
static unsigned short NextNameCode_
 
static bool DirectoryRead_
 
static Logger * Logger_
 
static DataElementMap * DataElementMap_
 
static UniversalMap * UniversalMap_
 
static DataAccessMap * DataAccessMap_
 
static ElementURIMap * ElementURIMap_
 
static NameMap * NameMap_
 
static DataAccessArray * DataAccessArray_
 
static DataAccessArray * DataAccessList_
 
static ElementURIArray * ElementURIArray_
 
static ElementURIList * ElementURIList_
 
static int ElementURICount_
 
static NameArray * NameArray_
 
static NameList * NameList_
 
static Mutex DataAccessMutex_
 
static Mutex ElementMutex_
 
static Mutex NameMutex_
 
static StaticDestructor StaticDestructor_
 Static instance of StaticDestructor. More...
 

Friends

class Supervisor
 Allows Supervisor to call Uninitialize. More...
 
class Unserialize
 

Detailed Description

Code unit that represents the slate.

Includes methods for registering output elements (variables) and methods for requesting input elements (variables) that also register the requester as a consumer of the requested input element.

Constructor & Destructor Documentation

Slate::Slate ( )
inlineprivate

Private Constructor for static class.

Member Function Documentation

void Slate::CodifyElementURI ( ElementURI &  elementURI)
static
void Slate::EnableDirectoryWrites ( )
static
CodedStr * Slate::FindCodedName ( const Str &  name)
static
ElementURI * Slate::FindElementURI ( const Str &  str)
static
CodedStr & Slate::GetCodedName ( const Str &  name)
static
DataAccess * Slate::GetDataAccess ( const DataAccessor &  dataAccessor,
UniversalDataElement *  universal = NULL 
)
static
static unsigned short Slate::GetDataAccessCount ( )
inlinestatic
DataElement * Slate::GetElement ( const ElementURI &  elementURI)
static

Returns the DataElement matching the supplied ElementURI.

References DataElementMap_, ElementMutex_, and FastMap< S, T >::get().

ElementURI * Slate::GetElementURI ( const ElementURI &  elementURI)
static

Returns the registered ElementURI matching the supplied ElementURI.

References ElementMutex_, ElementURIMap_, and FastMap< S, T >::get().

void Slate::MapDataElement ( ElementURI *  elementURI,
DataElement *  dataElement 
)
static
DataReader * Slate::NewInputReader ( const Str &  uriPart,
Component *  owner,
const DataValue *  defaultValue,
bool  deleteDefaultValue = true 
)
static

Creates a reader for this component's input (and a dataElement) Doesn't take a ComponentName, assumes it's being created in the owner's namespace.

References ElementURI::Create(), Syslog::CRITICAL, Component::getLogger(), Component::getName(), and Logger::syslog().

DataReader * Slate::NewInputReader ( const ElementURI &  elementURI,
Component *  owner,
const DataValue *  defaultValue,
bool  deleteDefaultValue = true 
)
static
DataWriter * Slate::NewOutputWriter ( const ElementURI &  elementURI,
Component *  owner,
DataValue *  initialValue 
)
static
DataReader * Slate::NewReader ( const ElementURI &  elementURI,
Component *  owner,
const DataValue *  defaultValue,
bool  deleteDefaultValue = true 
)
static
UniversalDataReader * Slate::NewUniversalReader ( const UniversalURI &  universalURI,
Component *  owner,
const DataValue *  defaultValue,
bool  deleteDefaultValue = true 
)
static
DataWriter * Slate::NewWriter ( const Str &  componentName,
const Str &  uriPart,
Component *  owner 
)
static
DataWriter * Slate::NewWriter ( const ElementURI &  elementURI,
Component *  owner 
)
static
void Slate::ReadDirectory ( const Str &  dirFilename)
static
static bool Slate::ReadHeader ( InStream &  inStream)
staticprivate

Read and process a header frame.

Returns
True if the header frame was processed sucessfully, False if there were any problems.
template<typename T >
static bool Slate::ReadOnce ( const Str &  componentName,
const Str &  uriPart,
const Unit &  unit,
T &  readTo,
Logger &  logger,
Syslog::Severity  severity = Syslog::CRITICAL 
)
inlinestatic
template<typename T >
bool Slate::ReadOnce ( const ElementURI &  elementURI,
const Unit &  unit,
T &  readTo,
Logger &  logger,
Syslog::Severity  severity = Syslog::CRITICAL 
)
static
static bool Slate::ReadOnce ( const Str &  componentName,
const Str &  uriPart,
DataValue &  readTo,
Logger &  logger,
Syslog::Severity  severity = Syslog::CRITICAL 
)
inlinestatic

References ReadOnce().

template<typename T >
bool Slate::ReadOnce ( const unsigned short &  uriCode,
const Unit &  unit,
T &  readTo,
Logger &  logger,
Syslog::Severity  severity = Syslog::CRITICAL 
)
static
void Slate::SimulateDirectoryWrites ( )
static
void Slate::WriteDataAccessEntry ( DataAccess *  dataAccess,
LogWriter *  rewriteTo = NULL,
bool  forceWrite = false 
)
staticprivate
void Slate::WriteElementURIEntry ( ElementURI *  elementURI,
LogWriter *  rewriteTo = NULL,
bool  forceWrite = false 
)
staticprivate
void Slate::WriteNameEntry ( CodedStr *  codeName,
LogWriter *  rewriteTo = NULL,
bool  forceWrite = false 
)
staticprivate
template<typename T >
bool Slate::WriteOnce ( const Str &  uriPart,
Component *  owner,
const Unit &  unit,
const T &  writeThis 
)
static

If the value is only going to be written once, it's probably not worth providing a DataWriter.

These functions allow for fairly efficient single writer. They return true if the value is writtem, false otherwise. Note: These writes are logged.

Referenced by CommandLine::commandSet(), Aggregate::defineArg(), NewDataElement(), Config::ParseLine(), and WriteOnce().

bool Slate::WriteOnce ( const Str &  uriPart,
Component *  owner,
const DataValue &  writeThis 
)
static
template<typename T >
bool Slate::WriteOnce ( const unsigned short &  uriCode,
Component *  actor,
const Unit &  unit,
const T &  writeThis 
)
static

References WriteOnce().

bool Slate::WriteOnce ( const unsigned short &  uriCode,
Component *  actor,
const DataValue &  writeThis 
)
static
template<>
bool Slate::WriteOnce ( const Str &  uriPart,
Component *  owner,
const Unit &  unit,
const float &  writeThis 
)

References FLOAT4, and WriteOnce().

template<>
bool Slate::WriteOnce ( const Str &  uriPart,
Component *  owner,
const Unit &  unit,
const double &  writeThis 
)

References DOUBLE8, and WriteOnce().

template<>
bool Slate::WriteOnce ( const unsigned short &  uriCode,
Component *  actor,
const Unit &  unit,
const float &  writeThis 
)

References FLOAT4, and WriteOnce().

template<>
bool Slate::WriteOnce ( const unsigned short &  uriCode,
Component *  actor,
const Unit &  unit,
const double &  writeThis 
)

References DOUBLE8, and WriteOnce().

Friends And Related Function Documentation

friend class Supervisor
friend

Allows Supervisor to call Uninitialize.

friend class Unserialize
friend

Member Data Documentation

bool Slate::DirectoryRead_
staticprivate
bool Slate::DirectoryWritesEnabled_
staticprivate
int Slate::ElementURICount_
staticprivate
unsigned short Slate::NextDataAccessCode_
staticprivate
unsigned short Slate::NextElementURICode_
staticprivate
unsigned short Slate::NextNameCode_
staticprivate
const unsigned short Slate::NO_LOG_FORMAT = 0x0000
static
Slate::StaticDestructor Slate::StaticDestructor_
staticprivate

Static instance of StaticDestructor.


The documentation for this class was generated from the following files: