Skip to content

Commit

Permalink
Added necessary ifdefs for ModelicaSimulationError on RT targets (cpp…
Browse files Browse the repository at this point in the history
… runtime)

git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@25329 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
nimen committed Mar 31, 2015
1 parent a1bc23b commit 289da2c
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 26 deletions.
3 changes: 1 addition & 2 deletions SimulationRuntime/cpp/Core/Utils/Modelica/CMakeLists.txt
Expand Up @@ -15,5 +15,4 @@ endif(UNIX)
target_link_libraries (${ModelicaUtilitiesName} ${Boost_LIBRARIES})
install (TARGETS ${ModelicaUtilitiesName} DESTINATION lib/omc/${LIBINSTALLEXT})

install (FILES ${CMAKE_SOURCE_DIR}/Include/Core/Utils/Modelica/ModelicaUtilities.h ${CMAKE_SOURCE_DIR}/Include/Core/Utils/Modelica/ModelicaSimulationError.h DESTINATION include/omc/cpp/Core/Utils/Modelica)

install (FILES ${CMAKE_SOURCE_DIR}/Include/Core/Utils/Modelica/ModelicaUtilities.h ${CMAKE_SOURCE_DIR}/Include/Core/Utils/Modelica/FactoryExport.h ${CMAKE_SOURCE_DIR}/Include/Core/Utils/Modelica/ModelicaSimulationError.h DESTINATION include/omc/cpp/Core/Utils/Modelica)
@@ -0,0 +1,8 @@
#pragma once

#if defined(__vxworks) || defined(__TRICORE__)
#define BOOST_EXTENSION_EXPORT_DECL
#elif defined(OMC_BUILD) || defined(SIMSTER_BUILD)
#else
error "operating system not supported"
#endif
@@ -1,5 +1,7 @@
#pragma once

#include <Core/Utils/Modelica/FactoryExport.h>

//Enum for error types that can occur
enum SIMULATION_ERROR {
SOLVER, //all errors occur in solver (Euler,CVode)
Expand All @@ -19,32 +21,34 @@ enum SIMULATION_ERROR {
/*
Exception class for all simulation errors
*/
class ModelicaSimulationError: public std::runtime_error
{
public:
ModelicaSimulationError(SIMULATION_ERROR error_id,const std::string& error_info)
:runtime_error(strdup(error_info.c_str()))
,_error_id(error_id)
{
}
const char* what()
{
class ModelicaSimulationError : public std::runtime_error
{
public:
ModelicaSimulationError(SIMULATION_ERROR error_id, const std::string& error_info)
: runtime_error(strdup(error_info.c_str()))
, _error_id(error_id)
{
}

const char* what()
{
std::stringstream ss;
ss << "simulation error message : " << std::runtime_error::what();
return strdup(ss.str().c_str());
}
SIMULATION_ERROR getErrorID()
{
return _error_id;
}
}

SIMULATION_ERROR getErrorID()
{
return _error_id;
}

private:
SIMULATION_ERROR _error_id;

};
SIMULATION_ERROR _error_id;
};

//Helper functions to convert the error id to a readable format
BOOST_EXTENSION_EXPORT_DECL string error_id_string(SIMULATION_ERROR id);
//Helper functions to extend an error information for new additional string and time stamp
BOOST_EXTENSION_EXPORT_DECL string add_error_info(string new_info,string info,SIMULATION_ERROR id,double& time);
//Helper functions to extend an error information for new additional string
BOOST_EXTENSION_EXPORT_DECL string add_error_info(string new_info,string info,SIMULATION_ERROR id);
//Helper functions to convert the error id to a readable format
BOOST_EXTENSION_EXPORT_DECL string error_id_string(SIMULATION_ERROR id);
//Helper functions to extend an error information for new additional string and time stamp
BOOST_EXTENSION_EXPORT_DECL string add_error_info(string new_info,string info,SIMULATION_ERROR id,double& time);
//Helper functions to extend an error information for new additional string
BOOST_EXTENSION_EXPORT_DECL string add_error_info(string new_info,string info,SIMULATION_ERROR id);

0 comments on commit 289da2c

Please sign in to comment.