8 #include "Arp/System/Rsc/Services/Rsc.h" 9 #include "Arp/System/Commons/Exceptions/Exceptions.h" 10 #include "Arp/System/Rsc/Services/RemotingWriter.hpp" 11 #include "Arp/System/Rsc/Services/RscVariant.hxx" 14 namespace Arp {
namespace System {
namespace Rsc {
namespace Services
39 RscArrayWriter&
operator=(
const RscArrayWriter& arg) =
default;
101 void WriteRemotingValue(
RscType type,
const byte* pValue);
106 RemotingWriter* pWriter =
nullptr;
107 WriteElementFunction writeElementFunction;
108 size_t maxStringSize = 0;
116 : arrayInformation(value.GetArrayInformation())
117 , pWriter(value.typeInfo.pWriter)
130 if (value.typeInfo.pWriteElementFunction !=
nullptr)
132 this->writeElementFunction = *value.typeInfo.pWriteElementFunction;
134 else if(this->pWriter !=
nullptr)
136 this->writeElementFunction = [&](
RscType type,
const byte * pValue)
138 WriteRemotingValue(type, pValue);
150 return this->arrayInformation.
Size;
160 return this->position;
170 this->
WriteNext(reinterpret_cast<const byte*>(¤t));
180 this->
WriteNext(reinterpret_cast<const byte*>(¤t));
190 if(N != this->maxStringSize)
194 this->writeElementFunction(this->
GetElementType(), reinterpret_cast<const byte*>(current.
CStr()));
198 template<
int MaxStringSize>
209 if(this->pWriter ==
nullptr)
221 return structVariant;
231 if(N != this->maxStringSize)
236 if(current.ContainsTypeInformation())
238 current.typeInfo.pWriter = this->pWriter;
static ArgumentException Create(const char *paramName, const T ¶mValue)
Creates an ArgumentException instance using a default message text.
Definition: ArgumentException.hpp:112
const char * CStr(void) const
Returns pointer to internal buffer.
Definition: RscString.hxx:109
Complex datatype with implements IRscSerializable
size_t GetSize(void) const
Returns number of Elements contained in array
Definition: RscArrayWriter.hpp:148
Helper class to read an array of primtive types from an RscVariant. This class uses the array informa...
Definition: RscArrayWriter.hpp:21
RscArrayWriter(const RscVariant< N > &value)
Constructs an RscArray instance.
Definition: RscArrayWriter.hpp:115
The class contains date and time informations.
Definition: DateTime.hpp:44
size_t GetPosition(void) const
Returns current writing position in array
Definition: RscArrayWriter.hpp:158
void SetWriteElementFunction(WriteElementFunction *pFunction) const
Sets callback for write function to write a single array element. This could only be used for Variant...
Definition: RscVariant.hxx:685
RscType
Datatypes supported by Rsc. Values are identical with CommonRemoting::RemotingMarshalType. Only supported types of RemotingMarshalType are included.
Definition: RscType.hpp:27
Rsc container class for primitive data type, strings or information about arrays or structs...
Definition: RscVariant.hxx:39
Object type handled by Rsc as RscVariant
This exception is used when a method call is invalid for object's current state.
Definition: InvalidOperationException.hpp:14
const byte * GetDataAddress(void) const
Gets a raw pointer to internal data buffer. To read data prefer CopyTo and to write prefer assignment...
Definition: RscVariant.hxx:495
RscArrayWriter WriteNextArray(size_t size)
Writes the next subarray for arrays with more than one dimension. The next subarray is written with a...
This exception is used when an invalid argument occurs.
Definition: ArgumentException.hpp:14
Root namespace for the PLCnext API
RscType GetType(void) const
Gets the RscType of the contained element
Definition: RscVariant.hxx:413
void WriteNext(const T ¤t)
Writes the next single array element using the callback function given by ArrayInformation of RscVari...
Definition: RscArrayWriter.hpp:164
Datetime, handled by Rsc with DateTime
System components used by the System, Device, Plc or Io domains.
RscArrayWriter & operator=(const RscArrayWriter &arg)=default
Assignment operator.
~RscArrayWriter(void)=default
Destructs this instance and frees all resources.
RscType GetElementType(void) const
Returns the element type
Definition: RscArrayWriter.hpp:153
Contains a static string with string lentgh up to N characters. The string has to be null terminated...
Definition: RscString.hxx:18
static RscVariant< MaxStringSize > CreateStructVariant(size_t fieldCount)
Creates a new RscVariant initialized with RscStructInformation
Definition: RscVariant.hxx:538
unsigned char byte
The Arp character type.
Definition: PrimitiveTypes.hpp:23