BipedalLocomotion::System::VariablesHandler class

VariableHandler is useful to handle variables in an optimization problem, Their name, dimension and position.

Public types

class VariableDescription

Public functions

auto initialize(std::weak_ptr<const ParametersHandler::IParametersHandler> handler) -> bool noexcept
Initialize the VariablesHandler class.
auto addVariable(const std::string& name, const std::size_t& size) -> bool noexcept
Add a new variable to the list.
auto addVariable(const std::string& name, const std::size_t& size, const std::vector<std::string>& elementsName) -> bool noexcept
Add a new variable to the list.
auto addVariable(const std::string& name, const std::vector<std::string>& elementsName) -> bool noexcept
Add a new variable to the list.
auto getVariable(const std::string& name) const -> const VariableDescription& noexcept
Get a variable from the list.
auto getVariable(const std::string& name, VariableDescription& description) const -> bool noexcept
Get a variable from the list.
auto getNumberOfVariables() const -> const std::size_t& noexcept
Get the number of variables.
auto toString() const -> std::string noexcept
Get the string representation of the handler.
void clear() noexcept
Clear the content of the handler.

Function documentation

bool BipedalLocomotion::System::VariablesHandler::initialize(std::weak_ptr<const ParametersHandler::IParametersHandler> handler) noexcept

Initialize the VariablesHandler class.

Parameters
handler

pointer to parameters handler @notice The following parameters are required

Parameter NameTypeDescriptionMandatory
variables_namevector<string>List containing the name of the variablesYes
variables_sizevector<int>List containing the size of the variables. The size must be a strictly positive numberYes
<variable_name>_elements_namevector<string>List containing the name of the elements associated to a variable.Yes
Returns true/false in case of success/failure

This method calls VariablesHandler::addVariable using the parameters stored in the handler

bool BipedalLocomotion::System::VariablesHandler::addVariable(const std::string& name, const std::size_t& size) noexcept

Add a new variable to the list.

Parameters
name of the variable
size the size of the variable
Returns true/false in case of success/failure

bool BipedalLocomotion::System::VariablesHandler::addVariable(const std::string& name, const std::size_t& size, const std::vector<std::string>& elementsName) noexcept

Add a new variable to the list.

Parameters
name of the variable
size the size of the variable
elementsName vector containing the name associated to each elements of the variable
Returns true/false in case of success/failure

bool BipedalLocomotion::System::VariablesHandler::addVariable(const std::string& name, const std::vector<std::string>& elementsName) noexcept

Add a new variable to the list.

Parameters
name of the variable
elementsName vector containing the name associated to each elements of the variable
Returns true/false in case of success/failure

const VariableDescription& BipedalLocomotion::System::VariablesHandler::getVariable(const std::string& name) const noexcept

Get a variable from the list.

Parameters
name of the variable
Returns the variable description associated to the variable

bool BipedalLocomotion::System::VariablesHandler::getVariable(const std::string& name, VariableDescription& description) const noexcept

Get a variable from the list.

Parameters
name of the variable
description out the description of the variable
Returns true/false in case of success/failure

const std::size_t& BipedalLocomotion::System::VariablesHandler::getNumberOfVariables() const noexcept

Get the number of variables.

Returns the total number of variables

std::string BipedalLocomotion::System::VariablesHandler::toString() const noexcept

Get the string representation of the handler.

Returns a string containing the name of all the variables and their description.