From f335350c35208026a20c672805641e108f33e85b Mon Sep 17 00:00:00 2001 From: Ray Speth Date: Thu, 10 Sep 2015 17:38:29 -0400 Subject: [PATCH] Always use std::shared_ptr Since we compile as c++11, std::shared_ptr is guaranteed to exist. --- SConstruct | 16 -------- include/cantera/base/config.h.in | 6 --- include/cantera/base/ct_defs.h | 3 ++ include/cantera/base/smart_ptr.h | 38 ------------------- include/cantera/equil/ChemEquil.h | 2 - include/cantera/kinetics/FalloffFactory.h | 1 - include/cantera/kinetics/Kinetics.h | 1 - include/cantera/kinetics/Reaction.h | 1 - include/cantera/thermo/Species.h | 1 - include/cantera/thermo/SpeciesThermo.h | 1 - include/cantera/transport/TransportData.h | 1 - interfaces/cython/cantera/_cantera.pxd | 4 +- src/base/application.h | 1 - .../VCSnonideal/LatticeSolid_LiSi/latsol.cpp | 1 - .../dustyGasTransportTest.cpp | 1 - .../simpleTransport/simpleTransportTest.cpp | 1 - .../stoichSolidKinetics.cpp | 1 - 17 files changed, 5 insertions(+), 75 deletions(-) delete mode 100644 include/cantera/base/smart_ptr.h diff --git a/SConstruct b/SConstruct index 7dc7e320f..87898737b 100644 --- a/SConstruct +++ b/SConstruct @@ -818,22 +818,6 @@ boost_version_source = get_expression_value([''], 'BOOST_LIB_ retcode, boost_lib_version = conf.TryRun(boost_version_source, '.cpp') env['BOOST_LIB_VERSION'] = boost_lib_version.strip() -# Find shared pointer implementation -configh['CT_USE_STD_SHARED_PTR'] = None -configh['CT_USE_TR1_SHARED_PTR'] = None -configh['CT_USE_MSFT_SHARED_PTR'] = None -configh['CT_USE_BOOST_SHARED_PTR'] = None -if conf.CheckStatement('std::shared_ptr x', '#include '): - configh['CT_USE_STD_SHARED_PTR'] = 1 -elif conf.CheckStatement('std::tr1::shared_ptr x', '#include '): - configh['CT_USE_TR1_SHARED_PTR'] = 1 -elif conf.CheckStatement('std::tr1::shared_ptr x', '#include '): - configh['CT_USE_MSFT_SHARED_PTR'] = 1 -elif conf.CheckStatement('boost::shared_ptr x', '#include '): - configh['CT_USE_BOOST_SHARED_PTR'] = 1 -else: - config_error("Couldn't find a working shared_ptr implementation.") - import SCons.Conftest, SCons.SConf context = SCons.SConf.CheckContext(conf) ret = SCons.Conftest.CheckLib(context, diff --git a/include/cantera/base/config.h.in b/include/cantera/base/config.h.in index 45a608fd2..018a83ced 100644 --- a/include/cantera/base/config.h.in +++ b/include/cantera/base/config.h.in @@ -55,12 +55,6 @@ typedef int ftnlen; // Fortran hidden string length type %(LAPACK_NAMES_LOWERCASE)s %(LAPACK_FTN_TRAILING_UNDERSCORE)s -//--------- shared_ptr implementation --------- -%(CT_USE_STD_SHARED_PTR)s -%(CT_USE_TR1_SHARED_PTR)s -%(CT_USE_MSFT_SHARED_PTR)s -%(CT_USE_BOOST_SHARED_PTR)s - //-------- BOOST -------- %(USE_BOOST_MATH)s diff --git a/include/cantera/base/ct_defs.h b/include/cantera/base/ct_defs.h index 59c63a983..cfdd2ebf7 100644 --- a/include/cantera/base/ct_defs.h +++ b/include/cantera/base/ct_defs.h @@ -24,6 +24,7 @@ #include #include #include +#include /** * Namespace for the Cantera kernel. @@ -36,6 +37,8 @@ namespace Cantera #define DATA_PTR(vec) &vec[0] #endif +using std::shared_ptr; + /*! * All physical constants are stored here. * diff --git a/include/cantera/base/smart_ptr.h b/include/cantera/base/smart_ptr.h deleted file mode 100644 index b4a4299ee..000000000 --- a/include/cantera/base/smart_ptr.h +++ /dev/null @@ -1,38 +0,0 @@ -#ifndef CT_SMART_PTR -#define CT_SMART_PTR - -#include "config.h" - -#if defined CT_USE_STD_SHARED_PTR -#include -namespace Cantera -{ - using std::shared_ptr; -} - -#elif defined CT_USE_TR1_SHARED_PTR -#include -namespace Cantera -{ - using std::tr1::shared_ptr; -} - -#elif defined CT_USE_MSFT_SHARED_PTR -#include -namespace Cantera -{ - using std::tr1::shared_ptr; -} - -#elif defined CT_USE_BOOST_SHARED_PTR -#include -namespace Cantera -{ - using boost::shared_ptr; -} - -#else -#error "No shared_ptr implementation available" -#endif - -#endif diff --git a/include/cantera/equil/ChemEquil.h b/include/cantera/equil/ChemEquil.h index 042b9915e..885f1e8b8 100644 --- a/include/cantera/equil/ChemEquil.h +++ b/include/cantera/equil/ChemEquil.h @@ -13,8 +13,6 @@ #include "cantera/base/ctexceptions.h" #include "cantera/thermo/ThermoPhase.h" -#include - namespace Cantera { diff --git a/include/cantera/kinetics/FalloffFactory.h b/include/cantera/kinetics/FalloffFactory.h index 47b51f2e6..503710381 100644 --- a/include/cantera/kinetics/FalloffFactory.h +++ b/include/cantera/kinetics/FalloffFactory.h @@ -11,7 +11,6 @@ #include "cantera/base/FactoryBase.h" #include "cantera/base/ct_thread.h" -#include "cantera/base/smart_ptr.h" #include "cantera/kinetics/Falloff.h" namespace Cantera diff --git a/include/cantera/kinetics/Kinetics.h b/include/cantera/kinetics/Kinetics.h index 8a06d844c..a1aa75877 100644 --- a/include/cantera/kinetics/Kinetics.h +++ b/include/cantera/kinetics/Kinetics.h @@ -15,7 +15,6 @@ #include "cantera/thermo/mix_defs.h" #include "cantera/kinetics/Reaction.h" #include "cantera/base/global.h" -#include "cantera/base/smart_ptr.h" namespace Cantera { diff --git a/include/cantera/kinetics/Reaction.h b/include/cantera/kinetics/Reaction.h index c70457026..2f218fcf0 100644 --- a/include/cantera/kinetics/Reaction.h +++ b/include/cantera/kinetics/Reaction.h @@ -6,7 +6,6 @@ #define CT_REACTION_H #include "cantera/base/utilities.h" -#include "cantera/base/smart_ptr.h" #include "cantera/kinetics/RxnRates.h" #include "cantera/kinetics/Falloff.h" diff --git a/include/cantera/thermo/Species.h b/include/cantera/thermo/Species.h index 4989d9fa4..bd0fe1880 100644 --- a/include/cantera/thermo/Species.h +++ b/include/cantera/thermo/Species.h @@ -4,7 +4,6 @@ #define CT_SPECIES_H #include "cantera/base/ct_defs.h" -#include "cantera/base/smart_ptr.h" namespace Cantera { diff --git a/include/cantera/thermo/SpeciesThermo.h b/include/cantera/thermo/SpeciesThermo.h index 0668595a9..4bc976b2f 100644 --- a/include/cantera/thermo/SpeciesThermo.h +++ b/include/cantera/thermo/SpeciesThermo.h @@ -10,7 +10,6 @@ #define CT_SPECIESTHERMO_H #include "cantera/base/ct_defs.h" -#include "cantera/base/smart_ptr.h" namespace Cantera { diff --git a/include/cantera/transport/TransportData.h b/include/cantera/transport/TransportData.h index 5a7307576..a06848425 100644 --- a/include/cantera/transport/TransportData.h +++ b/include/cantera/transport/TransportData.h @@ -4,7 +4,6 @@ #define CT_TRANSPORTDATA_H #include "cantera/base/ct_defs.h" -#include "cantera/base/smart_ptr.h" namespace Cantera { diff --git a/interfaces/cython/cantera/_cantera.pxd b/interfaces/cython/cantera/_cantera.pxd index 5e08bbbec..69e709026 100644 --- a/interfaces/cython/cantera/_cantera.pxd +++ b/interfaces/cython/cantera/_cantera.pxd @@ -59,8 +59,8 @@ cdef extern from "cantera/cython/funcWrapper.h": CxxFunc1(callback_wrapper, void*) double eval(double) except +translate_exception -cdef extern from "cantera/base/smart_ptr.h": - cppclass shared_ptr "Cantera::shared_ptr" [T]: +cdef extern from "": + cppclass shared_ptr "std::shared_ptr" [T]: T* get() void reset(T*) diff --git a/src/base/application.h b/src/base/application.h index be4bd4d25..f3b51453e 100644 --- a/src/base/application.h +++ b/src/base/application.h @@ -7,7 +7,6 @@ #include "cantera/base/logger.h" #include -#include namespace Cantera { diff --git a/test_problems/VCSnonideal/LatticeSolid_LiSi/latsol.cpp b/test_problems/VCSnonideal/LatticeSolid_LiSi/latsol.cpp index 199c2d624..c4e8564eb 100644 --- a/test_problems/VCSnonideal/LatticeSolid_LiSi/latsol.cpp +++ b/test_problems/VCSnonideal/LatticeSolid_LiSi/latsol.cpp @@ -6,7 +6,6 @@ #include "cantera/thermo.h" #include -#include using namespace Cantera; diff --git a/test_problems/dustyGasTransport/dustyGasTransportTest.cpp b/test_problems/dustyGasTransport/dustyGasTransportTest.cpp index c58b07a61..c559731c5 100644 --- a/test_problems/dustyGasTransport/dustyGasTransportTest.cpp +++ b/test_problems/dustyGasTransport/dustyGasTransportTest.cpp @@ -2,7 +2,6 @@ #include "cantera/transport.h" #include "cantera/transport/DustyGasTransport.h" -#include #include using namespace std; diff --git a/test_problems/simpleTransport/simpleTransportTest.cpp b/test_problems/simpleTransport/simpleTransportTest.cpp index 1d177290a..0c31ba0dd 100644 --- a/test_problems/simpleTransport/simpleTransportTest.cpp +++ b/test_problems/simpleTransport/simpleTransportTest.cpp @@ -3,7 +3,6 @@ #include "cantera/thermo/HMWSoln.h" #include "cantera/transport/SimpleTransport.h" -#include #include using namespace std; diff --git a/test_problems/stoichSolidKinetics/stoichSolidKinetics.cpp b/test_problems/stoichSolidKinetics/stoichSolidKinetics.cpp index b4d39ef2e..de1acc0e2 100644 --- a/test_problems/stoichSolidKinetics/stoichSolidKinetics.cpp +++ b/test_problems/stoichSolidKinetics/stoichSolidKinetics.cpp @@ -4,7 +4,6 @@ #include "cantera/thermo/IonsFromNeutralVPSSTP.h" #include "cantera/IdealGasMix.h" -#include #include #include