A helper class for batch setting and restoring groups of parameter values. More...
#include <Component/ModelParamBatch.H>
Public Member Functions | |
template<class T > | |
void | addParamValue (const std::string ¶mname, const T &val) |
Add a new parameter name and associated value to our list of managed parameters. | |
void | installValues (ModelComponent *comp) |
Install our stored parameter values in the given component. | |
void | restoreValues (ModelComponent *comp) |
Restore parameter values saved during a previous installValues() call. | |
void | addParamValueAux (const std::string ¶mname, const rutz::shared_ptr< RefHolder > &valref) |
Auxiliary implementation function for addParamValue(). |
A helper class for batch setting and restoring groups of parameter values.
Typical usage would be like this:
ModelParamBatch params; params.addParamValue("SomeParam", int(1)); params.addParamValue("SomeFlag", true); params.addParamValue("SomeString", "hello"); ModelManager manager; params.installValues(&manager); // params are now 1,true,"hello" // ... do some work // ... later: params.restoreValues(&manager); // params are now back to their original values
Definition at line 69 of file ModelParamBatch.H.
void ModelParamBatch::addParamValue | ( | const std::string & | paramname, | |
const T & | val | |||
) | [inline] |
Add a new parameter name and associated value to our list of managed parameters.
Definition at line 78 of file ModelParamBatch.H.
References addParamValueAux().
void ModelParamBatch::addParamValueAux | ( | const std::string & | paramname, | |
const rutz::shared_ptr< RefHolder > & | valref | |||
) |
Auxiliary implementation function for addParamValue().
Definition at line 91 of file ModelParamBatch.C.
Referenced by addParamValue().
void ModelParamBatch::installValues | ( | ModelComponent * | comp | ) |
Install our stored parameter values in the given component.
The component's current values for those parameters will be remembered so that they can later be restored with restoreValue().
Definition at line 59 of file ModelParamBatch.C.
References ModelComponent::getModelParamString(), MC_RECURSE, and ModelComponent::setModelParamValAux().
void ModelParamBatch::restoreValues | ( | ModelComponent * | comp | ) |
Restore parameter values saved during a previous installValues() call.
Definition at line 75 of file ModelParamBatch.C.
References MC_RECURSE, and ModelComponent::setModelParamString().