~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/plugin/plugin.h

  • Committer: Monty Taylor
  • Date: 2009-12-08 23:39:39 UTC
  • mto: (1240.1.8 build)
  • mto: This revision was merged to the branch mainline in revision 1241.
  • Revision ID: mordred@inaugust.com-20091208233939-w0v4o04xer9pqqhu
Make range test shut up.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
2
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3
3
 *
4
 
 *  Copyright (C) 2009 Sun Microsystems, Inc.
 
4
 *  Copyright (C) 2009 Sun Microsystems
5
5
 *
6
6
 *  This program is free software; you can redistribute it and/or modify
7
7
 *  it under the terms of the GNU General Public License as published by
17
17
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18
18
 */
19
19
 
20
 
 
21
 
 
22
20
#ifndef DRIZZLED_PLUGIN_PLUGIN_H
23
21
#define DRIZZLED_PLUGIN_PLUGIN_H
24
22
 
25
23
#include <string>
26
24
#include <vector>
27
 
#include <map>
28
 
 
29
 
#include "drizzled/visibility.h"
30
25
 
31
26
namespace drizzled
32
27
{
33
 
 
34
 
class Session;
35
 
 
36
 
namespace module
 
28
namespace plugin
37
29
{
 
30
 
38
31
class Module;
39
 
}
40
 
 
41
 
namespace plugin
42
 
{
43
 
 
44
 
class DRIZZLED_API Plugin
 
32
 
 
33
class Plugin
45
34
{
46
35
private:
47
 
  const std::string _name;
48
 
  bool _is_active;
49
 
  module::Module *_module;
50
 
  const std::string _type_name;
 
36
  const std::string name;
 
37
  bool is_active;
 
38
  Module *module;
 
39
  const std::string type_name;
51
40
 
52
41
  Plugin();
53
42
  Plugin(const Plugin&);
54
43
  Plugin& operator=(const Plugin &);
55
44
public:
56
 
  typedef std::pair<const std::string, const std::string> map_key;
57
 
  typedef std::map<const map_key, plugin::Plugin *> map;
58
 
  typedef std::vector<Plugin *> vector;
59
45
 
60
 
  explicit Plugin(const std::string &name, const std::string &type_name);
 
46
  explicit Plugin(std::string in_name, std::string in_type_name);
61
47
  virtual ~Plugin() {}
62
48
 
63
 
  /*
64
 
   * This method is called for all plug-ins on shutdown,
65
 
   * _before_ the plug-ins are deleted. It can be used
66
 
   * when shutdown code references other plug-ins.
67
 
   */
68
 
  virtual void shutdownPlugin()
69
 
  {
70
 
  }
71
 
 
72
 
  // This is run after all plugins have been initialized.
73
 
  virtual void prime()
74
 
  {
75
 
  }
76
 
 
77
 
  virtual void startup(drizzled::Session &)
78
 
  {
79
 
  }
80
 
 
81
49
  void activate()
82
50
  {
83
 
    _is_active= true;
 
51
    is_active= true;
84
52
  }
85
53
 
86
54
  void deactivate()
87
55
  {
88
 
    _is_active= false;
 
56
    is_active= false;
89
57
  }
90
58
 
91
59
  bool isActive() const
92
60
  {
93
 
    return _is_active;
 
61
    return is_active;
94
62
  }
95
63
 
96
64
  const std::string &getName() const
97
65
  {
98
 
    return _name;
 
66
    return name;
99
67
  } 
100
68
 
101
 
  void setModule(module::Module *module)
 
69
  void setModule(Module *module_arg)
102
70
  {
103
 
    _module= module;
 
71
    module= module_arg;
104
72
  }
105
73
 
106
74
  const std::string& getTypeName() const
107
75
  {
108
 
    return _type_name;
109
 
  }
110
 
 
111
 
  virtual bool removeLast() const
112
 
  {
113
 
    return false;
 
76
    return type_name;
114
77
  }
115
78
 
116
79
  const std::string& getModuleName() const;