PLCnext API Documentation 24.0.0.71
RemotingWriter.hpp
1
2//
3// Copyright PHOENIX CONTACT Electronics GmbH
4//
6#pragma once
8#include "Arp/System/Rsc/Services/Rsc.h"
9
10// forwards
11namespace CommonRemoting
12{
13class BinaryWriter2;
14}
15
16namespace Arp { namespace System { namespace Rsc { namespace Services
17{
18
19using namespace CommonRemoting;
20
21//forwards
22class RscWriter;
23class RscClientContext;
24
29class RemotingWriter
30{
31 friend class RscStream;
32
33public: // construction
34 RemotingWriter(BinaryWriter2& remotingWriter, RscWriter& rscWriter, RscClientContext* pRscClientContext = nullptr);
35
36public: // getter
37 RscWriter& GetRscWriter(void);
38 bool HasDataTagging(void)const;
39
40public: // methods
41 void WriteDateTime(const DateTime& result);
42 void WriteArrayLength(size_t value);
43 void WriteDataInternal(const byte* pBuffer, size_t count);
44 void WriteStringInternal(const char* pBuffer, size_t maxSize = (size_t) -1, RscStringEncoding encoding = RscStringEncoding::Utf8, bool writeTag = true);
45 void WriteConfirmation(bool flush = false);
46 void WriteEnumeratorTag(RscType tag);
47 void BeginWriteStream(int maxPacketSize);
48 void WriteStream(const byte* pBuffer, uint32 bufferCount, int maxPacketSize);
49 void EndWriteStream(void);
50 void WriteObjectType(RscType type);
51 void WriteStringLength(size_t length);
52 void WriteStringEncoding(RscStringEncoding encoding);
53 void WriteObjectString(RscStringEncoding stringEncoding, const void* pString);
54 void WriteError(const char* pResourceCatalogue, int errorResourceId, int errorCode);
55 void WriteError(const char* pResourceCatalogue, int errorResourceId, const char* errorMsg);
56 void WriteTag(RscType type);
57 void WriteArrayTag(RscType elementType, size_t length);
58 void WriteBeginStruct(size_t fieldCount);
59 void WriteFieldCount(size_t fieldCount);
60 void WriteSecurityToken(const SecurityToken& result, bool writeTag = true);
61 void WriteArrayInformation(const RscArrayInformation& arrayInformation);
62
63private: // fields
64 BinaryWriter2& binaryWriter;
65 RscWriter& rscWriter;
66 RscClientContext* pRscClientContext = nullptr;
67};
68
70// inline methods of class RemotingWriter
71inline RscWriter& RemotingWriter::GetRscWriter(void)
72{
73 return this->rscWriter;
74}
75
76
77}}}} // end of namespace Arp::System::Rsc::Services
std::uint32_t uint32
The Arp unsigned integer type of 4 byte size.
Definition: PrimitiveTypes.hpp:36
@ System
System components used by the System, Device, Plc or Io domains.
RscStringEncoding
Determines the encoding of a Rsc String. Values are identical to CommonRemoting::StringEncoding.
Definition: RscStringEncoding.hpp:18
RscType
Data types supported by RSC.
Definition: RscType.hpp:36
Root namespace for the PLCnext API