cgv
|
interface for a factory that allows to create objects derived from cgv::base::base More...
#include <register.h>
Public Member Functions | |
factory (const std::string &_created_type_name, bool _singleton=false, const std::string &_object_options="") | |
construct | |
virtual std::string | get_object_options () const |
return the options string used for object registration | |
const std::string & | get_created_type_name () const |
overload to return the type name of the objects that the factory can create | |
std::string | get_property_declarations () |
support creation of object by setting create property to true | |
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. More... | |
bool | get_void (const std::string &property, const std::string &value_type, void *value_ptr) |
abstract interface for the getter of a dynamic property. More... | |
bool | is_singleton_factory () const |
return whether the factory can only generate one instance of the given type | |
base_ptr | get_singleton () const |
return pointer to singleton | |
void | release_singleton () |
release the singleton pointer | |
base_ptr | create_object () |
overload to create an object | |
virtual base_ptr | create_object_impl ()=0 |
overload to create an object | |
virtual 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. More... | |
virtual std::string | get_default_options () const |
overload to provide default options for registration | |
virtual void | on_register () |
overload to handle register events that is sent after the instance has been registered More... | |
virtual void | unregister () |
overload to handle unregistration of instances | |
virtual void | stream_stats (std::ostream &) |
overload to show the content of this object | |
virtual data::ref_ptr< named, true > | get_named () |
cast upward to named | |
virtual data::ref_ptr< node, true > | get_node () |
cast upward to node | |
virtual data::ref_ptr< group, true > | get_group () |
cast upward to 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 > | |
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 More... | |
int | get_ref_count () const |
read access to current count | |
Protected Member Functions | |
void | set_ref_count (int c) const |
write access is also const to allow ref counted pointers to const instances | |
Static Protected Member Functions | |
template<class T > | |
static data::ref_ptr< T, true > | cast_dynamic (base *b) |
use dynamic cast for upcast to given class | |
Protected Attributes | |
std::string | created_type_name |
store the type name of the to be created objects | |
bool | is_singleton |
store whether the factory can only create one object | |
base_ptr | singleton |
pointer to the single object created by the factory in case is_singleton is true | |
std::string | object_options |
store the options used for registering newly created objects | |
property interface | |
virtual bool | self_reflect (cgv::reflect::reflection_handler &) |
used for simple self reflection More... | |
virtual 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 | |
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 More... | |
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. More... | |
template<typename T > | |
T | get (const std::string &property) |
query a property of the element and perform standard conversions if necessary. More... | |
void | multi_set (const std::string &property_assignments, bool report_error=true) |
set several properties More... | |
bool | is_property (const std::string &property_name, std::string *type_name=0) |
check if the given name specifies a property. More... | |
void * | find_member_ptr (const std::string &property_name, std::string *type_name=0) |
find a member pointer by name. More... | |
interface for a factory that allows to create objects derived from cgv::base::base
|
virtualinherited |
abstract interface to call an action
overload to implement the execution of a method based on the method name and the given parameters
, i.e. a class method based on the action name and the given parameters. The default implementation uses the self_reflect() method to dispatch this call. If not found, the get_void method returns false.
|
inherited |
find a member pointer by name.
If not found the null pointer is returned. If the type name string pointer is provided, the type of the property is copied to the referenced string.
|
inlineinherited |
query a property of the element and perform standard conversions if necessary.
This templated version simply extracts the type of the value from the reference and calls the set_void() method. Note that this only works if the template cgv::type::info::type_name<T> is overloaded for the value type.
|
virtualinherited |
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 in cgv::render::render_config, cgv::base::test, cgv::base::factory_impl_2< T, CA1, CA2 >, cgv::base::factory_impl_1< T, CA >, cgv::base::factory_impl< T >, cgv::base::object_constructor, cgv::base::base_generator, cgv::media::image::image_reader, cgv::media::video::video_writer, cgv::media::image::image_writer, cgv::media::font::font, cgv::media::image::reader_listener, cgv::media::video::video_reader, cgv::gui::gui_group, cgv::base::group, cgv::media::video::video_writer_listener, cgv::render::shader_config, cgv::media::font::font_face, cgv::base::node, cgv::base::named, cgv::base::console, cgv::media::image::bmp_reader, cgv::media::video::video_reader_listener, cgv::media::image::bmp_writer, cgv::media::image::writer_listener, cgv::gui::window, and cgv::gui::button.
|
virtualinherited |
this virtual method allows to pass application specific data for internal purposes
this virtual method allows derived classes to pass application specific data
|
virtual |
abstract interface for the getter of a dynamic property.
abstract interface for the getter, by default it simply returns false
The default implementation uses the self_reflect() method to find a member with the given property as name. If not found, the get_void method returns false.
Reimplemented from cgv::base::base.
|
inherited |
check if the given name specifies a property.
If the type name string pointer is provided, the type of the property is copied to the referenced string.
|
inherited |
set several properties
set several properties, which are defined as colon separated assignments, where the types are derived automatically
, which are defined as colon separated assignments, where the types are derived automatically to bool, int, double or std::string.
|
virtualinherited |
overload to handle register events that is sent after the instance has been registered
overload to return a type info structure. By default an empty pointer is returned.
|
virtualinherited |
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 in cgv::render::render_config, and cgv::render::shader_config.
|
inlineinherited |
set a property of the element to the given value and perform standard conversions if necessary.
This templated version simply extracts the type of the value from the reference and calls the set_void() method. Note that this only works if the template cgv::type::info::type_name<T> is overloaded for the value type.
|
virtual |
abstract interface for the setter of a dynamic property.
abstract interface for the setter, by default it simply returns false
The default implementation uses the self_reflect() method to find a member with the given property as name. If not found, the set_void method returns false.
Reimplemented from cgv::base::base.