CHROMA
map_obj_memory_w.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 /*! \file map_obj_memory_w.cc
3  * \brief Memory based std::map object, factory registration
4  */
5 
6 #include "chromabase.h"
7 #include "qdp_map_obj_memory.h"
11 #include <string>
12 
13 namespace Chroma
14 {
15  using namespace QDP;
16 
17  namespace MapObjectMemoryEnv
18  {
19 
20  namespace
21  {
22  //! Callback function
23  QDP::MapObject<int,EVPair<LatticeColorVector> >* createMapObjIntKeyCV(XMLReader& xml_in,
24  const std::string& path,
25  const std::string& user_data)
26  {
27  // Doesn't need parameters...
28  auto obj = new QDP::MapObjectMemory<int,EVPair<LatticeColorVector> >();
29  obj->insertUserdata(user_data);
30  return obj;
31  }
32 
33  //! Callback function
34  QDP::MapObject<KeyPropColorVec_t,LatticeFermion>* createMapObjKeyPropColorVecLF(XMLReader& xml_in,
35  const std::string& path,
36  const std::string& user_data)
37  {
38  // Doesn't need parameters...
39  auto obj = new QDP::MapObjectMemory<KeyPropColorVec_t,LatticeFermion>();
40  obj->insertUserdata(user_data);
41  return obj;
42  }
43 
44  //! Local registration flag
45  bool registered = false;
46 
47  //! Name to be used
48  const std::string name = "MAP_OBJECT_MEMORY";
49  } // namespace anonymous
50 
51  std::string getName() {return name;}
52 
53  //! Register all the factories
54  bool registerAll()
55  {
56  bool success = true;
57  if (! registered)
58  {
59  success &= Chroma::TheMapObjIntKeyColorEigenVecFactory::Instance().registerObject(name, createMapObjIntKeyCV);
60  success &= Chroma::TheMapObjKeyPropColorVecFactory::Instance().registerObject(name, createMapObjKeyPropColorVecLF);
61  registered = true;
62  }
63  return success;
64  }
65 
66  } // Namespace MapObjectMemoryEnv
67 
68 } // Chroma
69 
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.
Header file for std::map obj aggregate registrations.
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