Slight Variation of the Observer Design Pattern (Subject part). More...
#include <IpObserver.hpp>
Public Member Functions | |
Constructors/Destructors | |
Subject () | |
Default Constructor. | |
virtual | ~Subject () |
Default destructor. | |
Methods to Add and Remove Observers. | |
Currently, the notify_type flags are not used, and Observers are attached in general and will recieve all notifications (of the type requested and possibly of types not requested). It is up to the observer to ignore the types they are not interested in. The NotifyType in the parameter list is so a more efficient mechanism depending on type could be implemented later if necessary. | |
void | AttachObserver (Observer::NotifyType notify_type, Observer *observer) const |
Attach the specified observer (i.e., begin recieving notifications). | |
void | DetachObserver (Observer::NotifyType notify_type, Observer *observer) const |
Detach the specified observer (i.e., no longer recieve notifications). | |
Protected Member Functions | |
void | Notify (Observer::NotifyType notify_type) const |
Private Member Functions | |
Default Compiler Generated Methods | |
Subject (const Subject &) | |
Copy Constructor. | |
void | operator= (const Subject &) |
Overloaded Equals Operator. | |
Private Attributes | |
std::vector< Observer * > | observers_ |
Slight Variation of the Observer Design Pattern (Subject part).
This class implements the Subject class of the Observer Design Pattern. An Observer "Attach"es to a Subject, indicating that it would like to be notified of changes in the Subject. Any derived class that is to be observed has to inherit off the Subject base class. If the subject needs to notify the Observer, it calls the Notify method.
Definition at line 125 of file IpObserver.hpp.
Ipopt::Subject::Subject | ( | ) | [inline] |
Default Constructor.
Definition at line 136 of file IpObserver.hpp.
Ipopt::Subject::~Subject | ( | ) | [inline, virtual] |
Default destructor.
Definition at line 288 of file IpObserver.hpp.
Ipopt::Subject::Subject | ( | const Subject & | ) | [private] |
Copy Constructor.
void Ipopt::Subject::AttachObserver | ( | Observer::NotifyType | notify_type, | |
Observer * | observer | |||
) | const [inline] |
Attach the specified observer (i.e., begin recieving notifications).
Definition at line 301 of file IpObserver.hpp.
void Ipopt::Subject::DetachObserver | ( | Observer::NotifyType | notify_type, | |
Observer * | observer | |||
) | const [inline] |
Detach the specified observer (i.e., no longer recieve notifications).
Definition at line 321 of file IpObserver.hpp.
void Ipopt::Subject::Notify | ( | Observer::NotifyType | notify_type | ) | const [inline, protected] |
Definition at line 343 of file IpObserver.hpp.
void Ipopt::Subject::operator= | ( | const Subject & | ) | [private] |
Overloaded Equals Operator.
Reimplemented in Ipopt::IteratesVector, Ipopt::TaggedObject, Ipopt::CompoundMatrix, Ipopt::CompoundSymMatrix, Ipopt::CompoundVector, Ipopt::DenseGenMatrix, Ipopt::DenseSymMatrix, Ipopt::DenseVector, Ipopt::DiagMatrix, Ipopt::ExpansionMatrix, Ipopt::IdentityMatrix, Ipopt::LowRankUpdateSymMatrix, Ipopt::Matrix, Ipopt::MultiVectorMatrix, Ipopt::ScaledMatrix, Ipopt::SumMatrix, Ipopt::SumSymMatrix, Ipopt::SymScaledMatrix, Ipopt::Vector, Ipopt::ZeroMatrix, Ipopt::GenTMatrix, and Ipopt::SymTMatrix.
std::vector<Observer*> Ipopt::Subject::observers_ [mutable, private] |
Definition at line 184 of file IpObserver.hpp.