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;
147 template<
typename T>
void add(
const std::string& parameterName,
148 const std::string& help,
149 const std::string& defaultValue,
150 bool isMandatory =
true,
152 for (
unsigned int i = 0; i < parameters.size(); ++i) {
153 if (parameters[i].getName() == parameterName) {
155 tlp::warning() <<
"ParameterDescriptionList::addVar " << parameterName <<
" already exists" << std::endl;
165 isMandatory, direction);
166 parameters.push_back(newParameter);
174 tlp::Iterator<ParameterDescription>* getParameters()
const;
182 const std::string& getDefaultValue(
const std::string& parameterName)
const;
191 void setDefaultValue(
const std::string& parameterName,
192 const std::string& value);
200 bool isMandatory(
const std::string& parameterName)
const;
210 void buildDefaultDataSet(
DataSet& ioDataSet,
Graph* inG = NULL)
const;
212 unsigned int size()
const {
213 return parameters.size();
216 ParameterDescription* getParameter(
const std::string& parameterName);
217 std::vector<ParameterDescription> parameters;
221 #define HTML_HELP_OPEN() "<!DOCTYPE html><html><head>\
222 <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; }\
223 .paramtable { width: 100%; border: 0px; border-bottom: 1px solid #C9C9C9; padding: 5px; }\
224 .help { font-style: italic; font-size: 90%; }</style>\
225 </head><body><table border=\"0\" class=\"paramtable\">"
227 #define HTML_HELP_DEF(A,B) "<tr><td><b>"A"</b><td>"B"</td></tr>"
229 #define HTML_HELP_BODY() "</table><p class=\"help\">"
231 #define HTML_HELP_CLOSE() "</p></body></html>"
259 void addInParameter(
const std::string &name,
260 const std::string &help,
261 const std::string &defaultValue,
262 bool isMandatory =
true) {
263 parameters.template add<T>(name, help, defaultValue, isMandatory, IN_PARAM);
276 void addOutParameter(
const std::string &name,
277 const std::string &help=std::string(),
278 const std::string &defaultValue = std::string(),
279 bool isMandatory =
true) {
280 parameters.template add<T>(name, help, defaultValue, isMandatory, OUT_PARAM);
293 void addInOutParameter(
const std::string &name,
294 const std::string &help=std::string(),
295 const std::string &defaultValue = std::string(),
296 bool isMandatory =
true) {
297 parameters.template add<T>(name, help, defaultValue, isMandatory, INOUT_PARAM);
313 void _DEPRECATED addParameter(
const std::string &name,
314 const std::string &help=std::string(),
315 const std::string &defaultValue = std::string(),
316 bool isMandatory =
true) {
317 addInParameter<T>(name, help, defaultValue, isMandatory);
325 bool inputRequired()
const;