Homepage
Demos
Overview
Downloads
Dev. Resources
Reference
Credits

HelloWorldBehavior.h

Go to the documentation of this file.
00001 //-*-c++-*-
00002 #ifndef INCLUDED_HelloWorldBehavior_h_
00003 #define INCLUDED_HelloWorldBehavior_h_
00004 
00005 #include "Behaviors/BehaviorBase.h"
00006 #include "Wireless/Wireless.h"
00007 
00008 //! Demonstrates serr, sout, and cout
00009 class HelloWorldBehavior : public BehaviorBase {
00010 public:
00011   //Note that we pass the name of our class as an argument to the
00012   //BehaviorBase constructor.  This is used for the default name for
00013   //instances of this class, and may allow more readable debugging
00014   //information
00015   HelloWorldBehavior() : BehaviorBase("HelloWorldBehavior") {}
00016   
00017   virtual void DoStart() {
00018     //call superclass first for housekeeping:
00019     BehaviorBase::DoStart();
00020 
00021     //now do your code:
00022     for(unsigned int i=0; i<100; i++)
00023       serr->printf("Hello serr!  This is %d\n",i);
00024     for(unsigned int i=0; i<10; i++)
00025       sout->printf("Hello sout!  This is %d\n",i);
00026     for(unsigned int i=0; i<10; i++)
00027       cout << "Hello cout!  This is " << i << endl;
00028     for(unsigned int i=0; i<10; i++)
00029       printf("Hello printf!  This is %d\n",i);
00030 
00031     //we'll just stop right away since this Behavior has no 'active' state.
00032     DoStop(); //Note that you could also override this DoStop function...
00033   }
00034   
00035   static std::string getClassDescription() {
00036     // This string will be shown by the HelpControl or by the tooltips
00037     // of the Controller GUI (not required, but nice)
00038     return "A little demo of text output";
00039   }
00040   virtual std::string getDescription() const {
00041     // We override this function to return the string we supplied
00042     // above (not required, but nice)
00043     return getClassDescription();
00044   }
00045   
00046 };
00047 
00048 /*! @file
00049  * @brief Defines HelloWorldBehavior, a little demo of text output (serr, sout, and cout)
00050  * @author ejt (Creator)
00051  *
00052  * $Author: ejt $
00053  * $Name: tekkotsu-2_4_1 $
00054  * $Revision: 1.5 $
00055  * $State: Exp $
00056  * $Date: 2004/11/11 01:45:36 $
00057  */
00058 
00059 #endif

Tekkotsu v2.4.1
Generated Tue Aug 16 16:32:47 2005 by Doxygen 1.4.4