~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/plugin/plugin.h

  • Committer: Brian Aker
  • Date: 2009-10-12 22:46:41 UTC
  • mfrom: (1130.2.27 plugin-base-class)
  • Revision ID: brian@gaz-20091012224641-gjo56i190y8c98xg
Merge Monty, default class.

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
 
 
26
#include "drizzled/atomics.h"
 
27
 
 
28
namespace drizzled
 
29
{
 
30
namespace plugin
 
31
{
 
32
 
 
33
class Handle;
 
34
 
 
35
class Plugin
 
36
{
 
37
private:
 
38
  const std::string name;
 
39
  std::vector<std::string> aliases;
 
40
  bool is_active;
 
41
  Handle *handle;
 
42
 
 
43
  Plugin();
 
44
  Plugin(const Plugin&);
 
45
  Plugin& operator=(const Plugin &);
 
46
public:
 
47
 
 
48
  explicit Plugin(std::string in_name);
 
49
  virtual ~Plugin() {}
 
50
 
 
51
  virtual void activate()
 
52
  {
 
53
    is_active= true;
 
54
  }
 
55
 
 
56
  virtual void deactivate()
 
57
  {
 
58
    is_active= false;
 
59
  }
 
60
 
 
61
  virtual bool isActive() const
 
62
  {
 
63
    return is_active;
 
64
  }
 
65
 
 
66
  const std::string &getName() const
 
67
  {
 
68
    return name;
 
69
  } 
 
70
 
 
71
  const std::vector<std::string>& getAliases() const
 
72
  {
 
73
    return aliases;
 
74
  }
 
75
 
 
76
  void addAlias(std::string alias)
 
77
  {
 
78
    aliases.push_back(alias);
 
79
  }
 
80
 
 
81
  void setHandle(Handle *handle_arg)
 
82
  {
 
83
    handle= handle_arg;
 
84
  }
 
85
 
 
86
};
 
87
} /* end namespace plugin */
 
88
} /* end namespace drizzled */
 
89
 
 
90
#endif /* DRIZZLED_PLUGIN_PLUGIN_H */