~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/module/module.h

  • Committer: Monty Taylor
  • Date: 2008-10-09 22:38:27 UTC
  • mto: This revision was merged to the branch mainline in revision 497.
  • Revision ID: monty@inaugust.com-20081009223827-bc9gvpiplsmvpwyq
Moved test() to its own file.
Made a new function to possibly replace int10_to_str.

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_MODULE_MODULE_H
21
 
#define DRIZZLED_MODULE_MODULE_H
22
 
 
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
 
 
31
 
#include <cassert>
32
 
#include <vector>
33
 
#include <boost/program_options.hpp>
34
 
 
35
 
#include "drizzled/module/manifest.h"
36
 
#include "drizzled/module/registry.h"
37
 
 
38
 
 
39
 
namespace drizzled
40
 
{
41
 
class set_var;
42
 
 
43
 
void module_shutdown(module::Registry &registry);
44
 
 
45
 
namespace module
46
 
{
47
 
 
48
 
class Library;
49
 
 
50
 
/* A plugin module */
51
 
class Module
52
 
{
53
 
  const std::string name;
54
 
  const Manifest *manifest;
55
 
 
56
 
public:
57
 
  typedef std::vector<sys_var *> Variables;
58
 
  Library *plugin_dl;
59
 
  bool isInited;
60
 
  Variables system_vars;         /* server variables for this plugin */
61
 
  Variables sys_vars;
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),
68
 
    system_vars(),
69
 
    sys_vars()
70
 
  {
71
 
    assert(manifest != NULL);
72
 
  }
73
 
 
74
 
  ~Module();
75
 
 
76
 
  const std::string& getName() const
77
 
  {
78
 
    return name;
79
 
  }
80
 
 
81
 
  const Manifest& getManifest() const
82
 
  {
83
 
    return *manifest;
84
 
  }
85
 
 
86
 
  void addMySysVar(sys_var *var)
87
 
  {
88
 
    sys_vars.push_back(var);
89
 
    addSysVar(var);
90
 
  }
91
 
 
92
 
  void addSysVar(sys_var *var)
93
 
  {
94
 
    system_vars.push_back(var);
95
 
  }
96
 
 
97
 
  Variables &getSysVars()
98
 
  {
99
 
    return system_vars;
100
 
  }
101
 
};
102
 
 
103
 
} /* namespace module */
104
 
} /* namespace drizzled */
105
 
 
106
 
#endif /* DRIZZLED_MODULE_MODULE_H */