PLCnext API Documentation 25.0.2.69
RscStreamReader.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 RscStreamWriter;
20
22class ARP_EXPORT RscStreamReader
23{
24 friend class RscStreamWriter;
25
26public: // construction
28 explicit RscStreamReader(RscReader& reader);
29
30public: // setter/getter
31 bool IsEmpty(void)const;
32
33public: // Read/Deserialize operation
34 size_t Read(byte* pBuffer, size_t bufferSize);
35 void DeserializeTo(Stream& stream);
36 void DeserializeTo(RscStreamWriter& streamWriter);
37 void Skip(void);
38
39private: // methods
40 void BeginRead(void); // this operation is private now and invoked implicit
41 void CheckNotEmpty(void);
42
43private: // fields
44 RscReader* pReader = nullptr;
45 bool hasBegunRead = false;
46 size_t count = 0;
47 size_t remaining = 0;
48
49private: // static fields
50 static constexpr size_t defaultBufferSize = 4096;
51
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
RscStreamReader(void)
Constructs an empty instance of RscStreamReader
Enables Rsc services to marshal large data packets as stream.
Definition: RscStreamWriter.hpp:23
Reads marshaled data of RSC services.
Definition: RscReader.hpp:34
@ Read
Specifies read access to the file. Data can be read from the file and the file pointer can be moved....