#include <nub/object.h>
Public Member Functions | |
nub::uid | id () const throw () |
rutz::fstring | real_typename () const |
Returns the typename of the full object. | |
virtual rutz::fstring | obj_typename () const |
Returns the (apparent) typename of the full object. | |
rutz::fstring | unique_name () const |
Returns a short string describing the object by its typename and id. | |
Protected Member Functions | |
object () | |
Default constructor. | |
virtual | ~object () GVX_DTOR_NOTHROW |
Virtual destructor. |
nub::object is a base class for objects that are to be exposed to a scripting language. Associates with each object a unique integer identifier. nub::object's are reference counted for automatic memory management, and are generally passed around via nub::ref's or nub::soft_ref's, which automatically manage the reference count.
Definition at line 64 of file object.h.
nub::object::object | ( | ) | [protected] |
Default constructor.
Can't have an empty throw() spec here, because ref_counted's constructor might throw (because it has to allocate memory for a nub::ref_counts object).
nub::object::~object | ( | ) | [protected, virtual] |
nub::uid nub::object::id | ( | ) | const throw () |
rutz::fstring nub::object::obj_typename | ( | ) | const [virtual] |
Returns the (apparent) typename of the full object.
The default implementation just returns real_typename(). However, certain kinds of objects -- e.g., proxy objects -- might usefully choose to have obj_typename() return something besides the real_typename(), in order to masquerade as a different type of object.
Definition at line 73 of file object.cc.
References real_typename().
Referenced by ModelComponent::start(), ModelComponent::stop(), and unique_name().
rutz::fstring nub::object::real_typename | ( | ) | const |
Returns the typename of the full object.
The result is a demangled version of typeid(*this)
.name(), which should very closely resemble the way the object was declared in source code.
Definition at line 67 of file object.cc.
References rutz::demangled_name().
Referenced by obj_typename().
rutz::fstring nub::object::unique_name | ( | ) | const |
Returns a short string describing the object by its typename and id.
Definition at line 79 of file object.cc.
References obj_typename(), and rutz::sfmt().
Referenced by nub::logging::add_obj_scope(), and nub::logging::remove_obj_scope().