nub::objectdb Class Reference
#include <nub/objdb.h>
List of all members.
Classes |
class | casting_iterator |
| A filtering iterator class; only exposes objects matching a given type. More...
|
class | impl |
Public Types |
typedef rutz::fwd_iter< object
*const > | iterator |
Public Member Functions |
virtual | ~objectdb () |
| Virtual destructor.
|
iterator | objects () const |
int | count () const throw () |
| Returns the number of valid objects in the database.
|
bool | is_valid_uid (nub::uid id) const throw () |
| Returns true if 'id' is a valid uid.
|
void | remove (nub::uid id) |
| Releases the object specified by id, but only if it is unshared.
|
void | release (nub::uid id) |
| Removes reference to the object with uid id.
|
void | purge () |
| Releases all unshared objects held in the database.
|
void | clear () |
| Calls purge() repeatedly until no more items can be removed.
|
void | clear_on_exit () |
| WARNING: should only be called during program exit.
|
nub::object * | get_checked_obj (nub::uid id) throw (nub::invalid_uid_error) |
| Return the nub::object* with the uid given by id.
|
void | insert_obj (nub::object *obj) |
| Insert a strong reference to obj into the database.
|
void | insert_obj_weak (nub::object *obj) |
| Insert a weak reference to obj into the database.
|
Static Public Member Functions |
static objectdb & | instance () |
| Returns the singleton instance of objectdb.
|
Protected Member Functions |
| objectdb () |
| Default constructor makes an empty list.
|
Detailed Description
objectdb is a database for storing nub::object objects, which can be accessed by their nub::uid values. Most clients will not need to use the objectdb directly, but can instead use the nub::ref and nub::soft_ref smart pointers.
Definition at line 81 of file objdb.h.
Constructor & Destructor Documentation
nub::objectdb::objectdb |
( |
|
) |
[protected] |
Default constructor makes an empty list.
Definition at line 310 of file objdb.cc.
nub::objectdb::~objectdb |
( |
|
) |
[virtual] |
Virtual destructor.
Definition at line 316 of file objdb.cc.
Member Function Documentation
void nub::objectdb::clear |
( |
|
) |
|
Calls purge()
repeatedly until no more items can be removed.
This will get rid of items that were only referenced by other items in the list.
Definition at line 354 of file objdb.cc.
void nub::objectdb::clear_on_exit |
( |
|
) |
|
WARNING: should only be called during program exit.
Does a full clear of all objects held by the objectdb. This breaks the usual semantics of objectdb, since it removes both shared and unshared objects.
Definition at line 362 of file objdb.cc.
int nub::objectdb::count |
( |
|
) |
const throw () |
Returns the number of valid objects in the database.
Definition at line 322 of file objdb.cc.
Insert a strong reference to obj into the database.
Definition at line 374 of file objdb.cc.
void nub::objectdb::insert_obj_weak |
( |
nub::object * |
obj |
) |
|
Insert a weak reference to obj into the database.
Definition at line 380 of file objdb.cc.
Returns the singleton instance of objectdb.
Definition at line 292 of file objdb.cc.
bool nub::objectdb::is_valid_uid |
( |
nub::uid |
id |
) |
const throw () |
Returns true if 'id' is a valid uid.
Definition at line 329 of file objdb.cc.
void nub::objectdb::purge |
( |
|
) |
|
Releases all unshared objects held in the database.
Since the objects are unshared, they will be destroyed in the process.
Definition at line 347 of file objdb.cc.
void nub::objectdb::release |
( |
nub::uid |
id |
) |
|
Removes reference to the object with uid id.
Definition at line 341 of file objdb.cc.
void nub::objectdb::remove |
( |
nub::uid |
id |
) |
|
Releases the object specified by id, but only if it is unshared.
This causes the object to be destroyed since it was unshared. If the object is shared, this operation throws an exception.
Definition at line 335 of file objdb.cc.
The documentation for this class was generated from the following files: