Drizzled Public API Documentation

module.h
00001 /* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
00002  *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
00003  *
00004  *  Copyright (C) 2009 Sun Microsystems, Inc.
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 
00030 #include <drizzled/common_fwd.h>
00031 #include <string>
00032 #include <vector>
00033 
00034 namespace drizzled {
00035 
00036 void module_shutdown(module::Registry&);
00037 
00038 namespace module {
00039 
00040 /* A plugin module */
00041 class Module
00042 {
00043 public:
00044   typedef std::vector<sys_var *> Variables;
00045   typedef std::vector<std::string> Depends;
00046 
00047   Library *plugin_dl;
00048   bool isInited;
00049   Variables system_vars;         /* server variables for this plugin */
00050   Variables sys_vars;
00051   Depends depends_;
00052 
00053   Module(const Manifest *manifest_arg, Library *library_arg);
00054   ~Module();
00055 
00056   const std::string& getName() const
00057   {
00058     return name;
00059   }
00060 
00061   const Manifest& getManifest() const
00062   {
00063     return manifest;
00064   }
00065 
00066   void addMySysVar(sys_var *var)
00067   {
00068     sys_vars.push_back(var);
00069     addSysVar(var);
00070   }
00071 
00072   void addSysVar(sys_var *var)
00073   {
00074     system_vars.push_back(var);
00075   }
00076 
00077   Variables &getSysVars()
00078   {
00079     return system_vars;
00080   }
00081 
00082   const Depends &getDepends() const
00083   {
00084     return depends_;
00085   }
00086 
00087   void setVertexHandle(VertexHandle *vertex)
00088   {
00089     vertex_= vertex;
00090   }
00091 
00092   VertexHandle *getVertexHandle()
00093   {
00094     return vertex_;
00095   }
00096 private:
00097   const std::string name;
00098   const Manifest &manifest;
00099   VertexHandle *vertex_;
00100 };
00101 
00102 } /* namespace module */
00103 } /* namespace drizzled */
00104