~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/plugin/plugin.h

pandora-build v0.71. Added check for avahi.

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
 
23
23
#include <string>
24
24
#include <vector>
25
 
#include <map>
26
25
 
27
26
namespace drizzled
28
27
{
29
 
namespace module
 
28
namespace plugin
30
29
{
 
30
 
31
31
class Module;
32
 
}
33
 
 
34
 
namespace plugin
35
 
{
36
32
 
37
33
class Plugin
38
34
{
39
35
private:
40
 
  const std::string _name;
41
 
  bool _is_active;
42
 
  module::Module *_module;
43
 
  const std::string _type_name;
 
36
  const std::string name;
 
37
  std::vector<std::string> aliases;
 
38
  bool is_active;
 
39
  Module *module;
 
40
  const std::string type_name;
44
41
 
45
42
  Plugin();
46
43
  Plugin(const Plugin&);
47
44
  Plugin& operator=(const Plugin &);
48
45
public:
49
 
  typedef std::map<std::string, Plugin *> map;
50
 
  typedef std::vector<Plugin *> vector;
51
46
 
52
 
  explicit Plugin(const std::string &name, const std::string &type_name);
 
47
  explicit Plugin(std::string in_name, std::string in_type_name);
53
48
  virtual ~Plugin() {}
54
49
 
55
 
  /*
56
 
   * This method is called for all plug-ins on shutdown,
57
 
   * _before_ the plug-ins are deleted. It can be used
58
 
   * when shutdown code references other plug-ins.
59
 
   */
60
 
  virtual void shutdownPlugin()
61
 
  {
62
 
  }
63
 
 
64
 
  // This is run after all plugins have been initialized.
65
 
  virtual void prime()
66
 
  {
67
 
  }
68
 
 
69
50
  void activate()
70
51
  {
71
 
    _is_active= true;
 
52
    is_active= true;
72
53
  }
73
54
 
74
55
  void deactivate()
75
56
  {
76
 
    _is_active= false;
 
57
    is_active= false;
77
58
  }
78
59
 
79
60
  bool isActive() const
80
61
  {
81
 
    return _is_active;
 
62
    return is_active;
82
63
  }
83
64
 
84
65
  const std::string &getName() const
85
66
  {
86
 
    return _name;
 
67
    return name;
87
68
  } 
88
69
 
89
 
  void setModule(module::Module *module)
90
 
  {
91
 
    _module= module;
 
70
  const std::vector<std::string>& getAliases() const
 
71
  {
 
72
    return aliases;
 
73
  }
 
74
 
 
75
  void addAlias(std::string alias)
 
76
  {
 
77
    aliases.push_back(alias);
 
78
  }
 
79
 
 
80
  void setModule(Module *module_arg)
 
81
  {
 
82
    module= module_arg;
92
83
  }
93
84
 
94
85
  const std::string& getTypeName() const
95
86
  {
96
 
    return _type_name;
 
87
    return type_name;
97
88
  }
98
89
 
99
90
  const std::string& getModuleName() const;