#include <EventCounter.h>
|
| EventCounter () |
| Default constructor.
|
|
| ~EventCounter () |
| Destructor.
|
|
void | create (unsigned int initval, bool countdown=false, bool blocking=false) |
| Creates the object annex file descriptor. Setting the initial value with 'initval'. When countdown is true the get() function will countdown the counter one by one and the return value is each time 0.
|
|
void | destroy () |
| Destroys the object/file descriptor.
|
|
handle_type | getHandle () const |
|
void | set (unsigned int increment=1) |
| Sets a new value by incrementing the existing one.
|
|
bool | get (unsigned int &value) const |
| Gets the counter value and decrements it. Returns true when it would block when blocking is disabled. When counting down was enabled the returned value is always 1 until the internal counter is zero. When not counting down the returned argument value is the counter value and the internal counter is reset to zero.
|
|
unsigned | get () const |
| Same as above but when the would block it return 0 otherwise the value is returned as described in the get() method.
|
|
TEventSemaphore class is build around the system call eventfd(). This class has a file descriptor which could be used in an epoll object.
◆ handle_type
◆ EventCounter()
sf::EventCounter::EventCounter |
( |
| ) |
|
◆ ~EventCounter()
sf::EventCounter::~EventCounter |
( |
| ) |
|
◆ create()
void sf::EventCounter::create |
( |
unsigned int |
initval, |
|
|
bool |
countdown = false , |
|
|
bool |
blocking = false |
|
) |
| |
Creates the object annex file descriptor. Setting the initial value with 'initval'. When countdown is true the get() function will countdown the counter one by one and the return value is each time 0.
◆ destroy()
void sf::EventCounter::destroy |
( |
| ) |
|
Destroys the object/file descriptor.
◆ get() [1/2]
unsigned int sf::EventCounter::get |
( |
| ) |
const |
|
inline |
Same as above but when the would block it return 0 otherwise the value is returned as described in the get() method.
◆ get() [2/2]
bool sf::EventCounter::get |
( |
unsigned int & |
value | ) |
const |
Gets the counter value and decrements it. Returns true when it would block when blocking is disabled. When counting down was enabled the returned value is always 1 until the internal counter is zero. When not counting down the returned argument value is the counter value and the internal counter is reset to zero.
◆ getHandle()
Returns the file descriptor to the object.
◆ set()
void sf::EventCounter::set |
( |
unsigned int |
increment = 1 | ) |
|
Sets a new value by incrementing the existing one.
- Returns
- On failure to do so it returns false.
The documentation for this class was generated from the following file: