| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | // ====================================================================== | ||
| 2 | // \title MapEntryBase | ||
| 3 | // \author bocchino | ||
| 4 | // \brief An abstract base class representing an entry in a map | ||
| 5 | // ====================================================================== | ||
| 6 | |||
| 7 | #ifndef Fw_MapEntryBase_HPP | ||
| 8 | #define Fw_MapEntryBase_HPP | ||
| 9 | |||
| 10 | #include "Fw/FPrimeBasicTypes.hpp" | ||
| 11 | |||
| 12 | namespace Fw { | ||
| 13 | |||
| 14 | template <typename K, typename V> | ||
| 15 | class MapEntryBase { | ||
| 16 | private: | ||
| 17 | // ---------------------------------------------------------------------- | ||
| 18 | // Deleted elements | ||
| 19 | // ---------------------------------------------------------------------- | ||
| 20 | |||
| 21 | //! Copy constructor deleted in the base class | ||
| 22 | //! Behavior depends on the implementation | ||
| 23 | MapEntryBase(const MapEntryBase<K, V>&) = delete; | ||
| 24 | |||
| 25 | //! operator= deleted in the base class | ||
| 26 | //! Behavior depends on the implementation | ||
| 27 | //! We avoid virtual user-defined operators | ||
| 28 | MapEntryBase<K, V>& operator=(const MapEntryBase<K, V>&) = delete; | ||
| 29 | |||
| 30 | protected: | ||
| 31 | // ---------------------------------------------------------------------- | ||
| 32 | // Protected constructors and destructors | ||
| 33 | // ---------------------------------------------------------------------- | ||
| 34 | |||
| 35 | //! Zero-argument constructor | ||
| 36 | 333683 | MapEntryBase() = default; | |
| 37 | |||
| 38 | //! Destructor | ||
| 39 | 658508 | virtual ~MapEntryBase() = default; | |
| 40 | |||
| 41 | public: | ||
| 42 | // ---------------------------------------------------------------------- | ||
| 43 | // Public member functions | ||
| 44 | // ---------------------------------------------------------------------- | ||
| 45 | |||
| 46 | //! Get the key associated with this entry | ||
| 47 | //! \return The key | ||
| 48 | virtual const K& getKey() const = 0; | ||
| 49 | |||
| 50 | //! Get the value associated with this entry | ||
| 51 | //! \return The value | ||
| 52 | virtual const V& getValue() const = 0; | ||
| 53 | }; | ||
| 54 | |||
| 55 | } // namespace Fw | ||
| 56 | |||
| 57 | #endif | ||
| 58 |