20 #ifndef _TULIPWITHPARAMETER
21 #define _TULIPWITHPARAMETER
27 #include <tulip/tulipconf.h>
33 template<
class itType >
71 std::string defaultValue;
77 const std::string& help,
const std::string& defaultValue,
79 : name(name), type(type), help(help),
80 defaultValue(defaultValue), mandatory(mandatory), direction(direction) {
110 defaultValue = defVal;
153 template<
typename T>
void add(
const std::string& parameterName,
154 const std::string& help,
155 const std::string& defaultValue,
156 bool isMandatory =
true,
158 for (
unsigned int i = 0; i < parameters.size(); ++i) {
159 if (parameters[i].getName() == parameterName) {
161 tlp::warning() <<
"ParameterDescriptionList::addVar " << parameterName <<
" already exists" << std::endl;
171 isMandatory, direction);
172 parameters.push_back(newParameter);
180 tlp::Iterator<ParameterDescription>* getParameters()
const;
188 const std::string& getDefaultValue(
const std::string& parameterName)
const;
197 void setDefaultValue(
const std::string& parameterName,
198 const std::string& value);
207 void setDirection(
const std::string& parameterName,
216 bool isMandatory(
const std::string& parameterName)
const;
226 void buildDefaultDataSet(
DataSet& ioDataSet,
Graph* inG = NULL)
const;
233 inline unsigned int size()
const {
234 return parameters.size();
243 return parameters.empty();
248 std::vector<ParameterDescription> parameters;
252 #define HTML_HELP_OPEN() "<!DOCTYPE html><html><head>\
253 <style type=\"text/css\">.body { font-family: \"Segoe UI\", Candara, \"Bitstream Vera Sans\", \"DejaVu Sans\", \"Bitstream Vera Sans\", \"Trebuchet MS\", Verdana, \"Verdana Ref\", sans-serif; }\
254 .paramtable { width: 100%; border: 0px; border-bottom: 1px solid #C9C9C9; padding: 5px; }\
255 .help { font-style: italic; font-size: 90%; }</style>\
256 </head><body><table border=\"0\" class=\"paramtable\">"
258 #define HTML_HELP_DEF(A,B) "<tr><td><b>" A "</b><td>" B "</td></tr>"
260 #define HTML_HELP_BODY() "</table><p class=\"help\">"
262 #define HTML_HELP_CLOSE() "</p></body></html>"
291 const std::string &help,
292 const std::string &defaultValue,
293 bool isMandatory =
true) {
294 parameters.template add<T>(name, help, defaultValue, isMandatory, IN_PARAM);
308 const std::string &help=std::string(),
309 const std::string &defaultValue = std::string(),
310 bool isMandatory =
true) {
311 parameters.template add<T>(name, help, defaultValue, isMandatory, OUT_PARAM);
325 const std::string &help=std::string(),
326 const std::string &defaultValue = std::string(),
327 bool isMandatory =
true) {
328 parameters.template add<T>(name, help, defaultValue, isMandatory, INOUT_PARAM);
345 const std::string &help=std::string(),
346 const std::string &defaultValue = std::string(),
347 bool isMandatory =
true) {
348 addInParameter<T>(name, help, defaultValue, isMandatory);
356 bool inputRequired()
const;
void add(const std::string ¶meterName, const std::string &help, const std::string &defaultValue, bool isMandatory=true, ParameterDirection direction=IN_PARAM)
Adds a new parameter of type T to the list.
void addOutParameter(const std::string &name, const std::string &help=std::string(), const std::string &defaultValue=std::string(), bool isMandatory=true)
Adds an OUT parameter to the plug-in.
const std::string & getName() const
bool empty() const
Test if the list is empty.
void setDirection(ParameterDirection dir)
A container that can store data from any type.
ParameterDirection getDirection() const
unsigned int size() const
Returns the number of parameters.
void setDefaultValue(const std::string &defVal)
Set the parameter's default value.
void addInParameter(const std::string &name, const std::string &help, const std::string &defaultValue, bool isMandatory=true)
Adds an IN parameter to the plug-in.
ParameterDirection
The ParameterDirection enum describes how a parameter is passed to a plugin The parameter can be seen...
void addParameter(const std::string &name, const std::string &help=std::string(), const std::string &defaultValue=std::string(), bool isMandatory=true)
Adds an IN parameter to the plug-in (deprecated)
ParameterDescriptionList parameters
The internal structure storing the parameters.
void addInOutParameter(const std::string &name, const std::string &help=std::string(), const std::string &defaultValue=std::string(), bool isMandatory=true)
Adds an INOUT parameter to the plug-in.
const std::string & getHelp() const
const std::string & getTypeName() const
const std::string & getDefaultValue() const
This class describes parameters taken by a plugin.
Describes a plugin's parameter.
This class describes parameters on a plug-in.