diff --git a/DDDigi/include/DDDigi/DigiAction.h b/DDDigi/include/DDDigi/DigiAction.h index a279733e9bc781626153ab43ede5a23af9be08ac..e85883312d23c5fcce45e4c1e24b529c0ad8e44e 100644 --- a/DDDigi/include/DDDigi/DigiAction.h +++ b/DDDigi/include/DDDigi/DigiAction.h @@ -23,6 +23,25 @@ #include <string> #include <cstdarg> +#if defined(G__ROOT) || defined(__CLING__) || defined(__ROOTCLING__) +#define DDDIGI_DEFINE_ACTION_DEFAULT_CTOR(action) public: action() = default; +#else +#define DDDIGI_DEFINE_ACTION_DEFAULT_CTOR(action) protected: action() = delete; +#endif + +/// 1) Allow default constructor (necessary for ROOT) +/// 2) Inhibit move constructor +/// 3) Inhibit copy constructor +/// 4) Inhibit move operator +/// 5) Inhibit assignment operator +#define DDDIGI_DEFINE_ACTION_CONSTRUCTORS(action) \ + DDDIGI_DEFINE_ACTION_DEFAULT_CTOR(action) \ + protected: \ + action(action&& copy) = delete; \ + action(const action& copy) = delete; \ + action& operator=(action&& copy) = delete; \ + action& operator=(const action& copy) = delete + /// Namespace for the AIDA detector description toolkit namespace dd4hep { @@ -207,16 +226,9 @@ namespace dd4hep { }; protected: - /// Inhibit default constructor - DigiAction() = delete; - /// Inhibit copy constructor - DigiAction(const DigiAction& copy) = delete; - /// Inhibit move constructor - DigiAction(DigiAction&& copy) = delete; - /// Inhibit assignment operator - DigiAction& operator=(const DigiAction& copy) = delete; - /// Inhibit assignment operator - DigiAction& operator=(DigiAction&& copy) = delete; + + /// Define standard assignments and constructors + DDDIGI_DEFINE_ACTION_CONSTRUCTORS(DigiAction); /// Default destructor virtual ~DigiAction(); diff --git a/DDDigi/include/DDDigi/DigiActionSequence.h b/DDDigi/include/DDDigi/DigiActionSequence.h index 8364058333dae6a96cbcf9673a3f0f76702e861a..ce27fbc0af690cedc9b5cffb7d247ad799668ff2 100644 --- a/DDDigi/include/DDDigi/DigiActionSequence.h +++ b/DDDigi/include/DDDigi/DigiActionSequence.h @@ -48,16 +48,8 @@ namespace dd4hep { CallbackSequence m_end; protected: - /// Inhibit public use of default constructor - DigiActionSequence() = delete; - /// Inhibit move constructor - DigiActionSequence(DigiActionSequence&& copy) = delete; - /// Inhibit copy constructor - DigiActionSequence(const DigiActionSequence& copy) = delete; - /// Inhibit move operator - DigiActionSequence& operator=(DigiActionSequence&& copy) = delete; - /// Inhibit assignment operator - DigiActionSequence& operator=(const DigiActionSequence& copy) = delete; + /// Define standard assignments and constructors + DDDIGI_DEFINE_ACTION_CONSTRUCTORS(DigiActionSequence); public: /// Standard constructor diff --git a/DDDigi/include/DDDigi/DigiInputAction.h b/DDDigi/include/DDDigi/DigiInputAction.h index b37a9cb605803641806bfc7b923ce0bb4aa11686..5ed83e10fd297c11a47e1ed45053c229667543fb 100644 --- a/DDDigi/include/DDDigi/DigiInputAction.h +++ b/DDDigi/include/DDDigi/DigiInputAction.h @@ -35,15 +35,11 @@ namespace dd4hep { */ class DigiInputAction : public DigiAction { protected: + /// Input data specification std::vector<std::string> m_input; - protected: - /// Inhibit copy constructor - DigiInputAction() = delete; - /// Inhibit copy constructor - DigiInputAction(const DigiInputAction& copy) = delete; - /// Inhibit assignment operator - DigiInputAction& operator=(const DigiInputAction& copy) = delete; + /// Define standard assignments and constructors + DDDIGI_DEFINE_ACTION_CONSTRUCTORS(DigiInputAction); public: /// Standard constructor diff --git a/DDDigi/include/DDDigi/DigiKernel.h b/DDDigi/include/DDDigi/DigiKernel.h index e6f2658437123d0174eaaa89f09402f513177e59..f652aa2e6d82139c7a692ff543b41a52d737789a 100644 --- a/DDDigi/include/DDDigi/DigiKernel.h +++ b/DDDigi/include/DDDigi/DigiKernel.h @@ -65,6 +65,10 @@ namespace dd4hep { /// Notify kernel that the execution of one single event finished void notify(DigiContext* context, const std::exception& e); + protected: + /// Define standard assignments and constructors + DDDIGI_DEFINE_ACTION_CONSTRUCTORS(DigiKernel); + public: /// Standard constructor for the master instance DigiKernel(Detector& description); diff --git a/DDDigi/include/DDDigi/DigiLockedAction.h b/DDDigi/include/DDDigi/DigiLockedAction.h index 4d4c97e5dc1771b81bd49a0c2d45ed90a252b0fb..c38ca7231559b71f6b96a1391da580d789cdab23 100644 --- a/DDDigi/include/DDDigi/DigiLockedAction.h +++ b/DDDigi/include/DDDigi/DigiLockedAction.h @@ -42,14 +42,11 @@ namespace dd4hep { std::mutex m_lock; /// Reference to underlying action DigiAction* m_action = 0; - protected: - /// Inhibit copy constructor - DigiLockedAction() = delete; - /// Inhibit copy constructor - DigiLockedAction(const DigiLockedAction& copy) = delete; - /// Inhibit assignment operator - DigiLockedAction& operator=(const DigiLockedAction& copy) = delete; + protected: + /// Define standard assignments and constructors + DDDIGI_DEFINE_ACTION_CONSTRUCTORS(DigiLockedAction); + public: /// Standard constructor DigiLockedAction(const DigiKernel& kernel, const std::string& nam); diff --git a/DDDigi/include/DDDigi/DigiSynchronize.h b/DDDigi/include/DDDigi/DigiSynchronize.h index c7f4bee0bc36a7cbaf39c2c4b41e51ab67484269..eb76a1e225ce771c91056ca730776615db350db1 100644 --- a/DDDigi/include/DDDigi/DigiSynchronize.h +++ b/DDDigi/include/DDDigi/DigiSynchronize.h @@ -36,16 +36,9 @@ namespace dd4hep { /// The list of action objects to be called Actors<DigiAction> m_actors; - /// Inhibit public use of default constructor - DigiSynchronize() = default; - /// Inhibit move constructor - DigiSynchronize(DigiSynchronize&& copy) = delete; - /// Inhibit copy constructor - DigiSynchronize(const DigiSynchronize& copy) = delete; - /// Inhibit move operator - DigiSynchronize& operator=(DigiSynchronize&& copy) = delete; - /// Inhibit assignment operator - DigiSynchronize& operator=(const DigiSynchronize& copy) = delete; + protected: + /// Define standard assignments and constructors + DDDIGI_DEFINE_ACTION_CONSTRUCTORS(DigiSynchronize); public: /// Standard constructor