8#ifndef FMTMODELYIELDHANDLER_Hm_included
9#define FMTMODELYIELDHANDLER_Hm_included
13#include <boost/serialization/serialization.hpp>
14#include <boost/serialization/nvp.hpp>
26 class FMTTimeYieldHandler;
47 virtual operator std::string()
const;
96 void setYield(
const size_t& modelid,
const size_t& yieldid,
const std::string& yldname);
102 virtual std::unique_ptr<FMTYieldHandler>
clone()
const;
160 virtual std::unique_ptr<FMTYieldHandler>
preSolve(
const FMTMaskFilter& filter,
const std::vector<FMTTheme>& newthemes)
const;
168 virtual std::unique_ptr<FMTYieldHandler>
postSolve(
const FMTMaskFilter& filter,
const std::vector<FMTTheme>& basethemes)
const;
187 friend class boost::serialization::access;
195 template<
class Archive>
196 void serialize(Archive& ar,
const unsigned int version)
198 ar& boost::serialization::make_nvp(
"FMTyieldhandler", boost::serialization::base_object<FMTYieldHandler>(*
this));
201 std::vector<std::unique_ptr<FMTYieldModel>>m_models;
202 std::map<std::string, std::pair<size_t, size_t>,
cmpYieldString>m_yldnames;
#define FMTEXPORT
Definition: FMTutility.h:125
Filter built from masks used to preSolve and postsolve FMTMask objects.
Definition: FMTMaskFilter.h:31
Core class holding, as a boost dynamic bitset, which theme attributes are part of a mask.
Definition: FMTMask.h:96
Yield handler wrapping machine learning yield models.
Definition: FMTModelYieldHandler.h:32
virtual bool empty() const
Return true if the handler is empty.
void clearRandomYieldsCache()
Clear the cache of all random yield models.
FMTModelYieldHandler(const FMTModelYieldHandler &rhs)
Copy constructor for FMTModelYieldHandler.
virtual std::unique_ptr< FMTYieldHandler > clone() const
Clone the model yield handler.
virtual size_t size() const
Return the number of yields in the handler.
virtual bool isNullYield(const std::string &yldname) const
Return true if a yield is a null yield.
FMTTimeYieldHandler toTimeHandler() const
Convert the yield models to a time yield handler if possible.
virtual bool containsYield(const std::string &yldname) const
Return true if the handler contains a given yield.
virtual double get(const std::string &yld, const FMTYieldRequest &request) const
Get the value of a yield for a request.
void pushBackModel(const std::unique_ptr< FMTYieldModel > &model)
Push back a yield model.
~FMTModelYieldHandler()=default
Default destructor for FMTModelYieldHandler.
virtual void clearCache()
Clear the cache of the handler.
void setYield(const size_t &modelid, const size_t &yieldid, const std::string &yldname)
Set the yield name for a given model and yield id.
virtual std::unique_ptr< FMTYieldHandler > preSolve(const FMTMaskFilter &filter, const std::vector< FMTTheme > &newthemes) const
Return a presolved copy of the handler.
void setModel(Models::FMTModel *p_modelPtr)
Set the model linked to the yield models.
FMTModelYieldHandler()
Default constructor for FMTModelYieldHandler.
virtual std::vector< std::string > getYieldNames() const
Return the yield names of the handler.
FMTModelYieldHandler(const FMTMask &p_mask)
Construct a model yield handler from a mask.
std::map< std::string, size_t > getModelsNameByIndex() const
Return the model names by their index.
virtual std::unique_ptr< FMTYieldHandler > postSolve(const FMTMaskFilter &filter, const std::vector< FMTTheme > &basethemes) const
Return a postsolved copy of the handler.
virtual FMTyldtype getType() const
Return the type of the yield handler.
Yield handler for time based yields, indexed by period.
Definition: FMTTimeYieldHandler.h:25
Base class for yield handlers, holding a mask and the base ages of the yields.
Definition: FMTYieldHandler.h:80
Request for yield values using a development and optionally a graph vertex.
Definition: FMTYieldRequest.h:37
Base class for the different models in FMT.
Definition: FMTModel.h:62
The Core namespace provides classes for simulating stands/strata growth/harvest through time.
Definition: FMTAction.h:34
FMTyldtype
Enumerator describing the type of a yield (age, time, complex, model).
Definition: FMTutility.h:62
Namespace containing all enumerator and classes used to construct or manipulate the different type of...
Definition: FMTAreaParser.h:54
Comparator ordering yield names by length then by content from the end.
Definition: FMTYieldHandler.h:35