Pandora
Pandora source code navigator
Loading...
Searching...
No Matches
Process.h
Go to the documentation of this file.
1
8#ifndef PANDORA_PROCESS_H
9#define PANDORA_PROCESS_H 1
10
11#include "Pandora/StatusCodes.h"
12
13#include <string>
14
15namespace pandora
16{
17
18class Pandora;
19class TiXmlHandle;
20
21//------------------------------------------------------------------------------------------------------------------------------------------
22
27{
28public:
32 Process();
33
39 const std::string &GetType() const;
40
46 const std::string &GetInstanceName() const;
47
53 const Pandora &GetPandora() const;
54
55protected:
61 virtual StatusCode ReadSettings(const TiXmlHandle xmlHandle) = 0;
62
66 virtual StatusCode Initialize();
67
71 virtual StatusCode Reset();
72
76 virtual ~Process();
77
85 StatusCode RegisterDetails(const Pandora *const pPandora, const std::string &type, const std::string &instanceName);
86
88 std::string m_type;
89 std::string m_instanceName;
90};
91
92//------------------------------------------------------------------------------------------------------------------------------------------
93//------------------------------------------------------------------------------------------------------------------------------------------
94
96 m_pPandora(nullptr)
97{
98}
99
100//------------------------------------------------------------------------------------------------------------------------------------------
101
102inline const std::string &Process::GetType() const
103{
104 return m_type;
105}
106
107//------------------------------------------------------------------------------------------------------------------------------------------
108
109inline const std::string &Process::GetInstanceName() const
110{
111 return m_instanceName;
112}
113
114//------------------------------------------------------------------------------------------------------------------------------------------
115
116inline const Pandora &Process::GetPandora() const
117{
118 if (!m_pPandora)
119 throw StatusCodeException(STATUS_CODE_NOT_INITIALIZED);
120
121 return *m_pPandora;
122}
123
124//------------------------------------------------------------------------------------------------------------------------------------------
125
127{
128 return STATUS_CODE_SUCCESS;
129}
130
131//------------------------------------------------------------------------------------------------------------------------------------------
132
134{
135 return STATUS_CODE_SUCCESS;
136}
137
138//------------------------------------------------------------------------------------------------------------------------------------------
139
141{
142}
143
144//------------------------------------------------------------------------------------------------------------------------------------------
145
146inline StatusCode Process::RegisterDetails(const Pandora *const pPandora, const std::string &type, const std::string &instanceName)
147{
148 if (!pPandora || type.empty() || instanceName.empty())
149 return STATUS_CODE_INVALID_PARAMETER;
150
151 if (m_pPandora || !m_type.empty() || !m_instanceName.empty())
152 return STATUS_CODE_ALREADY_PRESENT;
153
154 m_pPandora = pPandora;
155 m_type = type;
156 m_instanceName = instanceName;
157
158 return STATUS_CODE_SUCCESS;
159}
160
161} // namespace pandora
162
163#endif // #ifndef PANDORA_ALGORITHM_TOOL_H
Header file defining status codes and relevant preprocessor macros.
Pandora class.
Definition Pandora.h:40
Process class.
Definition Process.h:27
virtual StatusCode Initialize()
Perform any operations that must occur after reading settings, but before running the process.
Definition Process.h:126
Process()
Default constructor.
Definition Process.h:95
std::string m_type
The process type.
Definition Process.h:88
std::string m_instanceName
The process instance name.
Definition Process.h:89
virtual StatusCode Reset()
Perform any operations when pandora is reset, typically at the end of each event.
Definition Process.h:133
const std::string & GetType() const
Get the type.
Definition Process.h:102
const Pandora & GetPandora() const
Get the associated pandora instance.
Definition Process.h:116
virtual StatusCode ReadSettings(const TiXmlHandle xmlHandle)=0
Read the algorithm settings.
const Pandora * m_pPandora
The pandora object that will run the process.
Definition Process.h:87
const std::string & GetInstanceName() const
Get the instance name.
Definition Process.h:109
virtual ~Process()
Destructor.
Definition Process.h:140
StatusCode RegisterDetails(const Pandora *const pPandora, const std::string &type, const std::string &instanceName)
Register i) the pandora instance that will run the process and ii) the process type.
Definition Process.h:146
StatusCodeException class.
StatusCode
The StatusCode enum.