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

Default implementation of the persistence API. More...

#include <batch_program_management.h>

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

Public Member Functions

uint16_t size () const
 Return the number of entries in the container. More...
 
Common::Result save (const uint8_t pid, const std::string &name, std::vector< Action > &actions)
 Store the given entry to persistent storage. More...
 
Common::Result destroy (const uint8_t pid)
 Remove the program with the given pid ftom. More...
 
Common::Result destroy (const Entry &entry)
 Destroy the given entry in the persistent storage. More...
 
void clear (void)
 Erase all the DB entries.
 
EntryPtr find (const uint8_t pid) const
 Find the program with the given pid. More...
 
EntryPtr find (const std::string &name) const
 Find the program with the given name. More...
 
uint8_t next_pid () const
 Return next available PID for the program. 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< Entry >
virtual Result save (const Entry &entry)=0
 Store the given entry to persistent storage. More...
 
virtual Result destroy (const Entry &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 414 of file batch_program_management.h.

Member Function Documentation

◆ begin() [1/2]

iterator HF::Core::BatchProgramManagement::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 453 of file batch_program_management.h.

References db.

454  {
455  return db.begin();
456  }
Container db
Actual container for the entries.

◆ begin() [2/2]

const_iterator HF::Core::BatchProgramManagement::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 473 of file batch_program_management.h.

References db.

474  {
475  return db.cbegin();
476  }
Container db
Actual container for the entries.

◆ destroy() [1/2]

Common::Result HF::Core::BatchProgramManagement::Entries::destroy ( const uint8_t  pid)
virtual

Remove the program with the given pid ftom.

Parameters
[in]pidthe Program ID to destroy.
Return values
Result::OKif the entry was destroyed,
Result::FAIL_ARGif no entry with pid exists,
Result::FAIL_UNKNOWNotherwise.

Implements HF::Core::BatchProgramManagement::IEntries.

◆ destroy() [2/2]

Common::Result HF::Core::BatchProgramManagement::Entries::destroy ( const Entry &  entry)

Destroy the given entry in the persistent storage.

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

◆ end() [1/2]

iterator HF::Core::BatchProgramManagement::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 463 of file batch_program_management.h.

References db.

464  {
465  return db.end();
466  }
Container db
Actual container for the entries.

◆ end() [2/2]

const_iterator HF::Core::BatchProgramManagement::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 483 of file batch_program_management.h.

References db.

484  {
485  return db.cend();
486  }
Container db
Actual container for the entries.

◆ find() [1/2]

EntryPtr HF::Core::BatchProgramManagement::Entries::find ( const uint8_t  pid) const
virtual

Find the program with the given pid.

Parameters
[in]pidthe Program ID to search for.
Returns
pointer to the program with the given pid, nullptr otherwise.

Implements HF::Core::BatchProgramManagement::IEntries.

◆ find() [2/2]

EntryPtr HF::Core::BatchProgramManagement::Entries::find ( const std::string &  name) const
virtual

Find the program with the given name.

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

Implements HF::Core::BatchProgramManagement::IEntries.

◆ next_pid()

uint8_t HF::Core::BatchProgramManagement::Entries::next_pid ( ) const
virtual

Return next available PID for the program.

Returns
the PID to use in the program entry, or Entry::AVAILABLE_PID if no PID is available.

Implements HF::Core::BatchProgramManagement::IEntries.

◆ save()

Common::Result HF::Core::BatchProgramManagement::Entries::save ( const uint8_t  pid,
const std::string &  name,
std::vector< Action > &  actions 
)
virtual

Store the given entry to persistent storage.

Parameters
[in]pidProgram ID for the new entry.
[in]namename for the new batch program.
[in]actionsAction list for the batch program.
Return values
Common::Result::OKif the entry was saved,
Common::Result::FAIL_UNKNOWNotherwise.

Implements HF::Core::BatchProgramManagement::IEntries.

◆ size()

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

Return the number of entries in the container.

Returns
the number of entries in the container.

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


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