Commit 6b83f75b authored by Aaron Bray's avatar Aaron Bray

Merge branch '2.x'

parents dc550aa7 34dbfbbc
......@@ -92,39 +92,45 @@ const SEScalar* SEEnvironment::GetScalar(const std::string& name)
return nullptr;
}
bool SEEnvironment::ProcessChange(const SEInitialEnvironmentConditions& change)
bool SEEnvironment::ProcessChange(SEInitialEnvironmentConditions& change)
{
// If we have data then we merge it, if a file was provided
// we reset and set the environment to the file, so we only have the file data
if (change.HasConditions())
GetConditions().Merge(*change.GetConditions());
GetConditions().Merge(change.GetConditions());
else if (change.HasConditionsFile())
{
if (!GetConditions().SerializeFromFile(change.GetConditionsFile(),JSON))// Does NOT merge file in data, Should we?
// Update the condition with the file contents
std::string cfg_file = change.GetConditionsFile();
if (!change.GetConditions().SerializeFromFile(cfg_file,JSON))
{
/// \error Unable to read Configuration Action file
Error("Could not read provided SEInitialEnvironment file", "SEEnvironment::ProcessChange");
return false;
}
GetConditions().Merge(change.GetConditions());
}
StateChange();
return true;
}
bool SEEnvironment::ProcessChange(const SEChangeEnvironmentConditions& change)
bool SEEnvironment::ProcessChange(SEChangeEnvironmentConditions& change)
{
// If we have data then we merge it, if a file was provided
// we reset and set the environment to the file, so we only have the file data
if (change.HasConditions())
GetConditions().Merge(*change.GetConditions());
GetConditions().Merge(change.GetConditions());
else if (change.HasConditionsFile())
{
if (!GetConditions().SerializeFromFile(change.GetConditionsFile(),JSON))// Does NOT merge file in data, Should we?
// Update the action with the file contents
std::string cfg_file = change.GetConditionsFile();
if (!change.GetConditions().SerializeFromFile(cfg_file,JSON))
{
/// \error Unable to read Configuration Action file
Error("Could not read provided SEEnvironmentChange file", "SEEnvironment::ProcessChange");
return false;
}
GetConditions().Merge(change.GetConditions());
}
StateChange();
return true;
......
......@@ -19,15 +19,16 @@ public:
virtual void Clear();
protected:
/** @name ProcessChange
* @brief - Will change this class as directed by the Action
*/
virtual bool ProcessChange(const SEChangeEnvironmentConditions& action);
virtual bool ProcessChange(SEChangeEnvironmentConditions& action);
/** @name ProcessChange
* @brief - Will change this class as directed by the Condition
*/
virtual bool ProcessChange(const SEInitialEnvironmentConditions& change);
virtual bool ProcessChange(SEInitialEnvironmentConditions& change);
/** @name StateChange
* @brief - This method is called when ever there is a state change
......
......@@ -111,13 +111,18 @@ bool SEAnesthesiaMachine::SerializeFromFile(const std::string& filename, Seriali
return PBAnesthesiaMachine::SerializeFromFile(filename, *this, m);
}
void SEAnesthesiaMachine::ProcessConfiguration(const SEAnesthesiaMachineConfiguration& config)
void SEAnesthesiaMachine::ProcessConfiguration(SEAnesthesiaMachineConfiguration& config)
{
if (config.HasConfiguration())
Merge(*config.GetConfiguration());
Merge(config.GetConfiguration());
else if (config.HasConfigurationFile())
if (!SerializeFromFile(config.GetConfigurationFile(),JSON)) // Does NOT merge file in data, Should we ?
{
// Update the action with the file contents
std::string cfg_file = config.GetConfigurationFile();
if (!config.GetConfiguration().SerializeFromFile(cfg_file, JSON))
Error("Unable to load configuration file", "SEAnesthesiaMachine::ProcessConfiguration");
Merge(config.GetConfiguration());
}
StateChange();
}
......
......@@ -53,7 +53,7 @@ protected:
*/
virtual void StateChange(){};
virtual void Merge(const SEAnesthesiaMachine& from);
virtual void ProcessConfiguration(const SEAnesthesiaMachineConfiguration& config);
virtual void ProcessConfiguration(SEAnesthesiaMachineConfiguration& config);
public:
......
......@@ -89,13 +89,18 @@ void SEInhaler::Merge(const SEInhaler& from)
}
}
void SEInhaler::ProcessConfiguration(const SEInhalerConfiguration& config)
void SEInhaler::ProcessConfiguration(SEInhalerConfiguration& config)
{
if (config.HasConfiguration())
Merge(*config.GetConfiguration());
Merge(config.GetConfiguration());
else if (config.HasConfigurationFile())
if (!SerializeFromFile(config.GetConfigurationFile(),JSON))// Does NOT merge file in data, Should we?
{
// Update the action with the file contents
std::string cfg_file = config.GetConfigurationFile();
if (!config.GetConfiguration().SerializeFromFile(cfg_file, JSON))
Error("Unable to load configuration file", "SEInhaler::ProcessConfiguration");
Merge(config.GetConfiguration());// Preserve our pointers!
}
StateChange();
}
......
......@@ -41,7 +41,7 @@ protected:
*/
virtual void StateChange(){};
virtual void Merge(const SEInhaler& from);
virtual void ProcessConfiguration(const SEInhalerConfiguration& config);
virtual void ProcessConfiguration(SEInhalerConfiguration& config);
public:
......
......@@ -4,9 +4,9 @@
# This file will define the following variables:
# - Pulse_LIB_ROOT_DIR : The root library directory
# - PULSE_LIBRARIES : The list of both debug and release libraries.
: It is recommended to use this variable in your CMake file
: It will configure both debug and release build types for you.
: target_link_libraries(YourProject ${PULSE_LIBRARIES})
# : It is recommended to use this variable in your CMake file
# : It will configure both debug and release build types for you.
# : target_link_libraries(YourProject ${PULSE_LIBRARIES})
# - Pulse_RELEASE_LIBS : The list of release libraries.
# - Pulse_DEBUG_LIBS : The list of debug libraries.
# - Pulse_INCLUDE_DIRS : The Pulse include directories.
......@@ -51,7 +51,7 @@ set(Pulse_RELEASE_LIBS "${Pulse_LIB_ROOT_DIR}/PulseEngine.${LIB_ENDING}"
"${Pulse_LIB_ROOT_DIR}/DataModelBindings.${LIB_ENDING}"
"${Pulse_LIB_ROOT_DIR}/${LOG4CPLUS_LIB}.${LIB_ENDING}"
"${Pulse_LIB_ROOT_DIR}/libprotobuf.${LIB_ENDING}"
"${WIN32_LIBS}
"${WIN32_LIBS}"
)
foreach(lib ${Pulse_RELEASE_LIBS})
list (APPEND PULSE_LIBRARIES optimized ${lib})
......@@ -62,7 +62,7 @@ set(Pulse_DEBUG_LIBS "${Pulse_LIB_ROOT_DIR}/PulseEngined.${LIB_ENDING}"
"${Pulse_LIB_ROOT_DIR}/DataModelBindingsd.${LIB_ENDING}"
"${Pulse_LIB_ROOT_DIR}/${LOG4CPLUS_LIB}D.${LIB_ENDING}"
"${Pulse_LIB_ROOT_DIR}/libprotobufd.${LIB_ENDING}"
"${WIN32_LIBS}
"${WIN32_LIBS}"
)
foreach(lib ${Pulse_DEBUG_LIBS})
list (APPEND PULSE_LIBRARIES debug ${lib})
......
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