Brunot
Loading...
Searching...
No Matches
GameObject::Key Class Reference

a Key class to be used as a key when holding GameObjects (or unique pointers to game objects) in <key, value> datasets More...

#include <GameObject.h>

Public Member Functions

 Key (gobj::UUID uuid, gobj::Type type, unsigned short subtype)
auto getUUID () const -> gobj::UUID
auto getType () const -> gobj::Type
auto getSubtype () const -> unsigned short

Private Attributes

gobj::UUID uuid
 the UUID of the GameObject the Key was generated from
gobj::Type type
 the type of the GameObject the Key was generated from
unsigned short subtype

Friends

auto operator< (const Key &lhs, const Key &rhs) ->bool
 comparison for GameObject Keys, to allow them to be used as keys in <key, value> containers.

Detailed Description

a Key class to be used as a key when holding GameObjects (or unique pointers to game objects) in <key, value> datasets

Constructor & Destructor Documentation

◆ Key()

GameObject::Key::Key ( gobj::UUID uuid,
gobj::Type type,
unsigned short subtype )

Member Function Documentation

◆ getSubtype()

auto GameObject::Key::getSubtype ( ) const->unsignedshort

◆ getType()

auto GameObject::Key::getType ( ) const->gobj::Type

◆ getUUID()

auto GameObject::Key::getUUID ( ) const->gobj::UUID

◆ operator<

auto operator< ( const Key & lhs,
const Key & rhs )->bool
friend

comparison for GameObject Keys, to allow them to be used as keys in <key, value> containers.

Less than means that the type, and subtype (if applicable) comes before the others type and subtype in the type and subtype enums. In the cases where type and subtype are equal, then UUID is used for comparison, and the object with the lower UUID (created first) is treated as lower.

Parameters
lhs
rhs
Returns
whether the lhs is "less" than rhs

@todo: turn this into a non branching comparison @todo: check this logic on same subtype but different types of objects (may not be necessary as we only store one type in a container /e usually )

Member Data Documentation

◆ subtype

unsigned short GameObject::Key::subtype
private

◆ type

gobj::Type GameObject::Key::type
private

the type of the GameObject the Key was generated from

◆ uuid

gobj::UUID GameObject::Key::uuid
private

the UUID of the GameObject the Key was generated from


The documentation for this class was generated from the following files:
  • /home/egrazil/sites/Brunot/The House/source/Framework/GameObject.h
  • /home/egrazil/sites/Brunot/The House/source/Framework/GameObject.cpp