~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/module/registry.h

  • Committer: Brian Aker
  • Date: 2010-05-21 18:25:00 UTC
  • mfrom: (1530.2.10)
  • Revision ID: brian@gaz-20100521182500-c30dbqd2ko56cf56
Merge Monty

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18
18
 */
19
19
 
20
 
#ifndef DRIZZLED_PLUGIN_REGISTRY_H
21
 
#define DRIZZLED_PLUGIN_REGISTRY_H
 
20
#ifndef DRIZZLED_MODULE_REGISTRY_H
 
21
#define DRIZZLED_MODULE_REGISTRY_H
22
22
 
23
23
#include <string>
24
24
#include <vector>
33
33
{
34
34
namespace plugin
35
35
{
 
36
class Plugin;
 
37
}
 
38
 
 
39
namespace module
 
40
{
36
41
class Module;
37
 
class Plugin;
38
42
class Library;
39
43
 
40
44
class Registry
42
46
private:
43
47
  std::map<std::string, Library *> library_map;
44
48
  std::map<std::string, Module *> module_map;
45
 
  std::map<std::string, Plugin *> plugin_registry;
 
49
  std::map<std::string, plugin::Plugin *> plugin_registry;
46
50
 
47
51
  Registry()
48
52
   : module_map(),
54
58
  ~Registry();
55
59
public:
56
60
 
57
 
  static plugin::Registry& singleton()
 
61
  static Registry& singleton()
58
62
  {
59
 
    static plugin::Registry *registry= new plugin::Registry();
 
63
    static Registry *registry= new Registry();
60
64
    return *registry;
61
65
  }
62
66
 
69
73
 
70
74
  std::vector<Module *> getList(bool active);
71
75
 
72
 
  const std::map<std::string, Plugin *> &getPluginsMap() const
 
76
  const std::map<std::string, plugin::Plugin *> &getPluginsMap() const
73
77
  {
74
78
    return plugin_registry;
75
79
  }
79
83
    return module_map;
80
84
  }
81
85
 
82
 
  Library *addLibrary(const std::string &plugin_name);
 
86
  Library *addLibrary(const std::string &plugin_name, bool builtin= false);
83
87
  void removeLibrary(const std::string &plugin_name);
84
88
  Library *findLibrary(const std::string &plugin_name) const;
85
89
 
 
90
  void shutdownModules();
 
91
 
86
92
  template<class T>
87
93
  void add(T *plugin)
88
94
  {
106
112
                    plugin->getName().c_str());
107
113
      unireg_abort(1);
108
114
    }
109
 
    plugin_registry.insert(std::pair<std::string, Plugin *>(plugin_name, plugin));
 
115
    plugin_registry.insert(std::pair<std::string, plugin::Plugin *>(plugin_name, plugin));
110
116
  }
111
117
 
112
118
  template<class T>
122
128
 
123
129
};
124
130
 
125
 
} /* end namespace plugin */
126
 
} /* end namespace drizzled */
127
 
#endif /* DRIZZLED_PLUGIN_REGISTRY_H */
 
131
} /* namespace module */
 
132
} /* namespace drizzled */
 
133
#endif /* DRIZZLED_MODULE_REGISTRY_H */