Katabatic - Routing Toolbox


List of all members | Public Member Functions
Observable Class Reference

Observer Design Pattern, Subject part. More...

Public Member Functions

 Observable ()
 
template<typename T >
T * getObserver ()
 
void addObserver (BaseObserver *)
 
void removeObserver (BaseObserver *)
 
void notify (unsigned int flags)
 

Detailed Description

Observer Design Pattern, Subject part.

Observable is the implementation of the subject part of the Observer design pattern. For the time beeing it's a simplificated version that allows only one Observer to watch the subject.

Observable is designed to be an attribute of the subject, not one of it's base class.

This implantation is completly generic and has nothing specific to Katabatic. It may be moved sometimes in Hurricane at Property level in Hurricane::DBo.

Note to Myself: Observer pattern is the one behind signal/slots.

Constructor & Destructor Documentation

Observable ( )
inline

Default and only constructor. The copy constructor is disabled (made private and unimplemented).

Member Function Documentation

T * getObserver ( )
inline

Returns: The (only) observer, NULL if there is none. It is the object of which the Observer is an attribute, that is, it's owner, and not the Observer itself which is returned.

void addObserver ( BaseObserver observer)
inline

Adds an observer. If more than one is added, throw an error.

void removeObserver ( BaseObserver observer)
inline

Removes an observer. If the observer do not belong to this observable, throw an exception.

void notify ( unsigned int  flags)
inline

Used by the subject to signal a change in it's state to the observers. The flags parameter can be used to indicates what kind of change is occuring. Values for flags are defined between the subject and the observers.

References BaseObserver::notify().

Referenced by AutoSegment::_invalidate(), AutoSegment::_postCreate(), AutoSegment::_preDestroy(), and AutoSegment::revalidate().


The documentation for this class was generated from the following files:


Generated by doxygen 1.8.5 on Mon Oct 1 2018 Return to top of page
Katabatic - Routing Toolbox Copyright © 2008-2016 UPMC. All rights reserved