iopc::TypeManager Class Reference
[iopcmeta]

A singleton which maintains a list of Type Descriptions (instances of the Type subclasses). More...

#include <typeManager.h>

List of all members.

Public Types

typedef std::map< std::string,
const Type * > 
TypesMap

Public Member Functions

const TypesMapgetTypesMapInst () const

Static Public Member Functions

static TypeManagergetInstance ()
 Returns the singleton instance.
static void registerType (const Type *type, const std::type_info *ti)
 Registers the specified type under a name provided by the Type Description.
static void registerType (const Type *type, const std::string &typeName, const std::type_info *ti)
 Registers the specified type under a provided name.
static const TypegetType (const std::string &typeName)
 Returns a Type object that represents a type specified by its name.
static bool hasType (const std::string &typeName)
 Checks whether the TypeManager contains a Type Description for the specified type.
static const TypegetTypeByTypeInfo (const std::type_info *ti)
 Returns a Type object that represents a type specified by its type_info object.
static const TypesMapgetTypesMap ()
 Returns a map containing all registered types.
static void init ()
 Initializes type manager instances.
static void topologicalSort (const Type &root, std::vector< const Type * > &sorted)
 Sorts all child types of a root type in a topological inheritance order. First go parents, then their children.
static void parseType (std::string inStr, std::string &type, std::string &typeMeta, std::string &attr, std::string &attrMeta)
 Parses a type name, attribute name and metadata code from a string representation.


Detailed Description

A singleton which maintains a list of Type Descriptions (instances of the Type subclasses).

The class is thread safe for read-only access (i.e. no type registrations)


Member Typedef Documentation

typedef std::map<std::string, const Type*> iopc::TypeManager::TypesMap

Keys of the map contains qualified type names, values contain the Type Descriptions


Member Function Documentation

static void iopc::TypeManager::registerType ( const Type type,
const std::type_info *  ti 
) [inline, static]

Registers the specified type under a name provided by the Type Description.

Used by the TypeRegistrar instances generated by iopcsp

Parameters:
type A pointer to the Type description
ti typeid of the type being registered

static void iopc::TypeManager::registerType ( const Type type,
const std::string &  typeName,
const std::type_info *  ti 
) [inline, static]

Registers the specified type under a provided name.

Parameters:
type A pointer to the Type description
typeName The name under which the type will be registered
ti typeid of the type being registered

static const Type& iopc::TypeManager::getType ( const std::string &  typeName  )  [inline, static]

Returns a Type object that represents a type specified by its name.

The typeName parameter must be a fully qualified name. Example: "iopc::OidObject", "::TopLevelType"

Parameters:
typeName A fully qualified type name.
Returns:
A type object that represents the type.
Exceptions:
IopcNotFoundException if such type is not found

static bool iopc::TypeManager::hasType ( const std::string &  typeName  )  [inline, static]

Checks whether the TypeManager contains a Type Description for the specified type.

Parameters:
typeName A fully qualified type name.

static const Type& iopc::TypeManager::getTypeByTypeInfo ( const std::type_info *  ti  )  [inline, static]

Returns a Type object that represents a type specified by its type_info object.

This object is returned by the typeid operator.

Parameters:
ti A type_info object
Returns:
A type object that represents the type.
Exceptions:
IopcNotFoundException if such type is not found

static const TypesMap& iopc::TypeManager::getTypesMap (  )  [inline, static]

Returns a map containing all registered types.

Its key contains qualified type names, values contain the Type Descriptions

static void iopc::TypeManager::init (  )  [inline, static]

Initializes type manager instances.

Called by IopcMeta::init()

static void iopc::TypeManager::topologicalSort ( const Type root,
std::vector< const Type * > &  sorted 
) [inline, static]

Sorts all child types of a root type in a topological inheritance order. First go parents, then their children.

Parameters:
[in] root Root type of the inheritance tree to be sorted
[out] sorted Topologically sorted list. Note that it does not include the root type.

static void iopc::TypeManager::parseType ( std::string  inStr,
std::string &  type,
std::string &  typeMeta,
std::string &  attr,
std::string &  attrMeta 
) [inline, static]

Parses a type name, attribute name and metadata code from a string representation.

Following formats are accepted:

 Type
 Type::attribute
 Type[metadata_code]::attribute
 Type::attribute[metadata_code]

Type is a qualified type name. It may also be other arbitrary string in which case the attribute and attribute metadata are not parsed. If some of the compartments is missing, corresponding output parameter will be set to an empty string

Parameters:
[in] inStr The string to be parsed
[out] type Parsed type name
[out] typeMeta Parsed type metadata code
[out] attr Parsed attribute name
[out] attrMeta Parsed attribute metadata code

const std::map< std::string, const Type * > & iopc::TypeManager::getTypesMapInst (  )  const

WARNING: iterating the list of types is not thread-safe against registering a new type.


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

Generated on Tue Apr 14 16:46:38 2009 for IOPC 2 by  doxygen 1.5.6