Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

nub::objectdb Class Reference

#include <nub/objdb.h>

Collaboration diagram for nub::objectdb:

Collaboration graph
[legend]
List of all members.

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.

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::objectget_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 objectdbinstance ()
 Returns the singleton instance of objectdb.

Protected Member Functions

 objectdb ()
 Default constructor makes an empty list.

Classes

class  casting_iterator
 A filtering iterator class; only exposes objects matching a given type. More...
class  impl


Constructor & Destructor Documentation

nub::objectdb::objectdb  )  [protected]
 

Default constructor makes an empty list.

Definition at line 310 of file objdb.cc.

References GVX_TRACE.

nub::objectdb::~objectdb  )  [virtual]
 

Virtual destructor.

Definition at line 316 of file objdb.cc.

References GVX_TRACE.


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.

References GVX_TRACE, and nub::objectdb::impl::purge().

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.

References nub::objectdb::impl::clear_all(), and GVX_TRACE.

int nub::objectdb::count  )  const throw ()
 

Returns the number of valid objects in the database.

Definition at line 322 of file objdb.cc.

References nub::objectdb::impl::count(), and GVX_TRACE.

nub::object * nub::objectdb::get_checked_obj nub::uid  id  )  throw (nub::invalid_uid_error)
 

Return the nub::object* with the uid given by id.

Checks first if id is a valid uid, and throws an nub::invalid_uid_error if it is not.

Definition at line 368 of file objdb.cc.

References GVX_TRACE.

Referenced by nub::detail::get_checked_item().

void nub::objectdb::insert_obj nub::object obj  ) 
 

Insert a strong reference to obj into the database.

Definition at line 374 of file objdb.cc.

References GVX_TRACE, and nub::objectdb::impl::insert_obj().

Referenced by nub::detail::insert_item().

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.

References GVX_TRACE, and nub::objectdb::impl::insert_obj().

Referenced by nub::detail::insert_item().

nub::objectdb & nub::objectdb::instance  )  [static]
 

Returns the singleton instance of objectdb.

Definition at line 292 of file objdb.cc.

Referenced by count_all(), dbClear(), dbClearOnExit(), dbPurge(), dbRelease(), find_all(), nub::detail::get_checked_item(), nub::detail::insert_item(), nub::detail::is_valid_uid(), objDelete(), and remove_all().

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.

References GVX_TRACE.

Referenced by nub::detail::is_valid_uid().

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.

References dbg_eval_nl, GVX_TRACE, and nub::objectdb::impl::purge().

void nub::objectdb::release nub::uid  id  ) 
 

Removes reference to the object with uid id.

Definition at line 341 of file objdb.cc.

References GVX_TRACE, and nub::objectdb::impl::release().

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.

References GVX_TRACE, and nub::objectdb::impl::remove().

Referenced by remove_all().


The documentation for this class was generated from the following files:
Generated on Sun Nov 22 13:51:38 2009 for iLab Neuromorphic Vision Toolkit by  doxygen 1.4.4