Project

General

Profile

Actions

Bug #1181

open

register factories bug

Added by Jules Waldhart over 6 years ago. Updated over 6 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
-
Start date:
2018-05-24
Due date:
% Done:

0%

Estimated time:

Description

Need to define the macro to register factories that way:

#define CONCAT_IMPL(x,y) x##y
#define MACRO_CONCAT(x,y) CONCAT_IMPL(x,y)
//credits to github.com/ros/class_loader for the macro
#define LOCALPATH_REGISTER_CREATOR_INTERNAL(Derived, UniqueID) \
namespace \
{\
  struct MACRO_CONCAT(ProxyExec,UniqueID) \
  {\
    typedef  Derived _derived; \
    MACRO_CONCAT(ProxyExec,UniqueID)() \
    { \
      ::move4d::API::LocalpathFactory::instance()->registerFactory(#Derived, new ::move4d::API::LocalPathBaseCreator<_derived>()); \
    }\
  };\
  static MACRO_CONCAT(ProxyExec,UniqueID) MACRO_CONCAT(g_register_plugin_,UniqueID);\
}
#define LOCALPATH_REGISTER_FACTORY(localpath_class)\
    LOCALPATH_REGISTER_CREATOR_INTERNAL(localpath_class,__COUNTER__)

Actions #2

Updated by Jules Waldhart over 6 years ago

Or better, this way:

//credits to github.com/ros/class_loader for the macro
#define LOCALPATH_REGISTER_CREATOR_INTERNAL(Derived, UniqueID) \
namespace \
{\
  struct ProxyExec ## UniqueID \
  {\
    typedef  Derived _derived; \
    ProxyExec ## UniqueID() \
    { \
      ::move4d::API::LocalpathFactory::instance()->registerFactory(#Derived, new ::move4d::API::LocalPathBaseCreator<_derived>()); \
    }\
  };\
  static ProxyExec ## UniqueID g_register_plugin_ ## UniqueID;\
}

//this one needed to have the needed supplementary level of macro expansion
#define LOCALPATH_REGISTER_CREATOR_INTERNAL_HOP1(Derived,UniqueID) \
    LOCALPATH_REGISTER_CREATOR_INTERNAL(Derived,UniqueID)
#define LOCALPATH_REGISTER_FACTORY(localpath_class)\
    LOCALPATH_REGISTER_CREATOR_INTERNAL_HOP1(localpath_class,__COUNTER__)

Actions #3

Updated by Jules Waldhart over 6 years ago

fixed for LocalPath and Path by move4d|9305e7cb, branch fix1181

Actions #4

Updated by Jules Waldhart over 6 years ago

  • Status changed from New to Resolved

merged in devel branch

Actions

Also available in: Atom PDF