PLCnext API Documentation 25.0.2.69
Public Types | Public Member Functions | List of all members
Arp::Base::Rsc::Commons::RscArrayReader Class Reference

Utility class to read an array of primitive types from RscVariant. This class uses the array information stored in RscVariant. More...

#include <RscArrayReader.hpp>

Public Types

using Reader = Arp::Base::Rsc::Commons::Services::RscReader
 The reader type.
 
using ReadElementFunction = RscVariantBase::ReadElementFunction
 The read element delegate type.
 

Public Member Functions

template<int N>
 RscArrayReader (const RscVariant< N > &arrayVariant)
 Constructs an RscArray instance. More...
 
 RscArrayReader (const RscVariantBase &arrayVariant)
 Constructs an RscArray instance. More...
 
 RscArrayReader (size_t size, RscType elementType, const ReadElementFunction &readElementFunction)
 Constructs an RscArrayReader instance. More...
 
 RscArrayReader (size_t size, RscType elementType, Reader &reader)
 Constructs an RscArrayReader instance. More...
 
size_t GetSize (void) const
 Returns the number of values contained in the array. More...
 
RscType GetElementType (void) const
 Returns the value type of the array elements. More...
 
size_t GetDimensions (void) const
 Gets the count of the array dimensions. More...
 
size_t GetFieldCount (void) const
 Returns field count if the array contains struct elements. More...
 
size_t GetPosition (void) const
 Returns the current reading position in the array to read. More...
 
template<class T >
void ReadNext (T &current)
 Reads the next array value using the supplied callback function given by ArrayInformation of RscVariant. This method can only be used for primitive types. More...
 
template<int N>
void ReadNext (RscString< N > &current)
 Reads the next string array value using the callback function given by ArrayInformation of RscVariant. More...
 
template<int N>
void ReadNext (RscVariant< N > &current)
 Reads the next array object of type RscVariant. More...
 
template<int N>
RscStructReader ReadNextStruct (void)
 Reads the next struct element. More...
 
RscArrayReader ReadNextArray (void)
 Reads the next subarray of arrays with more than one dimension. The next subarray is read using a new instance of <see cref="RscArrayReader/>. More...
 

Detailed Description

Utility class to read an array of primitive types from RscVariant. This class uses the array information stored in RscVariant.

Constructor & Destructor Documentation

◆ RscArrayReader() [1/4]

template<int N>
Arp::Base::Rsc::Commons::RscArrayReader::RscArrayReader ( const RscVariant< N > &  arrayVariant)
inlineexplicit

Constructs an RscArray instance.

Parameters
arrayVariantThe RscVariant with array information.
Template Parameters
NN determines the maximum string size, if the array consists of string elements. If set to 0 strings are not supported.

◆ RscArrayReader() [2/4]

Arp::Base::Rsc::Commons::RscArrayReader::RscArrayReader ( const RscVariantBase arrayVariant)
explicit

Constructs an RscArray instance.

Parameters
arrayVariantThe RscVariant instance with array information.
Template Parameters
NN Determines the maximum string size if the array consists of string elements. If set to 0 strings are not supported.

◆ RscArrayReader() [3/4]

Arp::Base::Rsc::Commons::RscArrayReader::RscArrayReader ( size_t  size,
RscType  elementType,
const ReadElementFunction readElementFunction 
)

Constructs an RscArrayReader instance.

Parameters
sizeThe size of the array.
elementTypeThe value type of the array elements.
readElementFunctionA lambda expression to read the next element.

◆ RscArrayReader() [4/4]

Arp::Base::Rsc::Commons::RscArrayReader::RscArrayReader ( size_t  size,
RscType  elementType,
Reader reader 
)

Constructs an RscArrayReader instance.

Parameters
sizeThe size of the array.
elementTypeThe value type of the array elements.
readerThe reader used to read the values from.

Member Function Documentation

◆ GetDimensions()

size_t Arp::Base::Rsc::Commons::RscArrayReader::GetDimensions ( void  ) const

Gets the count of the array dimensions.

Returns
The count of array dimensions (0 for elementary type, 1 for array type, 2 for array of array type etc)

◆ GetElementType()

RscType Arp::Base::Rsc::Commons::RscArrayReader::GetElementType ( void  ) const

Returns the value type of the array elements.

Returns
The value type.

◆ GetFieldCount()

size_t Arp::Base::Rsc::Commons::RscArrayReader::GetFieldCount ( void  ) const

Returns field count if the array contains struct elements.

Returns
The field count of struct elements.

◆ GetPosition()

size_t Arp::Base::Rsc::Commons::RscArrayReader::GetPosition ( void  ) const

Returns the current reading position in the array to read.

Returns
The current position in the array to read.

◆ GetSize()

size_t Arp::Base::Rsc::Commons::RscArrayReader::GetSize ( void  ) const

Returns the number of values contained in the array.

Returns
The number of values contained in the array.

◆ ReadNext() [1/3]

template<int N>
void Arp::Base::Rsc::Commons::RscArrayReader::ReadNext ( RscString< N > &  current)
inline

Reads the next string array value using the callback function given by ArrayInformation of RscVariant.

Parameters
currentReference to RscString.
Template Parameters
NMaximum string size of RscString. Have to be equal to internal maximum string size defined with the constructor.

◆ ReadNext() [2/3]

template<int N>
void Arp::Base::Rsc::Commons::RscArrayReader::ReadNext ( RscVariant< N > &  current)
inline

Reads the next array object of type RscVariant.

Parameters
currentThe read value.
Template Parameters
NMaximum string size of string elements. This has to be equal to internal maximum string size defined by construction.

◆ ReadNext() [3/3]

template<class T >
void Arp::Base::Rsc::Commons::RscArrayReader::ReadNext ( T &  current)
inline

Reads the next array value using the supplied callback function given by ArrayInformation of RscVariant. This method can only be used for primitive types.

Parameters
currentThe read value.
Template Parameters
TType of the array element.

◆ ReadNextArray()

RscArrayReader Arp::Base::Rsc::Commons::RscArrayReader::ReadNextArray ( void  )

Reads the next subarray of arrays with more than one dimension. The next subarray is read using a new instance of <see cref="RscArrayReader/>.

Returns
New instance of RscArrayReader used to read the next subarray.

◆ ReadNextStruct()

template<int N>
RscStructReader Arp::Base::Rsc::Commons::RscArrayReader::ReadNextStruct ( void  )
inline

Reads the next struct element.

Returns
A new instance of RscStructReader used to read next struct element from.
Template Parameters
NMaximum string size of struct fields.

The documentation for this class was generated from the following files: