modules.h File Reference


Detailed Description

Interface for Module Management Subsystem.

Definition in file modules.h.

#include <hn/osdep.h>
#include <hn/object.h>
#include <string>
#include <vector>
#include <map>

Include dependency graph for modules.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.


Namespaces

namespace  Detail

Defines

#define DECLARE_MODULE(Class, Name)
 Use this macro in your module's entrance class (derived from ModuleBase) to initialize Module declaration.
#define IMPLEMENT_MODULE(Class)
 Use this macro in your module's main implmenetation file to complete the module implementation.

Typedefs

typedef void * HNMODULE
 Typedef HNMODULE (HydraNode Module) depending on platform.

Define Documentation

#define DECLARE_MODULE Class,
Name   ) 
 

Value:

public:                                                              \
                static Class& instance() { return *s_instance##Class ; }     \
                Class() : ModuleBase(Name) { s_instance##Class = this; }     \
                static uint8_t getPriority() {                               \
                        return s_instance##Class->ModuleBase::getPriority(); \
                }                                                            \
                static void setPriority(ModulePriority pri) {                \
                        s_instance##Class->ModuleBase::setPriority(pri);     \
                }                                                            \
        private:                                                             \
                static Class *s_instance##Class
Use this macro in your module's entrance class (derived from ModuleBase) to initialize Module declaration.

This also makes the class a Singleton, which's instance may be retrieved using instance() member function from now on.

Parameters:
Class Name of the class being declared.
Name Short, single-word name of the class, e.g. "ed2k" or "hnsh"

Definition at line 132 of file modules.h.

#define IMPLEMENT_MODULE Class   ) 
 

Value:

Class* Class::s_instance##Class = 0;                          \
                extern "C" DLLIMPORT ModuleBase* onInit() {                   \
                        return new Class();                                   \
                } class Class
Use this macro in your module's main implmenetation file to complete the module implementation.

Parameters:
Class Name of the module's main class, derived from ModuleBase

Definition at line 152 of file modules.h.


Typedef Documentation

typedef void* HNMODULE
 

Typedef HNMODULE (HydraNode Module) depending on platform.

Definition at line 35 of file modules.h.