NIST Biometric Evaluation Framework
Software components for biometric technology evaluations
be_process_workercontroller.h
Go to the documentation of this file.
1/*
2 * This software was developed at the National Institute of Standards and
3 * Technology (NIST) by employees of the Federal Government in the course
4 * of their official duties. Pursuant to title 17 Section 105 of the
5 * United States Code, this software is not subject to copyright protection
6 * and is in the public domain. NIST assumes no responsibility whatsoever for
7 * its use by other parties, and makes no guarantees, expressed or implied,
8 * about its quality, reliability, or any other characteristic.
9 */
10
11#ifndef __BE_PROCESS_WORKERCONTROLLER_H__
12#define __BE_PROCESS_WORKERCONTROLLER_H__
13
14#include <memory>
15
16#include <be_error_exception.h>
17#include <be_memory_autoarray.h>
18#include <be_process.h>
19#include <be_process_worker.h>
20
21namespace BiometricEvaluation
22{
23 namespace Process
24 {
30 {
31 public:
39 std::shared_ptr<Worker> worker);
40
55 virtual void
57 const Memory::uint8Array &message);
58
73 virtual void
75 const std::string &name,
76 std::shared_ptr<void> argument);
77
92 virtual void
94 const std::string &name,
95 double argument);
96
111 virtual void
113 const std::string &name,
114 int64_t argument);
115
130 virtual void
132 const std::string &name,
133 const std::string &argument);
134
143 virtual void
145
153 virtual bool
155 const = 0;
156
168 virtual bool
170 const = 0;
171
184 inline bool
186 const
187 {
188 return (this->everWorked() &&
189 !this->isWorking());
190 }
191
199 std::shared_ptr<Worker>
201 const;
202
216 virtual int32_t
218 const
219 final;
220
226
227 protected:
229 std::shared_ptr<Worker> _worker;
231 bool _rvSet;
233 int32_t _rv;
234
235 private:
253 virtual void
254 start(
255 bool communicate = false) = 0;
256
266 virtual void
267 stop() = 0;
268 };
269 }
270}
271
272#endif /* __BE_PROCESS_WORKERCONTROLLER_H__ */
Wrapper of a Worker returned from a Process::Manager.
int32_t _rv
Exit status from _worker.workerMain()
virtual void setParameterFromDouble(const std::string &name, double argument)
Set a double parameter to be passed to the Worker.
virtual void setParameterFromString(const std::string &name, const std::string &argument)
Set a string parameter to be passed to the Worker.
virtual bool isWorking() const =0
Obtain whether or not Worker is working.
virtual bool everWorked() const =0
Obtain whether or not this Worker has ever worked.
bool _rvSet
Whether or not _rv contains a true value.
bool finishedWorking() const
Obtain whether or not this Worker has both started and finished its task.
virtual void setParameterFromInteger(const std::string &name, int64_t argument)
Set an integer parameter to be passed to the Worker.
WorkerController(std::shared_ptr< Worker > worker)
WorkerController constructor.
virtual void reset()
Reuse the Worker.
std::shared_ptr< Worker > getWorker() const
Obtain the Worker instance being wrapped.
virtual void setParameter(const std::string &name, std::shared_ptr< void > argument)
Set the parameter to be passed to the Worker.
virtual void sendMessageToWorker(const Memory::uint8Array &message)
Send a message to the Worker contained within this WorkerController.
std::shared_ptr< Worker > _worker
The Worker instance that is running in this child.
virtual int32_t getExitStatus() const final
Obtain the exit status of the wrapped Worker.
An abstraction of an instance that performs work on given data.
This software was developed at the National Institute of Standards and Technology (NIST) by employees...