Drizzled Public API Documentation

library.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 
00032 #include <boost/filesystem.hpp>
00033 
00034 namespace drizzled
00035 {
00036 namespace module
00037 {
00038 
00039 struct Manifest;
00040 
00041 /* A handle for the dynamic library containing a plugin or plugins. */
00042 class Library
00043 {
00044   std::string name;
00045   void *handle;
00046   const Manifest *manifest;
00047 
00048   /* We don't want these */
00049   Library();
00050   Library(const Library &);
00051   Library& operator=(const Library &);
00052 
00053   /* Construction should only happen through the static factory method */
00054   Library(const std::string &name_arg,
00055           void *handle_arg,
00056           const Manifest *manifest_arg);
00057 
00058 public:
00059   ~Library();
00060 
00061   const std::string &getName() const
00062   {
00063     return name;
00064   }
00065  
00066   const Manifest *getManifest() const
00067   {
00068     return manifest;
00069   }
00070 
00071   static const boost::filesystem::path getLibraryPath(const std::string &plugin_name);
00072   static Library *loadLibrary(const std::string &plugin_name, bool builtin);
00073 };
00074 
00075 } /* namespace module */
00076 } /* namespace drizzled */
00077