~drizzle-trunk/drizzle/development

1093.3.3 by Monty Taylor
Split out handle and library.
1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3
 *
1999.6.1 by kalebral at gmail
update Copyright strings to a more common format to help with creating the master debian copyright file
4
 *  Copyright (C) 2009 Sun Microsystems, Inc.
1093.3.3 by Monty Taylor
Split out handle and library.
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
2234 by Brian Aker
Mass removal of ifdef/endif in favor of pragma once.
20
#pragma once
1093.3.3 by Monty Taylor
Split out handle and library.
21
1324.2.8 by Monty Taylor
Added some comment headers.
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
2252.1.21 by Olaf van der Spek
Common fwd
30
#include <drizzled/common_fwd.h>
2207.6.2 by Olaf van der Spek
Refactor
31
#include <string>
1851.1.1 by Monty Taylor
Removed sys_var_chain.
32
#include <vector>
2207.6.2 by Olaf van der Spek
Refactor
33
34
namespace drizzled {
35
36
void module_shutdown(module::Registry&);
37
38
namespace module {
1093.3.3 by Monty Taylor
Split out handle and library.
39
1192.2.3 by Monty Taylor
Renamed plugin::Handle to plugin::Module for clarity.
40
/* A plugin module */
41
class Module
1093.3.3 by Monty Taylor
Split out handle and library.
42
{
2095.3.1 by Monty Taylor
Re-purpose the old plugin sysvar slot in the struct to be a depends list.
43
public:
44
  typedef std::vector<sys_var *> Variables;
45
  typedef std::vector<std::string> Depends;
46
1093.3.3 by Monty Taylor
Split out handle and library.
47
  Library *plugin_dl;
48
  bool isInited;
1851.1.1 by Monty Taylor
Removed sys_var_chain.
49
  Variables system_vars;         /* server variables for this plugin */
1857.3.4 by Monty Taylor
Track lifecycle of sys_var different form plugin_sysvar
50
  Variables sys_vars;
2095.3.1 by Monty Taylor
Re-purpose the old plugin sysvar slot in the struct to be a depends list.
51
  Depends depends_;
52
2207.6.2 by Olaf van der Spek
Refactor
53
  Module(const Manifest *manifest_arg, Library *library_arg);
1857.3.3 by Monty Taylor
It works - has a valgrind issue somewhere.
54
  ~Module();
1856 by Brian Aker
Merge Monty
55
1093.3.4 by Monty Taylor
Naming cleanups.
56
  const std::string& getName() const
57
  {
58
    return name;
59
  }
60
61
  const Manifest& getManifest() const
62
  {
2207.6.2 by Olaf van der Spek
Refactor
63
    return manifest;
1093.3.4 by Monty Taylor
Naming cleanups.
64
  }
1626.2.1 by Monty Taylor
Added wrapper around variables_map to allow us to pull values back out of
65
1857.3.4 by Monty Taylor
Track lifecycle of sys_var different form plugin_sysvar
66
  void addMySysVar(sys_var *var)
67
  {
68
    sys_vars.push_back(var);
69
    addSysVar(var);
70
  }
71
1851.1.1 by Monty Taylor
Removed sys_var_chain.
72
  void addSysVar(sys_var *var)
73
  {
74
    system_vars.push_back(var);
75
  }
76
1856 by Brian Aker
Merge Monty
77
  Variables &getSysVars()
1851.1.1 by Monty Taylor
Removed sys_var_chain.
78
  {
79
    return system_vars;
80
  }
2095.3.1 by Monty Taylor
Re-purpose the old plugin sysvar slot in the struct to be a depends list.
81
82
  const Depends &getDepends() const
83
  {
84
    return depends_;
85
  }
86
2095.3.7 by Monty Taylor
Fixed the dependency graph so that it doesn't get included in sql_yacc.yy.
87
  void setVertexHandle(VertexHandle *vertex)
2095.3.6 by Monty Taylor
Actually properly process module dependencies. w00t.
88
  {
89
    vertex_= vertex;
90
  }
91
2095.3.7 by Monty Taylor
Fixed the dependency graph so that it doesn't get included in sql_yacc.yy.
92
  VertexHandle *getVertexHandle()
2095.3.6 by Monty Taylor
Actually properly process module dependencies. w00t.
93
  {
94
    return vertex_;
95
  }
2207.6.2 by Olaf van der Spek
Refactor
96
private:
97
  const std::string name;
98
  const Manifest &manifest;
99
  VertexHandle *vertex_;
1093.3.3 by Monty Taylor
Split out handle and library.
100
};
101
1530.2.5 by Monty Taylor
Renamed classes that were in drizzled::plugin but which were not meant
102
} /* namespace module */
1093.3.3 by Monty Taylor
Split out handle and library.
103
} /* namespace drizzled */
104