drizzle
C++ MySQL-protocol-compatible database server
Loading...
Searching...
No Matches
module/context.h
1/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2 * vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3 *
4 * Copyright (C) 2010 Monty Taylor
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
36
37#include <boost/noncopyable.hpp>
38#include <drizzled/module/registry.h>
39#include <drizzled/visibility.h>
40
41namespace drizzled {
42namespace module {
43
44class DRIZZLED_API Context : boost::noncopyable
45{
46public:
47
48 Context(module::Registry &registry_arg,
49 module::Module *module_arg) :
50 registry(registry_arg),
51 module(module_arg)
52 { }
53
54 template<class T>
55 void add(T *plugin)
56 {
57 plugin->setModule(module);
58 registry.add(plugin);
59 }
60
61 template<class T>
62 void add(T *plugin, plugin::deleter_fn deleter)
63 {
64 plugin->setModule(module);
65 registry.add(plugin, deleter);
66 }
67
68 template<class T>
69 void remove(T *plugin)
70 {
71 registry.remove(plugin);
72 }
73
74 void registerVariable(sys_var *var);
75
76 option_map getOptions();
77
78 static std::string prepend_name(std::string module_name,
79 const std::string &var_name);
80private:
81 module::Registry &registry;
82 module::Module *module;
83};
84
85
86} /* namespace module */
87} /* namespace drizzled */
88
TODO: Rename this file - func.h is stupid.
Visibility Control Macros.
#define DRIZZLED_API
Definition visibility.h:38