OpenM++ runtime library (libopenm)
dbParameter.h
Go to the documentation of this file.
1
5// Copyright (c) 2013-2015 OpenM++
6// This code is licensed under the MIT license (see LICENSE.txt for details)
7
8#ifndef DB_PARAMETER_H
9#define DB_PARAMETER_H
10
13#include "dbExec.h"
14#include "metaHolder.h"
16
17namespace openm
18{
21 {
22 virtual ~IParameterReader() noexcept = 0;
23
25 static IParameterReader * create(
26 int i_runId,
27 const char * i_name,
28 IDbExec * i_dbExec,
29 const MetaHolder * i_metaStore
30 );
31
33 virtual int parameterId(void) const noexcept = 0;
34
36 virtual size_t sizeOf(void) const noexcept = 0;
37
47 virtual void readParameter(
48 IDbExec * i_dbExec, int i_subId, const type_info & i_type, size_t i_size, void * io_valueArr
49 ) = 0;
50
60 virtual void readParameter(
61 IDbExec * i_dbExec, const type_info & i_type, int i_subCount, size_t i_size, void * io_valueArr
62 ) = 0;
63
73 virtual void readParameter(
74 IDbExec * i_dbExec, const vector<int> & i_subIdArr, const type_info & i_type, size_t i_size, void * io_valueArr
75 ) = 0;
76 };
77
80 {
81 virtual ~IParameterSetWriter() noexcept = 0;
82
85 int i_setId,
86 const char * i_name,
87 IDbExec * i_dbExec,
88 const MetaHolder * i_metaStore,
89 const MetaSetHolder * i_metaSet
90 );
91
93 virtual size_t sizeOf(void) const noexcept = 0;
94
103 virtual void writeParameter(
104 IDbExec * i_dbExec, const type_info & i_type, int i_subCount, size_t i_size, void * i_valueArr
105 ) = 0;
106 };
107
110 {
111 virtual ~IParameterRunWriter() noexcept = 0;
112
115 int i_runId,
116 const char * i_name,
117 IDbExec * i_dbExec,
118 const MetaHolder * i_metaStore,
119 const char * i_doubleFormat = ""
120 );
121
123 virtual size_t sizeOf(void) const noexcept = 0;
124
133 virtual void writeParameter(
134 IDbExec * i_dbExec, const type_info & i_type, int i_subCount, size_t i_size, void * i_valueArr
135 ) = 0;
136
147 virtual void loadCsvParameter(IDbExec * i_dbExec, const vector<int> & i_subIdArr, const char * i_filePath, bool i_isIdCsv = false) = 0;
148
156 virtual void digestParameter(IDbExec * i_dbExec, int i_subCount, const type_info & i_type) = 0;
157 };
158}
159
160#endif // DB_PARAMETER_H
database connection wrapper to execute sql commands.
Definition: dbExec.h:21
OpenM++ data library: public interface for db common structures.
OpenM++ data library: public interface.
OpenM++ modeling library: holder struct for metadata tables used by model.
OpenM++ modeling library: holder struct for working sets metadata.
openM++ namespace
Definition: log.h:32
OpenM++ common file utilities.
input parameter reader public interface
Definition: dbParameter.h:21
virtual int parameterId(void) const noexcept=0
return input parameter id
virtual size_t sizeOf(void) const noexcept=0
return input parameter size for single sub value
static IParameterReader * create(int i_runId, const char *i_name, IDbExec *i_dbExec, const MetaHolder *i_metaStore)
input parameter reader factory
Definition: parameterReader.cpp:65
virtual void readParameter(IDbExec *i_dbExec, const vector< int > &i_subIdArr, const type_info &i_type, size_t i_size, void *io_valueArr)=0
read input parameter single selected sub values.
virtual void readParameter(IDbExec *i_dbExec, const type_info &i_type, int i_subCount, size_t i_size, void *io_valueArr)=0
read all sub values of input parameter.
virtual void readParameter(IDbExec *i_dbExec, int i_subId, const type_info &i_type, size_t i_size, void *io_valueArr)=0
read input parameter single sub value.
public interface of input parameter writer for model run
Definition: dbParameter.h:110
virtual void digestParameter(IDbExec *i_dbExec, int i_subCount, const type_info &i_type)=0
calculate run parameter values digest and store only single copy of parameter values.
virtual void writeParameter(IDbExec *i_dbExec, const type_info &i_type, int i_subCount, size_t i_size, void *i_valueArr)=0
write parameter: write all sub values of the parameter into db run table
virtual size_t sizeOf(void) const noexcept=0
return input parameter size for single sub value
static IParameterRunWriter * create(int i_runId, const char *i_name, IDbExec *i_dbExec, const MetaHolder *i_metaStore, const char *i_doubleFormat="")
input parameter writer factory
Definition: parameterWriter.cpp:133
virtual void loadCsvParameter(IDbExec *i_dbExec, const vector< int > &i_subIdArr, const char *i_filePath, bool i_isIdCsv=false)=0
load parameter values from csv file into run table, it can be any of: .csv .tsv .id....
public interface of input parameter writer into workset
Definition: dbParameter.h:80
virtual size_t sizeOf(void) const noexcept=0
return input parameter size for single sub value
static IParameterSetWriter * create(int i_setId, const char *i_name, IDbExec *i_dbExec, const MetaHolder *i_metaStore, const MetaSetHolder *i_metaSet)
input parameter writer factory
Definition: parameterWriter.cpp:121
virtual void writeParameter(IDbExec *i_dbExec, const type_info &i_type, int i_subCount, size_t i_size, void *i_valueArr)=0
write parameter: write all sub values of the parameter into db set table
Holder for model metadata core part (not include model text).
Definition: metaHolder.h:20
Holder for working sets metadata.
Definition: metaSetHolder.h:19