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