Public Member Functions | Private Attributes | Friends | List of all members
genie::RegistryItem< T > Class Template Reference

A templated concrete implementation of the RegistryItemI interface. Provides an arbitrary basic type (bool, int, double, string) value for RegistryI-type containers. More...

#include <RegistryItem.h>

Inheritance diagram for genie::RegistryItem< T >:
genie::RegistryItemI

Public Member Functions

 RegistryItem ()
 
 RegistryItem (T item, bool locked=false, bool local=true)
 
 RegistryItem (const RegistryItem *ri)
 
 ~RegistryItem ()
 
RegistryItemIClone (void) const
 
RgType_t TypeInfo (void) const
 
const T & Data (void) const
 
bool IsLocked (void) const
 
void Lock (void)
 
void UnLock (void)
 
bool IsLocal (void) const
 
void SetLocal (bool isloc)
 
void Print (ostream &stream) const
 
template<>
 ~RegistryItem ()
 
template<>
 ~RegistryItem ()
 
template<>
 ~RegistryItem ()
 
template<>
RgType_t TypeInfo (void) const
 
template<>
RgType_t TypeInfo (void) const
 
template<>
RgType_t TypeInfo (void) const
 
template<>
RgType_t TypeInfo (void) const
 
template<>
RgType_t TypeInfo (void) const
 
template<>
RgType_t TypeInfo (void) const
 
template<>
RgType_t TypeInfo (void) const
 
template<>
RgType_t TypeInfo (void) const
 
template<>
void Print (ostream &stream) const
 
template<>
void Print (ostream &stream) const
 
template<>
void Print (ostream &stream) const
 
template<>
void Print (ostream &stream) const
 
- Public Member Functions inherited from genie::RegistryItemI
virtual ~RegistryItemI ()
 

Private Attributes

fItem
 
bool fIsLocked
 
bool fIsLocal
 

Friends

ostream & operator (ostream &stream, const RegistryItem< T > &rec)
 

Additional Inherited Members

- Protected Member Functions inherited from genie::RegistryItemI
 RegistryItemI ()
 

Detailed Description

template<typename T>
class genie::RegistryItem< T >

A templated concrete implementation of the RegistryItemI interface. Provides an arbitrary basic type (bool, int, double, string) value for RegistryI-type containers.

Author
Costas Andreopoulos <constantinos.andreopoulos cern.ch> University of Liverpool & STFC Rutherford Appleton Laboratory

May 06, 2004

Copyright (c) 2003-2020, The GENIE Collaboration For the full text of the license visit http://copyright.genie-mc.org

Definition at line 32 of file RegistryItem.h.

Constructor & Destructor Documentation

template<typename T>
genie::RegistryItem< T >::RegistryItem ( )
inline

Definition at line 39 of file RegistryItem.h.

39 { };
template<typename T >
genie::RegistryItem< T >::RegistryItem ( item,
bool  locked = false,
bool  local = true 
)

Definition at line 47 of file RegistryItem.cxx.

48 {
49  fItem = item;
50  fIsLocked = locked;
51  fIsLocal = local;
52 }
template<typename T >
genie::RegistryItem< T >::RegistryItem ( const RegistryItem< T > *  ri)

Definition at line 54 of file RegistryItem.cxx.

55 {
56  fItem = ri->fItem;
57  fIsLocked = ri->fIsLocked;
58  fIsLocal = ri->fIsLocal;
59 }
template<typename T >
genie::RegistryItem< T >::~RegistryItem ( )

Definition at line 61 of file RegistryItem.cxx.

62 {
63 
64 }
template<>
genie::RegistryItem< RgH1F >::~RegistryItem ( )

Definition at line 66 of file RegistryItem.cxx.

67 {
68  if (fItem) delete fItem;
69 }
template<>
genie::RegistryItem< RgH2F >::~RegistryItem ( )

Definition at line 71 of file RegistryItem.cxx.

72 {
73  if (fItem) delete fItem;
74 }

Definition at line 76 of file RegistryItem.cxx.

77 {
78  if (fItem) delete fItem;
79 }

Member Function Documentation

template<typename T >
RegistryItemI * genie::RegistryItem< T >::Clone ( void  ) const
virtual

Implements genie::RegistryItemI.

Definition at line 81 of file RegistryItem.cxx.

82 {
83  RegistryItemI * item = new RegistryItem<T>(fItem,fIsLocked);
84  return item;
85 }
template<typename T>
const T& genie::RegistryItem< T >::Data ( void  ) const
inline

Definition at line 46 of file RegistryItem.h.

46 { return fItem; }
template<typename T>
bool genie::RegistryItem< T >::IsLocal ( void  ) const
inlinevirtual

Implements genie::RegistryItemI.

Definition at line 50 of file RegistryItem.h.

50 { return fIsLocal; }
template<typename T>
bool genie::RegistryItem< T >::IsLocked ( void  ) const
inlinevirtual

Implements genie::RegistryItemI.

Definition at line 47 of file RegistryItem.h.

47 { return fIsLocked; }
template<typename T>
void genie::RegistryItem< T >::Lock ( void  )
inlinevirtual

Implements genie::RegistryItemI.

Definition at line 48 of file RegistryItem.h.

48 { fIsLocked = true; }
template<typename T >
void genie::RegistryItem< T >::Print ( ostream &  stream) const
virtual

Implements genie::RegistryItemI.

Definition at line 127 of file RegistryItem.cxx.

128 {
129  stream << ((fIsLocked) ? "[ locked]" : "[unlocked]")
130  << " "
131  << ((fIsLocal) ? "[l]" : "[g]")
132  << " : "
133  << (fItem);
134 }
template<>
void genie::RegistryItem< RgAlg >::Print ( ostream &  stream) const

Definition at line 136 of file RegistryItem.cxx.

137 {
138  stream << ((fIsLocked) ? "[ locked]" : "[unlocked]")
139  << " "
140  << ((fIsLocal) ? "[l]" : "[g]")
141  << " : "
142  << (fItem);
143 }
template<>
void genie::RegistryItem< RgH1F >::Print ( ostream &  stream) const

Definition at line 145 of file RegistryItem.cxx.

146 {
147  TH1F * histo = dynamic_cast<TH1F *>(fItem);
148  if(!histo) stream << "*** NULL RgH1F ***";
149 
150  stream << ((fIsLocked) ? "[ locked]" : "[unlocked]")
151  << " "
152  << ((fIsLocal) ? "[l]" : "[g]")
153  << " : "
154  << (histo ? histo->GetName() : "NULL");
155 }
template<>
void genie::RegistryItem< RgH2F >::Print ( ostream &  stream) const

Definition at line 157 of file RegistryItem.cxx.

158 {
159  TH2F * histo = dynamic_cast<TH2F *>(fItem);
160  if(!histo) stream << "*** NULL RgH2F ***";
161 
162  stream << ((fIsLocked) ? "[ locked]" : "[unlocked]")
163  << " "
164  << ((fIsLocal) ? "[l]" : "[g]")
165  << " : "
166  << (histo ? histo->GetName() : "NULL");
167 }
template<>
void genie::RegistryItem< RgTree >::Print ( ostream &  stream) const

Definition at line 169 of file RegistryItem.cxx.

170 {
171  TTree * tree = dynamic_cast<TTree *>(fItem);
172  if(!tree) stream << "*** NULL RgTree ***";
173 
174  stream << ((fIsLocked) ? "[ locked]" : "[unlocked]")
175  << " "
176  << ((fIsLocal) ? "[l]" : "[g]")
177  << " : "
178  << (tree ? tree->GetName() : "NULL");
179 }
template<typename T>
void genie::RegistryItem< T >::SetLocal ( bool  isloc)
inlinevirtual

Implements genie::RegistryItemI.

Definition at line 51 of file RegistryItem.h.

51 { fIsLocal = isloc; }
template<typename T>
RgType_t genie::RegistryItem< T >::TypeInfo ( void  ) const
virtual

Implements genie::RegistryItemI.

template<>
RgType_t genie::RegistryItem< RgBool >::TypeInfo ( void  ) const
virtual

Implements genie::RegistryItemI.

Definition at line 87 of file RegistryItem.cxx.

88 {
89  return kRgBool;
90 }
template<>
RgType_t genie::RegistryItem< RgInt >::TypeInfo ( void  ) const
virtual

Implements genie::RegistryItemI.

Definition at line 92 of file RegistryItem.cxx.

93 {
94  return kRgInt;
95 }
template<>
RgType_t genie::RegistryItem< RgDbl >::TypeInfo ( void  ) const
virtual

Implements genie::RegistryItemI.

Definition at line 97 of file RegistryItem.cxx.

98 {
99  return kRgDbl;
100 }
template<>
RgType_t genie::RegistryItem< RgStr >::TypeInfo ( void  ) const
virtual

Implements genie::RegistryItemI.

Definition at line 102 of file RegistryItem.cxx.

103 {
104  return kRgStr;
105 }
template<>
RgType_t genie::RegistryItem< RgAlg >::TypeInfo ( void  ) const
virtual

Implements genie::RegistryItemI.

Definition at line 107 of file RegistryItem.cxx.

108 {
109  return kRgAlg;
110 }
template<>
RgType_t genie::RegistryItem< RgH1F >::TypeInfo ( void  ) const
virtual

Implements genie::RegistryItemI.

Definition at line 112 of file RegistryItem.cxx.

113 {
114  return kRgH1F;
115 }
template<>
RgType_t genie::RegistryItem< RgH2F >::TypeInfo ( void  ) const
virtual

Implements genie::RegistryItemI.

Definition at line 117 of file RegistryItem.cxx.

118 {
119  return kRgH2F;
120 }
template<>
RgType_t genie::RegistryItem< RgTree >::TypeInfo ( void  ) const
virtual

Implements genie::RegistryItemI.

Definition at line 122 of file RegistryItem.cxx.

123 {
124  return kRgTree;
125 }
template<typename T>
void genie::RegistryItem< T >::UnLock ( void  )
inlinevirtual

Implements genie::RegistryItemI.

Definition at line 49 of file RegistryItem.h.

49 { fIsLocked = false; }

Friends And Related Function Documentation

template<typename T>
ostream& operator ( ostream &  stream,
const RegistryItem< T > &  rec 
)
friend

Member Data Documentation

template<typename T>
bool genie::RegistryItem< T >::fIsLocal
private

Definition at line 62 of file RegistryItem.h.

template<typename T>
bool genie::RegistryItem< T >::fIsLocked
private

Definition at line 61 of file RegistryItem.h.

template<typename T>
T genie::RegistryItem< T >::fItem
private

Definition at line 60 of file RegistryItem.h.


The documentation for this class was generated from the following files: