~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
1530.2.5 by Monty Taylor
Renamed classes that were in drizzled::plugin but which were not meant
20
#ifndef DRIZZLED_MODULE_MODULE_H
21
#define DRIZZLED_MODULE_MODULE_H
1093.3.3 by Monty Taylor
Split out handle and library.
22
1324.2.8 by Monty Taylor
Added some comment headers.
23
/**
24
 * @file Defines a Plugin Module
25
 *
26
 * A plugin::Module is the fundamental functional element of the plugin system.
27
 * Plugins are inited and deinited by module. A module init can register one
28
 * or more plugin::Plugin objects. 
29
 */
30
1324.2.11 by Monty Taylor
Fixed some merge stoopidity.
31
#include <cassert>
1851.1.1 by Monty Taylor
Removed sys_var_chain.
32
#include <vector>
1626.2.1 by Monty Taylor
Added wrapper around variables_map to allow us to pull values back out of
33
#include <boost/program_options.hpp>
1324.2.11 by Monty Taylor
Fixed some merge stoopidity.
34
1530.2.5 by Monty Taylor
Renamed classes that were in drizzled::plugin but which were not meant
35
#include "drizzled/module/manifest.h"
1626.2.1 by Monty Taylor
Added wrapper around variables_map to allow us to pull values back out of
36
#include "drizzled/module/registry.h"
37
1093.3.3 by Monty Taylor
Split out handle and library.
38
1280.1.10 by Monty Taylor
Put everything in drizzled into drizzled namespace.
39
namespace drizzled
40
{
1857.3.3 by Monty Taylor
It works - has a valgrind issue somewhere.
41
class set_var;
1093.3.3 by Monty Taylor
Split out handle and library.
42
1530.2.5 by Monty Taylor
Renamed classes that were in drizzled::plugin but which were not meant
43
void module_shutdown(module::Registry &registry);
44
45
namespace module
1093.3.3 by Monty Taylor
Split out handle and library.
46
{
47
48
class Library;
49
1192.2.3 by Monty Taylor
Renamed plugin::Handle to plugin::Module for clarity.
50
/* A plugin module */
51
class Module
1093.3.3 by Monty Taylor
Split out handle and library.
52
{
1093.3.4 by Monty Taylor
Naming cleanups.
53
  const std::string name;
1228.1.3 by Monty Taylor
All of the outstanding plugin loader system cleanups:
54
  const Manifest *manifest;
1626.2.1 by Monty Taylor
Added wrapper around variables_map to allow us to pull values back out of
55
1093.3.3 by Monty Taylor
Split out handle and library.
56
public:
1851.1.1 by Monty Taylor
Removed sys_var_chain.
57
  typedef std::vector<sys_var *> Variables;
1093.3.3 by Monty Taylor
Split out handle and library.
58
  Library *plugin_dl;
59
  bool isInited;
1851.1.1 by Monty Taylor
Removed sys_var_chain.
60
  Variables system_vars;         /* server variables for this plugin */
1857.3.4 by Monty Taylor
Track lifecycle of sys_var different form plugin_sysvar
61
  Variables sys_vars;
1626.2.1 by Monty Taylor
Added wrapper around variables_map to allow us to pull values back out of
62
  Module(const Manifest *manifest_arg,
63
         Library *library_arg) :
64
    name(manifest_arg->name),
65
    manifest(manifest_arg),
66
    plugin_dl(library_arg),
67
    isInited(false),
1857.3.3 by Monty Taylor
It works - has a valgrind issue somewhere.
68
    system_vars(),
69
    sys_vars()
1324.2.8 by Monty Taylor
Added some comment headers.
70
  {
1324.2.11 by Monty Taylor
Fixed some merge stoopidity.
71
    assert(manifest != NULL);
1324.2.8 by Monty Taylor
Added some comment headers.
72
  }
1851.1.1 by Monty Taylor
Removed sys_var_chain.
73
1857.3.3 by Monty Taylor
It works - has a valgrind issue somewhere.
74
  ~Module();
1856 by Brian Aker
Merge Monty
75
1093.3.4 by Monty Taylor
Naming cleanups.
76
  const std::string& getName() const
77
  {
78
    return name;
79
  }
80
81
  const Manifest& getManifest() const
82
  {
83
    return *manifest;
84
  }
1626.2.1 by Monty Taylor
Added wrapper around variables_map to allow us to pull values back out of
85
1857.3.4 by Monty Taylor
Track lifecycle of sys_var different form plugin_sysvar
86
  void addMySysVar(sys_var *var)
87
  {
88
    sys_vars.push_back(var);
89
    addSysVar(var);
90
  }
91
1851.1.1 by Monty Taylor
Removed sys_var_chain.
92
  void addSysVar(sys_var *var)
93
  {
94
    system_vars.push_back(var);
95
  }
96
1856 by Brian Aker
Merge Monty
97
  Variables &getSysVars()
1851.1.1 by Monty Taylor
Removed sys_var_chain.
98
  {
99
    return system_vars;
100
  }
1093.3.3 by Monty Taylor
Split out handle and library.
101
};
102
1530.2.5 by Monty Taylor
Renamed classes that were in drizzled::plugin but which were not meant
103
} /* namespace module */
1093.3.3 by Monty Taylor
Split out handle and library.
104
} /* namespace drizzled */
105
1530.2.5 by Monty Taylor
Renamed classes that were in drizzled::plugin but which were not meant
106
#endif /* DRIZZLED_MODULE_MODULE_H */