~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/plugin/plugin.h

  • Committer: Monty Taylor
  • Date: 2008-12-17 04:54:32 UTC
  • mto: (685.1.38 devel) (713.1.1 devel)
  • mto: This revision was merged to the branch mainline in revision 713.
  • Revision ID: monty@inaugust.com-20081217045432-dw4425razy7do46i
Fixed bool. No more sql_mode.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
 
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3
 
 *
4
 
 *  Copyright (C) 2009 Sun Microsystems, Inc.
5
 
 *
6
 
 *  This program is free software; you can redistribute it and/or modify
7
 
 *  it under the terms of the GNU General Public License as published by
8
 
 *  the Free Software Foundation; version 2 of the License.
9
 
 *
10
 
 *  This program is distributed in the hope that it will be useful,
11
 
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 
 *  GNU General Public License for more details.
14
 
 *
15
 
 *  You should have received a copy of the GNU General Public License
16
 
 *  along with this program; if not, write to the Free Software
17
 
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18
 
 */
19
 
 
20
 
 
21
 
 
22
 
#ifndef DRIZZLED_PLUGIN_PLUGIN_H
23
 
#define DRIZZLED_PLUGIN_PLUGIN_H
24
 
 
25
 
#include <string>
26
 
#include <vector>
27
 
#include <map>
28
 
 
29
 
#include "drizzled/visibility.h"
30
 
 
31
 
namespace drizzled
32
 
{
33
 
 
34
 
class Session;
35
 
 
36
 
namespace module
37
 
{
38
 
class Module;
39
 
}
40
 
 
41
 
namespace plugin
42
 
{
43
 
 
44
 
class DRIZZLED_API Plugin
45
 
{
46
 
private:
47
 
  const std::string _name;
48
 
  bool _is_active;
49
 
  module::Module *_module;
50
 
  const std::string _type_name;
51
 
 
52
 
  Plugin();
53
 
  Plugin(const Plugin&);
54
 
  Plugin& operator=(const Plugin &);
55
 
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
 
 
60
 
  explicit Plugin(const std::string &name, const std::string &type_name);
61
 
  virtual ~Plugin() {}
62
 
 
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
 
  void activate()
82
 
  {
83
 
    _is_active= true;
84
 
  }
85
 
 
86
 
  void deactivate()
87
 
  {
88
 
    _is_active= false;
89
 
  }
90
 
 
91
 
  bool isActive() const
92
 
  {
93
 
    return _is_active;
94
 
  }
95
 
 
96
 
  const std::string &getName() const
97
 
  {
98
 
    return _name;
99
 
  } 
100
 
 
101
 
  void setModule(module::Module *module)
102
 
  {
103
 
    _module= module;
104
 
  }
105
 
 
106
 
  const std::string& getTypeName() const
107
 
  {
108
 
    return _type_name;
109
 
  }
110
 
 
111
 
  virtual bool removeLast() const
112
 
  {
113
 
    return false;
114
 
  }
115
 
 
116
 
  const std::string& getModuleName() const;
117
 
};
118
 
} /* end namespace plugin */
119
 
} /* end namespace drizzled */
120
 
 
121
 
#endif /* DRIZZLED_PLUGIN_PLUGIN_H */