| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | // ====================================================================== | ||
| 2 | // \title SetOrMapImplConstIterator | ||
| 3 | // \author bocchino | ||
| 4 | // \brief A class template representing a const iterator for a set or map implementation | ||
| 5 | // ====================================================================== | ||
| 6 | |||
| 7 | #ifndef Fw_SetOrMapImplConstIterator_HPP | ||
| 8 | #define Fw_SetOrMapImplConstIterator_HPP | ||
| 9 | |||
| 10 | #include "Fw/DataStructures/SetOrMapImplEntry.hpp" | ||
| 11 | #include "Fw/FPrimeBasicTypes.hpp" | ||
| 12 | |||
| 13 | namespace Fw { | ||
| 14 | |||
| 15 | template <typename KE, typename VN> | ||
| 16 | class SetOrMapImplConstIterator { | ||
| 17 | private: | ||
| 18 | // ---------------------------------------------------------------------- | ||
| 19 | // Deleted elements | ||
| 20 | // ---------------------------------------------------------------------- | ||
| 21 | |||
| 22 | //! Copy constructor | ||
| 23 | SetOrMapImplConstIterator(const SetOrMapImplConstIterator<KE, VN>& it) = delete; | ||
| 24 | |||
| 25 | //! Copy assignment operator | ||
| 26 | SetOrMapImplConstIterator& operator=(const SetOrMapImplConstIterator<KE, VN>&) = delete; | ||
| 27 | |||
| 28 | public: | ||
| 29 | // ---------------------------------------------------------------------- | ||
| 30 | // Types | ||
| 31 | // ---------------------------------------------------------------------- | ||
| 32 | |||
| 33 | //! The kind of a const iterator implementation | ||
| 34 | enum class ImplKind { ARRAY, RED_BLACK_TREE }; | ||
| 35 | |||
| 36 | public: | ||
| 37 | // ---------------------------------------------------------------------- | ||
| 38 | // Constructors and destructors | ||
| 39 | // ---------------------------------------------------------------------- | ||
| 40 | |||
| 41 | //! Zero-argument constructor | ||
| 42 | 267192 | SetOrMapImplConstIterator() = default; | |
| 43 | |||
| 44 | //! Destructor | ||
| 45 | 262866 | virtual ~SetOrMapImplConstIterator() = default; | |
| 46 | |||
| 47 | public: | ||
| 48 | // ---------------------------------------------------------------------- | ||
| 49 | // Public member functions | ||
| 50 | // ---------------------------------------------------------------------- | ||
| 51 | |||
| 52 | //! Return the impl kind | ||
| 53 | //! \return The impl kind | ||
| 54 | virtual ImplKind implKind() const = 0; | ||
| 55 | |||
| 56 | //! Increment the iterator | ||
| 57 | virtual void increment() = 0; | ||
| 58 | |||
| 59 | //! Check whether the iterator is in range | ||
| 60 | //! \return True if the iterator is in range | ||
| 61 | virtual bool isInRange() const = 0; | ||
| 62 | |||
| 63 | //! Get the set or map impl entry pointed to by this iterator | ||
| 64 | //! \return The set or map impl entry | ||
| 65 | virtual const SetOrMapImplEntry<KE, VN>& getEntry() const = 0; | ||
| 66 | }; | ||
| 67 | |||
| 68 | } // namespace Fw | ||
| 69 | |||
| 70 | #endif | ||
| 71 |