DD4hep  1.28.0
Detector Description Toolkit for High Energy Physics
NamedObject.cpp
Go to the documentation of this file.
1 //==========================================================================
2 // AIDA Detector description implementation
3 //--------------------------------------------------------------------------
4 // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN)
5 // All rights reserved.
6 //
7 // For the licensing terms see $DD4hepINSTALL/LICENSE.
8 // For the list of contributors see $DD4hepINSTALL/doc/CREDITS.
9 //
10 // Author : M.Frank
11 //
12 //==========================================================================
13 
14 // Framework includes
15 #include <DD4hep/NamedObject.h>
16 #include <DD4hep/detail/Handle.inl>
17 #include <TNamed.h>
18 
19 namespace dd4hep {
20  template <> const char* Handle<NamedObject>::name() const {
21  return this->m_element ? this->m_element->name.c_str() : "";
22  }
23  template <> void
24  Handle<NamedObject>::assign(NamedObject* p, const std::string& n, const std::string& t){
25  m_element = p;
26  p->name = n;
27  p->type = t;
28  }
29 }
31 using namespace dd4hep;
32 
34 NamedObject::NamedObject(const char* nam, const char* typ)
35  : name(nam ? nam : ""), type(typ ? typ : "")
36 {
37 }
38 
40 NamedObject::NamedObject(const std::string& nam)
41  : name(nam), type()
42 {
43 }
44 
46 NamedObject::NamedObject(const std::string& nam, const std::string& typ)
47  : name(nam), type(typ)
48 {
49 }
50 
dd4hep::Handle
Handle: a templated class like a shared pointer, which allows specialized access to tgeometry objects...
Definition: Handle.h:84
dd4hep::Handle::name
const char * name() const
Access the object name (or "" if not supported by the object)
dd4hep::NamedObject::NamedObject
NamedObject()=default
Standard constructor.
NamedObject.h
dd4hep
Namespace for the AIDA detector description toolkit.
Definition: AlignmentsCalib.h:28
dd4hep::NamedObject
Implementation of a named object.
Definition: NamedObject.h:30
dd4hep::NamedObject::name
std::string name
The object name.
Definition: NamedObject.h:33
dd4hep::NamedObject::type
std::string type
The object type.
Definition: NamedObject.h:35