#include <IpObserver.hpp>
Inheritance diagram for Ipopt::Observer:
Public Types | |
NT_All | |
NT_BeingDestroyed | |
NT_Changed | |
enum | NotifyType { NT_All, NT_BeingDestroyed, NT_Changed } |
Enumeration specifying the type of notification. More... | |
Public Member Functions | |
Constructors/Destructors | |
Observer () | |
Default Constructor. | |
virtual | ~Observer () |
Default destructor. | |
Protected Member Functions | |
void | RequestAttach (NotifyType notify_type, const Subject *subject) |
Derived classes should call this method to request an "Attach" to a Subject. | |
void | RequestDetach (NotifyType notify_type, const Subject *subject) |
Derived classes should call this method to request a "Detach" to a Subject. | |
virtual void | RecieveNotification (NotifyType notify_type, const Subject *subject)=0 |
Derived classes should overload this method to recieve the requested notification from attached Subjects. | |
Private Member Functions | |
void | ProcessNotification (NotifyType notify_type, const Subject *subject) |
Private Method for Recieving Notification should only be called by the friend class Subject. | |
Default Compiler Generated Methods | |
(Hidden to avoid implicit creation/calling). These methods are not implemented and we do not want the compiler to implement them for us, so we declare them private and do not define them. This ensures that they will not be implicitly created/called. | |
Observer (const Observer &) | |
Copy Constructor. | |
void | operator= (const Observer &) |
Overloaded Equals Operator. | |
Private Attributes | |
std::vector< const Subject * > | subjects_ |
A list of the subjects currently being observed. | |
Friends | |
class | Subject |
This class implements the Observer 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 wishing to recieve notifications from a Subject should inherit off of Observer and overload the protected method, RecieveNotification_(...).
Definition at line 39 of file IpObserver.hpp.
Ipopt::Observer::Observer | ( | ) | [inline] |
Ipopt::Observer::~Observer | ( | ) | [inline, virtual] |
Default destructor.
Definition at line 190 of file IpObserver.hpp.
References DBG_PRINT, DBG_START_METH, DBG_VERBOSITY, NT_All, RequestDetach(), and subjects_.
Ipopt::Observer::Observer | ( | const Observer & | ) | [private] |
Copy Constructor.
void Ipopt::Observer::RequestAttach | ( | NotifyType | notify_type, | |
const Subject * | subject | |||
) | [inline, protected] |
Derived classes should call this method to request an "Attach" to a Subject.
Do not call "Attach" explicitly on the Subject since further processing is done here
Definition at line 211 of file IpObserver.hpp.
References Ipopt::Subject::AttachObserver(), DBG_ASSERT, DBG_START_METH, and subjects_.
Referenced by Ipopt::DependentResult< T >::DependentResult().
void Ipopt::Observer::RequestDetach | ( | NotifyType | notify_type, | |
const Subject * | subject | |||
) | [inline, protected] |
Derived classes should call this method to request a "Detach" to a Subject.
Do not call "Detach" explicitly on the Subject since further processing is done here
Definition at line 230 of file IpObserver.hpp.
References DBG_ASSERT, DBG_PRINT, DBG_START_METH, Ipopt::Subject::DetachObserver(), and subjects_.
Referenced by ~Observer().
virtual void Ipopt::Observer::RecieveNotification | ( | NotifyType | notify_type, | |
const Subject * | subject | |||
) | [protected, pure virtual] |
Derived classes should overload this method to recieve the requested notification from attached Subjects.
Referenced by ProcessNotification().
void Ipopt::Observer::operator= | ( | const Observer & | ) | [private] |
Overloaded Equals Operator.
void Ipopt::Observer::ProcessNotification | ( | NotifyType | notify_type, | |
const Subject * | subject | |||
) | [inline, private] |
Private Method for Recieving Notification should only be called by the friend class Subject.
This method will, in turn, call the overloaded RecieveNotification method for the derived class to process.
Definition at line 260 of file IpObserver.hpp.
References DBG_ASSERT, DBG_START_METH, NT_BeingDestroyed, RecieveNotification(), and subjects_.
friend class Subject [friend] |
Definition at line 114 of file IpObserver.hpp.
std::vector<const Subject*> Ipopt::Observer::subjects_ [private] |
A list of the subjects currently being observed.
Definition at line 104 of file IpObserver.hpp.
Referenced by ProcessNotification(), RequestAttach(), RequestDetach(), and ~Observer().