~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/module/registry.h

  • Committer: Monty Taylor
  • Date: 2010-12-06 20:03:48 UTC
  • mto: (1977.1.1 build)
  • mto: This revision was merged to the branch mainline in revision 1980.
  • Revision ID: mordred@inaugust.com-20101206200348-ds31k1kc8ougn7fg
four more variables

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>
28
28
#include "drizzled/gettext.h"
29
29
#include "drizzled/unireg.h"
30
30
#include "drizzled/errmsg_print.h"
 
31
#include "drizzled/plugin/plugin.h"
31
32
 
32
33
namespace drizzled
33
34
{
34
 
namespace plugin
 
35
 
 
36
namespace module
35
37
{
36
38
class Module;
37
 
class Plugin;
38
39
class Library;
39
40
 
40
41
class Registry
42
43
private:
43
44
  std::map<std::string, Library *> library_map;
44
45
  std::map<std::string, Module *> module_map;
45
 
  std::map<std::string, Plugin *> plugin_registry;
 
46
  std::map<std::string, plugin::Plugin *> plugin_registry;
46
47
 
47
48
  Registry()
48
49
   : module_map(),
54
55
  ~Registry();
55
56
public:
56
57
 
57
 
  static plugin::Registry& singleton()
 
58
  static Registry& singleton()
58
59
  {
59
 
    static plugin::Registry *registry= new plugin::Registry();
 
60
    static Registry *registry= new Registry();
60
61
    return *registry;
61
62
  }
62
63
 
 
64
  void copy(plugin::Plugin::vector &arg);
 
65
 
63
66
  static void shutdown();
64
67
 
65
68
  Module *find(std::string name);
66
69
 
67
70
  void add(Module *module);
68
71
 
 
72
  void remove(Module *module);
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 */