Lunchbox  1.8.0
dso.h
1 
2 /* Copyright (c) 2009, Cedric Stalder <cedric.stalder@gmail.com>
3  * 2009-2013, 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 <lunchbox/api.h>
23 #include <lunchbox/nonCopyable.h>
24 #include <string>
25 
26 namespace lunchbox
27 {
28 namespace detail { class DSO; }
29 
31 class DSO : public NonCopyable
32 {
33 public:
35  LUNCHBOX_API DSO();
36 
38  LUNCHBOX_API DSO( const std::string& name );
39 
41  LUNCHBOX_API ~DSO();
42 
50  LUNCHBOX_API bool open( const std::string& fileName );
51 
56  LUNCHBOX_API void close();
57 
63  LUNCHBOX_API void* getFunctionPointer( const std::string& functionName);
64 
70  template< class F > F getFunctionPointer( const std::string& func )
71  { return (F)(getFunctionPointer( func )); }
72 
74  LUNCHBOX_API bool isOpen() const;
75 
76 private:
77  detail::DSO* const _impl;
78 };
79 
80 }
81 
82 #endif //LUNCHBOX_DSO_H