cgma
|
#include <CubitObserver.hpp>
Public Member Functions | |
CubitObserver () | |
virtual | ~CubitObserver () |
CubitStatus | watch_observable (CubitObservable *observable) |
CubitStatus | stop_watching_observable (CubitObservable *observable) |
virtual void | notify_observer (const CubitEvent *observer_event)=0 |
CubitStatus | register_observable (CubitObservable *observable) |
CubitStatus | unregister_observable (CubitObservable *observable) |
Static Public Member Functions | |
static CubitStatus | register_observer (CubitObserver *obs) |
register observer with the global CubitEventDispatcher | |
static CubitStatus | unregister_observer (CubitObserver *obs) |
unregister observer with the global CubitEventDispatcher | |
Private Attributes | |
int | observableCount |
Definition at line 16 of file CubitObserver.hpp.
Definition at line 6 of file CubitObserver.cpp.
{ observableCount = 0; }
CubitObserver::~CubitObserver | ( | ) | [virtual] |
Definition at line 11 of file CubitObserver.cpp.
{ assert(observableCount == 0); }
virtual void CubitObserver::notify_observer | ( | const CubitEvent * | observer_event | ) | [pure virtual] |
Implemented in RefEntityFactory, RefGroup, CAActuateSet, and GeomDataObserver.
CubitStatus CubitObserver::register_observable | ( | CubitObservable * | observable | ) |
Definition at line 16 of file CubitObserver.cpp.
{ if (observable == NULL) return CUBIT_FAILURE; //- add this observer to the observable's list, and if successful, //- increment the observable count CubitStatus success = observable->add_observer(this); if (success == CUBIT_SUCCESS) observableCount++; return success; }
CubitStatus CubitObserver::register_observer | ( | CubitObserver * | obs | ) | [static] |
register observer with the global CubitEventDispatcher
Definition at line 50 of file CubitObserver.cpp.
{ AppUtil::instance()->event_dispatcher().add_observer(obs); return CUBIT_SUCCESS; }
CubitStatus CubitObserver::stop_watching_observable | ( | CubitObservable * | observable | ) | [inline] |
Definition at line 29 of file CubitObserver.hpp.
{ return unregister_observable(observable); }
CubitStatus CubitObserver::unregister_observable | ( | CubitObservable * | observable | ) |
Definition at line 31 of file CubitObserver.cpp.
{ if (observable == NULL) return CUBIT_FAILURE; //- remove this observer from the observable's list, and if successful, //- decrement the observable count CubitStatus success = CUBIT_SUCCESS; //- only call the remove function on the observable if we're not being called //- from the observable success = observable->remove_observer(this); if (success == CUBIT_SUCCESS) observableCount--; return success; }
CubitStatus CubitObserver::unregister_observer | ( | CubitObserver * | obs | ) | [static] |
unregister observer with the global CubitEventDispatcher
Definition at line 56 of file CubitObserver.cpp.
{ AppUtil::instance()->event_dispatcher().remove_observer(obs); return CUBIT_SUCCESS; }
CubitStatus CubitObserver::watch_observable | ( | CubitObservable * | observable | ) | [inline] |
Definition at line 24 of file CubitObserver.hpp.
{ return register_observable(observable); }
int CubitObserver::observableCount [private] |
Definition at line 58 of file CubitObserver.hpp.