cgma
CubitObserver Class Reference

#include <CubitObserver.hpp>

Inheritance diagram for CubitObserver:
CAActuateSet GeomDataObserver RefEntityFactory RefGroup

List of all members.

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

Detailed Description

Definition at line 16 of file CubitObserver.hpp.


Constructor & Destructor Documentation

Definition at line 6 of file CubitObserver.cpp.

{
  observableCount = 0;
}

Definition at line 11 of file CubitObserver.cpp.

{
  assert(observableCount == 0);
}

Member Function Documentation

virtual void CubitObserver::notify_observer ( const CubitEvent observer_event) [pure virtual]

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;
}

register observer with the global CubitEventDispatcher

Definition at line 50 of file CubitObserver.cpp.

Definition at line 29 of file CubitObserver.hpp.

    { return unregister_observable(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;
}

unregister observer with the global CubitEventDispatcher

Definition at line 56 of file CubitObserver.cpp.

Definition at line 24 of file CubitObserver.hpp.

    { return register_observable(observable); }

Member Data Documentation

Definition at line 58 of file CubitObserver.hpp.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines