Ipopt Documentation  
 
Loading...
Searching...
No Matches
Ipopt::Observer Class Referenceabstract

Slight Variation of the Observer Design Pattern. More...

#include <IpObserver.hpp>

+ Inheritance diagram for Ipopt::Observer:

Public Types

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 ()
 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 ReceiveNotification (NotifyType notify_type, const Subject *subject)=0
 Derived classes should overload this method to receive the requested notification from attached Subjects.
 

Private Member Functions

void ProcessNotification (NotifyType notify_type, const Subject *subject)
 Private Method for Receiving 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 &)
 Default Assignment Operator.
 

Private Attributes

std::vector< const Subject * > subjects_
 A list of the subjects currently being observed.
 

Friends

class Subject
 

Detailed Description

Slight Variation of the Observer Design Pattern.

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 receive notifications from a Subject should inherit off of Observer and overload the protected method, ReceiveNotification_(...).

Definition at line 38 of file IpObserver.hpp.

Member Enumeration Documentation

◆ NotifyType

Enumeration specifying the type of notification.

Enumerator
NT_All 
NT_BeingDestroyed 
NT_Changed 

Definition at line 57 of file IpObserver.hpp.

Constructor & Destructor Documentation

◆ Observer() [1/2]

Ipopt::Observer::Observer ( )
inline

Default Constructor.

Definition at line 48 of file IpObserver.hpp.

◆ ~Observer()

Ipopt::Observer::~Observer ( )
inlinevirtual

Destructor.

Definition at line 230 of file IpObserver.hpp.

◆ Observer() [2/2]

Ipopt::Observer::Observer ( const Observer )
private

Copy Constructor.

Member Function Documentation

◆ RequestAttach()

void Ipopt::Observer::RequestAttach ( NotifyType  notify_type,
const Subject subject 
)
inlineprotected

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 254 of file IpObserver.hpp.

◆ RequestDetach()

void Ipopt::Observer::RequestDetach ( NotifyType  notify_type,
const Subject subject 
)
inlineprotected

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 276 of file IpObserver.hpp.

◆ ReceiveNotification()

virtual void Ipopt::Observer::ReceiveNotification ( NotifyType  notify_type,
const Subject subject 
)
protectedpure virtual

Derived classes should overload this method to receive the requested notification from attached Subjects.

Implemented in Ipopt::DependentResult< T >.

◆ operator=()

void Ipopt::Observer::operator= ( const Observer )
private

Default Assignment Operator.

◆ ProcessNotification()

void Ipopt::Observer::ProcessNotification ( NotifyType  notify_type,
const Subject subject 
)
inlineprivate

Private Method for Receiving Notification should only be called by the friend class Subject.

This method will, in turn, call the overloaded ReceiveNotification method for the derived class to process.

Definition at line 311 of file IpObserver.hpp.

Friends And Related Symbol Documentation

◆ Subject

Definition at line 137 of file IpObserver.hpp.

Member Data Documentation

◆ subjects_

std::vector<const Subject*> Ipopt::Observer::subjects_
private

A list of the subjects currently being observed.

Definition at line 121 of file IpObserver.hpp.


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