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
26 using ReadElementFunction = RscVariant<>::ReadElementFunction;
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>
The class contains date and time informations.
Definition: DateTime.hpp:45
This exception is used when an invalid argument occurs.
Definition: ArgumentException.hpp:15
static ArgumentException Create(const char *paramName, const T ¶mValue)
Creates an ArgumentException instance using a default message text.
Definition: ArgumentException.hpp:112
This exception is used when a method call is invalid for object's current state.
Definition: InvalidOperationException.hpp:15
Helper class to read an array of primtive types from an RscVariant. This class uses the array informa...
Definition: RscArrayReader.hpp:23
size_t GetDimensions(void) const
Gets the count of array dimensions.
Definition: RscArrayReader.hpp:189
RscArrayReader ReadNextArray(void)
Reads the next subarray for arrays with more than one dimension. The next subarray is read with a new...
size_t GetSize(void) const
Returns number of Elements contained in array
Definition: RscArrayReader.hpp:179
~RscArrayReader(void)=default
Destructs this instance and frees all resources.
RscType GetElementType(void) const
Returns the element type
Definition: RscArrayReader.hpp:184
void ReadNext(byte *pCurrent)
Reads the next single array element using the callback function given by ArrayInformation of RscVaria...
size_t GetFieldCount(void) const
Returns field count if array contains struct elements
Definition: RscArrayReader.hpp:199
RscArrayReader(size_t size, RscType elementType, RemotingReader &reader)
///
RscArrayReader(const RscArrayReader &arg)=default
///
size_t GetPosition(void) const
Returns current reading position in array
Definition: RscArrayReader.hpp:194
RscArrayReader(const RscVariant< N > &value)
Constructs an RscArray instance.
Definition: RscArrayReader.hpp:143
void ReadNext(T ¤t)
Reads the next single array element using the callback function given by ArrayInformation of RscVaria...
Definition: RscArrayReader.hpp:205
RscStructReader< MaxStringSize > ReadNextStruct(void)
Reads the next struct element.
Definition: RscArrayReader.hpp:258
RscArrayReader & operator=(const RscArrayReader &arg)=default
Assignment operator.
RscArrayReader(size_t size, RscType elementType, ReadElementFunction readFunction)
Constructs an RscArrayReader instance.
Contains a static string with string lentgh up to N characters. The string has to be null terminated.
Definition: RscString.hxx:21
const char * CStr(void) const
Returns pointer to internal buffer.
Definition: RscString.hxx:111
Helper class to read a struct from an RscVariant. This class uses the struct information stored in Rs...
Definition: RscStructReader.hxx:25
Rsc container class for primitive data type, strings or information about arrays or structs....
Definition: RscVariant.hxx:39
void SetType(RscType rscType)
Forces the internal RscType to be set to another RscType. This Method does no conversion or validatio...
Definition: RscVariant.hxx:526
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:514
RscType GetType(void) const
Gets the RscType of the contained element
Definition: RscVariant.hxx:432
@ System
System components used by the System, Device, Plc or Io domains.
RscType
Datatypes supported by Rsc. Values are identical with CommonRemoting::RemotingMarshalType....
Definition: RscType.hpp:37
@ DateTime
Datetime, handled by Rsc with DateTime
Root namespace for the PLCnext API