Polyphase Game Engine
Loading...
Searching...
No Matches
Object.h File Reference
#include "PolyphaseAPI.h"
#include "Utilities.h"
#include "EngineTypes.h"
#include "ScriptAutoReg.h"
#include <string>
#include <stdint.h>

Go to the source code of this file.

Classes

class  Object
 

Macros

#define DECLARE_OBJECT(Type, ParentType)
 
#define DEFINE_OBJECT(Type)   RuntimeId Type::sRuntimeId = reinterpret_cast<RuntimeId>(&Type::sRuntimeId);
 

Functions

POLYPHASE_API int CreateClassMetatable (const char *className, const char *classFlag, const char *parentClassName)
 
template<typename T >
T * Cast (Object *object)
 
template<typename T , typename U >
SharedPtr< T > Cast (const SharedPtr< U > &object)
 
template<typename T , typename U >
WeakPtr< T > Cast (const WeakPtr< U > &object)
 

Macro Definition Documentation

◆ DECLARE_OBJECT

#define DECLARE_OBJECT (   Type,
  ParentType 
)
Value:
public: \
static const char* ClassRuntimeName() { return #Type; } \
virtual const char* RuntimeName() const override { return Type::ClassRuntimeName(); } \
virtual const char* RuntimeParentName() const override { return ParentType::ClassRuntimeName(); } \
static RuntimeId ClassRuntimeId() { return sRuntimeId; } \
virtual RuntimeId InstanceRuntimeId() const override { return Type::ClassRuntimeId(); } \
virtual Object* QueryInterface(RuntimeId id) const override \
{ \
if (id == sRuntimeId) \
{ return (Object*)this; } \
else \
{ return ParentType::QueryInterface(id); } \
} \
virtual bool Is(RuntimeId id) const override \
{ \
if (id == sRuntimeId) \
{ return true; } \
else \
{ return ParentType::Is(id); } \
} \
virtual bool Is(const char* name) const override \
{ \
if (strncmp(name, ClassRuntimeName(), 256) == 0) \
{ return true; } \
else \
{ return ParentType::Is(name); } \
} \
private: \
static RuntimeId sRuntimeId; \
public:
uint64_t RuntimeId
Definition EngineTypes.h:67
Definition Object.h:13

◆ DEFINE_OBJECT

#define DEFINE_OBJECT (   Type)    RuntimeId Type::sRuntimeId = reinterpret_cast<RuntimeId>(&Type::sRuntimeId);

Function Documentation

◆ Cast() [1/3]

template<typename T , typename U >
SharedPtr< T > Cast ( const SharedPtr< U > &  object)

◆ Cast() [2/3]

template<typename T , typename U >
WeakPtr< T > Cast ( const WeakPtr< U > &  object)

◆ Cast() [3/3]

template<typename T >
T * Cast ( Object object)

◆ CreateClassMetatable()

POLYPHASE_API int CreateClassMetatable ( const char *  className,
const char *  classFlag,
const char *  parentClassName 
)