~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/module/library.h

  • Committer: Brian Aker
  • Date: 2009-02-21 00:18:15 UTC
  • Revision ID: brian@tangent.org-20090221001815-x20e8h71e984lvs1
Completion (?) of uint conversion.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
 
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3
 
 *
4
 
 *  Copyright (C) 2009 Sun Microsystems, Inc.
5
 
 *
6
 
 *  This program is free software; you can redistribute it and/or modify
7
 
 *  it under the terms of the GNU General Public License as published by
8
 
 *  the Free Software Foundation; version 2 of the License.
9
 
 *
10
 
 *  This program is distributed in the hope that it will be useful,
11
 
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 
 *  GNU General Public License for more details.
14
 
 *
15
 
 *  You should have received a copy of the GNU General Public License
16
 
 *  along with this program; if not, write to the Free Software
17
 
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18
 
 */
19
 
 
20
 
#ifndef DRIZZLED_MODULE_LIBRARY_H
21
 
#define DRIZZLED_MODULE_LIBRARY_H
22
 
 
23
 
/**
24
 
 * @file Defines a Plugin Library Wrapper
25
 
 *
26
 
 * A plugin::Library is a wrapper object around a plugin .so file. It owns
27
 
 * the void * returned by dlopen and contains the knowledge of how to load
28
 
 * and unload plugin libraries via dlopen().
29
 
 */
30
 
 
31
 
#include <string>
32
 
 
33
 
#include <boost/filesystem.hpp>
34
 
 
35
 
namespace drizzled
36
 
{
37
 
namespace module
38
 
{
39
 
 
40
 
struct Manifest;
41
 
 
42
 
/* A handle for the dynamic library containing a plugin or plugins. */
43
 
class Library
44
 
{
45
 
  std::string name;
46
 
  void *handle;
47
 
  const Manifest *manifest;
48
 
 
49
 
  /* We don't want these */
50
 
  Library();
51
 
  Library(const Library &);
52
 
  Library& operator=(const Library &);
53
 
 
54
 
  /* Construction should only happen through the static factory method */
55
 
  Library(const std::string &name_arg,
56
 
          void *handle_arg,
57
 
          const Manifest *manifest_arg);
58
 
 
59
 
public:
60
 
  ~Library();
61
 
 
62
 
  const std::string &getName() const
63
 
  {
64
 
    return name;
65
 
  }
66
 
 
67
 
  const Manifest *getManifest() const
68
 
  {
69
 
    return manifest;
70
 
  }
71
 
 
72
 
  static const boost::filesystem::path getLibraryPath(const std::string &plugin_name);
73
 
  static Library *loadLibrary(const std::string &plugin_name, bool builtin);
74
 
};
75
 
 
76
 
} /* namespace module */
77
 
} /* namespace drizzled */
78
 
 
79
 
#endif /* DRIZZLED_MODULE_LIBRARY_H */