GDAL

cpl_compressor.h
Go to the documentation of this file.
1/**********************************************************************
2 * Project: CPL - Common Portability Library
3 * Purpose: Registry of compression/decompression functions
4 * Author: Even Rouault <even.rouault at spatialys.com>
5 *
6 **********************************************************************
7 * Copyright (c) 2021, Even Rouault <even.rouault at spatialys.com>
8 *
9 * Permission is hereby granted, free of charge, to any person obtaining a
10 * copy of this software and associated documentation files (the "Software"),
11 * to deal in the Software without restriction, including without limitation
12 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
13 * and/or sell copies of the Software, and to permit persons to whom the
14 * Software is furnished to do so, subject to the following conditions:
15 *
16 * The above copyright notice and this permission notice shall be included
17 * in all copies or substantial portions of the Software.
18 *
19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
20 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
22 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
24 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25 * DEALINGS IN THE SOFTWARE.
26 ****************************************************************************/
27
28#ifndef CPL_COMPRESSOR_H_INCLUDED
29#define CPL_COMPRESSOR_H_INCLUDED
30
31#include "cpl_port.h"
32
33#include <stdbool.h>
34
41 CPL_C_START
42
73 typedef bool (*CPLCompressionFunc)(const void *input_data, size_t input_size,
74 void **output_data, size_t *output_size,
75 CSLConstList options,
76 void *compressor_user_data);
77
79 typedef enum
80{
82 CCT_COMPRESSOR,
84 CCT_FILTER
85} CPLCompressorType;
86
88 typedef struct
89{
91 int nStructVersion;
93 const char *pszId;
95 CPLCompressorType eType;
103 CSLConstList papszMetadata;
105 CPLCompressionFunc pfnFunc;
107 void *user_data;
108} CPLCompressor;
109
110 bool CPL_DLL CPLRegisterCompressor(const CPLCompressor *compressor);
111
112 bool CPL_DLL CPLRegisterDecompressor(const CPLCompressor *decompressor);
113
114 char CPL_DLL **CPLGetCompressors(void);
115
116 char CPL_DLL **CPLGetDecompressors(void);
117
118 const CPLCompressor CPL_DLL *CPLGetCompressor(const char *pszId);
119
120 const CPLCompressor CPL_DLL *CPLGetDecompressor(const char *pszId);
121
123 void CPL_DLL CPLDestroyCompressorRegistry(void);
126 CPL_C_END
127
128#endif // CPL_COMPRESSOR_H_INCLUDED
CPLGetDecompressor
const CPLCompressor * CPLGetDecompressor(const char *pszId)
Return a decompressor.
Definition cpl_compressor.cpp:1994
CPLRegisterDecompressor
bool CPLRegisterDecompressor(const CPLCompressor *decompressor)
Register a new decompressor.
Definition cpl_compressor.cpp:1898
CPLGetCompressors
char ** CPLGetCompressors(void)
Return the list of registered compressors.
Definition cpl_compressor.cpp:1926
CPLGetDecompressors
char ** CPLGetDecompressors(void)
Return the list of registered decompressors.
Definition cpl_compressor.cpp:1947
CPLCompressionFunc
bool(* CPLCompressionFunc)(const void *input_data, size_t input_size, void **output_data, size_t *output_size, CSLConstList options, void *compressor_user_data)
Callback of a compressor/decompressor.
Definition cpl_compressor.h:73
CPLCompressorType
CPLCompressorType
Type of compressor.
Definition cpl_compressor.h:80
CCT_FILTER
@ CCT_FILTER
Filter.
Definition cpl_compressor.h:84
CCT_COMPRESSOR
@ CCT_COMPRESSOR
Compressor.
Definition cpl_compressor.h:82
CPLRegisterCompressor
bool CPLRegisterCompressor(const CPLCompressor *compressor)
Register a new compressor.
Definition cpl_compressor.cpp:1866
CPLGetCompressor
const CPLCompressor * CPLGetCompressor(const char *pszId)
Return a compressor.
Definition cpl_compressor.cpp:1970
cpl_port.h
Core portability definitions for CPL.
CPL_C_END
#define CPL_C_END
Macro to end a block of C symbols.
Definition cpl_port.h:299
CPL_C_START
#define CPL_C_START
Macro to start a block of C symbols.
Definition cpl_port.h:295
CSLConstList
char ** CSLConstList
Type of a constant null-terminated list of nul terminated strings.
Definition cpl_port.h:1183
CPLCompressor
Compressor/decompressor description.
Definition cpl_compressor.h:89
CPLCompressor::user_data
void * user_data
User data to provide to the callback.
Definition cpl_compressor.h:107
CPLCompressor::eType
CPLCompressorType eType
Compressor type.
Definition cpl_compressor.h:95
CPLCompressor::nStructVersion
int nStructVersion
Structure version.
Definition cpl_compressor.h:91
CPLCompressor::pfnFunc
CPLCompressionFunc pfnFunc
Compressor/decompressor callback.
Definition cpl_compressor.h:105
CPLCompressor::pszId
const char * pszId
Id of the compressor/decompressor.
Definition cpl_compressor.h:93
CPLCompressor::papszMetadata
CSLConstList papszMetadata
Metadata, as a NULL terminated list of strings.
Definition cpl_compressor.h:103