ircproxy  The Ultimate Cyborg

BoolExpression< inverted > Class Template Reference

#include <Bool.h>

Inheritance diagram for BoolExpression< inverted >:

ExpressionInterface

List of all members.


Detailed Description

template<bool inverted>
class BoolExpression< inverted >

An Expression consisting of a single boolean (Bool).

Definition at line 32 of file Bool.h.


Public Types

typedef BoolExpression<!inverted > inverted_type
 The type of the inverted expression.
typedef bool evaluation_type
 The return type of evaluate_impl.

Public Member Functions

 BoolExpression (Bool &b)
 Copy constructor.
BoolExpression<!inverted > operator! (void) const
 Inversion operator. Returns an inverted expression.
ExpressionEventServercreate_event_server (void)
 Create and return an event server that is watching this expression.
bool evaluate_impl (void) const
 Evaluate this expression.
void sub_event_server_impl (ExpressionEventServer *)
 Implementation of sub_event_server(). Remove event server event_server from the notification list.
virtual void add_event_server (boost::shared_ptr< ExpressionEventServer > const &event_server)
 Add event server event_server to notification list.
virtual bool evaluate (void)
 Implementation of pure virtual function 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 purposes. Write the contents of this object to os.

Private Attributes

BoolM_b
 The underlying Bool.

Member Typedef Documentation

template<bool inverted>
typedef BoolExpression<!inverted> BoolExpression< inverted >::inverted_type

The type of the inverted expression.

Definition at line 34 of file Bool.h.

template<bool inverted>
typedef bool BoolExpression< inverted >::evaluation_type

The return type of evaluate_impl.

Definition at line 35 of file Bool.h.


Constructor & Destructor Documentation

template<bool inverted>
BoolExpression< inverted >::BoolExpression ( Bool b  )  [inline]

Copy constructor.

Definition at line 42 of file Bool.h.

Referenced by BoolExpression< inverted >::create_event_server().

00042 : M_b(b) { }


Member Function Documentation

template<bool inverted>
BoolExpression<!inverted> BoolExpression< inverted >::operator! ( void   )  const [inline]

Inversion operator. Returns an inverted expression.

Definition at line 45 of file Bool.h.

References BoolExpression< inverted >::M_b.

00045 { return BoolExpression<!inverted>(M_b); }

template<bool inverted>
ExpressionEventServer & BoolExpression< inverted >::create_event_server ( void   )  [inline]

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

Definition at line 21 of file Bool.inl.

References BoolExpression< inverted >::BoolExpression(), and debug::channels::dc::expression.

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

template<bool inverted>
bool BoolExpression< inverted >::evaluate_impl ( void   )  const [inline]

Evaluate this expression.

Definition at line 177 of file Bool.h.

References BoolExpression< inverted >::M_b, and Bool::value().

Referenced by BoolExpression< inverted >::evaluate().

00178 {
00179   return M_b.value() != inverted;
00180 }

template<bool inverted>
void BoolExpression< inverted >::sub_event_server_impl ( ExpressionEventServer event_server  )  [inline]

Implementation of sub_event_server(). Remove event server event_server from the notification list.

Definition at line 184 of file Bool.h.

References BoolExpression< inverted >::M_b, and Bool::sub_event_server().

Referenced by BoolExpression< inverted >::sub_event_server().

00185 {
00186   M_b.sub_event_server(event_server);
00187 }

template<bool inverted>
void BoolExpression< inverted >::add_event_server ( boost::shared_ptr< ExpressionEventServer > const &  event_server  )  [inline, virtual]

Add event server event_server to notification list.

Implements ExpressionInterface.

Definition at line 168 of file Bool.h.

References Bool::add_event_server(), and BoolExpression< inverted >::M_b.

00169 {
00170   M_b.add_event_server(event_server);
00171 }

template<bool inverted>
virtual bool BoolExpression< inverted >::evaluate ( void   )  [inline, virtual]

Implementation of pure virtual function ExpressionInterface::evaluate.

Implements ExpressionInterface.

Definition at line 55 of file Bool.h.

References BoolExpression< inverted >::evaluate_impl().

00055 { return evaluate_impl(); }

template<bool inverted>
virtual void BoolExpression< inverted >::sub_event_server ( ExpressionEventServer event_server  )  [inline, virtual]

Implementation of pure virtual function ExpressionInterface::sub_event_server.

Implements ExpressionInterface.

Definition at line 57 of file Bool.h.

References BoolExpression< inverted >::sub_event_server_impl().

00057 { sub_event_server_impl(event_server); }

template<bool inverted>
void BoolExpression< inverted >::print_on ( std::ostream &  os  )  const [inline, virtual]

For debugging purposes. Write the contents of this object to os.

Implements ExpressionInterface.

Definition at line 158 of file Bool.h.

References BoolExpression< inverted >::M_b, and Bool::print_name().

00159 {
00160   if (inverted)
00161     os << '!';
00162   M_b.print_name(os);
00163 }


Member Data Documentation


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

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