FMT 0.9.8
Forest management tools for forest planning
Loading...
Searching...
No Matches
FMTyields.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 FMTYLD_H_INCLUDED
9#define FMTYLD_H_INCLUDED
10
11#include "FMTlist.hpp"
12#include "FMTyieldhandler.hpp"
13#include "FMTdevelopment.hpp"
14#include "FMTbounds.hpp"
15#include <vector>
16#include <map>
17#include <string>
18#include <boost/serialization/serialization.hpp>
19#include "FMTutility.hpp"
20#include "FMTtheme.hpp"
21#include <unordered_map>
22#include <memory>
23#include <boost/serialization/export.hpp>
24#include "FMTyieldrequest.hpp"
25
26
27namespace Core
28{
29class FMTdevelopment;
30class FMTageyieldhandler;
31class FMTtimeyieldhandler;
32// DocString: FMTyields
39class FMTEXPORT FMTyields : public FMTlist<std::unique_ptr<FMTyieldhandler>>
40 {
41 // DocString: FMTyields::serialize
45 friend class boost::serialization::access;
46 friend class FMTyieldrequest;
47 template<class Archive>
48 void serialize(Archive& ar, const unsigned int version)
49 {
50 try{
51 ar & boost::serialization::make_nvp("handlers", boost::serialization::base_object<FMTlist<std::unique_ptr<FMTyieldhandler>>>(*this));
52 updateyieldpresence();
53 }catch (...)
54 {
55 _exhandler->printexceptions("", "FMTyields::serialize", __LINE__, __FILE__);
56 }
57 }
58 // DocString: FMTyields::yieldpresence
60 std::unordered_map<std::string,bool>yieldpresence;
61 // DocString: FMTyields::gethandleroftype
66 std::vector<const FMTyieldhandler*> gethandleroftype(FMTyldtype type) const;
67 // DocString: FMTyields::gethandleroftype
72 std::vector<FMTyieldhandler*> gethandlers(FMTyldtype type);
73 // DocString: FMTyields::getmaxbase
78 int getmaxbase(const std::vector<const FMTyieldhandler*>& handlers) const;
79 // DocString: FMTyields::updateyieldpresence
83 void updateyieldpresence();
84 public:
85 // DocString: FMTyields::generatedefaultyields
89 void generatedefaultyields(const std::vector<Core::FMTtheme>& themes);
90 // DocString: FMTyields::swap
94 void swap(FMTyields& rhs);
95 // DocString: FMTyields::gotyieldtype
99 bool gotyieldtype(FMTyldtype type) const;
100 // DocString: FMTyields::setactionsmappingtomodelhandlers
104 void setactionsmappingtomodelhandlers(const std::vector<int>& actionids);
105 // DocString: FMTyields::getallyieldnames
109 std::vector<std::string> getallyieldnames() const;
110 // DocString: FMTyields()
115 // DocString: ~FMTyields()
119 ~FMTyields()=default;
120 // DocString: FMTyields(const FMTyields&)
124 FMTyields(const FMTyields& rhs);
125 // DocString: FMTyields::operator=
129 FMTyields& operator = (const FMTyields& rhs);
130 // DocString: FMTyields::clearcache
134 void clearcache() final;
135 // DocString: FMTyields::isyld
139 bool isyld(const std::string& value,bool fromsource = false) const;
140 // DocString: FMTyields::isnullyld
144 bool isnullyld(const std::string& value) const;
145 // DocString: FMTyields::get
150 //std::vector<double>get(std::vector<FMTyieldrequest>& requests) const;
151 // DocString: FMTyields::getsingle
156 //double getsingle(const FMTdevelopment& dev,const std::string& target) const;
157 //std::map<std::string,double>getylds(const FMTdevelopment& dev,const FMTspec& spec) const;
158 // DocString: FMTyields::getylds
162 //std::vector<double>getylds(const FMTdevelopment& dev, const FMTspec& spec) const;
163 // DocString: FMTyields::getage
168 int getage(const FMTyieldrequest& request,const FMTspec& spec) const;
169 // DocString: FMTyields::getallyields
175 std::map<std::string, std::map<std::string, std::vector<double>>>getallyields(const FMTtheme& target,FMTyldtype type) const;
176 // DocString: FMTyields::operator==
180 bool operator == (const FMTyields& rhs) const;
181 // DocString: FMTyields::operator!=
185 bool operator != (const FMTyields& rhs) const;
186 // DocString: FMTyields::update
191 void update() override;
192 // DocString: FMTyields::presolve
197 FMTyields presolve(const FMTmaskfilter& filter,
198 const std::vector<FMTtheme>& originalthemes,
199 const std::vector<FMTtheme>& newthemes) const;
200 // DocString: FMTyields::getstacked
204 std::vector<std::string>getstacked() const;
205 // DocString: FMTyields::getfromfactor
211 FMTyields getfromfactor(const double& factor,
212 std::vector<std::string>yieldnames = std::vector<std::string>()) const;
213 // DocString: FMTyields::get
218 double get(const FMTyieldrequest& request,const std::string& yld) const;
219 // DocString: FMTyields::push_backagehandler
223 void push_backagehandler(const FMTmask& mask, const FMTageyieldhandler& value);
224 // DocString: FMTyields::push_backtimehandler
228 void push_backtimehandler(const FMTmask& mask, const FMTtimeyieldhandler& value);
229 };
230}
231BOOST_CLASS_EXPORT_KEY(Core::FMTyields)
232#endif // FMTYLD_H_INCLUDED
#define FMTEXPORT
Definition: FMTutility.hpp:92
Definition: FMTageyieldhandler.hpp:20
Definition: FMTlist.hpp:46
Definition: FMTmask.hpp:96
Definition: FMTmaskfilter.hpp:27
Definition: FMTbounds.hpp:342
Definition: FMTtheme.hpp:47
Definition: FMTtimeyieldhandler.hpp:21
Definition: FMTyieldrequest.hpp:36
Definition: FMTyields.hpp:40
void setactionsmappingtomodelhandlers(const std::vector< int > &actionids)
~FMTyields()=default
std::vector< std::string > getallyieldnames() const
void swap(FMTyields &rhs)
void generatedefaultyields(const std::vector< Core::FMTtheme > &themes)
void clearcache() final
bool gotyieldtype(FMTyldtype type) const
FMTyields(const FMTyields &rhs)
The Core namespace provides classes for simulating stands/strata growth/harvest through time.
Definition: FMTaction.hpp:31
FMTyldtype
Definition: FMTutility.hpp:45