8#include "Arp/Base/Rsc/Commons/Rsc.hpp"
9#include "Arp/Base/Rsc/Commons/RscArrayReader.hpp"
10#include "Arp/Base/Rsc/Commons/IRscReadEnumerator.hxx"
11#include "Arp/Base/Rsc/Commons/Services/RscReader.hpp"
13namespace Arp::Base::Rsc::Commons::Services
39 bool isArrayEnumerator;
40 bool hasEnded =
false;
90 : rscReader(rscReader)
91 , isArrayEnumerator(isArrayEnumerator)
101 if(this->isArrayEnumerator)
103 this->rscReader.ReadTag(RscType::Array);
104 if(this->rscType == RscType::Struct)
106 this->rscReader.ReadBeginStruct(this->fieldCount);
110 this->rscReader.ReadTag(this->rscType);
112 this->arrayLength = this->rscReader.ReadArrayLength();
116 this->rscReader.ReadTag(RscType::Enumerator);
118 return this->arrayLength;
128 if(this->isArrayEnumerator)
130 if(this->arrayLength == 0)
136 this->rscReader.Read(current, this->isConcreteType);
144 this->rscReader.ReadEnumeratorTag(this->rscType, this->hasEnded);
149 if(this->rscType == RscType::Struct)
151 size_t readFieldCount = this->rscReader.ReadFieldCount();
152 if(readFieldCount != this->fieldCount)
155 RscError::ProtocolViolation,
156 "Read invalid struct field count: expected '{}', received '{}'",
157 this->fieldCount, readFieldCount);
160 this->rscReader.Read(current,
true);
172 if (this->arrayLength == 0)
177 this->rscReader.ReadTag(RscType::Array);
178 RscType elementType = this->rscReader.ReadTag();
179 size_t arraySize = this->rscReader.ReadArrayLength();
180 current =
RscArrayReader(arraySize, elementType, this->rscReader);
189 if(this->isArrayEnumerator)
191 if(this->arrayLength != 0)
196 this->hasEnded =
true;
This exception is thrown when an operation cannot be executed because the related state is invalid.
Definition: InvalidOperationException.hpp:16
Interface for reading a arrays or enumerations.
Definition: IRscReadEnumerator.hxx:19
Utility class to read an array of primitive types from RscVariant. This class uses the array informat...
Definition: RscArrayReader.hpp:22
This exception class is used by RSC if any exception is thrown.
Definition: RscException.hpp:24
This class is used to deduct RSC types automatically by compilation.
Definition: RscTypeDeduction.hpp:24
constexpr RscType Get(void)
Gets the RscType of the as argument passed template parameter.
Definition: RscTypeDeduction.hpp:47
static bool IsConcreteType(RscType type)
Determines if the supplied type specifies a concrete type, i.e not unspecified and not object.
Definition: RscTypeInfo.cpp:242
Implementation of IRscReadEnumerator used on client side.
Definition: RscReadEnumerator.hxx:19
RscReadEnumerator & operator=(const RscReadEnumerator &arg)
The default copy-assignment operator.
bool ReadNext(T ¤t) override
Reads the next value of the enumeration.
Definition: RscReadEnumerator.hxx:126
size_t BeginRead(void) override
This operation is called at the begin of reading the enumeration.
Definition: RscReadEnumerator.hxx:99
RscReadEnumerator(RscReadEnumerator &&arg) noexcept
The default move constructor.
RscReadEnumerator & operator=(RscReadEnumerator &&arg) noexcept
The default move-assignment operator.
RscReadEnumerator(RscReader &rscReader, bool isArrayEnumerator)
Constructs an RscReadEnumerator instance.
Definition: RscReadEnumerator.hxx:89
static constexpr size_t UndefinedArrayLength
This constant is used to determine that an enumeration is not an array enumeration and hence has an u...
Definition: RscReadEnumerator.hxx:47
~RscReadEnumerator(void) override
Destructs this instance and checks if enumerations has ended.
void EndRead(void) override
This operation has to be called when the enumerating has finished.
Definition: RscReadEnumerator.hxx:187
RscReadEnumerator(const RscReadEnumerator &arg)
The default copy constructor.
Reads marshaled data of RSC services.
Definition: RscReader.hpp:34
This class provides the number of fields of a concrete struct. This class is specialized for concrete...
Definition: StructInfo.hxx:26
size_t FieldCount
Specifies the field count of a struct.
Definition: StructInfo.hxx:27