![]() |
HAN-FUN API
1.5.3
This project provides the common implementation of ULE Alliance's HAN-FUN application protocol.
|
Default implementation of the persistence API. More...
#include <scheduling.h>
Public Member Functions | |
uint16_t | size () const |
Return the number of entries in the container. More... | |
Common::Result | save (const EntryType &entry) |
Store the given entry to persistent storage. More... | |
Common::Result | save (uint8_t id, uint8_t status, _Type &time, uint8_t pid) |
Store the given entry to persistent storage. More... | |
void | clear (void) |
Erase all the DB entries. | |
Common::Result | destroy (const uint8_t id) |
Destroy the given entry in the persistent storage. More... | |
Common::Result | destroy (const EntryType &entry) |
Destroy the given entry in the persistent storage. More... | |
EntryPointer | find (uint8_t id) const |
Find the Event with the given id. More... | |
void | for_each (std::function< void(Entry< _Type > &)> func) |
Call the given function with each entry in the DB as argument. More... | |
uint8_t | next_id () const |
Return next available id for event. 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... | |
![]() | |
virtual void | for_each (std::function< void(EntryType &e)> func)=0 |
Call the given function with each entry in the DB as argument. More... | |
![]() | |
virtual Result | save (const Entry< _Type > &entry)=0 |
Store the given entry to persistent storage. More... | |
virtual Result | destroy (const Entry< _Type > &entry)=0 |
Destroy the given entry in the persistent storage. More... | |
Protected Member Functions | |
bool | exists (const uint8_t id) const |
Check if entry with given id exists. More... | |
Protected Attributes | |
Container | db |
Actual container for the entries. | |
Additional Inherited Members | |
![]() | |
typedef Entry< _Type > | EntryType |
Entry helper type. More... | |
typedef Common::Pointer< EntryType > | EntryPointer |
Entry pointer helper. More... | |
Default implementation of the persistence API.
_Type | the specific type of the scheduling entry. |
Definition at line 536 of file scheduling.h.
|
inline |
Get an iterator to the start of the entries in this container.
Definition at line 672 of file scheduling.h.
References HF::Core::Scheduling::Entries< _Type >::db.
|
inline |
Get a constant iterator to the start of the entries in this container.
Definition at line 692 of file scheduling.h.
References HF::Core::Scheduling::Entries< _Type >::db.
|
inline |
Destroy the given entry
in the persistent storage.
[in] | id | the Event ID to destroy |
Common::Result::OK,if | the entry was destroyed. |
Common::Result::FAIL_ARG | otherwise. |
Definition at line 601 of file scheduling.h.
References HF::Core::Scheduling::Entries< _Type >::db, HF::Core::Scheduling::Entries< _Type >::exists(), HF::Common::FAIL_ARG, HF::Core::Scheduling::Entry< _Type >::id, and HF::Common::OK.
Referenced by HF::Core::Scheduling::Entries< _Type >::destroy().
|
inline |
Destroy the given entry
in the persistent storage.
[in] | entry | reference to the entry to erase. |
Common::Result::OK,if | the entry was destroyed. |
Common::Result::FAIL_ARG | otherwise. |
Definition at line 620 of file scheduling.h.
References HF::Core::Scheduling::Entries< _Type >::destroy(), and HF::Core::Scheduling::Entry< _Type >::id.
|
inline |
Get an iterator to the end of the entries in this container.
Definition at line 682 of file scheduling.h.
References HF::Core::Scheduling::Entries< _Type >::db.
|
inline |
Get a constant iterator to the start of the entries in this container.
Definition at line 702 of file scheduling.h.
References HF::Core::Scheduling::Entries< _Type >::db.
|
inlineprotected |
Check if entry with given id
exists.
[in] | id | the entry ID to search for. |
true | if the entry already exists, |
false | otherwise. |
Definition at line 717 of file scheduling.h.
References HF::Core::Scheduling::Entries< _Type >::db.
Referenced by HF::Core::Scheduling::Entries< _Type >::destroy(), HF::Core::Scheduling::Entries< _Type >::next_id(), and HF::Core::Scheduling::Entries< _Type >::save().
|
inlinevirtual |
Find the Event with the given id.
[in] | id | Event ID to search for. |
id
, nullptr
otherwise. Implements HF::Core::Scheduling::IEntries< _Type >.
Definition at line 626 of file scheduling.h.
References HF::Core::Scheduling::Entries< _Type >::db.
|
inline |
Call the given function with each entry in the DB as argument.
[in] | func | function to apply to all entries in the store. |
Definition at line 643 of file scheduling.h.
References HF::Core::Scheduling::Entries< _Type >::db.
|
inlinevirtual |
Return next available id for event.
Scheduler::Entry::AVAILABLE_ID
if no id is available. Implements HF::Core::Scheduling::IEntries< _Type >.
Definition at line 649 of file scheduling.h.
References HF::Core::Scheduling::Entry< _Type >::AVAILABLE_ID, HF::Core::Scheduling::Entries< _Type >::db, HF::Core::Scheduling::Entries< _Type >::exists(), HF::Core::Scheduling::Entry< _Type >::MAX_ID, and HF::Core::Scheduling::Entry< _Type >::START_ID.
|
inlinevirtual |
Store the given entry
to persistent storage.
[in] | entry | the entry to save to storage. |
Common::Result::OK | if the entry was saved, |
Common::Result::FAIL_UNKNOWN | otherwise. |
Implements HF::Core::Scheduling::IEntries< _Type >.
Definition at line 555 of file scheduling.h.
References HF::Core::Scheduling::Entries< _Type >::db, HF::Core::Scheduling::Entries< _Type >::exists(), HF::Common::FAIL_ARG, HF::Core::Scheduling::Entry< _Type >::id, and HF::Common::OK.
Referenced by HF::Core::Scheduling::Entries< _Type >::save().
|
inline |
Store the given entry
to persistent storage.
[in] | id | entry's ID. |
[in] | status | entry's status. |
[in] | time | entry's time. |
[in] | pid | entry's PID. |
Common::Result::OK | if the entry was saved, |
Common::Result::FAIL_UNKNOWN | otherwise. |
Definition at line 579 of file scheduling.h.
References HF::Core::Scheduling::Entries< _Type >::save().
|
inlinevirtual |
Return the number of entries in the container.
Implements HF::Common::IEntries< Entry< _Type > >.
Definition at line 549 of file scheduling.h.
References HF::Core::Scheduling::Entries< _Type >::db.