NAP
Public Member Functions | Static Public Member Functions | List of all members
ComponentPtrBase Class Referenceabstract

#include <componentptr.h>

Public Member Functions

virtual ~ComponentPtrBase ()=default
 
virtual std::string toString () const =0
 
virtual ComponenttoObject () const =0
 
virtual void assign (const std::string &targetPath, rtti::Object *targetObject)=0
 

Static Public Member Functions

static std::string translateTargetID (const std::string &targetID)
 

Description

This class serves as the base for typed ComponentPtrs and is only here so that we can check whether a pointer is a ComponentPtr through RTTI. The reason we can't do that with ComponentPtr itself is because ComponentPtr is a template class and RTTI has difficulties dealing with that.

Constructor & Destructor Documentation

◆ ~ComponentPtrBase()

virtual ~ComponentPtrBase ( )
virtualdefault

Member Function Documentation

◆ assign()

virtual void assign ( const std::string &  targetPath,
rtti::Object targetObject 
)
pure virtual

Assign the path to the component (including ID) and object to this pointer. Used for pointer resolving by the ResourceManager. Should not be called manually (is only public so that we can register it in RTTI)

Parameters
targetPathpath to the target component including ID
targetObjectThe pointer to be assigned

◆ toObject()

virtual Component* toObject ( ) const
pure virtual

Returns the assigned component

Returns
The rtti object, nullptr if it doesn't exist

◆ toString()

virtual std::string toString ( ) const
pure virtual

Convert the path to a string for serialization

Returns
The string representation of this object

◆ translateTargetID()

static std::string translateTargetID ( const std::string &  targetID)
static

Convert the full target path to an ID that can be resolved against an object

Parameters
targetIDThe target ID to translate
Returns
The translated ID