~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/plugin/registry.h

  • Committer: Monty Taylor
  • Date: 2010-03-05 21:09:24 UTC
  • mto: This revision was merged to the branch mainline in revision 1381.
  • Revision ID: mordred@inaugust.com-20100305210924-fa7lq9i3r5cheh23
Create a plugin::Context object to carry information about the plugin module
currently being loaded, and also to hide the entire Registry from the
plugin. Essentially, the context is the plugin's view of the Registry.

Show diffs side-by-side

added added

removed removed

Lines of Context:
44
44
  std::map<std::string, Module *> module_map;
45
45
  std::map<std::string, const Plugin *> plugin_registry;
46
46
 
47
 
  Module *current_module;
48
 
 
49
47
  Registry()
50
48
   : module_map(),
51
 
     plugin_registry(),
52
 
     current_module(NULL)
 
49
     plugin_registry()
53
50
  { }
54
51
 
55
52
  Registry(const Registry&);
69
66
 
70
67
  void add(Module *module);
71
68
 
72
 
  void setCurrentModule(Module *module)
73
 
  {
74
 
    current_module= module;
75
 
  }
76
 
 
77
 
  void clearCurrentModule()
78
 
  {
79
 
    current_module= NULL;
80
 
  }
81
69
 
82
70
  std::vector<Module *> getList(bool active);
83
71
 
98
86
  template<class T>
99
87
  void add(T *plugin)
100
88
  {
101
 
    plugin->setModule(current_module);
102
89
    bool failed= false;
103
90
    std::string plugin_name(plugin->getName());
104
91
    std::transform(plugin_name.begin(), plugin_name.end(),