cgv
Loading...
Searching...
No Matches
cgv::gui::base_provider_generator Class Reference
Inheritance diagram for cgv::gui::base_provider_generator:
cgv::base::base cgv::base::registration_listener cgv::data::ref_counted cgv::reflect::self_reflection_tag

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
 
- Public Member Functions inherited from cgv::base::base
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, trueget_named ()
 perform downcast to named
 
virtual data::ref_ptr< node, trueget_node ()
 perform downcast to node
 
virtual data::ref_ptr< group, trueget_group ()
 perform downcast to group
 
virtual data::ref_ptr< const named, trueget_named_const () const
 perform downcast to const named
 
virtual data::ref_ptr< const node, trueget_node_const () const
 perform downcast to const node
 
virtual data::ref_ptr< const group, trueget_group_const () const
 perform downcast to const group
 
template<class T >
data::ref_ptr< T, truecast ()
 cast to arbitrary class, but use the casts to named, node and group from the interface
 
template<class T >
data::ref_ptr< const T, truecast_const ()
 const cast to arbitrary class, but use the casts to named, node and group from the interface
 
template<class T >
Tget_interface ()
 use dynamic type cast to check for the given interface
 
template<class T >
const Tget_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 voidget_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 > &param_value_types, const std::vector< const void * > &param_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.
 
voidfind_member_ptr (const std::string &property_name, std::string *type_name=0)
 find a member pointer by name.
 
- Public Member Functions inherited from cgv::data::ref_counted
int get_ref_count () const
 read access to current count
 

Protected Types

typedef std::map< std::string, gui_definitiondef_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_ptrpvd_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)
 
- Protected Member Functions inherited from cgv::base::base
virtual ~base ()
 make destructor virtual and not accessible from outside
 
- Protected Member Functions inherited from cgv::data::ref_counted
 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_ptrunmatched_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

- Static Protected Member Functions inherited from cgv::base::base
template<class T >
static data::ref_ptr< T, truecast_dynamic (base *b)
 use dynamic cast for upcast to given class
 

Detailed Description

Definition at line 13 of file base_provider_generator.h.

Member Typedef Documentation

◆ def_map_iter

typedef def_map_type::const_iterator cgv::gui::base_provider_generator::def_map_iter
protected

iterator type for map

Definition at line 25 of file base_provider_generator.h.

◆ def_map_type

typedef std::map<std::string,gui_definition> cgv::gui::base_provider_generator::def_map_type
protected

type of mapping from strings to gui definitions

Definition at line 23 of file base_provider_generator.h.

◆ pvd_map_iter

typedef pvd_map_type::iterator cgv::gui::base_provider_generator::pvd_map_iter
protected

iterator type of base_provider map

Definition at line 29 of file base_provider_generator.h.

◆ pvd_map_type

type of map from objects to base_providers

Definition at line 27 of file base_provider_generator.h.

Constructor & Destructor Documentation

◆ base_provider_generator()

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.

Member Function Documentation

◆ generate_object_gui()

bool cgv::gui::base_provider_generator::generate_object_gui ( cgv::base::base_ptr  object)
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().

◆ get_type_name()

std::string cgv::gui::base_provider_generator::get_type_name ( ) const
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.

◆ on_set()

void cgv::gui::base_provider_generator::on_set ( void *  member_ptr)
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().

◆ parse_gui_file()

bool cgv::gui::base_provider_generator::parse_gui_file ( const std::string &  file_name)

◆ register_object()

void cgv::gui::base_provider_generator::register_object ( cgv::base::base_ptr  object,
const std::string &  options 
)
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.

◆ self_reflect()

bool cgv::gui::base_provider_generator::self_reflect ( cgv::reflect::reflection_handler )
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().

◆ timer_event()

void cgv::gui::base_provider_generator::timer_event ( double  ,
double   
)
protected

Definition at line 59 of file base_provider_generator.cxx.

◆ unregister_object()

void cgv::gui::base_provider_generator::unregister_object ( cgv::base::base_ptr  object,
const std::string &  options 
)
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().

Member Data Documentation

◆ check_file_update

bool cgv::gui::base_provider_generator::check_file_update
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().

◆ defs_by_name

def_map_type cgv::gui::base_provider_generator::defs_by_name
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().

◆ defs_by_type

def_map_type cgv::gui::base_provider_generator::defs_by_type
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().

◆ gui_files

std::map<std::string,long long> cgv::gui::base_provider_generator::gui_files
protected

store read gui files with last write times

Definition at line 41 of file base_provider_generator.h.

Referenced by parse_gui_file().

◆ providers

pvd_map_type cgv::gui::base_provider_generator::providers
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().

◆ unmatched_objects

std::vector<cgv::base::base_ptr> cgv::gui::base_provider_generator::unmatched_objects
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().


The documentation for this class was generated from the following files: