Commit 13452728 authored by Aaron Bray's avatar Aaron Bray
Browse files

Reworking some classes to help create a C interface that can use protobufs

parent 54ace535
......@@ -109,8 +109,10 @@ add_subdirectory(engine)
add_subdirectory(test)
add_subdirectory(sdk)
add_subdirectory(verification)
include(${CMAKE_CURRENT_SOURCE_DIR}/PulseJNI.cmake)
# Various interfaces for different languages
#include(${CMAKE_CURRENT_SOURCE_DIR}/PulseC.cmake)
include(${CMAKE_CURRENT_SOURCE_DIR}/PulseCLR.cmake)
include(${CMAKE_CURRENT_SOURCE_DIR}/PulseJNI.cmake)
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
set_target_properties (libprotobuf libprotobuf-lite PROPERTIES FOLDER protobufs)
......
add_library(PulseC SHARED engine/cpp/PulseEngineC.h
engine/cpp/PulseEngineC.cpp)
target_include_directories(PulseC PRIVATE ${CMAKE_BINARY_DIR}/schema/cpp/)
target_include_directories(PulseC PRIVATE ${CMAKE_BINARY_DIR}/schema/cpp/bind/)
target_include_directories(PulseC PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/engine/cpp)
target_include_directories(PulseC PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/cdm/cpp)
target_include_directories(PulseC PRIVATE ${EIGEN3_INCLUDE_DIR})
target_include_directories(PulseC PRIVATE ${LOG4CPLUS_INCLUDE_DIR})
target_include_directories(PulseC PRIVATE ${PROTOBUF_INCLUDE_DIR})
set(PulseC_FLAGS)
set_target_properties(PulseC PROPERTIES COMPILE_FLAGS "${PulseC_FLAGS}" PREFIX "")
if(APPLE)
set_target_properties(PulseC PROPERTIES MACOSX_RPATH ON)
endif()
set_target_properties(PulseC PROPERTIES
DEBUG_POSTFIX "${PULSE_DEBUG_POSTFIX}"
RELWITHDEBINFO_POSTFIX "${PULSE_RELWITHDEBINFO_POSTFIX}")
add_custom_command(TARGET PulseC POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:PulseC> ${INSTALL_BIN})
install(TARGETS PulseC
RUNTIME DESTINATION ${INSTALL_BIN}
LIBRARY DESTINATION ${INSTALL_LIB}
ARCHIVE DESTINATION ${INSTALL_LIB})
......@@ -18,7 +18,7 @@ target_include_directories(PulseCLR PRIVATE ${PROTOBUF_INCLUDE_DIR})
set(PulseCLR_FLAGS "/EHa")
string( REPLACE "/RTC1" "" CMAKE_CXX_FLAGS_DEBUG ${CMAKE_CXX_FLAGS_DEBUG} )
set_target_properties(PulseCLR PROPERTIES COMPILE_FLAGS "${PulseCLR_FLAGS}" PREFIX "")
set_target_properties(PulseCLR PROPERTIES COMMON_LANGUAGE_RUNTIME "") # Also turn on CLR
#set_target_properties(PulseCLR PROPERTIES COMMON_LANGUAGE_RUNTIME "") # Also turn on CLR
message(STATUS "PulseCLR COMPILE_FLAGS : ${CMAKE_CXX_FLAGS_DEBUG}")
set_target_properties(PulseCLR PROPERTIES
......
......@@ -41,7 +41,7 @@ message(STATUS "Eigen is here : ${eigen_SRC}" )
###################################################
message( STATUS "External project - log4cplus" )
set(log4cplus_SRC "${CMAKE_BINARY_DIR}/log4cplus/src/log4cplus")
set(log4cplus_SRC "${CMAKE_BINARY_DIR}/log4cplus/src/log4cplus" CACHE PATH "Log4cplus Source")
ExternalProject_Add( log4cplus
PREFIX log4cplus
......
......@@ -2,12 +2,11 @@
See accompanying NOTICE file for details.*/
#include "stdafx.h"
#include "scenario/SEAction.h"
#include "engine/SEAction.h"
#include "engine/SEAdvanceTime.h"
#include "engine/SESerializeState.h"
#include "substance/SESubstanceManager.h"
#include "scenario/SEAdvanceTime.h"
#include "scenario/SESerializeState.h"
SEAction::SEAction() : Loggable()
{
......
......@@ -2,18 +2,18 @@
See accompanying NOTICE file for details.*/
#include "stdafx.h"
#include "scenario/SEAction.h"
#include "scenario/SEActionManager.h"
#include "engine/SEAction.h"
#include "engine/SEActionManager.h"
#include "patient/actions/SEPatientAction.h"
#include "scenario/SEPatientActionCollection.h"
#include "engine/SEPatientActionCollection.h"
#include "system/equipment/anesthesiamachine/actions/SEAnesthesiaMachineAction.h"
#include "scenario/SEAnesthesiaMachineActionCollection.h"
#include "engine/SEAnesthesiaMachineActionCollection.h"
#include "system/environment/actions/SEEnvironmentAction.h"
#include "scenario/SEEnvironmentActionCollection.h"
#include "engine/SEEnvironmentActionCollection.h"
#include "system/equipment/inhaler/actions/SEInhalerAction.h"
#include "scenario/SEInhalerActionCollection.h"
#include "engine/SEInhalerActionCollection.h"
#include "substance/SESubstanceManager.h"
#include "io/protobuf/PBScenario.h"
#include "io/protobuf/PBEngine.h"
SEActionManager::SEActionManager(SESubstanceManager& substances) : Loggable(substances.GetLogger()),
m_Substances(substances)
......@@ -43,19 +43,19 @@ void SEActionManager::Clear()
bool SEActionManager::SerializeToString(std::string& output, SerializationMode m) const
{
return PBScenario::SerializeToString(*this, output, m);
return PBEngine::SerializeToString(*this, output, m);
}
bool SEActionManager::SerializeToFile(const std::string& filename, SerializationMode m) const
{
return PBScenario::SerializeToFile(*this, filename, m);
return PBEngine::SerializeToFile(*this, filename, m);
}
bool SEActionManager::SerializeFromString(const std::string& src, SerializationMode m)
{
return PBScenario::SerializeFromString(src, *this, m);
return PBEngine::SerializeFromString(src, *this, m);
}
bool SEActionManager::SerializeFromFile(const std::string& filename, SerializationMode m)
{
return PBScenario::SerializeFromFile(filename, *this, m);
return PBEngine::SerializeFromFile(filename, *this, m);
}
// A raw serialize method
......@@ -68,7 +68,7 @@ bool SEActionManager::SerializeFromFile(const std::string& filename, Serializati
// So this method is intended to be a middle man between the socket/language client and an engine.
bool SEActionManager::SerializeFromString(const std::string& src, std::vector<SEAction*>& dst, SerializationMode m, SESubstanceManager& subMgr)
{
return PBScenario::SerializeFromString(src, dst, m, subMgr);
return PBEngine::SerializeFromString(src, dst, m, subMgr);
}
bool SEActionManager::ProcessAction(const SEAction& action)
......
......@@ -11,7 +11,7 @@ class SESubstanceManager;
class CDM_DECL SEActionManager : public Loggable
{
friend class PBScenario;//friend the serialization class
friend class PBEngine;//friend the serialization class
public:
SEActionManager(SESubstanceManager&);
......
......@@ -2,7 +2,7 @@
See accompanying NOTICE file for details.*/
#include "stdafx.h"
#include "scenario/SEAdvanceTime.h"
#include "engine/SEAdvanceTime.h"
#include "properties/SEScalarTime.h"
SEAdvanceTime::SEAdvanceTime() : SEAction()
......
......@@ -2,7 +2,7 @@
See accompanying NOTICE file for details.*/
#pragma once
#include "scenario/SEAction.h"
#include "engine/SEAction.h"
class CDM_DECL SEAdvanceTime : public SEAction
{
......
......@@ -2,7 +2,7 @@
See accompanying NOTICE file for details.*/
#include "stdafx.h"
#include "scenario/SEAnesthesiaMachineActionCollection.h"
#include "engine/SEAnesthesiaMachineActionCollection.h"
#include "substance/SESubstanceManager.h"
#include "system/equipment/anesthesiamachine/SEAnesthesiaMachine.h"
#include "system/equipment/anesthesiamachine/actions/SEOxygenTankPressureLoss.h"
......
......@@ -24,7 +24,7 @@ CDM_BIND_DECL(AnyAnesthesiaMachineActionData)
class CDM_DECL SEAnesthesiaMachineActionCollection : public Loggable
{
friend class PBScenario;//friend the serialization class
friend class PBEngine;//friend the serialization class
friend class SEActionManager;
protected:
SEAnesthesiaMachineActionCollection(SESubstanceManager&);
......
......@@ -2,7 +2,7 @@
See accompanying NOTICE file for details.*/
#include "stdafx.h"
#include "scenario/SECondition.h"
#include "engine/SECondition.h"
#include "substance/SESubstanceManager.h"
#include "patient/conditions/SEPatientCondition.h"
#include "system/environment/conditions/SEEnvironmentCondition.h"
......
......@@ -2,7 +2,7 @@
See accompanying NOTICE file for details.*/
#include "stdafx.h"
#include "scenario/SEConditionManager.h"
#include "engine/SEConditionManager.h"
//Patient Conditions
#include "patient/conditions/SEChronicAnemia.h"
#include "patient/conditions/SEChronicObstructivePulmonaryDisease.h"
......@@ -17,7 +17,7 @@
#include "system/environment/conditions/SEInitialEnvironmentConditions.h"
#include "substance/SESubstance.h"
#include "substance/SESubstanceManager.h"
#include "io/protobuf/PBScenario.h"
#include "io/protobuf/PBEngine.h"
SEConditionManager::SEConditionManager(SESubstanceManager& substances) : Loggable(substances.GetLogger()), m_Substances(substances)
{
......@@ -52,19 +52,19 @@ void SEConditionManager::Clear()
bool SEConditionManager::SerializeToString(std::string& output, SerializationMode m) const
{
return PBScenario::SerializeToString(*this, output, m);
return PBEngine::SerializeToString(*this, output, m);
}
bool SEConditionManager::SerializeToFile(const std::string& filename, SerializationMode m) const
{
return PBScenario::SerializeToFile(*this, filename, m);
return PBEngine::SerializeToFile(*this, filename, m);
}
bool SEConditionManager::SerializeFromString(const std::string& src, SerializationMode m)
{
return PBScenario::SerializeFromString(src, *this, m);
return PBEngine::SerializeFromString(src, *this, m);
}
bool SEConditionManager::SerializeFromFile(const std::string& filename, SerializationMode m)
{
return PBScenario::SerializeFromFile(filename, *this, m);
return PBEngine::SerializeFromFile(filename, *this, m);
}
bool SEConditionManager::ProcessCondition(const SECondition& condition)
......
......@@ -19,7 +19,7 @@ class SESubstanceManager;
class CDM_DECL SEConditionManager : public Loggable
{
friend class PBScenario;//friend the serialization class
friend class PBEngine;//friend the serialization class
public:
SEConditionManager(SESubstanceManager&);
......
......@@ -2,9 +2,9 @@
See accompanying NOTICE file for details.*/
#include "stdafx.h"
#include "scenario/SEDataRequest.h"
#include "engine/SEDataRequest.h"
#include "utils/unitconversion/UCCommon.h"
#include "io/protobuf/PBScenario.h"
#include "io/protobuf/PBEngine.h"
SEDataRequest::SEDataRequest(const SEDataRequest& dr)
{
......@@ -42,7 +42,7 @@ void SEDataRequest::Clear()
void SEDataRequest::Copy(const SEDataRequest& src)
{
PBScenario::Copy(src, *this);
PBEngine::Copy(src, *this);
}
bool SEDataRequest::IsValid()
......
......@@ -5,7 +5,7 @@
class SESubstanceManager;
class CCompoundUnit;
class SEDataRequestManager;
#include "scenario/SEDecimalFormat.h"
#include "engine/SEDecimalFormat.h"
enum class eDataRequest_Category {
Patient = 0, Physiology, Environment, GasCompartment,
......@@ -16,7 +16,7 @@ extern const std::string& eDataRequest_Category_Name(eDataRequest_Category m);
class CDM_DECL SEDataRequest : public SEDecimalFormat
{
friend class PBScenario;//friend the serialization class
friend class PBEngine;//friend the serialization class
friend class SEDataRequestManager;
protected:
SEDataRequest(const SEDataRequest& dr);
......
......@@ -5,8 +5,7 @@
#include "SEDataRequestManager.h"
#include "substance/SESubstance.h"
#include "substance/SESubstanceManager.h"
#include "io/protobuf/PBScenario.h"
#include "io/protobuf/PBScenario.h"
#include "io/protobuf/PBEngine.h"
SEDataRequestManager::SEDataRequestManager(Logger* logger) : Loggable(logger)
{
......@@ -30,24 +29,24 @@ void SEDataRequestManager::Clear()
void SEDataRequestManager::Copy(const SEDataRequestManager& src, const SESubstanceManager& subMgr)
{
PBScenario::Copy(src, *this, subMgr);
PBEngine::Copy(src, *this, subMgr);
}
bool SEDataRequestManager::SerializeToString(std::string& output, SerializationMode m) const
{
return PBScenario::SerializeToString(*this, output, m);
return PBEngine::SerializeToString(*this, output, m);
}
bool SEDataRequestManager::SerializeToFile(const std::string& filename, SerializationMode m) const
{
return PBScenario::SerializeToFile(*this, filename, m);
return PBEngine::SerializeToFile(*this, filename, m);
}
bool SEDataRequestManager::SerializeFromString(const std::string& src, SerializationMode m, const SESubstanceManager& subMgr)
{
return PBScenario::SerializeFromString(src, *this, m, subMgr);
return PBEngine::SerializeFromString(src, *this, m, subMgr);
}
bool SEDataRequestManager::SerializeFromFile(const std::string& filename, SerializationMode m, const SESubstanceManager& subMgr)
{
return PBScenario::SerializeFromFile(filename, *this, m, subMgr);
return PBEngine::SerializeFromFile(filename, *this, m, subMgr);
}
bool SEDataRequestManager::HasDefaultDecimalFormatting() const
......
......@@ -2,13 +2,13 @@
See accompanying NOTICE file for details.*/
#pragma once
#include "scenario/SEDataRequest.h"
#include "engine/SEDataRequest.h"
class SESubstance;
class SESubstanceManager;
class CDM_DECL SEDataRequestManager : public Loggable
{
friend class PBScenario;//friend the serialization class
friend class PBEngine;//friend the serialization class
public:
SEDataRequestManager(Logger* logger);
~SEDataRequestManager();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment