00001 // $Header: /cvs/lcd/slic/include/CommandQueue.hh,v 1.2 2007/04/27 01:54:32 jeremy Exp $ 00002 #ifndef SLIC_COMMANDQUEUE_HH 00003 #define SLIC_COMMANDQUEUE_HH 00004 00005 // slic 00006 #include "Module.hh" 00007 00008 // std 00009 #include <vector> 00010 #include <string> 00011 00012 namespace slic 00013 { 00019 class CommandQueue : public Module 00020 { 00021 public: 00022 00023 typedef std::vector<std::string> CmdVecType; 00024 typedef std::string CmdType; 00025 typedef size_t SizeType; 00026 00027 public: 00028 00029 CommandQueue() 00030 : Module( "CommandQueue" ) 00031 {} 00032 00033 virtual ~CommandQueue() 00034 {} 00035 00039 void add(const CmdType& g4cmd) 00040 { 00041 m_commands.push_back( g4cmd ); 00042 } 00043 00047 void add(const char* g4cmd) 00048 { 00049 std::string cmdStr = g4cmd; 00050 add(std::string(cmdStr)); 00051 } 00052 00056 CmdVecType::iterator cmdsBegin() 00057 { 00058 return m_commands.begin(); 00059 } 00060 00064 CmdVecType::iterator cmdsEnd() 00065 { 00066 return m_commands.end(); 00067 } 00068 00072 void printOut(); 00073 00077 void execute(); 00078 00082 void clear() 00083 { 00084 m_commands.clear(); 00085 } 00086 00090 CmdVecType::iterator find(const std::string& str); 00091 00092 private: 00093 CmdVecType m_commands; 00094 }; 00095 } 00096 00097 #endif
1.5.4