Skip to content

Commit

Permalink
Add back constants file
Browse files Browse the repository at this point in the history
Bill-hbrhbr committed Nov 22, 2024
1 parent 4dc14f8 commit 74d62bf
Showing 8 changed files with 28 additions and 3 deletions.
1 change: 1 addition & 0 deletions components/core/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -460,6 +460,7 @@ set(SOURCE_FILES_unitTest
src/clp/streaming_archive/writer/utils.cpp
src/clp/streaming_archive/writer/utils.hpp
src/clp/streaming_compression/Compressor.hpp
src/clp/streaming_compression/Constants.hpp
src/clp/streaming_compression/Decompressor.hpp
src/clp/streaming_compression/passthrough/Compressor.cpp
src/clp/streaming_compression/passthrough/Compressor.hpp
1 change: 1 addition & 0 deletions components/core/src/clp/clg/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -89,6 +89,7 @@ set(
../streaming_archive/writer/File.hpp
../streaming_archive/writer/Segment.cpp
../streaming_archive/writer/Segment.hpp
../streaming_compression/Constants.hpp
../streaming_compression/Decompressor.hpp
../streaming_compression/passthrough/Compressor.cpp
../streaming_compression/passthrough/Compressor.hpp
1 change: 1 addition & 0 deletions components/core/src/clp/clo/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -89,6 +89,7 @@ set(
../streaming_archive/writer/File.hpp
../streaming_archive/writer/Segment.cpp
../streaming_archive/writer/Segment.hpp
../streaming_compression/Constants.hpp
../streaming_compression/Decompressor.hpp
../streaming_compression/passthrough/Compressor.cpp
../streaming_compression/passthrough/Compressor.hpp
1 change: 1 addition & 0 deletions components/core/src/clp/clp/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -117,6 +117,7 @@ set(
../streaming_archive/writer/utils.cpp
../streaming_archive/writer/utils.hpp
../streaming_compression/Compressor.hpp
../streaming_compression/Constants.hpp
../streaming_compression/Decompressor.hpp
../streaming_compression/passthrough/Compressor.cpp
../streaming_compression/passthrough/Compressor.hpp
14 changes: 14 additions & 0 deletions components/core/src/clp/streaming_compression/Constants.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#ifndef CLP_STREAMING_COMPRESSION_CONSTANTS_HPP
#define CLP_STREAMING_COMPRESSION_CONSTANTS_HPP

#include <cstddef>
#include <cstdint>

namespace clp::streaming_compression {
enum class CompressorType : uint8_t {
ZSTD = 0x10,
Passthrough = 0xFF,
};
} // namespace clp::streaming_compression

#endif // CLP_STREAMING_COMPRESSION_CONSTANTS_HPP
Original file line number Diff line number Diff line change
@@ -6,6 +6,7 @@
#include "../FileReader.hpp"
#include "../ReaderInterface.hpp"
#include "../TraceableException.hpp"
#include "Constants.hpp"

namespace clp::streaming_compression {
class Decompressor : public ReaderInterface {
@@ -24,7 +25,7 @@ class Decompressor : public ReaderInterface {
};

// Constructor
Decompressor() = default;
explicit Decompressor(CompressorType type) : m_compression_type(type) {}

// Destructor
~Decompressor() = default;
@@ -56,6 +57,10 @@ class Decompressor : public ReaderInterface {
char* extraction_buf,
size_t extraction_len
) = 0;

protected:
// Variables
CompressorType m_compression_type;
};
} // namespace clp::streaming_compression

Original file line number Diff line number Diff line change
@@ -26,7 +26,8 @@ class Decompressor : public ::clp::streaming_compression::Decompressor {

// Constructors
Decompressor()
: m_input_type(InputType::NotInitialized),
: ::clp::streaming_compression::Decompressor(CompressorType::Passthrough),
m_input_type(InputType::NotInitialized),
m_compressed_data_buf(nullptr),
m_compressed_data_buf_len(0),
m_decompressed_stream_pos(0) {}
Original file line number Diff line number Diff line change
@@ -8,7 +8,8 @@

namespace clp::streaming_compression::zstd {
Decompressor::Decompressor()
: m_input_type(InputType::NotInitialized),
: ::clp::streaming_compression::Decompressor(CompressorType::ZSTD),
m_input_type(InputType::NotInitialized),
m_decompression_stream(nullptr),
m_file_reader(nullptr),
m_file_reader_initial_pos(0),

0 comments on commit 74d62bf

Please sign in to comment.