40 #ifndef __OPENFLUID_WARE_SIMULATIONDRIVENWARE_HPP__
41 #define __OPENFLUID_WARE_SIMULATIONDRIVENWARE_HPP__
55 #define REQUIRE_SIMULATION_STAGE(stage,msg) \
56 if (OPENFLUID_GetCurrentStage() != (stage)) \
58 openfluid::base::ExceptionContext Context = computeFrameworkContext(OPENFLUID_CODE_LOCATION); \
59 throw openfluid::base::FrameworkException(Context,msg); \
65 #define REQUIRE_SIMULATION_STAGE_GE(stage,msg) \
66 if (OPENFLUID_GetCurrentStage() < (stage)) \
68 openfluid::base::ExceptionContext Context = computeFrameworkContext(OPENFLUID_CODE_LOCATION); \
69 throw openfluid::base::FrameworkException(Context,msg); \
75 #define REQUIRE_SIMULATION_STAGE_LE(stage,msg) \
76 if (OPENFLUID_GetCurrentStage() > (stage)) \
78 openfluid::base::ExceptionContext Context = computeFrameworkContext(OPENFLUID_CODE_LOCATION); \
79 throw openfluid::base::FrameworkException(Context,msg); \
90 #define _STREAMTOSTRING(_stream) ((static_cast<std::ostringstream&>(std::ostringstream().flush() << _stream)).str())
110 #define OPENFLUID_LogWarning(_stream) \
111 appendToLog(openfluid::tools::FileLogger::LogType::WARNING_MSG,_STREAMTOSTRING(_stream))
128 #define OPENFLUID_DisplayWarning(_stream) \
129 displayToConsole(openfluid::tools::FileLogger::LogType::WARNING_MSG,_STREAMTOSTRING(_stream))
146 #define OPENFLUID_LogAndDisplayWarning(_stream) \
147 OPENFLUID_LogWarning(_stream); \
148 OPENFLUID_DisplayWarning(_stream)
168 #define OPENFLUID_LogInfo(_stream) \
169 appendToLog(openfluid::tools::FileLogger::LogType::INFO_MSG,_STREAMTOSTRING(_stream))
186 #define OPENFLUID_DisplayInfo(_stream) \
187 displayToConsole(openfluid::tools::FileLogger::LogType::INFO_MSG,_STREAMTOSTRING(_stream))
204 #define OPENFLUID_LogAndDisplayInfo(_stream) \
205 OPENFLUID_LogInfo(_stream); \
206 OPENFLUID_DisplayInfo(_stream)
263 #define OPENFLUID_LogDebug(_stream) \
264 appendToLog(openfluid::tools::FileLogger::LogType::DEBUG_MSG,_STREAMTOSTRING(_stream))
266 #define OPENFLUID_DisplayDebug(_stream) \
267 displayToConsole(openfluid::tools::FileLogger::LogType::DEBUG_MSG,_STREAMTOSTRING(_stream))
269 #define OPENFLUID_LogAndDisplayDebug(_stream) \
270 OPENFLUID_LogDebug(_stream); \
271 OPENFLUID_DisplayDebug(_stream)
275 #define OPENFLUID_LogDebug(_stream)
277 #define OPENFLUID_DisplayDebug(_stream)
279 #define OPENFLUID_LogAndDisplayDebug(_stream)
514 mp_SimStatus(nullptr), mp_SimLogger(nullptr), m_PreviousTimeIndex(0)
674 std::string& Val)
const;
685 std::vector<std::string>& Vals)
const;
696 std::vector<double>& Vals)
const;
707 std::vector<long>& Vals)
const;
719 mp_SimLogger = SimLogger;
728 m_PreviousTimeIndex = TimeIndex;
Definition: ExceptionContext.hpp:54
Definition: SimulationLogger.hpp:58
Definition: SimulationStatus.hpp:56
SimulationStage
Definition: SimulationStatus.hpp:59
SchedulingConstraint
Definition: SimulationStatus.hpp:62
Class for management of date and time information.
Definition: DateTime.hpp:88
Definition: DoubleValue.hpp:81
Definition: MatrixValue.hpp:85
Definition: StringValue.hpp:83
Definition: VectorValue.hpp:85
Definition: PluggableWare.hpp:98
virtual bool isLinked() const
Definition: PluggableWare.hpp:123
Definition: SimulationDrivenWare.hpp:292
void linkToSimulationLogger(openfluid::base::SimulationLogger *SimLogger)
Definition: SimulationDrivenWare.hpp:717
bool OPENFLUID_GetWareParameter(const openfluid::ware::WareParams_t &Params, const openfluid::ware::WareParamKey_t &ParamName, bool &Val) const
virtual bool isLinked() const
Definition: SimulationDrivenWare.hpp:306
openfluid::base::SimulationStatus::SimulationStage OPENFLUID_GetCurrentStage() const
openfluid::core::TimeIndex_t OPENFLUID_GetCurrentTimeIndex() const
bool OPENFLUID_GetWareParameter(const openfluid::ware::WareParams_t &Params, const openfluid::ware::WareParamKey_t &ParamName, openfluid::core::MatrixValue &Val) const
bool OPENFLUID_GetWareParameter(const openfluid::ware::WareParams_t &Params, const openfluid::ware::WareParamKey_t &ParamName, openfluid::core::VectorValue &Val) const
void setPreviousTimeIndex(const openfluid::core::TimeIndex_t &TimeIndex)
Definition: SimulationDrivenWare.hpp:726
openfluid::core::DateTime OPENFLUID_GetBeginDate() const
void initializeWare(const WareID_t &ID)
openfluid::core::DateTime OPENFLUID_GetEndDate() const
bool OPENFLUID_GetWareParameter(const openfluid::ware::WareParams_t &Params, const openfluid::ware::WareParamKey_t &ParamName, std::vector< double > &Vals) const
openfluid::core::Duration_t OPENFLUID_GetDefaultDeltaT() const
void appendToLog(openfluid::tools::FileLogger::LogType LType, const std::string &Msg) const
bool OPENFLUID_GetWareParameter(const openfluid::ware::WareParams_t &Params, const openfluid::ware::WareParamKey_t &ParamName, long &Val) const
openfluid::core::Duration_t OPENFLUID_GetSimulationDuration() const
virtual void OPENFLUID_RaiseWarning(const std::string &Msg)
openfluid::base::SimulationStatus::SchedulingConstraint OPENFLUID_GetSchedulingConstraint() const
openfluid::base::ExceptionContext computeFrameworkContext(const std::string &CodeLoc="") const
void displayToConsole(openfluid::tools::FileLogger::LogType LType, const std::string &Msg) const
std::string OPENFLUID_GetCurrentStageAsString() const
SimulationDrivenWare(WareType WType)
Definition: SimulationDrivenWare.hpp:513
openfluid::core::StringValue OPENFLUID_GetWareParameter(const openfluid::ware::WareParams_t &Params, const openfluid::ware::WareParamKey_t &ParamName) const
virtual void OPENFLUID_RaiseError(const std::string &Source, const std::string &Msg)
bool OPENFLUID_GetWareParameter(const openfluid::ware::WareParams_t &Params, const openfluid::ware::WareParamKey_t &ParamName, openfluid::core::DoubleValue &Val) const
bool OPENFLUID_GetWareParameter(const openfluid::ware::WareParams_t &Params, const openfluid::ware::WareParamKey_t &ParamName, double &Val) const
virtual void OPENFLUID_RaiseWarning(const std::string &Source, const std::string &Msg)
bool OPENFLUID_GetWareParameter(const openfluid::ware::WareParams_t &Params, const openfluid::ware::WareParamKey_t &ParamName, std::string &Val) const
openfluid::core::TimeIndex_t OPENFLUID_GetPreviousRunTimeIndex() const
virtual ~SimulationDrivenWare()
Definition: SimulationDrivenWare.hpp:712
bool OPENFLUID_GetWareParameter(const openfluid::ware::WareParams_t &Params, const openfluid::ware::WareParamKey_t &ParamName, openfluid::core::StringValue &Val) const
openfluid::core::DateTime OPENFLUID_GetCurrentDate() const
bool OPENFLUID_IsWareParameterExist(const openfluid::ware::WareParams_t &Params, const openfluid::ware::WareParamKey_t &ParamName) const
void linkToSimulation(const openfluid::base::SimulationStatus *SimStatus)
virtual void OPENFLUID_RaiseError(const std::string &Msg)
bool OPENFLUID_GetWareParameter(const openfluid::ware::WareParams_t &Params, const openfluid::ware::WareParamKey_t &ParamName, float &Val) const
bool OPENFLUID_GetWareParameter(const openfluid::ware::WareParams_t &Params, const openfluid::ware::WareParamKey_t &ParamName, std::vector< std::string > &Vals) const
bool OPENFLUID_GetWareParameter(const openfluid::ware::WareParams_t &Params, const openfluid::ware::WareParamKey_t &ParamName, std::vector< long > &Vals) const
bool OPENFLUID_GetWareParameter(const openfluid::ware::WareParams_t &Params, const openfluid::ware::WareParamKey_t &ParamName, int &Val) const
openfluid::base::ExceptionContext computeWareContext(const std::string &CodeLoc="") const
Definition: WareRNG.hpp:58
#define OPENFLUID_API
Definition: dllexport.hpp:86
std::uint64_t Duration_t
Definition: TypeDefs.hpp:312
std::uint64_t TimeIndex_t
Definition: TypeDefs.hpp:298
WareType
Definition: TypeDefs.hpp:61
std::string WareID_t
Definition: TypeDefs.hpp:49
std::string WareParamKey_t
Definition: TypeDefs.hpp:142
std::map< WareParamKey_t, WareParamValue_t > WareParams_t
Definition: TypeDefs.hpp:146
Definition: ApplicationException.hpp:47