Program Listing for File dataHandle.h
↰ Return to documentation for file (PrismEngine/src/dataHandle.h)
#pragma once
#include <cstdint>
namespace prism {
namespace scene {
constexpr uint32_t INVALID_DATA_HANDLE = UINT32_MAX;
template<typename DataType_, typename TagType_>
struct DataHandle {
uint32_t id = INVALID_DATA_HANDLE;
using DataType = DataType_;
using TagType = TagType_;
DataHandle() = default;
explicit DataHandle(uint32_t i) : id(i) {}
bool isValid() const { return id != INVALID_DATA_HANDLE; }
explicit operator bool() const { return isValid(); }
static DataHandle invalid() {
return DataHandle<DataType, TagType>(INVALID_DATA_HANDLE);
}
bool operator==(const DataHandle& other) const { return id == other.id; }
bool operator!=(const DataHandle& other) const { return id != other.id; }
};
}
}