OpenM++ runtime library (libopenm)
dbOutputTable.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_OUTPUT_TABLE_H
9 #define DB_OUTPUT_TABLE_H
10 
11 #include <cmath>
12 #include <cfloat>
13 #include "libopenm/db/dbCommon.h"
14 #include "dbExec.h"
15 #include "metaHolder.h"
16 
17 namespace openm
18 {
21  {
22  virtual ~IOutputTableWriter() noexcept = 0;
23 
25  static IOutputTableWriter * create(
26  int i_runId,
27  const char * i_name,
28  IDbExec * i_dbExec,
29  const MetaHolder * i_metaStore,
30  int i_subCount,
31  bool i_isSparse = false,
32  double i_nullValue = FLT_MIN
33  );
34 
36  static IOutputTableWriter * create(
37  int i_runId,
38  const char * i_name,
39  IDbExec * i_dbExec,
40  const MetaHolder * i_metaStore,
41  int i_subCount,
42  const char * i_doubleFormat = ""
43  );
44 
46  virtual size_t sizeOf(void) const noexcept = 0;
47 
49  static size_t sizeOf(const MetaHolder * i_metaStore, int i_tableId);
50 
52  virtual int expressionCount(void) const noexcept = 0;
53 
63  virtual void writeAccumulator(
64  IDbExec * i_dbExec, int i_subId, int i_accId, size_t i_size, const double * i_valueArr
65  ) = 0;
66 
68  virtual void writeAllExpressions(IDbExec * i_dbExec) = 0;
69 
71  virtual void digestOutput(IDbExec * i_dbExec) = 0;
72  };
73 
76  {
77  virtual ~IOutputTableReader() noexcept = 0;
78 
80  virtual size_t sizeOf(void) const noexcept = 0;
81 
83  virtual size_t totalSizeOf(void) const noexcept = 0;
84 
93  virtual void readTable(IDbExec * i_dbExec, bool i_isNanFill, size_t i_size, double * io_valueArr) = 0;
94  };
95 
98  {
99  virtual ~IOutputTableExprReader() noexcept = 0;
100 
103  int i_runId,
104  const char * i_name,
105  IDbExec * i_dbExec,
106  const MetaHolder * i_metaStore,
107  const char * i_expr = ""
108  );
109  };
110 
113  {
114  virtual ~IOutputTableAccReader() noexcept = 0;
115 
117  static IOutputTableAccReader * create(
118  int i_runId,
119  const char * i_name,
120  IDbExec * i_dbExec,
121  const MetaHolder * i_metaStore,
122  const char * i_acc = "",
123  const vector<int> & i_subIdArr = {}
124  );
125  };
126 }
127 
128 #endif // DB_OUTPUT_TABLE_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++ namespace
Definition: log.h:32
output table accumulators reader public interface
Definition: dbOutputTable.h:113
static IOutputTableAccReader * create(int i_runId, const char *i_name, IDbExec *i_dbExec, const MetaHolder *i_metaStore, const char *i_acc="", const vector< int > &i_subIdArr={})
output table reader factory: create new reader table accumulators reader
Definition: outputTableReader.cpp:159
output table expressions reader public interface
Definition: dbOutputTable.h:98
static IOutputTableExprReader * create(int i_runId, const char *i_name, IDbExec *i_dbExec, const MetaHolder *i_metaStore, const char *i_expr="")
output table reader factory: create new reader table expressions reader
Definition: outputTableReader.cpp:148
output table reader public interface
Definition: dbOutputTable.h:76
virtual size_t sizeOf(void) const noexcept=0
return number of values to select from the table
virtual size_t totalSizeOf(void) const noexcept=0
return output table size: total number of values in the table
virtual void readTable(IDbExec *i_dbExec, bool i_isNanFill, size_t i_size, double *io_valueArr)=0
read output table values.
output table writer public interface
Definition: dbOutputTable.h:21
virtual int expressionCount(void) const noexcept=0
return number of output aggregated expressions
virtual void writeAllExpressions(IDbExec *i_dbExec)=0
write all output table values: aggregate sub-values using table expressions
virtual void digestOutput(IDbExec *i_dbExec)=0
calculate output table values digest and store only single copy of output values
virtual size_t sizeOf(void) const noexcept=0
return total number of values for each accumulator
virtual void writeAccumulator(IDbExec *i_dbExec, int i_subId, int i_accId, size_t i_size, const double *i_valueArr)=0
write output table accumulator values
static IOutputTableWriter * create(int i_runId, const char *i_name, IDbExec *i_dbExec, const MetaHolder *i_metaStore, int i_subCount, bool i_isSparse=false, double i_nullValue=FLT_MIN)
output table writer factory to write accumulators
Definition: outputTableWriter.cpp:83
Holder for model metadata core part (not include model text).
Definition: metaHolder.h:20