Ipopt Documentation  
 
Loading...
Searching...
No Matches
Ipopt::Subject Class Reference

Slight Variation of the Observer Design Pattern (Subject part). More...

#include <IpObserver.hpp>

+ Inheritance diagram for Ipopt::Subject:

Public Member Functions

Constructors/Destructors
 Subject ()
 Default Constructor.
 
virtual ~Subject ()
 Destructor.
 
Methods to Add and Remove Observers.

Currently, the notify_type flags are not used, and Observers are attached in general and will receive 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 receiving notifications).
 
void DetachObserver (Observer::NotifyType notify_type, Observer *observer) const
 Detach the specified observer (i.e., no longer receive notifications).
 

Protected Member Functions

void Notify (Observer::NotifyType notify_type) const
 

Private Member Functions

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.

 Subject (const Subject &)
 Copy Constructor.
 
void operator= (const Subject &)
 Default Assignment Operator.
 

Private Attributes

std::vector< Observer * > observers_
 

Detailed Description

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

Constructor & Destructor Documentation

◆ Subject() [1/2]

Ipopt::Subject::Subject ( )
inline

Default Constructor.

Definition at line 159 of file IpObserver.hpp.

◆ ~Subject()

Ipopt::Subject::~Subject ( )
inlinevirtual

Destructor.

Definition at line 343 of file IpObserver.hpp.

◆ Subject() [2/2]

Ipopt::Subject::Subject ( const Subject )
private

Copy Constructor.

Member Function Documentation

◆ AttachObserver()

void Ipopt::Subject::AttachObserver ( Observer::NotifyType  notify_type,
Observer observer 
) const
inline

Attach the specified observer (i.e., begin receiving notifications).

Definition at line 356 of file IpObserver.hpp.

◆ DetachObserver()

void Ipopt::Subject::DetachObserver ( Observer::NotifyType  notify_type,
Observer observer 
) const
inline

Detach the specified observer (i.e., no longer receive notifications).

Definition at line 379 of file IpObserver.hpp.

◆ Notify()

void Ipopt::Subject::Notify ( Observer::NotifyType  notify_type) const
inlineprotected

Definition at line 406 of file IpObserver.hpp.

◆ operator=()

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

Default Assignment Operator.

Member Data Documentation

◆ observers_

std::vector<Observer*> Ipopt::Subject::observers_
mutableprivate

Definition at line 226 of file IpObserver.hpp.


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