Skip to content

Commit 5b38569

Browse files
committed
remove output_stream
1 parent 9c507bc commit 5b38569

File tree

8 files changed

+22
-145
lines changed

8 files changed

+22
-145
lines changed

CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,6 @@ set(SPARROW_IPC_HEADERS
116116
${SPARROW_IPC_INCLUDE_DIR}/sparrow_ipc/magic_values.hpp
117117
${SPARROW_IPC_INCLUDE_DIR}/sparrow_ipc/memory_output_stream.hpp
118118
${SPARROW_IPC_INCLUDE_DIR}/sparrow_ipc/metadata.hpp
119-
${SPARROW_IPC_INCLUDE_DIR}/sparrow_ipc/output_stream.hpp
120119
${SPARROW_IPC_INCLUDE_DIR}/sparrow_ipc/serialize_utils.hpp
121120
${SPARROW_IPC_INCLUDE_DIR}/sparrow_ipc/serialize.hpp
122121
${SPARROW_IPC_INCLUDE_DIR}/sparrow_ipc/serializer.hpp

include/sparrow_ipc/any_output_stream.hpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#pragma once
22

3-
#include <array>
43
#include <concepts>
54
#include <cstddef>
65
#include <cstdint>
@@ -26,8 +25,8 @@ namespace sparrow_ipc
2625
/**
2726
* @brief Type-erased wrapper for any stream-like object.
2827
*
29-
* This class provides type erasure for ANY type that supports stream operations,
30-
* not just those derived from output_stream. It uses the concept-based type erasure
28+
* This class provides type erasure for ANY type that supports stream operations.
29+
* It uses the concept-based type erasure
3130
* pattern to wrap any stream-like object polymorphically.
3231
*
3332
* @details This implementation uses the classic type erasure pattern with:
@@ -37,7 +36,6 @@ namespace sparrow_ipc
3736
*
3837
* Usage:
3938
* @code
40-
* // Works with output_stream derived classes
4139
* std::vector<uint8_t> buffer;
4240
* memory_output_stream<std::vector<uint8_t>> mem_stream(buffer);
4341
* any_output_stream stream1(mem_stream);

include/sparrow_ipc/chunk_memory_output_stream.hpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
#pragma once
22

33
#include <cstdint>
4+
#include <functional>
45
#include <numeric>
56
#include <ranges>
6-
7-
#include "sparrow_ipc/output_stream.hpp"
7+
#include <vector>
88

99
namespace sparrow_ipc
1010
{
1111
/**
1212
* @brief An output stream that writes data into separate memory chunks.
1313
*
14-
* This template class implements an output_stream that stores data in discrete memory chunks
14+
* This template class stores data in discrete memory chunks
1515
* rather than a single contiguous buffer. Each write operation creates a new chunk, making it
1616
* suitable for scenarios where data needs to be processed or transmitted in separate units.
1717
*
@@ -29,7 +29,7 @@ namespace sparrow_ipc
2929
requires std::ranges::random_access_range<R>
3030
&& std::ranges::random_access_range<std::ranges::range_value_t<R>>
3131
&& std::same_as<typename std::ranges::range_value_t<R>::value_type, uint8_t>
32-
class chunked_memory_output_stream final : public output_stream
32+
class chunked_memory_output_stream
3333
{
3434
public:
3535

@@ -51,7 +51,7 @@ namespace sparrow_ipc
5151
* @param count Number of characters to write
5252
* @return Reference to this stream for method chaining
5353
*/
54-
chunked_memory_output_stream<R>& write(const char* s, std::streamsize count) final;
54+
chunked_memory_output_stream<R>& write(const char* s, std::streamsize count);
5555

5656
/**
5757
* @brief Writes a span of bytes as a new chunk.
@@ -61,7 +61,7 @@ namespace sparrow_ipc
6161
* @param span A span of bytes to write as a new chunk
6262
* @return Reference to this stream for method chaining
6363
*/
64-
chunked_memory_output_stream<R>& write(std::span<const std::uint8_t> span) final;
64+
chunked_memory_output_stream<R>& write(std::span<const std::uint8_t> span);
6565

6666
/**
6767
* @brief Writes a buffer by moving it into the chunk container.
@@ -83,7 +83,7 @@ namespace sparrow_ipc
8383
* @param count Number of times to repeat the value
8484
* @return Reference to this stream for method chaining
8585
*/
86-
chunked_memory_output_stream<R>& write(uint8_t value, std::size_t count) final;
86+
chunked_memory_output_stream<R>& write(uint8_t value, std::size_t count);
8787

8888
/**
8989
* @brief Writes a single character as a new chunk.
@@ -93,7 +93,7 @@ namespace sparrow_ipc
9393
* @param value The character value to write
9494
* @return Reference to this stream for method chaining
9595
*/
96-
chunked_memory_output_stream<R>& put(char value) final;
96+
chunked_memory_output_stream<R>& put(char value);
9797

9898
/**
9999
* @brief Reserves capacity in the chunk container.
@@ -103,7 +103,7 @@ namespace sparrow_ipc
103103
*
104104
* @param size Number of chunks to reserve space for
105105
*/
106-
void reserve(std::size_t size) override;
106+
void reserve(std::size_t size);
107107

108108
/**
109109
* @brief Reserves capacity using a lazy calculation function.
@@ -112,7 +112,7 @@ namespace sparrow_ipc
112112
*
113113
* @param calculate_reserve_size Function that returns the number of chunks to reserve
114114
*/
115-
void reserve(const std::function<std::size_t()>& calculate_reserve_size) override;
115+
void reserve(const std::function<std::size_t()>& calculate_reserve_size);
116116

117117
/**
118118
* @brief Gets the total size of all chunks.
@@ -121,7 +121,7 @@ namespace sparrow_ipc
121121
*
122122
* @return The total number of bytes across all chunks
123123
*/
124-
[[nodiscard]] size_t size() const override;
124+
[[nodiscard]] size_t size() const;
125125

126126
private:
127127

include/sparrow_ipc/memory_output_stream.hpp

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11

22
#include <cstdint>
3+
#include <functional>
34
#include <ranges>
45

5-
#include "sparrow_ipc/output_stream.hpp"
6-
76
namespace sparrow_ipc
87
{
98
/**
@@ -26,7 +25,7 @@ namespace sparrow_ipc
2625
*/
2726
template <typename R>
2827
requires std::ranges::random_access_range<R> && std::same_as<typename R::value_type, uint8_t>
29-
class memory_output_stream final : public output_stream
28+
class memory_output_stream
3029
{
3130
public:
3231

@@ -52,7 +51,7 @@ namespace sparrow_ipc
5251
*
5352
* @note The characters are converted to uint8_t and appended to the buffer
5453
*/
55-
memory_output_stream& write(const char* s, std::streamsize count) final;
54+
memory_output_stream& write(const char* s, std::streamsize count);
5655

5756
/**
5857
* @brief Writes a span of bytes to the buffer.
@@ -62,7 +61,7 @@ namespace sparrow_ipc
6261
* @param span A span of bytes to write
6362
* @return Reference to this stream for method chaining
6463
*/
65-
memory_output_stream& write(std::span<const std::uint8_t> span) final;
64+
memory_output_stream& write(std::span<const std::uint8_t> span);
6665

6766
/**
6867
* @brief Writes a byte value repeated a specified number of times.
@@ -74,7 +73,7 @@ namespace sparrow_ipc
7473
* @param count Number of times to repeat the value
7574
* @return Reference to this stream for method chaining
7675
*/
77-
memory_output_stream& write(uint8_t value, std::size_t count) final;
76+
memory_output_stream& write(uint8_t value, std::size_t count);
7877

7978
/**
8079
* @brief Writes a single character to the buffer.
@@ -84,7 +83,7 @@ namespace sparrow_ipc
8483
* @param value The character value to write
8584
* @return Reference to this stream for method chaining
8685
*/
87-
memory_output_stream& put(char value) final;
86+
memory_output_stream& put(char value);
8887

8988
/**
9089
* @brief Reserves capacity in the underlying buffer.
@@ -94,7 +93,7 @@ namespace sparrow_ipc
9493
*
9594
* @param size Number of bytes to reserve
9695
*/
97-
void reserve(std::size_t size) override;
96+
void reserve(std::size_t size);
9897

9998
/**
10099
* @brief Reserves capacity using a lazy calculation function.
@@ -103,14 +102,14 @@ namespace sparrow_ipc
103102
*
104103
* @param calculate_reserve_size Function that returns the number of bytes to reserve
105104
*/
106-
void reserve(const std::function<std::size_t()>& calculate_reserve_size) override;
105+
void reserve(const std::function<std::size_t()>& calculate_reserve_size);
107106

108107
/**
109108
* @brief Gets the current size of the buffer.
110109
*
111110
* @return The number of bytes currently in the buffer
112111
*/
113-
[[nodiscard]] size_t size() const override;
112+
[[nodiscard]] size_t size() const;
114113

115114
private:
116115

include/sparrow_ipc/output_stream.hpp

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

include/sparrow_ipc/serialize.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
#include "sparrow_ipc/any_output_stream.hpp"
99
#include "sparrow_ipc/config/config.hpp"
1010
#include "sparrow_ipc/magic_values.hpp"
11-
#include "sparrow_ipc/output_stream.hpp"
1211
#include "sparrow_ipc/serialize_utils.hpp"
1312
#include "sparrow_ipc/utils.hpp"
1413

include/sparrow_ipc/serialize_utils.hpp

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
#include "Message_generated.h"
99
#include "sparrow_ipc/any_output_stream.hpp"
1010
#include "sparrow_ipc/config/config.hpp"
11-
#include "sparrow_ipc/output_stream.hpp"
1211
#include "sparrow_ipc/utils.hpp"
1312

1413
namespace sparrow_ipc
@@ -169,17 +168,5 @@ namespace sparrow_ipc
169168
*/
170169
[[nodiscard]] SPARROW_IPC_API int64_t calculate_body_size(const sparrow::record_batch& record_batch);
171170

172-
173-
/**
174-
* @brief Adds padding bytes to an output stream to ensure 8-byte alignment.
175-
*
176-
* This function appends zero bytes to the end of the provided stream until
177-
* its size is a multiple of 8. This is often required for proper memory
178-
* alignment in binary formats such as Apache Arrow IPC.
179-
*
180-
* @param stream The output stream where padding bytes will be added
181-
*/
182-
SPARROW_IPC_API void add_padding(output_stream& stream);
183-
184171
SPARROW_IPC_API std::vector<sparrow::data_type> get_column_dtypes(const sparrow::record_batch& rb);
185172
}

tests/test_serializer.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
#include <doctest/doctest.h>
55
#include <sparrow/record_batch.hpp>
66

7-
#include "sparrow_ipc/any_output_stream.hpp"
87
#include "sparrow_ipc/memory_output_stream.hpp"
98
#include "sparrow_ipc/serializer.hpp"
109
#include "sparrow_ipc_tests_helpers.hpp"

0 commit comments

Comments
 (0)