Yate
|
Atomic access and operations to shared variables. More...
#include <yatengine.h>
Public Member Functions | |
SharedVars () | |
void | get (const String &name, String &rval) |
void | set (const String &name, const char *val) |
bool | create (const String &name, const char *val=0) |
void | clear (const String &name) |
bool | exists (const String &name) |
unsigned int | inc (const String &name, unsigned int wrap=0) |
unsigned int | dec (const String &name, unsigned int wrap=0) |
Public Member Functions inherited from Mutex | |
Mutex (bool recursive=false, const char *name=0) | |
Mutex (const Mutex &original) | |
~Mutex () | |
Mutex & | operator= (const Mutex &original) |
virtual bool | lock (long maxwait=-1) |
virtual bool | unlock () |
virtual bool | locked () const |
const char * | owner () const |
bool | recursive () const |
Public Member Functions inherited from Lockable | |
virtual | ~Lockable () |
virtual bool | check (long maxwait=-1) |
virtual bool | unlockAll () |
Additional Inherited Members | |
Static Public Member Functions inherited from Mutex | |
static int | count () |
static int | locks () |
static bool | efficientTimedLock () |
Static Public Member Functions inherited from Lockable | |
static void | wait (unsigned long maxwait) |
static unsigned long | wait () |
static void | startUsingNow () |
static void | enableSafety (bool safe=true) |
static bool | safety () |
Atomic access and operations to shared variables.
Class that implements atomic / locked access and operations to its shared variables
|
inline |
Constructor
void clear | ( | const String & | name | ) |
Clear a variable
name | Name of the variable to clear |
bool create | ( | const String & | name, |
const char * | val = 0 |
||
) |
Create and set a variable only if the variable is not already set
name | Name of the variable to set |
val | New value to assign to a variable |
unsigned int dec | ( | const String & | name, |
unsigned int | wrap = 0 |
||
) |
Atomically decrement a variable as unsigned integer
name | Name of the variable |
wrap | Value to wrap around at, zero disables (stucks at zero) |
bool exists | ( | const String & | name | ) |
Check if a variable exists
name | Name of the variable |
Get the string value of a variable
name | Name of the variable |
rval | String to return the value into |
unsigned int inc | ( | const String & | name, |
unsigned int | wrap = 0 |
||
) |
Atomically increment a variable as unsigned integer
name | Name of the variable |
wrap | Value to wrap around at, zero disables |
void set | ( | const String & | name, |
const char * | val | ||
) |
Set the string value of a variable
name | Name of the variable to set |
val | New value to assign to a variable |