MeLOn
Loading...
Searching...
No Matches
modelParser.h
Go to the documentation of this file.
1/**********************************************************************************
2* Copyright (c) 2020 Process Systems Engineering (AVT.SVT), RWTH Aachen University
3*
4* This program and the accompanying materials are made available under the
5* terms of the Eclipse Public License 2.0 which is available at
6* http://www.eclipse.org/legal/epl-2.0.
7*
8* SPDX-License-Identifier: EPL-2.0
9*
10* @file modelParser.h
11*
12* @brief File containing declaration of the ModelParser class.
13*
14**********************************************************************************/
15
16#pragma once
17
18#include <string> // std::string
19
20#include "exceptions.h"
21#include "modelData.h"
22#include "scaler.h"
23
24namespace melon {
25
35
41 public:
51 virtual std::shared_ptr<ModelData> parse_model(const std::string modelPath, const std::string modelName = "") = 0;
52
57 virtual ~ModelParser() = default;
58
59 protected:
60 std::string _modelPath;
61 std::string _modelName;
74 std::string _format_file_path(const std::string modelPath, const std::string modelName, const MODEL_FILE_TYPE fileType);
75
83 std::string _format_folder_path(const std::string modelPath);
84
92 static SCALER_TYPE _string_to_scaler_type(const std::string scalerTypeName);
93
101 static SCALER_PARAMETER _string_to_scaler_parameter(const std::string scalerParameterName);
102 };
103
109 public:
110
118 virtual std::unique_ptr<ModelParser> create_model_parser(const MODEL_FILE_TYPE fileType = MODEL_FILE_TYPE::CSV) = 0;
119 };
120}
This class is a abstract parent class for model parser factories implemented in the MeLOn library.
Definition modelParser.h:108
virtual std::unique_ptr< ModelParser > create_model_parser(const MODEL_FILE_TYPE fileType=MODEL_FILE_TYPE::CSV)=0
Abstract factory function for creating a instance of an model parser corresponding to the specified f...
This class is a abstract parent class for model parser implemented in the MeLOn library.
Definition modelParser.h:40
static SCALER_TYPE _string_to_scaler_type(const std::string scalerTypeName)
Turns a string containing the name of an scaler type in the correct enum representation.
Definition modelParser.cpp:126
virtual ~ModelParser()=default
Virtual desctructor to enable inheritance.
std::string _modelPath
Definition modelParser.h:60
std::string _format_folder_path(const std::string modelPath)
Applies the correct format to the path given by the user.
Definition modelParser.cpp:86
std::string _format_file_path(const std::string modelPath, const std::string modelName, const MODEL_FILE_TYPE fileType)
Applies the correct format to the path given by the user.
Definition modelParser.cpp:28
static SCALER_PARAMETER _string_to_scaler_parameter(const std::string scalerParameterName)
Turns a string containing the name of an scaler type in the correct enum representation.
Definition modelParser.cpp:144
virtual std::shared_ptr< ModelData > parse_model(const std::string modelPath, const std::string modelName="")=0
Abstract function for defining the structure of the parsing function which is used to get the model d...
std::string _modelName
Definition modelParser.h:61
Definition kernel.h:21
MODEL_FILE_TYPE
Enum for representing the parsable filetypes.
Definition modelParser.h:30
@ CSV
Definition modelParser.h:31
@ XML
Definition modelParser.h:32
@ JSON
Definition modelParser.h:33
SCALER_PARAMETER
Definition scaler.h:41
SCALER_TYPE
Enum for representing the available types of scalers.
Definition scaler.h:31