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 <<
"Factory error: unknown identifier: id = " <<
id << std::endl;
60 template <
typename IdentifierType,
class AbstractProduct>
75 template<
class AbstractProduct,
76 typename IdentifierType,
77 class TList = NullType,
78 typename ProductCreator = AbstractProduct* (*)(),
79 template<
typename,
class>
80 class FactoryErrorPolicy = DefaultFactoryError>
81 class ObjectFactory :
public FactoryErrorPolicy<IdentifierType, AbstractProduct>
106 typename IdToProductMap::value_type(
id, creator)).second;
126 typename IdToProductMap::const_iterator
i =
associations_.find(
id);
129 typedef typename IdToProductMap::const_iterator CI;
130 QDPIO::cerr <<
"Couldnt find key " <<
id <<
" in the std::map: " << std::endl;
131 QDPIO::cerr <<
"Available Keys are : " << std::endl;
134 QDPIO::cerr <<
j->first << std::endl << std::flush;
140 return (i->second)();
152 typename IdToProductMap::const_iterator
i =
associations_.find(
id);
155 typedef typename IdToProductMap::const_iterator CI;
156 QDPIO::cerr <<
"Couldnt find key " <<
id <<
" in the std::map: " << std::endl;
157 QDPIO::cerr <<
"Available Keys are : " << std::endl;
160 QDPIO::cerr <<
j->first << std::endl << std::flush;
166 return (i->second)(p1);
172 typename IdToProductMap::const_iterator
i =
associations_.find(
id);
175 typedef typename IdToProductMap::const_iterator CI;
176 QDPIO::cerr <<
"Couldnt find key " <<
id <<
" in the std::map: " << std::endl;
177 QDPIO::cerr <<
"Available Keys are : " << std::endl;
180 QDPIO::cerr <<
j->first << std::endl << std::flush;
186 return (i->second)(p1, p2);
192 typename IdToProductMap::const_iterator
i =
associations_.find(
id);
195 typedef typename IdToProductMap::const_iterator CI;
196 QDPIO::cerr <<
"Couldnt find key " <<
id <<
" in the std::map: " << std::endl;
197 QDPIO::cerr <<
"Available Keys are : " << std::endl;
200 QDPIO::cerr <<
j->first << std::endl << std::flush;
206 return (i->second)(p1, p2, p3);
213 typename IdToProductMap::const_iterator
i =
associations_.find(
id);
216 typedef typename IdToProductMap::const_iterator CI;
217 QDPIO::cerr <<
"Couldnt find key " <<
id <<
" in the std::map: " << std::endl;
218 QDPIO::cerr <<
"Available Keys are : " << std::endl;
221 QDPIO::cerr <<
j->first << std::endl << std::flush;
227 return (i->second)(p1, p2, p3, p4);
234 typename IdToProductMap::const_iterator
i =
associations_.find(
id);
237 typedef typename IdToProductMap::const_iterator CI;
238 QDPIO::cerr <<
"Couldnt find key " <<
id <<
" in the std::map: " << std::endl;
239 QDPIO::cerr <<
"Available Keys are : " << std::endl;
242 QDPIO::cerr <<
j->first << std::endl << std::flush;
248 return (i->second)(p1, p2, p3, p4, p5);
255 typename IdToProductMap::const_iterator
i =
associations_.find(
id);
258 typedef typename IdToProductMap::const_iterator CI;
259 QDPIO::cerr <<
"Couldnt find key " <<
id <<
" in the std::map: " << std::endl;
260 QDPIO::cerr <<
"Available Keys are : " << std::endl;
263 QDPIO::cerr <<
j->first << std::endl << std::flush;
269 return (i->second)(p1, p2, p3, p4, p5, p6);
276 typename IdToProductMap::const_iterator
i =
associations_.find(
id);
279 typedef typename IdToProductMap::const_iterator CI;
280 QDPIO::cerr <<
"Couldnt find key " <<
id <<
" in the std::map: " << std::endl;
281 QDPIO::cerr <<
"Available Keys are : " << std::endl;
284 QDPIO::cerr <<
j->first << std::endl << std::flush;
290 return (i->second)(p1, p2, p3, p4, p5, p6, p7);
297 typename IdToProductMap::const_iterator
i =
associations_.find(
id);
300 typedef typename IdToProductMap::const_iterator CI;
301 QDPIO::cerr <<
"Couldnt find key " <<
id <<
" in the std::map: " << std::endl;
302 QDPIO::cerr <<
"Available Keys are : " << std::endl;
305 QDPIO::cerr <<
j->first << std::endl << std::flush;
311 return (i->second)(p1, p2, p3, p4, p5, p6, p7, p8);
Primary include file for CHROMA library code.
TL::TypeAtNonStrict< ParmList, 5, NullType >::Result Parm6
TL::TypeAtNonStrict< ParmList, 7, NullType >::Result Parm8
bool registerObject(const IdentifierType &id, ProductCreator creator)
Register the object.
TL::TypeAtNonStrict< ParmList, 0, NullType >::Result Parm1
AbstractProduct * createObject(const IdentifierType &id, Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, Parm6 p6)
AbstractProduct * createObject(const IdentifierType &id, Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, Parm6 p6, Parm7 p7)
AbstractProduct * createObject(const IdentifierType &id, Parm1 p1, Parm2 p2)
std::map< IdentifierType, ProductCreator > IdToProductMap
TL::TypeAtNonStrict< ParmList, 3, NullType >::Result Parm4
AbstractProduct * createObject(const IdentifierType &id, Parm1 p1)
Create the object.
AbstractProduct * createObject(const IdentifierType &id, Parm1 p1, Parm2 p2, Parm3 p3)
TL::TypeAtNonStrict< ParmList, 1, NullType >::Result Parm2
TL::TypeAtNonStrict< ParmList, 2, NullType >::Result Parm3
AbstractProduct * createObject(const IdentifierType &id)
Create the object.
TL::TypeAtNonStrict< ParmList, 8, NullType >::Result Parm9
TL::TypeAtNonStrict< ParmList, 6, NullType >::Result Parm7
IdToProductMap associations_
bool unregisterObject(const IdentifierType &id)
Unregister the object.
AbstractProduct * createObject(const IdentifierType &id, Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5)
AbstractProduct * createObject(const IdentifierType &id, Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4, Parm5 p5, Parm6 p6, Parm7 p7, Parm8 p8)
AbstractProduct * createObject(const IdentifierType &id, Parm1 p1, Parm2 p2, Parm3 p3, Parm4 p4)
TL::TypeAtNonStrict< ParmList, 4, NullType >::Result Parm5
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)