// LTrack.h #ifndef LTrack_H #define LTrack_H // Class LTrack holds an ETrack and a chain of LayerStat objects // with a pointer to the current status. This class manages both // the track and status chain. // // The status chain (class LayerStatChain) has few public methods. // This class is a friend and directly manipulates it attributes. // This class provides the interface for maniputlaing the chain. // // Non-default LTrack objects are created only in Layer method // propagate(tre,prop). Other classes (including Layer subclasses) // may construct default objects and assign them or may copy with // the copy constructor. // // The chain of layer status objects correspond exactly to the nest // of layers that carried out the propagation. I.e., the first // status points to the top layer, the second to the first sublayer, etc. // // 17sep99 // LTrack now carries the result of the propagation in a PropStat object. // Default is failed propagation. // #include "trfbase/ETrack.h" #include "trfbase/PropStat.h" #include "LayerStatChain.h" #include "LayerStat.h" #include "ptr/Ptr.h" #include namespace trf { class LTrack; class Propagator; // List of reference-counting pointers to LTrack's. typedef std::vector LTrackList; // output stream std::ostream& operator<<(std::ostream& stream, const LTrack& trl); class LTrack { // Needs access to the non-default constructor friend class Layer; private: // attributes // track ETrack _tre; // chain of LayerStat objects // The first is the top of the list. LayerStatChain _chain; // propagation status PropStat _pstat; private: // output stream void ostr(std::ostream& stream) const; // constructor from track and layer status // The status is used to start a chain. // This is only used by Layer::propagate(tre,prop). LTrack(const ETrack& tre, const LayerStat& lstat); public: // methods // Default constructor. // This is needed so layers can return lists of LTrack's. LTrack(); // copy constructor // track and complete status chain are copied LTrack(const LTrack& trl); // assignment operator LTrack& operator=(const LTrack& trl); // destructor ~LTrack(); // return if the current status is defined bool at_valid_status() const; // Return if the current status is the top-level status. // Returns true for an empty status list. bool at_top_status() const; // return the current status LayerStat& get_status(); // return the current status const const LayerStat& get_status() const; // Step down the status chain. // Returns false when the last element in the chain is reached. bool set_next_status(); // Step up the status chain. // Returns false when the first element in the chain is reached. bool set_previous_status(); // Add a status to the end of the list. // Returns a reference to the added status. // Sets pointer to reference the new status. // Note that the argument may be a layer. LayerStat& push_status(const LayerStat& lstat); // drop the last status from the list // Set current status back only if it pointed at deleted element. // Return false if there was no status to drop. bool pop_status(); // Set the cluster status to be the current status. void set_cluster_status(); // clear the cluster status. void clear_cluster_status(); // fetch the status chain LayerStatChain& get_status_chain() { return _chain; } // fetch the status chain const const LayerStatChain& get_status_chain() const { return _chain; } // fetch reference to the track ETrack& get_track() { return _tre; }; // fetch const reference to the track const ETrack& get_track() const { return _tre; }; // Fetch reference to propagation status. PropStat& get_prop_stat() { return _pstat; } // Fetch const reference to propagation status. const PropStat& get_prop_stat() const { return _pstat; } // output stream friend std::ostream& operator<<(std::ostream& stream, const LTrack& trl); }; } // end namespace trf #endif