DEKI/ENGINE docs
Deki 0.19.0
Modular C++ 2D engine for embedded displays and desktop
Loading...
Searching...
No Matches

#include <deki/Object.h>

Public Member Functions

 Object ()
 Object (const std::string &objectName)
 Object (const Object &)=delete
 Not copyable: an Object owns its children and components by raw pointer, so a copy would double-free them, and the editor-only side table is keyed by this, which a copy would share.
Object & operator= (const Object &)=delete
 ~Object ()
 Must stay out of line: it erases this object's row from the editor-only side table in Object.cpp.
uint32_t GetId () const
void SetId (uint32_t newId)
const std::string & GetName () const
void SetName (const std::string &newName)
bool IsActive () const
void SetActive (bool value)
bool IsEditorOnly () const
void SetEditorOnly (bool value)
bool IsPersistent () const
void SetPersistent (bool value)
void SetOwnerScene (Scene *scene)
Scene * GetOwnerScene () const
bool IsSceneInstance () const
bool IsPartOfInstance () const
void SetPartOfInstance (bool value)
const std::string & GetSourceSceneGuid () const
 Empty when this object is not a scene instance.
void SetSourceSceneGuid (const std::string &guid)
const std::string & GetInstanceOverridesJson () const
void SetInstanceOverridesJson (const std::string &json)
void AddChild (Object *child)
void RemoveChild (Object *child)
void SetParent (Object *newParent)
Object * GetParent () const
const std::vector< Object * > & GetChildren () const
Object * FindChild (uint32_t childId)
Object * FindChildByName (const std::string &name)
void RemoveFromParent ()
bool IsDescendantOf (Object *ancestor) const
void InsertChildAt (Object *child, size_t index)
int GetChildIndex (Object *child) const
bool IsActiveInHierarchy () const
 True when this object and all its ancestors are active.
void MarkWorldTransformDirty ()
template<typename T, typename... Args>
T * AddComponent (Args &&... args)
template<typename T>
T * GetComponent ()
 The first component of type T or of a class directly derived from T.
template<typename T>
const T * GetComponent () const
Component * GetComponentByTypeId (uint32_t typeId)
 The first component whose type id is exactly typeId.
const Component * GetComponentByTypeId (uint32_t typeId) const
template<typename T>
std::vector< T * > GetComponents ()
 Every component of type T or of a class directly derived from T.
template<typename T>
bool HasComponent () const
 True when a component of type T or a class directly derived from T is attached.
template<typename T>
void RemoveComponent ()
void RemoveComponent (Component *comp)
 Removes and deletes comp.
const std::vector< Component * > & GetComponents () const
template<typename T>
T * FindInterface ()
 The first component that implements interface T, found through the ComponentInterfaceAdapters registry (no RTTI).

Static Public Member Functions

static uint32_t GenerateId ()
static uint32_t GenerateDeterministicId (uint32_t seed1, uint32_t seed2)

Friends

void Internal::AttachComponent (Object &object, Component *component)
Component * Internal::AddComponentByName (Object &object, const std::string &typeName)
int Internal::DetachComponent (Object &object, Component *component)
void Internal::ReattachComponent (Object &object, Component *component, size_t index)

Constructor & Destructor Documentation

◆ Object() [1/3]

Deki::Object::Object ( )

◆ Object() [2/3]

Deki::Object::Object ( const std::string & objectName)

◆ Object() [3/3]

Deki::Object::Object ( const Object & )
delete

Not copyable: an Object owns its children and components by raw pointer, so a copy would double-free them, and the editor-only side table is keyed by this, which a copy would share.

◆ ~Object()

Deki::Object::~Object ( )

Must stay out of line: it erases this object's row from the editor-only side table in Object.cpp.

Defining it = default here would make the class layout depend on DEKI_EDITOR again.

Member Function Documentation

◆ operator=()

Object & Deki::Object::operator= ( const Object & )
delete

◆ GetId()

uint32_t Deki::Object::GetId ( ) const
inline

◆ SetId()

void Deki::Object::SetId ( uint32_t newId)

◆ GenerateId()

uint32_t Deki::Object::GenerateId ( )
inlinestatic

◆ GenerateDeterministicId()

uint32_t Deki::Object::GenerateDeterministicId ( uint32_t seed1,
uint32_t seed2 )
inlinestatic

◆ GetName()

const std::string & Deki::Object::GetName ( ) const
inline

◆ SetName()

void Deki::Object::SetName ( const std::string & newName)
inline

◆ IsActive()

bool Deki::Object::IsActive ( ) const
inline

◆ SetActive()

void Deki::Object::SetActive ( bool value)
inline

◆ IsEditorOnly()

bool Deki::Object::IsEditorOnly ( ) const
inline

◆ SetEditorOnly()

void Deki::Object::SetEditorOnly ( bool value)
inline

◆ IsPersistent()

bool Deki::Object::IsPersistent ( ) const
inline

◆ SetPersistent()

void Deki::Object::SetPersistent ( bool value)
inline

◆ SetOwnerScene()

void Deki::Object::SetOwnerScene ( Scene * scene)
inline

◆ GetOwnerScene()

Scene * Deki::Object::GetOwnerScene ( ) const
inline

◆ IsSceneInstance()

bool Deki::Object::IsSceneInstance ( ) const
inline

◆ IsPartOfInstance()

bool Deki::Object::IsPartOfInstance ( ) const
inline

◆ SetPartOfInstance()

void Deki::Object::SetPartOfInstance ( bool value)
inline

◆ GetSourceSceneGuid()

const std::string & Deki::Object::GetSourceSceneGuid ( ) const

Empty when this object is not a scene instance.

The reference is valid until the next SetSourceSceneGuid on this object, or its destruction.

◆ SetSourceSceneGuid()

void Deki::Object::SetSourceSceneGuid ( const std::string & guid)

◆ GetInstanceOverridesJson()

const std::string & Deki::Object::GetInstanceOverridesJson ( ) const

◆ SetInstanceOverridesJson()

void Deki::Object::SetInstanceOverridesJson ( const std::string & json)

◆ AddChild()

void Deki::Object::AddChild ( Object * child)

◆ RemoveChild()

void Deki::Object::RemoveChild ( Object * child)

◆ SetParent()

void Deki::Object::SetParent ( Object * newParent)

◆ GetParent()

Object * Deki::Object::GetParent ( ) const
inline

◆ GetChildren()

const std::vector< Object * > & Deki::Object::GetChildren ( ) const
inline

◆ FindChild()

Object * Deki::Object::FindChild ( uint32_t childId)

◆ FindChildByName()

Object * Deki::Object::FindChildByName ( const std::string & name)

◆ RemoveFromParent()

void Deki::Object::RemoveFromParent ( )

◆ IsDescendantOf()

bool Deki::Object::IsDescendantOf ( Object * ancestor) const

◆ InsertChildAt()

void Deki::Object::InsertChildAt ( Object * child,
size_t index )

◆ GetChildIndex()

int Deki::Object::GetChildIndex ( Object * child) const

◆ IsActiveInHierarchy()

bool Deki::Object::IsActiveInHierarchy ( ) const

True when this object and all its ancestors are active.

◆ MarkWorldTransformDirty()

void Deki::Object::MarkWorldTransformDirty ( )
inline

◆ AddComponent()

template<typename T, typename... Args>
T * Deki::Object::AddComponent ( Args &&... args)
inline

◆ GetComponent() [1/2]

template<typename T>
T * Deki::Object::GetComponent ( )
inline

The first component of type T or of a class directly derived from T.

For example, GetComponent<SetupComponent>() returns an SDCardComponent that derives from SetupComponent.

◆ GetComponent() [2/2]

template<typename T>
const T * Deki::Object::GetComponent ( ) const
inline

◆ GetComponentByTypeId() [1/2]

Component * Deki::Object::GetComponentByTypeId ( uint32_t typeId)
inline

The first component whose type id is exactly typeId.

◆ GetComponentByTypeId() [2/2]

const Component * Deki::Object::GetComponentByTypeId ( uint32_t typeId) const
inline

◆ GetComponents() [1/2]

template<typename T>
std::vector< T * > Deki::Object::GetComponents ( )
inline

Every component of type T or of a class directly derived from T.

◆ HasComponent()

template<typename T>
bool Deki::Object::HasComponent ( ) const
inline

True when a component of type T or a class directly derived from T is attached.

◆ RemoveComponent() [1/2]

template<typename T>
void Deki::Object::RemoveComponent ( )
inline

◆ RemoveComponent() [2/2]

void Deki::Object::RemoveComponent ( Component * comp)
inline

Removes and deletes comp.

◆ GetComponents() [2/2]

const std::vector< Component * > & Deki::Object::GetComponents ( ) const
inline

◆ FindInterface()

template<typename T>
T * Deki::Object::FindInterface ( )
inline

The first component that implements interface T, found through the ComponentInterfaceAdapters registry (no RTTI).

T must have a static constexpr uint32_t kInterfaceID member.

◆ Internal::AttachComponent

void Internal::AttachComponent ( Object & object,
Component * component )
friend

◆ Internal::AddComponentByName

Component * Internal::AddComponentByName ( Object & object,
const std::string & typeName )
friend

◆ Internal::DetachComponent

int Internal::DetachComponent ( Object & object,
Component * component )
friend

◆ Internal::ReattachComponent

void Internal::ReattachComponent ( Object & object,
Component * component,
size_t index )
friend

The documentation for this class was generated from the following file: