Main Page | Class Hierarchy | Alphabetical List | Compound List | File List | Compound Members | File Members | Related Pages

NamedO Class Reference

#include <NamedO.h>

Inheritance diagram for NamedO:

Inheritance graph
[legend]
List of all members.

Detailed Description

Base class for heap objects that have a name.

Classes derived from NamedO should implement a getName() method. under the name returned by getName each new object is registered, and can be looked up by name using the NamedO::getObject function.

Changelog:

Definition at line 28 of file NamedO.h.

Public Member Functions

 NamedO (const char *name_="?")
 Constructor from a C style string, serves as default constructor.

 NamedO (const std::string &name_)
 Constructor from a C++ string.

 NamedO (const std::string &name_, const std::string &definition_)
 Constructor from two C++ strings.

virtual const char * getName () const
 Returns pointer to name (pointer must NOT be deleted!).

virtual const char * getDefinition () const
 Returns pointer to definition (pointer must NOT be deleted!).

virtual NamedOsetName (const std::string &newname)
 Method to be called when the name is changed.

virtual NamedOsetName (const char *newname)
virtual NamedOsetDefinition (const std::string &newdef)
 Method to change the definition.

virtual std::ostream & print (std::ostream &os) const
 Method for printing.

virtual void destroy ()
 Replaces delete, which cannot be called because of protected destructor.


Static Public Member Functions

NamedOgetObject (const std::string &name)
 Access function that returns a pointer to an NamedO object with this name.

NamedOgetObject (const char *name)
 Access function that returns a pointer to an NamedO object with this name.

template<class T> T * getObject (const std::string &name)
template<class T> T * getObject (const char *name)
std::ostream & listObjects (std::ostream &os)
 Outputs a list of all objects registered so far.

std::string str (char c)
 Converts a char into a string.

std::string str (const char *s)
 Converts a C style string into a string.

std::string str (int i)
 Converts an int into a string.

std::string str (int i, int wide)
 Converts an int into a string, with a minimum number of digits (leading zeroes).

std::string str (float f)
 Converts an float into a string.

std::string str (double d)
 Converts a double into a string.

std::string str (bool b)
 Converts a bool into a string.


Protected Member Functions

virtual ~NamedO ()
 Protected destructor ensures creation on the heap.


Private Member Functions

void reg ()
 Register an object.

void unreg ()
 Unregister an object.

 NamedO (const NamedO &source)
 Private copy constructor, left unimplemented: No copying!

NamedOoperator= (const NamedO &source)
 Private assignment operator, left unimplemented: No assignment!


Static Private Member Functions

void initMap ()
 Internal function to initialize the maps.


Private Attributes

std::string name
 The object's name.

std::string definition
 The object's name.


Friends

class NamedO::Init

Related Functions

(Note that these are not member functions.)

std::ostream & operator<< (std::ostream &os, const NamedO &rhs)
 Output operator.


Constructor & Destructor Documentation

NamedO::NamedO const char *  name_ = "?"  )  [explicit]
 

Constructor from a C style string, serves as default constructor.

Parameters:
name_  The object's name

Definition at line 65 of file NamedO.C.

References reg().

NamedO::NamedO const std::string &  name_  )  [explicit]
 

Constructor from a C++ string.

Parameters:
name_  The object's name

Definition at line 72 of file NamedO.C.

References reg().

NamedO::NamedO const std::string &  name_,
const std::string &  definition_
 

Constructor from two C++ strings.

Parameters:
name_  The object's name
definition_  The object's definition

Definition at line 79 of file NamedO.C.

References reg().


Member Function Documentation

NamedO & NamedO::setName const std::string &  newname  )  [virtual]
 

Method to be called when the name is changed.

Parameters:
newname  The new name

Definition at line 147 of file NamedO.C.

References name, and reg().

Referenced by JBLH1SomeArrayIterator< H1SomeArrayPtr, ArrayRow >::JBLH1SomeArrayIterator(), JBLH1SomeBankIterator< H1SomeBankPtr, H1SomeRow >::JBLH1SomeBankIterator(), and setName().

NamedO & NamedO::setName const char *  newname  )  [virtual]
 

Parameters:
newname  The new name

Definition at line 156 of file NamedO.C.

References setName().

NamedO & NamedO::setDefinition const std::string &  newdef  )  [virtual]
 

Method to change the definition.

Parameters:
newdef  The new definition

Definition at line 160 of file NamedO.C.

References definition.

Referenced by CutBinning::genDefinition().

NamedO * NamedO::getObject const std::string &  name  )  [static]
 

Access function that returns a pointer to an NamedO object with this name.

This access function must never be called within the constructor of any class that is derived from NamedO!

Parameters:
name  The name

Reimplemented in BaseCut, FloatFun, IntFun, and NamedBinning.

Definition at line 171 of file NamedO.C.

References getName().

Referenced by getObject().

NamedO * NamedO::getObject const char *  name  )  [static]
 

Access function that returns a pointer to an NamedO object with this name.

This access function must never be called within the constructor of any class that is derived from NamedO!

Parameters:
name  The name

Reimplemented in BaseCut, FloatFun, IntFun, and NamedBinning.

Definition at line 183 of file NamedO.C.

References getObject().

template<class T>
T* NamedO::getObject const std::string &  name  )  [inline, static]
 

Parameters:
name  The name

Reimplemented in BaseCut, FloatFun, IntFun, and NamedBinning.

Definition at line 76 of file NamedO.h.

References getObject().

template<class T>
T* NamedO::getObject const char *  name  )  [inline, static]
 

Parameters:
name  The name

Reimplemented in BaseCut, FloatFun, IntFun, and NamedBinning.

Definition at line 82 of file NamedO.h.

References getObject().

std::string NamedO::str char  c  )  [static]
 

Converts a char into a string.

Parameters:
c  The character

Definition at line 188 of file NamedO.C.

Referenced by BinningFun::BinningFun(), ConstBaseCut::ConstBaseCut(), ConstFun::ConstFun(), ConstIntFun::ConstIntFun(), CutBinning::CutBinning(), JBLH1BankFloatFunInt::JBLH1BankFloatFunInt(), JBLH1BankIntFun::JBLH1BankIntFun(), JBLH1FloatFun< H1SomePtr >::JBLH1FloatFun(), JBLH1IntFun< H1SomePtr >::JBLH1IntFun(), NamedBinning::NamedBinning(), FloatFun::operator-(), and RangeIterator::RangeIterator().

std::string NamedO::str const char *  s  )  [static]
 

Converts a C style string into a string.

Parameters:
s  A C style string

Definition at line 194 of file NamedO.C.

std::string NamedO::str int  i  )  [static]
 

Converts an int into a string.

Parameters:
i  The integer

Definition at line 198 of file NamedO.C.

std::string NamedO::str int  i,
int  wide
[static]
 

Converts an int into a string, with a minimum number of digits (leading zeroes).

Parameters:
i  The integer,
wide  The field width

Definition at line 204 of file NamedO.C.

std::string NamedO::str float  f  )  [static]
 

Converts an float into a string.

Parameters:
f  The float

Definition at line 212 of file NamedO.C.

std::string NamedO::str double  d  )  [static]
 

Converts a double into a string.

Parameters:
d  The double

Definition at line 218 of file NamedO.C.

std::string NamedO::str bool  b  )  [static]
 

Converts a bool into a string.

Parameters:
b  The bool

Definition at line 224 of file NamedO.C.


The documentation for this class was generated from the following files:
Generated on Thu Oct 26 12:54:53 2006 for SFH by doxygen 1.3.2