# class SharedVars | Atomic access and operations to shared variables. More...
Full name | `TelEngine::SharedVars`
Definition | `#include <yatengine.h>`
Inherits | TelEngine::Mutex [public ]
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

#### Public Methods

- inline 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)

## Detailed Description

Class that implements atomic / locked access and operations to its shared variables

inline SharedVars () | ### SharedVars

Constructor

void get (const String& name, String& rval) | ### get

Get the string value of a variable

Parameters:

name | Name of the variable
rval | String to return the value into

void set (const String& name, const char* val) | ### set

Set the string value of a variable

Parameters:

name | Name of the variable to set
val | New value to assign to a variable

bool create (const String& name, const char* val = 0) | ### create

Create and set a variable only if the variable is not already set

Parameters:

name | Name of the variable to set
val | New value to assign to a variable

Returns: True if a new variable was created

void clear (const String& name) | ### clear

Clear a variable

Parameters:

name | Name of the variable to clear

bool exists (const String& name) | ### exists

Check if a variable exists

Parameters:

name | Name of the variable

Returns: True if the variable exists

unsigned int inc (const String& name, unsigned int wrap = 0) | ### inc

Atomically increment a variable as unsigned integer

Parameters:

name | Name of the variable
wrap | Value to wrap around at, zero disables

Returns: Value of the variable before increment, zero if it was not defined or not numeric

unsigned int dec (const String& name, unsigned int wrap = 0) | ### dec

Atomically decrement a variable as unsigned integer

Parameters:

name | Name of the variable
wrap | Value to wrap around at, zero disables (stucks at zero)

Returns: Value of the variable after decrement, zero if it was not defined or not numeric

Generated by: paulc on bussard on Fri Dec 21 16:28:34 2012, using kdoc 2.0a54.