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

Helper class to write a dynamic array of primtive types from RscVariant. This class uses the array information stored in RscVariant. More...

#include <RscArrayWriter.hpp>

Public Types

using RscWriter = Arp::Base::Rsc::Commons::Services::RscWriter
 The writer type.
 
using WriteElementFunction = RscVariant<>::WriteElementFunction
 The write element delegate type.
 

Public Member Functions

template<int N>
 RscArrayWriter (const RscVariant< N > &value)
 Constructs an RscArray instance. More...
 
 RscArrayWriter (const RscVariantBase &value)
 Constructs an RscArray instance. More...
 
 RscArrayWriter (size_t size, RscType elementType, WriteElementFunction writeFunction)
 Constructs an RscArrayWriter instance. More...
 
 RscArrayWriter (size_t size, RscType elementType, RscWriter &writer, size_t dimensions=1)
 Constructs an RscArrayWriter instance. More...
 
size_t GetSize (void) const
 Returns number of elements contained in the array to read. More...
 
RscType GetElementType (void) const
 Gets the element type of the array values. More...
 
size_t GetPosition (void) const
 Gets the current writing position in the array. More...
 
template<class T >
void WriteNext (const T &current)
 Writes the next single array element using the callback function given by array information of RscVariant. This method can only be used for primitive types. More...
 
template<int N>
void WriteNext (const RscString< N > &current)
 Writes the next array string element using the callback function given by ArrayInformation of RscVariant. More...
 
template<int N>
void WriteNext (const RscVariant< N > &current)
 Writes the next array object element using the callback function given by ArrayInformation of RscVariant. More...
 
template<int N>
RscVariant< N > WriteNextStruct ()
 Writes the next struct element. More...
 
RscArrayWriter WriteNextArray (size_t size)
 Writes the next subarray of arrays with more than one dimension. The next subarray is written using a new instance of RscArrayWriter. More...
 
void WriteNextSimple (const RscVariantBase &value)
 For internal use only. More...
 

Detailed Description

Helper class to write a dynamic array of primtive types from RscVariant. This class uses the array information stored in RscVariant.

Constructor & Destructor Documentation

◆ RscArrayWriter() [1/4]

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

Constructs an RscArray instance.

Parameters
valueReference to RscVariant containing a dynamic array.
Template Parameters
NN determines the maximum string size of string array elements. If set to 0 strings will not be supported.

◆ RscArrayWriter() [2/4]

Arp::Base::Rsc::Commons::RscArrayWriter::RscArrayWriter ( const RscVariantBase value)
explicit

Constructs an RscArray instance.

Parameters
valueReference to RscVariant containing a dynamic array.
Template Parameters
NN determines the maximum string size of string array elements. If set to 0 strings will not be supported.

◆ RscArrayWriter() [3/4]

Arp::Base::Rsc::Commons::RscArrayWriter::RscArrayWriter ( size_t  size,
RscType  elementType,
WriteElementFunction  writeFunction 
)

Constructs an RscArrayWriter instance.

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

◆ RscArrayWriter() [4/4]

Arp::Base::Rsc::Commons::RscArrayWriter::RscArrayWriter ( size_t  size,
RscType  elementType,
RscWriter writer,
size_t  dimensions = 1 
)

Constructs an RscArrayWriter instance.

Parameters
sizeThe size of the array.
elementTypeThe value type of the array elements.
writer
dimensions

Member Function Documentation

◆ GetElementType()

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

Gets the element type of the array values.

Returns
The element type of the array values.

◆ GetPosition()

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

Gets the current writing position in the array.

Returns
The writing position in the array.

◆ GetSize()

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

Returns number of elements contained in the array to read.

Returns
The number of elements contained in the array.

◆ WriteNext() [1/3]

template<int N>
void Arp::Base::Rsc::Commons::RscArrayWriter::WriteNext ( const RscString< N > &  current)
inline

Writes the next array string element using the callback function given by ArrayInformation of RscVariant.

Parameters
currentThe current string to write.
Template Parameters
NMaximum string size of RscString. This has to be equal to the string size defined by construction.

◆ WriteNext() [2/3]

template<int N>
void Arp::Base::Rsc::Commons::RscArrayWriter::WriteNext ( const RscVariant< N > &  current)
inline

Writes the next array object element using the callback function given by ArrayInformation of RscVariant.

Parameters
currentThe current object to write.
Template Parameters
NMaximum string size of RscVariant. This has to be equal to string size defined by construction.

◆ WriteNext() [3/3]

template<class T >
void Arp::Base::Rsc::Commons::RscArrayWriter::WriteNext ( const T &  current)
inline

Writes the next single array element using the callback function given by array information of RscVariant. This method can only be used for primitive types.

Parameters
currentThe current element to write.
Template Parameters
TThe element type of the array.

◆ WriteNextArray()

RscArrayWriter Arp::Base::Rsc::Commons::RscArrayWriter::WriteNextArray ( size_t  arraySize)

Writes the next subarray of arrays with more than one dimension. The next subarray is written using a new instance of RscArrayWriter.

Parameters
arraySizeThe size of the next subarray to write.
Returns
A new instance of RscArrayWriter used to write next subarray.

◆ WriteNextSimple()

void Arp::Base::Rsc::Commons::RscArrayWriter::WriteNextSimple ( const RscVariantBase value)

For internal use only.

Parameters
valueThe simple value to write.

◆ WriteNextStruct()

template<int N>
RscVariant< N > Arp::Base::Rsc::Commons::RscArrayWriter::WriteNextStruct
inline

Writes the next struct element.

Returns
A new instance of RscVariant used to read next struct element from using RscArrayWriter.
Template Parameters
MaxStringSizeMaximum string size of struct fields.

The return object of this operation might be used to directly initialize a <see cref=="RscStructWriter"/>

RscStructWriter structWriter = arrayWriter.WriteNextStruct<512>();
Utility class to write dynamic structs.
Definition: RscStructWriter.hpp:24

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