CHROMA
map_obj_null_w.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 /*! \file
3  * \brief Null based std::map object, factory registration
4  */
5 
6 #include "chromabase.h"
7 #include "qdp_map_obj_null.h"
10 #include <string>
11 
12 namespace Chroma
13 {
14 
15  namespace MapObjectNullEnv
16  {
17  namespace
18  {
19  //! Callback function
20  QDP::MapObject<int,EVPair<LatticeColorVector> >* createMapObjIntKeyCV(XMLReader& xml_in,
21  const std::string& path,
22  const std::string& user_data)
23  {
24  // Doesn't need parameters...
25  auto obj = new QDP::MapObjectNull<int,EVPair<LatticeColorVector> >();
26  obj->insertUserdata(user_data);
27  return obj;
28  }
29 
30  //! Callback function
31  QDP::MapObject<KeyPropColorVec_t,LatticeFermion>* createMapObjKeyPropColorVecLF(XMLReader& xml_in,
32  const std::string& path,
33  const std::string& user_data)
34  {
35  // Doesn't need parameters...
36  auto obj = new QDP::MapObjectNull<KeyPropColorVec_t,LatticeFermion>();
37  obj->insertUserdata(user_data);
38  return obj;
39  }
40 
41  //! Local registration flag
42  bool registered = false;
43 
44  //! Name to be used
45  const std::string name = "MAP_OBJECT_NULL";
46  } // namespace anonymous
47 
48  std::string getName() {return name;}
49 
50  //! Register all the factories
51  bool registerAll()
52  {
53  bool success = true;
54  if (! registered)
55  {
56  success &= Chroma::TheMapObjIntKeyColorEigenVecFactory::Instance().registerObject(name, createMapObjIntKeyCV);
57  success &= Chroma::TheMapObjKeyPropColorVecFactory::Instance().registerObject(name, createMapObjKeyPropColorVecLF);
58  registered = true;
59  }
60  return success;
61  }
62 
63  } // Namespace MapObjectNullEnv
64 
65 } // Chroma
66 
Primary include file for CHROMA library code.
static T & Instance()
Definition: singleton.h:432
Handle< MapObject< int, EVPair< LatticeColorVector > > > obj
Key for propagator colorstd::vector sources.
static bool registered
Local registration flag.
const std::string name
Name to be used.
bool registerAll()
Register all the factories.
Asqtad Staggered-Dirac operator.
Definition: klein_gord.cc:10
::std::string string
Definition: gtest.h:1979