Skip to content

Commit

Permalink
Macro conformance with the rest of Helium
Browse files Browse the repository at this point in the history
  • Loading branch information
gorlak committed Aug 23, 2013
1 parent 143ea66 commit d74f091
Show file tree
Hide file tree
Showing 12 changed files with 56 additions and 56 deletions.
12 changes: 6 additions & 6 deletions API.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,19 @@
#define HELIUM_REFLECT_API
#endif

//#define REFLECT_PROFILE
//#define HELIUM_PROFILE

#if defined(PROFILE_INSTRUMENT_ALL) || defined(REFLECT_PROFILE)
#define REFLECT_SCOPE_TIMER(__Str) PROFILE_SCOPE_TIMER(__Str)
#define HELIUM_REFLECT_SCOPE_TIMER(__Str) PROFILE_SCOPE_TIMER(__Str)
#else
#define REFLECT_SCOPE_TIMER(__Str)
#define HELIUM_REFLECT_SCOPE_TIMER(__Str)
#endif

#if !HELIUM_RELEASE
# define REFLECT_CHECK_MEMORY 1
# define REFLECT_CHECK_MEMORY_ASSERT HELIUM_ASSERT
# define HELIUM_REFLECT_CHECK_MEMORY 1
# define HELIUM_REFLECT_CHECK_MEMORY_ASSERT HELIUM_ASSERT
#else
# define REFLECT_CHECK_MEMORY_ASSERT( EXPR )
# define HELIUM_REFLECT_CHECK_MEMORY_ASSERT( EXPR )
#endif

namespace Helium
Expand Down
6 changes: 3 additions & 3 deletions Meta.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@
// its reflecting upon, so define a simple type checking system just for the reflection classes
//

#define REFLECT_META_BASE(__Id, __Type) \
#define HELIUM_META_BASE(__Id, __Type) \
typedef __Type This; \
const static Helium::Reflect::MetaId s_MetaId = __Id; \
virtual Helium::Reflect::MetaId GetMetaId() const { return __Id; } \
virtual bool IsA(Helium::Reflect::MetaId id) const { return __Id == id; }

#define REFLECT_META_DERIVED(__Id, __Type, __Base) \
#define HELIUM_META_DERIVED(__Id, __Type, __Base) \
typedef __Type This; \
typedef __Base Base; \
const static Helium::Reflect::MetaId s_MetaId = __Id; \
Expand Down Expand Up @@ -91,7 +91,7 @@ namespace Helium
class HELIUM_REFLECT_API Meta : public Helium::AtomicRefCountBase< Meta >, public PropertyCollection
{
public:
REFLECT_META_BASE( MetaIds::Invalid, Meta );
HELIUM_META_BASE( MetaIds::Invalid, Meta );

Meta();
virtual ~Meta();
Expand Down
26 changes: 13 additions & 13 deletions MetaClass.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ namespace Helium
class HELIUM_REFLECT_API MetaClass : public MetaStruct
{
public:
REFLECT_META_DERIVED( MetaIds::MetaClass, MetaClass, MetaStruct );
HELIUM_META_DERIVED( MetaIds::MetaClass, MetaClass, MetaStruct );

protected:
MetaClass();
Expand Down Expand Up @@ -106,39 +106,39 @@ const Helium::Reflect::MetaClass* OBJECT::s_MetaClass = NULL;
Helium::Reflect::MetaClassRegistrar< OBJECT, OBJECT::Base > OBJECT::s_Registrar( TXT( #OBJECT ) );

// declares an abstract object (an object that either A: cannot be instantiated or B: is never actually serialized)
#define REFLECT_DECLARE_ABSTRACT_NO_REGISTRAR( OBJECT, BASE ) \
#define HELIUM_DECLARE_ABSTRACT_NO_REGISTRAR( OBJECT, BASE ) \
_REFLECT_DECLARE_CLASS( OBJECT, BASE )

#define REFLECT_DECLARE_ABSTRACT( OBJECT, BASE ) \
REFLECT_DECLARE_ABSTRACT_NO_REGISTRAR( OBJECT, BASE ) \
#define HELIUM_DECLARE_ABSTRACT( OBJECT, BASE ) \
HELIUM_DECLARE_ABSTRACT_NO_REGISTRAR( OBJECT, BASE ) \
_REFLECT_DECLARE_CLASS_REGISTRAR( OBJECT, BASE )

// defines the abstract object class
#define REFLECT_DEFINE_ABSTRACT_NO_REGISTRAR( OBJECT ) \
#define HELIUM_DEFINE_ABSTRACT_NO_REGISTRAR( OBJECT ) \
_REFLECT_DEFINE_CLASS( OBJECT, NULL )

// defines the abstract object class
#define REFLECT_DEFINE_ABSTRACT( OBJECT ) \
REFLECT_DEFINE_ABSTRACT_NO_REGISTRAR( OBJECT ) \
#define HELIUM_DEFINE_ABSTRACT( OBJECT ) \
HELIUM_DEFINE_ABSTRACT_NO_REGISTRAR( OBJECT ) \
_REFLECT_DEFINE_CLASS_REGISTRAR( OBJECT, NULL )

// declares a concrete object with creator
#define REFLECT_DECLARE_CLASS_NO_REGISTRAR( OBJECT, BASE ) \
#define HELIUM_DECLARE_CLASS_NO_REGISTRAR( OBJECT, BASE ) \
_REFLECT_DECLARE_CLASS( OBJECT, BASE ) \
_REFLECT_DECLARE_CREATOR( OBJECT )

// declares a concrete object with creator
#define REFLECT_DECLARE_CLASS( OBJECT, BASE ) \
REFLECT_DECLARE_CLASS_NO_REGISTRAR( OBJECT, BASE ) \
#define HELIUM_DECLARE_CLASS( OBJECT, BASE ) \
HELIUM_DECLARE_CLASS_NO_REGISTRAR( OBJECT, BASE ) \
_REFLECT_DECLARE_CLASS_REGISTRAR( OBJECT, BASE )

// defines a concrete object
#define REFLECT_DEFINE_CLASS_NO_REGISTRAR( OBJECT ) \
#define HELIUM_DEFINE_CLASS_NO_REGISTRAR( OBJECT ) \
_REFLECT_DEFINE_CLASS( OBJECT, &OBJECT::CreateObject )

// defines a concrete object
#define REFLECT_DEFINE_CLASS( OBJECT ) \
REFLECT_DEFINE_CLASS_NO_REGISTRAR( OBJECT ) \
#define HELIUM_DEFINE_CLASS( OBJECT ) \
HELIUM_DEFINE_CLASS_NO_REGISTRAR( OBJECT ) \
_REFLECT_DEFINE_CLASS_REGISTRAR( OBJECT, &OBJECT::CreateObject )

#include "Reflect/MetaClass.inl"
6 changes: 3 additions & 3 deletions MetaEnum.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ namespace Helium
class HELIUM_REFLECT_API MetaEnum : public MetaType
{
public:
REFLECT_META_DERIVED( MetaIds::MetaEnum, MetaEnum, MetaType );
HELIUM_META_DERIVED( MetaIds::MetaEnum, MetaEnum, MetaType );

class HELIUM_REFLECT_API Element
{
Expand Down Expand Up @@ -99,11 +99,11 @@ const Helium::Reflect::MetaEnum* ENUMERATION::s_Enumeration = NULL; \
Helium::Reflect::MetaEnumRegistrar< ENUMERATION > ENUMERATION::s_Registrar( TXT( #ENUMERATION ) );

// declares an enumeration
#define REFLECT_DECLARE_ENUM( ENUMERATION ) \
#define HELIUM_DECLARE_ENUM( ENUMERATION ) \
_REFLECT_DECLARE_ENUM( ENUMERATION )

// defines an enumeration
#define REFLECT_DEFINE_ENUM( ENUMERATION ) \
#define HELIUM_DEFINE_ENUM( ENUMERATION ) \
_REFLECT_DEFINE_ENUM( ENUMERATION )

#include "Reflect/MetaEnum.inl"
10 changes: 5 additions & 5 deletions MetaStruct.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ namespace Helium
class HELIUM_REFLECT_API MetaStruct : public MetaType
{
public:
REFLECT_META_DERIVED( MetaIds::MetaStruct, MetaStruct, MetaType );
HELIUM_META_DERIVED( MetaIds::MetaStruct, MetaStruct, MetaType );

protected:
MetaStruct();
Expand Down Expand Up @@ -233,17 +233,17 @@ const Helium::Reflect::MetaStruct* STRUCTURE::s_MetaStruct = NULL; \
Helium::Reflect::MetaStructRegistrar< STRUCTURE, STRUCTURE::Base > STRUCTURE::s_Registrar( TXT( #STRUCTURE ) );

// declares a concrete object with creator
#define REFLECT_DECLARE_BASE_STRUCT( STRUCTURE ) \
#define HELIUM_DECLARE_BASE_STRUCT( STRUCTURE ) \
_REFLECT_DECLARE_BASE_STRUCT( STRUCTURE )

#define REFLECT_DECLARE_DERIVED_STRUCT( STRUCTURE, BASE ) \
#define HELIUM_DECLARE_DERIVED_STRUCT( STRUCTURE, BASE ) \
_REFLECT_DECLARE_DERIVED_STRUCT( STRUCTURE, BASE )

// defines a concrete object
#define REFLECT_DEFINE_BASE_STRUCT( STRUCTURE ) \
#define HELIUM_DEFINE_BASE_STRUCT( STRUCTURE ) \
_REFLECT_DEFINE_BASE_STRUCT( STRUCTURE )

#define REFLECT_DEFINE_DERIVED_STRUCT( STRUCTURE ) \
#define HELIUM_DEFINE_DERIVED_STRUCT( STRUCTURE ) \
_REFLECT_DEFINE_DERIVED_STRUCT( STRUCTURE )

#include "Reflect/MetaStruct.inl"
2 changes: 1 addition & 1 deletion MetaType.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ namespace Helium
class HELIUM_REFLECT_API MetaType HELIUM_ABSTRACT : public Meta
{
public:
REFLECT_META_BASE( MetaIds::MetaType, MetaType );
HELIUM_META_BASE( MetaIds::MetaType, MetaType );

protected:
MetaType();
Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,11 @@ struct HeroType : Helium::Reflect::Enum
God,
};

REFLECT_DECLARE_ENUM( HeroType );
HELIUM_DECLARE_ENUM( HeroType );
static void PopulateMetaType( MetaEnum& info );
};

REFLECT_DEFINE_ENUM( HeroType );
HELIUM_DEFINE_ENUM( HeroType );

void HeroType::PopulateMetaType( MetaEnum& info )
{
Expand All @@ -80,11 +80,11 @@ struct Hero : Helium::Reflect::Struct
HeroType m_HeroType;
uint32_t m_HitPoints;

REFLECT_DECLARE_BASE_STRUCT( Hero );
HELIUM_DECLARE_BASE_STRUCT( Hero );
static void PopulateMetaType( MetaStruct& comp );
};

REFLECT_DEFINE_BASE_STRUCT( Hero );
HELIUM_DEFINE_BASE_STRUCT( Hero );

void Hero::PopulateMetaType( Reflect::MetaStruct& comp )
{
Expand All @@ -101,11 +101,11 @@ class ComicUniverse : public Helium::Reflect::Object
{
Hero m_Heroes[ 8 ];

REFLECT_DECLARE_CLASS( ComicUniverse, Object );
HELIUM_DECLARE_CLASS( ComicUniverse, Object );
static void PopulateMetaType( MetaClass& comp );
};

REFLECT_DEFINE_CLASS( ComicUniverse );
HELIUM_DEFINE_CLASS( ComicUniverse );

void ComicUniverse::PopulateMetaType( Reflect::MetaClass& comp )
{
Expand Down
6 changes: 3 additions & 3 deletions Registry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#include "Reflect/TranslatorDeduction.h"

// Prints the callstack for every init and cleanup call
// #define REFLECT_DEBUG_INIT_AND_CLEANUP
// #define HELIUM_DEBUG_INIT_AND_CLEANUP

using namespace Helium;
using namespace Helium::Reflect;
Expand Down Expand Up @@ -86,7 +86,7 @@ void Reflect::Initialize()
MetaTypeRegistrar::RegisterTypes( RegistrarTypes::MetaClass );
}

#ifdef REFLECT_DEBUG_INIT_AND_CLEANUP
#ifdef HELIUM_DEBUG_INIT_AND_CLEANUP
std::vector<uintptr_t> trace;
Helium::GetStackTrace( trace );

Expand All @@ -110,7 +110,7 @@ void Reflect::Cleanup()
g_Registry = NULL;
}

#ifdef REFLECT_DEBUG_INIT_AND_CLEANUP
#ifdef HELIUM_DEBUG_INIT_AND_CLEANUP
std::vector<uintptr_t> trace;
Helium::GetStackTrace( trace );

Expand Down
6 changes: 3 additions & 3 deletions Tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ struct EmptyBaseCheck : Struct
};
HELIUM_COMPILE_ASSERT( sizeof( EmptyBaseCheck ) == sizeof( uint32_t ) ); // check for empty-base optimization

REFLECT_DEFINE_ENUM( TestEnumeration );
HELIUM_DEFINE_ENUM( TestEnumeration );

void TestEnumeration::PopulateMetaType( MetaEnum& info )
{
info.AddElement( ValueOne, TXT( "Value One" ) );
info.AddElement( ValueTwo, TXT( "Value Two" ) );
}

REFLECT_DEFINE_BASE_STRUCT( TestStructure );
HELIUM_DEFINE_BASE_STRUCT( TestStructure );

void TestStructure::PopulateMetaType( Reflect::MetaStruct& comp )
{
Expand All @@ -46,7 +46,7 @@ void TestStructure::PopulateMetaType( Reflect::MetaStruct& comp )
comp.AddField( &TestStructure::m_FoundationMapUint32, "Map of Unsigned 32-bit Integers" );
}

REFLECT_DEFINE_CLASS( TestObject );
HELIUM_DEFINE_CLASS( TestObject );

void TestObject::PopulateMetaType( Reflect::MetaClass& comp )
{
Expand Down
6 changes: 3 additions & 3 deletions Tests.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace Helium
ValueTwo,
};

REFLECT_DECLARE_ENUM( TestEnumeration );
HELIUM_DECLARE_ENUM( TestEnumeration );
static void PopulateMetaType( MetaEnum& info );
};

Expand All @@ -42,7 +42,7 @@ namespace Helium
Set<uint32_t> m_FoundationSetUint32;
Map<uint32_t, uint32_t> m_FoundationMapUint32;

REFLECT_DECLARE_BASE_STRUCT( TestStructure );
HELIUM_DECLARE_BASE_STRUCT( TestStructure );
static void PopulateMetaType( MetaStruct& comp );
};

Expand All @@ -54,7 +54,7 @@ namespace Helium
TestEnumeration m_Enumeration;
TestEnumeration m_EnumerationArray[ 8 ];

REFLECT_DECLARE_CLASS( TestObject, Object );
HELIUM_DECLARE_CLASS( TestObject, Object );
static void PopulateMetaType( MetaClass& comp );
};

Expand Down
6 changes: 3 additions & 3 deletions TranslateBuiltin.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ namespace Helium
class PointerTranslator : public ScalarTranslator
{
public:
REFLECT_META_DERIVED( MetaIds::PointerTranslator, PointerTranslator, ScalarTranslator );
HELIUM_META_DERIVED( MetaIds::PointerTranslator, PointerTranslator, ScalarTranslator );

inline PointerTranslator();
virtual void Construct( Pointer pointer ) HELIUM_OVERRIDE;
Expand Down Expand Up @@ -157,7 +157,7 @@ namespace Helium
class EnumerationTranslator : public ScalarTranslator
{
public:
REFLECT_META_DERIVED( MetaIds::EnumerationTranslator, EnumerationTranslator, ScalarTranslator );
HELIUM_META_DERIVED( MetaIds::EnumerationTranslator, EnumerationTranslator, ScalarTranslator );

inline EnumerationTranslator();
virtual void Construct( Pointer pointer ) HELIUM_OVERRIDE;
Expand Down Expand Up @@ -189,7 +189,7 @@ namespace Helium
class HELIUM_REFLECT_API TypeTranslator : public ScalarTranslator
{
public:
REFLECT_META_DERIVED( MetaIds::TypeTranslator, TypeTranslator, ScalarTranslator );
HELIUM_META_DERIVED( MetaIds::TypeTranslator, TypeTranslator, ScalarTranslator );

TypeTranslator();
virtual void Construct( Pointer pointer ) HELIUM_OVERRIDE;
Expand Down
14 changes: 7 additions & 7 deletions Translator.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ namespace Helium
class HELIUM_REFLECT_API Translator : public Meta
{
public:
REFLECT_META_DERIVED( MetaIds::Translator, Translator, Meta );
HELIUM_META_DERIVED( MetaIds::Translator, Translator, Meta );

inline Translator( size_t size );

Expand Down Expand Up @@ -139,7 +139,7 @@ namespace Helium
class HELIUM_REFLECT_API ScalarTranslator : public Translator
{
public:
REFLECT_META_DERIVED( MetaIds::ScalarTranslator, ScalarTranslator, Translator );
HELIUM_META_DERIVED( MetaIds::ScalarTranslator, ScalarTranslator, Translator );

inline ScalarTranslator( size_t size, ScalarType type );

Expand All @@ -162,7 +162,7 @@ namespace Helium
class HELIUM_REFLECT_API StructureTranslator : public Translator
{
public:
REFLECT_META_DERIVED( MetaIds::StructureTranslator, StructureTranslator, Translator );
HELIUM_META_DERIVED( MetaIds::StructureTranslator, StructureTranslator, Translator );

inline StructureTranslator( size_t size );

Expand All @@ -176,7 +176,7 @@ namespace Helium
class HELIUM_REFLECT_API ContainerTranslator : public Translator
{
public:
REFLECT_META_DERIVED( MetaIds::ContainerTranslator, ContainerTranslator, Translator );
HELIUM_META_DERIVED( MetaIds::ContainerTranslator, ContainerTranslator, Translator );

inline ContainerTranslator( size_t size );

Expand All @@ -191,7 +191,7 @@ namespace Helium
class HELIUM_REFLECT_API SetTranslator : public ContainerTranslator
{
public:
REFLECT_META_DERIVED( MetaIds::SetTranslator, SetTranslator, ContainerTranslator );
HELIUM_META_DERIVED( MetaIds::SetTranslator, SetTranslator, ContainerTranslator );

inline SetTranslator( size_t size );

Expand All @@ -211,7 +211,7 @@ namespace Helium
class HELIUM_REFLECT_API SequenceTranslator : public ContainerTranslator
{
public:
REFLECT_META_DERIVED( MetaIds::SequenceTranslator, SequenceTranslator, ContainerTranslator );
HELIUM_META_DERIVED( MetaIds::SequenceTranslator, SequenceTranslator, ContainerTranslator );

inline SequenceTranslator( size_t size );

Expand All @@ -235,7 +235,7 @@ namespace Helium
class HELIUM_REFLECT_API AssociationTranslator : public ContainerTranslator
{
public:
REFLECT_META_DERIVED( MetaIds::AssociationTranslator, AssociationTranslator, ContainerTranslator );
HELIUM_META_DERIVED( MetaIds::AssociationTranslator, AssociationTranslator, ContainerTranslator );

inline AssociationTranslator( size_t size );

Expand Down

0 comments on commit d74f091

Please sign in to comment.