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