00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #ifndef USE_PCH
00017 #include "sys.h"
00018 #ifdef CWDEBUG
00019 #include <libcwd/cwprint.h>
00020 #endif
00021 #endif
00022
00023 #include "Expression.h"
00024
00025 ExpressionEventServer::ExpressionEventServer(boost::shared_ptr<ExpressionInterface> const& expression) :
00026 M_expression(expression), M_ok(true), M_evaluation(expression->evaluate())
00027 {
00028 Dout(dc::objects, "Constructing ExpressionEventServer(\"" <<
00029 cwprint(*expression) << "\") with evaluation " << M_evaluation);
00030 }
00031
00032 void ExpressionEventServer::bool_changed(void)
00033 {
00034 if (!M_ok)
00035 return;
00036 bool evaluation = M_expression->evaluate();
00037 if (M_evaluation != evaluation)
00038 {
00039 M_evaluation = evaluation;
00040 trigger(ExpressionEventType(evaluation, M_expression));
00041 }
00042 }
00043
00044 void ExpressionEventServer::all_requests_destroyed(void)
00045 {
00046 M_expression->sub_event_server(this);
00047 }
00048