Homepage | Demos | Overview | Downloads | Dev. Resources | Reference | Credits |
OutputNode.hGo to the documentation of this file.00001 //-*-c++-*- 00002 #ifndef INCLUDED_OutputNode_h_ 00003 #define INCLUDED_OutputNode_h_ 00004 00005 #include "Behaviors/StateNode.h" 00006 #include <string> 00007 #include <ostream> 00008 00009 //! A very simple StateNode that outputs its name to a given ostream upon activation, handy for debugging 00010 /*! The Event Logger controller item (Status Reports menu) is a much better tool for debugging */ 00011 class OutputNode : public StateNode { 00012 public: 00013 //!constructor, sets name and ostream to use for output 00014 OutputNode(const char* nm, std::ostream& output) : StateNode("OutputNode",nm), next(NULL), out(output), msg(nm) {} 00015 //!constructor, sets name and another state which will immediately be transitioned to upon activation 00016 OutputNode(const char* nm, std::ostream& output, StateNode * nextstate) : StateNode("OutputNode",nm), next(nextstate), out(output), msg(nm) {} 00017 //!constructor, sets name, message, and another state which will immediately be transitioned to upon activation 00018 OutputNode(const char* nm, const std::string& mg, std::ostream& output, StateNode * nextstate) : StateNode("OutputNode",nm), next(nextstate), out(output), msg(mg) {} 00019 00020 //!outputs this state's name, will transition to #next if non-NULL 00021 /*!if #next is NULL, the state will simply stay active until some other transition causes it to leave*/ 00022 virtual void DoStart() { 00023 StateNode::DoStart(); 00024 out << msg << std::endl; 00025 if(next!=NULL) { 00026 DoStop(); 00027 next->DoStart(); 00028 } 00029 } 00030 00031 protected: 00032 StateNode* next; //!< the state to transition to upon entering, can be NULL 00033 std::ostream& out; //!< the stream to use for output - if not specified (default constructor) cout will be used 00034 std::string msg; //!< message to show on activation 00035 00036 private: 00037 OutputNode(const OutputNode& node); //!< don't call this 00038 OutputNode operator=(const OutputNode& node); //!< don't call this 00039 }; 00040 00041 /*! @file 00042 * @brief Defines OutputNode, a very simple StateNode that outputs its name to a given ostream upon activation, handy for debugging 00043 * @author ejt (Creator) 00044 * 00045 * $Author: ejt $ 00046 * $Name: tekkotsu-2_4_1 $ 00047 * $Revision: 1.8 $ 00048 * $State: Exp $ 00049 * $Date: 2005/02/02 18:20:27 $ 00050 */ 00051 00052 #endif |
Tekkotsu v2.4.1 |
Generated Tue Aug 16 16:32:48 2005 by Doxygen 1.4.4 |