Pression  1.1.1
Compressor, decompressor, uploader and downloader plugins
compressor.h
1 
2 /* Copyright (c) 2010, Cedric Stalder <cedric.stalder@gmail.com>
3  * 2010-2014, Stefan Eilemann <eile@eyescale.ch>
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_COMPRESSOR_H
22 #define PRESSION_COMPRESSOR_H
23 
24 #include <pression/api.h>
25 #include <pression/types.h>
26 #include <lunchbox/thread.h> // thread-safety macros
27 
28 namespace pression
29 {
30 namespace detail { class Compressor; }
31 
38 {
39  typedef detail::Compressor* const Compressor::*bool_t;
40 
41 public:
43  PRESSION_API Compressor();
44 
52  PRESSION_API Compressor( PluginRegistry& from, const uint32_t name );
53 
55  PRESSION_API virtual ~Compressor();
56 
58  PRESSION_API bool isGood() const;
59 
64  operator bool_t() const { return isGood() ? &Compressor::impl_ : 0; }
65 
67  bool operator ! () const { return !isGood(); }
68 
73  PRESSION_API bool uses( const uint32_t name ) const;
74 
76  PRESSION_API const EqCompressorInfo& getInfo() const;
77 
93  static PRESSION_API uint32_t choose( const PluginRegistry& registry,
94  const uint32_t tokenType,
95  const float minQuality,
96  const bool ignoreMSE );
97 
106  PRESSION_API bool setup( PluginRegistry& from, const uint32_t name );
107 
113  PRESSION_API bool setup( PluginRegistry& registry, const uint32_t tokenType,
114  const float minQuality, const bool ignoreMSE );
115 
117  PRESSION_API bool realloc();
118 
120  PRESSION_API void clear();
121 
129  PRESSION_API void compress( void* const in, const uint64_t inDims[2] );
130 
139  PRESSION_API void compress( void* const in, const uint64_t pvp[4],
140  const uint64_t flags );
141 
146  PRESSION_API unsigned getNumResults() const LB_DEPRECATED;
147 
152  PRESSION_API CompressorResult getResult() const;
153 
155  PRESSION_API void getResult( const unsigned i, void** const out,
156  uint64_t* const outSize ) const LB_DEPRECATED;
157 
158 private:
159  Compressor( const Compressor& );
160  Compressor operator=( const Compressor& );
161  detail::Compressor* const impl_;
162  LB_TS_VAR( _thread );
163 };
164 }
165 #endif // PRESSION_COMPRESSOR_H
Defines export visibility macros for library Pression.
Information about one compressor.
A C++ class to handle one compressor plugin instance.
Definition: compressor.h:37
A structure to hold the results from one compress operation.
A registry for loaded plugins.