A class to manage Pandora skips.
More...
#include <pandorastation.h>
|
| | SkipTracker (int limit, int interv) |
| | Construct a skip tracker. More...
|
| |
| bool | canSkip (time_t *when) |
| | Check if (and when) a skip is available. More...
|
| |
| bool | skip (time_t *when=nullptr) |
| | Check if a skip is available, and record one if it is. More...
|
| |
| void | setLimit (int limit) |
| |
|
| void | purge () |
| | Remove expired skips from the front of the list. More...
|
| |
A class to manage Pandora skips.
◆ SkipTracker()
| Pandora::SkipTracker::SkipTracker |
( |
int |
limit, |
|
|
int |
interv |
|
) |
| |
Construct a skip tracker.
The tracker is a simple linked list.
When a skip occurs, the time of its expiration is added to the list. When checks are done, the front time is checked; if that time is past, it is removed. Skips are allowed when the size of the list is below the skip limit.
- Parameters
-
| limit | The number of skips to allow. |
| interv | The duration over which the limit applies. |
◆ canSkip()
| bool Pandora::SkipTracker::canSkip |
( |
time_t * |
when | ) |
|
Check if (and when) a skip is available.
- Parameters
-
| when | If non-null, is set on return to the time at which the next skip is allowed. |
- Returns
- True if a skip is allowed, false otherwise.
◆ purge()
| void Pandora::SkipTracker::purge |
( |
void |
| ) |
|
|
inlineprivate |
Remove expired skips from the front of the list.
◆ setLimit()
| void Pandora::SkipTracker::setLimit |
( |
int |
limit | ) |
|
|
inline |
◆ skip()
| bool Pandora::SkipTracker::skip |
( |
time_t * |
when = nullptr | ) |
|
Check if a skip is available, and record one if it is.
- Parameters
-
| when | If non-null, is set on return to the time at which the next skip is allowed. |
- Returns
- True if a skip happened, false if it was not allowed.
◆ interval
| time_t Pandora::SkipTracker::interval |
|
private |
The duration over which the limit applies.
◆ skip_limit
| size_t Pandora::SkipTracker::skip_limit |
|
private |
The limit on the number of skips.
The documentation for this class was generated from the following files: