22 #ifndef __HERMES_COMMON_MIXINS_H
23 #define __HERMES_COMMON_MIXINS_H
50 virtual bool isOkay()
const = 0;
53 virtual std::string getClassName()
const = 0;
65 typedef void(*callbackFn)(
const char*);
68 Loggable(
bool verbose_output =
false, callbackFn verbose_callback = NULL,
bool add_newline =
true);
70 void set_file_output_only(
bool onOff);
72 void set_timestamps(
bool onOff);
74 void set_erase_on_beginning(
bool onOff);
75 void set_logFile_name(
const char* filename);
76 void set_logFile_name(std::string filename);
77 static void set_static_logFile_name(
const char* filename);
78 static void set_static_logFile_name(std::string filename);
80 void info(
const char* msg, ...)
const;
81 void info_if(
bool cond,
const char* msg, ...)
const;
82 void warn(
const char* msg, ...)
const;
83 void warn_if(
bool cond,
const char* msg, ...)
const;
84 void error(
const char* msg, ...)
const;
85 void error_if(
bool cond,
const char* msg, ...)
const;
89 virtual void set_verbose_output(
bool to_set);
92 bool get_verbose_output()
const;
97 virtual void set_verbose_callback(callbackFn callback);
100 callbackFn get_verbose_callback()
const;
106 static void info(
const char* msg, ...);
107 static void warn(
const char* msg, ...);
108 static void error(
const char* msg, ...);
113 static char* staticLogFileName;
117 void hermes_fwrite(
const void* ptr,
size_t size,
size_t nitems, FILE* stream)
const;
118 void hermes_fread(
void* ptr,
size_t size,
size_t nitems, FILE* stream)
const;
125 bool write_console(
const char code,
const char* text)
const;
128 class HERMES_API HermesLogEventInfo
131 HermesLogEventInfo(
const char code,
const char* src_function,
const char* src_file,
const int src_line);
135 const char* src_function;
137 const char* src_file;
142 HermesLogEventInfo* hermes_build_log_info(
char event)
const;
144 static std::map<std::string, bool> logger_written;
153 void hermes_log_message(
const char code,
const char* msg)
const;
160 bool file_output_only;
163 callbackFn verbose_callback;
166 bool print_timestamps;
169 bool erase_on_beginning;
172 bool log_file_written;
204 const std::string& name()
const;
207 double accumulated()
const;
210 std::string accumulated_str()
const;
217 std::string last_str()
const;
220 #ifdef _WINDOWS //Windows
221 typedef uint64_t SysTime;
225 typedef timespec SysTime;
227 const std::string period_name;
237 SysTime get_time()
const;
239 double period_in_seconds(
const SysTime& begin,
const SysTime& end)
const;
241 std::string to_string(
const double time)
const;
251 virtual void set_global_integration_order(
unsigned int order);
252 bool global_integration_order_set;
253 unsigned int global_integration_order;
263 virtual void set_time(
double time);
264 virtual void set_time_step(
double time_step);
276 virtual bool on_initialization();
278 virtual bool on_step_begin();
280 virtual bool on_initial_step_end();
282 virtual bool on_step_end();
284 virtual bool on_finish();
295 const T& get_parameter_value(
const Parameter<T>& parameter);
302 void set_parameter_value(
Parameter<T>& parameter, T* value);
General namespace for the Hermes library.
Class using time measurement Can be used directly (is not abstract), so one can use e...
Class that allows overriding integration order in its discrete problems Internal. ...
char * logFileName
Logfile name.
File containing definition of exceptions classes.
TimerPeriodTickType
Tick type. Used by the class Hermes::TimePeriod.
Class that allows for attaching any method to particular parts of its functionality. Internal.
File containing common definitions, and basic global enums etc. for HermesCommon. ...
Class that allows overriding integration order in its discrete problems Internal. ...
Accumulate a period between ticks.
Class the output of which is loggable, i.e. that uses functionality of info(), warn() Contains the cl...