CMS 3D CMS Logo

DDObject< T > Class Template Reference

#include <DetectorDescription/Core/interface/DDObject.h>

List of all members.

Public Types

typedef
RegistryType::const_iterator 
const_iterator
typedef RegistryType::iterator iterator
 iterator
typedef Ptr< T > pointer
typedef DDRegistry< pointerRegistryType
 std::maps a DDName to the pointer to be wrapped

Public Member Functions

 DDObject (DDName *)
 named object, implemenation derived from DDName & thus provides the name
 DDObject (const DDName &, T *)
 initialized (named) object, implementation provided by T*
 DDObject (const DDName &name)
 initialized (named) object
 DDObject ()
 unitialized, anonymous object
const DDNamename () const
 anonymous (un-named) object
T & operator * ()
const T & operator * () const
 operator bool () const
T * operator-> ()
const T * operator-> () const

Static Public Member Functions

static iterator begin ()
static iterator end ()

Private Member Functions

void init ()
void registerAnoObject (const DDName &name, T *object)
void registerObject (const DDName &name, T *object)

Static Private Member Functions

static RegistryTypeanoRegistry ()
 static registry for anonymous pointers (un-named pointers)
static RegistryTyperegistry ()
 the static registry for the wrapped pointer

Private Attributes

RegistryType::iterator rep_
 representation of the wrapped object is a pointer into a registry-stdmap


Detailed Description

template<class T>
class DDObject< T >

Definition at line 15 of file DDObject.h.


Member Typedef Documentation

template<class T>
typedef RegistryType::const_iterator DDObject< T >::const_iterator

Definition at line 24 of file DDObject.h.

template<class T>
typedef RegistryType::iterator DDObject< T >::iterator

iterator

Definition at line 22 of file DDObject.h.

template<class T>
typedef Ptr<T> DDObject< T >::pointer

Definition at line 18 of file DDObject.h.

template<class T>
typedef DDRegistry<pointer> DDObject< T >::RegistryType

std::maps a DDName to the pointer to be wrapped

Definition at line 20 of file DDObject.h.


Constructor & Destructor Documentation

template<class T>
DDObject< T >::DDObject (  )  [inline]

unitialized, anonymous object

Definition at line 94 of file DDObject.h.

00095 : rep_(registry().end()) 
00096  { }

template<class T>
DDObject< T >::DDObject ( const DDName name  )  [inline, explicit]

initialized (named) object

Definition at line 100 of file DDObject.h.

References DDObject< T >::registerObject().

00101 { 
00102   registerObject(name,(T*)0);
00103 }

template<class T>
DDObject< T >::DDObject ( const DDName name,
T *  object 
) [inline]

initialized (named) object, implementation provided by T*

Definition at line 107 of file DDObject.h.

References DDObject< T >::registerObject().

00108 { 
00109    registerObject(name,object);
00110 }

template<class T>
DDObject< T >::DDObject ( DDName object  )  [inline, explicit]

named object, implemenation derived from DDName & thus provides the name

Definition at line 124 of file DDObject.h.

References DDObject< T >::registerObject().

00125 { 
00126   // Loki compile time check whether T is sub-classed from DDName
00127   //SUPERSUBCLASS(DDName,T);
00128   registerObject(*object,static_cast<T*>(object));
00129 }


Member Function Documentation

template<class T>
static RegistryType& DDObject< T >::anoRegistry (  )  [inline, static, private]

static registry for anonymous pointers (un-named pointers)

Definition at line 81 of file DDObject.h.

References reg_.

Referenced by DDObject< T >::registerAnoObject().

00082   {
00083     static RegistryType reg_;
00084     return reg_;
00085   }

template<class T>
static iterator DDObject< T >::begin (  )  [inline, static]

Definition at line 61 of file DDObject.h.

References DDObject< T >::registry().

00061 { return registry().begin(); }

template<class T>
static iterator DDObject< T >::end (  )  [inline, static]

Definition at line 63 of file DDObject.h.

References DDObject< T >::registry().

Referenced by DDObject< T >::operator bool().

00063 { return registry().end();}

template<class T>
void DDObject< T >::init (  )  [private]

template<class T>
const DDName & DDObject< T >::name (  )  const [inline]

anonymous (un-named) object

the name of the wrapped object

Definition at line 156 of file DDObject.h.

References DDObject< T >::rep_.

00157 {
00158   //static DDName name_;
00159   return rep_->first;   
00160 }

template<class T>
T & DDObject< T >::operator * ( void   )  [inline]

Definition at line 171 of file DDObject.h.

References DDObject< T >::rep_.

00172 {
00173   return *(rep_->second);
00174 }

template<class T>
const T & DDObject< T >::operator * ( void   )  const [inline]

Definition at line 164 of file DDObject.h.

References DDObject< T >::rep_.

00165 {
00166    return *(rep_->second);      
00167 }

template<class T>
DDObject< T >::operator bool (  )  const [inline]

Definition at line 53 of file DDObject.h.

References DDObject< T >::end(), DDObject< T >::registry(), and DDObject< T >::rep_.

00054   {
00055     if (rep_ != registry().end()) {
00056       return bool(rep_->second);
00057     }
00058     throw DDException("unbound DDObject, typeid.name="+std::string(typeid(*rep_->second).name()));
00059   }; 

template<class T>
T * DDObject< T >::operator-> (  )  [inline]

Definition at line 185 of file DDObject.h.

References DDObject< T >::rep_.

00186 {
00187         return &(*rep_->second);
00188 }

template<class T>
const T * DDObject< T >::operator-> (  )  const [inline]

Definition at line 178 of file DDObject.h.

References DDObject< T >::rep_.

00179 {
00180         return &(*rep_->second);
00181 }

template<class T>
void DDObject< T >::registerAnoObject ( const DDName name,
T *  object 
) [inline, private]

Definition at line 145 of file DDObject.h.

References DDObject< T >::anoRegistry(), DDObject< T >::rep_, and HLT_VtxMuL3::result.

00146 {
00147   std::pair<typename RegistryType::iterator,bool> result 
00148     = anoRegistry().insert(typename RegistryType::value_type(name,pointer(object)));
00149   if (!result.second) {
00150     result.first->second = pointer(object);
00151   }
00152   rep_ = result.first; 
00153 }

template<class T>
void DDObject< T >::registerObject ( const DDName name,
T *  object 
) [inline, private]

Definition at line 133 of file DDObject.h.

References DDObject< T >::registry(), DDObject< T >::rep_, and HLT_VtxMuL3::result.

Referenced by DDObject< T >::DDObject().

00134 {
00135   std::pair<typename RegistryType::iterator,bool> result 
00136     = registry().insert(typename RegistryType::value_type(name,pointer(object)));
00137   if (!result.second) {
00138     result.first->second = pointer(object);
00139   }
00140   rep_ = result.first; 
00141 }

template<class T>
static RegistryType& DDObject< T >::registry (  )  [inline, static, private]

the static registry for the wrapped pointer

Definition at line 74 of file DDObject.h.

References reg_.

Referenced by DDObject< T >::begin(), DDObject< T >::end(), DDObject< T >::operator bool(), and DDObject< T >::registerObject().

00075   {
00076     static RegistryType reg_;
00077     return reg_;
00078   };


Member Data Documentation

template<class T>
RegistryType::iterator DDObject< T >::rep_ [private]

representation of the wrapped object is a pointer into a registry-stdmap

Definition at line 88 of file DDObject.h.

Referenced by DDObject< T >::name(), DDObject< T >::operator *(), DDObject< T >::operator bool(), DDObject< T >::operator->(), DDObject< T >::registerAnoObject(), and DDObject< T >::registerObject().


The documentation for this class was generated from the following file:
Generated on Tue Jun 9 18:18:12 2009 for CMSSW by  doxygen 1.5.4