8#include <framework/core/ModuleParamList.templateDetails.h>
10#include <framework/core/ModuleParamInfoPython.h>
11#include <framework/core/FrameworkExceptions.h>
13#include <boost/python/object.hpp>
14#include <boost/python/list.hpp>
23 "Could not find the parameter with the "
24 "name '%1%'! The value of the parameter "
29 "The type of the module parameter '%1%' "
30 "(%2%) is different from the type of the "
31 "value it should be set to (%3%)!");
35 throw (ModuleParameterNotFoundError() << name);
39 const std::string& expectedTypeInfo,
40 const std::string& typeInfo)
42 throw (ModuleParameterTypeError() << name << expectedTypeInfo << typeInfo);
56 std::vector<std::string> missingParam;
58 if (mapEntry.second->isForcedInSteering() && !mapEntry.second->isSetInSteering())
59 missingParam.push_back(mapEntry.first);
66 std::shared_ptr<boost::python::list> returnList(
new boost::python::list);
67 std::map<std::string, ModuleParamPtr>::const_iterator mapIter;
73 newParamInfo.
m_name = mapIter->first;
75 newParamInfo.
m_typeName = currParam->getTypeInfo();
81 returnList->append(boost::python::object(newParamInfo));
90 myParam->setValueFromParam(*param.second.get());
97 std::vector<std::string> names;
100 names.push_back(nameAndParam.first);
127 std::map<std::string, ModuleParamPtr>::const_iterator mapIter;
131 return mapIter->second;
132 }
else throw (ModuleParameterNotFoundError() << name);
Class to store basic information about a parameter.
bool m_forceInSteering
If true the parameter has to be set by the user in the steering file.
bool m_setInSteering
True if the parameter was set in the steering file.
std::string m_description
The description of the parameter.
boost::python::list m_defaultValues
The default values of the parameter as a python list.
std::string m_name
The name of the parameter.
boost::python::list m_values
The values of the parameter as a python list.
std::string m_typeName
The name of the type of the parameter.
The Module parameter list class.
std::shared_ptr< boost::python::list > getParamInfoListPython() const
Returns a python list of all parameters.
std::map< std::string, ModuleParamPtr > m_paramMap
Stores the module parameters together with a string name as key.
ModuleParamList()
Constructor.
std::string getParameterDescription(const std::string &name) const
Returns the description of a parameter given by its name.
std::vector< std::string > getUnsetForcedParams() const
Returns list of unset parameters (if they are required to have a value.
std::string getParameterTypeInfo(const std::string &name) const
Returns the type info of a parameter given by its name.
void setParameters(const ModuleParamList ¶ms)
Set values for parameters from other parameter list.
std::vector< std::string > getParameterNames() const
Returns the names of all parameters in this parameter list.
static void throwTypeError(const std::string &name, const std::string &expectedTypeInfo, const std::string &typeInfo)
Throws an error for a requested parameter that exists but was request with the wrong type.
ModuleParamPtr getParameterPtr(const std::string &name) const
Returns a ModuleParamPtr to a parameter.
~ModuleParamList()
Destructor.
static void throwNotFoundError(const std::string &name)
Throws an error for a requested parameter that does not exist.
std::shared_ptr< ModuleParamBase > ModuleParamPtr
Defines a pointer to a module parameter as a boost shared pointer. */.
void addParameter(const std::string &name, T ¶mVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module list.
#define BELLE2_DEFINE_EXCEPTION(ClassName, Message)
Macro that defines an exception with the given message template.
void getParamValuesPython(const std::string &name, PythonObject &pyOutput, bool defaultValues) const
Returns a python object containing the value or default value of the given parameter.
Abstract base class for different kinds of events.