Overview     Modules     Class Hierarchy     Classes     Members  

OLOObject is the base class of the Observable/Listener/Observer object hierachy. It manages storage of a unique id for these objects as well as the storage of relations between them. It also manages destruction of these objects. More...

#include <Observable.h>

Inheritance diagram for tlp::OLOObject:

Public Member Functions

tlp::node getNode () const
 return the node representing that OLOObject in the OLOGraph
unsigned int getSent () const
 return the number of sent nofication
unsigned int getReceived () const
 return the number of received nofication

Static Public Member Functions

static OLOObjectgetObject (tlp::node n)
static bool isAlive (tlp::node n)
 Enables to test if the object represented by a node has been deleted. Outside a unhold/hold block or an update that function always return true.
static const tlp::VectorGraphgetOLOGraph ()
 Return a reference on the Observable/Listener/Observer graph.

Protected Types

enum  OLOEDGETYPE { OBSERVABLE = 0x01, OBSERVER = 0x02, LISTENER = 0x04 }

Protected Member Functions

 OLOObject ()
 OLOObject (const OLOObject &)
virtual ~OLOObject ()
OLOObjectoperator= (const OLOObject &)
tlp::Iterator< tlp::node > * getInObjects () const
 return an iterator on in objects (Observable), the iterator guarantee that all objects are alive (not deleted during hold or notify)
tlp::Iterator< tlp::node > * getOutObjects () const
 return an iterator on out objects (Listener/Observer), the iterator garantee that all objects are alive (not deleted during hold or notify)

Friends

class Observable

Detailed Description

OLOObject is the base class of the Observable/Listener/Observer object hierachy. It manages storage of a unique id for these objects as well as the storage of relations between them. It also manages destruction of these objects.

Each Observable/listener/Observer is stored in a VectorGraph object as a node. An edge in that graph represents a connection between an Observable and a Listener/Observer. OLOObject enables to manage the creation/destruction of node when a Observable/Listener/Observer is created/deleted. OLOObject also enables to guarantee the coherency of relations between Observable and Listener/Observer.

OLOObject provides functions to access to the graph of OLOObjects as well as the state of elements in that graph. Using these functions can ease debugging of complex Observable/Listener/Observer systems.

Warning
Due to the possibility to delay event sending, it is possible that nodes or edges in the graph don't represent the connections and objects that the user expect. Indeed, node deletion, edge creation and edge deletion are delayed until the Obserable::notify or Obserable::unholdObserver function terminate. Only node creation is not delayed.
See Also
Listener
Observer
Observable

Member Enumeration Documentation

Enumerator:
OBSERVABLE 
OBSERVER 
LISTENER 

Constructor & Destructor Documentation

tlp::OLOObject::OLOObject ( )
protected
tlp::OLOObject::OLOObject ( const OLOObject )
protected
virtual tlp::OLOObject::~OLOObject ( )
protectedvirtual

Member Function Documentation

tlp::Iterator<tlp::node>* tlp::OLOObject::getInObjects ( ) const
protected

return an iterator on in objects (Observable), the iterator guarantee that all objects are alive (not deleted during hold or notify)

tlp::node tlp::OLOObject::getNode ( ) const

return the node representing that OLOObject in the OLOGraph

static OLOObject* tlp::OLOObject::getObject ( tlp::node  n)
static

return a pointer on the object represented by that node

Warning
If you call that function during an update, it is possible that the pointer do not point on an existing object, use the isAlive function before to test if your object still valid
static const tlp::VectorGraph& tlp::OLOObject::getOLOGraph ( )
static

Return a reference on the Observable/Listener/Observer graph.

tlp::Iterator<tlp::node>* tlp::OLOObject::getOutObjects ( ) const
protected

return an iterator on out objects (Listener/Observer), the iterator garantee that all objects are alive (not deleted during hold or notify)

unsigned int tlp::OLOObject::getReceived ( ) const

return the number of received nofication

unsigned int tlp::OLOObject::getSent ( ) const

return the number of sent nofication

static bool tlp::OLOObject::isAlive ( tlp::node  n)
static

Enables to test if the object represented by a node has been deleted. Outside a unhold/hold block or an update that function always return true.

OLOObject& tlp::OLOObject::operator= ( const OLOObject )
protected

Friends And Related Function Documentation

friend class Observable
friend


Tulip Software by LaBRI Visualization Team    2001 - 2012