|
Yate
|
Atomic access and operations to shared variables. More...
#include <yatengine.h>
Public Member Functions | |
| SharedVars (const char *name=0) | |
| 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) |
| void | clearAll () |
| bool | exists (const String &name) |
| uint64_t | inc (const String &name, uint64_t wrap=0) |
| uint64_t | dec (const String &name, uint64_t wrap=0) |
| uint64_t | add (const String &name, uint64_t val, uint64_t wrap=0) |
| uint64_t | sub (const String &name, uint64_t val, uint64_t wrap=0) |
| void | copy (NamedList &dest, const String &prefix=String::empty(), bool skipPrefix=true, bool replace=false) |
| virtual const String & | toString () const |
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 |
| virtual Mutex * | lockableMutex () |
Public Member Functions inherited from Lockable | |
| virtual | ~Lockable () |
| virtual bool | check (long maxwait=-1) |
| virtual bool | unlockAll () |
| virtual Semaphore * | lockableSemaphore () |
| virtual RWLock * | lockableRWLock () |
Public Member Functions inherited from RefObject | |
| RefObject () | |
| virtual | ~RefObject () |
| virtual void * | getObject (const String &name) const |
| virtual bool | alive () const |
| bool | ref () |
| bool | deref () |
| int | refcount () const |
| virtual void | destruct () |
Public Member Functions inherited from GenObject | |
| GenObject () | |
| virtual | ~GenObject () |
| virtual const String & | traceId () const |
| NamedCounter * | getObjCounter () const |
| NamedCounter * | setObjCounter (NamedCounter *counter) |
Static Public Member Functions | |
| static bool | getList (RefPointer< SharedVars > &dest, const String &name) |
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 () |
Static Public Member Functions inherited from RefObject | |
| static bool | alive (const RefObject *obj) |
| static bool | efficientIncDec () |
Static Public Member Functions inherited from GenObject | |
| static void * | getObject (const String &name, const GenObject *obj) |
| static bool | getObjCounting () |
| static void | setObjCounting (bool enable) |
| static NamedCounter * | getObjCounter (const String &name, bool create=true) |
| static ObjList & | getObjCounters () |
Additional Inherited Members | |
Protected Member Functions inherited from RefObject | |
| virtual void | zeroRefs () |
| bool | resurrect () |
| virtual void | destroyed () |
Atomic access and operations to shared variables.
Class that implements atomic / locked access and operations to its shared variables
|
inline |
Constructor
| name | Optional name |
| uint64_t add | ( | const String & | name, |
| uint64_t | val, | ||
| uint64_t | wrap = 0 ) |
Atomically add a value to a variable as unsigned integer
| name | Name of the variable |
| val | Value to add |
| wrap | Value to wrap around at, zero disables |
| void clear | ( | const String & | name | ) |
Clear a variable
| name | Name of the variable to clear |
| void clearAll | ( | ) |
Clear all variables. Does nothing for Engine (global shared list)
|
inline |
Atomically copy parameters to destination
| dest | Destination list |
| prefix | Optional prefix to match in parameter names |
| skipPrefix | Skip over the prefix when building new parameter name |
| replace | Set to true to replace list parameter instead of adding a new one |
References NamedList::copyParams(), and NamedList::copySubParams().
| 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 |
| uint64_t dec | ( | const String & | name, |
| uint64_t | 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 |
|
static |
Retrieve a named list of SharedVars. Create it if not found
| dest | Destination to be filled with requested list |
| name | Name of the list |
| uint64_t inc | ( | const String & | name, |
| uint64_t | 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 |
| uint64_t sub | ( | const String & | name, |
| uint64_t | val, | ||
| uint64_t | wrap = 0 ) |
Atomically substract a value from a variable as unsigned integer
| name | Name of the variable |
| val | Value to substract |
| wrap | Value to wrap around at, zero disables |
|
inlinevirtual |