Commit 90e8e425 authored by Simon Spannagel's avatar Simon Spannagel
Browse files

DetectorModel: add helper method to determine if this model is of a certain type

parent 94d2ce9e
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -51,6 +51,14 @@ namespace allpix {
         */
        static std::shared_ptr<DetectorModel> factory(const std::string& name, const ConfigReader&);

        /**
         * @brief Helper method to determine if this detector model is of a given type
         * The template parameter needs to be specified speicifcally, i.e.
         *     if(model->is<HybridPixelDetectorModel>()) { }
         * @return Boolean indication whether this model is of the given type or not
         */
        template <class T> bool is() { return dynamic_cast<T*>(this) != nullptr; }

        /**
         * @brief Helper class to hold support layers for a detector model
         */