10 #ifndef PLUGIN_TEMPLATE_HPP_
11 #define PLUGIN_TEMPLATE_HPP_
17 namespace OpenAB_Plugin{
19 template<
typename __C>
23 Node(__C*p,std::string& name):p(p),next(NULL),name(name){};
24 Node(__C*p,std::string& name,
Node*n):p(p),next(n),name(name){};
35 template<
typename __C>
44 current = current->getNext();
55 template<
typename __C>
93 if (0 == l->
getElement()->getName().compare(name))
104 LOG_FUNC() <<
" Erase: " <<
" \"" << name <<
"\""<<std::endl;
108 if (0 == l->
getElement()->getName().compare(name))
132 template<
typename __C,
typename __P>
146 LOG_FUNC() <<
" Adding new " <<
typeid(__C).name() <<
" \"" << name <<
"\""<<std::endl;
150 if (NULL != loadedCb)
182 virtual bool fromJSON(
const std::string& json) = 0;
183 virtual std::string
toJSON()
const = 0;
193 #define EXPORT_PLUGIN_INTERFACE(PluginNamespace, PluginInterface, PluginParameters) \
194 namespace PluginNamespace { \
195 Factory::typeList factories; \
197 Factory::PluginLoadedCallback Factory::loadedCb = NULL; \
200 Factory::typeList Factory::factories = PluginNamespace::factories;\
210 #define DECLARE_PLUGIN_INTERFACE(PluginNamespace, PluginInterface, PluginParameters) \
211 namespace PluginNamespace { \
212 typedef OpenAB_Plugin::Factory< PluginInterface , PluginParameters > Factory; \
221 #define REGISTER_PLUGIN_FACTORY(PluginFactory) \
223 PluginFactory factory; \
228 #endif // PLUGIN_TEMPLATE_HPP_
bool operator!=(NodeIterator< __C > it)
Definition: Plugin.hpp:48
Definition: Plugin.hpp:176
virtual __C * newIstance(const __P &)=0
NodeIterator(Node< __C > *c)
Definition: Plugin.hpp:39
virtual bool fromJSON(const std::string &json)=0
LinkedList()
Definition: Plugin.hpp:62
static void setPluginLoadedCallback(PluginLoadedCallback callback)
Definition: Plugin.hpp:173
Factory(std::string name)
Constructor.
Definition: Plugin.hpp:145
~LinkedList()
Definition: Plugin.hpp:64
typeNode * findNode(std::string name)
Definition: Plugin.hpp:89
Node * getNext()
Definition: Plugin.hpp:26
NodeIterator< __C > iterator
Definition: Plugin.hpp:60
std::string getName()
Definition: Plugin.hpp:163
void eraseNode(std::string name)
Definition: Plugin.hpp:102
virtual ~Parameters()
Definition: Plugin.hpp:180
Definition: Plugin.hpp:20
static typeList factories
Definition: Plugin.hpp:172
void(* PluginLoadedCallback)(const std::string &pluginName)
Definition: Plugin.hpp:165
Definition: Plugin.hpp:36
virtual std::string toJSON() const =0
void push_front(__C *elem, std::string &name)
Definition: Plugin.hpp:84
iterator begin()
Definition: Plugin.hpp:75
Definition: Plugin.hpp:133
void setNext(Node *n)
Definition: Plugin.hpp:27
__C * operator[](std::string name)
Definition: Plugin.hpp:66
#define LOG_FUNC()
Definition: Log.hpp:147
Node(__C *p, std::string &name)
Definition: Plugin.hpp:23
__C * operator->()
Definition: Plugin.hpp:49
NodeIterator & operator++()
Definition: Plugin.hpp:41
__C * getElement()
Definition: Plugin.hpp:25
~Factory()
Destructor, virtual by default.
Definition: Plugin.hpp:159
LinkedList< Factory< __C, __P > > typeList
List of the specialized Factories.
Definition: Plugin.hpp:140
Node< __C > typeNode
Definition: Plugin.hpp:59
iterator end()
Definition: Plugin.hpp:79
Definition: Plugin.hpp:56
Node(__C *p, std::string &name, Node *n)
Definition: Plugin.hpp:24
Parameters()
Definition: Plugin.hpp:179