ircproxy  The Ultimate Cyborg

WatchedExpression< T > Class Template Reference

#include <Watched.h>

Inheritance diagram for WatchedExpression< T >:

ExpressionInterface

List of all members.


Detailed Description

template<typename T>
class WatchedExpression< T >

An expression consisting of a single Watched object.

Definition at line 32 of file Watched.h.


Public Types

typedef T const & evaluation_type
 The type that the expression evaluates to.

Public Member Functions

 WatchedExpression (Watched< T > &b)
 Construct a WatchedExpression for Watched object b.
ExpressionEventServercreate_event_server (void)
 Create and return an event server that is watching this expression.
T const & evaluate_impl (void) const
 Return the value of the underlying type.
void sub_event_server_impl (ExpressionEventServer *)
 Remove event server event_server from the notification list.
virtual void add_event_server (boost::shared_ptr< ExpressionEventServer > const &event_server)
 Add Expression event server event_server to the notification list.
virtual bool evaluate (void)
 Implement pure virtual ExpressionInterface::evaluate.
virtual void sub_event_server (ExpressionEventServer *event_server)
 Implementation of pure virtual function ExpressionInterface::sub_event_server.
virtual void print_on (std::ostream &os) const
 For debugging purpose; write the (debug) name of this object to os.

Private Attributes

Watched< T > & M_b
 A reference to the watched object.

Member Typedef Documentation

template<typename T>
typedef T const& WatchedExpression< T >::evaluation_type

The type that the expression evaluates to.

Definition at line 34 of file Watched.h.


Constructor & Destructor Documentation

template<typename T>
WatchedExpression< T >::WatchedExpression ( Watched< T > &  b  )  [inline]

Construct a WatchedExpression for Watched object b.

Definition at line 41 of file Watched.h.

Referenced by WatchedExpression< T >::create_event_server().

00041 : M_b(b) { }


Member Function Documentation

template<typename T>
ExpressionEventServer & WatchedExpression< T >::create_event_server ( void   )  [inline]

Create and return an event server that is watching this expression.

Definition at line 21 of file Watched.inl.

References debug::channels::dc::expression, and WatchedExpression< T >::WatchedExpression().

00022   {
00023     boost::shared_ptr<ExpressionInterface> expression(new WatchedExpression(*this));
00024     boost::shared_ptr<ExpressionEventServer> event_server(new ExpressionEventServer(expression));
00025     expression->add_event_server(event_server);
00026     return *event_server;
00027   }

template<typename T>
T const & WatchedExpression< T >::evaluate_impl ( void   )  const [inline]

Return the value of the underlying type.

Definition at line 278 of file Watched.h.

References WatchedExpression< T >::M_b.

00279 {
00280   return M_b.value();
00281 }

template<typename T>
void WatchedExpression< T >::sub_event_server_impl ( ExpressionEventServer event_server  )  [inline]

Remove event server event_server from the notification list.

Remove Expression event server event_server to the notification list.

Definition at line 285 of file Watched.h.

References WatchedExpression< T >::M_b.

Referenced by WatchedExpression< T >::sub_event_server().

00286 {
00287   M_b.sub_event_server(event_server);
00288 }

template<typename T>
void WatchedExpression< T >::add_event_server ( boost::shared_ptr< ExpressionEventServer > const &  event_server  )  [inline, virtual]

Add Expression event server event_server to the notification list.

Implements ExpressionInterface.

Definition at line 271 of file Watched.h.

References WatchedExpression< T >::M_b.

00272 {
00273   M_b.add_event_server(event_server);
00274 }

template<typename T>
virtual bool WatchedExpression< T >::evaluate ( void   )  [inline, virtual]

Implement pure virtual ExpressionInterface::evaluate.

Implements ExpressionInterface.

Definition at line 56 of file Watched.h.

00057         { DoutFatal(dc::core, "Calling WatchedExpression<" << type_info_of<T>().demangled_name() << ">::evaluate()");
00058           return false; /* Dummy return to suppress compiler warning (argh) */ }

template<typename T>
virtual void WatchedExpression< T >::sub_event_server ( ExpressionEventServer event_server  )  [inline, virtual]

Implementation of pure virtual function ExpressionInterface::sub_event_server.

Implements ExpressionInterface.

Definition at line 60 of file Watched.h.

References WatchedExpression< T >::sub_event_server_impl().

00060 { sub_event_server_impl(event_server); }

template<typename T>
void WatchedExpression< T >::print_on ( std::ostream &  os  )  const [inline, virtual]

For debugging purpose; write the (debug) name of this object to os.

Implements ExpressionInterface.

Definition at line 263 of file Watched.h.

References WatchedExpression< T >::M_b.

00264 {
00265   M_b.print_name(os);
00266 }


Member Data Documentation

template<typename T>
Watched<T>& WatchedExpression< T >::M_b [private]


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

Copyright © 2005-2007 Carlo Wood.  All rights reserved.