VR-Link API Documentation for DIS
List of all members | Public Types | Public Member Functions | Static Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | Static Protected Attributes

This class handles the conversion between a byte stream and an English readable view of the data in an OMT Tree. More...

+ Collaboration diagram for DtDatatypeManager:

Public Types

enum  DtDatatypeEnum {
  SIMPLE = 1, ENUMERATED, COMPLEX, ARRAY,
  VARIANT, FIXED, DEFINED, DATATYPE_MAX
}

Public Member Functions

 DtDatatypeManager ()
 constructor
virtual ~DtDatatypeManager ()
 destructor
virtual void initOMTData (DtOMTTree *omtTree)
 Fills the datatype type tree with OMT information This function is required at initialization.
virtual DtOMTTreeomtTree ()
virtual void setImplicitPadding (bool enableImplicitPadding)
 Set whether to use implicit padding when construction datatypes.
virtual bool isImplicitPaddingEnabled () const
virtual void fillDefaultDatatypeRepList ()
 fills the simple database with the usual suspects.
virtual void addDatatypeRep (DtDatatypeRep *)
virtual void addDefinedDatatypeRep (DtDatatypeRep *)
virtual DtDatatypeRepgetSimpleDatatypeRep (const DtString &datatypeName)
virtual std::map< DtString,
DtDatatypeRep * >::iterator 
getNameRepMapList ()
 get a list of all representations.
virtual std::map< DtString,
DtDatatypeRep * >::iterator 
getNameRepMapListEnd ()
virtual void addDelimiterMap (const DtString &datatype, const DtString &delimiter)
 A delimiter is the divider between elements in a complex or fixed datatype.
virtual void removeDelimiterMap (const DtString &datatype)
virtual void setDefaultDelimiter (const DtString &str)
 if no delimiter is specified, this function uses this
virtual void setArrayWrapper (const DtString &start, const DtString &end)
 If set, this will wrap complex values with the wrapper.
virtual DtString getDelimiterMap (const DtString &datatypeName, bool *isAvailable=0)
 get the delimiter for this datatype or the default if its undefined
virtual std::map< DtString,
DtString >::iterator 
getDelimiterList ()
virtual std::map< DtString,
DtString >::iterator 
getDelimiterListEnd ()
virtual void addArrayBracketMap (const DtString &datatype, bool valueIsBracketed)
 Specifies if values of the given datatype when found in an array are bracketed or not.
virtual void removeArrayBracketMap (const DtString &datatype)
virtual void setDefaultArrayBracket (bool valueIsBracketed)
 if no bracket is specified, array values are bracket as specified here.
virtual bool getArrayBracketMap (const DtString &datatypeName, bool *isAvailable=0)
 get the array bracket setting for this datatype or the default if its undefined
virtual std::map< DtString,
bool >::iterator 
getArrayBracketList ()
virtual std::map< DtString,
bool >::iterator 
getArrayBracketListEnd ()
virtual void readFile (DtString str)
 Read the datatype mapping file.
virtual void writeFile (DtString str)
 Write out to the datatype mapping file.
virtual void addRepMapping (const DtString &datatype, const DtString &rep)
virtual void removeRepMapping (const DtString &datatype)
virtual bool modifyRepMapping (const DtString &datatype, const DtString &rep)
 Modify a mapping.
virtual std::map< DtString,
DtString >::iterator 
getRepMapList ()
 Get a list of all the Representation mappings.
virtual std::map< DtString,
DtString >::iterator 
getRepMapListEnd ()
virtual DtString getFedNodeStringRep (const DtDatatypeFedNode *currFedNode, const void *value, int size, int &returnSize)
 Get the string representation from the datatype and the value The size input is the size that the network says the datatype is, but that gets modified to the actual size read.
virtual DtString getStringRep (const DtString &datatypeName, const void *value, int size, int &returnSize)
virtual DtStringTreecreateStringTreeRep (const DtDatatypeFedNode *currFedNode, const void *value, int size, int &returnSize, unsigned int currentOffset=0, DtObjectHistory *=0)
 Creates a string tree from a datatype.
virtual DtStringTreecreateStringTreeRep (const DtString &datatypeName, const void *value, int size, int &returnSize, const DtOMTNode *omtNode=0, unsigned int currentOffset=0, DtStringTree *strParentTree=0, DtObjectHistory *=0)
virtual void getValueFromStringRep (const DtString &datatypeName, const DtString &stringRep, std::vector< char > &result)
 The exact reverse of getStringRep.
virtual DtString convertStringTreeToString (DtStringTree *, const DtString &delimiter)
 Flatten a string tree.
virtual DtDatatypeEnum getDatatypeEnum (const DtString &datatypeName)

Static Public Member Functions

static DtDatatypeManagerdefaultInstance ()
 returns a singleton datatype manager

Protected Types

typedef std::map< DtString,
DtString
DatatypeNameRepNameMap
typedef std::map< DtString,
DtDatatypeRep * > 
RepNamePtrMap

Protected Member Functions

 DtDatatypeManager (const DtDatatypeManager &orig)
 Copy Constructor - Not Implemented!
DtDatatypeManageroperator= (const DtDatatypeManager &rhs)
 Assignment Operator - Not Implemented!
virtual void checkOrphanMappings ()
virtual void checkObjOrphans (DtObjectClassFedNode *objClass)
virtual void checkIntOrphans (DtInteractionClassFedNode *intClass)
virtual void getDefaultRep (const void *value, int size, int &returnSize, DtString &returnString)
 Helper functions for getStringRep and createStringTreeRep.
virtual void getDatatypeRep (const DtString &datatypeName, const void *value, int size, int &returnSize, DtString &returnString)
virtual void getEnumRep (const DtString &datatypeName, const void *value, int size, int &returnSize, DtString &returnString)
virtual void getVariantRep (const DtString &datatypeName, const void *value, int size, int &returnSize, DtString &returnString)
virtual void getArrayRepBySize (const DtString &datatypeName, const void *value, int size, int &returnSize, DtString &returnString)
virtual void getArrayRepByCount (DtArrayDatatypeNode *arrayNode, const void *value, int size, int &returnSize, DtString &returnString)
virtual void getArrayRep (const DtString &datatypeName, const void *value, int size, int &returnSize, DtString &returnString)
virtual void getValueFromDatatypeRep (const DtString &datatypeName, const DtString &stringRep, std::vector< char > &result)
 Helper functions for getValueFromStringRep.
virtual void getValueFromArrayRep (const DtString &datatypeName, const DtString &stringRep, std::vector< char > &result)
virtual void getValueFromComplexRep (const DtString &datatypeName, const DtString &stringRep, std::vector< char > &result)
virtual void getValueFromFixedRep (const DtString &datatypeName, const DtString &stringRep, std::vector< char > &result)
virtual void getValueFromEnumRep (const DtString &datatypeName, const DtString &stringRep, std::vector< char > &result)
virtual void createComplexTreeRep (const DtString &datatypeName, const void *value, int size, int &returnSize, DtStringTree *strTree, DtStringTree *strParentTree=0, unsigned int currentOffset=0, DtObjectHistory *=0)
 Helper functions for createStringTreeRep.
virtual void createArrayTreeRep (const DtString &datatypeName, const void *value, int size, int &returnSize, DtStringTree *strTree, DtStringTree *strParentTree=0, unsigned int currentOffset=0, DtObjectHistory *=0)
virtual void createDefinedTreeRep (const DtString &datatypeName, const void *value, int size, int &returnSize, DtStringTree *strTree, DtStringTree *strParentTree=0, unsigned int currentOffset=0, DtObjectHistory *=0)
virtual void createVariantTreeRep (const DtString &datatypeName, const void *value, int size, int &returnSize, DtStringTree *strTree, DtStringTree *strParentTree=0, unsigned int currentOffset=0, DtObjectHistory *=0)
virtual void createFixedTreeRep (const DtString &datatypeName, const void *value, int size, int &returnSize, DtStringTree *strTree, DtStringTree *strParentTree=0, unsigned int currentOffset=0, DtObjectHistory *=0)
virtual void processMappings (DtlObjPtr &ptr)
 Helper function for the datatype Mapping file.
virtual int getComplexDatatypeCount (DtComplexComponentNode *compNode, DtComplexDatatypeNode *parentNode, const void *value, int valueSize, int alreadyRead, const DtStringTree *strTree=0, const DtStringTree *parentTree=0)
 Complex and array datatypes have an undetermined amount of elements This function returns the correct element count.
virtual int getArrayDatatypeCount (DtArrayDatatypeNode *arrayNode, const void *value, int valueSize, const DtStringTree *strTree=0, const DtStringTree *parentTree=0)

Protected Attributes

DtOMTTreemyOMTTree
std::map< DtString,
DtDatatypeEnum
myDatatypeTypeMap
DatatypeNameRepNameMap myDatatypeToRepMap
std::set< DtStringmyRemappedDatatypes
RepNamePtrMap myNameToRepMap
DtString myDefaultDelimiter
std::map< DtString, DtStringmyDelimiterMap
DtString myStartWrapper
DtString myEndWrapper
DtString myDefaultArrayBracket
std::map< DtString, bool > myArrayBracketMap
bool myUseImplicitPadding

Static Protected Attributes

static DtDatatypeManagertheDatatypeManager
 Protected member data.

Detailed Description

This class handles the conversion between a byte stream and an English readable view of the data in an OMT Tree.

Member Typedef Documentation

Member Enumeration Documentation

Enumerator:
SIMPLE 
ENUMERATED 

A basic datatype such as int or bool.

COMPLEX 

An Enumeration that maps an integer to a string value.

ARRAY 

A collection of different data types in one.

VARIANT 

A collection of the same datatype in one.

FIXED 

A datatype that could be of a different type at runtime.

DEFINED 

A fixed set of a collection of different data types.

DATATYPE_MAX 

An INTERNALLY defined set of different data types.

Constructor & Destructor Documentation

DtDatatypeManager::DtDatatypeManager ( )

constructor

virtual DtDatatypeManager::~DtDatatypeManager ( )
virtual

destructor

DtDatatypeManager::DtDatatypeManager ( const DtDatatypeManager orig)
protected

Copy Constructor - Not Implemented!

Member Function Documentation

virtual void DtDatatypeManager::addArrayBracketMap ( const DtString datatype,
bool  valueIsBracketed 
)
virtual

Specifies if values of the given datatype when found in an array are bracketed or not.

For example, an array of integer values 1,2,3,4 would be "[1][2][3][4]" whereas an array of unbracketed characters a,b,c,d would be "abcd"

virtual void DtDatatypeManager::addDatatypeRep ( DtDatatypeRep )
virtual
virtual void DtDatatypeManager::addDefinedDatatypeRep ( DtDatatypeRep )
virtual
virtual void DtDatatypeManager::addDelimiterMap ( const DtString datatype,
const DtString delimiter 
)
virtual

A delimiter is the divider between elements in a complex or fixed datatype.

like this: 123:456:100

virtual void DtDatatypeManager::addRepMapping ( const DtString datatype,
const DtString rep 
)
virtual
virtual void DtDatatypeManager::checkIntOrphans ( DtInteractionClassFedNode intClass)
protectedvirtual
virtual void DtDatatypeManager::checkObjOrphans ( DtObjectClassFedNode objClass)
protectedvirtual
virtual void DtDatatypeManager::checkOrphanMappings ( )
protectedvirtual
virtual DtString DtDatatypeManager::convertStringTreeToString ( DtStringTree ,
const DtString delimiter 
)
virtual

Flatten a string tree.

This basically converts any function created by createStringTreeRep to the same result as getStringRep Delimiter specifies the character(s) separating components of the datatype.

virtual void DtDatatypeManager::createArrayTreeRep ( const DtString datatypeName,
const void *  value,
int  size,
int &  returnSize,
DtStringTree strTree,
DtStringTree strParentTree = 0,
unsigned int  currentOffset = 0,
DtObjectHistory *  = 0 
)
protectedvirtual
virtual void DtDatatypeManager::createComplexTreeRep ( const DtString datatypeName,
const void *  value,
int  size,
int &  returnSize,
DtStringTree strTree,
DtStringTree strParentTree = 0,
unsigned int  currentOffset = 0,
DtObjectHistory *  = 0 
)
protectedvirtual

Helper functions for createStringTreeRep.

virtual void DtDatatypeManager::createDefinedTreeRep ( const DtString datatypeName,
const void *  value,
int  size,
int &  returnSize,
DtStringTree strTree,
DtStringTree strParentTree = 0,
unsigned int  currentOffset = 0,
DtObjectHistory *  = 0 
)
protectedvirtual
virtual void DtDatatypeManager::createFixedTreeRep ( const DtString datatypeName,
const void *  value,
int  size,
int &  returnSize,
DtStringTree strTree,
DtStringTree strParentTree = 0,
unsigned int  currentOffset = 0,
DtObjectHistory *  = 0 
)
protectedvirtual
virtual DtStringTree* DtDatatypeManager::createStringTreeRep ( const DtDatatypeFedNode currFedNode,
const void *  value,
int  size,
int &  returnSize,
unsigned int  currentOffset = 0,
DtObjectHistory *  = 0 
)
virtual

Creates a string tree from a datatype.

This can be a single string if this is a simple datatype, or a more elaborate structure on more complex datatype. Note that this is a 'create' function and the caller is responsible for deleting the string tree

Parameters
datatypeNameThe Name of the datatype that is defined in value
valueA series of bytes from the network.
sizeThe total size of bytes in value
returnSizeThis gets filled with the actual number of bytes read. If there is a problem and the number of bytes is too many, this returns -1.
virtual DtStringTree* DtDatatypeManager::createStringTreeRep ( const DtString datatypeName,
const void *  value,
int  size,
int &  returnSize,
const DtOMTNode omtNode = 0,
unsigned int  currentOffset = 0,
DtStringTree strParentTree = 0,
DtObjectHistory *  = 0 
)
virtual
virtual void DtDatatypeManager::createVariantTreeRep ( const DtString datatypeName,
const void *  value,
int  size,
int &  returnSize,
DtStringTree strTree,
DtStringTree strParentTree = 0,
unsigned int  currentOffset = 0,
DtObjectHistory *  = 0 
)
protectedvirtual
static DtDatatypeManager* DtDatatypeManager::defaultInstance ( )
static

returns a singleton datatype manager

virtual void DtDatatypeManager::fillDefaultDatatypeRepList ( )
virtual

fills the simple database with the usual suspects.

virtual std::map<DtString,bool>::iterator DtDatatypeManager::getArrayBracketList ( )
virtual
virtual std::map<DtString,bool>::iterator DtDatatypeManager::getArrayBracketListEnd ( )
virtual
virtual bool DtDatatypeManager::getArrayBracketMap ( const DtString datatypeName,
bool *  isAvailable = 0 
)
virtual

get the array bracket setting for this datatype or the default if its undefined

virtual int DtDatatypeManager::getArrayDatatypeCount ( DtArrayDatatypeNode arrayNode,
const void *  value,
int  valueSize,
const DtStringTree strTree = 0,
const DtStringTree parentTree = 0 
)
protectedvirtual
virtual void DtDatatypeManager::getArrayRep ( const DtString datatypeName,
const void *  value,
int  size,
int &  returnSize,
DtString returnString 
)
protectedvirtual
virtual void DtDatatypeManager::getArrayRepByCount ( DtArrayDatatypeNode arrayNode,
const void *  value,
int  size,
int &  returnSize,
DtString returnString 
)
protectedvirtual
virtual void DtDatatypeManager::getArrayRepBySize ( const DtString datatypeName,
const void *  value,
int  size,
int &  returnSize,
DtString returnString 
)
protectedvirtual
virtual int DtDatatypeManager::getComplexDatatypeCount ( DtComplexComponentNode compNode,
DtComplexDatatypeNode parentNode,
const void *  value,
int  valueSize,
int  alreadyRead,
const DtStringTree strTree = 0,
const DtStringTree parentTree = 0 
)
protectedvirtual

Complex and array datatypes have an undetermined amount of elements This function returns the correct element count.

Parameters
parentTreeA filled string tree.
virtual DtDatatypeEnum DtDatatypeManager::getDatatypeEnum ( const DtString datatypeName)
virtual
virtual void DtDatatypeManager::getDatatypeRep ( const DtString datatypeName,
const void *  value,
int  size,
int &  returnSize,
DtString returnString 
)
protectedvirtual
virtual void DtDatatypeManager::getDefaultRep ( const void *  value,
int  size,
int &  returnSize,
DtString returnString 
)
protectedvirtual

Helper functions for getStringRep and createStringTreeRep.

virtual std::map<DtString,DtString>::iterator DtDatatypeManager::getDelimiterList ( )
virtual
virtual std::map<DtString,DtString>::iterator DtDatatypeManager::getDelimiterListEnd ( )
virtual
virtual DtString DtDatatypeManager::getDelimiterMap ( const DtString datatypeName,
bool *  isAvailable = 0 
)
virtual

get the delimiter for this datatype or the default if its undefined

virtual void DtDatatypeManager::getEnumRep ( const DtString datatypeName,
const void *  value,
int  size,
int &  returnSize,
DtString returnString 
)
protectedvirtual
virtual DtString DtDatatypeManager::getFedNodeStringRep ( const DtDatatypeFedNode currFedNode,
const void *  value,
int  size,
int &  returnSize 
)
virtual

Get the string representation from the datatype and the value The size input is the size that the network says the datatype is, but that gets modified to the actual size read.

Parameters
datatypeNameThe Name of the datatype that is defined in value
valueA series of bytes from the network.
sizeThe total size of bytes in value
returnSizeThis gets filled with the actual number of bytes read. If there is a problem and the number of bytes is too many, this returns -1.
virtual std::map<DtString,DtDatatypeRep*>::iterator DtDatatypeManager::getNameRepMapList ( )
virtual

get a list of all representations.

virtual std::map<DtString,DtDatatypeRep*>::iterator DtDatatypeManager::getNameRepMapListEnd ( )
virtual
virtual std::map<DtString,DtString>::iterator DtDatatypeManager::getRepMapList ( )
virtual

Get a list of all the Representation mappings.

virtual std::map<DtString,DtString>::iterator DtDatatypeManager::getRepMapListEnd ( )
virtual
virtual DtDatatypeRep* DtDatatypeManager::getSimpleDatatypeRep ( const DtString datatypeName)
virtual
virtual DtString DtDatatypeManager::getStringRep ( const DtString datatypeName,
const void *  value,
int  size,
int &  returnSize 
)
virtual
virtual void DtDatatypeManager::getValueFromArrayRep ( const DtString datatypeName,
const DtString stringRep,
std::vector< char > &  result 
)
protectedvirtual
virtual void DtDatatypeManager::getValueFromComplexRep ( const DtString datatypeName,
const DtString stringRep,
std::vector< char > &  result 
)
protectedvirtual
virtual void DtDatatypeManager::getValueFromDatatypeRep ( const DtString datatypeName,
const DtString stringRep,
std::vector< char > &  result 
)
protectedvirtual

Helper functions for getValueFromStringRep.

virtual void DtDatatypeManager::getValueFromEnumRep ( const DtString datatypeName,
const DtString stringRep,
std::vector< char > &  result 
)
protectedvirtual
virtual void DtDatatypeManager::getValueFromFixedRep ( const DtString datatypeName,
const DtString stringRep,
std::vector< char > &  result 
)
protectedvirtual
virtual void DtDatatypeManager::getValueFromStringRep ( const DtString datatypeName,
const DtString stringRep,
std::vector< char > &  result 
)
virtual

The exact reverse of getStringRep.

This function takes a StringRep and converts it to a byte value. As well as it can.

Parameters
datatypeNameThe Name of the datatype that is defined in value
stringRepThe string representation of the datatype
virtual void DtDatatypeManager::getVariantRep ( const DtString datatypeName,
const void *  value,
int  size,
int &  returnSize,
DtString returnString 
)
protectedvirtual
virtual void DtDatatypeManager::initOMTData ( DtOMTTree omtTree)
virtual

Fills the datatype type tree with OMT information This function is required at initialization.

virtual bool DtDatatypeManager::isImplicitPaddingEnabled ( ) const
virtual
virtual bool DtDatatypeManager::modifyRepMapping ( const DtString datatype,
const DtString rep 
)
virtual

Modify a mapping.

Do not do anything if the mapping does not exist returns true if a mapping is modified, false otherwise

virtual DtOMTTree* DtDatatypeManager::omtTree ( )
inlinevirtual
DtDatatypeManager& DtDatatypeManager::operator= ( const DtDatatypeManager rhs)
protected

Assignment Operator - Not Implemented!

virtual void DtDatatypeManager::processMappings ( DtlObjPtr ptr)
protectedvirtual

Helper function for the datatype Mapping file.

virtual void DtDatatypeManager::readFile ( DtString  str)
virtual

Read the datatype mapping file.

virtual void DtDatatypeManager::removeArrayBracketMap ( const DtString datatype)
virtual
virtual void DtDatatypeManager::removeDelimiterMap ( const DtString datatype)
virtual
virtual void DtDatatypeManager::removeRepMapping ( const DtString datatype)
virtual
virtual void DtDatatypeManager::setArrayWrapper ( const DtString start,
const DtString end 
)
virtual

If set, this will wrap complex values with the wrapper.

Allows for things like this: [x,y,z] (if the wrapper is "[","]")

virtual void DtDatatypeManager::setDefaultArrayBracket ( bool  valueIsBracketed)
virtual

if no bracket is specified, array values are bracket as specified here.

virtual void DtDatatypeManager::setDefaultDelimiter ( const DtString str)
virtual

if no delimiter is specified, this function uses this

virtual void DtDatatypeManager::setImplicitPadding ( bool  enableImplicitPadding)
virtual

Set whether to use implicit padding when construction datatypes.

virtual void DtDatatypeManager::writeFile ( DtString  str)
virtual

Write out to the datatype mapping file.

Member Data Documentation

std::map<DtString,bool> DtDatatypeManager::myArrayBracketMap
protected
DatatypeNameRepNameMap DtDatatypeManager::myDatatypeToRepMap
protected
std::map<DtString,DtDatatypeEnum> DtDatatypeManager::myDatatypeTypeMap
protected
DtString DtDatatypeManager::myDefaultArrayBracket
protected
DtString DtDatatypeManager::myDefaultDelimiter
protected
std::map<DtString,DtString> DtDatatypeManager::myDelimiterMap
protected
DtString DtDatatypeManager::myEndWrapper
protected
RepNamePtrMap DtDatatypeManager::myNameToRepMap
protected
DtOMTTree* DtDatatypeManager::myOMTTree
protected
std::set<DtString> DtDatatypeManager::myRemappedDatatypes
protected
DtString DtDatatypeManager::myStartWrapper
protected
bool DtDatatypeManager::myUseImplicitPadding
protected
DtDatatypeManager* DtDatatypeManager::theDatatypeManager
staticprotected

Protected member data.


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

Document ID: Generated on Wed Aug 14 15:35:11 EDT 2013 from SVN revision 130445
Copyright © 2005-2013 VT MÄK. All Rights Reserved (www.mak.com)