34#ifndef __H__UG_BRIDGE__CLASS_NAME_PROVIDER__
35#define __H__UG_BRIDGE__CLASS_NAME_PROVIDER__
71 void set_name(
const std::string&
name);
77 const std::string&
name()
const {
return m_name;}
80 bool empty()
const {
return m_name.empty();}
100template <
typename TClass>
105 static void set_name(
const std::string& nameIn,
const std::string& group,
106 bool newName =
false);
109 template <
typename TParent1>
110 static void set_name(
const std::string& nameIn,
const std::string& group,
111 bool newName =
false);
114 template <
typename TParent1,
typename TParent2>
115 static void set_name(
const std::string& nameIn,
const std::string& group,
116 bool newName =
false);
124 static bool is_a(
const std::string& parent,
bool strict =
false);
127 static const std::string&
name();
130 static const std::string&
group(){
return m_group;}
133 static const std::vector<const char*>& names();
142 static bool named() {
return !m_bForwardDeclared && !m_ClassNameNode.empty();}
146 static void set_foreward_declared();
162template <
typename TClass>
168template <
typename TBase,
typename TDerived>
185 template <
typename TBase,
typename TDerived>
221 template <
typename T>
223 template <
typename T>
225 template <
typename T>
227 template <
typename T>
233 typedef void* (*CastFunc)(
void*);
243 bool clearVec =
true);
location name
Definition checkpoint_util.lua:128
Definition smart_pointer.h:296
Definition smart_pointer.h:108
Instances of this class or of derived classes are thrown if errors arise.
Definition error.h:104
provides castings from derived classes to base classes
Definition class_name_provider.h:182
static void * cast_to_base_class(void *pDerivVoid, const ClassNameNode *&node, const std::string &baseName)
cast a pointer to the desired base class
Definition class_name_provider.cpp:139
void *(* CastFunc)(void *)
Definition class_name_provider.h:233
static T * cast_to(void *pDerivVoid, const ClassNameNode *&node)
casts a void pointer to a concrete class
Definition class_name_provider_impl.h:234
static std::map< std::pair< const ClassNameNode *, const ClassNameNode * >, CastFunc > m_mmCast
Definition class_name_provider.h:236
static void add_cast_func()
add a cast function to the registry: Casts: Derived -> Base
Definition class_name_provider_impl.h:219
node for class names
Definition class_name_provider.h:65
bool empty() const
returns if a name has been set
Definition class_name_provider.h:80
size_t num_base_classes() const
returns number of parents
Definition class_name_provider.h:86
std::string m_name
own name
Definition class_name_provider.h:93
const std::string & name() const
returns own name
Definition class_name_provider.h:77
const ClassNameNode & base_class(size_t i) const
return a base class
Definition class_name_provider.h:89
std::vector< const ClassNameNode * > m_vBaseClass
base classes
Definition class_name_provider.h:96
provides the name for a class
Definition class_name_provider.h:102
static std::vector< const char * > m_names
vector of parent class names (depreciated)
Definition class_name_provider.h:150
static bool named()
returns if the class has been named by user
Definition class_name_provider.h:142
static std::string m_group
Name of group, we're this class is sorted.
Definition class_name_provider.h:153
static const ClassNameNode & class_name_node()
return the class name node in the class hierarchy
Definition class_name_provider.h:136
static bool m_bForwardDeclared
set to true if class has not been named by user, but a default name given
Definition class_name_provider.h:156
static const std::string & group()
groups
Definition class_name_provider.h:130
static const std::string & name()
name of this class
Definition class_name_provider_impl.h:152
static bool forward_declared()
returns if class name is forward declared
Definition class_name_provider.h:139
static ClassNameNode m_ClassNameNode
class name node holding own name and pointers to base class name nodes
Definition class_name_provider.h:159
const char * GetClassName()
Definition class_name_provider.h:163
void * StaticVoidCast(void *DerivVoidPtr)
static cast function for two classes
Definition class_name_provider_impl.h:205
bool ClassNameTreeContains(const ClassNameNode &node, const std::string &name)
returns if a name is contained in the name tree at node or in base classes
Definition class_name_provider.cpp:104
bool ClassNameVecContains(const std::vector< const char * > &names, const std::string &name)
returns if a name is contained in the name vector
Definition class_name_provider.cpp:76
void ExtractClassNameVec(std::vector< const char * > &names, const ClassNameNode &node, bool clearVec)
returns the vector containing all names in the name tree for node and its base classes
Definition class_name_provider.cpp:90
bool ClassNameTreeWay(std::vector< size_t > &vWay, const ClassNameNode &node, const std::string &name)
Definition class_name_provider.cpp:119
#define UG_API
Definition ug_config.h:65
void baseName(std::string &nameOut, const std::string &nameIn)
Definition vtkoutput.cpp:209
Definition class_name_provider.h:172
std::string m_to
Definition class_name_provider.h:177
UGError_ClassCastFailed(const std::string &from, const std::string &to)
Definition class_name_provider.h:173
std::string m_from
Definition class_name_provider.h:176