~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/plugin/library.h

Reverted 1103

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
2
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3
3
 *
4
 
 *  Copyright (C) 2009 Sun Microsystems, Inc.
 
4
 *  Copyright (C) 2009 Sun Microsystems
5
5
 *
6
6
 *  This program is free software; you can redistribute it and/or modify
7
7
 *  it under the terms of the GNU General Public License as published by
17
17
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18
18
 */
19
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>
 
20
#ifndef DRIZZLED_PLUGIN_LIBRARY_H
 
21
#define DRIZZLED_PLUGIN_LIBRARY_H
 
22
 
 
23
#include <drizzled/lex_string.h>
34
24
 
35
25
namespace drizzled
36
26
{
37
 
namespace module
 
27
namespace plugin
38
28
{
39
29
 
40
 
struct Manifest;
 
30
class Manifest;
41
31
 
42
32
/* A handle for the dynamic library containing a plugin or plugins. */
43
33
class Library
44
34
{
45
 
  std::string name;
 
35
public:
 
36
  LEX_STRING dl;
46
37
  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);
 
38
  Manifest *plugins;
 
39
  Library() : dl(), handle(NULL), plugins(NULL) {}
74
40
};
75
41
 
76
 
} /* namespace module */
 
42
} /* namespace plugin */
77
43
} /* namespace drizzled */
78
44
 
79
 
#endif /* DRIZZLED_MODULE_LIBRARY_H */
 
45
#endif /* DRIZZLED_PLUGIN_LIBRARY_H */