FMT 0.9.8
Forest management tools for forest planning
Loading...
Searching...
No Matches
FMTdata.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 FMTDATA_H_INCLUDED
9#define FMTDATA_H_INCLUDED
10
11
12#include <vector>
13#include <string>
14#include <map>
15#include "FMTutility.hpp"
16#include <boost/serialization/serialization.hpp>
17#include <boost/serialization/nvp.hpp>
18#include <boost/serialization/map.hpp>
19#include <boost/serialization/vector.hpp>
20#include <boost/serialization/binary_object.hpp>
21#include <boost/serialization/export.hpp>
22#include <boost/unordered/unordered_map_fwd.hpp>
23
24namespace Core
25{
26class FMTdevelopment;
27class FMTyieldrequest;
28class FMTexpression;
29class FMTmask;
30
32 {
33 friend class boost::serialization::access;
34 template<class Archive>
35 void serialize(Archive& ar, const unsigned int version)
36 {
37 ar & BOOST_SERIALIZATION_NVP(ops);
38 ar & BOOST_SERIALIZATION_NVP(source);
39 ar & BOOST_SERIALIZATION_NVP(stacking);
40 ar & BOOST_SERIALIZATION_NVP(data);
41 }
43 std::vector<std::string>source;
44 std::vector<bool>stacking;//Stacking a string = true stacking a number = false
45 //mutable std::unique_ptr<boost::unordered_map<FMTdevelopment,double>> _cache; //hash base on (age and/or period and/or mask) //only for complex yield!!!!
46 mutable boost::unordered_map<FMTdevelopment,double>* _cache; //hash base on (age and/or period and/or mask) //only for complex yield!!!!
47 mutable bool _agebase;
48 //size_t hashdata(const int& period, const int& age, const FMTmask& mask) const;
49 FMTdevelopment getsummarydevelopment(const FMTyieldrequest& request) const;
50 public:
51 std::vector<double> data;
54 FMTdata(const FMTdata& rhs);
55 FMTdata(const std::vector<double>& lvalues,
56 const FMTyieldparserop& lops,
57 const std::vector<std::string>& lsource);
58 FMTdata(const std::vector<double>& lvalues,
59 const FMTyieldparserop& lops,
60 const std::vector<std::string>& lsource,
61 const std::vector<bool>& varstack);
62 FMTdata& operator = (const FMTdata& rhs);
64 void clearcache();
65 bool constant() const;
66 bool nulldata() const;
67 bool cachevalue(const FMTyieldrequest& request) const;
68 double get(const FMTyieldrequest& request) const;
69 void set(const double& value, const FMTyieldrequest& request, const bool& age_only) const;
70 std::vector<std::string> getsource() const;
71 std::vector<double>tovalues(const std::map<std::string, double>& sources) const;
73 bool operator == (const FMTdata& rhs) const;
74 operator std::string() const;
75 FMTdata operator * (const double& factor) const;
76 };
77}
78
79BOOST_CLASS_EXPORT_KEY(Core::FMTdata)
80
81
82#endif // FMTDATA_H_INCLUDED
#define FMTEXPORT
Definition: FMTutility.hpp:92
Definition: FMTdata.hpp:32
FMTyieldparserop getop() const
bool nulldata() const
std::vector< double > data
Definition: FMTdata.hpp:51
FMTdata(const FMTdata &rhs)
std::vector< std::string > getsource() const
bool constant() const
void clearcache()
FMTexpression toexpression() const
FMTdata(const std::vector< double > &lvalues, const FMTyieldparserop &lops, const std::vector< std::string > &lsource, const std::vector< bool > &varstack)
void set(const double &value, const FMTyieldrequest &request, const bool &age_only) const
std::vector< double > tovalues(const std::map< std::string, double > &sources) const
double get(const FMTyieldrequest &request) const
FMTdata(const std::vector< double > &lvalues, const FMTyieldparserop &lops, const std::vector< std::string > &lsource)
bool cachevalue(const FMTyieldrequest &request) const
Definition: FMTdevelopment.hpp:44
Definition: FMTexpression.hpp:19
Definition: FMTyieldrequest.hpp:36
The Core namespace provides classes for simulating stands/strata growth/harvest through time.
Definition: FMTaction.hpp:31
FMTyieldparserop
Definition: FMTutility.hpp:53