00001
00002 #ifndef INCLUDED_OutputNode_h_
00003 #define INCLUDED_OutputNode_h_
00004
00005 #include "Behaviors/StateNode.h"
00006 #include <string>
00007 #include <ostream>
00008
00009
00010 class OutputNode : public StateNode {
00011 public:
00012
00013 OutputNode() : StateNode(), next(NULL), out(cout), msg() {}
00014
00015 OutputNode(const char* nm, StateNode* par, ostream& output) : StateNode(nm,par), next(NULL), out(output), msg(nm) {}
00016
00017 OutputNode(const char* nm, StateNode* par, ostream& output, StateNode * nextstate) : StateNode(nm,par), next(nextstate), out(output), msg(nm) {}
00018
00019 OutputNode(const char* nm, const std::string& mg, StateNode* par, ostream& output, StateNode * nextstate) : StateNode(nm,par), next(nextstate), out(output), msg(mg) {}
00020
00021
00022
00023 virtual void DoStart() {
00024 StateNode::DoStart();
00025 out << msg << endl;
00026 if(next!=NULL) {
00027 DoStop();
00028 next->DoStart();
00029 }
00030 }
00031
00032 protected:
00033 StateNode* next;
00034 ostream& out;
00035 std::string msg;
00036
00037 private:
00038 OutputNode(const OutputNode& node);
00039 OutputNode operator=(const OutputNode& node);
00040 };
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053 #endif