#include "IqrfLogging.h"
#include <memory>
#include <string>
#include <map>
Go to the source code of this file.
|
#define | INIT_COMPONENT(IComponentClassName, ComponentClassName) |
| Convenient macro to register component interface and implementation. More...
|
|
◆ INIT_COMPONENT
#define INIT_COMPONENT |
( |
|
IComponentClassName, |
|
|
|
ComponentClassName |
|
) |
| |
Value:std::unique_ptr<IComponentClassName> __launch_create_##ComponentClassName(const std::string& iname) { \
return std::unique_ptr<IComponentClassName>(new ComponentClassName(iname)); } \
\
class __Loader_##ComponentClassName { \
public: \
__Loader_##ComponentClassName() {
\ (void*)&__launch_create_##ComponentClassName); \
} \
}; \
\
void init_##ComponentClassName() { \
static __Loader_##ComponentClassName cs; \
}
static StaticBuildFunctionMap & get()
StaticBuildFunctionMap singleton getter.
Definition: LaunchUtils.h:30
void setFunction(const std::string &fceName, void *fcePtr)
Set pointer to function.
Definition: LaunchUtils.h:59
Convenient macro to register component interface and implementation.
- Parameters
-
IComponentClassName | component interface name |
ComponentClassName | component implementation name |
Declare and define define __launch_create_##ComponentClassName() to create implementation declare __Loader_##ComponentClassName class for function registration define init_##ComponentClassName() with static class for function registration This macro shall be added once to a component source code and init_##ComponentClassName() shall be called at the very beginning of application in case of static build