FMT 0.9.8
Forest management tools for forest planning
Loading...
Searching...
No Matches
FMTtaskhandler.hpp
Go to the documentation of this file.
1/*
2Copyright (c) 2019 Gouvernement du Québec
3
4SPDX-License-Identifier: LiLiQ-R-1.1
5License-Filename: LICENSES/EN/LiLiQ-R11unicode.txt
6*/
7#ifndef FMTTASKHANDLER_H_INCLUDED
8#define FMTTASKHANDLER_H_INCLUDED
9#include <memory>
10#include "FMTobject.hpp"
11
13namespace Parallel
14{
15 class FMTtask;
16 // DocString: FMTtaskhandler
22 {
23 // DocString: FMTtaskhandler::maxnumberofthread
25 unsigned int maxnumberofthread;
26 // DocString: FMTtaskhandler::alltasks
28 std::vector<std::unique_ptr<FMTtask>>alltasks;
29 // DocString: FMTtaskhandler::splittasks
33 void splittasks();
34 // DocString: FMTtaskhandler::finalize
38 void finalize(std::unique_ptr<FMTtask>& lasttask);
39 // DocString: FMTtaskhandler::logtasktime
43 void logtasktime(const std::chrono::time_point<std::chrono::high_resolution_clock>& startime) const;
44 public:
45 // DocString: FMTtaskhandler::FMTtaskhandler(const std::unique_ptr<FMTtask>&,unsigned int)
49 FMTtaskhandler(const std::unique_ptr<FMTtask>& maintask,
50 unsigned int maxthread = 0);
51 // DocString: ~FMTtaskhandler()
55 ~FMTtaskhandler()=default;
56 // DocString: FMTtaskhandler::FMTtaskhandler(const Parallel::FMTtask&,unsigned int)
60 FMTtaskhandler(const FMTtask& maintask,
61 unsigned int maxthread = 0);
62 // DocString: FMTtaskhandler::FMTtaskhandler()
66 FMTtaskhandler() = default;
67 // DocString: FMTtaskhandler::FMTtaskhandler(const FMTtaskhandler)
72 // DocString: FMTtaskhandler::operator=
76 FMTtaskhandler& operator =(const FMTtaskhandler& rhs);
77 // DocString: FMTtaskhandler::gettasks
81 const std::vector<std::unique_ptr<FMTtask>>& gettasks() const;
82 // DocString: FMTtaskhandler::gettasksfromdynamiccast
86 template<class ptrtype>
87 const std::vector<const ptrtype*> gettasksfromdynamiccast() const
88 {
89 std::vector<const ptrtype*>castedptr;
90 for (const std::unique_ptr<FMTtask>& task : alltasks)
91 {
92 castedptr.push_back(dynamic_cast<const ptrtype*>(task.get()));
93 }
94 return castedptr;
95 }
96 // DocString: FMTtaskhandler::conccurentrun
102 // DocString: FMTtaskhandler::ondemandrun
108 // DocString: FMTtaskhandler::passinlogger
112 void passinlogger(const std::shared_ptr<Logging::FMTlogger>& logger) override;
113 };
114
115}
116
117#endif
#define FMTEXPORT
Definition: FMTutility.hpp:92
Definition: FMTobject.hpp:50
Definition: FMTtask.hpp:28
Definition: FMTtaskhandler.hpp:22
FMTtaskhandler(const FMTtask &maintask, unsigned int maxthread=0)
FMTtaskhandler(const std::unique_ptr< FMTtask > &maintask, unsigned int maxthread=0)
FMTtaskhandler(const FMTtaskhandler &rhs)
const std::vector< const ptrtype * > gettasksfromdynamiccast() const
Definition: FMTtaskhandler.hpp:87
void passinlogger(const std::shared_ptr< Logging::FMTlogger > &logger) override
const std::vector< std::unique_ptr< FMTtask > > & gettasks() const
Namespace for parallel tasking may include multithreading / multiprocessing.
Definition: FMTopareaschedulertask.hpp:40