FMT 1.2.0
Forest management tools for forest planning
Loading...
Searching...
No Matches
FMTBaseVertexProperties.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 FMTbasevertexproperties_Hm_included
9#define FMTbasevertexproperties_Hm_included
10
11
12
13#include <boost/serialization/serialization.hpp>
14#include <boost/functional/hash.hpp>
15#include <boost/serialization/export.hpp>
16#include <boost/serialization/nvp.hpp>
17#include <memory>
18#include "FMTutility.h"
19
20
21namespace Core {
22 class FMTActualDevelopment;
23 class FMTFuturDevelopment;
24 class FMTMask;
25 class FMTDevelopment;
26}
27
28
29
30namespace Graph
31{
33 {
34 public:
35 // DocString: FMTBaseVertexProperties::~FMTBaseVertexProperties
39 virtual ~FMTBaseVertexProperties() = default;
40 // DocString: FMTBaseVertexProperties::FMTBaseVertexProperties()
45 // DocString: FMTBaseVertexProperties::FMTBaseVertexProperties(const FMTBaseVertexProperties&)
51 // DocString: FMTBaseVertexProperties::operator=
58 // DocString: FMTBaseVertexProperties::FMTBaseVertexProperties(const Core::FMTFuturDevelopment&)
64 // DocString: FMTBaseVertexProperties::FMTBaseVertexProperties(const Core::FMTActualDevelopment&)
70 //FMTBaseVertexProperties(const Core::FMTDevelopment& p_development);
71 // DocString: FMTBaseVertexProperties::setDevlopementMask
76 void setDevlopementMask(const Core::FMTMask& p_newMask);
77 // DocString: FMTBaseVertexProperties::getBaseRhs
82 double getBaseRhs() const;
83 // DocString: FMTBaseVertexProperties::getConstraintId
88 virtual int getConstraintId() const;
89 // DocString: FMTBaseVertexProperties::get
94 const Core::FMTDevelopment& get() const;
95 // DocString: FMTBaseVertexProperties::hash
100 size_t hash() const;
101 // DocString: FMTBaseVertexProperties::operator<
107 bool operator < (const FMTBaseVertexProperties& rhs) const;
108 // DocString: FMTBaseVertexProperties::operator==
114 bool operator == (const FMTBaseVertexProperties& rhs) const;
115 // DocString: FMTBaseVertexProperties::operator!=
121 bool operator != (const FMTBaseVertexProperties& rhs) const;
122 private:
123 // DocString: FMTBaseVertexProperties::serialize
130 friend class boost::serialization::access;
131 template<class Archive>
132 void serialize(Archive& ar, unsigned int version)
133 {
134 double area = getBaseRhs();
135 ar& BOOST_SERIALIZATION_NVP(*m_development);
136 ar& BOOST_SERIALIZATION_NVP(area);
137 if (Archive::is_saving::value)
138 {
139 _save(area);
140 }
141 }
142 // DocString: FMTBaseVertexProperties::m_development
144 std::unique_ptr<Core::FMTDevelopment> m_development;
145 // DocString: FMTBaseVertexProperties::_save
150 void _save(double p_area);
151 };
152}
153
154
155 BOOST_CLASS_EXPORT_KEY(Graph::FMTBaseVertexProperties)
156
157
158 namespace boost {
159
160 template <>
161 struct hash<Graph::FMTBaseVertexProperties>
162 {
163 std::size_t operator()(const Graph::FMTBaseVertexProperties& vertex_properties) const
164 {
165 return vertex_properties.hash();
166 }
167 };
168
169
170}
171
172
173#endif
#define FMTEXPORT
Definition: FMTutility.h:125
Child class of FMTDevelopment representing an actual forest stand, holding the area of the stand.
Definition: FMTActualDevelopment.h:24
Base class of FMTActualDevelopment and FMTFuturDevelopment representing a forest stand.
Definition: FMTDevelopment.h:44
Child class of FMTDevelopment representing a future stand generated by growth or transition,...
Definition: FMTFuturDevelopment.h:23
Core class holding, as a boost dynamic bitset, which theme attributes are part of a mask.
Definition: FMTMask.h:96
Definition: FMTBaseVertexProperties.h:33
size_t hash() const
Hash the development of the vertex.
FMTBaseVertexProperties(const FMTBaseVertexProperties &rhs)
Copy constructor for FMTBaseVertexProperties.
double getBaseRhs() const
Get the right hand side of the constraint of the vertex.
virtual ~FMTBaseVertexProperties()=default
Default virtual destructor for FMTBaseVertexProperties.
FMTBaseVertexProperties(const Core::FMTFuturDevelopment &p_development)
Construct a FMTBaseVertexProperties from a futur development.
void setDevlopementMask(const Core::FMTMask &p_newMask)
Set the development mask of the vertex.
FMTBaseVertexProperties(const Core::FMTActualDevelopment &p_development)
Construct a FMTBaseVertexProperties from an actual development.
FMTBaseVertexProperties()=default
Default constructor for FMTBaseVertexProperties.
virtual int getConstraintId() const
Get the index of the constraint of the vertex.
const Core::FMTDevelopment & get() const
Get a const reference to the development of the vertex.
The Core namespace provides classes for simulating stands/strata growth/harvest through time.
Definition: FMTAction.h:34
Definition: FMTAreaParser.h:35
Definition: FMTAction.h:463
std::size_t operator()(const Graph::FMTBaseVertexProperties &vertex_properties) const
Definition: FMTBaseVertexProperties.h:163