// InteractingLayer.h #ifndef InteractingLayer_H #define InteractingLayer_H // Class which inherits from Layer, and adds some interaction to Layer's // track list. The InteractingLayer contains a concrete layer // (a LayerCylinder, for instance), and a concrete interactor // (a ThinCylMS, for instance). To add an interaction to tracks after // the tracks have been propagated to the layer, one simply calls // InteractingLayer.propagate(...). The contained layer's propagate is // then called, and the interaction appropriate to the contained interactor // is applied. #include #include "Layer.h" #include "LTrack.h" #include "trfbase/SurfacePtr.h" #include "trfbase/Interactor.h" #include "trfbase/InteractorPtr.h" #include "LayerPtr.h" namespace trf { class InteractingLayer : public Layer { public: // typedefs typedef std::vector InteractorList; typedef std::vector SurfaceList; public: // static methods // Return the type name. static TypeName get_type_name() { return "InteractingLayer"; } // Return the creator. static ObjCreator get_creator(); // Return the type. static Type get_static_type() { return get_creator(); } private: // attributes LayerPtr _plyr; InteractorPtr _pinter; private: // methods // output stream void ostr(std::ostream& stream) const; // Propagate a track to the next surface inthis layer. // The list of successful propagations is returned. // This calls _propagate of its layer void _propagate(const LTrack& tr1, const Propagator& prop, LTrackList& ltracks) const; // Interact a track. void _interact(ETrack& tre) const; public: // methods // constructor from a layer pointer and a single interactor pointer InteractingLayer(const LayerPtr& plyr, const InteractorPtr& pinter); // destructor virtual ~InteractingLayer(); // Return the type. Type get_type() const { return get_static_type(); } // Write the object data. ObjData write_data() const; // Return the layer. const LayerPtr& get_layer() const { return _plyr; } // Return the interactor. const InteractorPtr& get_interactor() const { return _pinter; } // call the contained class's has_clusters: bool has_clusters() const { return _plyr->has_clusters(); } // call the containing class's get_cluster_surfaces() SurfaceList get_cluster_surfaces() const; // Return all the clusters associated with the current layer // or its descendants. // Default here is to crash or return an error. virtual ClusterList get_clusters() const; // Return all the clusters associated with a particular surface // in this layer. // This method should call report_invalid_surface(SurfacePtr) // if it does not recognize the argument. virtual ClusterList get_clusters(SurfacePtr psrf) const; // Add a cluster to the layer. // Default here is to crash or return an error. virtual int add_cluster(const ClusterPtr& pclu); // Add a cluster to a particular surface in the layer. // Default here is to crash or return an error. virtual int add_cluster(const ClusterPtr& pclu, SurfacePtr psrf); // Drop all clusters from this layer. // Default here is to crash or return an error. virtual void drop_clusters(); }; } // end namespace trf #endif