~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/plugin/handle.h

  • Committer: Brian Aker
  • Date: 2009-10-07 16:55:53 UTC
  • mfrom: (1161.2.1 bug444827)
  • Revision ID: brian@gaz-20091007165553-9tnp7liw1k9g6gvc
Merge Padraig

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
 
#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
 
 
 
20
#ifndef DRIZZLED_PLUGIN_HANDLE_H
 
21
#define DRIZZLED_PLUGIN_HANDLE_H
 
22
 
 
23
#include <drizzled/lex_string.h>
 
24
#include <mysys/my_alloc.h>
 
25
 
 
26
class sys_var;
38
27
 
39
28
namespace drizzled
40
29
{
41
 
class set_var;
42
 
 
43
 
void module_shutdown(module::Registry &registry);
44
 
 
45
 
namespace module
 
30
namespace plugin
46
31
{
47
32
 
 
33
class Manifest;
48
34
class Library;
49
 
class VertexHandle;
50
35
 
51
 
/* A plugin module */
52
 
class Module
 
36
/* A handle of a plugin */
 
37
class Handle
53
38
{
54
 
public:
55
 
  typedef std::vector<sys_var *> Variables;
56
 
  typedef std::vector<std::string> Depends;
57
 
 
58
 
private:
59
39
  const std::string name;
60
 
  const Manifest *manifest;
61
 
  VertexHandle *vertex_;
62
 
 
 
40
  Manifest *manifest;
63
41
public:
64
42
  Library *plugin_dl;
65
43
  bool isInited;
66
 
  Variables system_vars;         /* server variables for this plugin */
67
 
  Variables sys_vars;
68
 
  Depends depends_;
69
 
 
70
 
  Module(const Manifest *manifest_arg,
71
 
         Library *library_arg);
72
 
 
73
 
  ~Module();
74
 
 
 
44
  MEM_ROOT mem_root;            /* memory for dynamic plugin structures */
 
45
  sys_var *system_vars;         /* server variables for this plugin */
 
46
  Handle(Manifest *manifest_arg, Library *library_arg)
 
47
    : name(manifest_arg->name), manifest(manifest_arg), plugin_dl(library_arg),
 
48
      mem_root(), system_vars(NULL) {}
 
49
      
 
50
  Handle(Manifest *manifest_arg)
 
51
    : name(manifest_arg->name), manifest(manifest_arg), plugin_dl(NULL),
 
52
      mem_root(), system_vars(NULL) {}
 
53
      
75
54
  const std::string& getName() const
76
55
  {
77
56
    return name;
81
60
  {
82
61
    return *manifest;
83
62
  }
84
 
 
85
 
  void addMySysVar(sys_var *var)
86
 
  {
87
 
    sys_vars.push_back(var);
88
 
    addSysVar(var);
89
 
  }
90
 
 
91
 
  void addSysVar(sys_var *var)
92
 
  {
93
 
    system_vars.push_back(var);
94
 
  }
95
 
 
96
 
  Variables &getSysVars()
97
 
  {
98
 
    return system_vars;
99
 
  }
100
 
 
101
 
  const Depends &getDepends() const
102
 
  {
103
 
    return depends_;
104
 
  }
105
 
 
106
 
  void setVertexHandle(VertexHandle *vertex)
107
 
  {
108
 
    vertex_= vertex;
109
 
  }
110
 
 
111
 
  VertexHandle *getVertexHandle()
112
 
  {
113
 
    return vertex_;
114
 
  }
115
63
};
116
64
 
117
 
} /* namespace module */
 
65
} /* namespace plugin */
118
66
} /* namespace drizzled */
119
67
 
120
 
#endif /* DRIZZLED_MODULE_MODULE_H */
 
68
#endif /* DRIZZLED_PLUGIN_HANDLE_H */