DD4hep  1.30.0
Detector Description Toolkit for High Energy Physics
Classes | Namespaces | Macros
Factories.h File Reference
#include <DD4hep/Plugins.h>
#include <DD4hep/DetElement.h>
#include <DD4hep/NamedObject.h>
#include <cstdarg>

Go to the source code of this file.

Classes

class  dd4hep::SimpleConstructionFactory< T >
 Template class with a generic constructor signature. More...
 
class  dd4hep::ConstructionFactory< T >
 
class  dd4hep::DetectorConstructionFactory< T >
 Template class for a generic dd4hep object constructor. More...
 
class  dd4hep::SegmentationFactory< T >
 Template class for a generic segmentation object constructor. More...
 
class  dd4hep::ApplyFactory< T >
 Template class with a generic signature to apply Detector plugins. More...
 
class  dd4hep::TranslationFactory< T >
 Specialized factory to translate objects, which can be retrieved from Detector. More...
 
class  dd4hep::XMLElementFactory< T >
 Create an arbitrary object from its XML representation. More...
 
class  dd4hep::XMLObjectFactory< T >
 Standard factory to create ROOT objects from an XML representation. More...
 
class  dd4hep::XMLDocumentReaderFactory< T >
 Read an arbitrary XML document and analyze its content. More...
 
class  dd4hep::XMLConversionFactory< T >
 Read an arbitrary XML document and analyze its content. More...
 
class  dd4hep::XmlDetElementFactory< T >
 Standard factory to create Detector elements from an XML representation. More...
 
class  dd4hep::JsonDetElementFactory< T >
 Standard factory to create Detector elements from the compact XML representation. More...
 

Namespaces

 dd4hep
 Namespace for the AIDA detector description toolkit.
 
 dd4hep::json
 Namespace for the AIDA detector description toolkit supporting JSON utilities.
 
 dd4hep::xml
 Namespace for the AIDA detector description toolkit supporting XML utilities.
 
 dd4hep::DDSegmentation
 Namespace for base segmentations.
 
 ns
 Helper structure to shortcut type definitions for the factories.
 

Macros

#define DECLARE_DETELEMENT_FACTORY(x)
 
#define DECLARE_NAMESPACE_DETELEMENT_FACTORY(n, x)
 
#define DECLARE_NAMED_APPLY_FACTORY(n, x)
 
#define DECLARE_NAMED_TRANSLATION_FACTORY(n, x)
 
#define DECLARE_NAMED_XMLELEMENT_FACTORY(n, x)
 
#define DECLARE_NAMED_DETELEMENT_FACTORY(n, x)
 
#define DECLARE_SEGMENTATION(name, func)
 
#define DECLARE_CREATE(name, func)
 
#define DECLARE_APPLY(name, func)
 
#define DECLARE_CONSTRUCTOR(name, func)
 
#define DECLARE_DD4HEP_CONSTRUCTOR(name, func)
 
#define DECLARE_TRANSLATION(name, func)
 
#define DECLARE_XMLELEMENT(name, func)
 
#define DECLARE_XML_SHAPE(name, func)
 
#define DECLARE_XML_VOLUME(name, func)
 
#define DECLARE_XML_DOC_READER(name, func)
 
#define DECLARE_XML_PLUGIN(name, func)
 
#define DECLARE_XML_PROCESSOR_BASIC(name, func, deprecated)
 
#define DECLARE_JSON_PROCESSOR_BASIC(name, func)
 
#define DECLARE_XML_PROCESSOR(name, func)   DECLARE_XML_PROCESSOR_BASIC(name,func,0)
 
#define DECLARE_SUBDETECTOR(name, func)   DECLARE_XML_PROCESSOR_BASIC(name,func,0)
 
#define DECLARE_DETELEMENT(name, func)   DECLARE_XML_PROCESSOR_BASIC(name,func,0)
 
#define DECLARE_DEPRECATED_DETELEMENT(name, func)   DECLARE_XML_PROCESSOR_BASIC(name,func,1)
 
#define DECLARE_JSON_DETELEMENT(name, func)   DECLARE_JSON_PROCESSOR_BASIC(name,func)
 

Macro Definition Documentation

◆ DECLARE_APPLY

#define DECLARE_APPLY (   name,
  func 
)
Value:
template <> long ApplyFactory<name>::create(dd4hep::Detector& l,int n,char** a) {return func(l,n,a);} \
DD4HEP_PLUGINSVC_FACTORY(name,name,long(dd4hep::Detector*,int,char**),__LINE__)}

Definition at line 282 of file Factories.h.

◆ DECLARE_CONSTRUCTOR

#define DECLARE_CONSTRUCTOR (   name,
  func 
)
Value:
template <> void* ConstructionFactory<name>::create(const char* n) { return func(n);} \
DD4HEP_PLUGINSVC_FACTORY(name,name,void*(const char*),__LINE__) }

Definition at line 287 of file Factories.h.

◆ DECLARE_CREATE

#define DECLARE_CREATE (   name,
  func 
)
Value:
template <> void* SimpleConstructionFactory<name>::create() { return func(); } \
DD4HEP_PLUGINSVC_FACTORY(name,name,void*(),__LINE__)}

Definition at line 277 of file Factories.h.

◆ DECLARE_DD4HEP_CONSTRUCTOR

#define DECLARE_DD4HEP_CONSTRUCTOR (   name,
  func 
)
Value:
template <> void* DetectorConstructionFactory<name>::create(dd4hep::Detector& l, int n,char** a) { return func(l,n,a);} \
DD4HEP_PLUGINSVC_FACTORY(name,name,void*(dd4hep::Detector*,int,char**),__LINE__) }

Definition at line 292 of file Factories.h.

◆ DECLARE_DEPRECATED_DETELEMENT

#define DECLARE_DEPRECATED_DETELEMENT (   name,
  func 
)    DECLARE_XML_PROCESSOR_BASIC(name,func,1)

Definition at line 341 of file Factories.h.

◆ DECLARE_DETELEMENT

#define DECLARE_DETELEMENT (   name,
  func 
)    DECLARE_XML_PROCESSOR_BASIC(name,func,0)

Definition at line 340 of file Factories.h.

◆ DECLARE_DETELEMENT_FACTORY

#define DECLARE_DETELEMENT_FACTORY (   x)
Value:

Definition at line 256 of file Factories.h.

◆ DECLARE_JSON_DETELEMENT

#define DECLARE_JSON_DETELEMENT (   name,
  func 
)    DECLARE_JSON_PROCESSOR_BASIC(name,func)

Definition at line 343 of file Factories.h.

◆ DECLARE_JSON_PROCESSOR_BASIC

#define DECLARE_JSON_PROCESSOR_BASIC (   name,
  func 
)
Value:
DD4HEP_OPEN_PLUGIN(dd4hep,det_element_##name) { \
template <> Ref_t JsonDetElementFactory< det_element_##name >::create(dd4hep::Detector& l,ns::json_h e,ns::ref_t h) \
{ return func(l,e,h);} \
DD4HEP_PLUGINSVC_FACTORY(det_element_##name,name,NamedObject*(dd4hep::Detector*,ns::json_h*,ns::ref_t*),__LINE__) }

Definition at line 333 of file Factories.h.

◆ DECLARE_NAMED_APPLY_FACTORY

#define DECLARE_NAMED_APPLY_FACTORY (   n,
 
)
Value:
namespace dd4hep \
{ DD4HEP_PLUGINSVC_FACTORY(n::x,x,long(dd4hep::Detector*,int, char**),__LINE__) }

Definition at line 260 of file Factories.h.

◆ DECLARE_NAMED_DETELEMENT_FACTORY

#define DECLARE_NAMED_DETELEMENT_FACTORY (   n,
 
)
Value:
namespace dd4hep \
{ DD4HEP_PLUGINSVC_FACTORY(n::x,x,dd4hep::*(),__LINE__) }

Definition at line 266 of file Factories.h.

◆ DECLARE_NAMED_TRANSLATION_FACTORY

#define DECLARE_NAMED_TRANSLATION_FACTORY (   n,
 
)
Value:

Definition at line 262 of file Factories.h.

◆ DECLARE_NAMED_XMLELEMENT_FACTORY

#define DECLARE_NAMED_XMLELEMENT_FACTORY (   n,
 
)
Value:

Definition at line 264 of file Factories.h.

◆ DECLARE_NAMESPACE_DETELEMENT_FACTORY

#define DECLARE_NAMESPACE_DETELEMENT_FACTORY (   n,
 
)
Value:
namespace dd4hep \
{ DD4HEP_PLUGINSVC_FACTORY(n::x,x,NamedObject*(dd4hep::Detector*,xml::Handle_t*,Ref_t*),__LINE__) }

Definition at line 258 of file Factories.h.

◆ DECLARE_SEGMENTATION

#define DECLARE_SEGMENTATION (   name,
  func 
)
Value:
template <> SegmentationObject* \
SegmentationFactory<name>::create(const DDSegmentation::BitFieldCoder* d) { return func(d); } \
DD4HEP_PLUGINSVC_FACTORY(name,segmentation_constructor__##name, \
SegmentationObject*(const DDSegmentation::BitFieldCoder*),__LINE__)}

Definition at line 270 of file Factories.h.

◆ DECLARE_SUBDETECTOR

#define DECLARE_SUBDETECTOR (   name,
  func 
)    DECLARE_XML_PROCESSOR_BASIC(name,func,0)

Definition at line 339 of file Factories.h.

◆ DECLARE_TRANSLATION

#define DECLARE_TRANSLATION (   name,
  func 
)
Value:
template <> Ref_t TranslationFactory<name>::create(dd4hep::Detector& l) {return func(l);} \
DECLARE_NAMED_TRANSLATION_FACTORY(Geometry,name) }

Definition at line 297 of file Factories.h.

◆ DECLARE_XML_DOC_READER

#define DECLARE_XML_DOC_READER (   name,
  func 
)
Value:
DD4HEP_OPEN_PLUGIN(dd4hep,xml_document_##name) { \
template <> long XMLDocumentReaderFactory<xml_document_##name>::create(dd4hep::Detector& l,ns::xml_h e) {return func(l,e);} \
DD4HEP_PLUGINSVC_FACTORY(xml_document_##name,name##_XML_reader,long(dd4hep::Detector*,ns::xml_h*),__LINE__) }

Definition at line 317 of file Factories.h.

◆ DECLARE_XML_PLUGIN

#define DECLARE_XML_PLUGIN (   name,
  func 
)
Value:
DD4HEP_OPEN_PLUGIN(dd4hep,xml_document_##name) { \
template <> long XMLDocumentReaderFactory<xml_document_##name>::create(dd4hep::Detector& l,ns::xml_h e) {return func(l,e);} \
DD4HEP_PLUGINSVC_FACTORY(xml_document_##name,name,long(dd4hep::Detector*,ns::xml_h*),__LINE__) }

Definition at line 322 of file Factories.h.

◆ DECLARE_XML_PROCESSOR

#define DECLARE_XML_PROCESSOR (   name,
  func 
)    DECLARE_XML_PROCESSOR_BASIC(name,func,0)

Definition at line 338 of file Factories.h.

◆ DECLARE_XML_PROCESSOR_BASIC

#define DECLARE_XML_PROCESSOR_BASIC (   name,
  func,
  deprecated 
)
Value:
DD4HEP_OPEN_PLUGIN(dd4hep,det_element_##name) {\
template <> Ref_t XmlDetElementFactory< det_element_##name >::create(dd4hep::Detector& l,ns::xml_h e,ns::ref_t h) \
{ if (deprecated) warning_deprecated_xml_factory(#name); return func(l,e,h);} \
DD4HEP_PLUGINSVC_FACTORY(det_element_##name,name,NamedObject*(dd4hep::Detector*,ns::xml_h*,Ref_t*),__LINE__) }

Definition at line 327 of file Factories.h.

◆ DECLARE_XML_SHAPE

#define DECLARE_XML_SHAPE (   name,
  func 
)
Value:
DD4HEP_OPEN_PLUGIN(dd4hep,xml_element_##name) {\
template <> Handle<TObject> XMLObjectFactory<xml_element_##name>::create(dd4hep::Detector& l,ns::xml_h e) {return func(l,e);}\
DD4HEP_PLUGINSVC_FACTORY(xml_element_##name,name,TObject*(dd4hep::Detector*,ns::xml_h*),__LINE__) }

Definition at line 307 of file Factories.h.

◆ DECLARE_XML_VOLUME

#define DECLARE_XML_VOLUME (   name,
  func 
)
Value:
DD4HEP_OPEN_PLUGIN(dd4hep,xml_element_##name) {\
template <> Handle<TObject> XMLObjectFactory<xml_element_##name>::create(dd4hep::Detector& l,ns::xml_h e) {return func(l,e);}\
DD4HEP_PLUGINSVC_FACTORY(xml_element_##name,name,TObject*(dd4hep::Detector*,ns::xml_h*),__LINE__) }

Definition at line 312 of file Factories.h.

◆ DECLARE_XMLELEMENT

#define DECLARE_XMLELEMENT (   name,
  func 
)
Value:
DD4HEP_OPEN_PLUGIN(dd4hep,xml_element_##name) {\
template <> Ref_t XMLElementFactory<xml_element_##name>::create(dd4hep::Detector& l,ns::xml_h e) {return func(l,e);} \
DD4HEP_PLUGINSVC_FACTORY(xml_element_##name,name,NamedObject*(dd4hep::Detector*,ns::xml_h*),__LINE__) }

Definition at line 302 of file Factories.h.

dd4hep::warning_deprecated_xml_factory
void warning_deprecated_xml_factory(const char *name)
Function tp print warning about deprecated factory usage. Used by Plugin mechanism.
Definition: Handle.cpp:369
dd4hep::xml::Handle_t
Class to easily access the properties of single XmlElements.
Definition: XMLElements.h:380
json_h
dd4hep::json::Handle_t json_h
Definition: Helper.h:26
DD4HEP_PLUGINSVC_FACTORY
#define DD4HEP_PLUGINSVC_FACTORY(type, name, signature, serial)
Definition: Plugins.h:150
xml_h
dd4hep::xml::Handle_t xml_h
Definition: ConditionsRepository.cpp:32
dd4hep::Ref_t
Handle< NamedObject > Ref_t
Default Ref_t definition describing named objects.
Definition: Handle.h:182
DD4HEP_OPEN_PLUGIN
#define DD4HEP_OPEN_PLUGIN(ns, name)
Definition: Plugins.h:148
TObject
Class of the ROOT toolkit. See http://root.cern.ch/root/htmldoc/ClassIndex.html.
Definition: ROOTClasses.h:41
dd4hep
Namespace for the AIDA detector description toolkit.
Definition: AlignmentsCalib.h:28
dd4hep::NamedObject
Implementation of a named object.
Definition: NamedObject.h:30
dd4hep::Detector
The main interface to the dd4hep detector description package.
Definition: Detector.h:90