From 4c917f2e2a43ea50cd287dd322dda9d08b213b7d Mon Sep 17 00:00:00 2001 From: Gluzskiy Alexandr Date: Thu, 17 Mar 2011 21:08:25 +0200 Subject: modified: api/ec_pluginapi.h modified: api/ec_services.h modified: core/events.cpp modified: core/events.h modified: core/globals.h modified: core/main.cpp modified: core/modules.cpp modified: core/modules.h modified: plugins/example/main.cpp --- core/events.cpp | 4 ++-- core/events.h | 2 +- core/globals.h | 2 +- core/main.cpp | 1 + core/modules.cpp | 8 ++++++++ core/modules.h | 2 ++ 6 files changed, 15 insertions(+), 4 deletions(-) (limited to 'core') diff --git a/core/events.cpp b/core/events.cpp index d858696..b4a2396 100644 --- a/core/events.cpp +++ b/core/events.cpp @@ -55,7 +55,7 @@ bool RegisterEventHandler(int type, EVENT_HANDLER func) } return true; } -void* RegisterEventType(int type) +int RegisterEventType(int type) { if(!event_handlers.empty()) { @@ -64,7 +64,7 @@ void* RegisterEventType(int type) for(std::list::iterator i = event_handlers.begin(); i != end; ++i) { if((*i)->getType() == type) - return (void*)-1; + return -1; } } event_handlers.push_back(new evt_handler(type)); diff --git a/core/events.h b/core/events.h index 909efa7..1d968df 100644 --- a/core/events.h +++ b/core/events.h @@ -17,7 +17,7 @@ #ifndef EVENTS_H_INCLUDED #define EVENTS_H_INCLUDED bool RegisterEventHandler(int, EVENT_HANDLER); -void* RegisterEventType(int); +int RegisterEventType(int); class evt_handler{ public: diff --git a/core/globals.h b/core/globals.h index e9c94a1..a82e512 100644 --- a/core/globals.h +++ b/core/globals.h @@ -20,5 +20,5 @@ #define GLOBALS_H extern ACE_Log_Msg logger; - +extern int current_plugin_id; #endif \ No newline at end of file diff --git a/core/main.cpp b/core/main.cpp index 9f3e25c..03b314b 100644 --- a/core/main.cpp +++ b/core/main.cpp @@ -24,6 +24,7 @@ boost::mutex service_list_mutex; std::list event_handlers; boost::mutex event_handlers_mutex; ACE_Log_Msg logger; +int current_plugin_id = 13; bool halt_requested = false; diff --git a/core/modules.cpp b/core/modules.cpp index e5e9bc7..6eaf038 100644 --- a/core/modules.cpp +++ b/core/modules.cpp @@ -123,6 +123,9 @@ plugin::plugin(ACE_DLL *lib, PLUGININFO *info, exported_functions_s *funcs) exported_funcs = funcs; else exported_funcs = NULL; + pluginid = current_plugin_id; + plugininfo->pluginid = pluginid; + ++current_plugin_id; } plugin::~plugin() @@ -142,3 +145,8 @@ const plugin::exported_functions_s* plugin::get_exported_functions() { return exported_funcs; } + +const int plugin::get_plugin_id() +{ + return pluginid; +} diff --git a/core/modules.h b/core/modules.h index 6cdd0f6..ca61aee 100644 --- a/core/modules.h +++ b/core/modules.h @@ -45,12 +45,14 @@ public: // void set_plugin(); const PLUGININFO *get_plugininfo(); const exported_functions_s *get_exported_functions(); + const int get_plugin_id(); plugin(ACE_DLL *lib, PLUGININFO *info, exported_functions_s *funcs); ~plugin(); private: ACE_DLL *plug; exported_functions_s *exported_funcs; PLUGININFO *plugininfo; + int pluginid; }; #endif // MODULE_H_INCLUDED -- cgit v1.2.3