SLIC  6.1.1
Simulation for the Linear Collider (SLIC) - Geant4 simulation application
CommandQueue.hh
Go to the documentation of this file.
1 #ifndef SLIC_COMMANDQUEUE_HH_
2 #define SLIC_COMMANDQUEUE_HH_ 1
3 
4 // SLIC
5 #include "Module.hh"
6 
7 // STL
8 #include <vector>
9 #include <string>
10 
11 namespace slic {
12 
18 class CommandQueue: public Module {
19  public:
20 
21  typedef std::vector<std::string> CommandVectorType;
22  typedef std::string CommandType;
23  typedef size_t SizeType;
24 
25  public:
26 
31  Module("CommandQueue") {
32  }
33 
37  virtual ~CommandQueue() {
38  }
39 
44  void add(const CommandType& command) {
45  m_commands.push_back(command);
46  }
47 
52  void add(const char* command) {
53  std::string cmdStr = command;
54  add(std::string(cmdStr));
55  }
56 
61  CommandVectorType::iterator cmdsBegin() {
62  return m_commands.begin();
63  }
64 
69  CommandVectorType::iterator cmdsEnd() {
70  return m_commands.end();
71  }
72 
76  void printOut();
77 
81  void execute();
82 
86  void clear() {
87  m_commands.clear();
88  }
89 
95  CommandVectorType::iterator find(const std::string& command);
96 
97  private:
99 };
100 }
101 
102 #endif
A queue of G4 commands to be executed in order.
Definition: CommandQueue.hh:18
std::string CommandType
Definition: CommandQueue.hh:22
CommandVectorType::iterator find(const std::string &command)
Definition: CommandQueue.cc:24
CommandVectorType::iterator cmdsBegin()
Definition: CommandQueue.hh:61
std::vector< std::string > CommandVectorType
Definition: CommandQueue.hh:21
void add(const CommandType &command)
Definition: CommandQueue.hh:44
CommandVectorType::iterator cmdsEnd()
Definition: CommandQueue.hh:69
void add(const char *command)
Definition: CommandQueue.hh:52
virtual ~CommandQueue()
Definition: CommandQueue.hh:37
CommandVectorType m_commands
Definition: CommandQueue.hh:98
Base class for slic code modules that provides common functionality, such as logging to an output str...
Definition: Module.hh:25