~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/module/module.h

Fix merge issues with 1.0 CC fix.

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
#pragma once
 
21
 
 
22
/**
 
23
 * @file Defines a Plugin Module
 
24
 *
 
25
 * A plugin::Module is the fundamental functional element of the plugin system.
 
26
 * Plugins are inited and deinited by module. A module init can register one
 
27
 * or more plugin::Plugin objects. 
 
28
 */
 
29
 
 
30
#include <drizzled/common_fwd.h>
 
31
#include <string>
 
32
#include <vector>
 
33
 
 
34
namespace drizzled {
 
35
 
 
36
void module_shutdown(module::Registry&);
 
37
 
 
38
namespace module {
 
39
 
 
40
/* A plugin module */
 
41
class Module
 
42
{
 
43
public:
 
44
  typedef std::vector<sys_var *> Variables;
 
45
  typedef std::vector<std::string> Depends;
 
46
 
 
47
  Library *plugin_dl;
 
48
  bool isInited;
 
49
  Variables system_vars;         /* server variables for this plugin */
 
50
  Variables sys_vars;
 
51
  Depends depends_;
 
52
 
 
53
  Module(const Manifest *manifest_arg, Library *library_arg);
 
54
  ~Module();
 
55
 
 
56
  const std::string& getName() const
 
57
  {
 
58
    return name;
 
59
  }
 
60
 
 
61
  const Manifest& getManifest() const
 
62
  {
 
63
    return manifest;
 
64
  }
 
65
 
 
66
  void addMySysVar(sys_var *var)
 
67
  {
 
68
    sys_vars.push_back(var);
 
69
    addSysVar(var);
 
70
  }
 
71
 
 
72
  void addSysVar(sys_var *var)
 
73
  {
 
74
    system_vars.push_back(var);
 
75
  }
 
76
 
 
77
  Variables &getSysVars()
 
78
  {
 
79
    return system_vars;
 
80
  }
 
81
 
 
82
  const Depends &getDepends() const
 
83
  {
 
84
    return depends_;
 
85
  }
 
86
 
 
87
  void setVertexHandle(VertexHandle *vertex)
 
88
  {
 
89
    vertex_= vertex;
 
90
  }
 
91
 
 
92
  VertexHandle *getVertexHandle()
 
93
  {
 
94
    return vertex_;
 
95
  }
 
96
private:
 
97
  const std::string name;
 
98
  const Manifest &manifest;
 
99
  VertexHandle *vertex_;
 
100
};
 
101
 
 
102
} /* namespace module */
 
103
} /* namespace drizzled */
 
104