Repository navigation
token
Dmitry Koplyarov edited this page Feb 29, 2016
·
14 revisions
class token
{
public:
struct implementation
{
virtual void release_token_impl() = 0;
virtual ~implementation() { }
};
public:
token(token&& other);
~token();
token(const token&) = delete;
token& operator = (const token&) = delete;
template < typename Implementation_, typename... Args_ >
static token create(Args_&&... args);
void reset();
};A RAII class for managing generic resource ownership. Used for holding signal connections in wigwag library.
You can also use it in your code for managing various listeners (e.g. logger sinks) registration/unregistration.
struct implementation
{
virtual void release_token_impl() = 0;
virtual ~implementation() { }
};A base class that manages a resource ownership via release_token_impl method.
token(token&& other);Just an ordinary move constructor. Nothing special.
token(const token&) = delete;The copy constructor is prohibited.
~token();Resets a token object if it hasn't been reset before.
Releases the associated resource (e.g. signal connection).
template < typename Implementation_, typename... Args_ >
static token create (Args_&&... args);Creates a token object.
Template arguments:
- Implementation_ - an implementation subclass
- Args_... - variadic arguments types
Arguments:
- args... - forwarded to the Implementation_ class constructor
void reset();Resets a token object if it hasn't been reset before.
Releases the associated resource (e.g. signal connection).