FMT 0.9.8
Forest management tools for forest planning
Loading...
Searching...
No Matches
FMTtask.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 FMTTASK_H_INCLUDED
8#define FMTTASK_H_INCLUDED
9#include <memory>
10#include "FMTobject.hpp"
11#include <boost/thread/recursive_mutex.hpp>
12
13/*namespace Logging
14{
15 class FMTlogger;
16}*/
17
18
20namespace Parallel
21{
22 // DocString: FMTtask
28 {
29 // DocString: FMTtaskhandler::done
31 bool done;
32 protected:
33 // DocString: FMTtaskhandler::mutex
35 static boost::recursive_mutex taskmutex;
36 // DocString: FMTtaskhandler::tasklogger
39 std::unique_ptr<Logging::FMTlogger>tasklogger;
40 // DocString: FMTreplanningtask::setstatus()
44 void setstatus(bool status);
45 // DocString: FMTreplanningtask::split()
49 std::vector<size_t>splitwork(int numberoftasks,const int& totalworksize) const;
50 public:
51 // DocString: FMTreplanningtask::FMTtask()
56 // DocString: ~FMTtask()
60 virtual ~FMTtask() = default;
61 // DocString: FMTreplanningtask::FMTtask(const FMTtask&)
65 FMTtask(const FMTtask& rhs);
66 // DocString: FMTreplanningtask::operator=(const FMTtask&)
70 FMTtask& operator = (const FMTtask& rhs);
71 // DocString: FMTreplanningtask::clone()
75 virtual std::unique_ptr<FMTtask>clone() const;
76 // DocString: FMTreplanningtask::split()
80 virtual std::vector<std::unique_ptr<FMTtask>>split(const unsigned int& numberoftasks) const;
81 // DocString: FMTreplanningtask::spawn()
85 virtual std::unique_ptr<FMTtask>spawn();
86 // DocString: FMTreplanningtask::work
90 virtual void work();
91 // DocString: FMTreplanningtask::finalize
96 virtual void finalize();
97 // DocString: FMTreplanningtask::isdone()
101 bool isdone() const;
102 // DocString: FMTreplanningtask::getthreadid()
106 std::string getthreadid() const;
107
108 };
109
110}
111
112
113
114#endif
#define FMTEXPORT
Definition: FMTutility.hpp:92
Definition: FMTobject.hpp:50
Definition: FMTtask.hpp:28
virtual std::unique_ptr< FMTtask > spawn()
FMTtask(const FMTtask &rhs)
std::vector< size_t > splitwork(int numberoftasks, const int &totalworksize) const
virtual void finalize()
virtual std::unique_ptr< FMTtask > clone() const
virtual ~FMTtask()=default
void setstatus(bool status)
std::unique_ptr< Logging::FMTlogger > tasklogger
Definition: FMTtask.hpp:39
std::string getthreadid() const
static boost::recursive_mutex taskmutex
Recursive mutex for the task.
Definition: FMTtask.hpp:35
virtual void work()
virtual std::vector< std::unique_ptr< FMTtask > > split(const unsigned int &numberoftasks) const
bool isdone() const
Namespace for parallel tasking may include multithreading / multiprocessing.
Definition: FMTopareaschedulertask.hpp:40