Graphite
Version 3
An experimental 3D geometry processing program
|
Base class for all objects in the GOM system. More...
#include <OGF/gom/types/object.h>
Public Member Functions | |
Object (bool transient=false) | |
Object constructor. More... | |
virtual | ~Object () |
Object destructor. | |
virtual MetaClass * | meta_class () const |
Gets the meta class. More... | |
virtual void | set_meta_class (MetaClass *mclass) |
Sets the meta class. More... | |
unsigned int | id () const |
Gets the identifier of this object. More... | |
std::string | string_id () const |
Gets the unique string identifier. More... | |
bool | has_method (const std::string &method_name) const |
Tests whether a method is defined. More... | |
virtual bool | invoke_method (const std::string &method_name, const ArgList &args, Any &ret_val) |
Invokes a method by method name and argument list, and gets the return value. More... | |
bool | invoke_method (const std::string &method_name, const ArgList &args) |
Invokes a method by method name and argument list. More... | |
bool | invoke_method (const std::string &method_name) |
Invokes a method by method name. More... | |
bool | has_property (const std::string &prop_name) const |
Tests whether a property is defined. More... | |
virtual bool | get_property (const std::string &prop_name, std::string &prop_value) const |
Gets a property. More... | |
virtual Connection * | connect_signal_to_slot (const std::string &signal_name, Object *to, const std::string &slot_name) |
Connects a signal with a slot of another object. More... | |
virtual void | add_connection (Connection *connection) |
Adds a connection to this object. More... | |
virtual void | remove_connection (Connection *connection) |
Removes a connection to this object. More... | |
virtual void | get_element (index_t i, Any &value) const |
Gets an element by index. More... | |
virtual void | set_element (index_t i, const Any &value) |
Sets an element by index. More... | |
virtual void | search (const std::string &needle, const std::string &path="") |
Displays the names of all objects that contain a substring. More... | |
bool | get_signals_enabled () const |
Tests wheter signals are enabled. More... | |
void | set_signals_enabled (bool value) |
Enables or disables signals. More... | |
bool | get_slots_enabled () const |
Tests wheter slots are enabled. More... | |
void | set_slots_enabled (bool value) |
Enables or disables slots. More... | |
MetaClass * | get_meta_class () const |
Gets the meta class. More... | |
std::string | get_string_id () const |
Gets the unique string identifier. More... | |
virtual std::string | get_doc () const |
Gets the documentation. More... | |
virtual Sign | compare (const Object *other) const |
Compares this object with another one. More... | |
virtual bool | is_a (const MetaType *type) const |
Tests whether this object inherits a given type. More... | |
void | disconnect () |
Removes all connections from signals of this objects. More... | |
void | enable_signals () |
Enables signals. | |
void | disable_signals () |
Disables signals. | |
void | enable_slots () |
Enables slots. | |
void | disable_slots () |
Disables slots. | |
void | set_properties (const ArgList &args) |
Sets several properties in a single call. More... | |
virtual bool | set_property (const std::string &name, const std::string &value) |
Sets an individual property. More... | |
void | help () const |
Displays some help about this object. More... | |
virtual bool | set_property (const std::string &name, const Any &value) |
Sets an individual property. More... | |
virtual bool | get_property (const std::string &prop_name, Any &prop_value) const |
Gets a property. More... | |
Public Member Functions inherited from GEO::Counted | |
void | ref () const |
Increments the reference count. More... | |
void | unref () const |
Decrements the reference count. More... | |
bool | is_shared () const |
Check if the object is shared. More... | |
int | nb_refs () const |
Gets the number of references that point to this object. More... | |
Static Public Member Functions | |
static Object * | id_to_object (unsigned int id) |
Gets an object from a unique object id. More... | |
Static Public Member Functions inherited from GEO::Counted | |
static void | ref (const Counted *counted) |
Increments the reference count. More... | |
static void | unref (const Counted *counted) |
Decrements the reference count. More... | |
Public Attributes | |
__pad0__: virtual index_t get_nb_elements() const | |
__pad1__: bool equals(const Object* other) const | |
Protected Member Functions | |
virtual bool | emit_signal (const std::string &signal_name, const ArgList &args, bool called_from_slot=false) |
Emits a signal and calls the slots it is connected to. More... | |
Protected Member Functions inherited from GEO::Counted | |
Counted () | |
Creates a reference counted object. More... | |
virtual | ~Counted () |
Destroys a reference counted object. More... | |
Friends | |
class | MetaMethod |
|
explicit |
Object constructor.
[in] | transient | if true, the object is transient. Transient objects have their id set to zero and are not referenced in the global id_to_object_ table. |
|
virtual |
Adds a connection to this object.
[in] | connection | a pointer to the connection to be added |
Compares this object with another one.
Default implementation compares addresses
[in] | other | the other object to be compared |
POSITIVE | if this object is greater than other |
ZERO | if this object and other are equal |
NEGATIVE | if this object is lower than other |
|
virtual |
Connects a signal with a slot of another object.
[in] | signal_name | name of the signal |
[in] | to | a pointer to the receiver Object |
[in] | slot_name | name of the receiver's slot |
void OGF::Object::disconnect | ( | ) |
Removes all connections from signals of this objects.
Connections to slots of this object are kept.
|
protectedvirtual |
Emits a signal and calls the slots it is connected to.
This function is used by GOMGEN to implement all the signal adapters, that marshall the signal's arguments in the argument list and calls the slots.
[in] | signal_name | name of the signal |
[in] | args | a const reference to the arguments list |
[in] | called_from_slot | distingishes whether the signal was called after an event, or was called from client code. This can be used to implement a recording mechanism. |
Reimplemented in OGF::MetaMethod.
|
virtual |
Gets the documentation.
Reimplemented in OGF::Request, OGF::MetaMethod, and OGF::MetaClass.
Gets an element by index.
Part of the array interface, used by operator[] in scripting language.
[in] | i | the index of the element, in [0..get_nb_elements()-1]. |
[out] | value | the element at index i. |
Reimplemented in OGF::NL::Vector.
|
inline |
|
virtual |
Gets a property.
[in] | prop_name | name of the property |
[out] | prop_value | value of the property as a string |
true | if the property could be sucessfully read |
false | otherwise |
Reimplemented in OGF::DynamicObject.
|
virtual |
Gets a property.
[in] | prop_name | name of the property |
[out] | prop_value | value of the property as a string |
true | if the property could be sucessfully read |
false | otherwise |
|
inline |
|
inline |
|
inline |
Gets the unique string identifier.
The unique string identifier is composed of the class name and instance id.
bool OGF::Object::has_method | ( | const std::string & | method_name | ) | const |
Tests whether a method is defined.
[in] | method_name | name of the property |
true | if this Object has the method |
false | otherwise |
bool OGF::Object::has_property | ( | const std::string & | prop_name | ) | const |
Tests whether a property is defined.
[in] | prop_name | name of the property |
true | if this Object has the property |
false | otherwise |
void OGF::Object::help | ( | ) | const |
Displays some help about this object.
Outputs the doc property to the logger.
|
inline |
Gets the identifier of this object.
Each object instance has a unique identifier. This identifier is used by the object maps managed by each MetaClass. It is also used by the VCR mechanism that allows one to record and playback all the events in the system.
|
inlinestatic |
|
inline |
|
inline |
Invokes a method by method name and argument list.
This variant of invoke() is for methods with void return type.
[in] | method_name | name of the method |
[in] | args | a const reference to the ArgList |
true | if the method could be sucessfully invoked |
false | otherwise |
|
virtual |
Invokes a method by method name and argument list, and gets the return value.
[in] | method_name | name of the method |
[in] | args | a const reference to the ArgList |
[out] | ret_val | the return value as an Any |
true | if the method could be sucessfully invoked |
false | otherwise |
Reimplemented in OGF::Commands.
|
virtual |
Tests whether this object inherits a given type.
[in] | type | a const pointer to the MetaType to be tested. |
true | if this object inherits type |
false | otherwise |
|
virtual |
Gets the meta class.
|
virtual |
Removes a connection to this object.
[in] | connection | a pointer to the connection to be removed |
|
virtual |
Displays the names of all objects that contain a substring.
[in] | needle | the substring |
[in] | path | the path to be prepended to the names |
Reimplemented in OGF::MetaClass, OGF::Scope, OGF::MetaInformation, and OGF::Interpreter.
Sets an element by index.
Part of the array interface, used by operator[] in scripting language.
[in] | i | the index of the element, in [0..get_nb_elements()-1]. |
[in] | value | the element at index i. |
Reimplemented in OGF::NL::Vector.
|
virtual |
Sets the meta class.
This function is automatically called by the factories generated by GOMGEN. User code does not need to use it.
[in] | mclass | a pointer to the MetaClass |
void OGF::Object::set_properties | ( | const ArgList & | args | ) |
Sets several properties in a single call.
[in] | args | a const reference to a set of name-value pairs |
|
virtual |
Sets an individual property.
[in] | name | name of the property |
[in] | value | value of the property as an Any |
true | if the property could be sucessfully set |
false | otherwise |
Reimplemented in OGF::DynamicObject.
|
virtual |
Sets an individual property.
[in] | name | name of the property |
[in] | value | value of the property |
true | if the property could be sucessfully set |
false | otherwise |
|
inline |
|
inline |
std::string OGF::Object::string_id | ( | ) | const |
Gets the unique string identifier.
The unique string identifier is composed of the class name and instance id.