Skip to content

Commit 18ea029

Browse files
authored
refactor(core): Remove clp::Array and migrate to ystdlib::containers::Array. (#712)
1 parent f374113 commit 18ea029

File tree

19 files changed

+31
-194
lines changed

19 files changed

+31
-194
lines changed

components/core/CMakeLists.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,6 @@ set(SOURCE_FILES_reducer_unitTest
370370
)
371371

372372
set(SOURCE_FILES_unitTest
373-
src/clp/Array.hpp
374373
src/clp/aws/AwsAuthenticationSigner.cpp
375374
src/clp/aws/AwsAuthenticationSigner.hpp
376375
src/clp/aws/constants.hpp
@@ -598,7 +597,6 @@ set(SOURCE_FILES_unitTest
598597
submodules/sqlite3/sqlite3ext.h
599598
tests/LogSuppressor.hpp
600599
tests/TestOutputCleaner.hpp
601-
tests/test-Array.cpp
602600
tests/test-BoundedReader.cpp
603601
tests/test-BufferedFileReader.cpp
604602
tests/test-clp_s-end_to_end.cpp
@@ -663,6 +661,7 @@ target_link_libraries(unitTest
663661
clp::regex_utils
664662
clp::string_utils
665663
yaml-cpp::yaml-cpp
664+
ystdlib::containers
666665
ystdlib::error_handling
667666
${LIBLZMA_LIBRARIES}
668667
ZStd::ZStd

components/core/src/clp/Array.hpp

Lines changed: 0 additions & 111 deletions
This file was deleted.

components/core/src/clp/NetworkReader.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
#include <vector>
1919

2020
#include <curl/curl.h>
21+
#include <ystdlib/containers/Array.hpp>
2122

22-
#include "Array.hpp"
2323
#include "CurlDownloadHandler.hpp"
2424
#include "CurlGlobalInstance.hpp"
2525
#include "ErrorCode.hpp"
@@ -344,7 +344,7 @@ class NetworkReader : public ReaderInterface {
344344
size_t m_buffer_size{cDefaultBufferSize};
345345
size_t m_curr_downloader_buf_idx{0};
346346

347-
std::vector<Array<char>> m_buffer_pool;
347+
std::vector<ystdlib::containers::Array<char>> m_buffer_pool;
348348
std::queue<BufferView> m_filled_buffer_queue;
349349
std::optional<BufferView> m_curr_downloader_buf;
350350
std::optional<BufferView> m_curr_reader_buf;

components/core/src/clp/clg/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ target_link_libraries(clg
139139
${STD_FS_LIBS}
140140
clp::string_utils
141141
yaml-cpp::yaml-cpp
142+
ystdlib::containers
142143
ZStd::ZStd
143144
)
144145
# Put the built executable at the root of the build directory

components/core/src/clp/clo/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@ target_link_libraries(clo
167167
${sqlite_LIBRARY_DEPENDENCIES}
168168
${STD_FS_LIBS}
169169
clp::string_utils
170+
ystdlib::containers
170171
ZStd::ZStd
171172
)
172173
# Put the built executable at the root of the build directory

components/core/src/clp/clp/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,7 @@ target_link_libraries(clp
181181
${STD_FS_LIBS}
182182
clp::string_utils
183183
yaml-cpp::yaml-cpp
184+
ystdlib::containers
184185
ZStd::ZStd
185186
)
186187
# Put the built executable at the root of the build directory

components/core/src/clp/make_dictionaries_readable/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ target_link_libraries(make-dictionaries-readable
4949
log_surgeon::log_surgeon
5050
spdlog::spdlog
5151
clp::string_utils
52+
ystdlib::containers
5253
ZStd::ZStd
5354
)
5455
# Put the built executable at the root of the build directory

components/core/src/clp/streaming_archive/ArchiveMetadata.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
#include <sys/stat.h>
44

55
#include <fmt/core.h>
6+
#include <ystdlib/containers/Array.hpp>
67

7-
#include "../Array.hpp"
88
#include "../FileReader.hpp"
99

1010
namespace clp::streaming_archive {
@@ -26,7 +26,7 @@ auto ArchiveMetadata::create_from_file(std::string_view file_path) -> ArchiveMet
2626
throw OperationFailed(clp_rc, __FILENAME__, __LINE__);
2727
}
2828

29-
clp::Array<char> buf{static_cast<size_t>(file_stat.st_size)};
29+
ystdlib::containers::Array<char> buf(static_cast<size_t>(file_stat.st_size));
3030
if (auto const clp_rc = file_reader.try_read_exact_length(buf.data(), buf.size());
3131
clp::ErrorCode::ErrorCode_Success != clp_rc)
3232
{

components/core/src/clp/streaming_compression/lzma/Compressor.hpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
#include <cstdint>
66

77
#include <lzma.h>
8+
#include <ystdlib/containers/Array.hpp>
89

9-
#include "../../Array.hpp"
1010
#include "../../ErrorCode.hpp"
1111
#include "../../TraceableException.hpp"
1212
#include "../../WriterInterface.hpp"
@@ -37,7 +37,8 @@ class Compressor : public ::clp::streaming_compression::Compressor {
3737
Compressor() : Compressor{cDefaultCompressionLevel, cDefaultDictionarySize, LZMA_CHECK_CRC64} {}
3838

3939
Compressor(int compression_level, size_t dict_size, lzma_check check)
40-
: m_lzma_stream{compression_level, dict_size, check} {}
40+
: m_compressed_stream_block_buffer(cCompressedStreamBlockBufferSize),
41+
m_lzma_stream{compression_level, dict_size, check} {}
4142

4243
// Destructor
4344
~Compressor() override = default;
@@ -224,7 +225,7 @@ class Compressor : public ::clp::streaming_compression::Compressor {
224225
WriterInterface* m_compressed_stream_writer{nullptr};
225226

226227
// Compressed stream variables
227-
Array<uint8_t> m_compressed_stream_block_buffer{cCompressedStreamBlockBufferSize};
228+
ystdlib::containers::Array<uint8_t> m_compressed_stream_block_buffer;
228229
LzmaStream m_lzma_stream;
229230
size_t m_uncompressed_stream_pos{0};
230231
};

components/core/src/clp/streaming_compression/zstd/Compressor.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111

1212
namespace clp::streaming_compression::zstd {
1313
Compressor::Compressor()
14-
: m_compressed_stream_block{
14+
: m_compressed_stream_block_buffer(ZSTD_CStreamOutSize()),
15+
m_compressed_stream_block{
1516
.dst = m_compressed_stream_block_buffer.data(),
1617
.size = m_compressed_stream_block_buffer.size(),
1718
.pos = 0

0 commit comments

Comments
 (0)