From 79ceae2f5cd2e981107811ba8d88c0d0771cec8c Mon Sep 17 00:00:00 2001 From: Ian bell Date: Tue, 20 May 2014 13:57:28 +0200 Subject: [PATCH] Diabled copy ctor for now for AbstractStateWrapper class until we figure out how to handle ownership and copying Signed-off-by: Ian bell --- include/AbstractState.h | 4 +++- src/AbstractState.cpp | 4 +++- src/HumidAirProp.cpp | 4 ++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/include/AbstractState.h b/include/AbstractState.h index e20617fc..06cd9301 100644 --- a/include/AbstractState.h +++ b/include/AbstractState.h @@ -387,9 +387,11 @@ class AbstractStateWrapper { protected: AbstractState *p; + // Copying is disabled for now until we determine the right semantics for ownership of AbstractState instance + AbstractStateWrapper(const AbstractStateWrapper& copy_from_me){}; public: AbstractStateWrapper(){this->p = NULL;}; - AbstractStateWrapper(const std::string &backend, const std::string &fluid_string){ + void set(const std::string &backend, const std::string &fluid_string){ this->p = AbstractState::factory(backend, fluid_string); }; ~AbstractStateWrapper(){delete this->p;}; diff --git a/src/AbstractState.cpp b/src/AbstractState.cpp index ffb2daea..20d7f6c7 100644 --- a/src/AbstractState.cpp +++ b/src/AbstractState.cpp @@ -325,8 +325,10 @@ TEST_CASE("Check AbstractStateWrapper","[AbstractStateWrapper]") } SECTION("initialized") { - CoolProp::AbstractStateWrapper Water = CoolProp::AbstractStateWrapper("HEOS", "Water"); + CoolProp::AbstractStateWrapper Water; CHECK_NOTHROW(Water.empty()); + CHECK(Water.empty() == true); + Water.set("HEOS", "Water"); CHECK(Water.empty() == false); CHECK_NOTHROW(Water.update(CoolProp::QT_INPUTS,1,300)); } diff --git a/src/HumidAirProp.cpp b/src/HumidAirProp.cpp index 2e099cca..46d5fcd3 100644 --- a/src/HumidAirProp.cpp +++ b/src/HumidAirProp.cpp @@ -25,10 +25,10 @@ namespace HumidAir void check_fluid_instantiation() { if (Water.empty()){ - Water = CoolProp::AbstractStateWrapper("HEOS", "Water"); + Water.set("HEOS", "Water"); } if (Air.empty()){ - Air = CoolProp::AbstractStateWrapper("HEOS", "Air"); + Air.set("HEOS", "Air"); } };