Skip to content

Commit a7b0b20

Browse files
committedMay 5, 2023
OrcLib: Stream: add Stream
1 parent e1c84d5 commit a7b0b20

File tree

2 files changed

+40
-0
lines changed

2 files changed

+40
-0
lines changed
 

‎src/OrcLib/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -582,6 +582,7 @@ set(SRC_STREAM
582582
"Stream/FileStreamConcept.cpp"
583583
"Stream/SeekDirection.h"
584584
"Stream/SpanStreamConcept.h"
585+
"Stream/Stream.h"
585586
"Stream/StreamConcept.h"
586587
)
587588

‎src/OrcLib/Stream/Stream.h

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
//
2+
// SPDX-License-Identifier: LGPL-2.1-or-later
3+
//
4+
// Copyright © 2022 ANSSI. All Rights Reserved.
5+
//
6+
// Author(s): fabienfl (ANSSI)
7+
//
8+
#pragma once
9+
10+
#include <memory>
11+
12+
#include "Stream/SeekDirection.h"
13+
#include "Utils/BufferSpan.h"
14+
#include "Utils/BufferView.h"
15+
16+
//
17+
// Lightweight stream interface to replace ByteStream
18+
//
19+
20+
namespace Orc {
21+
namespace Stream {
22+
23+
class Stream
24+
{
25+
public:
26+
using Ptr = std::shared_ptr<Stream>;
27+
28+
virtual ~Stream() {}
29+
30+
virtual size_t Read(BufferSpan output, std::error_code& ec) = 0;
31+
virtual size_t Write(BufferView& input, std::error_code& ec) = 0;
32+
virtual uint64_t Seek(SeekDirection direction, int64_t value, std::error_code& ec) = 0;
33+
};
34+
35+
} // namespace Stream
36+
37+
using Stream = Stream::Stream;
38+
39+
} // namespace Orc

0 commit comments

Comments
 (0)
Please sign in to comment.