-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProcess.cpp
More file actions
executable file
·96 lines (68 loc) · 1.69 KB
/
Process.cpp
File metadata and controls
executable file
·96 lines (68 loc) · 1.69 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
// Copyright 2006-12 HumaNature Studios Inc.
#include "CorePch.h"
#include "Process.h"
#include "ProcessEvent.h"
#include "ProcessManager.h"
#include "Scaleform/ExternalInterfaceEvent.h"
namespace core {
Process::Process(const char* name)
: mName(name == nullptr ? "" : name)
, mBegun(false)
, mEnded(false)
, mDeleteOnEnd(true)
{
}
Process::~Process()
{
}
bool Process::hasBegun()
{
return mBegun;
}
bool Process::hasEnded()
{
return mEnded;
}
void Process::begin()
{
mBegun = true;
ProcessManager::Instance().addProcess(this);
logInfo("Process", "Begun process '%s'", getReportName());
dispatch(ProcessEvent::PROCESS_BEGAN);
onBegin();
}
void Process::end(const char* additionalEvent)
{
onEnd();
mEnded = true;
ProcessManager::Instance().removeProcess(this);
logInfo("Process", "Ended process '%s'", getReportName());
if(additionalEvent != nullptr)
{
dispatch(additionalEvent);
}
dispatch(ProcessEvent::PROCESS_ENDED);
}
void Process::reset()
{
mBegun = false;
mEnded = false;
}
const char* Process::getReportName()
{
return mName.c_str();
}
void Process::dispatch(const CompactString& type)
{
ProcessEvent event(type, *this);
dispatchEvent(event);
}
void Process::onBegin()
{
// do nothing
}
void Process::onEnd()
{
// do nothing
}
} // namespace core