HAN-FUN API  1.5.3
This project provides the common implementation of ULE Alliance's HAN-FUN application protocol.
HF::Core::GroupManagement::Entries Struct Reference

Default implementation of the persistence API. More...

#include <group_management.h>

+ Inheritance diagram for HF::Core::GroupManagement::Entries:
+ Collaboration diagram for HF::Core::GroupManagement::Entries:

Public Member Functions

uint16_t size () const
 Return the number of entries in the container. More...
 
Common::Result save (uint16_t address, const std::string &name)
 Store the given entry to persistent storage. More...
 
Common::Result destroy (const uint16_t address)
 Destroy the entry given by address in the persistent storage. More...
 
Common::Result destroy (const Group &entry)
 Destroy the given entry in the persistent storage. More...
 
GroupPtr find (uint16_t address) const
 Find the group with the given group address. More...
 
GroupPtr find (const std::string &name) const
 Find the group with the given name. More...
 
uint16_t next_address () const
 Return next available address for device group. More...
 
iterator begin ()
 Get an iterator to the start of the entries in this container. More...
 
iterator end ()
 Get an iterator to the end of the entries in this container. More...
 
const_iterator begin () const
 Get a constant iterator to the start of the entries in this container. More...
 
const_iterator end () const
 Get a constant iterator to the start of the entries in this container. More...
 
- Public Member Functions inherited from HF::Common::IEntries< Group >
virtual Result save (const Group &entry)=0
 Store the given entry to persistent storage. More...
 
virtual Result destroy (const Group &entry)=0
 Destroy the given entry in the persistent storage. More...
 

Protected Attributes

Container db
 Actual container for the entries.
 

Detailed Description

Default implementation of the persistence API.

Definition at line 641 of file group_management.h.

Member Function Documentation

◆ begin() [1/2]

iterator HF::Core::GroupManagement::Entries::begin ( )
inline

Get an iterator to the start of the entries in this container.

Returns
iterator to the start of the entries present in this container.

Definition at line 682 of file group_management.h.

References db.

683  {
684  return db.begin();
685  }
Container db
Actual container for the entries.

◆ begin() [2/2]

const_iterator HF::Core::GroupManagement::Entries::begin ( ) const
inline

Get a constant iterator to the start of the entries in this container.

Returns
constant iterator to the start of the entries present in this container.

Definition at line 702 of file group_management.h.

References db.

703  {
704  return db.cbegin();
705  }
Container db
Actual container for the entries.

◆ destroy() [1/2]

Common::Result HF::Core::GroupManagement::Entries::destroy ( const uint16_t  address)
virtual

Destroy the entry given by address in the persistent storage.

Parameters
[in]addressthe address to the entry to erase.
Return values
Common::Result::OK,ifthe entry was destroyed.
Common::Result::FAIL_ARGotherwise.

Implements HF::Core::GroupManagement::IEntries.

◆ destroy() [2/2]

Common::Result HF::Core::GroupManagement::Entries::destroy ( const Group entry)

Destroy the given entry in the persistent storage.

Warning
the reference passed into this method SHOULD NOT be considered valid if it was obtained by calling the find method.
Parameters
[in]entryreference to the entry to erase.
Return values
Common::Result::OK,ifthe entry was destroyed.
Common::Result::FAIL_ARGotherwise.

◆ end() [1/2]

iterator HF::Core::GroupManagement::Entries::end ( )
inline

Get an iterator to the end of the entries in this container.

Returns
iterator to the end of the entries present in this container.

Definition at line 692 of file group_management.h.

References db.

693  {
694  return db.end();
695  }
Container db
Actual container for the entries.

◆ end() [2/2]

const_iterator HF::Core::GroupManagement::Entries::end ( ) const
inline

Get a constant iterator to the start of the entries in this container.

Returns
constant iterator to the start of the entries present in this container.

Definition at line 712 of file group_management.h.

References db.

713  {
714  return db.cend();
715  }
Container db
Actual container for the entries.

◆ find() [1/2]

GroupPtr HF::Core::GroupManagement::Entries::find ( uint16_t  address) const
virtual

Find the group with the given group address.

Parameters
[in]addressHF address to search for.
Returns
pointer to the group with the given address, nullptr otherwise.

Implements HF::Core::GroupManagement::IEntries.

◆ find() [2/2]

GroupPtr HF::Core::GroupManagement::Entries::find ( const std::string &  name) const
virtual

Find the group with the given name.

Parameters
[in]namegroup name to search for.
Returns
pointer to the group with the given name, nullptr otherwise.

Implements HF::Core::GroupManagement::IEntries.

◆ next_address()

uint16_t HF::Core::GroupManagement::Entries::next_address ( ) const
virtual

Return next available address for device group.

Returns
the address to use in the next group, or GroupAddress::NO_ADDR if no address is available.

Implements HF::Core::GroupManagement::IEntries.

◆ save()

Common::Result HF::Core::GroupManagement::Entries::save ( uint16_t  address,
const std::string &  name 
)
virtual

Store the given entry to persistent storage.

Parameters
[in]addressHF group address for the new group.
[in]namename for the new group.
Return values
Common::Result::OKif the entry was saved,
Common::Result::FAIL_UNKNOWNotherwise.

Implements HF::Core::GroupManagement::IEntries.

◆ size()

uint16_t HF::Core::GroupManagement::Entries::size ( ) const
virtual

Return the number of entries in the container.

Returns
the number of entries in the container.

Implements HF::Common::IEntries< Group >.


The documentation for this struct was generated from the following file: