#ifndef SUBSTRING_OCCURENCE_HDR #define SUBSTRING_OCCURENCE_HDR #include "concordia/common/config.hpp" #include #include /*! Class representing occurence of a searched substring. It holds the following information: - id of the example where the substring was found - offset of the matched substring in this example - length of the example */ class SubstringOccurence { public: /*! Constructor. */ SubstringOccurence(); /*! Constructor taking data from a marker. \param marker */ explicit SubstringOccurence(const SUFFIX_MARKER_TYPE & marker); /*! Constructor with three arguments. \param id example id \param offset offset of the substring in the example \param exampleLength length of the example */ SubstringOccurence(const SUFFIX_MARKER_TYPE & id, const SUFFIX_MARKER_TYPE & offset, const SUFFIX_MARKER_TYPE & exampleLength); /*! Destructor. */ virtual ~SubstringOccurence(); /*! Getter for example id. \returns example id */ SUFFIX_MARKER_TYPE getId() const { return _id; } /*! Getter for example offset \returns example offset */ SUFFIX_MARKER_TYPE getOffset() const { return _offset; } /*! Getter for example length. \returns example length */ SUFFIX_MARKER_TYPE getExampleLength() const { return _exampleLength; } /*! Setter of all the fields, based on input marker. \param marker marker to read the data from */ void enterDataFromMarker(const SUFFIX_MARKER_TYPE & marker); friend std::ostream & operator << (std::ostream & o, const SubstringOccurence & occurence) { return o << "occurence(exampleId=" << occurence.getId() << ", offset=" << occurence.getOffset() << ")"; } private: SUFFIX_MARKER_TYPE _id; SUFFIX_MARKER_TYPE _offset; // the example SUFFIX_MARKER_TYPE _exampleLength; }; #endif