Arcane  4.1.12.0
User documentation
Loading...
Searching...
No Matches
IDataCompressor.h
1// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
2//-----------------------------------------------------------------------------
3// Copyright 2000-2026 CEA (www.cea.fr) IFPEN (www.ifpenergiesnouvelles.com)
4// See the top-level COPYRIGHT file for details.
5// SPDX-License-Identifier: Apache-2.0
6//-----------------------------------------------------------------------------
7/*---------------------------------------------------------------------------*/
8/* IDataCompressor.h (C) 2000-2021 */
9/* */
10/* Interface allowing data compression/decompression. */
11/*---------------------------------------------------------------------------*/
12#ifndef ARCANE_UTILS_IDATACOMPRESSOR_H
13#define ARCANE_UTILS_IDATACOMPRESSOR_H
14/*---------------------------------------------------------------------------*/
15/*---------------------------------------------------------------------------*/
16
18
19/*---------------------------------------------------------------------------*/
20/*---------------------------------------------------------------------------*/
21
22namespace Arcane
23{
24
25/*---------------------------------------------------------------------------*/
26/*---------------------------------------------------------------------------*/
27
28/*!
29 * \brief Interface of a service for compressing/decompressing data.
30 */
31class ARCANE_UTILS_EXPORT IDataCompressor
32{
33 public:
34
35 virtual ~IDataCompressor() = default;
36
37 public:
38
39 virtual void build() = 0;
40
41 public:
42
43 //! Algorithm name
44 virtual String name() const = 0;
45
46 /*!
47 * \brief Minimum array size below which compression is not useful.
48 *
49 * This can be used by the caller to avoid compressing/decompressing
50 * certain arrays. This value is not used internally by this instance.
51 *
52 * If the caller uses this value, consistency must be guaranteed both during
53 * compression and decompression (i.e.: do not call decompression for arrays
54 * whose decompressed size is less than minCompressSize() if the compress()
55 * method was not called for that array).
56 */
57 virtual Int64 minCompressSize() const = 0;
58
59 /*!
60 * \brief Compresses the data \a values and stores it in \a compressed_values.
61 *
62 * This operation may throw an IOException exception in case of an error.
63 */
64 virtual void compress(Span<const std::byte> values, Array<std::byte>& compressed_values) = 0;
65
66 /*!
67 * \brief Decompresses the data \a compressed_values and stores it in \a values.
68 *
69 * \a values must already have been allocated to the necessary size to contain
70 * the decompressed data.
71 * This operation may throw an IOException exception in case of an error.
72 */
73 virtual void decompress(Span<const std::byte> compressed_values, Span<std::byte> values) = 0;
74};
75
76/*---------------------------------------------------------------------------*/
77/*---------------------------------------------------------------------------*/
78
79} // End namespace Arcane
80
81/*---------------------------------------------------------------------------*/
82/*---------------------------------------------------------------------------*/
83
84#endif
Declarations of types used in Arcane.
Base class for 1D data vectors.
Interface of a service for compressing/decompressing data.
virtual String name() const =0
Algorithm name.
virtual void decompress(Span< const std::byte > compressed_values, Span< std::byte > values)=0
Decompresses the data compressed_values and stores it in values.
virtual void compress(Span< const std::byte > values, Array< std::byte > &compressed_values)=0
Compresses the data values and stores it in compressed_values.
virtual Int64 minCompressSize() const =0
Minimum array size below which compression is not useful.
View of an array of elements of type T.
Definition Span.h:635
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --
std::int64_t Int64
Signed integer type of 64 bits.