Skip to content

SetOrMapImplEntry

SetOrMapImplEntry is a final class template defined in Fw/DataStructures. It represents an entry in a set or a map implementation.

1. Template Parameters

SetOrMapImplEntry has the following template parameters.

Kind Name Purpose
typename KE The type of a key in a map or the element of a set
typename VN The type of a value in a map or Nil in a set

SetOrMapImplEntry statically asserts the following:

  • KE is default constructible.
  • KE is assignable to KE&.
  • VN is default constructible.
  • VN is assignable to VN&.

2. Base Class

SetOrMapImplEntry<KE, VN> is publicly derived from the following templates:

  1. MapEntryBase<KE, VN>.
classDiagram
    MapEntryBase <|-- SetOrMapImplEntry

3. Private Member Variables

SetOrMapImplEntry has the following private member variables.

Name Type Purpose Default Value
m_keyOrElement KE The map key or set element C++ default initialization
m_valueOrNil VN The value or Nil C++ default initialization

4. Public Constructors and Destructors

4.1. Zero-Argument Constructor

SetOrMapImplEntry()

Use default initialization of members.

4.2. Constructor Providing Members

SetOrMapImplEntry(const KE& keyOrElement, const VN& valueOrNil)
  1. Set m_keyOrElement = keyOrElement.

  2. Set m_valueOrNil = valueOrNil.

4.3. Copy Constructor

SetOrMapImplEntry(const SetOrMapImplEntry<KE, VN>& entry)

Set *this = entry.

4.4. Destructor

~SetOrMapImplEntry() override

Defined as = default.

5. Public Member Functions

5.1. operator=

SetOrMapImplEntry<KE, VN>& operator=(const SetOrMapImplEntry<KE, VN>& entry)
  1. If this != &entry

    1. Set m_keyOrElement = entry.m_keyOrElement.

    2. Set m_valueOrNil = entry.m_valueOrNil.

  2. Return *this.

5.2. getKeyOrElement

const KE& getKeyOrElement() const

Return a reference to m_keyOrElement.

5.3. getValueOrNil

const VN& getValueOrNil() const

Return a reference to m_valueOrNil.

5.4. getKey

const KE& getKey() const override

Return a reference to m_keyOrElement.

5.5. getValue

const VN& getValue() const override

Return a reference to m_valueOrNil.

5.6. setKeyOrElement

void setKeyOrElement(const KE& keyOrElement)

Set m_keyOrElement = keyOrElement.

5.7. setValueOrNil

void setValueOrNil(const VN& valueOrNil)

Set m_valueOrNil = valueOrNil.