#include <typeManager.h>
Public Types | |
typedef std::map< std::string, const Type * > | TypesMap |
Public Member Functions | |
const TypesMap & | getTypesMapInst () const |
Static Public Member Functions | |
static TypeManager & | getInstance () |
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 Type & | getType (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 Type & | getTypeByTypeInfo (const std::type_info *ti) |
Returns a Type object that represents a type specified by its type_info object. | |
static const TypesMap & | getTypesMap () |
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. |
The class is thread safe for read-only access (i.e. no type registrations)
typedef std::map<std::string, const Type*> iopc::TypeManager::TypesMap |
Keys of the map contains qualified type names, values contain the Type Descriptions
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
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.
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"
typeName | A fully qualified type name. |
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.
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.
ti | A type_info object |
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.
[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
[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.