7 #include "Arp/System/Rsc/Services/Rsc.h"     8 #include "Arp/System/Commons/Logging.h"     9 #include "Arp/System/Commons/Exceptions/Exceptions.h"    10 #include "Arp/System/Rsc/Services/RscException.hpp"    11 #include "Arp/System/Rsc/Services/IRscWriteEnumerator.hxx"    12 #include "Arp/System/Rsc/Services/RscWriter.hpp"    13 #include "Arp/System/Rsc/Services/RscArrayWriter.hpp"    16 namespace Arp { 
namespace System { 
namespace Rsc { 
namespace Services
    36     void            BeginWrite(
size_t arrayLengthArg = (
size_t) -1)
override;
    45     RemotingWriter& remotingWriter;
    46     bool isArrayEnumerator;
    48     size_t arrayLength = 0;
    49     bool endWritten = 
false;
    50     size_t fieldCount = 0;
    57     : isArrayEnumerator(isArrayEnumeratorArg)
    58     , remotingWriter(rscWriter.GetRemotingWriter())
    59     , rscType(GetRscTypeFrom(T()))
    60     , fieldCount(StructInfo<T>().FieldCount)
    69         Log::Error(
"Rsc Enumerating was not ended properly, call EndWrite() method when writing was finished.");
    76     this->arrayLength = arrayLengthArg;
    78     if(this->isArrayEnumerator)
    80         if(this->arrayLength == (
size_t) -1)
    88             this->remotingWriter.WriteBeginStruct(this->fieldCount);
    92             this->remotingWriter.WriteTag(this->rscType);
    94         this->remotingWriter.WriteArrayLength(this->arrayLength);
    98         if(this->arrayLength != (
size_t) -1)
   100             throw ArgumentException(
"Array length could not be defined for standard enumerators.");
   109     if(this->isArrayEnumerator)
   111         if(this->arrayLength == 0)
   120         this->remotingWriter.WriteEnumeratorTag(this->rscType);
   123             this->remotingWriter.WriteFieldCount(this->fieldCount);
   126     RscValueAdapter<T> valueAdapter(current);
   127     valueAdapter.Write(this->remotingWriter, 
false);
   134     this->remotingWriter.WriteTag(arrayElementType);
   135     this->remotingWriter.WriteArrayLength(arraySize);
   136     return RscArrayWriter(arraySize, arrayElementType, this->remotingWriter);
   142     if(this->isArrayEnumerator)
   144         if(this->arrayLength != 0)
   154     this->endWritten = 
true;
 void BeginWrite(size_t arrayLengthArg=(size_t) -1) override
Begins the operation to write the enumerator.
Definition: RscWriteEnumerator.hxx:74
 
Complex datatype with implements IRscSerializable
 
Helper class to read an array of primtive types from an RscVariant. This class uses the array informa...
Definition: RscArrayWriter.hpp:21
 
~RscWriteEnumerator(void)
Destructs this instance and frees all resources.
Definition: RscWriteEnumerator.hxx:65
 
Writes data to Rsc. 
Definition: RscWriter.hpp:32
 
void EndWrite(void) override
Ends the enumerator. With an array enumerator all enumerator elements had to be written
Definition: RscWriteEnumerator.hxx:140
 
Implementation of IRscWriteEnumerator used on client side. 
Definition: RscWriteEnumerator.hxx:23
 
RscType
Datatypes supported by Rsc. Values are identical with CommonRemoting::RemotingMarshalType. Only supported types of RemotingMarshalType are included. 
Definition: RscType.hpp:27
 
This exception is used when a method call is invalid for object's current state.
Definition: InvalidOperationException.hpp:14
 
RscWriteEnumerator(RscWriter &rscWriter, bool isArrayEnumerator)
Constructs an RscEnumeratorBase instance.
Definition: RscWriteEnumerator.hxx:56
 
Enumerator type, handled by Rsc with IRscReadEnumerator and IRscWriteEnumerator
 
This exception is used when an invalid argument occurs.
Definition: ArgumentException.hpp:14
 
Root namespace for the PLCnext API
 
Interface for writing an array or an enumerator. For regular enumerators UndefinedArrayLength is used...
Definition: IRscWriteEnumerator.hxx:22
 
System components used by the System, Device, Plc or Io domains.
 
void WriteNext(const T ¤t) override
Writes the next enumerator element.
Definition: RscWriteEnumerator.hxx:107