vrq
Public Member Functions | Protected Member Functions | List of all members
CDataType Class Referenceabstract

Base class for describing data types. More...

#include <cdatatype.h>

Inheritance diagram for CDataType:
CObject CSimpleType

Public Member Functions

 CDataType (VarDataType_t t)
 Create data type instance. More...
 
 CDataType (VarDataType_t t, list< CNode * > packedList)
 Create data type instance. More...
 
virtual CDataTypeClone (CObstack *heap)=0
 Create a new copy with a deep copy. More...
 
virtual void SetVarDataType (VarDataType_t v)
 Set declaration's variable data type. More...
 
virtual VarDataType_t GetVarDataType () const
 Get declaration's variable data type. More...
 
virtual void SetConst (int v)
 Set declaration's const property. More...
 
virtual int GetConst () const
 Get declaration's const property. More...
 
virtual int GetTwoState () const =0
 Get declaration's 2 state property. More...
 
virtual int GetSigned () const =0
 Get declartion's signed property. More...
 
virtual NodeType_t GetNodeType (void) const =0
 Get data type. More...
 
virtual int IsBaseWidthConstant (void) const =0
 Determine if base width (sans packed dimensions) of declaration is constant, ie dependent upon only constants and parameters. More...
 
virtual int IsBaseWidthVolatile (void) const =0
 Determine if base width (sans packed dimensions) of declaration is volatile, ie depend upon parameters or variables. More...
 
virtual int IsBaseWidthEvaluateable (void) const =0
 Determine if base width (sans packed dimensions) of declaration can be evaluated. More...
 
virtual INT32 GetBaseWidth (void) const =0
 Evaluate base width (sans packed dimensions) of declaration. More...
 
virtual CNodeGetBaseWidthExp () const =0
 Get expression for datatype's base width (sans packed dimensions) More...
 
virtual int IsScalar () const
 Determine if complete data structure is a scalar. More...
 
virtual int IsVector () const =0
 Determine if complete data structure is a vector. More...
 
virtual int IsPacked () const =0
 Determine if complete data structure is packed. More...
 
virtual int IsPackedWidthConstant (void) const
 Determine if packed or vector width of declaration is constant, ie dependent upon only constants and parameters. More...
 
virtual int IsPackedWidthVolatile (void) const
 Determine if packed or vector width of declaration is volatile, ie depend upon parameters or variables. More...
 
virtual int IsPackedWidthEvaluateable (void) const
 Determine if packed or vector width of declaration can be evaluated. More...
 
virtual CNodeGetPackedMsb () const
 Get expression for declaration's msb. More...
 
virtual CNodeGetPackedLsb () const
 Get expression for declaration's lsb. More...
 
virtual CNodeGetPackedRange () const
 Get expression for datatype's overall packed or vector range (msb/lsb) More...
 
virtual INT32 GetPackedWidth (void) const
 Evaluate packed or vector width of declaration. More...
 
virtual CNodeGetPackedWidthExp () const
 Get expression for datatype's overall packed or vector width. More...
 
virtual int PackedWidthDirection (void) const
 Evaluate current decl width direction. More...
 
virtual INT32 GetNumberOfPackedDimensions (void) const
 Get number of packed dimensions of declaration. More...
 
virtual CNodeGetPackedMsi (INT32 dim) const
 Get expression tree for upper limit of given packed array dimension. More...
 
virtual CNodeGetPackedLsi (INT32 dim) const
 Get expression tree for lower limit of packed array dimension. More...
 
virtual CNodeGetPackedRange (INT32 dim) const
 Get expression for range of packed array for dimension. More...
 
virtual void Dump (FILE *f) const =0
 Dump data type info to file descriptor. More...
 
virtual void PreVisit1 (int(*callback)(CNode *, void *), void *data)
 Walk tree invoking callback on each node before children have been visited. More...
 
virtual void PostVisit1 (void(*callback)(CNode *, void *), void *data)
 Walk tree invoking callback on each node after children have been visited. More...
 
virtual void PostSubVisit1 (CNode *(*callback)(CNode *, void *), void *data)
 Walk tree invoking callback on each node after children have been visited. More...
 
- Public Member Functions inherited from CObject
void * operator new (size_t size, CObstack *stack)
 Allocate object on CObstack heap. More...
 
void operator delete (void *object)
 Destroy object. More...
 

Protected Member Functions

void Copy (CObstack *heap, const CDataType &o)
 Perform deep copy of given object to this one This should never be call directly, only by subclasses. More...
 

Detailed Description

Base class for describing data types.

Constructor & Destructor Documentation

CDataType::CDataType ( VarDataType_t  t)

Create data type instance.

CDataType::CDataType ( VarDataType_t  t,
list< CNode * >  packedList 
)

Create data type instance.

Member Function Documentation

virtual CDataType* CDataType::Clone ( CObstack heap)
pure virtual

Create a new copy with a deep copy.

Parameters
heapheap to use for allocation.

Implemented in CSimpleType.

void CDataType::Copy ( CObstack heap,
const CDataType o 
)
protected

Perform deep copy of given object to this one This should never be call directly, only by subclasses.

Parameters
heapheap to use for allocation.
odeclaration to copy.
virtual void CDataType::Dump ( FILE *  f) const
pure virtual

Dump data type info to file descriptor.

Parameters
ffile descriptor.

Implemented in CSimpleType.

virtual INT32 CDataType::GetBaseWidth ( void  ) const
pure virtual

Evaluate base width (sans packed dimensions) of declaration.

Returns
packed or vector width of declaration.

Implemented in CSimpleType.

virtual CNode* CDataType::GetBaseWidthExp ( ) const
pure virtual

Get expression for datatype's base width (sans packed dimensions)

Returns
width expression

Implemented in CSimpleType.

virtual int CDataType::GetConst ( ) const
inlinevirtual

Get declaration's const property.

Returns
value of const property.
virtual NodeType_t CDataType::GetNodeType ( void  ) const
pure virtual

Get data type.

Returns
node type

Implemented in CSimpleType.

virtual INT32 CDataType::GetNumberOfPackedDimensions ( void  ) const
inlinevirtual

Get number of packed dimensions of declaration.

Returns
number of dimensions, 0 if non-array.

Reimplemented in CSimpleType.

virtual CNode* CDataType::GetPackedLsb ( ) const
virtual

Get expression for declaration's lsb.

Valid only for Packed and Vector declarations.

Returns
lsb expression, NULL if scalar.

Reimplemented in CSimpleType.

virtual CNode* CDataType::GetPackedLsi ( INT32  dim) const
virtual

Get expression tree for lower limit of packed array dimension.

Parameters
dimdimension.
Returns
expression tree for packed lower limit.

Reimplemented in CSimpleType.

virtual CNode* CDataType::GetPackedMsb ( ) const
virtual

Get expression for declaration's msb.

Valid only for Packed and Vector declarations.

Returns
msb expression, NULL if scalar.

Reimplemented in CSimpleType.

virtual CNode* CDataType::GetPackedMsi ( INT32  dim) const
virtual

Get expression tree for upper limit of given packed array dimension.

Parameters
dimdimension.
Returns
expression tree for packed upper limit.

Reimplemented in CSimpleType.

virtual CNode* CDataType::GetPackedRange ( ) const
virtual

Get expression for datatype's overall packed or vector range (msb/lsb)

Returns
range expression, NULL if scalar.

Reimplemented in CSimpleType.

virtual CNode* CDataType::GetPackedRange ( INT32  dim) const
inlinevirtual

Get expression for range of packed array for dimension.

Parameters
dimdimension to get.
Returns
range expression for limit.

Reimplemented in CSimpleType.

virtual INT32 CDataType::GetPackedWidth ( void  ) const
virtual

Evaluate packed or vector width of declaration.

Returns
packed or vector width of declaration.

Reimplemented in CSimpleType.

virtual CNode* CDataType::GetPackedWidthExp ( ) const
virtual

Get expression for datatype's overall packed or vector width.

Returns
width expression

Reimplemented in CSimpleType.

virtual int CDataType::GetSigned ( ) const
pure virtual

Get declartion's signed property.

Returns
value of signed property.

Implemented in CSimpleType.

virtual int CDataType::GetTwoState ( ) const
pure virtual

Get declaration's 2 state property.

Returns
value of 2 state property.

Implemented in CSimpleType.

virtual VarDataType_t CDataType::GetVarDataType ( ) const
inlinevirtual

Get declaration's variable data type.

Returns
value of signed property.
virtual int CDataType::IsBaseWidthConstant ( void  ) const
pure virtual

Determine if base width (sans packed dimensions) of declaration is constant, ie dependent upon only constants and parameters.

Returns
non-zero if vector or packed width of declaration is constant.

Implemented in CSimpleType.

virtual int CDataType::IsBaseWidthEvaluateable ( void  ) const
pure virtual

Determine if base width (sans packed dimensions) of declaration can be evaluated.

Returns
non-zero of packed or vector width of declaration can be evaluated.

Implemented in CSimpleType.

virtual int CDataType::IsBaseWidthVolatile ( void  ) const
pure virtual

Determine if base width (sans packed dimensions) of declaration is volatile, ie depend upon parameters or variables.

Returns
non-zero of vector or packed width of declaration is volatile.

Implemented in CSimpleType.

virtual int CDataType::IsPacked ( ) const
pure virtual

Determine if complete data structure is packed.

Packed data structures can be treated as a single vector.

Returns
non-zero if complete data structure is packed.

Implemented in CSimpleType.

virtual int CDataType::IsPackedWidthConstant ( void  ) const
virtual

Determine if packed or vector width of declaration is constant, ie dependent upon only constants and parameters.

Returns
non-zero if vector or packed width of declaration is constant.
virtual int CDataType::IsPackedWidthEvaluateable ( void  ) const
virtual

Determine if packed or vector width of declaration can be evaluated.

Returns
non-zero of packed or vector width of declaration can be evaluated.
virtual int CDataType::IsPackedWidthVolatile ( void  ) const
virtual

Determine if packed or vector width of declaration is volatile, ie depend upon parameters or variables.

Returns
non-zero of vector or packed width of declaration is volatile.
virtual int CDataType::IsScalar ( ) const
virtual

Determine if complete data structure is a scalar.

Scalars are single-bit intergal types.

Returns
non-zero if complete data structure is a vector.
virtual int CDataType::IsVector ( ) const
pure virtual

Determine if complete data structure is a vector.

Vectors are multi-bit intergal types.

Returns
non-zero if complete data structure is a vector.

Implemented in CSimpleType.

virtual int CDataType::PackedWidthDirection ( void  ) const
virtual

Evaluate current decl width direction.

Expression must be constant.

Returns
1 - big endian, -1 - little endian, 0 - cannot be determined

Reimplemented in CSimpleType.

virtual void CDataType::PostSubVisit1 ( CNode *(*)(CNode *, void *)  callback,
void *  data 
)
virtual

Walk tree invoking callback on each node after children have been visited.

callback may modify tree and return a modified subtree.

Parameters
callbackfunction to be called for each node
dataopaque argument passed to callback function
Returns
modified child subtree.
virtual void CDataType::PostVisit1 ( void(*)(CNode *, void *)  callback,
void *  data 
)
virtual

Walk tree invoking callback on each node after children have been visited.

Parameters
callbackfunction to be called for each node
dataopaque argument passed to callback function
virtual void CDataType::PreVisit1 ( int(*)(CNode *, void *)  callback,
void *  data 
)
virtual

Walk tree invoking callback on each node before children have been visited.

callback can terminate transversal early. callback returns 0 to terminate transversal early.

Parameters
callbackfunction to be called for each node
dataopaque argument passed to callback function
virtual void CDataType::SetConst ( int  v)
inlinevirtual

Set declaration's const property.

Use to indicate type is a constant variable.

Parameters
vvalue to const property.
virtual void CDataType::SetVarDataType ( VarDataType_t  v)
inlinevirtual

Set declaration's variable data type.

Parameters
vvariable data type

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