CeresEngine 0.2.0
A game development framework
Loading...
Searching...
No Matches
IReflectable.hpp
Go to the documentation of this file.
1//
2// CeresEngine - A game development framework
3//
4// Created by Rogiel Sulzbach.
5// Copyright (c) 2018-2022 Rogiel Sulzbach. All rights reserved.
6//
7
8#pragma once
9
10#include "Forward.hpp"
11
12namespace CeresEngine {
13
15 struct ClassInfo {
19
21 const void* instance = nullptr;
22
23 constexpr ClassInfo() = default;
24 constexpr ClassInfo(const TypeID typeID, const void* instance) : typeID(typeID), instance(instance) {}
25 };
26
37
38#define CE_REFLECTABLE_CLASS \
39public: \
40 CE_DISABLE_WARNING_PUSH \
41 CE_DISABLE_WARNING_MISSING_OVERRIDE \
42 [[nodiscard]] virtual ::CeresEngine::ClassInfo getClassInfo() noexcept; \
43 [[nodiscard]] virtual ::CeresEngine::ClassInfo getClassInfo() const noexcept; \
44 CE_DISABLE_WARNING_POP \
45private:
46
47#define CE_REFLECTABLE_STRUCT \
48public: \
49 CE_DISABLE_WARNING_PUSH \
50 CE_DISABLE_WARNING_MISSING_OVERRIDE \
51 [[nodiscard]] virtual ::CeresEngine::ClassInfo getClassInfo() const noexcept; \
52 [[nodiscard]] virtual ::CeresEngine::ClassInfo getClassInfo() noexcept; \
53 CE_DISABLE_WARNING_POP \
54public:
55
56} // namespace CeresEngine
An interface that must be implemented by types that wish to expose richer reflection data.
Definition IReflectable.hpp:29
virtual ClassInfo getClassInfo() noexcept=0
virtual ~IReflectable() noexcept=default
Definition Application.hpp:19
constexpr size_t hash(const T &v)
Generates a hash for the provided type.
Definition Hash.hpp:25
A structure that contains type information for a class.
Definition IReflectable.hpp:15
TypeID typeID
The class type ID.
Definition IReflectable.hpp:18
const void * instance
A pointer to the instance.
Definition IReflectable.hpp:21
constexpr ClassInfo(const TypeID typeID, const void *instance)
Definition IReflectable.hpp:24
constexpr ClassInfo()=default