Deprecate Factory pointer argument to "newFoo" convenience functions

This commit is contained in:
Ray Speth 2016-07-07 21:12:39 -04:00
parent 7f21aa0f45
commit 45099255de
7 changed files with 53 additions and 4 deletions

View file

@ -76,23 +76,35 @@ private:
/**
* Create a new kinetics manager.
* @deprecated The `KineticsFactory*` argument to this function is deprecated
* and will be removed after Cantera 2.3.
*/
inline Kinetics* newKineticsMgr(XML_Node& phase,
std::vector<ThermoPhase*> th, KineticsFactory* f=0)
{
if (f == 0) {
f = KineticsFactory::factory();
} else {
warn_deprecated("newKineticsMgr(XML_Node&, KineticsFactory*)",
"The `KineticsFactory*` argument to this function is deprecated and"
" will be removed after Cantera 2.3.");
}
return f->newKinetics(phase, th);
}
/**
* Create a new kinetics manager.
* @deprecated The `KineticsFactory*` argument to this function is deprecated
* and will be removed after Cantera 2.3.
*/
inline Kinetics* newKineticsMgr(const std::string& model, KineticsFactory* f=0)
{
if (f == 0) {
f = KineticsFactory::factory();
} else {
warn_deprecated("newKineticsMgr(string, KineticsFactory*)",
"The `KineticsFactory*` argument to this function is deprecated and"
" will be removed after Cantera 2.3.");
}
return f->newKinetics(model);
}

View file

@ -95,12 +95,18 @@ private:
* @returns a pointer to a new ThermoPhase instance matching the model string.
* Returns NULL if something went wrong. Throws an exception
* UnknownThermoPhaseModel if the string wasn't matched.
* @deprecated The `ThermoFactory*` argument to this function is deprecated and
* will be removed after Cantera 2.3.
*/
inline ThermoPhase* newThermoPhase(const std::string& model,
ThermoFactory* f=0)
{
if (f == 0) {
f = ThermoFactory::factory();
} else {
warn_deprecated("newThermoPhase(string, ThermoFactory*)",
"The `ThermoFactory*` argument to this function is deprecated and"
" will be removed after Cantera 2.3.");
}
return f->create(model);
}

View file

@ -255,11 +255,15 @@ private:
* @param loglevel int containing the Loglevel, defaults to zero
* @param f optional pointer to the TransportFactory object
* @param ndim Number of dimensions for transport fluxes
*
* @deprecated Use the version which does not take a `TransportFactory*`.To be
* removed after Cantera 2.3.
* @ingroup tranprops
*/
Transport* newTransportMgr(const std::string& transportModel = "", thermo_t* thermo = 0, int loglevel = 0,
TransportFactory* f = 0, int ndim=1);
Transport* newTransportMgr(const std::string& transportModel, thermo_t* thermo, int loglevel,
TransportFactory* f, int ndim=1);
Transport* newTransportMgr(const std::string& transportModel = "",
thermo_t* thermo = 0, int loglevel = 0, int ndim=1);
//! Create a new transport manager instance.
/*!
@ -267,7 +271,8 @@ Transport* newTransportMgr(const std::string& transportModel = "", thermo_t* the
* @param loglevel int containing the Loglevel, defaults to zero
* @param f pointer to the TransportFactory object if it's been allocated
* @returns a transport manager for the phase
*
* @deprecated The `TransportFactory*` argument to this function is deprecated
* and will be removed after Cantera 2.3.
* @ingroup tranprops
*/
Transport* newDefaultTransportMgr(thermo_t* thermo, int loglevel = 0, TransportFactory* f = 0);

View file

@ -41,11 +41,18 @@ private:
ReactorFactory();
};
//! Create a Reactor object of the specified type
//! @deprecated The `ReactorFactory*` argument to this function is deprecated and
//! will be removed after Cantera 2.3.
inline ReactorBase* newReactor(const std::string& model,
ReactorFactory* f=0)
{
if (f == 0) {
f = ReactorFactory::factory();
} else {
warn_deprecated("newReactor(string, ReactorFactory*)",
"The `ReactorFactory*` argument to this function is deprecated and"
" will be removed after Cantera 2.3.");
}
return f->newReactor(model);
}

View file

@ -337,6 +337,10 @@ VPSSMgr* newVPSSMgr(VPStandardStateTP* tp_ptr,
{
if (f == 0) {
f = VPSSMgrFactory::factory();
} else {
warn_deprecated("newVPSSMgr(VPStandardStateTP*, XML_Node*, vector<XML_Node*>, VPSSMgrFactory*)",
"The `VPSSMgrFactory*` argument to this function is deprecated and"
" will be removed after Cantera 2.3.");
}
return f->newVPSSMgr(tp_ptr, phaseNode_ptr, spDataNodeList);
}

View file

@ -176,6 +176,8 @@ VPSSMgr* newVPSSMgr(VPSSMgr_enumType type,
* of species XML nodes that will be in the phase
* @param f Pointer to a VPSSMgrFactory. optional
* parameter. Defaults to NULL.
* @deprecated The `VPSSMgrFactory*` argument to this function is deprecated and
* will be removed after Cantera 2.3.
*/
VPSSMgr* newVPSSMgr(VPStandardStateTP* vp_ptr,
XML_Node* phaseNode_ptr,

View file

@ -594,16 +594,29 @@ void TransportFactory::getSolidTransportData(const XML_Node& transportNode,
Transport* newTransportMgr(const std::string& transportModel, thermo_t* thermo, int loglevel, TransportFactory* f, int ndim)
{
warn_deprecated("newTransportMgr(string, thermo_t*, int, TransportFactory*, int)",
"This overload is deprecated and will be removed after Cantera 2.3."
" Use the version that does not take a TransportFactory*.");
if (f == 0) {
f = TransportFactory::factory();
}
return f->newTransport(transportModel, thermo, loglevel, ndim);
}
Transport* newTransportMgr(const std::string& transportModel, thermo_t* thermo, int loglevel, int ndim)
{
TransportFactory* f = TransportFactory::factory();
return f->newTransport(transportModel, thermo, loglevel, ndim);
}
Transport* newDefaultTransportMgr(thermo_t* thermo, int loglevel, TransportFactory* f)
{
if (f == 0) {
f = TransportFactory::factory();
} else {
warn_deprecated("newDefaultTransportMgr(ThermoPhase*, int, TransportFactory*)",
"The `TransportFactory*` argument to this function is deprecated"
" and will be removed after Cantera 2.3.");
}
return f->newTransport(thermo, loglevel);
}