MDType Class Reference

Holds the definition of a metadata type. More...

#include <mdtype.h>

Inheritance diagram for MDType:

RefCount IRefCount List of all members.

Public Types

typedef std::pair< std::string,
MDValuePtr
NamedValue
 Name and value pair for enums.
typedef std::list< NamedValueNamedValueList
 List of name and value pairs for enums.

Public Member Functions

MDTypePtr EffectiveType (void)
 Report the effective type of this type.
MDTypeClass EffectiveClass (void) const
 Report the effective class of this type.
MDTypePtr EffectiveBase (void) const
 Report the effective base type of this type.
TypeRef EffectiveRefType (void) const
 Report the effective reference type of this type.
std::string EffectiveRefTarget (void) const
 Report the effective reference target of this type.
UInt32 EffectiveSize (void) const
 Report the effective size of this type.
bool HandlesSubdata (void) const
 Does this value's trait take control of all sub-data and build values in the our own DataChunk?
void SetEndian (bool Val)
 Endian access function (set).
bool GetEndian (void) const
 Endian access function (get).
void SetArrayClass (MDArrayClass Val)
 ArrayClass access function (set).
MDArrayClass GetArrayClass (void)
 ArrayClass access function (get).
const std::string & Name (void) const
 Get the name of this type.
const ULPtrGetTypeUL (void) const
 Read-only access to the type UL.
NamedValueListGetEnumValues (void)
 (not Read-only) access to the enumerated value list
void SetRefType (TypeRef Val)
 Set the reference type.
TypeRef GetRefType (void) const
 Get the reference type.
void SetRefTarget (std::string Val)
 Set the reference target.
std::string GetRefTarget (void) const
 Get the reference target.
bool AddEnumValue (std::string Name, MDValuePtr &Value)
 Add a new value to an enumerated value type.
bool AddEnumValue (std::string Name, std::string Value)
 Add a new value to an enumerated value type.
bool AddEnumValue (std::string Name, ULPtr &Value)
 Add a new UL value to an enumerated value type.
void SetTraits (MDTraitsPtr Tr)
 Set the traits for this type.
MDTraitsPtr GetTraits (void) const
 Access the traits for this type.

Static Public Member Functions

static MDTypePtr AddBasic (std::string TypeName, ULPtr &UL, int TypeSize)
 Add a new basic type.
static MDTypePtr AddInterpretation (std::string TypeName, MDTypePtr BaseType, ULPtr &UL, int Size=0)
 Add a new interpretation type.
static MDTypePtr AddArray (std::string TypeName, MDTypePtr BaseType, ULPtr &UL, int ArraySize=0)
 Add a new array type.
static MDTypePtr AddCompound (std::string TypeName, ULPtr &UL)
 Add a new compound type.
static MDTypePtr AddEnum (std::string TypeName, MDTypePtr BaseType, ULPtr &UL)
 Add a new enumerated value type.
static MDTypePtr Find (std::string TypeName, bool SearchAll=false)
 Find a type in the default symbol space, optionally searching all others.
static MDTypePtr Find (std::string TypeName, SymbolSpacePtr &SymSpace, bool SearchAll=false)
 Find a type in a specified symbol space, optionally searching all others.
static MDTypePtr Find (const UL &BaseUL)
 Find a type by UL.
static MDTypePtr Find (ULPtr &BaseUL)
 Find a type by ULPtr.
static bool AddTraitsMapping (std::string TypeName, std::string TraitsName)
 Add a mapping to be applied to all types of a given type name.
static bool UpdateTraitsMapping (std::string TypeName, std::string TraitsName)
 Update an existing mapping and apply to any existing type of the given name.
static bool AddTraitsMapping (const UL &TypeUL, std::string TraitsName)
 Add a mapping to be applied to all types of a given type UL.
static bool UpdateTraitsMapping (const UL &TypeUL, std::string TraitsName)
 Update an existing mapping and apply to any existing type of the given UL.
static MDTraitsPtr LookupTraitsMapping (std::string TypeName, std::string DefaultTraitsName="")
 Lookup the traits for a specified type name.
static MDTraitsPtr LookupTraitsMapping (const UL &TypeUL, const UL &DefaultTraitsUL)
 Lookup the traits for a specified type UL.
static MDTraitsPtr LookupTraitsMapping (std::string TypeName, const UL &DefaultTraitsUL)
 Lookup the traits for a specified type name.
static MDTraitsPtr LookupTraitsMapping (const UL &TypeUL, std::string DefaultTraitsName="")
 Lookup the traits for a specified type UL.

Public Attributes

MDTypeParent Base
 Base class if this is a derived class, else NULL.
StringList ChildOrder
 Child names in order for compound types.
int Size
 The size of the item in multiples of base class items, or 0 if it is variable.

Protected Types

typedef std::map< std::string,
MDTraitsPtr
TraitsMapType
 Type to map type names to their handling traits.
typedef std::map< UL, MDTraitsPtrTraitsULMapType
 Type to map type ULs to their handling traits.

Protected Member Functions

 MDType (std::string TypeName, MDTypeClass TypeClass, ULPtr &UL, MDTraitsPtr TypeTraits)
 Construct a basic MDType.
 MDType ()
 Prevent auto construction by NOT having an implementation to this constructor.
 MDType (const MDType &rhs)
 Prevent copy construction by NOT having an implementation to this copy constructor.
void AddSub (std::string SubName, MDTypePtr SubType)
 Add a sub to a compound type.

Static Protected Member Functions

static void AddType (MDTypePtr &Type, ULPtr &TypeUL)
 Add a given type to the lookups.

Protected Attributes

std::string TypeName
 Name of this MDType.
MDTypeClass Class
 Class of this MDType.
MDArrayClass ArrayClass
 Sub-class of array.
MDTraitsPtr Traits
 Traits for this MDType.
ULPtr TypeUL
 The UL for this type.
bool Endian
 Flag set to 'true' if this basic type should ever be byte-swapped.
TypeRef RefType
 Reference type of this type (if a reference source or target), if TypeRefUndefined then inherit.
std::string RefTarget
 Reference target of this type (if a reference source), if "" then inherit.
NamedValueList EnumValues
 List of enumerated values, if this is an enum, each with its value name.

Static Protected Attributes

static MDTypeList Types
 All types managed by this object.
static std::map< UL, MDTypePtrULLookup
 Map for UL lookups.
static std::map< UL, MDTypePtrULLookupVer1
 Map for UL lookups - ignoring the version number (all entries use version = 1).
static MDTypeMap NameLookup
 Map for reverse lookups based on type name.
static TraitsMapType TraitsMap
 Map of type names to thair handling traits.
static TraitsULMapType TraitsULMap
 Map of type ULs to thair handling traits.

Friends

class MDValue

Detailed Description

Holds the definition of a metadata type.


Member Typedef Documentation

typedef std::pair<std::string, MDValuePtr> NamedValue

Name and value pair for enums.

typedef std::list<NamedValue> NamedValueList

List of name and value pairs for enums.

typedef std::map<std::string, MDTraitsPtr> TraitsMapType [protected]

Type to map type names to their handling traits.

typedef std::map<UL, MDTraitsPtr> TraitsULMapType [protected]

Type to map type ULs to their handling traits.


Constructor & Destructor Documentation

MDType ( std::string  TypeName,
MDTypeClass  TypeClass,
ULPtr UL,
MDTraitsPtr  TypeTraits 
) [inline, protected]

Construct a basic MDType.

This constructor is protected so the ONLY way to create new MDTypes from outside this class is via AddBasic() etc.

MDType (  )  [protected]

Prevent auto construction by NOT having an implementation to this constructor.

MDType ( const MDType rhs  )  [protected]

Prevent copy construction by NOT having an implementation to this copy constructor.


Member Function Documentation

void AddSub ( std::string  SubName,
MDTypePtr  SubType 
) [protected]

Add a sub to a compound type.

MDTypePtr EffectiveType ( void   ) 

Report the effective type of this type.

Note:
Care must be taken using this function because it is easy to end up confused and read properties from the "effective" type that should be read from the interpretation instead (such as traits)

MDTypeClass EffectiveClass ( void   )  const

Report the effective class of this type.

MDTypePtr EffectiveBase ( void   )  const

Report the effective base type of this type.

TypeRef EffectiveRefType ( void   )  const

Report the effective reference type of this type.

std::string EffectiveRefTarget ( void   )  const

Report the effective reference target of this type.

UInt32 EffectiveSize ( void   )  const

Report the effective size of this type.

Returns:
The size in bytes of a single instance of this type, or 0 if variable size

bool HandlesSubdata ( void   )  const [inline]

Does this value's trait take control of all sub-data and build values in the our own DataChunk?

Normally any contained sub-types (such as array items or compound members) hold their own data

void SetEndian ( bool  Val  )  [inline]

Endian access function (set).

bool GetEndian ( void   )  const [inline]

Endian access function (get).

void SetArrayClass ( MDArrayClass  Val  )  [inline]

ArrayClass access function (set).

MDArrayClass GetArrayClass ( void   )  [inline]

ArrayClass access function (get).

const std::string& Name ( void   )  const [inline]

Get the name of this type.

const ULPtr& GetTypeUL ( void   )  const [inline]

Read-only access to the type UL.

NamedValueList& GetEnumValues ( void   )  [inline]

(not Read-only) access to the enumerated value list

void SetRefType ( TypeRef  Val  )  [inline]

Set the reference type.

TypeRef GetRefType ( void   )  const [inline]

Get the reference type.

void SetRefTarget ( std::string  Val  )  [inline]

Set the reference target.

std::string GetRefTarget ( void   )  const [inline]

Get the reference target.

MDTypePtr AddBasic ( std::string  TypeName,
ULPtr UL,
int  TypeSize 
) [static]

Add a new basic type.

DRAGONS: Currently doesn't check for duplicates

MDTypePtr AddInterpretation ( std::string  TypeName,
MDTypePtr  BaseType,
ULPtr UL,
int  Size = 0 
) [static]

Add a new interpretation type.

DRAGONS: Currently doesn't check for duplicates

MDTypePtr AddArray ( std::string  TypeName,
MDTypePtr  BaseType,
ULPtr UL,
int  Size = 0 
) [static]

Add a new array type.

DRAGONS: Currently doesn't check for duplicates

MDTypePtr AddCompound ( std::string  TypeName,
ULPtr UL 
) [static]

Add a new compound type.

DRAGONS: Currently doesn't check for duplicates

MDTypePtr AddEnum ( std::string  TypeName,
MDTypePtr  BaseType,
ULPtr UL 
) [static]

Add a new enumerated value type.

DRAGONS: Currently doesn't check for duplicates

bool AddEnumValue ( std::string  Name,
MDValuePtr Value 
)

Add a new value to an enumerated value type.

DRAGONS: This actual value object will be added to the enumeration class - don't change the value after adding it!

Returns:
true if all OK

bool AddEnumValue ( std::string  Name,
std::string  Value 
)

Add a new value to an enumerated value type.

DRAGONS: This actual value object will be added to the enumeration class - don't change the value after adding it!

Returns:
true if all OK

bool AddEnumValue ( std::string  Name,
ULPtr Value 
)

Add a new UL value to an enumerated value type.

DRAGONS: This actual value object will be added to the enumeration class - don't change the value after adding it!

Returns:
true if all OK

static MDTypePtr Find ( std::string  TypeName,
bool  SearchAll = false 
) [inline, static]

Find a type in the default symbol space, optionally searching all others.

MDTypePtr Find ( std::string  TypeName,
SymbolSpacePtr SymSpace,
bool  SearchAll = false 
) [static]

Find a type in a specified symbol space, optionally searching all others.

Returns:
Pointer to the object

NULL if there is no type of that name

Note:
If BaseType contains a qualified name of the format "symbolspace::name" then only the specified symbolspace is searched

MDTypePtr Find ( const UL BaseUL  )  [static]

Find a type by UL.

Returns:
Pointer to the object

NULL if there is no type with that UL

static MDTypePtr Find ( ULPtr BaseUL  )  [inline, static]

Find a type by ULPtr.

void SetTraits ( MDTraitsPtr  Tr  )  [inline]

Set the traits for this type.

MDTraitsPtr GetTraits ( void   )  const [inline]

Access the traits for this type.

void AddType ( MDTypePtr Type,
ULPtr TypeUL 
) [static, protected]

Add a given type to the lookups.

bool AddTraitsMapping ( std::string  TypeName,
std::string  TraitsName 
) [static]

Add a mapping to be applied to all types of a given type name.

Note:
This will act retrospectively

static bool UpdateTraitsMapping ( std::string  TypeName,
std::string  TraitsName 
) [inline, static]

Update an existing mapping and apply to any existing type of the given name.

bool AddTraitsMapping ( const UL TypeUL,
std::string  TraitsName 
) [static]

Add a mapping to be applied to all types of a given type UL.

Note:
This will act retrospectively

static bool UpdateTraitsMapping ( const UL TypeUL,
std::string  TraitsName 
) [inline, static]

Update an existing mapping and apply to any existing type of the given UL.

MDTraitsPtr LookupTraitsMapping ( std::string  TypeName,
std::string  DefaultTraitsName = "" 
) [static]

Lookup the traits for a specified type name.

If no traits have been defined for the specified type the traits with the name given in DefaultTraitsName is used (if specified)

MDTraitsPtr LookupTraitsMapping ( const UL TypeUL,
const UL DefaultTraitsUL 
) [static]

Lookup the traits for a specified type UL.

If no traits have been defined for the specified type the traits with the UL given in DefaultTraitsName is used

MDTraitsPtr LookupTraitsMapping ( std::string  TypeName,
const UL DefaultTraitsUL 
) [static]

Lookup the traits for a specified type name.

If no traits have been defined for the specified type the traits with the UL given in DefaultTraitsName is used

MDTraitsPtr LookupTraitsMapping ( const UL TypeUL,
std::string  DefaultTraitsName = "" 
) [static]

Lookup the traits for a specified type UL.

If no traits have been defined for the specified type the traits with the name given in DefaultTraitsName is used (if specified)


Friends And Related Function Documentation

friend class MDValue [friend]


Member Data Documentation

std::string TypeName [protected]

Name of this MDType.

MDTypeClass Class [protected]

Class of this MDType.

MDArrayClass ArrayClass [protected]

Sub-class of array.

MDTraitsPtr Traits [protected]

Traits for this MDType.

ULPtr TypeUL [protected]

The UL for this type.

bool Endian [protected]

Flag set to 'true' if this basic type should ever be byte-swapped.

TypeRef RefType [protected]

Reference type of this type (if a reference source or target), if TypeRefUndefined then inherit.

std::string RefTarget [protected]

Reference target of this type (if a reference source), if "" then inherit.

NamedValueList EnumValues [protected]

List of enumerated values, if this is an enum, each with its value name.

MDTypeParent Base

Base class if this is a derived class, else NULL.

StringList ChildOrder

Child names in order for compound types.

int Size

The size of the item in multiples of base class items, or 0 if it is variable.

MDTypeList Types [static, protected]

All types managed by this object.

std::map< UL, MDTypePtr > ULLookup [static, protected]

Map for UL lookups.

std::map< UL, MDTypePtr > ULLookupVer1 [static, protected]

Map for UL lookups - ignoring the version number (all entries use version = 1).

MDTypeMap NameLookup [static, protected]

Map for reverse lookups based on type name.

MDType::TraitsMapType TraitsMap [static, protected]

Map of type names to thair handling traits.

MDType::TraitsULMapType TraitsULMap [static, protected]

Map of type ULs to thair handling traits.


The documentation for this class was generated from the following files:
Generated on Mon Apr 2 15:21:01 2007 for MXFLib by  doxygen 1.5.1-p1