27     template <
typename T> 
void Handle<T>::assign(
T* n, 
const std::string& nam, 
const std::string& tit) {
 
   30         n->SetName(nam.c_str());
 
   32         n->SetTitle(tit.c_str());
 
   37       return this->m_element ? this->m_element->GetName() : 
"";
 
   42       if ( this->m_element ) 
return this->m_element;
 
   52       std::cout << 
"element:" << (
void*)m_element << std::endl;\
 
   53       std::cout << 
"type:   "  << (
char*)(m_element ? 
typeName(
typeid(*m_element)).c_str() : 
"---") << std::endl;\
 
   54       std::cout << 
"type:   "  << (
void*)(m_element ? &
typeid(*m_element) : 0) << std::endl;\
 
   55       std::cout << 
"target: "  << 
typeName(
typeid(X)) << std::endl;\
 
   56       std::cout << 
"target: "  << (
void*)&
typeid(X) << std::endl;\
 
   57       std::cout << 
"cast:   "  << 
dynamic_cast<X*
>((
TObject*)m_element) << std::endl;\
 
   58       std::cout << 
"cast:   "  << 
dynamic_cast<X*
>(m_element) << std::endl;\
 
   62 #define DD4HEP_INSTANTIATE_HANDLE(X)                                    \ 
   64     template <> void Handle<X>::verifyObject() const  {                 \ 
   65       increment_object_validations();                                   \ 
   66       if (m_element && dynamic_cast<X*>(m_element) == 0) {              \ 
   67         bad_assignment(typeid(*m_element), typeid(X));                  \ 
   70   template class DD4hep::Handle<X> 
   72 #define DD4HEP_INSTANTIATE_HANDLE_NAMED(X)                              \ 
   74     template <> const char* Handle<X>::name() const                     \ 
   75     { return this->m_element ? this->m_element->name.c_str() : ""; }    \ 
   77     Handle<X>::assign(X* p, const std::string& n, const std::string& t){\ 
   78       this->m_element = p;                                              \ 
   82     template <> void Handle<X>::verifyObject() const    {               \ 
   83       increment_object_validations();                                   \ 
   84       if (m_element && dynamic_cast<X*>((NamedObject*)m_element) == 0) {\ 
   85         bad_assignment(typeid(*m_element), typeid(X));                  \ 
   88   template class DD4hep::Handle<X> 
   90 #define DD4HEP_INSTANTIATE_HANDLE_UNNAMED(X)                            \ 
   93     Handle<X>::assign(X* n, const std::string&, const std::string&)     \ 
   94     { this->m_element = n;}                                             \ 
   95     template <> const char* Handle<X>::name() const { return ""; }      \ 
   97   DD4HEP_INSTANTIATE_HANDLE(X) 
const char * name() const 
Access the object name (or "" if not supported by the object) 
std::string typeName(const std::type_info &type)
ABI information about type names. 
void invalidHandleAssignmentError(const std::type_info &from, const std::type_info &to)
Throw exception when handles are badly assigned. 
void assign(Implementation *n, const std::string &nam, const std::string &title)
Assign a new named object. Note: object references must be managed by the user. 
T * access() const 
Checked object access. Throws invalid handle runtime exception. 
Class of the ROOT toolkit. See http://root.cern.ch/root/htmldoc/ClassIndex.html. 
void invalidHandleError(const std::type_info &type)
Throw exception when handles are check for validity. 
static void bad_assignment(const std::type_info &from, const std::type_info &to)
Helper routine called when unrelated types are assigned.