Drizzled Public API Documentation

context.h
00001 /* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
00002  *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
00003  *
00004  *  Copyright (C) 2010 Monty Taylor
00005  *
00006  *  This program is free software; you can redistribute it and/or modify
00007  *  it under the terms of the GNU General Public License as published by
00008  *  the Free Software Foundation; version 2 of the License.
00009  *
00010  *  This program is distributed in the hope that it will be useful,
00011  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  *  GNU General Public License for more details.
00014  *
00015  *  You should have received a copy of the GNU General Public License
00016  *  along with this program; if not, write to the Free Software
00017  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00018  */
00019 
00020 #pragma once
00021 
00037 #include <boost/noncopyable.hpp>
00038 #include <drizzled/module/registry.h>
00039 #include <drizzled/visibility.h>
00040 
00041 namespace drizzled {
00042 namespace module {
00043 
00044 class DRIZZLED_API Context : boost::noncopyable
00045 {
00046 public:
00047 
00048   Context(module::Registry &registry_arg,
00049           module::Module *module_arg) :
00050      registry(registry_arg),
00051      module(module_arg)
00052   { }
00053 
00054   template<class T>
00055   void add(T *plugin)
00056   {
00057     plugin->setModule(module);
00058     registry.add(plugin);
00059   }
00060 
00061   template<class T>
00062   void remove(T *plugin)
00063   {
00064     registry.remove(plugin);
00065   }
00066 
00067   void registerVariable(sys_var *var);
00068 
00069   option_map getOptions();
00070 
00071   static std::string prepend_name(std::string module_name,
00072                                   const std::string &var_name);
00073 private:
00074   module::Registry &registry;
00075   module::Module *module;
00076 };
00077 
00078 
00079 } /* namespace module */
00080 } /* namespace drizzled */
00081