1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188
|
#ifndef MODULE_H
#define MODULE_H
#include <kore/kore.h>
namespace kore
{
class Version;
class ModuleManager;
/**
* class kore::Module - the base structural and functional unit.
* Basically everything (expcept for some helper classes) is a module.
* This is an abstract class you may use to create your own modules.
* Also setting up a full module Info is mandatory.
*/
class KORE_API Module
{
public:
/**
* class kore::Module::Info - provides usefull information on a module.
* helper class.
*/
class KORE_API Info
{
public:
/**
* Create a Info object
* @param module - the Module object this Info is associated to
* @param name - the name of this module
* @param type - the type (class/API) of this module
* @param description - short description of the module
* @param version - the version of this module
* @param api - kore API version required by this module
*/
Info(Module* module, const char* name = 0, const char* type = 0, const char* description = 0, const Version* version = 0, const Version* api = 0);
virtual ~Info();
/**
* Gets the kore::Module this instance is associated to.
* @return - the module.
*/
virtual Module* module() const;
/**
* Gets the name of the module.
* @return - module name
*/
virtual const char* name() const;
/**
* Gets the module type.
* @return - module type.
*/
virtual const char* type() const;
/**
* Gets the module description string.
* @return - module description.
*/
virtual const char* description() const;
/**
* Gets the version of the module.
* @return - module version.
*/
virtual const Version* version() const;
/**
* Gets the API version requiered by this module.
* @return - API version
*/
virtual const Version* APIVersion() const;
protected:
/**
* Default constructor, for creating an empty Info object
*/
Info();
/**
* Convenience method for setting the Module this Info is associated to.
* @param module - the module.
*/
void setModule(Module* module = 0);
/**
* Convenience method for setting the Module name.
* @param name - module name.
*/
void setName(const char* name = 0);
/**
* Convenience method for setting the Module type.
* @param type - module type
*/
void setType(const char* type = 0);
/**
* Convenience method for setting the Module description.
* @param descr - module description
*/
void setDescription(const char* descr = 0);
/**
* Conveninence method for setting the Module version.
* @param version - module version.
*/
void setVersion(const Version* version = 0);
/**
* Convenience method for setting the API version required by this Module
* @param api - API version.
*/
void setAPIVersion(const Version* api = 0);
/**
* Convenience method for setting all the Module information "in one shot"
* @param module - the Module object this Info is associated to
* @param name - the name of this module
* @param type - the type (class/API) of this module
* @param description - short description of the module
* @param version - the version of this module
* @param api - kore API version required by this module
*/
void setInfo(Module* module = 0, const char* name = 0, const char* type = 0, const char* description = 0, const Version* version = 0, const Version* api = 0);
private:
// the module this Info is associated to
Module* _module;
// module name
const char* _name;
// module type
const char* _type;
// module description
const char* _description;
// module version
const Version* _version;
// api version required by this module
const Version* _api;
};
/**
* Callback method triggered right BEFORE REGISTERING this module to the
* ModuleManager.
* @param mm - the ModuleManager this Module will get registered to.
*/
virtual void registeringModule(ModuleManager* mm);
/**
* Callback method triggered right AFTER REGISTERING this module to the
* ModuleManager.
* @param mm - the ModuleManager this Module got registered to.
*/
virtual void moduleRegistered(ModuleManager* mm);
/**
* Callback method triggered right BEFORE UNREGISTERING this module from the
* ModuleManager.
* @param mm - the ModuleManager this Module will get unregistered from.
*/
virtual void unregisteringModule(ModuleManager* mm);
/**
* Callback method triggered right AFTER UNREGISTERING this module from the
* ModuleManager.
* @param mm - the ModuleManager this Module will get unregistered from.
*/
virtual void moduleUnregistered(ModuleManager* mm);
/**
* Gets the info for this module. The default implemetation returns the
* private _info member data, but subclasses may override that.
* @return the kore::Module::Info instance associated to this Module
*/
virtual const Info* info() const;
protected:
/**
* Default constructor. Creates an empty Module instance.
*/
Module();
/**
* Creates a module and sets its Info.
* @param info - the module info
*/
Module(const Info* info);
/**
* Destructor.
*/
virtual ~Module();
/**
* Convenience method for setting the module info.
* @param info - module info.
*/
void setInfo(const Info* info = 0);
private:
// module info
const Info* _info;
};
};
#endif
|