FMT 0.9.8
Forest management tools for forest planning
Loading...
Searching...
No Matches
FMTdevelopment.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
8#ifndef FMTDEV_H_INCLUDED
9#define FMTDEV_H_INCLUDED
10
11#include "FMTmask.hpp"
12#include <boost/serialization/serialization.hpp>
13#include <boost/serialization/nvp.hpp>
14#include <boost/serialization/string.hpp>
15#include "FMTobject.hpp"
16#include <memory>
17#include <vector>
18#include <boost/serialization/export.hpp>
20
21namespace Graph
22{
23 class FMTgraphvertextoyield;
24}
25
26
28namespace Core
29{
30class FMTfuturdevelopment;
31class FMTtransition;
32class FMTaction;
33class FMTyieldrequest;
34class FMTyields;
35class FMTdevelopmentpath;
36class FMTspec;
37// DocString: FMTdevelopment
44 {
45 // DocString: FMTdevelopment::serialize
49 friend class boost::serialization::access;
50 template<class Archive>
51 void serialize(Archive& ar, const unsigned int version)
52 {
53 try {
54 ar & boost::serialization::make_nvp("FMTobject", boost::serialization::base_object<FMTobject>(*this));
55 ar & BOOST_SERIALIZATION_NVP(mask);
56 ar & BOOST_SERIALIZATION_NVP(age);
57 ar & BOOST_SERIALIZATION_NVP(lock);
58 ar & BOOST_SERIALIZATION_NVP(period);
59 }catch (...)
60 {
61 _exhandler->printexceptions("", "FMTdevelopment::serialize", __LINE__, __FILE__);
62 }
63 }
64 private:
65 // DocString: FMTdevelopment::mask
67 FMTmask mask;
68 // DocString: FMTdevelopment::age
70 uint8_t age;
71 // DocString: FMTdevelopment::lock
73 uint8_t lock;
74 // DocString: FMTdevelopment::period
76 uint8_t period;
77 public:
78 // DocString: FMTdevelopment::getage
82 inline int getage() const
83 {
84 return static_cast<int>(age);
85 }
86 // DocString: FMTdevelopment::getlock
90 inline int getlock() const
91 {
92 return static_cast<int>(lock);
93 }
94 // DocString: FMTdevelopment::getperiod
98 inline int getperiod() const
99 {
100 return static_cast<int>(period);
101 }
102 // DocString: FMTdevelopment::getmask
106 inline const Core::FMTmask& getmask() const
107 {
108 return mask;
109 }
110 // DocString: FMTdevelopment::getmaskcopy
115 {
116 return mask;
117 }
118 // DocString: FMTdevelopment::setage
122 void setage(const int& lage);
123 // DocString: FMTdevelopment::setlock
127 void setlock(const int& llock);
128 // DocString: FMTdevelopment::setperiod
132 void setperiod(const int& lperiod);
133 // DocString: FMTdevelopment::setmask
137 void setmask(const Core::FMTmask& lmask);
138 // DocString: FMTdevelopment()
143 // DocString: ~FMTdevelopment()
147 virtual ~FMTdevelopment() = default;
148 // DocString: FMTdevelopment(const FMTmask&,const int&,const int&)
152 FMTdevelopment(const FMTmask& mask, const int& age, const int& lock);
153 // DocString: FMTdevelopment(const FMTmask,const int&,const int&,const int&)
157 FMTdevelopment(const FMTmask& lmask, const int& lage, const int& llock, const int& lperiod);
158 // DocString: FMTdevelopment(const FMTdevelopment&)
163 // DocString: FMTdevelopment::Clone()
167 virtual std::unique_ptr<FMTdevelopment> Clone() const;
168 // DocString: FMTdevelopment::operator=
172 FMTdevelopment& operator = (const FMTdevelopment& rhs);
173 // DocString: FMTdevelopment::operator==
177 bool operator == (const FMTdevelopment& rhs) const;
178 // DocString: FMTdevelopment::operator!=
182 bool operator != (const FMTdevelopment& rhs) const;
183 // DocString: FMTdevelopment::operator<
187 bool operator < (const FMTdevelopment& rhs) const;
188 // DocString: FMTdevelopment::grow
194 // DocString: FMTdevelopment::getyieldrequest
198 FMTyieldrequest getyieldrequest(const Graph::FMTgraphvertextoyield* graphyieldrequest = nullptr) const;
199 // DocString: FMTdevelopment::operable
203 bool operable(const FMTaction& action,const Core::FMTyields& ylds,
204 const Graph::FMTgraphvertextoyield* graphyieldrequest = nullptr) const;
205 // DocString: FMTdevelopment::anyoperable
209 bool anyoperable(const std::vector<const FMTaction*>& actions, const Core::FMTyields& ylds,
210 const Graph::FMTgraphvertextoyield* graphyieldrequest = nullptr) const;
211 // DocString: FMTdevelopment::operator std::string
215 virtual operator std::string() const;
216 // DocString: FMTdevelopment::getarea
220 virtual double getarea() const;
221 // DocString: FMTdevelopment::clearlock
226 // DocString: FMTdevelopment::operate
231 std::vector<FMTdevelopmentpath> operate(const FMTaction& action,
232 const FMTtransition& Transition,
233 const Core::FMTyields& ylds,
234 const std::vector<FMTtheme>& themes) const;
235 // DocString: FMTdevelopment::getinventorycoef
240 double getinventorycoef(const Core::FMTyields& ylds,const std::string& target_yield,
241 const Graph::FMTgraphvertextoyield* graphyieldrequest = nullptr) const;
242 // DocString: FMTdevelopment::getharvestcoef
248 double getharvestcoef(const std::vector<FMTdevelopmentpath>& topaths,
249 const FMTaction& action,const Core::FMTyields& ylds,const std::string& target_yield,
250 const Graph::FMTgraphvertextoyield* graphyieldrequest = nullptr) const;
251 // DocString: FMTdevelopment::is
255 bool is(const FMTspec& specification, const Core::FMTyields& ylds,
256 const Graph::FMTgraphvertextoyield* graphyieldrequest = nullptr) const;
257 // DocString: FMTdevelopment::worthtestingoperability
262 bool worthtestingoperability(const FMTaction& action) const;
263 // DocString: FMTdevelopment::anyworthtestingoperability
268 std::vector<int> anyworthtestingoperability(const std::vector<const FMTaction*>& actions, const FMTaction& firstaction) const;
269 // DocString: FMTdevelopment::isanyworthtestingoperability
273 std::vector<bool> isanyworthtestingoperability(const std::vector<const FMTaction*>& actions,
274 const std::vector<FMTaction>& allactions) const noexcept;
275 // DocString: FMTdevelopment::hash
279 inline size_t hash() const
280 {
281 std::size_t seed =0;
282 boost::hash_combine(seed, boost::hash<Core::FMTmask>()(mask));
283 boost::hash_combine(seed, boost::hash<uint8_t>()(age));
284 boost::hash_combine(seed, boost::hash<uint8_t>()(lock));
285 boost::hash_combine(seed, boost::hash<uint8_t>()(period));
286 return seed;
287 }
288 };
289
290}
291
292namespace boost {
296 template <>
297 struct hash<Core::FMTdevelopment>
298 {
299 std::size_t operator()(const Core::FMTdevelopment& dev) const
300 {
301 return dev.hash();
302 }
303 };
304
305
306}
307BOOST_SERIALIZATION_ASSUME_ABSTRACT(Core::FMTdevelopment)
308BOOST_CLASS_TRACKING(Core::FMTdevelopment, boost::serialization::track_always)
309BOOST_CLASS_EXPORT_KEY(Core::FMTdevelopment)
310
311#endif // FMTDEV_H_INCLUDED
#define FMTEXPORT
Definition: FMTutility.hpp:92
Definition: FMTaction.hpp:42
Definition: FMTdevelopment.hpp:44
std::vector< int > anyworthtestingoperability(const std::vector< const FMTaction * > &actions, const FMTaction &firstaction) const
FMTyieldrequest getyieldrequest(const Graph::FMTgraphvertextoyield *graphyieldrequest=nullptr) const
FMTdevelopment(const FMTdevelopment &rhs)
virtual ~FMTdevelopment()=default
std::vector< FMTdevelopmentpath > operate(const FMTaction &action, const FMTtransition &Transition, const Core::FMTyields &ylds, const std::vector< FMTtheme > &themes) const
void setage(const int &lage)
int getlock() const
Definition: FMTdevelopment.hpp:90
Core::FMTmask getmaskcopy() const
Definition: FMTdevelopment.hpp:114
FMTdevelopment(const FMTmask &lmask, const int &lage, const int &llock, const int &lperiod)
FMTdevelopment clearlock() const
void setlock(const int &llock)
virtual double getarea() const
std::vector< bool > isanyworthtestingoperability(const std::vector< const FMTaction * > &actions, const std::vector< FMTaction > &allactions) const noexcept
const Core::FMTmask & getmask() const
Definition: FMTdevelopment.hpp:106
bool worthtestingoperability(const FMTaction &action) const
void setperiod(const int &lperiod)
FMTdevelopment(const FMTmask &mask, const int &age, const int &lock)
void setmask(const Core::FMTmask &lmask)
bool is(const FMTspec &specification, const Core::FMTyields &ylds, const Graph::FMTgraphvertextoyield *graphyieldrequest=nullptr) const
bool operable(const FMTaction &action, const Core::FMTyields &ylds, const Graph::FMTgraphvertextoyield *graphyieldrequest=nullptr) const
bool anyoperable(const std::vector< const FMTaction * > &actions, const Core::FMTyields &ylds, const Graph::FMTgraphvertextoyield *graphyieldrequest=nullptr) const
size_t hash() const
Definition: FMTdevelopment.hpp:279
double getinventorycoef(const Core::FMTyields &ylds, const std::string &target_yield, const Graph::FMTgraphvertextoyield *graphyieldrequest=nullptr) const
int getage() const
Definition: FMTdevelopment.hpp:82
double getharvestcoef(const std::vector< FMTdevelopmentpath > &topaths, const FMTaction &action, const Core::FMTyields &ylds, const std::string &target_yield, const Graph::FMTgraphvertextoyield *graphyieldrequest=nullptr) const
int getperiod() const
Definition: FMTdevelopment.hpp:98
FMTfuturdevelopment grow() const
virtual std::unique_ptr< FMTdevelopment > Clone() const
Definition: FMTfuturdevelopment.hpp:24
Definition: FMTmask.hpp:96
Definition: FMTobject.hpp:50
Definition: FMTbounds.hpp:342
Definition: FMTtransition.hpp:37
Definition: FMTyieldrequest.hpp:36
Definition: FMTyields.hpp:40
Definition: FMTgraphvertextoyield.hpp:27
The Core namespace provides classes for simulating stands/strata growth/harvest through time.
Definition: FMTaction.hpp:31
Namespace for using/building unidirectional graphs in FMT.
Definition: FMTareaparser.hpp:31
Definition: FMTaction.hpp:364
std::size_t operator()(const Core::FMTdevelopment &dev) const
Definition: FMTdevelopment.hpp:299