Lunchbox  1.17.0
Multi-threaded C++ toolbox library for all application developers creating high-performance multi-threaded programs.
dso.h
1 
2 /* Copyright (c) 2009, Cedric Stalder <cedric.stalder@gmail.com>
3  * 2009-2014, Stefan Eilemann <eile@equalizergraphics.com>
4  *
5  * This library is free software; you can redistribute it and/or modify it under
6  * the terms of the GNU Lesser General Public License version 2.1 as published
7  * by the Free Software Foundation.
8  *
9  * This library is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11  * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12  * details.
13  *
14  * You should have received a copy of the GNU Lesser General Public License
15  * along with this library; if not, write to the Free Software Foundation, Inc.,
16  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17  */
18 
19 #ifndef LUNCHBOX_DSO_H
20 #define LUNCHBOX_DSO_H
21 
22 #include <boost/noncopyable.hpp>
23 #include <lunchbox/api.h>
24 #include <string>
25 
26 namespace lunchbox
27 {
28 namespace detail
29 {
30 class DSO;
31 }
32 
38 class DSO : public boost::noncopyable
39 {
40 public:
42  LUNCHBOX_API DSO();
43 
45  LUNCHBOX_API explicit DSO(const std::string& name);
46 
48  LUNCHBOX_API ~DSO();
49 
57  LUNCHBOX_API bool open(const std::string& fileName);
58 
63  LUNCHBOX_API void close();
64 
70  LUNCHBOX_API
71  void* getFunctionPointer(const std::string& functionName) const;
72 
78  template <class F>
79  F getFunctionPointer(const std::string& func) const
80  {
81  return (F)(getFunctionPointer(func));
82  }
83 
85  LUNCHBOX_API bool isOpen() const;
86 
91  LUNCHBOX_API bool operator==(const DSO& rhs) const;
92 
97  bool operator!=(const DSO& rhs) const { return !(*this == rhs); }
98 private:
99  detail::DSO* const _impl;
100 };
101 }
102 
103 #endif // LUNCHBOX_DSO_H
Helper to access dynamic shared objects (DSO)
Definition: dso.h:38
F getFunctionPointer(const std::string &func) const
Definition: dso.h:79
Defines export visibility macros for library Lunchbox.
Abstraction layer and common utilities for multi-threaded programming.
Definition: algorithm.h:29
bool operator!=(const DSO &rhs) const
Definition: dso.h:97