MDOType Class Reference

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

#include <mdobject.h>

Inheritance diagram for MDOType:

RefCount IRefCount List of all members.

Public Types

enum  DictionaryItems {
  DICT_ITEM_USE = 1, DICT_ITEM_REFTYPE = 2, DICT_ITEM_CONTAINERTYPE = 4, DICT_ITEM_MINLENGTH = 8,
  DICT_ITEM_MAXLENGTH = 16, DICT_ITEM_KEYFORMAT = 32, DICT_ITEM_LENFORMAT = 64, DICT_ITEM_DVALUE = 128
}
 Bit masks for items that are to be set for this definition in BuildTypeFromDict. More...

Public Member Functions

 MDOType (MDContainerType ContainerType, std::string RootName, std::string Name, std::string Detail, MDTypePtr Type, DictKeyFormat KeyFormat, DictLenFormat LenFormat, unsigned int minLen, unsigned int maxLen, DictUse Use)
 Public constructor - build a full type.
void SetRef (ClassRef Type, ULPtr &Target, std::string TargetName="")
 Set the referencing details for this type.
void SetRef (ClassRef Type, MDOTypePtr Target, std::string TargetName="")
 Set the referencing details for this type.
void Derive (MDOTypePtr &BaseEntry)
 Derive this new entry from a base entry.
void ReDerive (MDOTypePtr &BaseEntry)
 Re-Derive sub-items from a base entry.
const MDContainerTypeGetContainerType (void) const
 Access function for ContainerType.
ClassRef GetRefType (void) const
 Ref access function.
MDOTypePtr GetRefTarget (void) const
 Accessor for Reference Target.
std::string GetRefTargetName (void) const
 Accessor for Reference Target Name.
std::string Name (void) const
 Get the type name.
std::string FullName (void) const
 Get the full type name, including all parents.
const DataChunkGetDefault (void) const
 Read-only access to default value.
const DataChunkGetDValue (void) const
 Read-only access to distinguished value.
const ULPtrGetTypeUL (void) const
 Read-only access to the type UL.
unsigned int GetMinLength (void) const
 Read-only access to the minLength value.
unsigned int GetMaxLength (void) const
 Read-only access to the maxnLength value.
const MDTypePtrGetValueType (void) const
 Read-only access to ValueType.
const StringListGetChildOrder (void) const
 Read-only access to ChildOrder.
const MDOTypeListGetChildList (void) const
 Read-only access to ChildList.
MDOTypePtr Child (std::string Name)
 Locate a named child.
MDOTypePtr Child (ULPtr &ChildType)
 Locate a child by UL.
const DictKeyFormatGetKeyFormat (void) const
 Read-only access to KeyFormat.
const DictLenFormatGetLenFormat (void) const
 Read-only access to LenFormat.
std::pair< iterator, bool > insert (MDOTypePtr NewType)
 Insert a new child type.
ULPtrGetUL (void)
 Get the UL for this type.
const DataChunkGetKey (void)
 Read-only access to the key.
const DataChunkGetGlobalKey (void)
 Read-only access to the global key.
ClassUsage GetUse (void)
 Get the usage for this type.
bool IsA (std::string BaseType)
 Determine if this type is derived from a specified type (directly or indirectly).
bool IsA (MDOTypePtr &BaseType)
 Determine if this type is derived from a specified type (directly or indirectly).
bool IsA (const UL &BaseType)
 Determine if this type is derived from a specified type (directly or indirectly).
bool IsA (ULPtr &BaseType)
 Determine if this type is derived from a specified type (directly or indirectly).
void ReDefine (std::string NewDetail, std::string NewBase, unsigned int NewMinSize, unsigned int NewMaxSize)
 Redefine a sub-item in a container.
void ReDefine (std::string NewDetail)
 Redefine a container.

Static Public Member Functions

static void LoadDict (const char *DictFile, SymbolSpacePtr DefaultSymbolSpace=MXFLibSymbols)
 Load the dictionary.
static void LocateRefTypes (void)
 Locate reference target types for any types not yet located.
static PrimerPtr MakePrimer (bool SetStatic=false)
 Build a primer.
static PrimerPtr GetStaticPrimer (void)
 Get the static primer (make one if required).
static MDOTypePtr Find (std::string BaseType, bool SearchAll=false)
 Find a type in the default symbol space, optionally searching all others.
static MDOTypePtr Find (std::string BaseType, SymbolSpacePtr &SymSpace, bool SearchAll=false)
 Find a type in a specified symbol space, optionally searching all others.
static MDOTypePtr Find (const UL &BaseUL)
 Find the MDOType object that defines a type with a specified UL.
static MDOTypePtr Find (Tag BaseTag, PrimerPtr BasePrimer)
 Find the MDOType object that defines a type with a specified Tag.
static MDOTypePtr DefineClass (ClassRecordPtr &ThisClass, SymbolSpacePtr DefaultSymbolSpace, MDOTypePtr Parent=NULL)
 Define a class from an in-memory dictionary definition.
static MDOTypePtr DefineClass (ClassRecordPtr &ThisClass, MDOTypePtr Parent=NULL, SymbolSpacePtr DefaultSymbolSpace=MXFLibSymbols)

Public Attributes

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

Protected Member Functions

 MDOType ()
 Protected constructor so we can control creation of types.

Static Protected Member Functions

static void XML_startElement (void *user_data, const char *name, const char **attrs)
static void XML_endElement (void *user_data, const char *name)
static void XML_warning (void *user_data, const char *msg,...)
static void XML_error (void *user_data, const char *msg,...)
static void XML_fatalError (void *user_data, const char *msg,...)

Protected Attributes

MDContainerType ContainerType
std::string RootName
 Base name of this type.
MDTypePtr ValueType
 Value type if this is an actual data item, else NULL.
StringList ChildOrder
 Child names in order, for packs ## DEPRECATED - Use ChildList ##.
MDOTypeList ChildList
 Child types in order, for packs.
MDOTypeParent Parent
 Parent type if this is a child.
ULPtr TypeUL
 The UL for this type, or NULL.
DataChunk Key
 Main key field.
DataChunk GlobalKey
 Global key field (may be a copy of Key).
std::string DictName
 Short (XML tag) name.
std::string Detail
 Full descriptive name.
std::string TypeName
 Data type name from dictionary (or built from UL found in file?).
DictKeyFormat KeyFormat
 Format of key of sub-items.
DictLenFormat LenFormat
 Format of length of sub-items.
unsigned int minLength
 Minimum length of value field.
unsigned int maxLength
 Maximum length of value field.
DictUse Use
 Usage requirements.
DataChunk Default
 Default value (if one exists).
DataChunk DValue
 Distinguished value (if one is defined).
ClassRef RefType
 Reference type if this is a reference.
MDOTypeParent RefTarget
 Type (or base type) of item this ref source must target.
std::string RefTargetName
 Name of the type (or base type) of item this ref source must target.

Static Protected Attributes

static MDOTypeList AllTypes
 All types managed by this object.
static MDOTypeList TopTypes
 The top-level types managed by this object.
static std::map< UL, MDOTypePtrULLookup
 Map for UL lookups.
static std::map< UL, MDOTypePtrULLookupVer1
 Map for UL lookups - ignoring the version number (all entries use version = 1).
static MDOTypeMap NameLookup
 Map for reverse lookups based on type name.
static PrimerPtr StaticPrimer
 Basic primer for use when parsing non-primer partitions.

Detailed Description

Holds the definition of a metadata object type.


Member Enumeration Documentation

enum DictionaryItems

Bit masks for items that are to be set for this definition in BuildTypeFromDict.

This allows some values to be inherited from the base class, but some to be overridden by this definition.

Note:
The bits are actually passed in a UInt32.

Not all items need a bit as they can be validated.

Enumerator:
DICT_ITEM_USE 
DICT_ITEM_REFTYPE 
DICT_ITEM_CONTAINERTYPE 
DICT_ITEM_MINLENGTH 
DICT_ITEM_MAXLENGTH 
DICT_ITEM_KEYFORMAT 
DICT_ITEM_LENFORMAT 
DICT_ITEM_DVALUE 


Constructor & Destructor Documentation

MDOType ( void   )  [protected]

Protected constructor so we can control creation of types.

This constructor is private so the ONLY way to create new MDOTypes from outside this class is via member methods

MDOType ( MDContainerType  ContainerType,
std::string  RootName,
std::string  Name,
std::string  Detail,
MDTypePtr  Type,
DictKeyFormat  KeyFormat,
DictLenFormat  LenFormat,
unsigned int  minLen,
unsigned int  maxLen,
DictUse  Use 
) [inline]

Public constructor - build a full type.


Member Function Documentation

void SetRef ( ClassRef  Type,
ULPtr Target,
std::string  TargetName = "" 
) [inline]

Set the referencing details for this type.

void SetRef ( ClassRef  Type,
MDOTypePtr  Target,
std::string  TargetName = "" 
) [inline]

Set the referencing details for this type.

void Derive ( MDOTypePtr BaseEntry  ) 

Derive this new entry from a base entry.

Note:
It is important that DictName is set before calling

Don't attempt to call this function on objects that are not freshly created

void ReDerive ( MDOTypePtr BaseEntry  ) 

Re-Derive sub-items from a base entry.

Used when the base entry is being extended

const MDContainerType& GetContainerType ( void   )  const [inline]

Access function for ContainerType.

ClassRef GetRefType ( void   )  const [inline]

Ref access function.

MDOTypePtr GetRefTarget ( void   )  const [inline]

Accessor for Reference Target.

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

Accessor for Reference Target Name.

<

Note:
This must only be used during dictionary parsing or for error reporting, not for actual reference linking where RefTarget must be used

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

Get the type name.

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

Get the full type name, including all parents.

const DataChunk& GetDefault ( void   )  const [inline]

Read-only access to default value.

const DataChunk& GetDValue ( void   )  const [inline]

Read-only access to distinguished value.

const ULPtr& GetTypeUL ( void   )  const [inline]

Read-only access to the type UL.

unsigned int GetMinLength ( void   )  const [inline]

Read-only access to the minLength value.

unsigned int GetMaxLength ( void   )  const [inline]

Read-only access to the maxnLength value.

const MDTypePtr& GetValueType ( void   )  const [inline]

Read-only access to ValueType.

const StringList& GetChildOrder ( void   )  const [inline]

Read-only access to ChildOrder.

Note:
DEPRECATED - Use GetChildList() instead

const MDOTypeList& GetChildList ( void   )  const [inline]

Read-only access to ChildList.

MDOTypePtr Child ( std::string  Name  )  [inline]

Locate a named child.

MDOTypePtr Child ( ULPtr ChildType  )  [inline]

Locate a child by UL.

const DictKeyFormat& GetKeyFormat ( void   )  const [inline]

Read-only access to KeyFormat.

const DictLenFormat& GetLenFormat ( void   )  const [inline]

Read-only access to LenFormat.

std::pair<iterator, bool> insert ( MDOTypePtr  NewType  )  [inline]

Insert a new child type.

ULPtr& GetUL ( void   )  [inline]

Get the UL for this type.

const DataChunk& GetKey ( void   )  [inline]

Read-only access to the key.

const DataChunk& GetGlobalKey ( void   )  [inline]

Read-only access to the global key.

ClassUsage GetUse ( void   )  [inline]

Get the usage for this type.

bool IsA ( std::string  BaseType  ) 

Determine if this type is derived from a specified type (directly or indirectly).

bool IsA ( MDOTypePtr BaseType  ) 

Determine if this type is derived from a specified type (directly or indirectly).

bool IsA ( const UL BaseType  ) 

Determine if this type is derived from a specified type (directly or indirectly).

bool IsA ( ULPtr BaseType  )  [inline]

Determine if this type is derived from a specified type (directly or indirectly).

void ReDefine ( std::string  NewDetail,
std::string  NewBase,
unsigned int  NewMinSize,
unsigned int  NewMaxSize 
)

Redefine a sub-item in a container.

void ReDefine ( std::string  NewDetail  )  [inline]

Redefine a container.

static void LoadDict ( const char *  DictFile,
SymbolSpacePtr  DefaultSymbolSpace = MXFLibSymbols 
) [inline, static]

Load the dictionary.

void LocateRefTypes ( void   )  [static]

Locate reference target types for any types not yet located.

PrimerPtr MakePrimer ( bool  SetStatic = false  )  [static]

Build a primer.

This primer has the mappings of tag to UL from the dictionary

Parameters:
SetStatic - If true the StaticPrimer will be set to this new primer

static PrimerPtr GetStaticPrimer ( void   )  [inline, static]

Get the static primer (make one if required).

static MDOTypePtr Find ( std::string  BaseType,
bool  SearchAll = false 
) [inline, static]

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

MDOTypePtr Find ( std::string  BaseType,
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

MDOTypePtr Find ( const UL BaseUL  )  [static]

Find the MDOType object that defines a type with a specified UL.

Returns:
Pointer to the object

NULL if there is no type with that UL

MDOTypePtr Find ( Tag  BaseTag,
PrimerPtr  BasePrimer 
) [static]

Find the MDOType object that defines a type with a specified Tag.

The tag is looked up in the supplied primer

Note:
if BasePrimer is NULL then the static primer is searched
Returns:
Pointer to the object

NULL if there is no type with that tag

MDOTypePtr DefineClass ( ClassRecordPtr ThisClass,
SymbolSpacePtr  DefaultSymbolSpace,
MDOTypePtr  Parent = NULL 
) [static]

Define a class from an in-memory dictionary definition.

Lookup-table to convert key size to key format enum

Lookup-table to convert lenght size to len format enum

static MDOTypePtr DefineClass ( ClassRecordPtr ThisClass,
MDOTypePtr  Parent = NULL,
SymbolSpacePtr  DefaultSymbolSpace = MXFLibSymbols 
) [inline, static]

static void XML_startElement ( void *  user_data,
const char *  name,
const char **  attrs 
) [static, protected]

static void XML_endElement ( void *  user_data,
const char *  name 
) [static, protected]

void XML_warning ( void *  user_data,
const char *  msg,
  ... 
) [static, protected]

void XML_error ( void *  user_data,
const char *  msg,
  ... 
) [static, protected]

void XML_fatalError ( void *  user_data,
const char *  msg,
  ... 
) [static, protected]


Member Data Documentation

MDContainerType ContainerType [protected]

std::string RootName [protected]

Base name of this type.

MDTypePtr ValueType [protected]

Value type if this is an actual data item, else NULL.

MDOTypeParent Base

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

StringList ChildOrder [protected]

Child names in order, for packs ## DEPRECATED - Use ChildList ##.

MDOTypeList ChildList [protected]

Child types in order, for packs.

MDOTypeParent Parent [protected]

Parent type if this is a child.

ULPtr TypeUL [protected]

The UL for this type, or NULL.

DataChunk Key [protected]

Main key field.

DataChunk GlobalKey [protected]

Global key field (may be a copy of Key).

std::string DictName [protected]

Short (XML tag) name.

std::string Detail [protected]

Full descriptive name.

std::string TypeName [protected]

Data type name from dictionary (or built from UL found in file?).

DictKeyFormat KeyFormat [protected]

Format of key of sub-items.

DictLenFormat LenFormat [protected]

Format of length of sub-items.

unsigned int minLength [protected]

Minimum length of value field.

unsigned int maxLength [protected]

Maximum length of value field.

DictUse Use [protected]

Usage requirements.

DataChunk Default [protected]

Default value (if one exists).

DataChunk DValue [protected]

Distinguished value (if one is defined).

ClassRef RefType [protected]

Reference type if this is a reference.

MDOTypeParent RefTarget [protected]

Type (or base type) of item this ref source must target.

std::string RefTargetName [protected]

Name of the type (or base type) of item this ref source must target.

Note:
This must only be used during dictionary parsing or for error reporting, not for actual reference linking where RefTarget must be used

MDOTypeList AllTypes [static, protected]

All types managed by this object.

MDOTypeList TopTypes [static, protected]

The top-level types managed by this object.

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

Map for UL lookups.

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

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

std::map< std::string, MDOTypePtr > NameLookup [static, protected]

Map for reverse lookups based on type name.

PrimerPtr StaticPrimer [static, protected]

Basic primer for use when parsing non-primer partitions.


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