PLCnext API Documentation 25.0.2.69
RscStreamWriter.hpp
1
2//
3// Copyright Phoenix Contact GmbH & Co. KG
4//
6#pragma once
8#include "Arp/Base/Rsc/Commons/Rsc.hpp"
9#include "Arp/Base/Commons/Io/Stream.hpp"
10
11namespace Arp::Base::Rsc::Commons
12{
13
14// Type imports
17
18// forwards
19class RscStreamReader;
20
22class ARP_EXPORT RscStreamWriter
23{
24 friend class RscStreamReader;
25
26public: // construction
28 explicit RscStreamWriter(RscWriter& writer);
29
30public: // setter/getter
31 bool IsEmpty(void)const;
32
33public: // Write operations (only allowed if RemotingWriter is set)
34 void Write(const byte* buffer, size_t bufferSize);
35 void SerializeFrom(Stream& stream);
36 void SerializeFrom(RscStreamReader& streamReader);
37 void Flush(void);
38
39private: // methods
40 void BeginWrite(void); // this operation is private now and invoked implicit
41 void EndWrite(void); // this operation is private now and invoked implicit
42 void CheckNotEmpty(void);
43
44private: // fields
45 RscWriter* pWriter = nullptr;
46 bool hasBegunWrite = false;
47
48private: // static fields
49 static constexpr int32 maxPacketSize = std::numeric_limits<int32>::max();
50 static constexpr size_t copyBufferSize = 4096;
51 static constexpr int32 endTag = -1;
52};
53
54} // end of namespace Arp::Base::Rsc::Commons
This abstract class shall be the base class of all stream implementations.
Definition: Stream.hpp:20
Enables Rsc services to marshal large data packets as stream.
Definition: RscStreamReader.hpp:23
Enables Rsc services to marshal large data packets as stream.
Definition: RscStreamWriter.hpp:23
RscStreamWriter(void)
Constructs an empty instance of RscStreamWriter
Writes marshalled data of RSC services.
Definition: RscWriter.hpp:34
std::int32_t int32
The Arp integer type of 4 byte size.
Definition: PrimitiveTypes.hpp:35
@ Write
Specifies write access to the file. Data can be written to the file and the file pointer can be moved...