ircproxy The Ultimate Cyborg |
#include <Watched.h>
Definition at line 74 of file Watched.h.
Public Member Functions | |
Watched (char const *name) | |
Construct a Watched instance with debug name name. | |
Watched (char const *name, T const &value) | |
Construct a Watched instance with debug name name and value value. | |
Watched (Watched const &b) | |
Copy constructor. | |
~Watched () | |
Destructor. | |
void | print_name (std::ostream &os) const |
Print M_name to os for debugging purposes. | |
void | add_event_server (boost::shared_ptr< ExpressionEventServer > const &event_server) |
Add an event server to the event notification list. | |
void | sub_event_server (ExpressionEventServer *event_server) |
Remove an event server from the event notification list. | |
template<typename T2> | |
Watched & | operator= (T2 const &b) |
Templated assignment operator. | |
Watched & | operator= (Watched const &b) |
Assignment operator. | |
template<typename T2> | |
Watched & | operator &= (T2 const &b) |
Templated bitwise AND assignment operator. | |
Watched & | operator &= (Watched const &b) |
Bitwise AND assignment operator. | |
template<typename T2> | |
Watched & | operator|= (T2 const &b) |
Templated bitwise OR assignment operator. | |
Watched & | operator|= (Watched const &b) |
Bitwise OR assignment operator. | |
template<typename T2> | |
Watched & | operator^= (T2 const &b) |
Templated bitwise XOR assignment operator. | |
Watched & | operator^= (Watched const &b) |
Bitwise XOR assignment operator. | |
T | operator~ (void) |
Bitwise NOT operator. | |
WatchedExpression< T > | operator* (void) |
Dereference operator. Returns the Watched variable as Expression type. | |
T const & | value (void) const |
Return underlying value. | |
operator T const & () | |
Cast operator. Return underlying value. | |
Private Member Functions | |
void | changed_to (T const &b) |
Inform listening Expression event servers that this variable changed value. | |
Private Attributes | |
T | M_value |
The underlying value. | |
bool | M_being_destructed |
Set when this object is being destructed. | |
std::set< boost::shared_ptr < ExpressionEventServer > > | M_event_servers |
The event servers that watch expressions depending on this variable. | |
char const * | M_name |
A name for this object, for debugging purposes. |
Copy constructor.
Definition at line 95 of file Watched.h.
00095 : M_value(b.M_value), M_being_destructed(false) 00096 { 00097 #ifdef CWDEBUG 00098 if (!b.M_event_servers.empty()) 00099 Dout(dc::warning, "Copy-constructing a Watched<" << 00100 type_info_of<T>().demangled_name() << "> that is being used by one or more ExpressionEventServer's"); 00101 #endif 00102 }
Destructor.
Destructor. Inform listening Expression event servers that this variable is no longer watched.
Definition at line 305 of file Watched.h.
References Watched< T >::M_being_destructed, and Watched< T >::M_event_servers.
00306 { 00307 M_being_destructed = true; 00308 for (std::set<boost::shared_ptr<ExpressionEventServer> >::iterator iter = M_event_servers.begin(); iter != M_event_servers.end();) 00309 (*iter++)->bool_destructed(); 00310 }
void Watched< T >::print_name | ( | std::ostream & | os | ) | const [inline] |
void Watched< T >::add_event_server | ( | boost::shared_ptr< ExpressionEventServer > const & | event_server | ) | [inline] |
Add an event server to the event notification list.
Definition at line 112 of file Watched.h.
00113 { 00114 M_event_servers.insert(event_server); 00115 }
void Watched< T >::sub_event_server | ( | ExpressionEventServer * | event_server | ) | [inline] |
Remove an event server from the event notification list.
Definition at line 118 of file Watched.h.
00119 { 00120 if (M_being_destructed) 00121 return; 00122 std::set<boost::shared_ptr<ExpressionEventServer> >::iterator iter = M_event_servers.begin(); 00123 while (iter != M_event_servers.end()) 00124 { 00125 if ((*iter).get() == event_server) 00126 break; 00127 ++iter; 00128 } 00129 ASSERT(iter != M_event_servers.end()); 00130 M_event_servers.erase(iter); 00131 }
Assignment operator.
Definition at line 145 of file Watched.h.
00146 { 00147 if (M_value != b.M_value) 00148 changed_to(b.M_value); 00149 return *this; 00150 }
T Watched< T >::operator~ | ( | void | ) | [inline] |
WatchedExpression<T> Watched< T >::operator* | ( | void | ) | [inline] |
Dereference operator. Returns the Watched variable as Expression type.
Definition at line 219 of file Watched.h.
00219 { return WatchedExpression<T>(*this); }
T const& Watched< T >::value | ( | void | ) | const [inline] |
Return underlying value.
Definition at line 222 of file Watched.h.
Referenced by AuthState::auth_ping_argument(), operator &(), operator!=(), operator==(), operator>(), operator>=(), operator^(), and operator|().
00222 { return M_value; }
Watched< T >::operator T const & | ( | ) | [inline] |
void Watched< T >::changed_to | ( | T const & | b | ) | [inline, private] |
Inform listening Expression event servers that this variable changed value.
Definition at line 294 of file Watched.h.
References Watched< T >::M_event_servers, and Watched< T >::M_value.
Referenced by Watched< UserModeMask >::operator &=(), Watched< UserModeMask >::operator=(), Watched< UserModeMask >::operator^=(), and Watched< UserModeMask >::operator|=().
00295 { 00296 M_value = b; 00297 std::set<boost::shared_ptr<ExpressionEventServer> >::iterator iter = M_event_servers.begin(); 00298 // The call to bool_changed can remove iter from the set<>. Therefore increment iter before calling bool_changed. 00299 while (iter != M_event_servers.end()) 00300 (*iter++)->bool_changed(); 00301 }
The underlying value.
Definition at line 76 of file Watched.h.
Referenced by Watched< T >::changed_to(), Watched< UserModeMask >::operator &=(), Watched< UserModeMask >::operator UserModeMaskconst &(), Watched< UserModeMask >::operator=(), Watched< UserModeMask >::operator^=(), Watched< UserModeMask >::operator|=(), Watched< UserModeMask >::operator~(), and Watched< UserModeMask >::value().
bool Watched< T >::M_being_destructed [private] |
Set when this object is being destructed.
Definition at line 77 of file Watched.h.
Referenced by Watched< UserModeMask >::sub_event_server(), and Watched< T >::~Watched().
std::set<boost::shared_ptr<ExpressionEventServer> > Watched< T >::M_event_servers [private] |
The event servers that watch expressions depending on this variable.
Definition at line 78 of file Watched.h.
Referenced by Watched< UserModeMask >::add_event_server(), Watched< T >::changed_to(), Watched< UserModeMask >::sub_event_server(), and Watched< T >::~Watched().
Copyright © 2005-2007 Carlo Wood. All rights reserved. |
---|