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