-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.hpp
More file actions
72 lines (53 loc) · 1.87 KB
/
Program.hpp
File metadata and controls
72 lines (53 loc) · 1.87 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#if !defined PROGRAM_HPP
#define PROGRAM_HPP
#include <string>
#include <utility>
#include <vector>
#include "ProgramInterface.hpp"
#include "SignalManager.hpp"
// Program is meant to represent the running program that objects of this class
// are built into. Only one of these is meant to be used at a time.
class Program : virtual public ProgramInterface
{
public:
// Internalizes arguments passed to the running program. Retrieve using
// getName() and getArguments().
Program(int argc, char** argv);
// Does nothing
virtual ~Program();
// Returns a copy of the program name
virtual void getName(std::string& name) const;
// Returns a copy of the program arguments
virtual void getArguments(std::vector<std::string>& arguments) const;
protected:
// All Programs have an internal SignalManager to manage received IPC
// signals.
virtual SignalManager* getSignalManager();
private:
// String used to launch this program at the command line
std::string name;
// Arguments given to the program at runtime
std::vector<std::string> arguments;
// Manages signals for the program
SignalManager signal_manager;
// Disallow these for now; maybe these could be meaningfully implemented but
// we'll save that for later
Program(const Program&);
Program& operator=(const Program&);
};
//==============================================================================
inline void Program::getName(std::string& name) const
{
name = this->name;
}
//==============================================================================
inline void Program::getArguments(std::vector<std::string>& arguments) const
{
arguments = this->arguments;
}
//==============================================================================
inline SignalManager* Program::getSignalManager()
{
return &signal_manager;
}
#endif