~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/plugin/plugin.h

  • Committer: Monty Taylor
  • Date: 2008-10-09 22:38:27 UTC
  • mto: This revision was merged to the branch mainline in revision 497.
  • Revision ID: monty@inaugust.com-20081009223827-bc9gvpiplsmvpwyq
Moved test() to its own file.
Made a new function to possibly replace int10_to_str.

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
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
 
#ifndef DRIZZLED_PLUGIN_PLUGIN_H
21
 
#define DRIZZLED_PLUGIN_PLUGIN_H
22
 
 
23
 
#include <string>
24
 
#include <vector>
25
 
#include <map>
26
 
 
27
 
namespace drizzled
28
 
{
29
 
namespace module
30
 
{
31
 
class Module;
32
 
}
33
 
 
34
 
namespace plugin
35
 
{
36
 
 
37
 
class Plugin
38
 
{
39
 
private:
40
 
  const std::string _name;
41
 
  bool _is_active;
42
 
  module::Module *_module;
43
 
  const std::string _type_name;
44
 
 
45
 
  Plugin();
46
 
  Plugin(const Plugin&);
47
 
  Plugin& operator=(const Plugin &);
48
 
public:
49
 
  typedef std::map<std::string, Plugin *> map;
50
 
  typedef std::vector<Plugin *> vector;
51
 
 
52
 
  explicit Plugin(const std::string &name, const std::string &type_name);
53
 
  virtual ~Plugin() {}
54
 
 
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
 
  void activate()
70
 
  {
71
 
    _is_active= true;
72
 
  }
73
 
 
74
 
  void deactivate()
75
 
  {
76
 
    _is_active= false;
77
 
  }
78
 
 
79
 
  bool isActive() const
80
 
  {
81
 
    return _is_active;
82
 
  }
83
 
 
84
 
  const std::string &getName() const
85
 
  {
86
 
    return _name;
87
 
  } 
88
 
 
89
 
  void setModule(module::Module *module)
90
 
  {
91
 
    _module= module;
92
 
  }
93
 
 
94
 
  const std::string& getTypeName() const
95
 
  {
96
 
    return _type_name;
97
 
  }
98
 
 
99
 
  const std::string& getModuleName() const;
100
 
};
101
 
} /* end namespace plugin */
102
 
} /* end namespace drizzled */
103
 
 
104
 
#endif /* DRIZZLED_PLUGIN_PLUGIN_H */