Pression  1.0.0
Compressor, decompressor, uploader and downloader plugins
 All Classes Files Functions Variables Macros 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 Pression <https://github.com/Eyescale/Pression>
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 PRESSION_PLUGIN_H
22 #define PRESSION_PLUGIN_H
23 
24 #include <pression/api.h>
25 #include <pression/types.h>
26 #include <pression/plugins/compressor.h> // GLEW definition
27 
28 #include <lunchbox/dso.h> // base class
29 
30 namespace pression
31 {
32 namespace detail { class Plugin; }
33 
39 class Plugin : public lunchbox::DSO
40 {
41 public:
43  PRESSION_API explicit Plugin( const std::string& libraryName );
44 
46  PRESSION_API virtual ~Plugin();
47 
50  typedef size_t ( *GetNumCompressors_t ) ();
51  typedef void* ( *NewCompressor_t ) ( const unsigned );
52  typedef void ( *DeleteCompressor_t ) ( void* const );
53  typedef void* ( *NewDecompressor_t ) ( const unsigned );
54  typedef void ( *DeleteDecompressor_t ) ( void* const );
55  typedef void ( *Compress_t ) ( void* const, const unsigned,
56  void* const, const uint64_t*,
57  const uint64_t );
58  typedef unsigned ( *GetNumResults_t ) ( void* const, const unsigned );
59  typedef void ( *GetResult_t ) ( void* const, const unsigned,
60  const unsigned, void** const,
61  uint64_t* const );
62  typedef void ( *Decompress_t ) ( void* const, const unsigned,
63  const void* const*,
64  const uint64_t* const,
65  const unsigned, void* const,
66  uint64_t* const,
67  const uint64_t );
68  typedef bool ( *IsCompatible_t ) ( const unsigned, const GLEWContext* );
69  typedef void ( *Download_t )( void* const, const unsigned,
70  const GLEWContext*, const uint64_t*,
71  const unsigned, const uint64_t,
72  uint64_t*, void** );
73  typedef void ( *StartDownload_t )( void* const, const unsigned,
74  const GLEWContext*, const uint64_t*,
75  const unsigned, const uint64_t );
76  typedef void ( *FinishDownload_t )( void* const, const unsigned,
77  const GLEWContext*, const uint64_t*,
78  const uint64_t, uint64_t*, void** );
79  typedef void ( *Upload_t )( void* const, const unsigned,
80  const GLEWContext*, const void*,
81  const uint64_t*,
82  const uint64_t, const uint64_t*,
83  const unsigned );
85 
89  PRESSION_API bool isGood() const;
90 
92  PRESSION_API VisitorResult accept( PluginVisitor& visitor );
93 
95  PRESSION_API VisitorResult accept( ConstPluginVisitor& visitor ) const;
96 
98  bool implementsType( const uint32_t name ) const;
99 
101  PRESSION_API EqCompressorInfo findInfo( const uint32_t name ) const;
102 
104  PRESSION_API const CompressorInfos& getInfos() const;
106 
110  GetNumCompressors_t const getNumCompressors;
111 
113  NewCompressor_t const newCompressor;
114 
116  NewDecompressor_t const newDecompressor;
117 
119  DeleteCompressor_t const deleteCompressor;
120 
122  DeleteDecompressor_t const deleteDecompressor;
123 
125  Compress_t const compress;
126 
128  Decompress_t const decompress;
129 
131  GetNumResults_t const getNumResults;
132 
134  GetResult_t const getResult;
135 
137  IsCompatible_t const isCompatible;
138 
140  Download_t const download;
141 
143  Upload_t const upload;
144 
146  StartDownload_t const startDownload;
147 
149  FinishDownload_t const finishDownload;
151 
152 private:
153  detail::Plugin* const impl_;
154 };
155 }
156 #endif //PRESSION_PLUGIN_H
GetNumCompressors_t const getNumCompressors
Get the number of engines found in the plugin.
Definition: plugin.h:110
Download_t const download
Download pixel data.
Definition: plugin.h:140
Defines export visibility macros for library Pression.
Visitor for all plugins and compressors of a Plugin or PluginRegistry.
Definition: pluginVisitor.h:31
The API to create runtime-loadable compression plugins.
PRESSION_API VisitorResult accept(PluginVisitor &visitor)
Visit all compressors.
NewCompressor_t const newCompressor
Get a new compressor instance.
Definition: plugin.h:113
GetResult_t const getResult
Get the nth result from the last compression.
Definition: plugin.h:134
Holder for all functions and information of one compression plugin DSO.
Definition: plugin.h:39
Compress_t const compress
Compress data.
Definition: plugin.h:125
Upload_t const upload
Upload pixel data.
Definition: plugin.h:143
PRESSION_API bool isGood() const
Information about one compressor.
IsCompatible_t const isCompatible
Check if the transfer plugin can be used.
Definition: plugin.h:137
Decompress_t const decompress
Decompress data.
Definition: plugin.h:128
FinishDownload_t const finishDownload
Start downloading pixel data.
Definition: plugin.h:149
StartDownload_t const startDownload
Start downloading pixel data.
Definition: plugin.h:146
PRESSION_API Plugin(const std::string &libraryName)
Construct and initialize a new plugin DSO.
virtual PRESSION_API ~Plugin()
Destruct this plugin handle.
NewDecompressor_t const newDecompressor
Get a new decompressor instance.
Definition: plugin.h:116
DeleteCompressor_t const deleteCompressor
Delete the compressor instance.
Definition: plugin.h:119
GetNumResults_t const getNumResults
Get the number of results from the last compression.
Definition: plugin.h:131
DeleteDecompressor_t const deleteDecompressor
Delete the decompressor instance.
Definition: plugin.h:122