8 #include "Arp/System/Rsc/Services/Rsc.h" 9 #include "Arp/System/Commons/Exceptions/Exceptions.h" 10 #include "Arp/System/Rsc/Services/RscValueAdapter.hxx" 11 #include "Arp/System/Rsc/Services/RscVariant.hxx" 12 #include "Arp/System/Rsc/Services/RscStructReader.hxx" 15 namespace Arp {
namespace System {
namespace Rsc {
namespace Services
45 RscArrayReader&
operator=(
const RscArrayReader& arg) =
default;
124 template<
int MaxStringSize>
129 void CheckReadArgument(
RscType argumentType,
size_t maxLength);
134 size_t maxStringSize = 0;
135 RemotingReader* pReader =
nullptr;
136 ReadElementFunction readElementFunction;
144 : arrayInformation(value.GetArrayInformation())
145 , pReader(value.typeInfo.pReader)
162 if (value.typeInfo.pReadElementFunction !=
nullptr)
164 this->readElementFunction = *value.typeInfo.pReadElementFunction;
166 else if(this->pReader !=
nullptr)
168 this->readElementFunction = [&](
RscType expectedType,
byte * pValue)
170 return ReadRemotingValue(expectedType, pValue);
181 return this->arrayInformation.
Size;
196 return this->position;
215 this->
ReadNext(reinterpret_cast<byte*>(¤t));
229 this->
ReadNext(reinterpret_cast<byte*>(¤t));
243 if(this->maxStringSize != N)
249 if(current.ContainsTypeInformation())
251 current.typeInfo.pReader = this->pReader;
252 current.typeInfo.pReadElementFunction = &this->readElementFunction;
257 template<
int MaxStringSize>
271 structVariant.GetStructInformation().FieldCount = this->arrayInformation.
FieldCount;
static ArgumentException Create(const char *paramName, const T ¶mValue)
Creates an ArgumentException instance using a default message text.
Definition: ArgumentException.hpp:112
RscArrayReader(const RscVariant< N > &value)
Constructs an RscArray instance.
Definition: RscArrayReader.hpp:143
const char * CStr(void) const
Returns pointer to internal buffer.
Definition: RscString.hxx:109
Helper class to read a struct from an RscVariant. This class uses the struct information stored in Rs...
Definition: RscStructReader.hxx:24
~RscArrayReader(void)=default
Destructs this instance and frees all resources.
Complex datatype with implements IRscSerializable
void ReadNext(T ¤t)
Reads the next single array element using the callback function given by ArrayInformation of RscVaria...
Definition: RscArrayReader.hpp:205
size_t GetPosition(void) const
Returns current reading position in array
Definition: RscArrayReader.hpp:194
The class contains date and time informations.
Definition: DateTime.hpp:44
Helper class to read an array of primtive types from an RscVariant. This class uses the array informa...
Definition: RscArrayReader.hpp:22
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
size_t GetSize(void) const
Returns number of Elements contained in array
Definition: RscArrayReader.hpp:179
This exception is used when a method call is invalid for object's current state.
Definition: InvalidOperationException.hpp:14
size_t GetFieldCount(void) const
Returns field count if array contains struct elements
Definition: RscArrayReader.hpp:199
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
void SetType(RscType rscType)
Forces the internal RscType to be set to another RscType. This Method does no conversion or validatio...
Definition: RscVariant.hxx:507
This exception is used when an invalid argument occurs.
Definition: ArgumentException.hpp:14
RscArrayReader ReadNextArray(void)
Reads the next subarray for arrays with more than one dimension. The next subarray is read with a new...
RscType GetElementType(void) const
Returns the element type
Definition: RscArrayReader.hpp:184
Root namespace for the PLCnext API
RscType GetType(void) const
Gets the RscType of the contained element
Definition: RscVariant.hxx:413
RscStructReader< MaxStringSize > ReadNextStruct(void)
Reads the next struct element.
Definition: RscArrayReader.hpp:258
Datetime, handled by Rsc with DateTime
System components used by the System, Device, Plc or Io domains.
size_t GetDimensions(void) const
Gets the count of array dimensions.
Definition: RscArrayReader.hpp:189
Contains a static string with string lentgh up to N characters. The string has to be null terminated...
Definition: RscString.hxx:18
RscArrayReader & operator=(const RscArrayReader &arg)=default
Assignment operator.
unsigned char byte
The Arp character type.
Definition: PrimitiveTypes.hpp:23