24 #ifndef __SENSORMOTORINFOABLE_H
25 #define __SENSORMOTORINFOABLE_H
31 #include <selforg/sensormotorinfo.h>
67 void setNames(
const std::vector<std::string>& names){
68 this->
func=[names](
int index) {
69 if (index>=(
int)names.size())
return names.back() +
"Unknown";
70 else return names[index];
81 std::list<SensorMotorInfo>
getInfos(
int number)
const {
82 std::list<SensorMotorInfo> l;
83 for(
int i=0; i<number; i++){
99 return std::to_string(index+1);
void setBaseInfo(const SensorMotorInfo &baseinfo)
Definition: sensormotorinfoable.h:50
void setNames(const std::vector< std::string > &names)
set names explicitly (basename is anyway suffixed)
Definition: sensormotorinfoable.h:67
NamingFunction func
Definition: sensormotorinfoable.h:103
std::function< std::string(int)> NamingFunction
function that returns the name given the index
Definition: sensormotorinfoable.h:40
SensorMotorInfoAble()
Definition: sensormotorinfoable.h:42
int index
Definition: sensormotorinfo.h:52
SensorMotorInfo getBaseInfo()
Definition: sensormotorinfoable.h:54
SensorMotorInfo baseinfo
Definition: sensormotorinfoable.h:104
Interface for objects, that can be stored and restored to/from a file stream (binary).
Definition: sensormotorinfo.h:33
NamingFunction getNamingFunc() const
Definition: sensormotorinfoable.h:62
static std::string defaultNameing(int index)
the default implementation is for index==0: basename, otherwise basename + (index+1) ...
Definition: sensormotorinfoable.h:95
void setBaseName(const std::string &basename)
Definition: sensormotorinfoable.h:45
std::string getName(int index) const
returns the name of a single item. Typically called from within Sensor and Motor class.
Definition: sensormotorinfoable.h:75
std::string name
Definition: sensormotorinfo.h:49
Abstract class for giving names to sensors and motors.
Definition: sensormotorinfoable.h:37
std::list< SensorMotorInfo > getInfos(int number) const
get all infos.
Definition: sensormotorinfoable.h:81
void setNamingFunc(const NamingFunction &func)
Definition: sensormotorinfoable.h:58