C:/cmcintos/defOrgs/source/cognitive/Ctrl_ScheduleDriven.cxx

00001 #ifndef _Ctrl_ScheduleDriven_txx
00002 #define _Ctrl_ScheduleDriven_txx
00003 #include "Ctrl_ScheduleDriven.h"
00004 
00005 using namespace mial;
00006 //{
00007 template<class Type,int nDims>
00008 Ctrl_ScheduleDriven<Type,nDims>::Ctrl_ScheduleDriven()
00009 :ControlCenter<Type,nDims>()
00010 {
00011         //scName = n;
00012         //Make the base class stream pointer point to the runStream
00013         this->setBehaviorToRunStream(&behaviorToRunStream);
00014         setup = false;
00015 }
00016 
00017 
00018 template<class Type,int nDims>
00019 bool Ctrl_ScheduleDriven<Type,nDims>::decideNextBehavior()
00020 {
00021                 //Clear the current arg stream
00022                 behaviorToRunStream.str(std::string());
00023                 //Clear any errors
00024                 behaviorToRunStream.clear();
00025 
00026                 //Read next command from file
00027                 if(!setup)
00028                 {
00029                         in.open(scName.c_str());
00030                         setup = true;
00031                 }
00032                 std::string cmd;
00033                 std::string name;
00034                 if(!in.is_open())
00035                 {
00036                         this->behaviorToRun = NULL;
00037                         return false;
00038                 }
00039                 else
00040                 {
00041                         if(!in.eof())
00042                         {
00043                                 in >> name;
00044                                 getline(in,cmd,'\n');
00045                                 this->behaviorToRun = this->findBehavior(name);
00046                                 behaviorToRunStream << cmd;
00047                                 std::cout << cmd;
00048                                 std::cout << behaviorToRunStream.str();
00049                         }
00050                         else
00051                         {
00052                                 in.close();
00053                                 this->behaviorToRun = NULL;
00054                         }
00055                                                 
00056                         //Put the stream in the args
00057                         //behaviorToRunArgs = (void *)&behaviorToRunStream;
00058                         return true;
00059                 }
00060 }
00061 //}//end mial
00062 #endif

Generated on Wed Jul 19 13:05:17 2006 for IDO by  doxygen 1.4.7