Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions Resources/Templates/module-file-source.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -21,26 +21,27 @@ void meta_generated::AllocateModuleFile{{targetName}}{{moduleFileName}}(m::Refle
///////////////////////////////////////////////////////////////////////////
{{#class}}
{
//ID of decayed type
auto decayed_id = db.AllocateType( "{{& displayName}}" );
{ // Base Type
auto id = db.AllocateType( "{{& displayName}}" );
auto &type = db.types[ id ];
auto &type = db.types[ decayed_id ];

m::TypeInfo<{{& qualifiedName}}>::Register( id, type, true );
m::TypeInfo<{{& qualifiedName}}>::Register( decayed_id, type, true, decayed_id );
}
{{#ptrTypeEnabled}}
{ // Pointer Type
auto id = db.AllocateType( "{{& displayName}}*" );
auto &type = db.types[ id ];

m::TypeInfo<{{& qualifiedName}}*>::Register( id, type, false );
m::TypeInfo<{{& qualifiedName}}*>::Register( id, type, false, decayed_id );
}
{{/ptrTypeEnabled}}
{{#constPtrTypeEnabled}}
{ // Const Pointer Type
auto id = db.AllocateType( "const {{& displayName}}*" );
auto &type = db.types[ id ];

m::TypeInfo<const {{& qualifiedName}}*>::Register( id, type, false );
m::TypeInfo<const {{& qualifiedName}}*>::Register( id, type, false, decayed_id );
}
{{/constPtrTypeEnabled}}
}
Expand All @@ -61,7 +62,7 @@ void meta_generated::AllocateModuleFile{{targetName}}{{moduleFileName}}(m::Refle
auto id = db.AllocateType( "{{& displayName}}*" );
auto &type = db.types[ id ];

m::TypeInfo<{{& qualifiedName}}*>::Register( id, type, false );
m::TypeInfo<{{& qualifiedName}}*>::Register( id, type, true );
}
{{/ptrTypeEnabled}}
{{#constPtrTypeEnabled}}
Expand Down
13 changes: 7 additions & 6 deletions Resources/Templates/module-source.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -26,26 +26,27 @@ meta_generated::Module{{targetName}}::Module{{targetName}}(m::ReflectionDatabase
///////////////////////////////////////////////////////////////////////////
{{#external}}
{
{ // Base Type
auto id = db.AllocateType( "{{& displayName}}" );
auto &type = db.types[ id ];
auto decayed_id = db.AllocateType( "{{& displayName}}" );

{ // Base Type
auto &type = db.types[ decayed_id ];

m::TypeInfo<{{& qualifiedName}}>::Register( id, type, true );
m::TypeInfo<{{& qualifiedName}}>::Register( decayed_id, type, true, decayed_id );
}
{{#ptrTypeEnabled}}
{ // Pointer Type
auto id = db.AllocateType( "{{& displayName}}*" );
auto &type = db.types[ id ];

m::TypeInfo<{{& qualifiedName}}*>::Register( id, type, false );
m::TypeInfo<{{& qualifiedName}}*>::Register( id, type, false, decayed_id );
}
{{/ptrTypeEnabled}}
{{#constPtrTypeEnabled}}
{ // Const Pointer Type
auto id = db.AllocateType( "const {{& displayName}}*" );
auto &type = db.types[ id ];

m::TypeInfo<const {{& qualifiedName}}*>::Register( id, type, false );
m::TypeInfo<const {{& qualifiedName}}*>::Register( id, type, false, decayed_id );
}
{{/constPtrTypeEnabled}}
}
Expand Down
12 changes: 8 additions & 4 deletions Source/Runtime/Impl/TypeInfo.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,11 @@ namespace ursine
bool TypeInfo<T>::Defined = false;

template<typename T>
void TypeInfo<T>::Register(
TypeID id,
TypeData &data,
bool beingDefined
void TypeInfo<T>::Register(
TypeID id,
TypeData &data,
bool beingDefined,
TypeID DecayedTypeID
)
{
// already defined
Expand All @@ -54,6 +55,9 @@ namespace ursine

applyTrivialAttributes( data );
}
//For non pointer type id is passed to DecayedTypeID
data.DecayedTypeID = DecayedTypeID;

}

template<typename T>
Expand Down
12 changes: 6 additions & 6 deletions Source/Runtime/ReflectionDatabase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,18 @@

#include "Type.h"

#define REGISTER_NATIVE_TYPE(type) \
#define REGISTER_NATIVE_TYPE(type, decayed_type) \
{ \
auto id = AllocateType( #type ); \
auto &handle = types[ id ]; \
\
TypeInfo<type>::Register( id, handle, true ); \
auto &decayed_handle = typeidof(decayed_type); \
TypeInfo<type>::Register( id, handle, true, decayed_handle ); \
} \

#define REGISTER_NATIVE_TYPE_VARIANTS(type) \
REGISTER_NATIVE_TYPE( type ) \
REGISTER_NATIVE_TYPE( type* ) \
REGISTER_NATIVE_TYPE( const type* ) \
REGISTER_NATIVE_TYPE( type, type ) \
REGISTER_NATIVE_TYPE( type*, type ) \
REGISTER_NATIVE_TYPE( const type*, type ) \

#define REGISTER_NATIVE_TYPE_VARIANTS_W_ARRAY(type) \
REGISTER_NATIVE_TYPE_VARIANTS( type ) \
Expand Down
4 changes: 3 additions & 1 deletion Source/Runtime/TypeData.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ namespace ursine
// enum type

Enum enumeration;


//DecayedTypeID
TypeID DecayedTypeID;
// class type

Type::Set baseClasses;
Expand Down
2 changes: 1 addition & 1 deletion Source/Runtime/TypeInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ namespace ursine
{
static bool Defined;

static void Register(TypeID id, TypeData &data, bool beingDefined);
static void Register(TypeID id, TypeData &data, bool beingDefined, TypeID DecayedTypeID);

private:
template<typename U = T>
Expand Down