Lunchbox  1.9.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
compressorResult.h
1 
2 /* Copyright (c) 2013-2014, Stefan.Eilemann@epfl.ch
3  *
4  * This file is part of Lunchbox <https://github.com/Eyescale/Lunchbox>
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 LUNCHBOX_COMPRESSORRESULT_H
21 #define LUNCHBOX_COMPRESSORRESULT_H
22 
23 #include <lunchbox/array.h> // used inline as CompressorChunk
24 #include <lunchbox/plugins/compressorTypes.h> // EQ_COMPRESSOR_INVALID
25 
26 namespace lunchbox
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  BOOST_FOREACH( 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 // LUNCHBOX_COMPRESSORRESULT_H
A wrapper for C arrays without any memory management.
Definition: array.h:29
size_t getNumBytes() const
Definition: array.h:36
#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.