-
Notifications
You must be signed in to change notification settings - Fork 93
Expand file tree
/
Copy pathThreadMan.h
More file actions
142 lines (97 loc) · 4.76 KB
/
ThreadMan.h
File metadata and controls
142 lines (97 loc) · 4.76 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
#ifndef _RTEThreadMan_
#define _RTEThreadMan_
//////////////////////////////////////////////////////////////////////////////////////////
// File: ThreadMan.h
//////////////////////////////////////////////////////////////////////////////////////////
// Description: Header file for the ThreadMan class.
// Project: Retro Terrain Engine
// Author(s):
//
//
//////////////////////////////////////////////////////////////////////////////////////////
// Inclusions of header files
#include <string>
#include <deque>
//#include <boost/thread.hpp>
#include "Singleton.h"
#define g_ThreadMan ThreadMan::Instance()
namespace RTE
{
//////////////////////////////////////////////////////////////////////////////////////////
// Class: ThreadMan
//////////////////////////////////////////////////////////////////////////////////////////
// Description: The centralized singleton manager of all threads.
// Parent(s): Singleton
// Class history: 03/29/2014 ThreadMan created.
class ThreadMan:
public Singleton<ThreadMan>
{
//////////////////////////////////////////////////////////////////////////////////////////
// Public member variable, method and friend function declarations
public:
//////////////////////////////////////////////////////////////////////////////////////////
// Constructor: ThreadMan
//////////////////////////////////////////////////////////////////////////////////////////
// Description: Constructor method used to instantiate a ThreadMan object in system
// memory. Create() should be called before using the object.
// Arguments: None.
ThreadMan() { Clear(); Create(); }
//////////////////////////////////////////////////////////////////////////////////////////
// Destructor: ~ThreadMan
//////////////////////////////////////////////////////////////////////////////////////////
// Description: Destructor method used to clean up a ThreadMan object before deletion
// from system memory.
// Arguments: None.
virtual ~ThreadMan() { Destroy(); }
//////////////////////////////////////////////////////////////////////////////////////////
// Method: Create
//////////////////////////////////////////////////////////////////////////////////////////
// Description: Makes the ThreadMan object ready for use.
// Arguments: None.
// Return value: An error return value signaling sucess or any particular failure.
// Anything below 0 is an error signal.
virtual int Create();
//////////////////////////////////////////////////////////////////////////////////////////
// Virtual method: Reset
//////////////////////////////////////////////////////////////////////////////////////////
// Description: Resets the entire ThreadMan, including its inherited members, to
// their default settings or values.
// Arguments: None.
// Return value: None.
virtual void Reset() { Clear(); }
//////////////////////////////////////////////////////////////////////////////////////////
// Method: Destroy
//////////////////////////////////////////////////////////////////////////////////////////
// Description: Destroys and resets (through Clear()) the ThreadMan object.
// Arguments: None.
// Return value: None.
void Destroy();
//////////////////////////////////////////////////////////////////////////////////////////
// Virtual method: GetClassName
//////////////////////////////////////////////////////////////////////////////////////////
// Description: Gets the class name of this Entity.
// Arguments: None.
// Return value: A string with the friendly-formatted type name of this object.
virtual const std::string & GetClassName() const { return m_ClassName; }
//////////////////////////////////////////////////////////////////////////////////////////
// Protected member variable and method declarations
protected:
// Member variables
static const std::string m_ClassName;
//////////////////////////////////////////////////////////////////////////////////////////
// Private member variable and method declarations
private:
//////////////////////////////////////////////////////////////////////////////////////////
// Method: Clear
//////////////////////////////////////////////////////////////////////////////////////////
// Description: Clears all the member variables of this ThreadMan, effectively
// resetting the members of this abstraction level only.
// Arguments: None.
// Return value: None.
void Clear();
// Disallow the use of some implicit methods.
ThreadMan(const ThreadMan &reference);
ThreadMan & operator=(const ThreadMan &rhs);
};
} // namespace RTE
#endif // File