8#ifndef FMTlandscapeparser_Hm_included
9#define FMTlandscapeparser_Hm_included
14#include <boost/regex.hpp>
74 std::vector<Core::FMTTheme>
readVectors(
const std::string& location);
81 std::vector<Core::FMTTheme>
readRasters(
const std::vector< std::string>& locations);
89 void write(
const std::vector<Core::FMTTheme>& themes,
const std::string& location)
const;
93 const static boost::regex m_rxcleanlans;
96 const static boost::regex m_rxindex;
99 const static boost::regex m_rxparameter;
101 const static boost::regex m_rxPreAttributes;
103 const static boost::regex m_rxPreAggregate;
111 std::map<std::string, double> _getIndexes(
112 std::string indexm_line,
118 enum class ParseState {NORMAL = 0, IN_PRE_DECLARATION = 1};
123 struct preDeclarationContext {
125 std::string currentKey;
126 std::map<std::string, std::pair<std::vector<std::string>, std::vector<std::string>>> declarations;
132 preDeclarationContext();
138 void clearTheme(std::string nameID);
148 bool _processPreDeclarationLine(
149 const std::string& line,
150 preDeclarationContext& context,
156 struct themeParsingContext {
157 std::vector<std::string> attributes;
158 std::vector<std::string> attributenames;
159 std::vector<std::string> aggregates;
160 std::vector<std::vector<std::string>> aggregatenames;
161 std::vector<std::map<std::string, double>> indexes_values;
162 std::string themename;
163 std::string aggregatename;
168 bool aggregate_redefinition;
174 themeParsingContext();
191 void _processThemeLine(
192 const boost::smatch& kmatch,
193 themeParsingContext& ctx,
194 preDeclarationContext& preContext,
195 std::vector<Core::FMTTheme>& themes,
206 void _processAggregateLine(
207 const boost::smatch& kmatch,
208 themeParsingContext& ctx,
209 std::vector<Core::FMTTheme>& themes,
218 void _processAggregateValueLine(
219 const std::string& line,
220 themeParsingContext& ctx,
221 std::vector<Core::FMTTheme>& themes);
229 void _processAttributeLine(
230 const std::string& line,
231 themeParsingContext& ctx,
#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
Parser reading and writing the landscape section, and generating themes from vector or raster files.
Definition: FMTLandscapeParser.h:34
~FMTLandscapeParser()=default
Default destructor for FMTLandscapeParser.
std::vector< Core::FMTTheme > readRasters(const std::vector< std::string > &locations)
Return the themes present in a vector of raster files, one theme per raster.
std::vector< Core::FMTTheme > readVectors(const std::string &location)
Return the themes present in a spatial vector file.
FMTLandscapeParser(const FMTLandscapeParser &rhs)=default
Copy constructor for FMTLandscapeParser.
FMTLandscapeParser()
Default constructor for FMTLandscapeParser.
std::vector< Core::FMTTheme > read(const Core::FMTConstants &constants, const std::string &location)
Read the landscape section and return the themes.
void write(const std::vector< Core::FMTTheme > &themes, const std::string &location) const
Write a landscape section from a vector of themes.
Main parent class of all the parsers in FMT.
Definition: FMTParser.h:72
The Core namespace provides classes for simulating stands/strata growth/harvest through time.
Definition: FMTAction.h:34
Namespace handling all FMT's parsers. Everything related to I/O should be located in this namespace.
Definition: FMTActionParser.h:27