RegistryItem.h
Go to the documentation of this file.
1 //____________________________________________________________________________
2 /*!
3 
4 \class genie::RegistryItem
5 
6 \brief A templated concrete implementation of the RegistryItemI interface.
7  Provides an arbitrary basic type (bool, int, double, string) value
8  for RegistryI-type containers.
9 
10 \author Costas Andreopoulos <constantinos.andreopoulos \at cern.ch>
11  University of Liverpool & STFC Rutherford Appleton Laboratory
12 
13 \created May 06, 2004
14 
15 \cpright Copyright (c) 2003-2020, The GENIE Collaboration
16  For the full text of the license visit http://copyright.genie-mc.org
17 */
18 //____________________________________________________________________________
19 
20 #ifndef _REGISTRY_ITEM_H_
21 #define _REGISTRY_ITEM_H_
22 
23 #include <map>
24 #include <string>
25 #include <ostream>
26 
29 
30 namespace genie {
31 
32 template<typename T> class RegistryItem;
33 template<typename T>
34  ostream & operator << (ostream & stream, const RegistryItem<T> & rec);
35 
36 template<typename T> class RegistryItem : public RegistryItemI {
37 
38 public:
39  RegistryItem() { };
40  RegistryItem(T item, bool locked=false, bool local=true);
41  RegistryItem(const RegistryItem * ri);
42  ~RegistryItem();
43 
44  RegistryItemI * Clone (void) const;
45  RgType_t TypeInfo (void) const;
46  const T & Data (void) const { return fItem; }
47  bool IsLocked (void) const { return fIsLocked; }
48  void Lock (void) { fIsLocked = true; }
49  void UnLock (void) { fIsLocked = false; }
50  bool IsLocal (void) const { return fIsLocal; }
51  void SetLocal (bool isloc) { fIsLocal = isloc; }
52 
53  void Print(ostream& stream) const;
54 
55  friend ostream & operator <<
56  <T>(ostream & stream, const RegistryItem<T> & rec);
57 
58 private:
59 
61  bool fIsLocked;
62  bool fIsLocal;
63 };
64 
65 } // genie namespace
66 
67 #endif // _REGISTRY_ITEM_H_
rec
Definition: tracks.py:88
THE MAIN GENIE PROJECT NAMESPACE
Definition: AlgCmp.h:25
const T & Data(void) const
Definition: RegistryItem.h:46
Registry item pABC.
Definition: RegistryItemI.h:29
void SetLocal(bool isloc)
Definition: RegistryItem.h:51
enum genie::ERgType RgType_t
void Print(ostream &stream) const
bool IsLocal(void) const
Definition: RegistryItem.h:50
RgType_t TypeInfo(void) const
RegistryItemI * Clone(void) const
bool IsLocked(void) const
Definition: RegistryItem.h:47
A templated concrete implementation of the RegistryItemI interface. Provides an arbitrary basic type ...
Definition: RegistryItem.h:32