RegistryItemXxx< T > Class Template Reference

#include <RegistryItemXxx.h>

Inheritance diagram for RegistryItemXxx< T >:

RegistryItem List of all members.

Public Member Functions

 RegistryItemXxx ()
 ~RegistryItemXxx ()
void Dump () const
void Print (Option_t *="") const
virtual std::ostream & PrintStream (std::ostream &os) const
virtual std::istream & ReadStream (std::istream &is)
virtual const std::type_info & GetType () const
virtual const char * GetTypeAsString () const
template<>
void Streamer (TBuffer &buf)
template<>
void Streamer (TBuffer &buf)
template<>
std::ostream & PrintStream (std::ostream &os) const
template<>
std::istream & ReadStream (std::istream &is)
template<>
 ~RegistryItemXxx ()
template<>
RegistryItemDup (void) const
template<>
RegistryItemDup (void) const
template<>
void Streamer (TBuffer &buf)
template<>
void Streamer (TBuffer &buf)
template<>
 ~RegistryItemXxx ()
template<>
std::ostream & PrintStream (std::ostream &os) const
template<>
std::istream & ReadStream (std::istream &is)
template<>
const char * GetTypeAsString (void) const
template<>
const char * GetTypeAsString (void) const
template<>
const char * GetTypeAsString (void) const
template<>
const char * GetTypeAsString (void) const
template<>
const char * GetTypeAsString (void) const
template<>
std::ostream & PrintStream (std::ostream &os) const
template<>
std::istream & ReadStream (std::istream &is)

Private Member Functions

 RegistryItemXxx (T *data)
T * Get (void)
void Set (T *data)
RegistryItemDup (void) const

Private Attributes

T * fData

Friends

class Registry

Detailed Description

template<class T>
class RegistryItemXxx< T >

Definition at line 29 of file RegistryItemXxx.h.


Constructor & Destructor Documentation

template<class T>
RegistryItemXxx< T >::RegistryItemXxx (  ) 

template<class T>
RegistryItemXxx< T >::~RegistryItemXxx (  ) 

Definition at line 97 of file RegistryItemXxx.h.

References RegistryItemXxx< T >::fData.

00098 { 
00099     if (fData) delete fData; 
00100 }

template<class T>
RegistryItemXxx< T >::RegistryItemXxx ( T *  data  )  [private]

Definition at line 92 of file RegistryItemXxx.h.

00092                                            : fData(data) 
00093 { 
00094 }

template<>
RegistryItemXxx< const char * >::~RegistryItemXxx (  ) 

Definition at line 205 of file RegistryItemXxx.cxx.

References RegistryItemXxx< T >::fData.

00206 {
00207     if (fData) {
00208         if (*fData) {
00209             delete [] *fData;
00210             *fData = 0;
00211         }
00212         delete fData;    
00213         fData = 0;
00214     }
00215 }

template<>
RegistryItemXxx< const char * >::~RegistryItemXxx (  ) 


Member Function Documentation

template<class T>
void RegistryItemXxx< T >::Dump ( void   )  const [inline]

Definition at line 38 of file RegistryItemXxx.h.

References RegistryItemXxx< T >::fData.

00038 { std::cerr << *fData; }

template<>
RegistryItem * RegistryItemXxx< const char * >::Dup ( void   )  const [virtual]

Implements RegistryItem.

template<>
RegistryItem * RegistryItemXxx< const char * >::Dup ( void   )  const [virtual]

Implements RegistryItem.

Definition at line 218 of file RegistryItemXxx.cxx.

References RegistryItemXxx< T >::fData.

00219 {
00220     char** ppc = new char*;
00221     (*ppc) = new char [strlen(*fData)+1];
00222     strcpy(*ppc,*fData);
00223     const char** ppcc = const_cast<const char**>(ppc);
00224     return new RegistryItemXxx< const char* >(ppcc);
00225 }

template<class T>
RegistryItem * RegistryItemXxx< T >::Dup ( void   )  const [private, virtual]

Implements RegistryItem.

Definition at line 103 of file RegistryItemXxx.h.

References RegistryItemXxx< T >::fData.

00104 {
00105     return new RegistryItemXxx<T>(new T (*fData));
00106 }

template<class T>
T * RegistryItemXxx< T >::Get ( void   )  [private]

Definition at line 113 of file RegistryItemXxx.h.

References RegistryItemXxx< T >::fData.

Referenced by Registry::Get().

00114 {
00115     return fData; 
00116 }

template<class T>
virtual const std::type_info& RegistryItemXxx< T >::GetType (  )  const [inline, virtual]

Implements RegistryItem.

Definition at line 49 of file RegistryItemXxx.h.

00049 { return typeid(T); }

template<>
const char * RegistryItemXxx< Registry >::GetTypeAsString ( void   )  const [virtual]

Implements RegistryItem.

template<>
const char * RegistryItemXxx< const char * >::GetTypeAsString ( void   )  const [virtual]

Implements RegistryItem.

template<>
const char * RegistryItemXxx< double >::GetTypeAsString ( void   )  const [virtual]

Implements RegistryItem.

template<>
const char * RegistryItemXxx< int >::GetTypeAsString ( void   )  const [virtual]

Implements RegistryItem.

template<>
const char * RegistryItemXxx< char >::GetTypeAsString ( void   )  const [virtual]

Implements RegistryItem.

template<class T>
virtual const char* RegistryItemXxx< T >::GetTypeAsString ( void   )  const [inline, virtual]

Implements RegistryItem.

Definition at line 50 of file RegistryItemXxx.h.

00050 { return "void"; }

template<class T>
void RegistryItemXxx< T >::Print ( Option_t *  = ""  )  const [inline, virtual]

Implements RegistryItem.

Definition at line 39 of file RegistryItemXxx.h.

References RegistryItemXxx< T >::fData.

00039 { std::cout << *fData; }

template<>
std::ostream & RegistryItemXxx< Registry >::PrintStream ( std::ostream &  os  )  const [virtual]

Implements RegistryItem.

template<>
std::ostream & RegistryItemXxx< const char * >::PrintStream ( std::ostream &  os  )  const [virtual]

Implements RegistryItem.

template<>
std::ostream & RegistryItemXxx< const char * >::PrintStream ( std::ostream &  os  )  const [virtual]

Implements RegistryItem.

Definition at line 179 of file RegistryItemXxx.cxx.

References RegistryItemXxx< T >::fData.

00180 {
00181     os << "'" << *fData << "'";
00182     return os;
00183 }

template<class T>
virtual std::ostream& RegistryItemXxx< T >::PrintStream ( std::ostream &  os  )  const [inline, virtual]

Implements RegistryItem.

Definition at line 41 of file RegistryItemXxx.h.

References RegistryItemXxx< T >::fData.

00041                                                           { 
00042         return os << *fData; 
00043     }

template<>
std::istream & RegistryItemXxx< Registry >::ReadStream ( std::istream &  is  )  [virtual]

Implements RegistryItem.

template<>
std::istream & RegistryItemXxx< const char * >::ReadStream ( std::istream &  is  )  [virtual]

Implements RegistryItem.

template<>
std::istream & RegistryItemXxx< const char * >::ReadStream ( std::istream &  is  )  [virtual]

Implements RegistryItem.

Definition at line 186 of file RegistryItemXxx.cxx.

References RegistryItemXxx< T >::fData, and Util::read_quoted_string().

00187 {
00188     string stot = Util::read_quoted_string(is);
00189 
00190     if (!fData) {
00191         char** ppchar = new char*;
00192         *ppchar = 0;
00193         fData = const_cast<const char**>(ppchar);
00194     }
00195     if (*fData) delete [] *fData;
00196 
00197     char* pchar = new char[stot.length() + 1];
00198     strcpy(pchar,stot.c_str());
00199     *fData = const_cast<const char*>(pchar);
00200     return is;
00201 }

template<class T>
virtual std::istream& RegistryItemXxx< T >::ReadStream ( std::istream &  is  )  [inline, virtual]

Implements RegistryItem.

Definition at line 44 of file RegistryItemXxx.h.

References RegistryItemXxx< T >::fData.

00044                                                    {
00045         if (!fData) fData = new T;
00046         return is >> *fData;
00047     }

template<class T>
void RegistryItemXxx< T >::Set ( T *  data  )  [private]

Definition at line 119 of file RegistryItemXxx.h.

References RegistryItemXxx< T >::fData.

00120 {
00121     if (fData) delete fData;
00122     fData = data; 
00123 }

template<>
void RegistryItemXxx< char >::Streamer ( TBuffer &  buf  ) 

template<>
void RegistryItemXxx< const char * >::Streamer ( TBuffer &  buf  ) 

template<>
void RegistryItemXxx< char >::Streamer ( TBuffer &  buf  ) 

Definition at line 160 of file RegistryItemXxx.cxx.

References RegistryItemXxx< T >::fData, and Registry::Streamer().

00161 {
00162     if (buf.IsReading()) {
00163         Version_t v = buf.ReadVersion(); 
00164         if (v) { }
00165         RegistryItem::Streamer(buf);
00166 
00167         char c;
00168         buf >> c;
00169         fData = new char(c);
00170     } 
00171     else {
00172         buf.WriteVersion(IsA());
00173         RegistryItem::Streamer(buf);
00174         buf << *fData;
00175     }
00176 }

template<>
void RegistryItemXxx< T >::Streamer ( TBuffer &  buf  ) 

Definition at line 127 of file RegistryItemXxx.cxx.

References RegistryItemXxx< T >::fData, and Registry::Streamer().

00128 {
00129     if (buf.IsReading()) {
00130         Version_t v = buf.ReadVersion(); 
00131         if (v) { }
00132         RegistryItem::Streamer(buf);
00133 
00134         std::string str = "";
00135         char x[2];
00136         x[1] = '\0';
00137 
00138         do {                    // read out string one byte at a time
00139             buf >> x[0];
00140             str += x;
00141         } while (x[0]);
00142 
00143         char** ppchar = new char*;
00144         *ppchar = new char[str.length() + 1];
00145         strcpy(*ppchar,str.c_str());
00146         (*ppchar)[str.length()] = '\0'; // paranoia
00147         fData = const_cast<const char**>(ppchar);
00148     } 
00149     else {
00150         buf.WriteVersion(IsA());
00151         RegistryItem::Streamer(buf);
00152         buf << (*fData);
00153     }
00154 }


Friends And Related Function Documentation

template<class T>
friend class Registry [friend]

Definition at line 33 of file RegistryItemXxx.h.


Member Data Documentation

template<class T>
T* RegistryItemXxx< T >::fData [private]

Definition at line 59 of file RegistryItemXxx.h.

Referenced by RegistryItemXxx< T >::Dump(), RegistryItemXxx< T >::Dup(), RegistryItemXxx< T >::Get(), RegistryItemXxx< T >::Print(), RegistryItemXxx< T >::PrintStream(), RegistryItemXxx< T >::ReadStream(), RegistryItemXxx< T >::Set(), RegistryItemXxx< T >::Streamer(), and RegistryItemXxx< T >::~RegistryItemXxx().


The documentation for this class was generated from the following file:
Generated on Fri Oct 10 22:46:26 2014 for loon by  doxygen 1.4.7