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