a Code for the Combination of Indirect and Direct Constraints on High Energy Physics Models Logo
BOL::PushingObserved< PushedClass > Class Template Reference

#include <PushingObserved.hpp>

+ Inheritance diagram for BOL::PushingObserved< PushedClass >:

Detailed Description

template<typename PushedClass>
class BOL::PushingObserved< PushedClass >

Definition at line 26 of file PushingObserved.hpp.

Public Member Functions

 PushingObserved ()
 
virtual void registerObserver (PushedToObserver< PushedClass > *const joiningObserver)
 
void removeAllObservers ()
 
virtual void removeObserver (PushedToObserver< PushedClass > *const leavingObserver)
 
virtual void updateObservers ()
 
virtual void updateObservers (PushedClass const &pushedValue)
 
virtual ~PushingObserved ()
 

Protected Types

typedef std::pair< PushedToObserver< PushedClass > *, bool > observerWithBool
 
typedef std::list< observerWithBool >::iterator observerWithBoolListIterator
 

Protected Attributes

observerWithBoolListIterator observerIterator
 
std::list< observerWithBoolobserverList
 

Member Typedef Documentation

◆ observerWithBool

template<typename PushedClass >
typedef std::pair< PushedToObserver< PushedClass >*, bool > BOL::PushingObserved< PushedClass >::observerWithBool
protected

Definition at line 61 of file PushingObserved.hpp.

◆ observerWithBoolListIterator

template<typename PushedClass >
typedef std::list<observerWithBool>::iterator BOL::PushingObserved< PushedClass >::observerWithBoolListIterator
protected

Definition at line 63 of file PushingObserved.hpp.

Constructor & Destructor Documentation

◆ PushingObserved()

template<typename PushedClass >
BOL::PushingObserved< PushedClass >::PushingObserved
inline

Definition at line 74 of file PushingObserved.hpp.

74 :
77 {
78 // just an initialization list.
79 }
std::list< observerWithBool > observerList
observerWithBoolListIterator observerIterator

◆ ~PushingObserved()

template<typename PushedClass >
BOL::PushingObserved< PushedClass >::~PushingObserved
inlinevirtual

Definition at line 83 of file PushingObserved.hpp.

84 {
86 }

Member Function Documentation

◆ registerObserver()

template<typename PushedClass >
void BOL::PushingObserved< PushedClass >::registerObserver ( PushedToObserver< PushedClass > *const  joiningObserver)
inlinevirtual

Definition at line 138 of file PushingObserved.hpp.

140 {
141 observerList.push_back( observerWithBool( joiningObserver,
142 true ) );
143 joiningObserver->acceptFlagFromObserved( &(observerList.back().second) );
144 /* new observers are given a pointer to their associated bools, which
145 * indicate that their observers should be fine for
146 * respondToPush( ... ) calls if the bool is true, but if the bool is
147 * false, this PushingObserved instance knows to remove the observer with
148 * its next pass through the list.
149 */
150 }
std::pair< PushedToObserver< PushedClass > *, bool > observerWithBool

◆ removeAllObservers()

template<typename PushedClass >
void BOL::PushingObserved< PushedClass >::removeAllObservers
inline

Definition at line 179 of file PushingObserved.hpp.

182 {
184 while( observerList.end() != observerIterator )
185 {
186 if( observerIterator->second )
187 {
188 observerIterator->first->discardFlagFromObserved(
189 &(observerIterator->second) );
190 }
192 }
193 observerList.clear();
194 }

◆ removeObserver()

template<typename PushedClass >
void BOL::PushingObserved< PushedClass >::removeObserver ( PushedToObserver< PushedClass > *const  leavingObserver)
inlinevirtual

Definition at line 154 of file PushingObserved.hpp.

156 {
158 while( observerList.end() != observerIterator )
159 {
160 if( !(observerIterator->second) )
161 {
163 }
164 else if( leavingObserver == observerIterator->first )
165 {
166 leavingObserver->discardFlagFromObserved(
167 &(observerIterator->second) );
169 }
170 else
171 {
173 }
174 }
175 }

◆ updateObservers() [1/2]

template<typename PushedClass >
void BOL::PushingObserved< PushedClass >::updateObservers
inlinevirtual

Definition at line 115 of file PushingObserved.hpp.

120 {
122 while( observerList.end() != observerIterator )
123 {
124 if( observerIterator->second )
125 {
126 observerIterator->first->respondToObservedSignal();
128 }
129 else
130 {
132 }
133 }
134 }

◆ updateObservers() [2/2]

template<typename PushedClass >
void BOL::PushingObserved< PushedClass >::updateObservers ( PushedClass const &  pushedValue)
inlinevirtual

Definition at line 91 of file PushingObserved.hpp.

97 {
99 while( observerList.end() != observerIterator )
100 {
101 if( observerIterator->second )
102 {
103 observerIterator->first->respondToPush( pushedValue );
105 }
106 else
107 {
109 }
110 }
111 }

Member Data Documentation

◆ observerIterator

template<typename PushedClass >
observerWithBoolListIterator BOL::PushingObserved< PushedClass >::observerIterator
protected

Definition at line 65 of file PushingObserved.hpp.

◆ observerList

template<typename PushedClass >
std::list< observerWithBool > BOL::PushingObserved< PushedClass >::observerList
protected

Definition at line 64 of file PushingObserved.hpp.


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