7 #ifndef __IPOBSERVER_HPP__ 8 #define __IPOBSERVER_HPP__ 15 #if IPOPT_CHECKLEVEL > 2 16 # define IP_DEBUG_OBSERVER 18 #ifdef IP_DEBUG_OBSERVER 41 #ifdef IP_DEBUG_OBSERVER 42 static const Index dbg_verbosity;
73 NotifyType notify_type,
85 NotifyType notify_type,
93 virtual void ReceiveNotification(
94 NotifyType notify_type,
132 void ProcessNotification(
152 #ifdef IP_DEBUG_OBSERVER 153 static const Index dbg_verbosity;
232 #ifdef IP_DEBUG_OBSERVER 245 #ifdef IP_DEBUG_OBSERVER 259 #ifdef IP_DEBUG_OBSERVER 263 std::vector<const Subject*>::iterator attached_subject;
281 #ifdef IP_DEBUG_OBSERVER 283 DBG_PRINT((1,
"Requesting detach of subject: 0x%x\n", subject));
289 std::vector<const Subject*>::iterator attached_subject;
291 #ifdef IP_DEBUG_OBSERVER 296 if( attached_subject !=
subjects_.end() )
298 #ifdef IP_DEBUG_OBSERVER 299 DBG_PRINT((1,
"Removing subject: 0x%x from the list\n", subject));
316 #ifdef IP_DEBUG_OBSERVER 323 std::vector<const Subject*>::iterator attached_subject;
328 #ifdef IP_DEBUG_OBSERVER 345 #ifdef IP_DEBUG_OBSERVER 349 std::vector<Observer*>::iterator iter;
362 #ifdef IP_DEBUG_OBSERVER 369 std::vector<Observer*>::iterator attached_observer;
385 #ifdef IP_DEBUG_OBSERVER 392 std::vector<Observer*>::iterator attached_observer;
394 #ifdef IP_DEBUG_OBSERVER 411 #ifdef IP_DEBUG_OBSERVER 415 std::vector<Observer*>::iterator iter;
418 (*iter)->ProcessNotification(notify_type,
this);
std::vector< Observer * > observers_
NotifyType
Enumeration specifying the type of notification.
int Int
Type of default integer.
#define DBG_START_METH(__func_name, __verbose_level)
void RequestAttach(NotifyType notify_type, const Subject *subject)
Derived classes should call this method to request an "Attach" to a Subject.
virtual ~Observer()
Destructor.
virtual ~Subject()
Destructor.
Slight Variation of the Observer Design Pattern (Subject part).
void Notify(Observer::NotifyType notify_type) const
This file contains a base class for all exceptions and a set of macros to help with exceptions...
Slight Variation of the Observer Design Pattern.
void AttachObserver(Observer::NotifyType notify_type, Observer *observer) const
Attach the specified observer (i.e., begin receiving notifications).
Subject()
Default Constructor.
void ProcessNotification(NotifyType notify_type, const Subject *subject)
Private Method for Receiving Notification should only be called by the friend class Subject...
virtual void ReceiveNotification(NotifyType notify_type, const Subject *subject)=0
Derived classes should overload this method to receive the requested notification from attached Subje...
int Index
Type of all indices of vectors, matrices etc.
Observer()
Default Constructor.
#define DBG_PRINT(__printf_args)
void RequestDetach(NotifyType notify_type, const Subject *subject)
Derived classes should call this method to request a "Detach" to a Subject.
std::vector< const Subject * > subjects_
A list of the subjects currently being observed.
void DetachObserver(Observer::NotifyType notify_type, Observer *observer) const
Detach the specified observer (i.e., no longer receive notifications).