Lunchbox  1.10.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 
38 class Plugin : public DSO
39 {
40 public:
42  LUNCHBOX_API explicit Plugin( const std::string& libraryName );
43 
45  LUNCHBOX_API virtual ~Plugin();
46 
49  typedef size_t ( *GetNumCompressors_t ) ();
50  typedef void* ( *NewCompressor_t ) ( const unsigned );
51  typedef void ( *DeleteCompressor_t ) ( void* const );
52  typedef void* ( *NewDecompressor_t ) ( const unsigned );
53  typedef void ( *DeleteDecompressor_t ) ( void* const );
54  typedef void ( *Compress_t ) ( void* const, const unsigned,
55  void* const, const uint64_t*,
56  const uint64_t );
57  typedef unsigned ( *GetNumResults_t ) ( void* const, const unsigned );
58  typedef void ( *GetResult_t ) ( void* const, const unsigned,
59  const unsigned, void** const,
60  uint64_t* const );
61  typedef void ( *Decompress_t ) ( void* const, const unsigned,
62  const void* const*,
63  const uint64_t* const,
64  const unsigned, void* const,
65  uint64_t* const,
66  const uint64_t );
67  typedef bool ( *IsCompatible_t ) ( const unsigned, const GLEWContext* );
68  typedef void ( *Download_t )( void* const, const unsigned,
69  const GLEWContext*, const uint64_t*,
70  const unsigned, const uint64_t,
71  uint64_t*, void** );
72  typedef void ( *StartDownload_t )( void* const, const unsigned,
73  const GLEWContext*, const uint64_t*,
74  const unsigned, const uint64_t );
75  typedef void ( *FinishDownload_t )( void* const, const unsigned,
76  const GLEWContext*, const uint64_t*,
77  const uint64_t, uint64_t*, void** );
78  typedef void ( *Upload_t )( void* const, const unsigned,
79  const GLEWContext*, const void*,
80  const uint64_t*,
81  const uint64_t, const uint64_t*,
82  const unsigned );
84 
88  LUNCHBOX_API bool isGood() const;
89 
91  LUNCHBOX_API VisitorResult accept( PluginVisitor& visitor );
92 
94  LUNCHBOX_API VisitorResult accept( ConstPluginVisitor& visitor ) const;
95 
97  bool implementsType( const uint32_t name ) const;
98 
100  LUNCHBOX_API EqCompressorInfo findInfo( const uint32_t name ) const;
101 
103  LUNCHBOX_API const CompressorInfos& getInfos() const;
105 
109  GetNumCompressors_t const getNumCompressors;
110 
112  NewCompressor_t const newCompressor;
113 
115  NewDecompressor_t const newDecompressor;
116 
118  DeleteCompressor_t const deleteCompressor;
119 
121  DeleteDecompressor_t const deleteDecompressor;
122 
124  Compress_t const compress;
125 
127  Decompress_t const decompress;
128 
130  GetNumResults_t const getNumResults;
131 
133  GetResult_t const getResult;
134 
136  IsCompatible_t const isCompatible;
137 
139  Download_t const download;
140 
142  Upload_t const upload;
143 
145  StartDownload_t const startDownload;
146 
148  FinishDownload_t const finishDownload;
150 
151 private:
152  detail::Plugin* const impl_;
153 };
154 }
155 #endif //LUNCHBOX_PLUGIN_H
Helper to access dynamic shared objects (DSO)
Definition: dso.h:35
IsCompatible_t const isCompatible
Check if the transfer plugin can be used.
Definition: plugin.h:136
LUNCHBOX_API VisitorResult accept(PluginVisitor &visitor)
Visit all compressors.
StartDownload_t const startDownload
Start downloading pixel data.
Definition: plugin.h:145
Basic type definitions not provided by the operating system.
DeleteCompressor_t const deleteCompressor
Delete the compressor instance.
Definition: plugin.h:118
The API to create runtime-loadable compression plugins.
GetNumResults_t const getNumResults
Get the number of results from the last compression.
Definition: plugin.h:130
GetResult_t const getResult
Get the nth result from the last compression.
Definition: plugin.h:133
LUNCHBOX_API Plugin(const std::string &libraryName)
Construct and initialize a new plugin DSO.
DeleteDecompressor_t const deleteDecompressor
Delete the decompressor instance.
Definition: plugin.h:121
Information about one compressor.
LUNCHBOX_API bool isGood() const
Visitor for all plugins and compressors of a Plugin or PluginRegistry.
Definition: pluginVisitor.h:31
GetNumCompressors_t const getNumCompressors
Get the number of engines found in the plugin.
Definition: plugin.h:109
NewCompressor_t const newCompressor
Get a new compressor instance.
Definition: plugin.h:112
NewDecompressor_t const newDecompressor
Get a new decompressor instance.
Definition: plugin.h:115
VisitorResult
The result code from any visit operation.
Definition: visitorResult.h:29
Download_t const download
Download pixel data.
Definition: plugin.h:139
Holder for all functions and information of one compression plugin DSO.
Definition: plugin.h:38
Upload_t const upload
Upload pixel data.
Definition: plugin.h:142
FinishDownload_t const finishDownload
Start downloading pixel data.
Definition: plugin.h:148
virtual LUNCHBOX_API ~Plugin()
Destruct this plugin handle.
Decompress_t const decompress
Decompress data.
Definition: plugin.h:127
Compress_t const compress
Compress data.
Definition: plugin.h:124