Open Inventor Release 2024.1.0
 
Loading...
Searching...
No Matches
SoDataCompressor.h
Go to the documentation of this file.
1/*=======================================================================
2 *** THE CONTENT OF THIS WORK IS PROPRIETARY TO FEI S.A.S, (FEI S.A.S.), ***
3 *** AND IS DISTRIBUTED UNDER A LICENSE AGREEMENT. ***
4 *** ***
5 *** REPRODUCTION, DISCLOSURE, OR USE, IN WHOLE OR IN PART, OTHER THAN AS ***
6 *** SPECIFIED IN THE LICENSE ARE NOT TO BE UNDERTAKEN EXCEPT WITH PRIOR ***
7 *** WRITTEN AUTHORIZATION OF FEI S.A.S. ***
8 *** ***
9 *** RESTRICTED RIGHTS LEGEND ***
10 *** USE, DUPLICATION, OR DISCLOSURE BY THE GOVERNMENT OF THE CONTENT OF THIS ***
11 *** WORK OR RELATED DOCUMENTATION IS SUBJECT TO RESTRICTIONS AS SET FORTH IN ***
12 *** SUBPARAGRAPH (C)(1) OF THE COMMERCIAL COMPUTER SOFTWARE RESTRICTED RIGHT ***
13 *** CLAUSE AT FAR 52.227-19 OR SUBPARAGRAPH (C)(1)(II) OF THE RIGHTS IN ***
14 *** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 52.227-7013. ***
15 *** ***
16 *** COPYRIGHT (C) 1996-2023 BY FEI S.A.S, ***
17 *** BORDEAUX, FRANCE ***
18 *** ALL RIGHTS RESERVED ***
19**=======================================================================*/
20/*=======================================================================
21** Author : VSG (MMM YYYY)
22**=======================================================================*/
23
24
25#ifndef SO_DATA_COMPRESSOR_H
26#define SO_DATA_COMPRESSOR_H
27
28#ifdef _MSC_VER
29#pragma warning( push )
30#pragma warning(disable:4251)
31#endif
32
34#include <Inventor/sys/port.h>
35#include <Inventor/SbString.h>
37#include <Inventor/SbLinear.h>
38#include <Inventor/SbDataType.h>
39#include <Inventor/STL/vector>
40
41#include <LDM/nodes/SoDataSet.h>
42
66{
68
69public:
70
101
111
116
120 SoDataCompressor() : m_level(0){}
124 virtual ~SoDataCompressor() {}
125
134 virtual size_t compress(void *src, size_t srcLen, const TileInfo &tileInfo) = 0;
135
144 virtual size_t uncompress(void *dest, size_t destLen, const TileInfo &tileInfo) = 0;
145
153
165 virtual bool isLossless() = 0;
166
172 virtual void setCompressionLevel(size_t level) { m_level = level; }
173
179 virtual void *allocateCompressedBuffer(size_t size)
180 {
181 m_size = size;
182 m_compressedBuffer.resize(size);
183 if ( size>0)
184 return &m_compressedBuffer[0];
185 else
186 return NULL;
187 }
188
194 virtual void *getCompressedBuffer() { return &m_compressedBuffer[0]; }
195
203 static size_t crc32(const void *buf, size_t len);
204
209 virtual size_t getCompressionLevel() { return m_level; };
210
211 private:
212
213 size_t getSize() { return m_size;};
214 size_t m_size;
215
216private:
217 SbString m_compressionName;
218
219 std::vector<unsigned char> m_compressedBuffer;
220
221 size_t m_level;
222};
223
224#ifdef _MSC_VER
225#pragma warning( pop )
226#endif
227
228#endif
#define SO_TYPED_CLASS_ABSTRACT_HEADER()
Class encoding a data type.
Definition SbDataType.h:58
Class for smart character strings.
Definition SbString.h:202
Maintains a list of pointers to SbString instances.
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> 2D vector class ...
Definition SbVec.h:314
3D vector class.
Definition SbVec.h:1517
<a href="IconLegend.html"><img src="extLDM.gif" alt="Large Data Management" border="0"></a> Data com...
static SbStringList getAvailableCompressors()
Return a list of all available compressors.
static size_t crc32(const void *buf, size_t len)
Utility function to get the CRC32 of a buffer.
static SoDataCompressor * getAppropriateCompressor(const SbString &name)
Create and return an instance of a compressor of the given type.
virtual void * getCompressedBuffer()
Returns the compressed data.
virtual bool isLossless()=0
Returns true if the compression algorithm is lossless.
virtual ~SoDataCompressor()
Destructor.
SoDataCompressor()
Constructor.
virtual void * allocateCompressedBuffer(size_t size)
Allocates the internal buffer to hold the compressed data.
virtual void setCompressionLevel(size_t level)
Sets the compression level.
virtual size_t uncompress(void *dest, size_t destLen, const TileInfo &tileInfo)=0
Uncompresses data from the internal buffer to the given buffer.
virtual size_t compress(void *src, size_t srcLen, const TileInfo &tileInfo)=0
Compresses the given buffer into the internal buffer.
virtual SbString getCompressionFormatName() const =0
Returns the name of the compression algorithm used by this class.
virtual size_t getCompressionLevel()
Returns the compression level.
DataType
Supported data type.
Definition SoDataSet.h:604
Base class for object storing runtime type information.
size_t size() const
This structure contains the dimension and the type of the tile being processed.
SbVec3i32 dims
Dimensions of the tile.
SbVec2d range
Data range of the tile's volume.
TileInfo(const SbVec3i32 &dims, const SbDataType &dataType)
TileInfo(const SbVec3i32 &dims, const SbDataType &dataType, const SbVec2d &range)
SoDataSet::DataType dataType
Tile's data type (byte, int, etc.).
bool isRGBA
True if tile data is a RGBA color packed in a 32bits integer.