Giter Club home page Giter Club logo

mirror's People

Contributors

berdal84 avatar grouflon avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

berdal84

mirror's Issues

MIRROR_CLASS and visibility

La MACRO MIRROR_CLASS comporte "public:" qui a pour effet de se propager (une fois la macro passée) aux champs suivants.
N'y a-t-il pas une autre possibilité qui soit tout aussi transparente mais qui ne déborde pas ?

Exemple: drawFileInfo était publique, mais si je ne connais pas mirror et que je lis ce code, je la considère privée.
Bon, après j'aurais pu mieux la placer c'est une erreur de ma part...
image

MIRROR_CLASS_DEFINITION fail at runtime

Under linux (Ubuntu 20, clang 10) I have a problem with MIRROR_CLASS_DEFINITION.
I tried it with a single class, I'm unable to run the program, I got stuck inside the expression of an assert (checking if TypeId exists or not in a map). The runtime error occurs in the std, a division by zero:

image

everything starts here in mirror:

image

With the value:
image

For information, the map m_typeById is empty. Any idea ?

PS: I changed my keyboard, I prefer to use English because accents are missing on this one.

Compilation de mirror échoue sur master

OS: Ubuntu 20.04, 64bits

Je viens d'essayer de compiler mirror à partir du commit berdal84@b1fe138 (j'ai mergé ton master + un fix que tu m'avais suggéré pour l'unpiler), j'obtiens ces messages d'erreurs, une idée ?

Je build à partir de cette conf cmake:

# mirror
#-------
include( ${CMAKE_CURRENT_LIST_DIR}/mirror/mirror-config.cmake )
add_library(
        mirror
        STATIC
            ${MIRROR_SOURCES} )

target_include_directories(
        mirror
        PUBLIC
            ${MIRROR_INCLUDE_DIRS} )

Les erreurs lorsque je build la target mirror:

Scanning dependencies of target mirror
make[3]: AVERTISSEMENT : décalage d'horloge détecté. La construction peut être incomplète.
make[3]: Avertissement : le fichier « libs/CMakeFiles/mirror.dir/progress.make » a une date de modification 6978 s dans le futur
[ 33%] Building CXX object libs/CMakeFiles/mirror.dir/mirror/mirror_base.cpp.o
[ 66%] Building CXX object libs/CMakeFiles/mirror.dir/mirror/tools/BinarySerializer.cpp.o
In file included from /home/<user>/nodable/libs/mirror/tools/BinarySerializer.cpp:1:
/home/<user>/nodable/libs/mirror/tools/BinarySerializer.h:64:13: error: explicit specialization in non-namespace scope ‘struct mirror::BinarySerializer::FDataBuffer’
   64 |    template<>
      |             ^
/home/<user>/nodable/libs/mirror/tools/BinarySerializer.h:65:54: error: template-id ‘write<std::string>’ in declaration of primary template
   65 |    void write<std::string>(const std::string& _string)
      |                                                      ^
/home/<user>/nodable/libs/mirror/tools/BinarySerializer.h:75:9: error: too many template-parameter-lists
   75 |    bool read(T& _object)
      |         ^~~~
/home/<user>/nodable/libs/mirror/tools/BinarySerializer.h:83:13: error: explicit specialization in non-namespace scope ‘struct mirror::BinarySerializer::FDataBuffer’
   83 |    template<>
      |             ^
/home/<user>/nodable/libs/mirror/tools/BinarySerializer.h:84:9: error: expected ‘;’ at end of member declaration
   84 |    bool read<std::string>(std::string& _string)
      |         ^~~~
      |             ;
/home/<user>/nodable/libs/mirror/tools/BinarySerializer.h:84:13: error: expected unqualified-id before ‘<’ token
   84 |    bool read<std::string>(std::string& _string)
      |             ^
/home/<user>/nodable/libs/mirror/tools/BinarySerializer.h:97:39: error: ‘bool mirror::BinarySerializer::FDataBuffer::read(void*, size_t)’ conflicts with a previous declaration
   97 |    bool read(void* _data, size_t _size);
      |                                       ^
/home/<user>/nodable/libs/mirror/tools/BinarySerializer.h:84:9: note: previous declaration ‘bool mirror::BinarySerializer::FDataBuffer::read’
   84 |    bool read<std::string>(std::string& _string)
      |         ^~~~
In file included from /home/<user>/nodable/libs/mirror/tools/../mirror.h:12,
                 from /home/<user>/nodable/libs/mirror/tools/BinarySerializer.cpp:5:
/home/<user>/nodable/libs/mirror/tools/../mirror_base.h:24:20: error: expected initializer before ‘MetaData’
   24 |  struct MIRROR_API MetaData
      |                    ^~~~~~~~
/home/<user>/nodable/libs/mirror/tools/../mirror_base.h:41:20: error: expected initializer before ‘MetaDataSet’
   41 |  struct MIRROR_API MetaDataSet
      |                    ^~~~~~~~~~~
/home/<user>/nodable/libs/mirror/tools/../mirror_base.h:57:19: error: expected initializer before ‘VirtualTypeWrapper’
   57 |  class MIRROR_API VirtualTypeWrapper
      |                   ^~~~~~~~~~~~~~~~~~
/home/<user>/nodable/libs/mirror/tools/../mirror_base.h:75:2: error: expected class-name before ‘{’ token
   75 |  {
      |  ^
/home/<user>/nodable/libs/mirror/tools/../mirror_base.h: In constructor ‘mirror::TVirtualTypeWrapperBase<T, IsShallow>::TVirtualTypeWrapperBase()’:
/home/<user>/nodable/libs/mirror/tools/../mirror_base.h:79:4: error: ‘m_typeID’ was not declared in this scope; did you mean ‘GetTypeID’?
   79 |    m_typeID = GetTypeID<T>();
      |    ^~~~~~~~
      |    GetTypeID
/home/<user>/nodable/libs/mirror/tools/../mirror_base.h:80:4: error: ‘m_size’ was not declared in this scope; did you mean ‘dysize’?
   80 |    m_size = sizeof(T);
      |    ^~~~~~
      |    dysize
In file included from /home/<user>/nodable/libs/mirror/tools/../mirror.h:12,
                 from /home/<user>/nodable/libs/mirror/tools/BinarySerializer.cpp:5:
/home/<user>/nodable/libs/mirror/tools/../mirror_base.h: At global scope:
/home/<user>/nodable/libs/mirror/tools/../mirror_base.h:86:2: error: expected class-name before ‘{’ token
   86 |  {
      |  ^
/home/<user>/nodable/libs/mirror/tools/../mirror_base.h: In constructor ‘mirror::TVirtualTypeWrapperBase<T, typename std::enable_if<(std::is_function< <template-parameter-1-1> >::value || std::is_void<_Tp>::value), void>::type>::TVirtualTypeWrapperBase()’:
/home/<user>/nodable/libs/mirror/tools/../mirror_base.h:90:4: error: ‘m_typeID’ was not declared in this scope; did you mean ‘GetTypeID’?
   90 |    m_typeID = GetTypeID<T>();
      |    ^~~~~~~~
      |    GetTypeID
/home/<user>/nodable/libs/mirror/tools/../mirror_base.h:91:4: error: ‘m_size’ was not declared in this scope; did you mean ‘dysize’?
   91 |    m_size = 0;
      |    ^~~~~~
      |    dysize
/home/<user>/nodable/libs/mirror/tools/../mirror_base.h: At global scope:
/home/<user>/nodable/libs/mirror/tools/../mirror_base.h:97:2: error: expected class-name before ‘{’ token
   97 |  {
      |  ^
/home/<user>/nodable/libs/mirror/tools/../mirror_base.h: In constructor ‘mirror::TVirtualTypeWrapperBase<void>::TVirtualTypeWrapperBase()’:
/home/<user>/nodable/libs/mirror/tools/../mirror_base.h:101:4: error: ‘m_typeID’ was not declared in this scope; did you mean ‘GetTypeID’?
  101 |    m_typeID = GetTypeID<void>();
      |    ^~~~~~~~
      |    GetTypeID
/home/<user>/nodable/libs/mirror/tools/../mirror_base.h:102:4: error: ‘m_size’ was not declared in this scope; did you mean ‘dysize’?
  102 |    m_size = 0;
      |    ^~~~~~
      |    dysize
/home/<user>/nodable/libs/mirror/tools/../mirror_base.h: At global scope:
/home/<user>/nodable/libs/mirror/tools/../mirror_base.h:130:19: error: expected initializer before ‘TypeDesc’
  130 |  class MIRROR_API TypeDesc
      |                   ^~~~~~~~
/home/<user>/nodable/libs/mirror/tools/../mirror_base.h:157:19: error: expected initializer before ‘PointerTypeDesc’
  157 |  class MIRROR_API PointerTypeDesc : public TypeDesc
      |                   ^~~~~~~~~~~~~~~
/home/<user>/nodable/libs/mirror/tools/../mirror_base.h:168:19: error: expected initializer before ‘FixedSizeArrayTypeDesc’
  168 |  class MIRROR_API FixedSizeArrayTypeDesc : public TypeDesc
      |                   ^~~~~~~~~~~~~~~~~~~~~~
/home/<user>/nodable/libs/mirror/tools/../mirror_base.h:181:19: error: expected initializer before ‘ClassMember’
  181 |  class MIRROR_API ClassMember
      |                   ^~~~~~~~~~~
/home/<user>/nodable/libs/mirror/tools/../mirror_base.h:205:19: error: expected initializer before ‘Class’
  205 |  class MIRROR_API Class : public TypeDesc
      |                   ^~~~~
/home/<user>/nodable/libs/mirror/tools/../mirror_base.h:235:19: error: expected initializer before ‘EnumValue’
  235 |  class MIRROR_API EnumValue
      |                   ^~~~~~~~~
/home/<user>/nodable/libs/mirror/tools/../mirror_base.h:249:19: error: expected initializer before ‘Enum’
  249 |  class MIRROR_API Enum : public TypeDesc
      |                   ^~~~
/home/<user>/nodable/libs/mirror/tools/../mirror_base.h:299:2: error: ‘Enum’ does not name a type; did you mean ‘enum’?
  299 |  Enum* GetEnum()
      |  ^~~~
      |  enum
/home/<user>/nodable/libs/mirror/tools/../mirror_base.h:308:19: error: expected initializer before ‘TypeSet’
  308 |  class MIRROR_API TypeSet
      |                   ^~~~~~~
/home/<user>/nodable/libs/mirror/tools/../mirror_base.h: In static member function ‘static mirror::TypeDesc* mirror::TypeDescGetter<T, IsArray, IsPointer, IsEnum, IsFunction>::Get()’:
/home/<user>/nodable/libs/mirror/tools/../mirror_base.h:333:11: error: there are no arguments to ‘GetTypeSet’ that depend on a template parameter, so a declaration of ‘GetTypeSet’ must be available [-fpermissive]
  333 |    return GetTypeSet()->findTypeByID(typeID);
      |           ^~~~~~~~~~
/home/<user>/nodable/libs/mirror/tools/../mirror_base.h:333:11: note: (if you use ‘-fpermissive’, G++ will accept your code, but allowing the use of an undeclared name is deprecated)
/home/<user>/nodable/libs/mirror/tools/../mirror_base.h: In static member function ‘static mirror::TypeDesc* mirror::TypeDescGetter<T, typename std::enable_if<std::is_array< <template-parameter-1-1> >::value, void>::type>::Get()’:
/home/<user>/nodable/libs/mirror/tools/../mirror_base.h:342:26: error: expected nested-name-specifier before ‘typename’
  342 |    using type = typename typename std::remove_extent<T>::type;
      |                          ^~~~~~~~
/home/<user>/nodable/libs/mirror/tools/../mirror_base.h:343:11: error: ‘FixedSizeArrayTypeDesc’ does not name a type
  343 |    static FixedSizeArrayTypeDesc s_fixedSizeArrayTypeDesc(TypeDescGetter<type>::Get(), std::extent<T>::value , new TVirtualTypeWrapper<T>());
      |           ^~~~~~~~~~~~~~~~~~~~~~
In file included from /home/<user>/nodable/libs/mirror/mirror.h:12,
                 from /home/<user>/nodable/libs/mirror/mirror_base.cpp:1:
/home/<user>/nodable/libs/mirror/mirror_base.h:24:20: error: expected initializer before ‘MetaData’
   24 |  struct MIRROR_API MetaData
      |                    ^~~~~~~~
/home/<user>/nodable/libs/mirror/mirror_base.h:41:20: error: expected initializer before ‘MetaDataSet’
   41 |  struct MIRROR_API MetaDataSet
      |                    ^~~~~~~~~~~
/home/<user>/nodable/libs/mirror/mirror_base.h:57:19: error: expected initializer before ‘VirtualTypeWrapper’
   57 |  class MIRROR_API VirtualTypeWrapper
      |                   ^~~~~~~~~~~~~~~~~~
/home/<user>/nodable/libs/mirror/mirror_base.h:75:2: error: expected class-name before ‘{’ token
   75 |  {
      |  ^
/home/<user>/nodable/libs/mirror/tools/../mirror_base.h:344:12: error: ‘s_fixedSizeArrayTypeDesc’ was not declared in this scope
  344 |    return &s_fixedSizeArrayTypeDesc;
      |            ^~~~~~~~~~~~~~~~~~~~~~~~
/home/<user>/nodable/libs/mirror/mirror_base.h: In constructor ‘mirror::TVirtualTypeWrapperBase<T, IsShallow>::TVirtualTypeWrapperBase()’:
/home/<user>/nodable/libs/mirror/mirror_base.h:79:4: error: ‘m_typeID’ was not declared in this scope; did you mean ‘GetTypeID’?
   79 |    m_typeID = GetTypeID<T>();
      |    ^~~~~~~~
      |    GetTypeID
/home/<user>/nodable/libs/mirror/mirror_base.h:80:4: error: ‘m_size’ was not declared in this scope; did you mean ‘dysize’?
   80 |    m_size = sizeof(T);
      |    ^~~~~~
      |    dysize
In file included from /home/<user>/nodable/libs/mirror/mirror.h:12,
                 from /home/<user>/nodable/libs/mirror/mirror_base.cpp:1:
/home/<user>/nodable/libs/mirror/mirror_base.h: At global scope:
/home/<user>/nodable/libs/mirror/mirror_base.h:86:2: error: expected class-name before ‘{’ token
   86 |  {
      |  ^
/home/<user>/nodable/libs/mirror/tools/../mirror_base.h: In static member function ‘static mirror::TypeDesc* mirror::TypeDescGetter<T, void, typename std::enable_if<std::is_pointer<_Tp>::value, void>::type>::Get()’:
/home/<user>/nodable/libs/mirror/tools/../mirror_base.h:353:11: error: ‘PointerTypeDescInitializer’ does not name a type
  353 |    static PointerTypeDescInitializer<T> s_pointerTypeDescInitializer;
      |           ^~~~~~~~~~~~~~~~~~~~~~~~~~
/home/<user>/nodable/libs/mirror/tools/../mirror_base.h:363:11: error: there are no arguments to ‘GetTypeSet’ that depend on a template parameter, so a declaration of ‘GetTypeSet’ must be available [-fpermissive]
  363 |    return GetTypeSet()->findTypeByID(GetTypeID<T>());
      |           ^~~~~~~~~~
/home/<user>/nodable/libs/mirror/mirror_base.h: In constructor ‘mirror::TVirtualTypeWrapperBase<T, typename std::enable_if<(std::is_function< <template-parameter-1-1> >::value || std::is_void<_Tp>::value), void>::type>::TVirtualTypeWrapperBase()’:
/home/<user>/nodable/libs/mirror/mirror_base.h:90:4: error: ‘m_typeID’ was not declared in this scope; did you mean ‘GetTypeID’?
   90 |    m_typeID = GetTypeID<T>();
      |    ^~~~~~~~
      |    GetTypeID
/home/<user>/nodable/libs/mirror/tools/../mirror_base.h: In function ‘mirror::Class* mirror::GetClass()’:
/home/<user>/nodable/libs/mirror/tools/../mirror_base.h:393:15: warning: invalid use of incomplete type ‘class mirror::TypeDesc’
  393 |   if (typeDesc->getType() == Type_Class)
      |               ^~
In file included from /home/<user>/nodable/libs/mirror/tools/BinarySerializer.cpp:1:
/home/<user>/nodable/libs/mirror/tools/BinarySerializer.h:11:8: note: forward declaration of ‘class mirror::TypeDesc’
   11 |  class TypeDesc;
      |        ^~~~~~~~
In file included from /home/<user>/nodable/libs/mirror/tools/../mirror.h:12,
                 from /home/<user>/nodable/libs/mirror/tools/BinarySerializer.cpp:5:
/home/<user>/nodable/libs/mirror/tools/../mirror_base.h:395:39: error: invalid static_cast from type ‘mirror::TypeDesc*’ to type ‘mirror::Class*’
  395 |    return static_cast<Class*>(typeDesc);
      |                                       ^
In file included from /home/<user>/nodable/libs/mirror/tools/BinarySerializer.cpp:1:
/home/<user>/nodable/libs/mirror/tools/BinarySerializer.h:10:8: note: class type ‘mirror::Class’ is incomplete
   10 |  class Class;
      |        ^~~~~
/home/<user>/nodable/libs/mirror/tools/BinarySerializer.h:11:8: note: class type ‘mirror::TypeDesc’ is incomplete
   11 |  class TypeDesc;
      |        ^~~~~~~~
In file included from /home/<user>/nodable/libs/mirror/tools/../mirror.h:12,
                 from /home/<user>/nodable/libs/mirror/tools/BinarySerializer.cpp:5:
/home/<user>/nodable/libs/mirror/tools/../mirror_base.h: In function ‘DestType mirror::Cast(SourceType)’:
/home/<user>/nodable/libs/mirror/tools/../mirror_base.h:435:17: warning: invalid use of incomplete type ‘class mirror::Class’
  435 |    if (destClass->isChildOf(sourceClass) // upcast
      |                 ^~
In file included from /home/<user>/nodable/libs/mirror/tools/BinarySerializer.cpp:1:
/home/<user>/nodable/libs/mirror/tools/BinarySerializer.h:10:8: note: forward declaration of ‘class mirror::Class’
   10 |  class Class;
      |        ^~~~~
In file included from /home/<user>/nodable/libs/mirror/tools/../mirror.h:12,
                 from /home/<user>/nodable/libs/mirror/tools/BinarySerializer.cpp:5:
/home/<user>/nodable/libs/mirror/tools/../mirror_base.h:436:19: warning: invalid use of incomplete type ‘class mirror::Class’
  436 |     || sourceClass->isChildOf(destClass)) // downcast
      |                   ^~
In file included from /home/<user>/nodable/libs/mirror/tools/BinarySerializer.cpp:1:
/home/<user>/nodable/libs/mirror/tools/BinarySerializer.h:10:8: note: forward declaration of ‘class mirror::Class’
   10 |  class Class;
      |        ^~~~~
/home/<user>/nodable/libs/mirror/mirror_base.h:91:4: error: ‘m_size’ was not declared in this scope; did you mean ‘dysize’?
   91 |    m_size = 0;
      |    ^~~~~~
      |    dysize
/home/<user>/nodable/libs/mirror/mirror_base.h: At global scope:
/home/<user>/nodable/libs/mirror/mirror_base.h:97:2: error: expected class-name before ‘{’ token
   97 |  {
      |  ^
In file included from /home/<user>/nodable/libs/mirror/tools/../mirror.h:12,
                 from /home/<user>/nodable/libs/mirror/tools/BinarySerializer.cpp:5:
/home/<user>/nodable/libs/mirror/tools/../mirror_base.h: In static member function ‘static void mirror::FunctionArgumentsUnpiler<F, T, I, Top>::Unpile(mirror::StaticFunctionTypeDesc*)’:
/home/<user>/nodable/libs/mirror/tools/../mirror_base.h:468:13: warning: invalid use of incomplete type ‘class mirror::StaticFunctionTypeDesc’
  468 |    _function->addArgument<ArgumentType>();
      |             ^~
/home/<user>/nodable/libs/mirror/tools/../mirror_base.h:465:28: note: forward declaration of ‘class mirror::StaticFunctionTypeDesc’
  465 |   static void Unpile(class StaticFunctionTypeDesc* _function)
      |                            ^~~~~~~~~~~~~~~~~~~~~~
/home/<user>/nodable/libs/mirror/tools/../mirror_base.h:468:39: error: expected primary-expression before ‘>’ token
  468 |    _function->addArgument<ArgumentType>();
      |                                       ^
/home/<user>/nodable/libs/mirror/tools/../mirror_base.h:468:41: error: expected primary-expression before ‘)’ token
  468 |    _function->addArgument<ArgumentType>();
      |                                         ^
/home/<user>/nodable/libs/mirror/mirror_base.h: In constructor ‘mirror::TVirtualTypeWrapperBase<void>::TVirtualTypeWrapperBase()’:
/home/<user>/nodable/libs/mirror/mirror_base.h:101:4: error: ‘m_typeID’ was not declared in this scope; did you mean ‘GetTypeID’?
  101 |    m_typeID = GetTypeID<void>();
      |    ^~~~~~~~
      |    GetTypeID
/home/<user>/nodable/libs/mirror/mirror_base.h:102:4: error: ‘m_size’ was not declared in this scope; did you mean ‘dysize’?
  102 |    m_size = 0;
      |    ^~~~~~
      |    dysize
/home/<user>/nodable/libs/mirror/tools/../mirror_base.h: In static member function ‘static void mirror::FunctionArgumentsFiller<I, Top>::Fill(C*, const char**, size_t, std::tuple<_Args2 ...>&)’:
/home/<user>/nodable/libs/mirror/tools/../mirror_base.h:508:4: error: ‘ClassMember’ was not declared in this scope
  508 |    ClassMember* member = c->findMemberByName(_memberNames[I]);
      |    ^~~~~~~~~~~
/home/<user>/nodable/libs/mirror/mirror_base.h: At global scope:
/home/<user>/nodable/libs/mirror/mirror_base.h:130:19: error: expected initializer before ‘TypeDesc’
  130 |  class MIRROR_API TypeDesc
      |                   ^~~~~~~~
/home/<user>/nodable/libs/mirror/mirror_base.h:157:19: error: expected initializer before ‘PointerTypeDesc’
  157 |  class MIRROR_API PointerTypeDesc : public TypeDesc
      |                   ^~~~~~~~~~~~~~~
/home/<user>/nodable/libs/mirror/mirror_base.h:168:19: error: expected initializer before ‘FixedSizeArrayTypeDesc’
  168 |  class MIRROR_API FixedSizeArrayTypeDesc : public TypeDesc
      |                   ^~~~~~~~~~~~~~~~~~~~~~
/home/<user>/nodable/libs/mirror/mirror_base.h:181:19: error: expected initializer before ‘ClassMember’
  181 |  class MIRROR_API ClassMember
      |                   ^~~~~~~~~~~
/home/<user>/nodable/libs/mirror/mirror_base.h:205:19: error: expected initializer before ‘Class’
  205 |  class MIRROR_API Class : public TypeDesc
      |                   ^~~~~
/home/<user>/nodable/libs/mirror/mirror_base.h:235:19: error: expected initializer before ‘EnumValue’
  235 |  class MIRROR_API EnumValue
      |                   ^~~~~~~~~
/home/<user>/nodable/libs/mirror/mirror_base.h:249:19: error: expected initializer before ‘Enum’
  249 |  class MIRROR_API Enum : public TypeDesc
      |                   ^~~~
/home/<user>/nodable/libs/mirror/tools/../mirror_base.h:508:17: error: ‘member’ was not declared in this scope; did you mean ‘memmem’?
  508 |    ClassMember* member = c->findMemberByName(_memberNames[I]);
      |                 ^~~~~~
      |                 memmem
/home/<user>/nodable/libs/mirror/tools/../mirror_base.h:508:27: warning: invalid use of incomplete type ‘class mirror::Class’
  508 |    ClassMember* member = c->findMemberByName(_memberNames[I]);
      |                           ^~
In file included from /home/<user>/nodable/libs/mirror/tools/BinarySerializer.cpp:1:
/home/<user>/nodable/libs/mirror/tools/BinarySerializer.h:10:8: note: forward declaration of ‘class mirror::Class’
   10 |  class Class;
      |        ^~~~~
/home/<user>/nodable/libs/mirror/mirror_base.h:299:2: error: ‘Enum’ does not name a type; did you mean ‘enum’?
  299 |  Enum* GetEnum()
      |  ^~~~
      |  enum
/home/<user>/nodable/libs/mirror/mirror_base.h:308:19: error: expected initializer before ‘TypeSet’
  308 |  class MIRROR_API TypeSet
      |                   ^~~~~~~
/home/<user>/nodable/libs/mirror/mirror_base.h: In static member function ‘static mirror::TypeDesc* mirror::TypeDescGetter<T, IsArray, IsPointer, IsEnum, IsFunction>::Get()’:
/home/<user>/nodable/libs/mirror/mirror_base.h:333:11: error: there are no arguments to ‘GetTypeSet’ that depend on a template parameter, so a declaration of ‘GetTypeSet’ must be available [-fpermissive]
  333 |    return GetTypeSet()->findTypeByID(typeID);
      |           ^~~~~~~~~~
/home/<user>/nodable/libs/mirror/mirror_base.h:333:11: note: (if you use ‘-fpermissive’, G++ will accept your code, but allowing the use of an undeclared name is deprecated)
In file included from /home/<user>/nodable/libs/mirror/tools/../mirror.h:12,
                 from /home/<user>/nodable/libs/mirror/tools/BinarySerializer.cpp:5:
/home/<user>/nodable/libs/mirror/tools/../mirror_base.h: In function ‘typename mirror::FunctionTraits<NotAFunction>::result mirror::CallFunctionWithClassMembersAsArguments(F, C*, const char**, size_t)’:
/home/<user>/nodable/libs/mirror/tools/../mirror_base.h:532:76: error: type/value mismatch at argument 1 in template parameter list for ‘template<class _Tp> struct std::tuple_size’
  532 |   constexpr size_t argumentsCount = std::tuple_size<FunctionTraits<F>::args>::value;
      |                                                                            ^
/home/<user>/nodable/libs/mirror/tools/../mirror_base.h:532:76: note:   expected a type, got ‘mirror::FunctionTraits<F>::args’
/home/<user>/nodable/libs/mirror/tools/../mirror_base.h:534:44: error: the value of ‘argumentsCount’ is not usable in a constant expression
  534 |   FunctionArgumentsFiller<0, argumentsCount>::Fill(_classInstance, _memberNames, _memberCount, arguments);
      |                                            ^
/home/<user>/nodable/libs/mirror/tools/../mirror_base.h:534:44: note: in template argument for type ‘long unsigned int’
/home/<user>/nodable/libs/mirror/mirror_base.h: In static member function ‘static mirror::TypeDesc* mirror::TypeDescGetter<T, typename std::enable_if<std::is_array< <template-parameter-1-1> >::value, void>::type>::Get()’:
/home/<user>/nodable/libs/mirror/mirror_base.h:342:26: error: expected nested-name-specifier before ‘typename’
  342 |    using type = typename typename std::remove_extent<T>::type;
      |                          ^~~~~~~~
/home/<user>/nodable/libs/mirror/tools/../mirror_base.h:534:105: error: expression list treated as compound expression in initializer [-fpermissive]
  534 |   FunctionArgumentsFiller<0, argumentsCount>::Fill(_classInstance, _memberNames, _memberCount, arguments);
      |                                                                                                         ^
/home/<user>/nodable/libs/mirror/tools/../mirror_base.h: At global scope:
/home/<user>/nodable/libs/mirror/tools/../mirror_base.h:541:19: error: expected initializer before ‘StaticFunctionTypeDesc’
  541 |  class MIRROR_API StaticFunctionTypeDesc : public TypeDesc
      |                   ^~~~~~~~~~~~~~~~~~~~~~
/home/<user>/nodable/libs/mirror/tools/../mirror_base.h: In static member function ‘static mirror::TypeDesc* mirror::TypeDescGetter<T, void, void, void, typename std::enable_if<std::is_function< <template-parameter-1-1> >::value, void>::type>::Get()’:
/home/<user>/nodable/libs/mirror/tools/../mirror_base.h:571:25: error: there are no arguments to ‘GetTypeSet’ that depend on a template parameter, so a declaration of ‘GetTypeSet’ must be available [-fpermissive]
  571 |    TypeDesc* typeDesc = GetTypeSet()->findTypeByID(GetTypeID<T>());
      |                         ^~~~~~~~~~
/home/<user>/nodable/libs/mirror/tools/../mirror_base.h:577:5: error: there are no arguments to ‘GetTypeSet’ that depend on a template parameter, so a declaration of ‘GetTypeSet’ must be available [-fpermissive]
  577 |     GetTypeSet()->addType(staticFunctionTypeDesc);
      |     ^~~~~~~~~~
/home/<user>/nodable/libs/mirror/tools/../mirror_base.h:581:27: warning: invalid use of incomplete type ‘class mirror::StaticFunctionTypeDesc’
  581 |     staticFunctionTypeDesc->setReturnType<ReturnType>();
      |                           ^~
/home/<user>/nodable/libs/mirror/tools/../mirror_base.h:465:28: note: forward declaration of ‘class mirror::StaticFunctionTypeDesc’
  465 |   static void Unpile(class StaticFunctionTypeDesc* _function)
      |                            ^~~~~~~~~~~~~~~~~~~~~~
/home/<user>/nodable/libs/mirror/tools/../mirror_base.h:581:53: error: expected primary-expression before ‘>’ token
  581 |     staticFunctionTypeDesc->setReturnType<ReturnType>();
      |                                                     ^
/home/<user>/nodable/libs/mirror/tools/../mirror_base.h:581:55: error: expected primary-expression before ‘)’ token
  581 |     staticFunctionTypeDesc->setReturnType<ReturnType>();
      |                                                       ^
/home/<user>/nodable/libs/mirror/tools/../mirror_base.h: In constructor ‘mirror::TypeDescInitializer<T, HasFactory>::TypeDescInitializer(mirror::Type, const char*)’:
/home/<user>/nodable/libs/mirror/tools/../mirror_base.h:605:4: error: there are no arguments to ‘GetTypeSet’ that depend on a template parameter, so a declaration of ‘GetTypeSet’ must be available [-fpermissive]
  605 |    GetTypeSet()->addType(typeDesc);
      |    ^~~~~~~~~~
/home/<user>/nodable/libs/mirror/tools/../mirror_base.h: In destructor ‘mirror::TypeDescInitializer<T, HasFactory>::~TypeDescInitializer()’:
/home/<user>/nodable/libs/mirror/tools/../mirror_base.h:609:4: error: there are no arguments to ‘GetTypeSet’ that depend on a template parameter, so a declaration of ‘GetTypeSet’ must be available [-fpermissive]
  609 |    GetTypeSet()->removeType(typeDesc);
      |    ^~~~~~~~~~
/home/<user>/nodable/libs/mirror/tools/../mirror_base.h: In constructor ‘mirror::ClassInitializer<T, HasFactory>::ClassInitializer()’:
/home/<user>/nodable/libs/mirror/tools/../mirror_base.h:621:4: error: there are no arguments to ‘GetTypeSet’ that depend on a template parameter, so a declaration of ‘GetTypeSet’ must be available [-fpermissive]
  621 |    GetTypeSet()->addType(clss);
      |    ^~~~~~~~~~
/home/<user>/nodable/libs/mirror/tools/../mirror_base.h: In destructor ‘mirror::ClassInitializer<T, HasFactory>::~ClassInitializer()’:
/home/<user>/nodable/libs/mirror/tools/../mirror_base.h:625:4: error: there are no arguments to ‘GetTypeSet’ that depend on a template parameter, so a declaration of ‘GetTypeSet’ must be available [-fpermissive]
  625 |    GetTypeSet()->removeType(clss);
      |    ^~~~~~~~~~
/home/<user>/nodable/libs/mirror/mirror_base.h:343:11: error: ‘FixedSizeArrayTypeDesc’ does not name a type
  343 |    static FixedSizeArrayTypeDesc s_fixedSizeArrayTypeDesc(TypeDescGetter<type>::Get(), std::extent<T>::value , new TVirtualTypeWrapper<T>());
      |           ^~~~~~~~~~~~~~~~~~~~~~
/home/<user>/nodable/libs/mirror/tools/../mirror_base.h: At global scope:
/home/<user>/nodable/libs/mirror/tools/../mirror_base.h:645:3: error: ‘PointerTypeDesc’ does not name a type
  645 |   PointerTypeDesc* typeDesc = nullptr;
      |   ^~~~~~~~~~~~~~~
/home/<user>/nodable/libs/mirror/tools/../mirror_base.h: In constructor ‘mirror::PointerTypeDescInitializer<T>::PointerTypeDescInitializer()’:
/home/<user>/nodable/libs/mirror/tools/../mirror_base.h:637:4: error: ‘typeDesc’ was not declared in this scope; did you mean ‘TypeDesc’?
  637 |    typeDesc = new PointerTypeDesc(TypeDescGetter<type>::Get()->getTypeID(), new TVirtualTypeWrapper<T>());

(...)

Suggestion - mirror an external defined member

It would be great to add a mechanism to serialize members when you can't modify it's class (external library for example).

Here a small example:

struct A {
   ExternalClass m_member; // ExternalClass is included in a lib or from external files that you don't want to modify
   MIRROR_CLASS(A)
   (
      MIRROR_MEMBER(m_member); // will not work
   );
}

I propose for example:

struct A {
   ExternalClass m_member; // ExternalClass is included in a lib or from external files that you don't want to modify

   MIRROR_CLASS(A)
   (
      MIRROR_MEMBER(m_member, &methodToSerialize, &methodToDeserialize);
   );
}

These two methods should be defined by the user.

We can also imagine an other solution by defining MIRROR_CLASS and _MEMBER outside the class/struct. With internal classes, it only requires to add friend keyword, for external we have to use getter/setters if they exist of course...

What do you think of that ?

missing space in MIRROR_CLASS_NOVIRTUAL causing compilation failure under MSVC 19

#define MIRROR_CLASS_NOVIRTUAL(_class, ...)\
public:\
	::mirror::Class* getClass() const { return _class::GetClass(); }\
	__MIRROR_CLASS_CONSTRUCTION(_class, __VA_ARGS__)

needs a space after public: to avoid a triple : when preprocessed.

I suggest to do the same with MIRROR_CLASS to avoid eventual future bugs if the first line do not start with the keyword static.

For information, error was hard to understand since I'm not under windows right now, I'm "debugging" using the CI console:

View.cpp
D:\a\Nodable\Nodable\src\app\include\nodable/Settings.h(63,1): error C2059: syntax error: ';' [D:\a\Nodable\build\src\app\nodable_app.vcxproj]

image

Fortunately, CLion gave me the preprocessed output:
image

I don't understand why GCC and clang under linux are compiling this fine.

MIRROR_PARENT avec une classe qui n'est pas parente

(Peut être que tu as déjà corrigé ça, je tappe sur le commit: 26e5102 du 3 Mai 2020 (plus 4 commits que je t'avais soumis pour des include de cstring))

J'ai remarqué une erreur que j'ai faite à l'instant dans le fichier: https://raw.githubusercontent.com/berdal84/Nodable/dev/0.8/sources/Node/GraphNode.h

Les faits:

  • GraphNode hérite de Node (qui hérite de Object).
  • je déclare par erreur Component (qui hérite de Object) comme parent de GraphNode.
  • ça compile sans erreur avec g++

Je suggère une static assert.

How to get a the type T of a given a TypeDesc* ?

I would like to get the type of a TypeDesc, for example something like that:

int myVar = 0;
TypeDesc* t = mirror::TypeDescGetter<decltype(myVar)>().Get();
using T = mirror::TypeDescT(t)::type;
T myOtherVar = 1; // T must be int

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.