40 #ifndef _PARAMETRIZABLECOLLECTION_H_ 41 #define _PARAMETRIZABLECOLLECTION_H_ 100 typename std::map<size_t, N* >::const_iterator it;
101 for (it=
set.
objectsSet_.begin(); it!=
set.objectsSet_.end(); it++)
113 typename std::map<size_t, N* >::const_iterator it;
114 for (it=
set.
objectsSet_.begin(); it!=
set.objectsSet_.end(); it++)
129 typename std::map<size_t, N*>::const_iterator it;
154 std::vector<size_t> vCh;
156 std::map<size_t, ParameterList > mNumPl;
158 for (
size_t i=0; i<parameters.
size(); i++)
160 std::string n=parameters[i].getName();
161 size_t t=n.rfind(
"_");
162 if (t==std::string::npos)
164 size_t num=(size_t)atoi(n.substr(t+1).c_str());
165 mNumPl[num].addParameter(
Parameter(n.substr(0,t),parameters[i].getValue()));
168 std::map<size_t, ParameterList >::iterator it;
171 for (it=mNumPl.begin(); it!=mNumPl.end(); it++){
210 const std::vector<size_t>
keys()
const 212 std::vector<size_t> vkeys;
213 typename std::map<size_t, N*>::const_iterator it;
216 vkeys.push_back(it->first);
231 typename std::map<size_t, N*>::const_iterator it=
objectsSet_.find(objectIndex);
235 return dynamic_cast<const N*
>(it->second);
240 typename std::map<size_t, N*>::iterator it=
objectsSet_.find(objectIndex);
263 typename std::map<size_t, N*>::iterator it=
objectsSet_.find(objectIndex);
265 throw BadIntegerException(
"ParametrizableCollection<N>::addObject. Object objectIndex already used", (
int)objectIndex);
271 std::vector<std::string> nplm;
272 nplm=
object->getParameters().getParameterNames();
274 for (
size_t i = 0; i < nplm.size(); i++)
282 if (dynamic_cast<ParameterAliasable*>(
object)){
284 for (
size_t i = 0; i < nplm.size(); i++)
286 std::vector<std::string> va=ppa->
getAlias(nplm[i]);
287 for (
size_t j=0;j<va.size();j++)
304 throw BadIntegerException(
"ParametrizableCollection<N>::removeObject. None Object at this objectIndex", (
int)objectIndex);
313 for (
size_t i = pl.
size(); i>0; i--)
315 std::string pn=pl[i-1].getName();
317 size_t pu=pn.rfind(
"_");
318 int nm=atoi(pn.substr(pu+1).c_str());
319 if (nm==(
int)objectIndex){
320 std::vector<std::string> alpn=
getAlias(pn);
321 for (
unsigned j=0; j<alpn.size(); j++)
355 #endif // _PARAMETRIZABLECOLLECTION_H_ void addObject(N *object, size_t objectIndex)
Add a new object to the set with a given number.
Plain collection of parametrizable objects.
std::vector< std::string > getAlias(const std::string &name) const
std::vector< size_t > vChanged_
A vector of the numbers of objects that have changed during the last fireParameterChanged.
Extend the Parametrizable interface with support for parameter aliases.
void clear()
Resets all the information contained in this object.
This class allows to perform a correspondence analysis.
Number exception: integers.
virtual std::vector< std::string > getAlias(const std::string &name) const =0
~ParametrizableCollection()
void unaliasParameters(const std::string &p1, const std::string &p2)
Detach two parameters previously set as 'aliased'.
std::map< size_t, N *> objectsSet_
Contains all objects used.
ParametrizableCollection< N > & operator=(const ParametrizableCollection< N > &set)
This class is designed to facilitate the manipulation of parameters.
void addParameter_(Parameter *parameter)
ParametrizableCollection< N > * clone() const
Create a copy of this object and send a pointer to it.
const N * operator[](size_t objectIndex) const
Get one object from the set knowing its index.
N * operator[](size_t objectIndex)
void deleteParameter_(size_t index)
static std::string toString(T t)
General template method to convert to a string.
The parameter list object.
A partial implementation of the Parametrizable interface.
std::vector< size_t > hasChanged() const
AbstractParameterAliasable & operator=(const AbstractParameterAliasable &ap)
void fireParameterChanged(const ParameterList ¶meters)
virtual void setName(const std::string &name)
Set the name of this parameter.
const std::vector< size_t > keys() const
Returns the keys of the set.
const ParameterList & getParameters() const
Get all parameters available.
size_t getNumberOfObjects() const
ParametrizableCollection()
Create an empty object set.
void aliasParameters(const std::string &p1, const std::string &p2)
Set two parameters as 'aliased'.
ParametrizableCollection(const ParametrizableCollection< N > &set)
const bool hasObject(size_t objectIndex) const
Says if there is a object with a given index.
N * replaceObject(N *object, size_t objectIndex)
Replace a object in the set, and returns the replaced one.
N * removeObject(size_t objectIndex)
Remove a object from the set, and all corresponding parameters.