98 T*
find(
const std::string& name)
103 if (item.name_ == name)
118 new_item.name_ = name;
128 T*
rename(
const std::string& old_name,
const std::string& new_name)
130 T* item =
find(old_name);
131 T* existing_item =
find(new_name);
134 throw std::runtime_error(
"An item already exists with that name!");
136 item->name_ = new_name;
148 for (
auto it = container.begin(); it != container.end(); ++it)
150 if (it->name_ == name)
164 T*
get(
const std::string& name,
const std::string& old_name =
"")
166 if (name == old_name)
170 else if (old_name.empty())
176 return rename(old_name, name);
Contains all of the non-GUI code necessary for doing one "screen" worth of setup.
DataWarehousePtr config_data_
Setup Step that contains the SRDFConfig.
bool isReady() const override
Return true if the data necessary to proceed with this step has been configured.
void onInit() override
Overridable initialization method.
std::shared_ptr< SRDFConfig > srdf_config_
This class provides a number of standard operations based on srdf's vector members.
T * get(const std::string &name, const std::string &old_name="")
Get a pointer to an item with the given name, creating if necessary. If old_name is provided (and is ...
T * find(const std::string &name)
Return a pointer to an item with the given name if it exists, otherwise null.
T * create(const std::string &name)
Create an item with the given name and return the pointer.
T * rename(const std::string &old_name, const std::string &new_name)
Renames an item and returns a pointer to the item.
virtual InformationFields getInfoField() const =0
Returns the info field associated with this part of the SRDF.
virtual std::vector< T > & getContainer()=0
Returns the reference to the vector in the SRDF.
bool remove(const std::string &name)
Delete an item with the given name from the list.