Public Types | Public Member Functions | Static Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | Static Protected Attributes | Private Member Functions
DtDatatypeManager Class Reference

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:

List of all members.

Public Types

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

Public Member Functions

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 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 an array, complex, or fixed.
virtual void removeDelimiterMap (const DtString &datatype)
virtual void setDefaultDelimiter (const DtString &str)
 if no delimiter is specified, this function uses this
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 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 getStringRep (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 DtString convertStringTreeToString (DtStringTree *)
 Flatten a string tree.
virtual DtDatatypeEnum getDatatypeEnum (const DtString &datatypeName)

Static Public Member Functions

static DtDatatypeManagerdefaultInstance ()
 returns the one single rule handler

Protected Types

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

Protected Member Functions

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 getArrayRep (const DtString &datatypeName, const void *value, int size, int &returnSize, DtString &returnString)
virtual void createComplexTreeRep (const DtOMTNode *omtNode, 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 DtOMTNode *omtNode, 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
RepNamePtrMap myNameToRepMap
DtString myDefaultDelimiter
std::map< DtString, DtString > myDelimiterMap

Static Protected Attributes

static DtDatatypeManagertheDatatypeManager
 Protected member data.

Private Member Functions

 DtDatatypeManager ()
 default constructor
 DtDatatypeManager (const DtDatatypeManager &orig)
 Copy Constructor.
DtDatatypeManageroperator= (const DtDatatypeManager &rhs)
 Assignment Operator.

Detailed Description

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


Member Enumeration Documentation

Enumerator:
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.


Member Function Documentation

virtual void DtDatatypeManager::addDelimiterMap ( const DtString &  datatype,
const DtString &  delimiter 
) [virtual]

A delimiter is the divider between elements in an array, complex, or fixed.

For example, if the delimiter is :. Then an array of ints would look like this: 4:67:2:1

virtual DtString DtDatatypeManager::convertStringTreeToString ( DtStringTree ) [virtual]

Flatten a string tree.

This basically converts any function created by createStringTreeRep to the same result as getStringRep

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 int DtDatatypeManager::getComplexDatatypeCount ( DtComplexComponentNode compNode,
DtComplexDatatypeNode parentNode,
const void *  value,
int  valueSize,
int  alreadyRead,
const DtStringTree strTree = 0,
const DtStringTree parentTree = 0 
) [protected, virtual]

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

Parameters:
parentTreeA filled string tree.
virtual DtString DtDatatypeManager::getStringRep ( 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 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


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

Document ID: Generated on Tue Oct 11 19:41:03 EDT 2011 from SVN revision 107422
Copyright © 2005-2011 VT MÄK Inc. All Rights Reserved (www.mak.com)