27 #include "utility/kernel/CommandEntity.h" 29 #include "utility/utils/misc_utils/colormod.h" 34 class LoadCombinationVector;
39 template <
class Factors>
43 typedef typename std::map<std::string,Factors>::const_iterator const_iterator;
44 typedef typename std::map<std::string,Factors>::iterator iterator;
47 bool exists(
const std::string &)
const;
48 Factors *getPtrCoefs(
const std::string &);
49 Factors *crea_coefs(
const std::string &);
50 void print_err_not_found(
const std::string &,
const std::string &)
const;
53 const Factors *getPtrCoefs(
const std::string &)
const;
56 std::deque<std::string>
getNames(
void)
const;
57 boost::python::list
getKeys(
void)
const;
60 template <
class Factors>
64 template <
class Factors>
66 {
return (this->find(name)!=this->end()); }
69 template <
class Factors>
72 std::cerr << Color::red <<
getClassName() <<
"::" << functionName
73 <<
"; factors with name: '" 74 << name <<
"' not found." << std::endl
75 <<
" candidates are: ";
76 const std::deque<std::string> candidates= this->
getNames();
77 if(!candidates.empty())
79 std::deque<std::string>::const_iterator i= candidates.begin();
82 for(;i!=candidates.end();i++)
83 std::cerr <<
", " << *i;
84 std::cerr << Color::def << std::endl;
89 template <
class Factors>
92 std::deque<std::string> retval;
93 for(const_iterator i= this->begin();i!= this->end();i++)
94 retval.push_back(i->first);
99 template <
class Factors>
102 boost::python::list retval;
103 for(const_iterator i=this->begin();i!=this->end();i++)
104 retval.append((*i).first);
110 template <
class Factors>
114 if(this->exists(name))
115 retval= &((*this)[name]);
117 this->print_err_not_found(__FUNCTION__,name);
122 template <
class Factors>
125 if(this->exists(name))
126 return this->find(name)->second;
129 this->print_err_not_found(__FUNCTION__,name);
130 return default_factors;
135 template <
class Factors>
138 const Factors *retval=
nullptr;
139 if(this->exists(name))
140 retval= &(this->find(name)->second);
142 this->print_err_not_found(__FUNCTION__,name);
147 template <
class Factors>
152 template <
class Factors>
156 if(this->exists(name))
157 retval= &(this->find(name)->second);
162 retval= getPtrCoefs(name);
170 template <
class Factors>
172 { (*this)[name]= c; }
Routines to generate combinations of actions.
Almacena todas las familias de acciones.
Definition: Factors.h:34
Combination factor container.
Definition: FactorsMap.h:40
FactorsMap(void)
Default constructor.
Definition: FactorsMap.h:148
boost::python::list getKeys(void) const
Return the names of the factor families.
Definition: FactorsMap.h:100
virtual std::string getClassName(void) const
Returns demangled class name.
Definition: EntityWithOwner.cc:90
Objet that can execute python scripts.
Definition: CommandEntity.h:40
const Factors & BuscaCoefs(const std::string &) const
Return the factors identified by name.
Definition: FactorsMap.h:123
std::deque< std::string > getNames(void) const
Return the names of the factor families.
Definition: FactorsMap.h:90
void insert(const std::string &, const Factors &)
Inserts the coefficients.
Definition: FactorsMap.h:171