25 template <
typename IdentifierType,
class AbstractProduct>
30 const char*
what()
const throw() {
return "Unknown Type"; }
44 template <
typename IdentifierType,
class AbstractProduct>
49 std::ostringstream os;
50 os <<
"FunctionMap error: unknown identifier: id = " <<
id << std::endl;
60 template <
typename IdentifierType,
class AbstractProduct>
82 template<
typename Disambiguator,
83 class AbstractProduct,
84 typename IdentifierType,
86 typename ProductCall = AbstractProduct (*)(),
88 class FunctionMap :
public FunctionMapErrorPolicy<IdentifierType, AbstractProduct>
109 return associations_.insert(
110 typename IdToProductMap::value_type(
id, call)).second;
120 return associations_.erase(
id) == 1;
130 typename IdToProductMap::const_iterator
i = associations_.find(
id);
131 if (
i == associations_.end())
133 typedef typename IdToProductMap::const_iterator CI;
134 QDPIO::cerr <<
"Couldnt find key " <<
id <<
" in the std::map: " << std::endl;
135 QDPIO::cerr <<
"Available Keys are : " << std::endl;
136 for( CI
j = associations_.begin();
137 j != associations_.end();
j++) {
138 QDPIO::cerr <<
j->first << std::endl << std::flush;
141 return this->OnUnknownType(
id);
144 return (
i->second)();
156 typename IdToProductMap::const_iterator
i = associations_.find(
id);
157 if (
i == associations_.end())
159 typedef typename IdToProductMap::const_iterator CI;
160 QDPIO::cerr <<
"Couldnt find key " <<
id <<
" in the std::map: " << std::endl;
161 QDPIO::cerr <<
"Available Keys are : " << std::endl;
162 for( CI
j = associations_.begin();
163 j != associations_.end();
j++) {
164 QDPIO::cerr <<
j->first << std::endl << std::flush;
167 return this->OnUnknownType(
id);
170 return (
i->second)(p1);
183 typename IdToProductMap::const_iterator
i = associations_.find(
id);
184 if (
i == associations_.end())
186 typedef typename IdToProductMap::const_iterator CI;
187 QDPIO::cerr <<
"Couldnt find key " <<
id <<
" in the std::map: " << std::endl;
188 QDPIO::cerr <<
"Available Keys are : " << std::endl;
189 for( CI
j = associations_.begin();
190 j != associations_.end();
j++) {
191 QDPIO::cerr <<
j->first << std::endl << std::flush;
194 return this->OnUnknownType(
id);
197 return (
i->second)(p1, p2);
211 typename IdToProductMap::const_iterator
i = associations_.find(
id);
212 if (
i == associations_.end())
214 typedef typename IdToProductMap::const_iterator CI;
215 QDPIO::cerr <<
"Couldnt find key " <<
id <<
" in the std::map: " << std::endl;
216 QDPIO::cerr <<
"Available Keys are : " << std::endl;
217 for( CI
j = associations_.begin();
218 j != associations_.end();
j++) {
219 QDPIO::cerr <<
j->first << std::endl << std::flush;
222 return this->OnUnknownType(
id);
225 return (
i->second)(p1, p2, p3);
241 typename IdToProductMap::const_iterator
i = associations_.find(
id);
242 if (
i == associations_.end())
244 typedef typename IdToProductMap::const_iterator CI;
245 QDPIO::cerr <<
"Couldnt find key " <<
id <<
" in the std::map: " << std::endl;
246 QDPIO::cerr <<
"Available Keys are : " << std::endl;
247 for( CI
j = associations_.begin();
248 j != associations_.end();
j++) {
249 QDPIO::cerr <<
j->first << std::endl << std::flush;
252 return this->OnUnknownType(
id);
255 return (
i->second)(p1, p2, p3, p4);
272 typename IdToProductMap::const_iterator
i = associations_.find(
id);
273 if (
i == associations_.end())
275 typedef typename IdToProductMap::const_iterator CI;
276 QDPIO::cerr <<
"Couldnt find key " <<
id <<
" in the std::map: " << std::endl;
277 QDPIO::cerr <<
"Available Keys are : " << std::endl;
278 for( CI
j = associations_.begin();
279 j != associations_.end();
j++) {
280 QDPIO::cerr <<
j->first << std::endl << std::flush;
283 return this->OnUnknownType(
id);
286 return (
i->second)(p1, p2, p3, p4, p5);
304 typename IdToProductMap::const_iterator
i = associations_.find(
id);
305 if (
i == associations_.end())
307 typedef typename IdToProductMap::const_iterator CI;
308 QDPIO::cerr <<
"Couldnt find key " <<
id <<
" in the std::map: " << std::endl;
309 QDPIO::cerr <<
"Available Keys are : " << std::endl;
310 for( CI
j = associations_.begin();
311 j != associations_.end();
j++) {
312 QDPIO::cerr <<
j->first << std::endl << std::flush;
315 return this->OnUnknownType(
id);
318 return (
i->second)(p1, p2, p3, p4, p5, p6);
Primary include file for CHROMA library code.
std::map< IdentifierType, ProductCall > IdToProductMap
IdToProductMap associations_
AbstractProduct callFunction(const IdentifierType &id, Parm1 p1, Parm2 p2, Parm3 p3)
Call the function.
AbstractProduct callFunction(const IdentifierType &id, Parm1 p1, Parm2 p2)
Call the function.
AbstractProduct callFunction(const IdentifierType &id, Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, Parm6 p6)
Call the function.
bool unregisterFunction(const IdentifierType &id)
Unregister the function.
AbstractProduct callFunction(const IdentifierType &id, Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5)
Call the function.
bool registerFunction(const IdentifierType &id, ProductCall call)
Register the function.
TL::TypeAtNonStrict< ParmList, 5, NullType >::Result Parm6
TL::TypeAtNonStrict< ParmList, 0, NullType >::Result Parm1
TL::TypeAtNonStrict< ParmList, 1, NullType >::Result Parm2
TL::TypeAtNonStrict< ParmList, 2, NullType >::Result Parm3
AbstractProduct callFunction(const IdentifierType &id)
Call the function.
TL::TypeAtNonStrict< ParmList, 4, NullType >::Result Parm5
TL::TypeAtNonStrict< ParmList, 3, NullType >::Result Parm4
AbstractProduct callFunction(const IdentifierType &id, Parm1 p1)
Call the function.
AbstractProduct callFunction(const IdentifierType &id, Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4)
Call the function.
Asqtad Staggered-Dirac operator.
const char * what() const
static AbstractProduct OnUnknownType(const IdentifierType &id)
static AbstractProduct OnUnknownType(const IdentifierType &)
static AbstractProduct OnUnknownType(const IdentifierType &id)