FMT 1.2.0
Forest management tools for forest planning
Loading...
Searching...
No Matches
FMTConstants.h
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 FMTCON_Hm_included
9#define FMTCON_Hm_included
10
11#include <boost/unordered_map.hpp>
12#include <boost/serialization/serialization.hpp>
13#include <boost/serialization/nvp.hpp>
14#include <boost/serialization/export.hpp>
15#include <vector>
16#include <string>
17#include "FMTObject.h"
18#include "FMTExceptionHandler.h"
19
20namespace Core
21{
22// DocString: FMTConstants
28 {
29 public:
30 // DocString: FMTConstants()
35 // DocString: ~FMTConstants()
39 ~FMTConstants()=default;
40 // DocString: FMTConstants(const FMTConstants&)
46 // DocString: FMTConstants::set
52 void set(const std::string& key, std::vector<double>values);
53 // DocString: FMTConstants::get
61 template<typename T>
62 T get(std::string key, int period = 0) const;
63 // DocString: FMTConstants::getAll
70 template<typename T>
71 std::vector<T>getAll(std::string key) const;
72 // DocString: FMTConstants::isConstant
78 bool isConstant(std::string value) const;
79 // DocString: FMTConstants::length
85 size_t length(std::string value) const;
86 // DocString: FMTConstants::operator=
92 FMTConstants& operator = (const FMTConstants& rhs);
93 // DocString: FMTConstants::operator std::string
98 operator std::string() const;
99 private:
100 // DocString: FMTConstants::serialize
107 friend class boost::serialization::access;
108 template<class Archive>
109 void serialize(Archive& ar, const unsigned int version)
110 {
111 try{
112 ar & boost::serialization::make_nvp("data", m_data);
113 }catch (...)
114 {
115 _exhandler->printExceptions("", "FMTConstants::serialize", __LINE__, __FILE__);
116 }
117 }
118 // DocString: FMTConstants::m_data
120 boost::unordered_map<std::string,std::vector<double>>m_data;
121 };
122}
123
124BOOST_CLASS_EXPORT_KEY(Core::FMTConstants)
125
126#endif // FMTCON_Hm_included
#define FMTEXPORT
Definition: FMTutility.h:125
Class holding the constants defined in the constants section of a model, used by the parsers.
Definition: FMTConstants.h:28
FMTConstants(const FMTConstants &rhs)
Copy constructor for FMTConstants.
FMTConstants()
Default constructor for FMTConstants.
T get(std::string key, int period=0) const
Get the value of a given constant for a given period.
void set(const std::string &key, std::vector< double >values)
Set the values of a given constant.
~FMTConstants()=default
Default destructor for FMTConstants.
std::vector< T > getAll(std::string key) const
Get all the values of a given constant.
bool isConstant(std::string value) const
Return true if the given value is considered a constant.
size_t length(std::string value) const
Return the number of double values kept by a given constant.
Base class of multiple FMT classes holding a shared exception handler pointer and logger.
Definition: FMTObject.h:49
The Core namespace provides classes for simulating stands/strata growth/harvest through time.
Definition: FMTAction.h:34