~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/plugin/plugin.h

  • Committer: Brian Aker
  • Date: 2010-10-15 01:23:36 UTC
  • mfrom: (1835.1.7 staging)
  • Revision ID: brian@tangent.org-20101015012336-8w5lox9kj0hkv0a1
MergeĀ inĀ mutable/execute

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
28
namespace module
37
29
{
38
30
class Module;
41
33
namespace plugin
42
34
{
43
35
 
44
 
class DRIZZLED_API Plugin
 
36
class Plugin
45
37
{
46
38
private:
47
 
  const std::string _name;
48
 
  bool _is_active;
49
 
  module::Module *_module;
50
 
  const std::string _type_name;
 
39
  const std::string name;
 
40
  bool is_active;
 
41
  module::Module *module;
 
42
  const std::string type_name;
51
43
 
52
44
  Plugin();
53
45
  Plugin(const Plugin&);
54
46
  Plugin& operator=(const Plugin &);
55
47
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
48
 
60
 
  explicit Plugin(const std::string &name, const std::string &type_name);
 
49
  explicit Plugin(std::string in_name, std::string in_type_name);
61
50
  virtual ~Plugin() {}
62
51
 
63
52
  /*
68
57
  virtual void shutdownPlugin()
69
58
  {
70
59
  }
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
60
 
81
61
  void activate()
82
62
  {
83
 
    _is_active= true;
 
63
    is_active= true;
84
64
  }
85
65
 
86
66
  void deactivate()
87
67
  {
88
 
    _is_active= false;
 
68
    is_active= false;
89
69
  }
90
70
 
91
71
  bool isActive() const
92
72
  {
93
 
    return _is_active;
 
73
    return is_active;
94
74
  }
95
75
 
96
76
  const std::string &getName() const
97
77
  {
98
 
    return _name;
 
78
    return name;
99
79
  } 
100
80
 
101
 
  void setModule(module::Module *module)
 
81
  void setModule(module::Module *module_arg)
102
82
  {
103
 
    _module= module;
 
83
    module= module_arg;
104
84
  }
105
85
 
106
86
  const std::string& getTypeName() const
107
87
  {
108
 
    return _type_name;
109
 
  }
110
 
 
111
 
  virtual bool removeLast() const
112
 
  {
113
 
    return false;
 
88
    return type_name;
114
89
  }
115
90
 
116
91
  const std::string& getModuleName() const;