9#ifndef __IPOBSERVER_HPP__
10#define __IPOBSERVER_HPP__
17#if COIN_IPOPT_CHECKLEVEL > 2
18# define IP_DEBUG_OBSERVER
20#ifdef IP_DEBUG_OBSERVER
42#ifdef IP_DEBUG_OBSERVER
44 static const Index dbg_verbosity;
132#ifdef IP_DEBUG_OBSERVER
134 static const Index dbg_verbosity;
200#ifdef IP_DEBUG_OBSERVER
210#ifdef IP_DEBUG_OBSERVER
221#ifdef IP_DEBUG_OBSERVER
225 std::vector<const Subject*>::iterator attached_subject;
240#ifdef IP_DEBUG_OBSERVER
242 DBG_PRINT((1,
"Requesting detach of subject: 0x%x\n", subject));
247 std::vector<const Subject*>::iterator attached_subject;
249#ifdef IP_DEBUG_OBSERVER
254 if (attached_subject !=
subjects_.end()) {
255#ifdef IP_DEBUG_OBSERVER
256 DBG_PRINT((1,
"Removing subject: 0x%x from the list\n", subject));
270#ifdef IP_DEBUG_OBSERVER
276 std::vector<const Subject*>::iterator attached_subject;
281#ifdef IP_DEBUG_OBSERVER
298#ifdef IP_DEBUG_OBSERVER
302 std::vector<Observer*>::iterator iter;
311#ifdef IP_DEBUG_OBSERVER
318 std::vector<Observer*>::iterator attached_observer;
331#ifdef IP_DEBUG_OBSERVER
337 std::vector<Observer*>::iterator attached_observer;
339#ifdef IP_DEBUG_OBSERVER
353#ifdef IP_DEBUG_OBSERVER
357 std::vector<Observer*>::iterator iter;
359 (*iter)->ProcessNotification(notify_type,
this);
#define DBG_PRINT(__printf_args)
#define DBG_START_METH(__func_name, __verbose_level)
Slight Variation of the Observer Design Pattern.
void ProcessNotification(NotifyType notify_type, const Subject *subject)
Private Method for Recieving Notification should only be called by the friend class Subject.
virtual void RecieveNotification(NotifyType notify_type, const Subject *subject)=0
Derived classes should overload this method to recieve the requested notification from attached Subje...
virtual ~Observer()
Default destructor.
void RequestDetach(NotifyType notify_type, const Subject *subject)
Derived classes should call this method to request a "Detach" to a Subject.
void operator=(const Observer &)
Overloaded Equals Operator.
NotifyType
Enumeration specifying the type of notification.
std::vector< const Subject * > subjects_
A list of the subjects currently being observed.
Observer()
Default Constructor.
void RequestAttach(NotifyType notify_type, const Subject *subject)
Derived classes should call this method to request an "Attach" to a Subject.
Observer(const Observer &)
Copy Constructor.
Slight Variation of the Observer Design Pattern (Subject part).
void Notify(Observer::NotifyType notify_type) const
Subject(const Subject &)
Copy Constructor.
Subject()
Default Constructor.
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).
virtual ~Subject()
Default destructor.
std::vector< Observer * > observers_
void operator=(const Subject &)
Overloaded Equals Operator.
int Int
Type of default integer.
int Index
Type of all indices of vectors, matrices etc.