NIST Biometric Evaluation Framework
Software components for biometric technology evaluations
be_process_manager.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_MANAGER_H__
12#define __BE_PROCESS_MANAGER_H__
13
14#include <vector>
15
16#include <be_error_exception.h>
17#include <be_process.h>
18#include <be_process_worker.h>
20
21namespace BiometricEvaluation
22{
23 namespace Process
24 {
29 class Manager
30 {
31 public:
37
48 virtual std::shared_ptr<WorkerController>
50 std::shared_ptr<Worker> worker) = 0;
51
62 virtual uint32_t
64
76 virtual uint32_t
78
87 virtual uint32_t
89 const;
90
107 virtual void
109 bool wait = true,
110 bool communicate = false) = 0;
111
137 virtual void
139 std::shared_ptr<WorkerController> worker,
140 bool wait = true,
141 bool communicate = false) = 0;
142
150 virtual void
152
160 virtual void
162
176 virtual void
178 std::shared_ptr<WorkerController> worker) = 0;
179
197 virtual bool
199 std::shared_ptr<WorkerController> &sender,
200 int *nextFD = nullptr,
201 int numSeconds = -1)
202 const;
203
225 virtual bool
227 std::shared_ptr<WorkerController> &sender,
228 Memory::uint8Array &message,
229 int numSeconds = -1) const;
230
241 virtual void
243 Memory::uint8Array &message) const;
244
249 virtual ~Manager();
250
251 protected:
256 virtual void
257 _wait() = 0;
258
260 std::vector<std::shared_ptr<WorkerController>>
262
264 std::vector<std::shared_ptr<WorkerController>>
266
267 private:
268
269 };
270 }
271}
272
273
274#endif /* __BE_PROCESS_MANAGER_H__ */
An interface for intranode process management classes.
std::vector< std::shared_ptr< WorkerController > > _workers
Workers that have been added.
virtual void stopWorker(std::shared_ptr< WorkerController > worker)=0
Ask Worker to return as soon as possible.
virtual std::shared_ptr< WorkerController > addWorker(std::shared_ptr< Worker > worker)=0
Adds a Worker to be managed by this Manager.
virtual void reset()
Reuse all Workers.
virtual bool waitForMessage(std::shared_ptr< WorkerController > &sender, int *nextFD=nullptr, int numSeconds=-1) const
Wait for a message from a Worker.
virtual void broadcastMessage(Memory::uint8Array &message) const
Send one message to all Workers.
virtual uint32_t getNumActiveWorkers() const
Obtain the number of Workers that are still working.
virtual void startWorker(std::shared_ptr< WorkerController > worker, bool wait=true, bool communicate=false)=0
Start a Worker.
virtual uint32_t getTotalWorkers() const
Obtain the number of Workers this class is handling.
virtual void waitForWorkerExit()=0
Block until all Workers have exited.
std::vector< std::shared_ptr< WorkerController > > _pendingExit
Workers that are about to exit (stop requested).
virtual void _wait()=0
Do not return until all spawned processes exited.
virtual void startWorkers(bool wait=true, bool communicate=false)=0
Begin Worker's work.
virtual bool getNextMessage(std::shared_ptr< WorkerController > &sender, Memory::uint8Array &message, int numSeconds=-1) const
Obtain a message from a Worker.
virtual uint32_t getNumCompletedWorkers() const
Obtain the number of Workers that have exited.
virtual ~Manager()
Manager destructor.
This software was developed at the National Institute of Standards and Technology (NIST) by employees...