File indexing completed on 2025-01-18 09:55:21
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013 #ifndef DDDIGI_DIGIHANDLE_H
0014 #define DDDIGI_DIGIHANDLE_H
0015
0016
0017 #include <DD4hep/ComponentProperties.h>
0018 #include <DD4hep/Detector.h>
0019
0020
0021 #include <string>
0022 #include <memory>
0023
0024
0025 namespace dd4hep {
0026
0027
0028 namespace digi {
0029
0030
0031 class DigiKernel;
0032 class DigiAction;
0033 class DigiEventAction;
0034 class DigiSignalProcessor;
0035
0036
0037
0038
0039
0040
0041
0042 class KernelHandle {
0043 public:
0044
0045 mutable DigiKernel* value;
0046
0047 explicit KernelHandle();
0048
0049 explicit KernelHandle(DigiKernel* k);
0050
0051 KernelHandle(const KernelHandle& k) : value(k.value) {}
0052
0053 ~KernelHandle() { }
0054
0055 operator DigiKernel*() const { return value; }
0056
0057 DigiKernel* get() const { return value; }
0058
0059 DigiKernel* operator->() const { return value; }
0060
0061 Property& operator[](const std::string& property_name) const;
0062
0063 KernelHandle worker();
0064
0065 void destroy();
0066 };
0067
0068
0069
0070
0071
0072
0073
0074 template <typename TYPE> class DigiHandle {
0075 protected:
0076 void checked_assign(TYPE* p);
0077 TYPE* null() { return 0; }
0078 public:
0079
0080 mutable TYPE* value = 0;
0081
0082 explicit DigiHandle() = default;
0083
0084 DigiHandle(TYPE* typ);
0085
0086 template <typename T> DigiHandle(T* typ) : value(0) {
0087 checked_assign(dynamic_cast<TYPE*>(typ));
0088 }
0089
0090 DigiHandle(const DigiHandle& handle);
0091
0092 DigiHandle(DigiHandle&& handle);
0093
0094 DigiHandle(const DigiKernel&, const char* type_name);
0095
0096 DigiHandle(const DigiKernel&, const std::string& type_name);
0097
0098 ~DigiHandle();
0099
0100 Property& operator[](const std::string& property_name) const;
0101
0102 DigiHandle& operator=(const DigiHandle& handle);
0103
0104 DigiHandle& operator=(DigiHandle&& handle);
0105
0106 DigiHandle& operator=(TYPE* ptr);
0107
0108 bool operator!() const;
0109
0110 DigiAction* action() const;
0111
0112 TYPE* operator->() const;
0113
0114 operator TYPE*() const;
0115
0116 TYPE* get() const;
0117
0118 TYPE* release();
0119 };
0120
0121 }
0122 }
0123
0124 #endif