-
Notifications
You must be signed in to change notification settings - Fork 298
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@16797 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
- Loading branch information
1 parent
38d3208
commit e2b9d38
Showing
33 changed files
with
1,814 additions
and
1,814 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,23 @@ | ||
cmake_minimum_required (VERSION 2.6) | ||
|
||
project(${DataExchangeName}) | ||
|
||
add_library(${DataExchangeName} SHARED SimData.cpp FactoryExport.cpp ) | ||
target_link_libraries (${DataExchangeName} ${Boost_LIBRARIES} ) | ||
|
||
add_library(${DataExchangeName}_static STATIC SimData.cpp ) | ||
target_link_libraries (${DataExchangeName}_static ${Boost_LIBRARIES} ) | ||
|
||
install (TARGETS ${DataExchangeName} DESTINATION lib/omc/${LIBINSTALLEXT}) | ||
install (TARGETS ${DataExchangeName}_static DESTINATION lib/omc/${LIBINSTALLEXT}) | ||
|
||
install (FILES ${CMAKE_SOURCE_DIR}/Include/Core/DataExchange/IHistory.h | ||
${CMAKE_SOURCE_DIR}/Include/Core/DataExchange/ISimVar.h | ||
${CMAKE_SOURCE_DIR}/Include/Core/DataExchange/SimData.h | ||
DESTINATION include/omc/cpp/Core/DataExchange) | ||
|
||
|
||
|
||
|
||
|
||
|
||
cmake_minimum_required (VERSION 2.6) | ||
|
||
project(${DataExchangeName}) | ||
|
||
add_library(${DataExchangeName} SHARED SimData.cpp FactoryExport.cpp ) | ||
target_link_libraries (${DataExchangeName} ${Boost_LIBRARIES} ) | ||
|
||
add_library(${DataExchangeName}_static STATIC SimData.cpp ) | ||
target_link_libraries (${DataExchangeName}_static ${Boost_LIBRARIES} ) | ||
|
||
install (TARGETS ${DataExchangeName} DESTINATION lib/omc/${LIBINSTALLEXT}) | ||
install (TARGETS ${DataExchangeName}_static DESTINATION lib/omc/${LIBINSTALLEXT}) | ||
|
||
install (FILES ${CMAKE_SOURCE_DIR}/Include/Core/DataExchange/IHistory.h | ||
${CMAKE_SOURCE_DIR}/Include/Core/DataExchange/ISimVar.h | ||
${CMAKE_SOURCE_DIR}/Include/Core/DataExchange/SimData.h | ||
DESTINATION include/omc/cpp/Core/DataExchange) | ||
|
||
|
||
|
||
|
||
|
||
|
62 changes: 31 additions & 31 deletions
62
SimulationRuntime/cpp/Core/DataExchange/FactoryExport.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,31 @@ | ||
#pragma once | ||
|
||
#if defined(__vxworks) | ||
|
||
|
||
|
||
#elif defined(OMC_BUILD) | ||
#include "stdafx.h" | ||
#include <DataExchange/SimData.h> | ||
|
||
/* OMC factory*/ | ||
using boost::extensions::factory; | ||
|
||
BOOST_EXTENSION_TYPE_MAP_FUNCTION { | ||
types.get<std::map<std::string, factory<ISimData > > >() | ||
["SimData"].set<SimData>(); | ||
} | ||
#elif defined(SIMSTER_BUILD) | ||
#include "stdafx.h" | ||
#include <DataExchange/SimData.h> | ||
|
||
/*Simster factory*/ | ||
extern "C" void BOOST_EXTENSION_EXPORT_DECL extension_export_dataExchange(boost::extensions::factory_map & fm) | ||
{ | ||
fm.get<ISimData,int>()[1].set<SimData>(); | ||
} | ||
#else | ||
error "operating system not supported" | ||
#endif | ||
|
||
|
||
#pragma once | ||
|
||
#if defined(__vxworks) | ||
|
||
|
||
|
||
#elif defined(OMC_BUILD) | ||
#include "stdafx.h" | ||
#include <DataExchange/SimData.h> | ||
|
||
/* OMC factory*/ | ||
using boost::extensions::factory; | ||
|
||
BOOST_EXTENSION_TYPE_MAP_FUNCTION { | ||
types.get<std::map<std::string, factory<ISimData > > >() | ||
["SimData"].set<SimData>(); | ||
} | ||
#elif defined(SIMSTER_BUILD) | ||
#include "stdafx.h" | ||
#include <DataExchange/SimData.h> | ||
|
||
/*Simster factory*/ | ||
extern "C" void BOOST_EXTENSION_EXPORT_DECL extension_export_dataExchange(boost::extensions::factory_map & fm) | ||
{ | ||
fm.get<ISimData,int>()[1].set<SimData>(); | ||
} | ||
#else | ||
error "operating system not supported" | ||
#endif | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,85 +1,85 @@ | ||
#include "StdAfx.h" | ||
#include <DataExchange/SimData.h> | ||
|
||
|
||
|
||
/*Vxworks | ||
* extern "C" ISimData* createSimData() | ||
{ | ||
return new SimData(); | ||
} | ||
*/ | ||
|
||
SimData::SimData(void) | ||
{ | ||
} | ||
|
||
|
||
SimData::~SimData(void) | ||
{ | ||
} | ||
void SimData::Add(string key,boost::shared_ptr<ISimVar> var) | ||
{ | ||
std::pair<string,boost::shared_ptr<ISimVar> > elem(key,var); | ||
std::pair<Objects_type::iterator,bool> p = _sim_vars.insert(elem); | ||
} | ||
ISimVar* SimData::Get(string key) | ||
{ | ||
Objects_type::const_iterator iter =_sim_vars.find(key); | ||
|
||
//Prüfen ob das Simobjekt in Liste ist. | ||
if(iter!=_sim_vars.end()) | ||
{ | ||
boost::shared_ptr<ISimVar> obj= iter->second; | ||
return obj.get(); | ||
} | ||
else | ||
throw std::invalid_argument("There is no such sim variable " + key); | ||
} | ||
|
||
void SimData::addOutputResults(string name,ublas::vector<double> v) | ||
{ | ||
std::pair<string,ublas::vector<double> > elem(name,v); | ||
std::pair<OutputResults_type::iterator,bool> p = _result_vars.insert(elem); | ||
|
||
} | ||
void SimData::getTimeEntries(vector<double>& time_entries) | ||
{ | ||
time_entries = boost::ref(_time_entries); | ||
} | ||
|
||
|
||
void SimData::addTimeEntries(vector<double> time_entries) | ||
{ | ||
_time_entries = time_entries; | ||
} | ||
|
||
void SimData::destroy() | ||
{ | ||
delete this; | ||
} | ||
void SimData::clearResults() | ||
{ | ||
_result_vars.clear(); | ||
_time_entries.clear(); | ||
} | ||
|
||
|
||
void SimData::clearVars() | ||
{ | ||
_sim_vars.clear(); | ||
} | ||
void SimData::getOutputResults(string name,ublas::vector<double>& v) | ||
{ | ||
OutputResults_type::const_iterator iter =_result_vars.find(name); | ||
|
||
//Prüfen ob die Ergebnisse in Liste ist. | ||
if(iter!=_result_vars.end()) | ||
{ | ||
|
||
v = boost::ref(iter->second); | ||
} | ||
else | ||
throw std::invalid_argument("There is no such output variable " + name); | ||
} | ||
|
||
#include "StdAfx.h" | ||
#include <DataExchange/SimData.h> | ||
|
||
|
||
|
||
/*Vxworks | ||
* extern "C" ISimData* createSimData() | ||
{ | ||
return new SimData(); | ||
} | ||
*/ | ||
|
||
SimData::SimData(void) | ||
{ | ||
} | ||
|
||
|
||
SimData::~SimData(void) | ||
{ | ||
} | ||
void SimData::Add(string key,boost::shared_ptr<ISimVar> var) | ||
{ | ||
std::pair<string,boost::shared_ptr<ISimVar> > elem(key,var); | ||
std::pair<Objects_type::iterator,bool> p = _sim_vars.insert(elem); | ||
} | ||
ISimVar* SimData::Get(string key) | ||
{ | ||
Objects_type::const_iterator iter =_sim_vars.find(key); | ||
|
||
//Prüfen ob das Simobjekt in Liste ist. | ||
if(iter!=_sim_vars.end()) | ||
{ | ||
boost::shared_ptr<ISimVar> obj= iter->second; | ||
return obj.get(); | ||
} | ||
else | ||
throw std::invalid_argument("There is no such sim variable " + key); | ||
} | ||
|
||
void SimData::addOutputResults(string name,ublas::vector<double> v) | ||
{ | ||
std::pair<string,ublas::vector<double> > elem(name,v); | ||
std::pair<OutputResults_type::iterator,bool> p = _result_vars.insert(elem); | ||
|
||
} | ||
void SimData::getTimeEntries(vector<double>& time_entries) | ||
{ | ||
time_entries = boost::ref(_time_entries); | ||
} | ||
|
||
|
||
void SimData::addTimeEntries(vector<double> time_entries) | ||
{ | ||
_time_entries = time_entries; | ||
} | ||
|
||
void SimData::destroy() | ||
{ | ||
delete this; | ||
} | ||
void SimData::clearResults() | ||
{ | ||
_result_vars.clear(); | ||
_time_entries.clear(); | ||
} | ||
|
||
|
||
void SimData::clearVars() | ||
{ | ||
_sim_vars.clear(); | ||
} | ||
void SimData::getOutputResults(string name,ublas::vector<double>& v) | ||
{ | ||
OutputResults_type::const_iterator iter =_result_vars.find(name); | ||
|
||
//Prüfen ob die Ergebnisse in Liste ist. | ||
if(iter!=_result_vars.end()) | ||
{ | ||
|
||
v = boost::ref(iter->second); | ||
} | ||
else | ||
throw std::invalid_argument("There is no such output variable " + name); | ||
} | ||
|
Oops, something went wrong.