ML Reference
mlRuntimeDict.h
Go to the documentation of this file.
1/*************************************************************************************
2**
3** Copyright 2007, MeVis Medical Solutions AG
4**
5** The user may use this file in accordance with the license agreement provided with
6** the Software or, alternatively, in accordance with the terms contained in a
7** written agreement between the user and MeVis Medical Solutions AG.
8**
9** For further information use the contact form at https://www.mevislab.de/contact
10**
11**************************************************************************************/
12
13#ifndef ML_RUNTIME_DICT_H
14#define ML_RUNTIME_DICT_H
15
22
23// ML-includes
24#include "mlUtilsSystem.h"
25
26#include <unordered_map>
27#include <vector>
28#include <string>
29
30ML_UTILS_START_NAMESPACE
31
32 class RuntimeType;
33
34 //-------------------------------------------------------------------------
42 //-------------------------------------------------------------------------
44
45 public:
46
49
52
54 void clear();
55
62 bool insert(const RuntimeType* runtimeType);
63
69 bool remove(const char* className);
70
74 const RuntimeType* get(const char* className) const;
75
81 [[nodiscard]]
82 void* createInstanceFromName(const char* className) const;
83
87 void destroyRuntimeTypesOfDll(const char* dllName);
88
96 std::vector<const RuntimeType*> getAllDerivedFrom(const RuntimeType* parentType,
97 bool onlyFromDifferentDlls = false);
98
101 std::vector<const RuntimeType *> getAllRuntimeTypesOfDll(const char* dllName);
102
104 std::vector<const RuntimeType *> getAllTypes();
105
106 private:
107 std::unordered_map<std::string, const RuntimeType*> _dict;
108};
109
110ML_UTILS_END_NAMESPACE
111
112
113
114#endif // __mlRuntimeDict_H
This file declares the class RuntimeDict, which manages a set of instances of class RuntimeTypes.
void * createInstanceFromName(const char *className) const
Returns a pointer to a newly created instance of the runtime type or NULL if such an instance cannot ...
void destroyRuntimeTypesOfDll(const char *dllName)
Deletes all RuntimeTypes from the runtime dictionary which belong to the the dll with name dllName.
std::vector< const RuntimeType * > getAllTypes()
Returns all registered types.
bool insert(const RuntimeType *runtimeType)
Inserts an new type into the runtime dictionary.
std::vector< const RuntimeType * > getAllDerivedFrom(const RuntimeType *parentType, bool onlyFromDifferentDlls=false)
Returns a list of all runtime types derived from parentType.
RuntimeDict()
Creates new dictionary.
void clear()
Clears all dictionary entries and stored runtime types.
bool remove(const char *className)
Removes the element for the given className className.
~RuntimeDict()
Destructor. Removes dictionary and all stored runtime types.
const RuntimeType * get(const char *className) const
Returns the runtime type for a given className (or NULL if not element present).
std::vector< const RuntimeType * > getAllRuntimeTypesOfDll(const char *dllName)
Returns a list of all runtime types implemented by dll with name dllName.
RuntimeType contains type and inheritance information of a class and a static dictionary with informa...