#include "id.h"
#include "idpool.h"
#include "util/array.h"
#include "threading/criticalsection.h"
#include <tuple>
#include <utility>
#include "util/tupleutility.h"
#include "util/arrayallocator.h"
#include "util/arrayallocatorsafe.h"
Go to the source code of this file.
|
namespace | Ids |
| This simple Id pool implements a set of free and used consecutive integers.
|
|
◆ _DECL_ACQUIRE_RELEASE
#define _DECL_ACQUIRE_RELEASE |
( |
| ty | ) |
|
Value: bool ty##Acquire(const ty id); \
void ty##Release(const ty id); \
struct ty##Lock \
{ \
ty##Lock(const ty element) : element(element) { this->didAcquire = ty##Acquire(this->element); } \
~ty##Lock() { if (this->didAcquire) ty##Release(this->element); } \
private: \
bool didAcquire; \
ty element; \
};
◆ _IMPL_ACQUIRE_RELEASE
#define _IMPL_ACQUIRE_RELEASE |
( |
| ty, |
|
|
| allocator ) |
Value: bool ty##Acquire(const ty id) { return allocator.Acquire(id.id); } \
void ty##Release(const ty id) { allocator.Release(id.id); }