Pression  1.2.0
Compressor, decompressor, uploader and downloader plugins
compressorResult.h
1 
2 /* Copyright (c) 2013-2015, Stefan.Eilemann@epfl.ch
3  *
4  * This file is part of Pression <https://github.com/Eyescale/Pression>
5  *
6  * This library is free software; you can redistribute it and/or modify it under
7  * the terms of the GNU Lesser General Public License version 2.1 as published
8  * by the Free Software Foundation.
9  *
10  * This library is distributed in the hope that it will be useful, but WITHOUT
11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12  * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
13  * details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with this library; if not, write to the Free Software Foundation, Inc.,
17  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18  */
19 
20 #ifndef PRESSION_COMPRESSORRESULT_H
21 #define PRESSION_COMPRESSORRESULT_H
22 
23 #include <pression/plugins/compressorTypes.h> // EQ_COMPRESSOR_INVALID
24 #include <lunchbox/array.h> // used inline as CompressorChunk
25 
26 namespace pression
27 {
35 {
36  CompressorResult() : compressor( EQ_COMPRESSOR_INVALID ) {}
37  CompressorResult( const unsigned n, const CompressorChunks& c )
38  : compressor( n ), chunks( c ) {}
39 
41  uint64_t getSize() const
42  {
43  uint64_t size = 0;
44  for( const CompressorChunk& chunk : chunks )
45  size += chunk.getNumBytes();
46  return size;
47  }
48 
50  bool isCompressed() const
51  {
52  return compressor != EQ_COMPRESSOR_INVALID &&
53  compressor != EQ_COMPRESSOR_NONE &&
54  compressor != EQ_COMPRESSOR_AUTO;
55  }
56 
57  unsigned compressor;
58  CompressorChunks chunks;
59 };
60 }
61 #endif // PRESSION_COMPRESSORRESULT_H
#define EQ_COMPRESSOR_INVALID
Invalid Compressor.
#define EQ_COMPRESSOR_NONE
No Compressor.
#define EQ_COMPRESSOR_AUTO
Automatic selection of compressor.
Compression plugin names.
A structure to hold the results from one compress operation.