33 #ifndef __H__UG_BRIDGE__REGISTRY__
34 #define __H__UG_BRIDGE__REGISTRY__
41 #include <boost/function.hpp>
42 #include <boost/type_traits.hpp>
84 const std::string&
name()
const {
return m_name;}
88 {m_classes.push_back(c); m_classTags.push_back(tag);}
94 bool empty()
const {
return num_classes() == 0;}
147 void set_force_construct_via_smart_pointer(
bool bForceConstructionWithSmartPtr);
157 bool registry_changed();
179 template<
typename TFunc>
180 Registry& add_function(std::string funcName, TFunc
func, std::string group =
"",
181 std::string retValInfos =
"", std::string paramInfos =
"",
182 std::string tooltip =
"", std::string help =
"");
185 template<
typename TFunc>
187 add_and_get_function(std::string funcName, TFunc
func, std::string group =
"",
188 std::string retValInfos =
"", std::string paramInfos =
"",
189 std::string tooltip =
"", std::string help =
"");
192 size_t num_functions()
const;
199 size_t num_overloads(
size_t ind)
const;
220 template <
typename TClass>
222 std::string group =
"",
223 std::string tooltip =
"");
231 template <
typename TClass,
typename TBaseClass>
233 std::string group =
"",
234 std::string tooltip =
"");
242 template <
typename TClass,
typename TBaseClass1,
typename TBaseClass2>
244 std::string group =
"",
245 std::string tooltip =
"");
248 template <
typename TClass>
252 size_t num_classes()
const;
264 bool check_consistency();
272 size_t num_class_groups()
const;
292 void add_class_to_group(std::string className, std::string groupName,
293 std::string classTag =
"");
297 bool classname_registered(
const std::string&
name);
300 bool groupname_registered(
const std::string&
name);
303 bool functionname_registered(
const std::string&
name);
307 template <
typename TClass,
typename TBaseClass>
308 void check_base_class(
const std::string& className);
location name
Definition: checkpoint_util.lua:128
groups classes. One of the members is the default member.
Definition: registry.h:76
ClassGroupDesc()
Definition: registry.h:78
void add_class(IExportedClass *c, const std::string &tag)
adds a class to group
Definition: registry.h:87
void set_default_class(size_t i)
sets the i'th class as default
Definition: registry.h:106
size_t num_classes() const
returns number of classes in group
Definition: registry.h:91
const std::string & name() const
returns name of group
Definition: registry.h:84
IExportedClass * m_defaultClass
the current default class
Definition: registry.h:122
const std::string & get_class_tag(size_t i) const
returns the class group tag for a class
Definition: registry.h:103
std::vector< std::string > m_classTags
tags can be used to describe classes. One tag for each class.
Definition: registry.h:119
IExportedClass * get_default_class() const
if no default class is set, this method returns NULL.
Definition: registry.h:109
IExportedClass * get_class(size_t i)
returns a class of the group
Definition: registry.h:97
void set_name(const std::string &name)
sets name of group
Definition: registry.h:81
std::string m_name
name of class group
Definition: registry.h:113
const IExportedClass * get_class(size_t i) const
returns a class of the group
Definition: registry.h:100
bool empty() const
returns if classes in group
Definition: registry.h:94
std::vector< IExportedClass * > m_classes
classes registered to the class group
Definition: registry.h:116
This template class represents real c++ classes in the registry.
Definition: class.h:699
Groups of Functions - useful to realize overloaded functions.
Definition: global_function.h:243
This class describes a wrapper for a c++ - function, that is exported by ug.
Definition: global_function.h:186
Base class for exported Classes.
Definition: class.h:499
Registry for functions and classes that are exported to scripts and visualizations.
Definition: registry.h:138
std::vector< ClassGroupDesc * > m_vClassGroups
registered class groups
Definition: registry.h:321
std::vector< ExportedFunctionGroup * > m_vFunction
registered functions
Definition: registry.h:315
std::vector< FuncRegistryChanged > m_callbacksRegChanged
Callback, that are called when registry changed is invoked.
Definition: registry.h:324
std::vector< IExportedClass * > m_vClass
registered classes
Definition: registry.h:318
bool m_bForceConstructionWithSmartPtr
flag if classes must be constructed via smart-pointer
Definition: registry.h:327
boost::function< void(Registry *pReg)> FuncRegistryChanged
declaration of registry callback function.
Definition: registry.h:63
#define UG_API
Definition: ug_config.h:65
function func(x, y, z, t, si)