types#

namespace heph
namespace types#

Enums

enum class ExternalDummyEnum : int8_t#

Values:

enumerator A#
enumerator B#
enumerator C#
enumerator D#
enumerator E#
enumerator F#
enumerator G#
struct DummyPrimitivesType#
#include “hephaestus/types/dummy_type.h”

Collection of primitive types for testing purposes. NOTE: the data needs to be Protobuf serializable NOTE: missing primitive types shall be added at any time to increase the test coverage.

Public Members

bool dummy_bool = {}#
int8_t dummy_int8_t = {}#
int16_t dummy_int16_t = {}#
int32_t dummy_int32_t = {}#
int64_t dummy_int64_t = {}#
uint8_t dummy_uint8_t = {}#
uint16_t dummy_uint16_t = {}#
uint32_t dummy_uint32_t = {}#
uint64_t dummy_uint64_t = {}#
float dummy_float = {}#
double dummy_double = {}#

Public Functions

bool=default operator== (const DummyPrimitivesType &) const

Public Static Functions

static DummyPrimitivesType random(std::mt19937_64 &mt)#
struct DummyType#
#include “hephaestus/types/dummy_type.h”

Collection of non-primitive types for testing purposes. NOTE: the data needs to be Protobuf serializable NOTE: missing generic non-primitive types can be added to increase the test coverage.

Public Types

enum class InternalDummyEnum : int8_t#

Values:

enumerator ALPHA#

Public Members

DummyPrimitivesType dummy_primitives_type = {}#
InternalDummyEnum internal_dummy_enum = {}#
ExternalDummyEnum external_dummy_enum = {}#
std::string dummy_string#
std::vector<int32_t> dummy_vector#
std::vector<DummyPrimitivesType> dummy_vector_encapsulated#
std::array<int32_t, DUMMY_ARRAY_SIZE> dummy_array#
std::array<DummyPrimitivesType, DUMMY_ARRAY_SIZE> dummy_array_encapsulated#
std::unordered_map<std::size_t, int32_t> dummy_umap#
std::unordered_map<std::size_t, DummyPrimitivesType> dummy_umap_encapsulated#

Public Functions

bool=default operator== (const DummyType &) const

Public Static Attributes

static std::size_t DUMMY_ARRAY_SIZE = 3#

Public Static Functions

static DummyType random(std::mt19937_64 &mt)#
namespace heph
namespace types

Enums

enum class BoundsType : uint8_t#

Values:

enumerator INCLUSIVE#
enumerator LEFT_OPEN#
enumerator RIGHT_OPEN#
enumerator OPEN#

Functions

template<NumericType T>
static bool isWithinBounds(T value, const Bounds<T> &bounds)#
template<NumericType T>
static T clampValue(T value, const Bounds<T> &bounds)#
template<NumericType T>
std::ostream &operator<<(std::ostream &os, const Bounds<T> &bounds)#
template<NumericType T>
bool isWithinBounds(T value, const Bounds<T> &bounds)
template<NumericType T>
T clampValue(T value, const Bounds<T> &bounds)
template<NumericType T>
struct Bounds#
#include “hephaestus/types/bounds.h”

A class representing range bounds.

Public Members

T lower = {}#
T upper = {}#
BoundsType type = {BoundsType::INCLUSIVE}#

Public Functions

bool=default operator== (const Bounds &) const
std::string format() const#

Public Static Functions

static Bounds random(std::mt19937_64 &mt)#
namespace fmt
template<heph::NumericType T>
struct formatter<heph::types::Bounds<T>> : public ostream_formatter#
namespace heph
namespace types

Functions

template<class H>
H AbslHashValue(H h, const UuidV4 &id)#
struct UuidV4#
#include “hephaestus/types/uuid_v4.h”

A class representing a UUID (Universally Unique Identifier) version 4, which is purely (pseudo) randomly generated. We follow RFC 9562, which defines the UUIDv4 format. For details, see https://www.rfc-editor.org/rfc/rfc9562.html. To use a UuidV4 as a key in a hash map, we provide a custom hash function using the Abseil library’s AbslHashValue. Include <absl/hash/hash.h> in the implementation file and provide a custom hash function to the container, e.g. std::unordered_map<heph::types::UuidV4, DataT, absl::Hash<heph::types::UuidV4>>.

Public Members

uint64_t high = {0ULL}#

High 64 bits of the 128 bit UUID.

uint64_t low = {0ULL}#

Low 64 bits of the 128 bit UUID.

Public Functions

bool=default operator== (const UuidV4 &) const

Default comparison operator. We avoid using the spaceship operator (<=>) as random UUIDs (version 4) are not ordered.

bool isValid() const#

Checks if the UUID is valid. A valid UUIDv4 must neither be Nil nor Max, and it must conform to the UUIDv4 format as defined in RFC 9562.

std::string format() const#

Public Static Functions

static UuidV4 random(std::mt19937_64 &mt)#

Generates a random valid UUIDv4 using the provided random number generator.

static UuidV4 create()#

Creates a UUIDv4 using an internal static random number generator.

static UuidV4 createNil()#

Creates a UUIDv4 with all bits set to zero, 00000000-0000-0000-0000-000000000000. A Nil UUID value can be useful to communicate the absence of any other UUID value in situations that otherwise require or use a 128-bit UUID. A Nil UUID can express the concept “no such value here”. Thus, it is reserved for such use as needed for implementation-specific situations.

static UuidV4 createMax()#

Creates a UUIDv4 with all bits set to one, FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF. A Max UUID value can be used as a sentinel value in situations where a 128-bit UUID is required, but a concept such as “end of UUID list” needs to be expressed and is reserved for such use as needed for implementation-specific situations.