cgv
register.h
1 #pragma once
2 
3 #include <cgv/base/base.h>
4 #include <cgv/base/named.h>
5 #include <cgv/utils/token.h>
6 #include <cgv/type/info/type_name.h>
7 #include <string>
8 #include <iostream>
9 #include <map>
10 
11 #include "lib_begin.h"
12 
13 #ifndef _WIN32
14 #include <unistd.h>
15 #include <dlfcn.h>
16 #endif
17 
19 namespace cgv {
21  namespace base {
22 
23 
26 
29 extern void CGV_API enable_registration();
31 extern void CGV_API disable_registration();
33 extern bool CGV_API is_registration_enabled();
35 
44 extern void CGV_API define_registration_order(const std::string& partial_order, bool before_contructor_execution = false, const std::string& when = "always");
45 
48 {
49  registration_order_definition(const std::string& partial_order, bool before_contructor_execution = false, const std::string& when = "always");
50 };
51 
53 extern void CGV_API enable_registration_debugging();
55 extern void CGV_API disable_registration_debugging();
57 extern bool CGV_API is_registration_debugging_enabled();
58 
60 extern void CGV_API enable_permanent_registration();
62 extern void CGV_API disable_permanent_registration();
64 extern bool CGV_API is_permanent_registration_enabled();
66 extern void CGV_API unregister_all_objects();
68 extern unsigned CGV_API get_nr_permanently_registered_objects();
70 extern base_ptr CGV_API get_permanently_registered_object(unsigned i);
71 
72 
74 
77 extern void CGV_API enable_registration_event_cleanup();
79 extern void CGV_API disable_registration_event_cleanup();
81 extern bool CGV_API is_registration_event_cleanup_enabled();
82 
84 
87 
90 extern void CGV_API register_object(base_ptr object, const std::string& options = "");
92 extern void CGV_API unregister_object(base_ptr object, const std::string& options = "");
93 
95 struct CGV_API object_constructor : public cgv::base::base
96 {
97 public:
101  virtual std::string get_constructed_type_name() const = 0;
103  virtual base_ptr construct_object() const = 0;
104 };
105 
106 // type specific specialization of helper class to perform delayed registration and creation of objects in case that the registration is disabled
107 template <class T>
108 class object_constructor_impl : public object_constructor
109 {
110 public:
112  std::string get_type_name() const { return cgv::type::info::type_name<object_constructor_impl<T> >::get_name(); }
114  std::string get_constructed_type_name() const { return cgv::type::info::type_name<T>::get_name(); }
115  // creation function
116  base_ptr construct_object() const { return base_ptr(new T()); }
117 };
118 
119 // type specific specialization of helper class to perform delayed registration and creation of objects in case that the registration is disabled
120 template <class T, typename CA>
121 class object_constructor_impl_1 : public object_constructor
122 {
123  // buffer constructor argument
124  CA ca;
125 public:
126  // construct from option
127  object_constructor_impl_1(const CA& _ca) : ca(_ca) {}
129  std::string get_type_name() const { return cgv::type::info::type_name<object_constructor_impl_1<T, CA> >::get_name(); }
131  std::string get_constructed_type_name() const { return cgv::type::info::type_name<T>::get_name(); }
132  // creation function
133  base_ptr construct_object() const { return base_ptr(new T(ca)); }
134 };
135 
136 // type specific specialization of helper class to perform delayed registration and creation of objects in case that the registration is disabled
137 template <class T, typename CA1, typename CA2>
138 class object_constructor_impl_2 : public object_constructor
139 {
140  // buffer constructor arguments
141  CA1 ca1;
142  CA2 ca2;
143 public:
144  // construct from option
145  object_constructor_impl_2(const CA1& _ca1, const CA2& _ca2) : ca1(_ca1), ca2(_ca2) {}
147  std::string get_type_name() const { return cgv::type::info::type_name<object_constructor_impl_2<T,CA1,CA2> >::get_name(); }
149  std::string get_constructed_type_name() const { return cgv::type::info::type_name<T>::get_name(); }
150  // creation function
151  base_ptr construct_object() const { return base_ptr(new T(ca1,ca2)); }
152 };
153 
155 template <class T>
157 {
159  object_registration(const std::string& options) {
161  register_object(base_ptr(new T()),options);
162  else
163  register_object(base_ptr(new object_constructor_impl<T>()), options);
164  }
165 };
166 
168 template <class T, typename CA>
170 {
172  object_registration_1(const CA& arg, const std::string& options = "") {
174  register_object(base_ptr(new T(arg)),options);
175  else
176  register_object(base_ptr(new object_constructor_impl_1<T,CA>(arg)), options);
177  }
178 };
179 
181 template <class T, typename CA1, typename CA2>
183 {
185  object_registration_2(const CA1& a1, const CA2& a2, const std::string& options = "")
186  {
188  register_object(base_ptr(new T(a1,a2)),options);
189  else
190  register_object(base_ptr(new object_constructor_impl_2<T,CA1,CA2>(a1,a2)),options);
191  }
192 };
194 
197 
199 
200 struct CGV_API server
201 {
202 };
203 
205 
207 struct CGV_API driver
208 {
209 };
210 
212 
215 struct CGV_API registration_listener
216 {
218  virtual void register_object(base_ptr object, const std::string& options = "") = 0;
220  virtual void unregister_object(base_ptr object, const std::string& options = "") = 0;
221 };
222 
224 struct CGV_API factory : public base
225 {
226 protected:
228  std::string created_type_name;
234  std::string object_options;
235 public:
237  factory(const std::string& _created_type_name, bool _singleton = false, const std::string& _object_options = "");
239  virtual std::string get_object_options() const;
241  const std::string& get_created_type_name() const;
243  std::string get_property_declarations();
245  bool set_void(const std::string& property, const std::string& value_type, const void* value_ptr);
247  bool get_void(const std::string& property, const std::string& value_type, void* value_ptr);
249  bool is_singleton_factory() const;
251  base_ptr get_singleton() const;
253  void release_singleton();
255  base_ptr create_object();
258 };
259 
261 template <class T>
262 struct factory_impl : public factory
263 {
264  inline factory_impl(const std::string& _created_type_name, bool _is_singleton = false, const std::string& _object_options = "") :
265  factory(_created_type_name, _is_singleton, _object_options) {}
266  inline base_ptr create_object_impl() { return base_ptr(new T()); }
267  std::string get_type_name() const { return std::string("factory_impl<")+get_created_type_name()+">"; }
268 };
269 
271 template <class T, typename CA>
272 struct factory_impl_1 : public factory
273 {
274  CA ca;
275  inline factory_impl_1(CA _ca, const std::string& _created_type_name, bool is_singleton = false, const std::string& _object_options = "") :
276  factory(_created_type_name, is_singleton, _object_options), ca(_ca) {}
277  inline base_ptr create_object_impl() { return base_ptr(new T(ca)); }
278  std::string get_type_name() const { return std::string("factory_impl_1<")+get_created_type_name()+">"; }
279 };
280 
282 template <class T, typename CA1, typename CA2>
283 struct factory_impl_2 : public factory
284 {
285  CA1 ca1;
286  CA2 ca2;
287  inline factory_impl_2(CA1 _ca1, CA2 _ca2, const std::string& _created_type_name, bool is_singleton = false, const std::string& _object_options = "") :
288  factory(_created_type_name, is_singleton, _object_options), ca1(_ca1), ca2(_ca2) {}
289  inline base_ptr create_object_impl() { return base_ptr(new T(ca2)); }
290  std::string get_type_name() const { return std::string("factory_impl_2<")+get_created_type_name()+">"; }
291 };
292 
293 extern std::string CGV_API guess_created_type_name(const char* item_text);
294 extern void CGV_API register_factory_object(base_ptr fo, const char* item_text, char shortcut);
295 
297 template <class T>
299 {
301 
308  factory_registration(const std::string& _created_type_name, const std::string& _options = "", bool _is_singleton = false, const std::string& _object_options = "") {
309  register_object(new factory_impl<T>(_created_type_name, _is_singleton, _object_options), _options);
310  }
312 
314  factory_registration(const char* item_text, char shortcut, bool is_singleton = false) {
315  register_factory_object(new factory_impl<T>(guess_created_type_name(item_text), is_singleton), item_text, shortcut);
316  }
317 };
318 
320 template <class T, typename CA>
322 {
324 
331  factory_registration_1(const std::string& _created_type_name, const CA& _ca, const std::string& _options = "", bool _is_singleton = false, const std::string& _object_options = "") {
332  register_object(new factory_impl_1<T,CA>(_ca, _created_type_name, _is_singleton, _object_options), _options);
333  }
335 
337  factory_registration_1(const char* item_text, char shortcut, const CA& _ca, bool is_singleton = false) {
338  register_factory_object(new factory_impl_1<T,CA>(_ca, guess_created_type_name(item_text), is_singleton), item_text, shortcut);
339  }
340 };
341 
343 template <class T, typename CA1, typename CA2>
345 {
347 
354  factory_registration_2(const std::string& _created_type_name, const CA1& _ca1, const CA2& _ca2, const std::string& _options = "", bool _is_singleton = false, const std::string& _object_options = "") {
355  register_object(new factory_impl_2<T,CA1,CA2>(_ca1, _ca2, _created_type_name, _is_singleton, _object_options), _options);
356  }
357 };
358 
359 
361 
362 
365 class CGV_API test : public base
367 {
368 public:
370  static int nr_failed;
371 protected:
373  std::string test_name;
375  bool (*test_func)();
376 public:
378  test(const std::string& _test_name, bool (*_test_func)());
380  std::string get_type_name() const;
382  std::string get_test_name() const;
384  bool exec_test() const;
385 };
386 
388 #define TEST_ASSERT(V) \
389  if (!(V)) { \
390  std::cerr << "\n" << __FILE__ << "(" << __LINE__ << ") : error: test failure" << std::endl; \
391  ++cgv::base::test::nr_failed; \
392  }
393 
395 #define TEST_ASSERT_EQ(V,Q) \
396  if ((V) != (Q)) { \
397  std::cerr << "\n" << __FILE__ << "(" << __LINE__ << ") : error: test failure " << (V) << "!=" << (Q) << std::endl; \
398  ++cgv::base::test::nr_failed; \
399  }
400 
402 struct CGV_API test_registration
403 {
405  test_registration(const std::string& _test_name, bool (*_test_func)());
406 };
408 
409 
410 
411 
414 struct CGV_API resource_file_info
416 {
418  unsigned int file_offset;
420  unsigned int file_length;
422  const char* file_data;
424  std::string source_file;
427  unsigned int _file_offset = 0,
428  unsigned int _file_length = 0,
429  const char* _file_data = 0,
430  const std::string& _source_file = "");
431 };
432 
434 extern CGV_API std::map<std::string, resource_file_info>& ref_resource_file_map();
435 
437 extern CGV_API void register_resource_file(const std::string& file_path, unsigned int file_offset, unsigned int file_length, const char* file_data, const std::string& source_file = "");
438 
441 {
443  resource_file_registration(const char* file_data);
444 };
445 
447 extern CGV_API void register_resource_string(const std::string& string_name, const char* string_data);
448 
451 {
453  resource_string_registration(const std::string& string_name, const char* string_data);
454 };
455 
457 
458 
461 {
463  virtual void handle_args(std::vector<std::string>& args) = 0;
464 };
465 
468 {
469  CT_UNKNOWN, // command is not known to framework
470  CT_EMPTY, // command specification was empty
471  CT_COMMENT, // a comment was given starting with '/'
472  CT_SHOW, // a show command was specified, currently only show all is supported
473  CT_PERSISTENT, // the persistent command means that all successive value set commands in a config file should be updated during execution when the user changes one of them
474  CT_INITIAL, // reverts a persistent command
475  CT_PLUGIN, // loads a plugin
476  CT_CONFIG, // executes a config file
477  CT_GUI, // loads a gui description file
478  CT_NAME, // sets a value of a registered object of the given name
479  CT_TYPE // sets a value of a registered object of the given type
480 };
481 
484 {
488  std::vector<cgv::utils::token> parameters;
489 };
490 
492 extern CommandType CGV_API analyze_command(const cgv::utils::token& cmd, bool eliminate_quotes = true, command_info* info_ptr = 0);
493 
495 extern bool CGV_API process_command(const command_info& info);
496 
499 
501 
519 extern bool CGV_API process_command(const std::string& cmd, bool eliminate_quotes = true);
520 
522 extern void CGV_API show_all();
524 
527 
530 extern CGV_API void register_prog_name(const char* prog_name);
532 extern CGV_API std::string& ref_prog_name();
534 extern CGV_API std::string& ref_prog_path_prefix();
536 extern CGV_API void process_command_line_args(int argc, char** argv);
538 
541 
543 
545 {
547  virtual void multi_observe(base_ptr bp, const std::string& property_assignments, size_t off) = 0;
548 };
549 
551 
553 {
554 public:
556  virtual config_file_observer* find_config_file_observer(const std::string& file_name, const std::string& content) = 0;
558  virtual bool process_gui_file(const std::string& file_name) = 0;
559 };
560 
562 extern CGV_API void register_config_file_driver(config_file_driver* cfd);
563 
565 extern named_ptr CGV_API find_object_by_name(const std::string& name);
567 extern base_ptr CGV_API find_object_by_type(const std::string& type_name);
569 extern bool CGV_API process_config_file(const std::string& file_name);
571 extern bool CGV_API process_gui_file(const std::string& file_name);
573 
576 
579 extern CGV_API void* load_plugin(const std::string& file_name);
581 extern CGV_API std::string& ref_plugin_name();
583 extern CGV_API bool unload_plugin(void* handle);
585 
586 
587  }
588 }
589 
590 #include <cgv/config/lib_end.h>
cgv::base::factory
interface for a factory that allows to create objects derived from cgv::base::base
Definition: register.h:225
cgv::base::config_file_driver
abstract interface for a config file driver that handles permanent registration and gui config files.
Definition: register.h:553
cgv::base::disable_permanent_registration
void disable_permanent_registration()
deregister registration listener and dereference pointers to registered objects
Definition: register.cxx:507
cgv::base::is_registration_enabled
bool is_registration_enabled()
check whether registration is enabled
Definition: register.cxx:473
cgv::base::factory::object_options
std::string object_options
store the options used for registering newly created objects
Definition: register.h:234
cgv::base::object_registration::object_registration
object_registration(const std::string &options)
pass information about the target registration listener in the options argument
Definition: register.h:159
cgv::base::object_registration_1
convenience class to register an object of the given class type with one constructor argument
Definition: register.h:170
cgv::base::command_info
a structure to store an analized command
Definition: register.h:484
cgv::base::factory_impl_1::get_type_name
std::string get_type_name() const
overload to return the type name of this object. By default the type interface is queried over get_ty...
Definition: register.h:278
cgv::base::object_registration
convenience class to register an object of the given class type
Definition: register.h:157
cgv::base::unload_plugin
bool unload_plugin(void *handle)
unload the plugin with the given handle
Definition: register.cxx:1435
cgv::base::factory_registration::factory_registration
factory_registration(const std::string &_created_type_name, const std::string &_options="", bool _is_singleton=false, const std::string &_object_options="")
this registers an instance of the default factory implementation
Definition: register.h:308
cgv::base::config_file_driver::find_config_file_observer
virtual config_file_observer * find_config_file_observer(const std::string &file_name, const std::string &content)=0
create or find a config_file_observer from the given file name and the read content of the config fil...
cgv::base::test::nr_failed
static int nr_failed
static counter for all tests
Definition: register.h:370
cgv::base::show_all
void show_all()
show information about all registered members
Definition: register.cxx:936
cgv::base::is_registration_event_cleanup_enabled
bool is_registration_event_cleanup_enabled()
return whether registration cleanup is enabled
Definition: register.cxx:551
cgv::base::factory_impl_1
implementation of factory for objects of type T using a constructor with one argument of type CA
Definition: register.h:273
cgv::base::enable_registration_debugging
void enable_registration_debugging()
enable registration debugging
Definition: register.cxx:361
cgv::utils::token
Definition: token.h:16
cgv::base::factory_impl_2::get_type_name
std::string get_type_name() const
overload to return the type name of this object. By default the type interface is queried over get_ty...
Definition: register.h:290
cgv::base::factory_registration_1::factory_registration_1
factory_registration_1(const std::string &_created_type_name, const CA &_ca, const std::string &_options="", bool _is_singleton=false, const std::string &_object_options="")
this registers an instance of a standard factory implementation
Definition: register.h:331
cgv::base::factory_registration_1
convenience class to register a factory of the given class type that uses a constructor with one argu...
Definition: register.h:322
cgv::base::registration_order_definition
helper class whose constructor calls the define_registration_order() function
Definition: register.h:48
cgv::base::object_registration_2
convenience class to register an object of the given class type with two constructor arguments
Definition: register.h:183
cgv::base::argument_handler
interface for objects that process unknown command line arguments
Definition: register.h:461
cgv::base::is_registration_debugging_enabled
bool is_registration_debugging_enabled()
check whether registration debugging is enabled
Definition: register.cxx:372
cgv::data::ref_ptr< base, true >
cgv::base::resource_file_info
information registered with each resource file
Definition: register.h:416
cgv::base::process_command
bool process_command(const command_info &info)
process a command given by a command info structure, return whether command was processed correctly
Definition: register.cxx:1251
cgv::base::object_constructor::get_constructed_type_name
virtual std::string get_constructed_type_name() const =0
return the type name of the to be constructed object
cgv::base::resource_file_registration
convenience class to register a resource file
Definition: register.h:441
cgv::base::factory::create_object_impl
virtual base_ptr create_object_impl()=0
overload to create an object
cgv::base::define_registration_order
void define_registration_order(const std::string &partial_order, bool before_contructor_execution, const std::string &when)
specify a partial order of objects for registration
Definition: register.cxx:248
cgv::base::factory_impl::create_object_impl
base_ptr create_object_impl()
overload to create an object
Definition: register.h:266
cgv::base::base_ptr
data::ref_ptr< base, true > base_ptr
ref counted pointer to base
Definition: base.h:37
cgv::base::object_registration_2::object_registration_2
object_registration_2(const CA1 &a1, const CA2 &a2, const std::string &options="")
pass information about the target registration listener in the options argument
Definition: register.h:185
cgv::type::info::type_name::get_name
static const char * get_name()
return special name for standard types or type name from RTTI cleaned from keywords for all other typ...
Definition: type_name.h:56
cgv::base::config_file_driver::process_gui_file
virtual bool process_gui_file(const std::string &file_name)=0
process a gui file
cgv::base::enable_registration_event_cleanup
void enable_registration_event_cleanup()
Enable cleanup of registration events (default).
Definition: register.cxx:523
cgv::base::ref_resource_file_map
std::map< std::string, resource_file_info > & ref_resource_file_map()
return a reference to a mapping of resource file names to resource file infos
Definition: register.cxx:140
cgv::base::config_file_observer::multi_observe
virtual void multi_observe(base_ptr bp, const std::string &property_assignments, size_t off)=0
to be implemented method that adds permanent registration for a list of property assignments
cgv::base::test_registration
declare an instance of test_registration as static variable in order to register a test function in a...
Definition: register.h:403
cgv::base::unregister_all_objects
void unregister_all_objects()
unregister all existing objects to clean up
Definition: register.cxx:488
cgv::base::get_permanently_registered_object
base_ptr get_permanently_registered_object(unsigned i)
access to i-th permanently registered object
Definition: register.cxx:500
cgv::base::test::test_name
std::string test_name
name of test function
Definition: register.h:373
cgv::base::factory::singleton
base_ptr singleton
pointer to the single object created by the factory in case is_singleton is true
Definition: register.h:232
cgv::base::config_file_observer
abstract interface for observers of config files.
Definition: register.h:545
cgv::base::get_nr_permanently_registered_objects
unsigned get_nr_permanently_registered_objects()
access to number of permanently registered objects
Definition: register.cxx:494
cgv::base::factory_registration::factory_registration
factory_registration(const char *item_text, char shortcut, bool is_singleton=false)
this constructor is only provided for downward compatibility and should not be used anymore.
Definition: register.h:314
cgv::base::object_constructor
abstract base class of helpers to perform delayed registration and creation of objects in case that t...
Definition: register.h:96
cgv::base::resource_string_registration
convenience class to register a resource string
Definition: register.h:451
cgv::base::factory::get_created_type_name
const std::string & get_created_type_name() const
overload to return the type name of the objects that the factory can create
Definition: register.cxx:846
cgv::base::factory_registration_2
convenience class to register a factory of the given class type that uses a constructor with one argu...
Definition: register.h:345
cgv::base::process_command_line_args
void process_command_line_args(int argc, char **argv)
process the command line arguments: extract program name and load all plugins
Definition: register.cxx:1265
cgv::base::ref_plugin_name
std::string & ref_plugin_name()
return a reference to the currently loaded plugin
Definition: register.cxx:134
cgv::base::factory::created_type_name
std::string created_type_name
store the type name of the to be created objects
Definition: register.h:228
cgv::base::test
structure used to register a test function
Definition: register.h:367
cgv::base::resource_file_info::file_data
const char * file_data
pointer to
Definition: register.h:422
cgv::base::factory_impl::get_type_name
std::string get_type_name() const
overload to return the type name of this object. By default the type interface is queried over get_ty...
Definition: register.h:267
cgv::base::factory::is_singleton
bool is_singleton
store whether the factory can only create one object
Definition: register.h:230
cgv::base::factory_impl_1::create_object_impl
base_ptr create_object_impl()
overload to create an object
Definition: register.h:277
cgv::base::factory_impl
implementation of factory for objects of type T using the standard constructor
Definition: register.h:263
cgv::base::disable_registration
void disable_registration()
if registration is disable, all registration events are stored and sent at the momement when registra...
Definition: register.cxx:461
cgv::base::factory_registration_2::factory_registration_2
factory_registration_2(const std::string &_created_type_name, const CA1 &_ca1, const CA2 &_ca2, const std::string &_options="", bool _is_singleton=false, const std::string &_object_options="")
this registers an instance of a standard factory implementation
Definition: register.h:354
cgv::base::argument_handler::handle_args
virtual void handle_args(std::vector< std::string > &args)=0
this function is called on registered objects with the list of unknown command line parameters
cgv::base::find_object_by_type
base_ptr find_object_by_type(const std::string &type_name)
in case permanent registration is active, look for a registered object by type name
Definition: register.cxx:636
cgv::base::unregister_object
void unregister_object(base_ptr object, const std::string &options)
unregister an object and send event to all current registration ref_listeners()
Definition: register.cxx:594
cgv::base::disable_registration_debugging
void disable_registration_debugging()
disable registration debugging
Definition: register.cxx:366
cgv::base::register_resource_string
void register_resource_string(const std::string &string_name, const char *string_data)
register a resource string
Definition: register.cxx:919
cgv::base::registration_listener::unregister_object
virtual void unregister_object(base_ptr object, const std::string &options="")=0
overload to handle unregistration events
cgv::base::driver
interfaces that add several listeners and objects.
Definition: register.h:208
cgv::base::server
interfaces that add provides very basic functionality.
Definition: register.h:201
cgv::base::is_permanent_registration_enabled
bool is_permanent_registration_enabled()
check whether permanent registration is enabled
Definition: register.cxx:518
cgv::base::process_config_file
bool process_config_file(const std::string &_file_name)
interpret a config file
Definition: register.cxx:756
cgv::base::ref_prog_name
std::string & ref_prog_name()
return a refence to the name of the started executable
Definition: register.cxx:122
cgv::base::command_info::parameters
std::vector< cgv::utils::token > parameters
the parameters, one file name parameter for PLUGIN, CONFIG, GUI and two parameters (name/type,...
Definition: register.h:488
cgv::base::register_resource_file
void register_resource_file(const std::string &file_path, unsigned int file_offset, unsigned int file_length, const char *file_data, const std::string &source_file)
register a resource file
Definition: register.cxx:914
cgv::base::factory_registration_1::factory_registration_1
factory_registration_1(const char *item_text, char shortcut, const CA &_ca, bool is_singleton=false)
this constructor is only provided for downward compatibility and should not be used anymore.
Definition: register.h:337
cgv::base::factory_registration
convenience class to register a factory of the given class type
Definition: register.h:299
cgv::base::registration_listener::register_object
virtual void register_object(base_ptr object, const std::string &options="")=0
overload to handle registration events
cgv::base::resource_file_info::source_file
std::string source_file
name of
Definition: register.h:424
cgv::base::ref_prog_path_prefix
std::string & ref_prog_path_prefix()
return a refence to the path prefix of the started executable, this can be prepended for example to d...
Definition: register.cxx:128
cgv::base::disable_registration_event_cleanup
void disable_registration_event_cleanup()
disable cleanup of registration events (see enable_registration_event_cleanup).
Definition: register.cxx:541
cgv::base::find_object_by_name
named_ptr find_object_by_name(const std::string &name)
in case permanent registration is active, look for a registered object by name
Definition: register.cxx:630
cgv::base::base
Definition: base.h:57
cgv::base::command_info::command_type
CommandType command_type
the command type
Definition: register.h:486
cgv::base::analyze_command
CommandType analyze_command(const cgv::utils::token &cmd, bool eliminate_quotes, command_info *info_ptr)
parse a command and optionally store result in the command info, returns the command type
Definition: register.cxx:974
cgv::base::object_constructor::construct_object
virtual base_ptr construct_object() const =0
creation function
cgv::base::CommandType
CommandType
enumerate type for all command types supported in configuration files
Definition: register.h:468
cgv::base::enable_registration
void enable_registration()
enable registration and send all registration events that where emitted during disabled registration
Definition: register.cxx:377
cgv::base::load_plugin
void * load_plugin(const std::string &file_name)
load a plugin or dll and return a handle to the plugin, or 0 if loading was not successful.
Definition: register.cxx:1384
cgv::base::resource_file_info::file_length
unsigned int file_length
length of the resource file in bytes
Definition: register.h:420
cgv::type::info::get_type_name
const char * get_type_name(TypeId tid)
function that returns the name of a type specified through TypeId
Definition: type_id.cxx:117
cgv::base::process_gui_file
bool process_gui_file(const std::string &file_name)
interpret a gui file
Definition: register.cxx:762
cgv::base::register_config_file_driver
void register_config_file_driver(config_file_driver *cfd)
method to register a config_file_driver
Definition: register.cxx:661
cgv::base::enable_permanent_registration
void enable_permanent_registration()
register a registration listener that stores pointers to all registered objects
Definition: register.cxx:478
cgv::base::object_registration_1::object_registration_1
object_registration_1(const CA &arg, const std::string &options="")
pass information about the target registration listener in the options argument
Definition: register.h:172
cgv::base::factory_impl_2::create_object_impl
base_ptr create_object_impl()
overload to create an object
Definition: register.h:289
cgv::base::register_prog_name
void register_prog_name(const char *_prog_name)
set the file name of the current program.
Definition: register.cxx:895
cgv::base::register_object
void register_object(base_ptr object, const std::string &options)
register an object and send event to all current registration ref_listeners()
Definition: register.cxx:557
cgv
the cgv namespace
Definition: vr_calib.cxx:9
cgv::base::registration_listener
interfaces that allows to listen to registration events.
Definition: register.h:216
cgv::base::object_constructor::get_type_name
std::string get_type_name() const
return the type name of the object constructor class
Definition: register.h:99
cgv::base::factory::factory
factory(const std::string &_created_type_name, bool _singleton=false, const std::string &_object_options="")
construct
Definition: register.cxx:801
cgv::base::factory_impl_2
implementation of factory for objects of type T using a constructor with two arguments of types CA1 a...
Definition: register.h:284
cgv::type::info::type_name
Definition: type_name.h:54
cgv::base::resource_file_info::file_offset
unsigned int file_offset
at which location the resource file starts within the executable or dll
Definition: register.h:418