Defines
class_loader_register_macro.h File Reference
#include <string>
#include "class_loader/class_loader_core.h"
#include "class_loader/console_bridge_compatibility.h"
#include "console_bridge/console.h"
Include dependency graph for class_loader_register_macro.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define CLASS_LOADER_REGISTER_CLASS(Derived, Base)   CLASS_LOADER_REGISTER_CLASS_WITH_MESSAGE(Derived, Base, "")
#define CLASS_LOADER_REGISTER_CLASS_INTERNAL_HOP1_WITH_MESSAGE(Derived, Base, UniqueID, Message)   CLASS_LOADER_REGISTER_CLASS_INTERNAL_WITH_MESSAGE(Derived, Base, UniqueID, Message)
#define CLASS_LOADER_REGISTER_CLASS_INTERNAL_WITH_MESSAGE(Derived, Base, UniqueID, Message)
#define CLASS_LOADER_REGISTER_CLASS_WITH_MESSAGE(Derived, Base, Message)   CLASS_LOADER_REGISTER_CLASS_INTERNAL_HOP1_WITH_MESSAGE(Derived, Base, __COUNTER__, Message)

Define Documentation

#define CLASS_LOADER_REGISTER_CLASS (   Derived,
  Base 
)    CLASS_LOADER_REGISTER_CLASS_WITH_MESSAGE(Derived, Base, "")

This is the macro which must be declared within the source (.cpp) file for each class that is to be exported as plugin. The macro utilizes a trick where a new struct is generated along with a declaration of static global variable of same type after it. The struct's constructor invokes a registration function with the plugin system. When the plugin system loads a library with registered classes in it, the initialization of static variables forces the invocation of the struct constructors, and all exported classes are automatically registerd.

Definition at line 71 of file class_loader_register_macro.h.

#define CLASS_LOADER_REGISTER_CLASS_INTERNAL_HOP1_WITH_MESSAGE (   Derived,
  Base,
  UniqueID,
  Message 
)    CLASS_LOADER_REGISTER_CLASS_INTERNAL_WITH_MESSAGE(Derived, Base, UniqueID, Message)

Definition at line 57 of file class_loader_register_macro.h.

#define CLASS_LOADER_REGISTER_CLASS_INTERNAL_WITH_MESSAGE (   Derived,
  Base,
  UniqueID,
  Message 
)
Value:
namespace \
  { \
  struct ProxyExec ## UniqueID \
  { \
    typedef  Derived _derived; \
    typedef  Base _base; \
    ProxyExec ## UniqueID() \
    { \
      if (!std::string(Message).empty()) { \
        CONSOLE_BRIDGE_logInform("%s", Message);} \
      class_loader::class_loader_private::registerPlugin<_derived, _base>(#Derived, #Base); \
    } \
  }; \
  static ProxyExec ## UniqueID g_register_plugin_ ## UniqueID; \
  }

Definition at line 40 of file class_loader_register_macro.h.

#define CLASS_LOADER_REGISTER_CLASS_WITH_MESSAGE (   Derived,
  Base,
  Message 
)    CLASS_LOADER_REGISTER_CLASS_INTERNAL_HOP1_WITH_MESSAGE(Derived, Base, __COUNTER__, Message)

This macro is same as CLASS_LOADER_REGISTER_CLASS, but will spit out a message when the plugin is registered at library load time

Definition at line 64 of file class_loader_register_macro.h.



class_loader
Author(s): Mirza Shah
autogenerated on Thu Dec 7 2017 04:48:01