Tulip  5.2.1
Large graphs analysis and drawing
tlp::ParameterDescriptionList Struct Reference

#include <WithParameter.h>

Public Member Functions

template<typename T >
void add (const std::string &parameterName, const std::string &help, const std::string &defaultValue, bool isMandatory=true, ParameterDirection direction=IN_PARAM, const std::string &valuesDescription=std::string())
 
void buildDefaultDataSet (DataSet &ioDataSet, Graph *inG=nullptr) const
 
bool empty () const
 
const std::string & getDefaultValue (const std::string &parameterName) const
 
tlp::Iterator< ParameterDescription > * getParameters () const
 
bool isMandatory (const std::string &parameterName) const
 
void setDefaultValue (const std::string &parameterName, const std::string &value)
 
void setDirection (const std::string &parameterName, ParameterDirection direction)
 
unsigned int size () const
 

Detailed Description

This class describes parameters taken by a plugin.

It is used by WithParameter to store parameters. Each parameter is identified by a name, has a default value, a value, a help string, and a boolean indicating whether it is mandatory or optional.

Definition at line 152 of file WithParameter.h.

Member Function Documentation

◆ add()

template<typename T >
void tlp::ParameterDescriptionList::add ( const std::string &  parameterName,
const std::string &  help,
const std::string &  defaultValue,
bool  isMandatory = true,
ParameterDirection  direction = IN_PARAM,
const std::string &  valuesDescription = std::string() 
)
inline

Adds a new parameter of type T to the list.

Parameters
parameterNameThe name of the parameter.
helpThe help string of this parameter. Defaults to std::string().
defaultValueThe default value of this parameter. Defaults to std::string().
isMandatoryWhether this parameter is mandatory or optional. Defaults to true.
directionThe parameter's direction (see tlp::ParameterDirection for details)
Returns
void

Definition at line 167 of file WithParameter.h.

◆ buildDefaultDataSet()

void tlp::ParameterDescriptionList::buildDefaultDataSet ( DataSet ioDataSet,
Graph inG = nullptr 
) const

Builds a DataSet containing the default values for each parameter. If the DataSet has a key which is equal to a parameter's name, the existing value is kept.

Parameters
ioDataSetThe input dataset on which the parameters names will be associated with their default values.
inGA graph on which to create properties if any parameter is of a property type. Defaults to 0.
Returns
void

◆ empty()

bool tlp::ParameterDescriptionList::empty ( ) const
inline

Test if the list is empty.

Returns
bool true if the parameter description list is empty, false otherwise.

Definition at line 257 of file WithParameter.h.

◆ getDefaultValue()

const std::string& tlp::ParameterDescriptionList::getDefaultValue ( const std::string &  parameterName) const

retrieves the default value of a parameter.

Parameters
parameterNameThe name of the parameter to retrieve the default value of.
Returns
The default value of the parameter:string

◆ getParameters()

tlp::Iterator<ParameterDescription>* tlp::ParameterDescriptionList::getParameters ( ) const

Retrieves an Iterator on the parameters.

Returns
An iterator over the parameters :Iterator<ParameterDescription>*

◆ isMandatory()

bool tlp::ParameterDescriptionList::isMandatory ( const std::string &  parameterName) const

Retrieves whether a parameter is mandatory or optional.

Parameters
parameterNameThe name of the parameter for which to check if it is mandatory or optional.
Returns
bool true if the parameter is mandatory, false if it is optional.

◆ setDefaultValue()

void tlp::ParameterDescriptionList::setDefaultValue ( const std::string &  parameterName,
const std::string &  value 
)

Sets the default value of a parameter.

Parameters
parameterNameThe name of the parameter to set the value of.
valueThe new value for this parameter.
Returns
void

◆ setDirection()

void tlp::ParameterDescriptionList::setDirection ( const std::string &  parameterName,
ParameterDirection  direction 
)

Sets the direction of a parameter.

Parameters
parameterNameThe name of the parameter to set the value of.
dirThe new direction for this parameter.
Returns
void

◆ size()

unsigned int tlp::ParameterDescriptionList::size ( ) const
inline

Returns the number of parameters.

Returns
The number of parameters

Definition at line 248 of file WithParameter.h.