OpenM++ runtime library (libopenm)
openm Namespace Reference

openM++ namespace More...

Classes

struct  AccReceive
 
struct  AggregationColumnExpr
 column aggregation expression More...
 
struct  ArgKey
 common openM++ keys for runtime arguments More...
 
struct  ArgReader
 arguments reader to get runtime arguments from command line and ini-file. More...
 
class  ChildController
 controller for child process: receive input parameters from root and send output tables. More...
 
struct  CodeValueRow
 generic two string columns: (code, value) table row. More...
 
class  DbExecBase
 base class for database connection wrapper More...
 
class  DbExecSqlite
 db connection wrapper for SQLite. More...
 
union  DbValue
 union to pass value to database methods More...
 
class  DbValueSetter
 set DbValue by casting a pointer to the value More...
 
class  DoneVector
 
struct  EmptyPackedAdapter
 pack and unpack adapter for metadata table db rows (empty implementation). More...
 
struct  EntityAttrRow
 entity_attr table row. More...
 
class  EntityAttrRowAdapter
 
class  EntityAttrTable
 
struct  EntityAttrTxtLangRow
 entity_attr_txt table row and language code. More...
 
struct  EntityAttrTxtRow
 entity_attr_txt table row. More...
 
class  EntityAttrTxtRowAdapter
 
class  EntityAttrTxtTable
 
struct  EntityDicRow
 entity_dic table row. More...
 
class  EntityDicRowAdapter
 
class  EntityDicTable
 
struct  EntityDicTxtLangRow
 entity_dic_txt table row and language code. More...
 
struct  EntityDicTxtRow
 entity_dic_txt table row. More...
 
class  EntityDicTxtRowAdapter
 
class  EntityDicTxtTable
 
struct  EntityNameSizeItem
 model entity attributes name, type, size and member offset More...
 
struct  EventIdNameItem
 model events id, name More...
 
class  exit_guard
 simple resource exit guard implementation More...
 
struct  GroupLstRow
 group_lst table row. More...
 
class  GroupLstRowAdapter
 
class  GroupLstTable
 
struct  GroupPcRow
 group_pc table row. More...
 
class  GroupPcRowAdapter
 
class  GroupPcTable
 
struct  GroupTxtLangRow
 group_txt table row and language code. More...
 
struct  GroupTxtRow
 group_txt table row. More...
 
class  GroupTxtRowAdapter
 
class  GroupTxtTable
 
class  IDbExec
 database connection wrapper to execute sql commands. More...
 
struct  IEntityAttrTable
 entity_attr table public interface. More...
 
struct  IEntityAttrTxtTable
 entity_attr_txt table public interface. More...
 
struct  IEntityDicTable
 entity_dic table public interface. More...
 
struct  IEntityDicTxtTable
 entity_dic_txt table public interface. More...
 
struct  IFinalState
 final model run state public interface: thread safe More...
 
struct  IGroupLstTable
 group_lst table public interface. More...
 
struct  IGroupPcTable
 group_pc table public interface. More...
 
struct  IGroupTxtTable
 group_txt table public interface. More...
 
struct  ILangLstTable
 lang_lst table public interface. More...
 
struct  ILangWordTable
 lang_word table public interface. More...
 
struct  ILog
 log public interface: log to console and into log files More...
 
struct  ILogBase
 base for log public interface More...
 
struct  IMetaLoadedTable
 base class for preloaded metadata db-tables More...
 
struct  IMetaRow
 base class for model metadata db-rows More...
 
struct  IMetaTable
 base class for metadata db-tables More...
 
struct  IModel
 model sub-value run public interface More...
 
struct  IModelBuilder
 public interface to build model creation script from metadata rows. More...
 
struct  IModelDicTable
 model_dic table public interface. More...
 
struct  IModelDicTxtTable
 model_dic_txt table public interface. More...
 
struct  IModelRunState
 model run state public interface: thread safe More...
 
struct  IModelWordTable
 model_word table public interface. More...
 
class  IMsgExec
 public interface for message passing More...
 
class  IMsgRecv
 public interface for message receiver More...
 
class  IMsgRecvArray
 public interface to receive value array More...
 
class  IMsgRecvPacked
 public interface to receive packed data More...
 
class  IMsgSend
 public interface for message sender More...
 
class  IMsgSendArray
 public interface to send value array More...
 
class  IMsgSendPacked
 public interface to send packed data. More...
 
struct  IniEntry
 Ini-file entry: setcion, key and value. More...
 
class  IniFileReader
 ini-file reader: load all entries in memory and provide search methods. More...
 
struct  IOutputTableAccReader
 output table accumulators reader public interface More...
 
struct  IOutputTableExprReader
 output table expressions reader public interface More...
 
struct  IOutputTableReader
 output table reader public interface More...
 
struct  IOutputTableWriter
 output table writer public interface More...
 
struct  IPackedAdapter
 public interface to pack and unpack rows of metadata db-table More...
 
struct  IParamDicTable
 parameter_dic table public interface. More...
 
struct  IParamDicTxtTable
 parameter_dic_txt table public interface. More...
 
struct  IParamDimsTable
 parameter_dims table public interface. More...
 
struct  IParamDimsTxtTable
 parameter_dims_txt table public interface. More...
 
struct  IParameterReader
 input parameter reader public interface More...
 
struct  IParameterRunWriter
 public interface of input parameter writer for model run More...
 
struct  IParameterSetWriter
 public interface of input parameter writer into workset More...
 
struct  IParamImportTable
 model_parameter_import table public interface. More...
 
struct  IProfileLstTable
 profile_lst table public interface. More...
 
struct  IProfileOptionTable
 profile_option table public interface. More...
 
class  IRowAdapter
 row factory and setter interface to select row from database More...
 
struct  IRowBase
 db-row abstract base More...
 
class  IRowProcessor
 public interafce for row processing during select, ie: select and append to row list More...
 
struct  IRunBase
 public interface to initialize model run and input parameters More...
 
struct  IRunLstTable
 run_lst table public interface. More...
 
struct  IRunOptions
 public interface to get model run options More...
 
struct  IRunOptionTable
 run_option table public interface. More...
 
struct  ITableAccTable
 table_acc table public interface. More...
 
struct  ITableAccTxtTable
 table_acc_txt table public interface. More...
 
struct  ITableDicTable
 table_dic table public interface. More...
 
struct  ITableDicTxtTable
 table_dic_txt table public interface. More...
 
struct  ITableDimsTable
 table_dims table public interface. More...
 
struct  ITableDimsTxtTable
 table_dims_txt table public interface. More...
 
struct  ITableExprTable
 table_expr table public interface. More...
 
struct  ITableExprTxtTable
 table_expr_txt table public interface. More...
 
struct  ITaskLstTable
 task_lst table public interface. More...
 
struct  ITaskRunLstTable
 task_run_lst table public interface. More...
 
struct  ITaskRunSetTable
 task_run_set table public interface. More...
 
struct  ITaskSetTable
 task_set table public interface. More...
 
struct  ITaskTxtTable
 task_txt table public interface. More...
 
struct  ITrace
 trace log public interface: model event log to console and into log files More...
 
struct  ITypeDicTable
 type_dic table public interface. More...
 
struct  ITypeDicTxtTable
 type_dic_txt table public interface. More...
 
struct  ITypeEnumLstTable
 type_enum_lst table public interface. More...
 
struct  ITypeEnumTxtTable
 type_enum_txt table public interface. More...
 
class  IUtf8Converter
 UTF-8 converter public interface. More...
 
class  IValueFormatter
 converter for value column (parameter, accumulator or expression value) to string More...
 
struct  IWorksetLstTable
 workset_lst table public interface. More...
 
struct  IWorksetParamTable
 workset_parameter table public interface. More...
 
struct  IWorksetParamTxtTable
 workset_parameter_txt table public interface. More...
 
struct  IWorksetTxtTable
 workset_txt table public interface. More...
 
struct  LangLstRow
 lang_lst table row. More...
 
class  LangLstRowAdapter
 
class  LangLstTable
 
struct  LangWordRow
 lang_word table row. More...
 
class  LangWordRowAdapter
 
class  LangWordTable
 
struct  LessNoCase
 case neutral less comparator for strings More...
 
class  Log
 log implementation class: log to console and into log files. More...
 
class  LogBase
 Log base class: log to console and into log files. More...
 
struct  MessageEllipter
 helper to return ellipted string if source string exceed max size. More...
 
struct  MetaHolder
 Holder for model metadata core part (not include model text). More...
 
class  MetaLoader
 model metadata loader: read and broadcast metadata and run options. More...
 
struct  MetaModelHolder
 Holder for model metadata db rows. More...
 
struct  MetaMpiPackedAdapter
 MPI-based adapter to pack and unpack vector of metadata db rows. More...
 
struct  MetaSetHolder
 Holder for working sets metadata. More...
 
struct  MetaSetLangHolder
 Holder for working sets metadata. More...
 
class  ModelAccumulatorSql
 class to produce accumulators sql subqueries for output table More...
 
class  ModelAggregationSql
 class to produce aggregation sql for otput table More...
 
class  ModelBase
 model sub-value run base class More...
 
class  ModelBaseExpressionSql
 base class to produce sql expressions and subqueries for otput table More...
 
struct  ModelDicLangRow
 model_dic table row and default model language code. More...
 
struct  ModelDicRow
 model_dic table row. More...
 
class  ModelDicRowAdapter
 
class  ModelDicTable
 
struct  ModelDicTxtLangRow
 model_dic_txt table row and language code. More...
 
struct  ModelDicTxtRow
 model_dic_txt table row. More...
 
class  ModelDicTxtRowAdapter
 
class  ModelDicTxtTable
 
class  ModelInsertSql
 metadata inserter class: produce sql statements and insert metadata rows into db tables. More...
 
class  ModelRunState
 model run state: thread safe More...
 
class  ModelSqlBuilder
 class to build model creation sql from metadata rows. More...
 
struct  ModelSqlWriter
 wrapper around file stream to write into sql script file. More...
 
struct  ModelWordLangRow
 model_word table row and language code. More...
 
struct  ModelWordRow
 model_word table row. More...
 
class  ModelWordRowAdapter
 
class  ModelWordTable
 
class  MpiException
 messaging library MPI exception More...
 
class  MpiExec
 message passing library main class for MPI-based implementation More...
 
class  MpiPacked
 wrapper class around of MPI_Pack and MPI_Unpack More...
 
class  MpiRecvArray
 non-blocking receive of value array More...
 
class  MpiRecvPacked
 non-blocking receive of packed data More...
 
class  MpiSendArray
 non-blocking MPI send of value array More...
 
class  MpiSendBase
 base class for non-blocking MPI send More...
 
class  MpiSendPacked
 non-blocking MPI send of packed data More...
 
class  MsgEmptyExec
 message passing main class. More...
 
class  MsgEmptyRecvArray
 non-blocking receive of value array (empty implementation) More...
 
class  MsgEmptyRecvPacked
 non-blocking receive of packed data (empty implementation) More...
 
class  MsgEmptySendArray
 non-blocking send of value array (empty implementation) More...
 
class  MsgEmptySendBase
 base class for non-blocking send (empty implementation) More...
 
class  MsgEmptySendPacked
 non-blocking send of packed data (empty implementation) More...
 
class  MsgExecBase
 message passing base class More...
 
class  OpenmException
 openM++ exceptions More...
 
class  OutputTableAccReader
 
class  OutputTableExprReader
 
class  OutputTableReader
 output table reader base class More...
 
class  OutputTableWriter
 
struct  ParamDicRow
 parameter_dic join to model_parameter_dic table row. More...
 
class  ParamDicRowAdapter
 
class  ParamDicTable
 
struct  ParamDicTxtLangRow
 parameter_dic_txt join to model_parameter_dic table row and language code. More...
 
struct  ParamDicTxtRow
 parameter_dic_txt join to model_parameter_dic table row. More...
 
class  ParamDicTxtRowAdapter
 
class  ParamDicTxtTable
 
struct  ParamDimsRow
 parameter_dims join to model_parameter_dic table row. More...
 
class  ParamDimsRowAdapter
 
class  ParamDimsTable
 
struct  ParamDimsTxtLangRow
 parameter_dims_txt table row and language code. More...
 
struct  ParamDimsTxtRow
 parameter_dims_txt join to model_parameter_dic table row. More...
 
class  ParamDimsTxtRowAdapter
 
class  ParamDimsTxtTable
 
struct  ParameterNameSizeItem
 model input parameter name, type and size More...
 
class  ParameterReader
 
class  ParameterRunWriter
 
class  ParameterSetWriter
 
class  ParameterWriter
 
struct  ParamImportRow
 parameter_dic join to model_parameter_import table row. More...
 
class  ParamImportRowAdapter
 
class  ParamImportTable
 
struct  ProcessGroupDef
 
struct  ProfileLstRow
 profile_lst table row. More...
 
class  ProfileLstRowAdapter
 
class  ProfileLstTable
 
struct  ProfileOptionRow
 profile_option table row. More...
 
class  ProfileOptionRowAdapter
 
class  ProfileOptionTable
 
class  RestartController
 controller for "restart run": calculate outstanding sub-values for existing run More...
 
class  RootController
 controller for root process: create new model run(s), send input parameters to children and receieve output tables. More...
 
class  RowContainerInserter
 row processor to append rows to sequence container, ie: to list or vector More...
 
struct  RowMpiPackedAdapter
 MPI-based adapter to pack and unpack metadata db row. More...
 
class  RunController
 run controller: create new model run(s) and support data exchange. More...
 
struct  RunGroup
 
struct  RunLstRow
 run_lst table row. More...
 
class  RunLstRowAdapter
 
class  RunLstTable
 
struct  RunOptionRow
 run_option table row. More...
 
class  RunOptionRowAdapter
 
struct  RunOptions
 basic model run options More...
 
struct  RunOptionsKey
 keys for model run options More...
 
class  RunOptionTable
 
struct  RunShortKey
 keys for model run options (short form) More...
 
struct  RunState
 model run state data: status, progress, update times More...
 
class  RunStateHolder
 sub-value run state for all modeling threads, identified by (run id, sub-value id) pair More...
 
struct  RunStateItem
 run state data for sub-value identified by run id and sub-value id More...
 
struct  RunStatus
 model run status codes More...
 
class  SingleController
 controller for single process: create new model run(s), read input parameters and write output tables. More...
 
struct  TableAccRow
 table_acc table row. More...
 
class  TableAccRowAdapter
 
class  TableAccTable
 
struct  TableAccTxtLangRow
 table_acc_txt table row and language code. More...
 
struct  TableAccTxtRow
 table_acc_txt table row. More...
 
class  TableAccTxtRowAdapter
 
class  TableAccTxtTable
 
struct  TableDicRow
 table_dic table row. More...
 
class  TableDicRowAdapter
 
class  TableDicTable
 
struct  TableDicTxtLangRow
 table_dic_txt table row and language code. More...
 
struct  TableDicTxtRow
 table_dic_txt table row. More...
 
class  TableDicTxtRowAdapter
 
class  TableDicTxtTable
 
struct  TableDimsRow
 table_dims table row. More...
 
class  TableDimsRowAdapter
 
class  TableDimsTable
 
struct  TableDimsTxtLangRow
 table_dims_txt table row and language code. More...
 
struct  TableDimsTxtRow
 table_dims_txt table row. More...
 
class  TableDimsTxtRowAdapter
 
class  TableDimsTxtTable
 
struct  TableExprRow
 table_expr table row. More...
 
class  TableExprRowAdapter
 
class  TableExprTable
 
struct  TableExprTxtLangRow
 table_expr_txt table row and language code. More...
 
struct  TableExprTxtRow
 table_expr_txt table row. More...
 
class  TableExprTxtRowAdapter
 
class  TableExprTxtTable
 
struct  TaskLstRow
 task_lst table row. More...
 
class  TaskLstRowAdapter
 
class  TaskLstTable
 
struct  TaskRunLstRow
 task_run_lst table row. More...
 
class  TaskRunLstRowAdapter
 
class  TaskRunLstTable
 
struct  TaskRunSetRow
 task_run_set table row. More...
 
class  TaskRunSetRowAdapter
 
class  TaskRunSetTable
 
struct  TaskSetRow
 task_set table row. More...
 
class  TaskSetRowAdapter
 
class  TaskSetTable
 
struct  TaskTxtLangRow
 task_txt table row and language code. More...
 
struct  TaskTxtRow
 task_txt table row. More...
 
class  TaskTxtRowAdapter
 
class  TaskTxtTable
 
class  TraceLog
 trace log implementation class: model event log to console and into log files. More...
 
struct  TypeDicRow
 type_dic join to model_type_dic table row. More...
 
class  TypeDicRowAdapter
 
class  TypeDicTable
 
struct  TypeDicTxtLangRow
 type_dic_txt join to model_type_dic table row and language code. More...
 
struct  TypeDicTxtRow
 type_dic_txt join to model_type_dic table row. More...
 
class  TypeDicTxtRowAdapter
 
class  TypeDicTxtTable
 
struct  TypeEnumLstRow
 type_enum_lst join to model_type_dic table row. More...
 
class  TypeEnumLstRowAdapter
 
class  TypeEnumLstTable
 
struct  TypeEnumTxtLangRow
 type_enum_txt join to model_type_dic table row and language code. More...
 
struct  TypeEnumTxtRow
 type_enum_txt join to model_type_dic table row. More...
 
class  TypeEnumTxtRowAdapter
 
class  TypeEnumTxtTable
 
struct  ValueArray
 microdata csv value formatter: long strings are not supported More...
 
class  ValueFormatterBase
 false boolean value as string More...
 
struct  ValueRow
 value table row: parameter, accumulators or expression tables More...
 
class  ValueRowAdapter
 Row adapter to select row from value table (parameter, accumulator or expression) More...
 
class  ValueRowDigester
 row processor to calculate digest of value table row (parameter, accumulator or expression) More...
 
class  ValueRowSparseSetter
 row processor to put values into result array from sparse db table select results More...
 
struct  WorksetLstRow
 workset_lst table row. More...
 
class  WorksetLstRowAdapter
 
class  WorksetLstTable
 
struct  WorksetParamRow
 workset_parameter join to model_parameter_dic table row. More...
 
class  WorksetParamRowAdapter
 
class  WorksetParamTable
 
struct  WorksetParamTxtLangRow
 workset_parameter_txt table row and language code. More...
 
struct  WorksetParamTxtRow
 workset_parameter_txt join to model_parameter_dic table row. More...
 
class  WorksetParamTxtRowAdapter
 
class  WorksetParamTxtTable
 
struct  WorksetTxtLangRow
 workset_txt table row and language code. More...
 
struct  WorksetTxtRow
 workset_txt table row. More...
 
class  WorksetTxtRowAdapter
 
class  WorksetTxtTable
 

Typedefs

typedef void(DbExecSqlite::* SetFieldHandler) (IRowBase *, int, const IRowAdapter &)
 
typedef ValueFormatterBase< OM_STR_DB_MAX > ValueFormatter
 
typedef ValueFormatterBase< OM_CODE_DB_MAX > ShortFormatter
 parameter, accumulator or expression value formatter
 
typedef OpenmException< 4000, msgUnknownErrorMessageMsgException
 messaging library exception
 
typedef std::map< std::string, std::string, LessNoCaseNoCaseMap
 map of key-value strings with case neutral key search
 
typedef std::set< std::string, LessNoCaseNoCaseSet
 set of strings with case neutral key search
 
typedef std::unique_ptr< IRowBaseIRowBaseUptr
 unique pointer to db row
 
typedef std::vector< IRowBaseUptrIRowBaseVec
 db rows: vector of unique pointers to db row
 
typedef std::list< IRowBaseUptrIRowBaseList
 db rows: list of unique pointers to db row
 
typedef OpenmException< 4000, dbUnknownErrorMessageDbException
 db-exception
 
typedef OpenmException< 4000, helperUnknownErrorMessageHelperException
 helper library exception
 
typedef OpenmException< 4000, modelUnknownErrorMessageModelException
 modeling library exception
 
typedef OpenmException< 4000, simulationUnknownErrorMessageSimulationException
 simulation exception
 

Enumerations

enum class  CharCvtFrom {
  defaultPage , explicitPage , utf8 , utf16Le ,
  utf16Be , utf32Le , utf32Be
}
 character conversion from current encoding to UTF-8 More...
 
enum class  FncCode {
  undefined = 0 , if_case , div_by , avg ,
  sum , count , min , max ,
  var , sd , se , cv
}
 aggregation and non-aggregation function code More...
 
enum class  MsgTag {
  unused = 0 , initial , statusUpdate , microdataSize ,
  microdata , langLst = 32 , langWord , modelDic ,
  typeDic , typeEnumLst , parameterDic , parameterDims ,
  tableDic , tableDims , tableAcc , tableExpr ,
  entityDic , entityAttr , runOption , codeValue ,
  outSubValueBase = 128
}
 tag to identify message content More...
 
enum class  ExitStatus : int {
  OK = 0 , FAIL = 1 , HELPER_ERROR = 4 , MSG_ERROR = 8 ,
  DB_ERROR = 12 , MODEL_ERROR = 16 , SIMULATION_ERROR = 32
}
 model exit status More...
 
enum class  ModelStatus : int {
  undefined = 0 , init = 1 , progress , waitProgress ,
  shutdown , done = 64 , exit , error = 128
}
 modeling job status More...
 

Functions

uint32_t calculateNextCrc32 (uint32_t i_initialCrc, const void *i_data, size_t i_dataSize)
 calculate CRC-32 on next data block of bytes
 
string crc32String (const string &i_source)
 return CRC-32 of source string
 
template<typename TValue >
int FormatHandler (const void *i_value, size_t i_size, char *io_buffer, const char *i_format)
 convert value to string using snprintf: integer and float values.
 
template<typename TValue >
int FloatSqlFormatHandler (const void *i_value, size_t i_size, char *io_buffer, const char *i_format)
 convert value to string using snprintf: integer and float values.
 
int BoolFormatHandler (const void *i_value, size_t i_size, char *io_buffer)
 convert bool value to string: return "true" or "false" More...
 
int BoolSqlFormatHandler (const void *i_value, size_t i_size, char *io_buffer)
 convert bool value to SQL constant: return "1" or "0"
 
int StrFormatHandler (const void *i_value, size_t i_size, char *io_buffer)
 convert value to string: make a copy of source string More...
 
int StrSqlFormatHandler (const void *i_value, size_t i_size, char *io_buffer)
 convert string value into SQL constant: return 'quoted source value'
 
bool isFileExists (const char *i_filePath)
 return true if file or directory exists More...
 
void openInpStream (std::ifstream &io_inpSt, const char *i_filePath, std::ios_base::openmode i_mode)
 open input file stream More...
 
void openOutStream (std::ofstream &io_outSt, const char *i_filePath, std::ios_base::openmode i_mode)
 open output file stream More...
 
const std::string baseDirOf (const std::string &i_path)
 return base directory of the path or empty string if path is "." or ".."
 
const std::string baseDirOf (const char *i_path)
 return base directory of the path or empty string if path is "." or ".."
 
const std::string makeDefaultPath (const char *i_exePath, const char *i_extension)
 make path from current working directory, executable name and specified extension. More...
 
std::string const makeFilePath (const char *i_dirPath, const char *i_name, const char *i_extension=nullptr)
 make path by join directory, file name and specified extension. More...
 
const std::string toUtf8 (const char *i_byteArr, const char *i_codePageName=nullptr)
 convert null-terminated bytes from current user (or specified) code page to UTF-8 string. More...
 
const std::string toUtf8 (size_t i_size, const char *i_byteArr, const char *i_codePageName=nullptr)
 convert bytes from current user (or specified) code page to UTF-8 string. More...
 
bool isUtf8 (size_t i_size, const char *i_byteArr)
 return true if bytes are valid UTF-8 More...
 
const std::string fileToUtf8 (const char *i_filePath, const char *i_codePageName=nullptr)
 read file and return content as UTF-8 as string More...
 
const std::list< std::string > fileToUtf8Lines (const char *i_filePath, const char *i_codePageName=nullptr)
 read file, split by linefeed
and return content as list of UTF-8 as strings More...
 
void toLower (std::string &io_str, const std::locale &i_locale=std::locale(""))
 convert string to lower case
 
void toLower (char *io_str, const std::locale &i_locale=std::locale(""))
 convert string to lower case
 
void toUpper (std::string &io_str, const std::locale &i_locale=std::locale(""))
 convert string to upper case
 
void toUpper (char *io_str, const std::locale &i_locale=std::locale(""))
 convert string to upper case
 
int compareNoCase (const char *i_left, const char *i_right, size_t i_length=0)
 case neutral string comparison
 
bool equalNoCase (const char *i_left, const char *i_right, size_t i_length=0)
 case neutral string equal comparison
 
bool startWithNoCase (const std::string &i_str, const char *i_start)
 check if string start with i_start, using case neutral string comparison
 
bool endWithNoCase (const std::string &i_str, const char *i_end)
 check if string end with i_end, using case neutral string comparison
 
std::string trimLeft (const std::string &i_str, const std::locale &i_locale=std::locale(""))
 trim leading blank and space characters
 
std::string trimRight (const std::string &i_str, const std::locale &i_locale=std::locale(""))
 trim trailing blank and space characters
 
std::string trim (const std::string &i_str, const std::locale &i_locale=std::locale(""))
 trim leading and trailing blank and space characters
 
void blankCrLf (std::string &io_str)
 replace all <cr> or <lf> with blank space character
 
const std::string toQuoted (const std::string &i_str, char i_quote='\'')
 make quoted string using sql single ' quote by default, ie: 'O''Brien'
 
const std::string toUnQuoted (const std::string &i_str, char i_quote='\'', const std::locale &i_locale=std::locale(""))
 make unquoted string using sql single ' quote by default, ie: 'O''Brien' into O'Brien
 
const std::string toString (double i_val)
 convert float type to string: exist to fix std::to_string conversion losses.
 
const std::string toAlphaNumeric (const std::string &i_str, int i_maxSize=0)
 replace all non [A-Z,a-z,0-9] by _ underscore and remove repetitive underscores.
 
const std::string cleanPathChars (const std::string &i_str, int i_maxSize=0)
 replace all non non-printable and any of "'`$}{><:|?*&^;/\ by _ underscore.
 
const std::string replaceAll (const std::string &i_src, const char *i_oldValue, const char *i_newValue)
 replace all occurence of i_oldValue by i_newValue, both old and new values must be not empty
 
bool isBoolType (const char *i_typeName)
 return true if model type is boolean (logical)
 
bool isStringType (const char *i_typeName)
 return true if model type is string (varchar)
 
bool isBigIntType (const char *i_typeName)
 return true if model type is bigint (64 bit)
 
bool isIntType (const char *i_typeName, int i_typeId)
 return true if model type is integer: not float, string, boolean, bigint (if type is not a built-in then it must be integer enums)
 
bool isBuiltInType (int i_typeId)
 return true if model type id is built-in type id, ie: int, double, logical
 
bool isFloatType (const char *i_typeName)
 return true if model type is float (float, real, double or time)
 
bool isTimeType (const char *i_typeName)
 return true if model type is Time
 
bool isIntValid (const char *i_value)
 return true if i_value string represent valid integer constant
 
bool isFloatValid (const char *i_value)
 return true if i_value string represent valid floating point constant
 
bool isBoolTrue (const char *i_str)
 return true if lower case of source string one of: "yes" "1" "true"
 
bool isBoolValid (const char *i_str)
 return true if lower case of source string one of: "yes" "1" "true" "no" "0" "false"
 
int boolStringToInt (const char *i_value)
 convert i_value string represnting boolean option and return one of:
return 1 if i_value is one of: "yes", "1", "true" or empty "" value,
return 0 if i_value is one of: "no", "0", "false",
return -1 if i_value is nullptr,
return -2 otherwise.
 
ptrdiff_t memCopyTo (uint8_t *io_dst, ptrdiff_t i_offset, const void *i_src, size_t i_size)
 copy bytes source into destination and return next destination offset
 
const std::string makeDateTime (const std::chrono::system_clock::time_point &i_time)
 make date-time string, ie: 2012-08-17 16:04:59.148
 
const std::string makeTimeStamp (const std::chrono::system_clock::time_point &i_time)
 make timestamp string, ie: 2012_08_17_16_04_59_148
 
const std::string toDateTimeString (const std::string &i_timestamp)
 make date-time string from timestamp string, ie: 2012_08_17_16_04_59_148 => 2012-08-17 16:04:59.148
 
void formatTo (size_t i_size, char *io_buffer, const char *i_format, va_list io_args)
 format message into supplied buffer using vsnprintf()
 
std::string formatToString (const char *i_format,...)
 format message into string result using vsnprintf()
 
const char * elliptString (const char *i_src, size_t i_size, char *io_buffer)
 if source string exceed max size than return ellipted copy into the buffer
 
const std::string normalizeLanguageName (const std::string &i_srcLanguage)
 normalize language name by removing encoding part, replace _ by - and lower case: "en-ca" from "en_CA.UTF-8"
 
const std::list< std::string > splitLanguageName (const std::string &i_srcLanguage)
 normalize language name and split it into list of prefered languages: en_CA => [en-ca, en]
 
std::list< std::string > splitCsv (const std::string &i_values, const char *i_delimiters=",", bool i_isUnquote=false, char i_quote='\'')
 split and trim comma-separated list of values (other delimiters can be used too, ie: semicolon). More...
 
void splitCsv (const std::string &i_values, std::list< std::string > &io_resultLst, const char *i_delimiters=",", bool i_isUnquote=false, char i_quote='\'', const std::locale &i_locale=std::locale(""))
 split and trim comma-separated list of values (other delimiters can be used too, ie: semicolon). More...
 
int64_t getMilliseconds (void)
 return number of milliseconds since epoch to measure intervals
 
const std::string getDefaultLocaleName (void)
 get user prefered locale name: en-CA en-CA or empty "" string on error
 
std::tuple< uint64_t, uint64_t > getProcessMemorySize (void)
 return current process memory size and max peak memory size, in bytes. More...
 
template<typename TVal >
std::vector< TVal > read_om_parameter (IRunBase *const i_runBase, const char *i_name)
 read scalar parameter value or all sub-values for the current process
 
template<typename TVal >
std::vector< std::unique_ptr< TVal[]> > read_om_parameter (IRunBase *const i_runBase, const char *i_name, size_t i_size)
 read array parameter value or all sub-values for the current process
 

Variables

recursive_mutex dbMutex
 mutex to lock database operations
 
const char * nullValueString = "null"
 
const char * trueValueString = "true"
 NULL value as string.
 
const char * falseValueString = "false"
 true boolean value as string
 
const char msgUnknownErrorMessage [] = "unknown messaging error"
 messaging library default error message: "unknown messaging error"
 
recursive_mutex msgMutex
 mutex to lock messaging operations
 
const char * SQLITE_DB_PROVIDER = "sqlite"
 SQLite db-provider name.
 
const char * MYSQL_DB_PROVIDER = "mysql"
 MySQL and MariaDB db-provider name.
 
const char * PGSQL_DB_PROVIDER = "postgresql"
 PostgreSQL db-provider name.
 
const char * MSSQL_DB_PROVIDER = "mssql"
 MS SQL db-provider name.
 
const char * ORACLE_DB_PROVIDER = "oracle"
 Oracle db-provider name.
 
const char * DB2_DB_PROVIDER = "db2"
 DB2 db-provider name.
 
const char dbUnknownErrorMessage [] = "unknown db error"
 db-exception default error message: "unknown db error"
 
const char helperUnknownErrorMessage [] = "unknown error in helper method"
 helper library exception default error message: "unknown error in helper method" More...
 
const size_t PARAMETER_NAME_ARR_LEN
 size of parameters list: number of model input parameters
 
const ParameterNameSizeItem parameterNameSizeArr []
 model input parameters name, type and size
 
const size_t ENTITY_NAME_SIZE_ARR_LEN
 size of entity attributes list: all attributes of all entities
 
const EntityNameSizeItem EntityNameSizeArr []
 list of entity attributes name, type, size and member offset
 
const EventIdNameItem EventIdNameArr []
 list of events id, name
 
const size_t EVENT_ID_NAME_ARR_LEN
 size of event list: all events in all entities
 
const char modelUnknownErrorMessage [] = "unknown model error"
 default error message: "unknown model error" More...
 
const char simulationUnknownErrorMessage [] = "unknown error in simulation"
 simulation exception default error message: "unknown error in simulation" More...
 

Detailed Description

openM++ namespace

upper bound microdata row count to save in database

Enumeration Type Documentation

◆ CharCvtFrom

enum class openm::CharCvtFrom
strong

character conversion from current encoding to UTF-8

Enumerator
defaultPage 

current user code page (encoding)

explicitPage 

code page (encoding) specified by name

utf8 

UTF-8.

utf16Le 

UTF-16LE.

utf16Be 

UTF-16LE.

utf32Le 

UTF-16LE.

utf32Be 

UTF-16LE.

◆ ExitStatus

enum class openm::ExitStatus : int
strong

model exit status

Enumerator
OK 

completed successfully

FAIL 

unknown error

HELPER_ERROR 

helper exception: low level error from openM++ runtime

MSG_ERROR 

messaging exception: message passing (MPI) error

DB_ERROR 

database exception: database error from openM++ runtime or database vendor

MODEL_ERROR 

model exception: top level error from openM++ runtime

SIMULATION_ERROR 

simulation exception raised in model code

◆ FncCode

enum class openm::FncCode
strong

aggregation and non-aggregation function code

Enumerator
undefined 

undefined function

if_case 

if condition then value else other value

div_by 

divide by: wrap value as divisor

avg 

average value

sum 

sum of values

count 

count of values

min 

minimal value

max 

maximum value

var 

variance

sd 

standard deviation

se 

standard error

cv 

coefficient of variation

◆ ModelStatus

enum class openm::ModelStatus : int
strong

modeling job status

Enumerator
undefined 

unknown status

init 

initial status

progress 

run in progress

waitProgress 

run in progress, under external supervision

shutdown 

shutdown model process

done 

completed successfully

exit 

exit and not completed (reserved)

error 

error failure

◆ MsgTag

enum class openm::MsgTag
strong

tag to identify message content

Enumerator
unused 

reserved and should not be used

initial 

initial message at process start

statusUpdate 

modeling job status

microdataSize 

microdata row count for each entity

microdata 

microdata entity rows

langLst 

lang_lst db rows

langWord 

lang_word db rows

modelDic 

model_dic db rows

typeDic 

type_dic db rows

typeEnumLst 

type_enum_lst db rows

parameterDic 

parameter_dic db rows

parameterDims 

parameter_dims db rows

tableDic 

table_dic db rows

tableDims 

table_dims db rows

tableAcc 

table_acc db rows

tableExpr 

table_expr db rows

entityDic 

entity_dic db rows

entityAttr 

entity_attr db rows

runOption 

run_option db rows

codeValue 

generic (code,value) db rows

outSubValueBase 

input parameter

output table sub-value base

Function Documentation

◆ BoolFormatHandler()

int openm::BoolFormatHandler ( const void *  i_value,
size_t  i_size,
char *  io_buffer 
)

convert bool value to string: return "true" or "false"

convert bool value to string : return "true" or "false"

◆ fileToUtf8()

const string openm::fileToUtf8 ( const char *  i_filePath,
const char *  i_codePageName = nullptr 
)

read file and return content as UTF-8 as string

read file and return content as UTF-8 as string.

Parameters
[in]i_filePathpath to the file
[in]i_codePageName(optional) name of encoding or Windows code page, ie: English_US.1252
Returns
file content as UTF-8 string.

◆ fileToUtf8Lines()

const list< string > openm::fileToUtf8Lines ( const char *  i_filePath,
const char *  i_codePageName = nullptr 
)

read file, split by linefeed
and return content as list of UTF-8 as strings

read file, split by linefeed
and return content as list of UTF-8 as strings.

Parameters
[in]i_filePathpath to the file
[in]i_codePageName(optional) name of encoding or Windows code page, ie: English_US.1252
Returns
file content as UTF-8 string.

◆ getProcessMemorySize()

std::tuple< uint64_t, uint64_t > openm::getProcessMemorySize ( void  )

return current process memory size and max peak memory size, in bytes.

if return value is zero then memory information not avaliable.

usage example:

auto [nMem, nMax] = getProcessMemorySize();
if (nMem > 0) theLog->logFormatted(LT("Current memory size: %f MB"), ((double)nMem / (1024.0 * 1024.0)));
if (nMax > 0) theLog->logFormatted(LT("Maximum memory size: %f MB"), ((double)nMax / (1024.0 * 1024.0)));
ILog * theLog
public log interface
Definition: log.cpp:28
std::tuple< uint64_t, uint64_t > getProcessMemorySize(void)
return current process memory size and max peak memory size, in bytes.
Definition: os.cpp:11
#define LT(sourceMessage)
LT localisation function: return is temporary const char* and must be copied to avoid memory violatio...
Definition: omLog.h:133
virtual void logFormatted(const char *i_format,...) noexcept=0
log message formatted with vsnprintf()

◆ isFileExists()

bool openm::isFileExists ( const char *  i_filePath)

return true if file or directory exists

return true if file or directory exists

◆ isUtf8()

bool openm::isUtf8 ( size_t  i_size,
const char *  i_byteArr 
)

return true if bytes are valid UTF-8

return true if bytes are valid UTF-8.

See table in Description section of article https://en.wikipedia.org/wiki/UTF-8

Parameters
[in]i_sizenumber of bytes to convert
[in]i_byteArrsource bytes
Returns
true if valid UTF-8.

◆ makeDefaultPath()

const string openm::makeDefaultPath ( const char *  i_exePath,
const char *  i_extension 
)

make path from current working directory, executable name and specified extension.

Parameters
i_exePathfull pathname of the executable file.
i_extensionnew file extension.
Returns
path combined as current working directory, executable name and specified extension.

For example: C:\bin\modelOne.exe => D:\work\dir\modelOne.log

◆ makeFilePath()

const string openm::makeFilePath ( const char *  i_dirPath,
const char *  i_name,
const char *  i_extension = nullptr 
)

make path by join directory, file name and specified extension.

Parameters
i_dirPathpath or directory.
i_namefile name.
i_extensionfile extension, if not a null.
Returns
path combined as directory/name.extension

It does replace all \ with / even in "special\ path/", except of leading \ slashes For example: input\ ageSex csv => input/ageSex.csv \host\share ageSex.csv => \host/share.ageSex.csv

Parameters
i_dirPathpath or directory.
i_namefile name.
i_extensionfile extension, if not a null.
Returns
path combined as directory/name.extension

It does remove all trailing dots ... from file name. If i_dirPath not empty file name expected to be a relative path, not an absolute and any leading / or \ are removed.

◆ openInpStream()

void openm::openInpStream ( std::ifstream &  io_inpSt,
const char *  i_filePath,
std::ios_base::openmode  i_mode 
)

open input file stream

Windows-specific: if file path is UTF-8 then convert it to UTF-16LE

◆ openOutStream()

void openm::openOutStream ( std::ofstream &  io_outSt,
const char *  i_filePath,
std::ios_base::openmode  i_mode 
)

open output file stream

Windows-specific: if file path is UTF-8 then convert it to UTF-16LE

◆ splitCsv() [1/2]

std::list< std::string > openm::splitCsv ( const std::string &  i_values,
const char *  i_delimiters = ",",
bool  i_isUnquote = false,
char  i_quote = '\'' 
)

split and trim comma-separated list of values (other delimiters can be used too, ie: semicolon).

RFC 4180 difference: it does skip space-only lines and trim values unless it is " quoted ".

Parameters
[in]i_valuessource string of comma separated values.
[in]i_delimiterslist of delimiters, default: comma.
[in]i_isUnquoteif true then do "unquote ""csv"" ", default: false.
[in]i_quotequote character, default: sql single ' quote.

◆ splitCsv() [2/2]

void openm::splitCsv ( const std::string &  i_values,
std::list< std::string > &  io_resultLst,
const char *  i_delimiters = ",",
bool  i_isUnquote = false,
char  i_quote = '\'',
const std::locale &  i_locale = std::locale("") 
)

split and trim comma-separated list of values (other delimiters can be used too, ie: semicolon).

RFC 4180 difference: it does skip space-only lines and trim values unless it is " quoted ".

Parameters
[in]i_valuessource string of comma separated values.
[in,out]io_resultLstsource string of comma separated values.
[in]i_delimiterslist of delimiters, default: comma.
[in]i_isUnquoteif true then do "unquote ""csv"" ", default: false.
[in]i_quotequote character, default: sql single ' quote.
[in]i_localelocale to trim space characters, defaut: user default locale.

◆ StrFormatHandler()

int openm::StrFormatHandler ( const void *  i_value,
size_t  i_size,
char *  io_buffer 
)

convert value to string: make a copy of source string

convert varchar value to string: make a copy of source string

◆ toUtf8() [1/2]

const string openm::toUtf8 ( const char *  i_byteArr,
const char *  i_codePageName = nullptr 
)

convert null-terminated bytes from current user (or specified) code page to UTF-8 string.

Parameters
[in]i_byteArrsource bytes
[in]i_codePageName(optional) name of encoding or Windows code page, ie: English_US.1252
Returns
UTF-8 string.

◆ toUtf8() [2/2]

const string openm::toUtf8 ( size_t  i_size,
const char *  i_byteArr,
const char *  i_codePageName = nullptr 
)

convert bytes from current user (or specified) code page to UTF-8 string.

Parameters
[in]i_sizenumber of bytes to convert
[in]i_byteArrsource bytes
[in]i_codePageName(optional) name of encoding or Windows code page, ie: English_US.1252
Returns
UTF-8 string.

Variable Documentation

◆ helperUnknownErrorMessage

const char openm::helperUnknownErrorMessage = "unknown error in helper method"
extern

helper library exception default error message: "unknown error in helper method"

helper exception default error message

◆ modelUnknownErrorMessage

const char openm::modelUnknownErrorMessage = "unknown model error"
extern

default error message: "unknown model error"

model exception default error message

◆ simulationUnknownErrorMessage

const char openm::simulationUnknownErrorMessage = "unknown error in simulation"
extern

simulation exception default error message: "unknown error in simulation"

simulation exception default error message