Lunchbox  1.8.0
plugin.h
1 
2 /* Copyright (c) 2009-2010, Cedric Stalder <cedric.stalder@gmail.com>
3  * 2009-2013, Stefan Eilemann <eile@equalizergraphics.com>
4  *
5  * This file is part of Lunchbox <https://github.com/Eyescale/Lunchbox>
6  *
7  * This library is free software; you can redistribute it and/or modify it under
8  * the terms of the GNU Lesser General Public License version 2.1 as published
9  * by the Free Software Foundation.
10  *
11  * This library is distributed in the hope that it will be useful, but WITHOUT
12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13  * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
14  * details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with this library; if not, write to the Free Software Foundation, Inc.,
18  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19  */
20 
21 #ifndef LUNCHBOX_PLUGIN_H
22 #define LUNCHBOX_PLUGIN_H
23 
24 #include <lunchbox/types.h>
25 #include <lunchbox/dso.h> // base class
26 #include <lunchbox/visitorResult.h> // enum
27 #include <lunchbox/plugins/compressor.h> // GLEW definition
28 
29 namespace lunchbox
30 {
31 namespace detail { class Plugin; }
32 
34 class Plugin : public DSO
35 {
36 public:
38  LUNCHBOX_API Plugin( const std::string& libraryName );
39 
41  LUNCHBOX_API virtual ~Plugin();
42 
45  typedef size_t ( *GetNumCompressors_t ) ();
46  typedef void* ( *NewCompressor_t ) ( const unsigned );
47  typedef void ( *DeleteCompressor_t ) ( void* const );
48  typedef void* ( *NewDecompressor_t ) ( const unsigned );
49  typedef void ( *DeleteDecompressor_t ) ( void* const );
50  typedef void ( *Compress_t ) ( void* const, const unsigned,
51  void* const, const uint64_t*,
52  const uint64_t );
53  typedef unsigned ( *GetNumResults_t ) ( void* const, const unsigned );
54  typedef void ( *GetResult_t ) ( void* const, const unsigned,
55  const unsigned, void** const,
56  uint64_t* const );
57  typedef void ( *Decompress_t ) ( void* const, const unsigned,
58  const void* const*,
59  const uint64_t* const,
60  const unsigned, void* const,
61  uint64_t* const,
62  const uint64_t );
63  typedef bool ( *IsCompatible_t ) ( const unsigned, const GLEWContext* );
64  typedef void ( *Download_t )( void* const, const unsigned,
65  const GLEWContext*, const uint64_t*,
66  const unsigned, const uint64_t,
67  uint64_t*, void** );
68  typedef void ( *StartDownload_t )( void* const, const unsigned,
69  const GLEWContext*, const uint64_t*,
70  const unsigned, const uint64_t );
71  typedef void ( *FinishDownload_t )( void* const, const unsigned,
72  const GLEWContext*, const uint64_t*,
73  const uint64_t, uint64_t*, void** );
74  typedef void ( *Upload_t )( void* const, const unsigned,
75  const GLEWContext*, const void*,
76  const uint64_t*,
77  const uint64_t, const uint64_t*,
78  const unsigned );
80 
84  LUNCHBOX_API bool isGood() const;
85 
87  LUNCHBOX_API VisitorResult accept( PluginVisitor& visitor );
88 
90  LUNCHBOX_API VisitorResult accept( ConstPluginVisitor& visitor ) const;
91 
93  bool implementsType( const uint32_t name ) const;
94 
96  LUNCHBOX_API EqCompressorInfo findInfo( const uint32_t name ) const;
97 
99  LUNCHBOX_API const CompressorInfos& getInfos() const;
101 
105  GetNumCompressors_t const getNumCompressors;
106 
108  NewCompressor_t const newCompressor;
109 
111  NewDecompressor_t const newDecompressor;
112 
114  DeleteCompressor_t const deleteCompressor;
115 
117  DeleteDecompressor_t const deleteDecompressor;
118 
120  Compress_t const compress;
121 
123  Decompress_t const decompress;
124 
126  GetNumResults_t const getNumResults;
127 
129  GetResult_t const getResult;
130 
132  IsCompatible_t const isCompatible;
133 
135  Download_t const download;
136 
138  Upload_t const upload;
139 
141  StartDownload_t const startDownload;
142 
144  FinishDownload_t const finishDownload;
146 
147 private:
148  detail::Plugin* const impl_;
149 };
150 }
151 #endif //LUNCHBOX_PLUGIN_H