Nebula
Loading...
Searching...
No Matches
idallocator.h File Reference
#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.

Classes

class  Ids::IdAllocator< TYPES >
 An ID allocator associates an id with a slice in an N number of arrays. More...
 
class  Ids::IdAllocatorSafe< MAX_ALLOCS, TYPES >
 

Namespaces

namespace  Ids
 This simple Id pool implements a set of free and used consecutive integers.
 

Macros

#define _DECL_ACQUIRE_RELEASE(ty)
 
#define _IMPL_ACQUIRE_RELEASE(ty, allocator)
 

Macro Definition Documentation

◆ _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); }