Commit 3e8fb58d authored by Paul Schütze's avatar Paul Schütze
Browse files

Merge branch 'detmodel_is' into 'master'

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

See merge request allpix-squared/allpix-squared!634
parents 49987b19 90e8e425
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
         */