Refureku v2.2.0
C++17 runtime reflection library.
ClassTemplate.h
1
8#pragma once
9
10#include "Refureku/TypeInfo/Archetypes/Struct.h"
11
12namespace rfk
13{
14 //Forward declarations
15 class TemplateParameter;
16 class TemplateArgument;
17 class ClassTemplateInstantiation;
18 class ClassTemplate;
19
20 /* A struct template and a class template contain exactly the same data. Alias for convenience. */
21 using StructTemplate = ClassTemplate;
22
23 class ClassTemplate final : public Struct
24 {
25 public:
26 REFUREKU_API ClassTemplate(char const* name,
27 std::size_t id,
28 bool isClass) noexcept;
29 REFUREKU_API ~ClassTemplate() noexcept;
30
39 RFK_NODISCARD REFUREKU_API
40 TemplateParameter const& getTemplateParameterAt(std::size_t index) const noexcept;
41
47 RFK_NODISCARD REFUREKU_API
48 std::size_t getTemplateParametersCount() const noexcept;
49
57 template <std::size_t ArgsCount>
58 RFK_NODISCARD
59 ClassTemplateInstantiation const* getTemplateInstantiation(TemplateArgument const* (&args)[ArgsCount]) const noexcept;
60
69 RFK_NODISCARD REFUREKU_API
71 std::size_t argsCount) const noexcept;
72
78 RFK_NODISCARD REFUREKU_API
79 std::size_t getTemplateInstantiationsCount() const noexcept;
80
93 void* userData) const;
94
100 REFUREKU_API void addTemplateParameter(TemplateParameter const& param) noexcept;
101
107 REFUREKU_API void registerTemplateInstantiation(ClassTemplateInstantiation const& inst) noexcept;
108
114 REFUREKU_API void unregisterTemplateInstantiation(ClassTemplateInstantiation const& inst) noexcept;
115
116 private:
117 //Forward declaration
118 class ClassTemplateImpl;
119
120 RFK_GEN_GET_PIMPL(ClassTemplateImpl, Entity::getPimpl())
121 };
122
123 #include "Refureku/TypeInfo/Archetypes/Template/ClassTemplate.inl"
124}
Definition: ClassTemplate.h:24
REFUREKU_API void unregisterTemplateInstantiation(ClassTemplateInstantiation const &inst) noexcept
Unregister an instantiation of this class template.
RFK_NODISCARD REFUREKU_API std::size_t getTemplateParametersCount() const noexcept
Get the number of template parameters for this class template.
REFUREKU_API void registerTemplateInstantiation(ClassTemplateInstantiation const &inst) noexcept
Register an instantiation of this class template.
REFUREKU_API void addTemplateParameter(TemplateParameter const &param) noexcept
Append a template parameter to the list of template parameters.
RFK_NODISCARD ClassTemplateInstantiation const * getTemplateInstantiation(TemplateArgument const *(&args)[ArgsCount]) const noexcept
Get an existing template instantiation corresponding to the provided arguments.
RFK_NODISCARD REFUREKU_API TemplateParameter const & getTemplateParameterAt(std::size_t index) const noexcept
Retrieve the template parameter at the given index. If index is greater or equal to getTemplateParame...
RFK_NODISCARD REFUREKU_API std::size_t getTemplateInstantiationsCount() const noexcept
Get the number of instantiations (with different template parameters) of this class template within t...
REFUREKU_API bool foreachTemplateInstantiation(Visitor< ClassTemplateInstantiation > visitor, void *userData) const
Execute the given visitor on all template instantiations of this class.
Definition: ClassTemplateInstantiation.h:23
Definition: Entity.h:29
Definition: Struct.h:40
Definition: TemplateArgument.h:19
Definition: TemplateParameter.h:18
Definition: Allocator.h:16
bool(*)(T const &value, void *userData) Visitor
Visitor function.
Definition: Visitor.h:21