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 * SPDX-License-Identifier: MIT
10 ****************************************************************************/
11
12#ifndef CPL_COMPRESSOR_H_INCLUDED
13#define CPL_COMPRESSOR_H_INCLUDED
14
15#include "cpl_port.h"
16
17#include <stdbool.h>
18
25 CPL_C_START
26
57 typedef bool (*CPLCompressionFunc)(const void *input_data, size_t input_size,
58 void **output_data, size_t *output_size,
59 CSLConstList options,
60 void *compressor_user_data);
61
63 typedef enum
64{
66 CCT_COMPRESSOR,
68 CCT_FILTER
69} CPLCompressorType;
70
72 typedef struct
73{
75 int nStructVersion;
77 const char *pszId;
79 CPLCompressorType eType;
87 CSLConstList papszMetadata;
89 CPLCompressionFunc pfnFunc;
91 void *user_data;
92} CPLCompressor;
93
94 bool CPL_DLL CPLRegisterCompressor(const CPLCompressor *compressor);
95
96 bool CPL_DLL CPLRegisterDecompressor(const CPLCompressor *decompressor);
97
98 char CPL_DLL **CPLGetCompressors(void);
99
100 char CPL_DLL **CPLGetDecompressors(void);
101
102 const CPLCompressor CPL_DLL *CPLGetCompressor(const char *pszId);
103
104 const CPLCompressor CPL_DLL *CPLGetDecompressor(const char *pszId);
105
107 void CPL_DLL CPLDestroyCompressorRegistry(void);
110 CPL_C_END
111
112#endif // CPL_COMPRESSOR_H_INCLUDED
CPLGetDecompressor
const CPLCompressor * CPLGetDecompressor(const char *pszId)
Return a decompressor.
Definition: cpl_compressor.cpp:1978
CPLRegisterDecompressor
bool CPLRegisterDecompressor(const CPLCompressor *decompressor)
Register a new decompressor.
Definition: cpl_compressor.cpp:1882
CPLGetCompressors
char ** CPLGetCompressors(void)
Return the list of registered compressors.
Definition: cpl_compressor.cpp:1910
CPLGetDecompressors
char ** CPLGetDecompressors(void)
Return the list of registered decompressors.
Definition: cpl_compressor.cpp:1931
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:57
CPLCompressorType
CPLCompressorType
Type of compressor.
Definition: cpl_compressor.h:64
CCT_FILTER
@ CCT_FILTER
Filter.
Definition: cpl_compressor.h:68
CCT_COMPRESSOR
@ CCT_COMPRESSOR
Compressor.
Definition: cpl_compressor.h:66
CPLRegisterCompressor
bool CPLRegisterCompressor(const CPLCompressor *compressor)
Register a new compressor.
Definition: cpl_compressor.cpp:1850
CPLGetCompressor
const CPLCompressor * CPLGetCompressor(const char *pszId)
Return a compressor.
Definition: cpl_compressor.cpp:1954
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:283
CPL_C_START
#define CPL_C_START
Macro to start a block of C symbols.
Definition: cpl_port.h:279
CSLConstList
char ** CSLConstList
Type of a constant null-terminated list of nul terminated strings.
Definition: cpl_port.h:1179
CPLCompressor
Compressor/decompressor description.
Definition: cpl_compressor.h:73
CPLCompressor::user_data
void * user_data
User data to provide to the callback.
Definition: cpl_compressor.h:91
CPLCompressor::eType
CPLCompressorType eType
Compressor type.
Definition: cpl_compressor.h:79
CPLCompressor::nStructVersion
int nStructVersion
Structure version.
Definition: cpl_compressor.h:75
CPLCompressor::pfnFunc
CPLCompressionFunc pfnFunc
Compressor/decompressor callback.
Definition: cpl_compressor.h:89
CPLCompressor::pszId
const char * pszId
Id of the compressor/decompressor.
Definition: cpl_compressor.h:77
CPLCompressor::papszMetadata
CSLConstList papszMetadata
Metadata, as a NULL terminated list of strings.
Definition: cpl_compressor.h:87