/[projects]/smsdaemon/PluginManager.cpp
ViewVC logotype

Contents of /smsdaemon/PluginManager.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 26 - (show annotations) (download)
Mon Jun 9 18:15:53 2008 UTC (15 years, 11 months ago) by torben
File size: 995 byte(s)
Added first basic edition of smsdaemon.

So far sending & receiving sms works and a basic sample plugin is implemented.

1
2 #include "PluginManager.h"
3
4 #include "common.h"
5
6 #include "plugins/EchoPlugin.h"
7
8
9 typedef std::map<std::string, Plugin*>::iterator MapIterator;
10
11 PluginManager::PluginManager()
12 {
13 }
14
15 PluginManager::~PluginManager()
16 {
17 }
18
19
20 void PluginManager::LoadPlugins()
21 {
22 Common* cmn = Common::instance();
23
24 static EchoPlugin echo;
25 _plugins[ echo.GetCommand() ] = &echo;
26
27
28 for(MapIterator it = _plugins.begin(); it != _plugins.end(); ++it)
29 {
30 Plugin* pl = (*it).second;
31 cmn->logMessage( std::string("Loaded plugin \"") + pl->GetCommand() + "\" - " + pl->GetDescription() );
32 }
33
34
35 }
36
37 Plugin* PluginManager::GetPlugin(const std::string& pluginname)
38 {
39 return _plugins[ pluginname ];
40 }
41
42
43 std::vector<Plugin*> PluginManager::GetPluginList()
44 {
45 typedef std::map<std::string, Plugin*>::iterator MapIterator;
46 std::vector<Plugin*> plugin_list;
47
48 for (MapIterator it = _plugins.begin(); it != _plugins.end(); ++it)
49 {
50 Plugin* pl = (*it).second;
51 plugin_list.push_back(pl);
52 }
53
54
55 return plugin_list;
56 }

  ViewVC Help
Powered by ViewVC 1.1.20