cgv
|
Classes | |
struct | gui_definition |
each gui definition consists of the textual definition as well as an options string More... | |
Public Member Functions | |
base_provider_generator () | |
construct from instance and gui definition | |
std::string | get_type_name () const |
overload to return the type name of this object. By default the type interface is queried over get_type. | |
bool | self_reflect (cgv::reflect::reflection_handler &rh) |
used for simple self reflection | |
void | on_set (void *member_ptr) |
this callback is called when the set_void method has changed a member and can be overloaded in derived class | |
bool | parse_gui_file (const std::string &file_name) |
parse file and extract gui definitions | |
void | register_object (cgv::base::base_ptr object, const std::string &options) |
if object is registered that does not provide its own gui but matches type or name of a parsed gui definition, register a newly created base_provider for the object | |
void | unregister_object (cgv::base::base_ptr object, const std::string &options) |
remove also the base_provider of an object if created | |
![]() | |
virtual std::string | get_default_options () const |
overload to provide default options for registration | |
std::string | get_name_or_type_name () const |
determine name of instance by checking cgv::base::named interface and in failure fallback to get_type_name() | |
virtual void | on_register () |
overload to handle register events that is sent after the instance has been registered | |
virtual void | unregister () |
overload to handle unregistration of instances | |
virtual bool | on_exit_request () |
overload to handle the appication exit request, return true if exiting is allowed and false otherwise | |
virtual void | stream_stats (std::ostream &) |
overload to show the content of this object | |
virtual data::ref_ptr< named, true > | get_named () |
perform downcast to named | |
virtual data::ref_ptr< node, true > | get_node () |
perform downcast to node | |
virtual data::ref_ptr< group, true > | get_group () |
perform downcast to group | |
virtual data::ref_ptr< const named, true > | get_named_const () const |
perform downcast to const named | |
virtual data::ref_ptr< const node, true > | get_node_const () const |
perform downcast to const node | |
virtual data::ref_ptr< const group, true > | get_group_const () const |
perform downcast to const group | |
template<class T > | |
data::ref_ptr< T, true > | cast () |
cast to arbitrary class, but use the casts to named, node and group from the interface | |
template<class T > | |
data::ref_ptr< const T, true > | cast_const () |
const cast to arbitrary class, but use the casts to named, node and group from the interface | |
template<class T > | |
T * | get_interface () |
use dynamic type cast to check for the given interface | |
template<class T > | |
const T * | get_const_interface () const |
use dynamic type cast to check for the given interface | |
virtual void | update () |
this virtual update allows for example to ask a view to update the viewed value. The default implementation is empty. | |
virtual void * | get_user_data () const |
this virtual method allows to pass application specific data for internal purposes | |
virtual std::string | get_property_declarations () |
return a semicolon separated list of property declarations | |
virtual bool | set_void (const std::string &property, const std::string &value_type, const void *value_ptr) |
abstract interface for the setter of a dynamic property. | |
virtual bool | get_void (const std::string &property, const std::string &value_type, void *value_ptr) |
abstract interface for the getter of a dynamic property. | |
virtual bool | call_void (const std::string &method, const std::vector< std::string > ¶m_value_types, const std::vector< const void * > ¶m_value_ptrs, const std::string &result_type="", void *result_value_ptr=0) |
abstract interface to call an action | |
void | set (const std::string &property, const char *value) |
specialization of set method to support const char* as strings | |
template<typename T > | |
void | set (const std::string &property, const T &value) |
set a property of the element to the given value and perform standard conversions if necessary. | |
template<typename T > | |
T | get (const std::string &property) |
query a property of the element and perform standard conversions if necessary. | |
void | multi_set (const std::string &property_assignments, bool report_error=true) |
set several properties | |
bool | is_property (const std::string &property_name, std::string *type_name=0) |
check if the given name specifies a property. | |
void * | find_member_ptr (const std::string &property_name, std::string *type_name=0) |
find a member pointer by name. | |
![]() | |
int | get_ref_count () const |
read access to current count | |
Protected Types | |
typedef std::map< std::string, gui_definition > | def_map_type |
type of mapping from strings to gui definitions | |
typedef def_map_type::const_iterator | def_map_iter |
iterator type for map | |
typedef std::map< cgv::base::base_ptr, base_provider_ptr > | pvd_map_type |
type of map from objects to base_providers | |
typedef pvd_map_type::iterator | pvd_map_iter |
iterator type of base_provider map | |
Protected Member Functions | |
bool | generate_object_gui (cgv::base::base_ptr object) |
check whether gui description is available for object and if yes generate a base_provider | |
void | timer_event (double, double) |
![]() | |
virtual | ~base () |
make destructor virtual and not accessible from outside | |
![]() | |
ref_counted () | |
constructor initializes the count to 0 | |
void | set_ref_count (int c) const |
write access is also const to allow ref counted pointers to const instances | |
Protected Attributes | |
def_map_type | defs_by_type |
mappings from type to gui definitions | |
def_map_type | defs_by_name |
mappings from name to gui definitions | |
std::vector< cgv::base::base_ptr > | unmatched_objects |
keep track of unmatched objects | |
pvd_map_type | providers |
store map to base_providers | |
std::map< std::string, long long > | gui_files |
store read gui files with last write times | |
bool | check_file_update |
whether to check files | |
Additional Inherited Members | |
![]() | |
template<class T > | |
static data::ref_ptr< T, true > | cast_dynamic (base *b) |
use dynamic cast for upcast to given class | |
Definition at line 13 of file base_provider_generator.h.
|
protected |
iterator type for map
Definition at line 25 of file base_provider_generator.h.
|
protected |
type of mapping from strings to gui definitions
Definition at line 23 of file base_provider_generator.h.
|
protected |
iterator type of base_provider map
Definition at line 29 of file base_provider_generator.h.
|
protected |
type of map from objects to base_providers
Definition at line 27 of file base_provider_generator.h.
cgv::gui::base_provider_generator::base_provider_generator | ( | ) |
construct from instance and gui definition
Definition at line 14 of file base_provider_generator.cxx.
References check_file_update.
|
protected |
check whether gui description is available for object and if yes generate a base_provider
Definition at line 184 of file base_provider_generator.cxx.
References defs_by_name, defs_by_type, providers, and cgv::base::register_object().
Referenced by parse_gui_file(), and register_object().
|
virtual |
overload to return the type name of this object. By default the type interface is queried over get_type.
overload to return the type name of this object
Reimplemented from cgv::base::base.
Definition at line 20 of file base_provider_generator.cxx.
|
virtual |
this callback is called when the set_void method has changed a member and can be overloaded in derived class
Reimplemented from cgv::base::base.
Definition at line 32 of file base_provider_generator.cxx.
References check_file_update, and cgv::gui::get_animation_trigger().
bool cgv::gui::base_provider_generator::parse_gui_file | ( | const std::string & | file_name | ) |
parse file and extract gui definitions
Definition at line 69 of file base_provider_generator.cxx.
References defs_by_name, defs_by_type, generate_object_gui(), gui_files, providers, cgv::utils::tokenizer::set_sep(), cgv::utils::tokenizer::set_skip(), cgv::utils::to_string(), and unmatched_objects.
|
virtual |
if object is registered that does not provide its own gui but matches type or name of a parsed gui definition, register a newly created base_provider for the object
Implements cgv::base::registration_listener.
Definition at line 211 of file base_provider_generator.cxx.
References generate_object_gui(), and unmatched_objects.
|
virtual |
used for simple self reflection
is used by default implementation of set_void, get_void and get_property_declarations
The overloaded implementation is used by the default implementations of set_void, get_void and get_property_declarations with corresponding reflection handlers. The default implementation of self_reflect is empty.
Reimplemented from cgv::base::base.
Definition at line 26 of file base_provider_generator.cxx.
References check_file_update, and cgv::reflect::reflection_handler::reflect_member().
|
protected |
Definition at line 59 of file base_provider_generator.cxx.
|
virtual |
remove also the base_provider of an object if created
Implements cgv::base::registration_listener.
Definition at line 221 of file base_provider_generator.cxx.
References providers, unmatched_objects, and cgv::base::unregister_object().
|
protected |
whether to check files
Definition at line 43 of file base_provider_generator.h.
Referenced by base_provider_generator(), on_set(), and self_reflect().
|
protected |
mappings from name to gui definitions
Definition at line 33 of file base_provider_generator.h.
Referenced by generate_object_gui(), and parse_gui_file().
|
protected |
mappings from type to gui definitions
Definition at line 31 of file base_provider_generator.h.
Referenced by generate_object_gui(), and parse_gui_file().
|
protected |
store read gui files with last write times
Definition at line 41 of file base_provider_generator.h.
Referenced by parse_gui_file().
|
protected |
store map to base_providers
Definition at line 37 of file base_provider_generator.h.
Referenced by generate_object_gui(), parse_gui_file(), and unregister_object().
|
protected |
keep track of unmatched objects
Definition at line 35 of file base_provider_generator.h.
Referenced by parse_gui_file(), register_object(), and unregister_object().