#include <cstdint>
#include "core/types.h"
Go to the source code of this file.
|
class | Ids::Id |
| This class implements some static helper functions to set high and low 32-bit integers, as well as a function to create a complete id from two of them. More...
|
|
|
namespace | Ids |
| This simple Id pool implements a set of free and used consecutive integers.
|
|
|
#define | ID_32_TYPE(x) |
|
#define | ID_16_TYPE(x) |
|
#define | ID_32_24_8_NAMED_TYPE(x, id32_name, id24_name, id8_name, combined_name) |
|
#define | ID_32_24_8_TYPE(x) |
|
#define | ID_24_8_24_8_NAMED_TYPE(x, id24_0_name, id8_0_name, id24_1_name, id8_1_name, combined0_name, combined1_name) |
|
#define | ID_24_8_24_8_TYPE(x) |
|
#define | ID_24_8_NAMED_TYPE(x, id24_name, id8_name, combined_name) |
|
#define | ID_24_8_TYPE(x) |
|
◆ ID_16_TYPE
Value: struct x { \
constexpr x() : id(
Ids::InvalidId16) {}; \
constexpr x(
const Ids::Id16 id) : id(id) {}; \
constexpr explicit operator Ids::Id16()
const {
return id; } \
constexpr uint32_t HashCode()
const {
return (uint32_t)(
id); } \
const bool operator==(
const x& rhs)
const {
return id == rhs.id; } \
const bool operator!=(
const x& rhs)
const {
return id != rhs.id; } \
const bool operator<(
const x& rhs)
const {
return HashCode() < rhs.HashCode(); } \
const bool operator>(
const x& rhs)
const {
return HashCode() > rhs.HashCode(); } \
template <typename T> constexpr T As() const { static_assert(sizeof(T) == sizeof(x), "Can only convert between ID types of equal size"); T ret; memcpy((void*)&ret, this, sizeof(T)); return ret; }; \
}; \
This simple Id pool implements a set of free and used consecutive integers.
Definition id.h:135
uint16_t Id16
Definition id.h:140
static constexpr Id16 InvalidId16
Definition id.h:145
id
Definition resourceid.h:37
bool operator>(const TiXmlString &a, const TiXmlString &b)
Definition tinystr.h:283
bool operator<(const TiXmlString &a, const TiXmlString &b)
Definition tinystr.h:277
bool operator==(const TiXmlString &a, const TiXmlString &b)
Definition tinystr.h:272
bool operator!=(const TiXmlString &a, const TiXmlString &b)
Definition tinystr.h:282
◆ ID_24_8_24_8_NAMED_TYPE
#define ID_24_8_24_8_NAMED_TYPE |
( |
| x, |
|
|
| id24_0_name, |
|
|
| id8_0_name, |
|
|
| id24_1_name, |
|
|
| id8_1_name, |
|
|
| combined0_name, |
|
|
| combined1_name ) |
◆ ID_24_8_24_8_TYPE
#define ID_24_8_24_8_TYPE |
( |
| x | ) |
|
Value:
#define ID_24_8_24_8_NAMED_TYPE(x, id24_0_name, id8_0_name, id24_1_name, id8_1_name, combined0_name, combined1_name)
Definition id.h:73
◆ ID_24_8_NAMED_TYPE
#define ID_24_8_NAMED_TYPE |
( |
| x, |
|
|
| id24_name, |
|
|
| id8_name, |
|
|
| combined_name ) |
Value: struct x { \
union \
{\
struct\
{\
};\
}; \
constexpr x(
const Ids::Id24 id0,
const Ids::Id8 id1) : id24_name(id0), id8_name(id1) {} \
constexpr x(
const Ids::Id32 id) : combined_name(
id) {};\
explicit constexpr operator Ids::Id32()
const {
return combined_name; }\
constexpr uint32_t HashCode() const { return (uint32_t)combined_name; }\
const bool operator==(
const x& rhs)
const {
return id24_name == rhs.id24_name && id8_name == rhs.id8_name; }\
const bool operator!=(
const x& rhs)
const {
return id24_name != rhs.id24_name || id8_name != rhs.id8_name; }\
const bool operator<(
const x& rhs)
const {
return HashCode() < rhs.HashCode(); }\
const bool operator>(
const x& rhs)
const {
return HashCode() > rhs.HashCode(); }\
template <typename T> constexpr T As() const { static_assert(sizeof(T) == sizeof(x), "Can only convert between ID types of equal size"); T ret; memcpy((void*)&ret, this, sizeof(T)); return ret; }; \
}; \
static constexpr Id24 InvalidId24
Definition id.h:144
static constexpr Id8 InvalidId8
Definition id.h:146
uint32_t Id24
Definition id.h:139
uint8_t Id8
Definition id.h:141
uint32_t Id32
Definition id.h:138
static constexpr Id32 InvalidId32
Definition id.h:143
static constexpr Id32 MakeId24_8(const Id24 big, const Id8 tiny)
set 24-8 bits in integer
Definition id.h:280
◆ ID_24_8_TYPE
#define ID_24_8_TYPE |
( |
| x | ) |
|
Value:
#define ID_24_8_NAMED_TYPE(x, id24_name, id8_name, combined_name)
Definition id.h:109
◆ ID_32_24_8_NAMED_TYPE
#define ID_32_24_8_NAMED_TYPE |
( |
| x, |
|
|
| id32_name, |
|
|
| id24_name, |
|
|
| id8_name, |
|
|
| combined_name ) |
Value: struct x { \
union\
{\
struct\
{\
};\
};\
constexpr uint32_t HashCode() const { return (uint32_t)combined_name; }\
const bool operator==(
const x& rhs)
const {
return id32_name == rhs.id32_name && id24_name == rhs.id24_name && id8_name == rhs.id8_name; }\
const bool operator!=(
const x& rhs)
const {
return id32_name != rhs.id32_name || id24_name != rhs.id24_name || id8_name != rhs.id8_name; }\
const bool operator<(
const x& rhs)
const {
return HashCode64() < rhs.HashCode64(); }\
const bool operator>(
const x& rhs)
const {
return HashCode64() > rhs.HashCode64(); }\
template <typename T> constexpr T As() const { static_assert(sizeof(T) == sizeof(x), "Can only convert between ID types of equal size"); T ret; memcpy((void*)&ret, this, sizeof(T)); return ret; }; \
}; \
uint64_t Id64
Definition id.h:137
U32 Id
Definition im3d.h:37
static constexpr Id64 MakeId32_24_8(const Id32 upper, const Id24 big, const Id8 tiny)
set 32-24-8 bits 64 bit integer
Definition id.h:289
◆ ID_32_24_8_TYPE
#define ID_32_24_8_TYPE |
( |
| x | ) |
|
Value:
#define ID_32_24_8_NAMED_TYPE(x, id32_name, id24_name, id8_name, combined_name)
Definition id.h:46
◆ ID_32_TYPE
Value: struct x { \
constexpr x() : id(
Ids::InvalidId32) {}; \
constexpr x(
const Ids::Id32 id) : id(id) {}; \
constexpr explicit operator Ids::Id32()
const {
return id; } \
constexpr uint32_t HashCode()
const {
return id; } \
const bool operator==(
const x& rhs)
const {
return id == rhs.id; } \
const bool operator!=(
const x& rhs)
const {
return id != rhs.id; } \
const bool operator<(
const x& rhs)
const {
return HashCode() < rhs.HashCode(); } \
const bool operator>(
const x& rhs)
const {
return HashCode() > rhs.HashCode(); } \
template <typename T> constexpr T As() const { static_assert(sizeof(T) == sizeof(x), "Can only convert between ID types of equal size"); T ret; memcpy((void*)&ret, this, sizeof(T)); return ret; }; \
}; \