PLCnext API Documentation  22.3.0.20
RscVariant.hxx
1 //
3 // Copyright PHOENIX CONTACT Electronics GmbH
4 //
6 #pragma once
7 #include "Arp/System/Commons/Exceptions/Exceptions.h"
8 #include "Arp/System/Rsc/Services/Rsc.h"
9 #include "Arp/System/Rsc/Services/RscGuid.hpp"
10 #include "Arp/System/Rsc/Services/RscVersion.hpp"
11 #include "Arp/System/Rsc/Services/RscString.hxx"
12 #include "Arp/System/Rsc/Services/SecureString.hxx"
13 #include <cstring>
14 #include <cstddef>
15 #include <sstream>
16 #include <iomanip>
17 
18 namespace Arp { namespace System { namespace Rsc { namespace Services
19 {
20 
21 // forwards
22 class RscArrayReader;
23 class RscArrayWriter;
24 class RemotingReader;
25 class RemotingWriter;
26 template<int N> class RscStructReader;
27 template<int N> class RscStructWriter;
28 template<class T, bool IsClass, bool IsSerializable> class RscValueAdapter;
29 
36 template<int MaxStringSize = 0>
38 {
39 public: // typedefs/friends
40  friend class RscArrayReader;
41  friend class RscArrayWriter;
42  template<int N> friend class RscStructReader;
43  template<int N> friend class RscStructWriter;
44  template<class T, bool IsClass, bool IsSerializable> friend class RscValueAdapter;
45  template<int N> friend class SecureString;
46 
47  using ReadElementFunction = std::function<RscType(RscType expectedType, byte* pValue)>;
48  using WriteElementFunction = std::function<void(RscType valueType, const byte* pValue)>;
50 
51 public: // construction/destruction
57 
61  template <class T>
62  RscVariant(const T& value);
63 
68  RscVariant(const String& value);
69 
74  RscVariant(const char* value);
75 
80  template<int N>
81  RscVariant(const RscString<N>& value);
82 
87  template<int N>
88  RscVariant(const SecureString<N>& value);
89 
98  RscVariant(size_t arraySize, RscType arrayElementType, size_t dimensions = 1, size_t fieldCount = 0);
99 
109  RscVariant(size_t arraySize, RscType arrayElementType, ReadElementFunction* pFunction, size_t dimensions = 1, size_t fieldCount = 0);
110 
120  RscVariant(size_t arraySize, RscType arrayElementType, WriteElementFunction* pFunction, size_t dimensions = 1, size_t fieldCount = 0);
121 
125  RscVariant(size_t fieldCount, ReadElementFunction* pFunction);
126 
130  RscVariant(const RscVariant<MaxStringSize>&) = default;
131 
135  RscVariant(RscVariant&&) = default;
136 
137 public: // Static factory operations
143  static RscVariant<MaxStringSize> CreateStructVariant(size_t fieldCount);
144 
153  static RscVariant<MaxStringSize> CreateArrayVariant(size_t arraySize, RscType elementType, size_t dimensions = 1, size_t fieldCount = 0);
154 
155 private: // static factory operations
156  static RscVariant<MaxStringSize> CreateStructVariant(size_t fieldCount, RemotingWriter& writer);
157  static RscVariant<MaxStringSize> CreateArrayVariant(size_t arraySize, RscType elementType, RemotingWriter& writer, size_t dimensions = 1, size_t fieldCount = 0);
158 
159 public: // operators
160  template <class T>
161  RscVariant& operator=(const T& value);
162  RscVariant& operator=(const String& value);
163  RscVariant& operator=(const char* value);
164  template<int N>
165  RscVariant& operator=(const RscString<N>& value);
166  template<int N>
167  RscVariant& operator=(const SecureString<N>& value);
168  RscVariant& operator=(const RscVariant& value) = default;
169  RscVariant& operator=(RscVariant&&) = default;
170  bool operator==(const RscVariant& value)const;
171  bool operator!=(const RscVariant& value)const;
172 
173 public: // getter/setter
178  RscType GetType(void)const;
179 
184  RscType GetValueType(void)const;
185 
191  RscType GetArrayElementType(void)const;
192 
198  size_t GetArrayDimensions(void)const;
199 
205  size_t GetFieldCount(void) const;
206 
211  const char* GetChars(void)const;
212 
218  void SetWriteElementFunction(WriteElementFunction* pFunction) const;
219 
224  const byte* GetDataAddress(void)const;
225 
230  byte* GetDataAddress(void);
231 
236  void SetType(RscType rscType);
237 
238 public: // operations
243  template<class T>
244  T GetValue(void)const;
245 
250  template<class T>
251  void CopyTo(T& value)const;
252 
257  String ToString(void)const;
258 
259 private: // Setter/Getter for internal use and friend classes
260  RscArrayInformation& GetArrayInformation(void);
261  const RscArrayInformation& GetArrayInformation(void) const;
262  RscStructInformation& GetStructInformation(void);
263  const RscStructInformation& GetStructInformation(void) const;
264 
265 private: // methods
266  void Assign(const char*, size_t len, RscType type = RscType::Utf8String);
267  void InitComplexTypeInfo(void);
268  bool ContainsTypeInformation(void) const;
269  size_t GetSize(void)const;
270 
271 private: // nested types
272  struct ComplexTypeInfo
273  {
274  union
275  {
276  RscArrayInformation arrayInformation;
277  RscStructInformation structInformation;
278  };
279  RemotingReader* pReader = nullptr;
280  mutable RemotingWriter* pWriter = nullptr;
281  ReadElementFunction* pReadElementFunction = nullptr;
282  mutable WriteElementFunction* pWriteElementFunction = nullptr;
283  };
284 
285 private: // static fields
286  static const size_t maxPrimitiveSize = 8;
287 #ifdef ARP_SYSTEM_RSC_SUPPORT_VERSION_GUID_AS_OBJECT
288  static const size_t minBufferSize = std::max(maxPrimitiveSize, std::max(sizeof(RscGuid), sizeof(RscVersion)));
289 #else
290  static const size_t minBufferSize = maxPrimitiveSize;
291 #endif // ARP_SYSTEM_RSC_SUPPORT_VERSION_GUID_AS_OBJECT
292 
293  static const size_t bufferSize = minBufferSize < (size_t)MaxStringSize ? (size_t)MaxStringSize : minBufferSize;
294 
295 private: // fields
296  union
297  {
298  ComplexTypeInfo typeInfo;
299  byte buffer[bufferSize];
300  };
301  RscType type = RscType::None;
302 };
303 
304 
306 // inline methods of RscType helper
307 template<int N>
308 inline constexpr RscType GetRscTypeFrom(const RscVariant<N>& /*value*/)
309 {
310  return RscType::Object;
311 }
312 
314 // inline methods of class RscVariant
315 
316 template<int MaxStringSize>
318  : type(typeArg)
319 {
320 }
321 
322 template<int MaxStringSize>
323 template<class T>
325 {
326  this->operator=(value);
327 }
328 
329 template<int MaxStringSize>
331  : type(RscType::Utf8String)
332 {
333  this->operator=(value);
334 }
335 
336 template<int MaxStringSize>
337 inline RscVariant<MaxStringSize>::RscVariant(const char* value)
338 {
339  this->operator=(value);
340 }
341 
342 template<int MaxStringSize>
343 template<int N>
345 {
346  this->operator=(value);
347 }
348 
349 template<int MaxStringSize>
350 template<int N>
352 {
353  this->operator=(value);
354 }
355 
356 template<int MaxStringSize>
357 inline RscVariant<MaxStringSize>::RscVariant(size_t arraySize, RscType arrayElementType, size_t dimensions, size_t fieldCount)
358  : type(RscType::Array)
359 {
360  if(arrayElementType == RscType::Struct && fieldCount == 0)
361  {
362  throw ArgumentException::Create("fieldCount", fieldCount, "fieldCount has to be set for struct element types");
363  }
364  this->GetArrayInformation() = RscArrayInformation(arraySize, arrayElementType, dimensions, fieldCount);
365  this->typeInfo.pReader = nullptr;
366  this->typeInfo.pWriter = nullptr;
367  this->typeInfo.pReadElementFunction = nullptr;
368  this->typeInfo.pWriteElementFunction = nullptr;
369 }
370 
371 template<int MaxStringSize>
372 inline RscVariant<MaxStringSize>::RscVariant(size_t arraySize, RscType arrayElementType, ReadElementFunction* pFunction, size_t dimensions, size_t fieldCount)
373  : type(RscType::Array)
374 {
375  if(arrayElementType == RscType::Struct && fieldCount == 0)
376  {
377  throw ArgumentException::Create("fieldCount", fieldCount, "fieldCount has to be set for struct element types");
378  }
379  this->GetArrayInformation() = RscArrayInformation(arraySize, arrayElementType, dimensions, fieldCount);
380  this->typeInfo.pReader = nullptr;
381  this->typeInfo.pWriter = nullptr;
382  this->typeInfo.pReadElementFunction = pFunction;
383  this->typeInfo.pWriteElementFunction = nullptr;
384 }
385 
386 template<int MaxStringSize>
387 inline RscVariant<MaxStringSize>::RscVariant(size_t arraySize, RscType arrayElementType, WriteElementFunction* pFunction, size_t dimensions, size_t fieldCount)
388  : type(RscType::Array)
389 {
390  if(arrayElementType == RscType::Struct && fieldCount == 0)
391  {
392  throw ArgumentException::Create("fieldCount", fieldCount, "fieldCount has to be set for struct element types");
393  }
394  this->GetArrayInformation() = RscArrayInformation(arraySize, arrayElementType, dimensions, fieldCount);
395  this->typeInfo.pReader = nullptr;
396  this->typeInfo.pWriter = nullptr;
397  this->typeInfo.pReadElementFunction = nullptr;
398  this->typeInfo.pWriteElementFunction = pFunction;
399 }
400 
401 template<int MaxStringSize>
402 inline RscVariant<MaxStringSize>::RscVariant(size_t fieldCount, ReadElementFunction* pFunction)
403  : type(RscType::Struct)
404 {
405  this->InitComplexTypeInfo();
406  this->GetStructInformation() = RscStructInformation(fieldCount);
407  this->typeInfo.pReadElementFunction = pFunction;
408 }
409 
410 template<int MaxStringSize>
412 {
413  return this->type;
414 }
415 
416 template<int MaxStringSize>
418 {
419  switch (this->type)
420  {
421  case RscType::IecTime:
422  return RscType::Int32;
423  case RscType::IecTime64:
424  case RscType::IecDate64:
425  case RscType::IecDateTime64:
426  case RscType::IecTimeOfDay64:
427  return RscType::Int64;
428  default:
429  // no mapping
430  return this->type;
431  }
432 }
433 
434 template<int MaxStringSize>
436 {
437  return this->GetArrayInformation().ElementType;
438 }
439 
440 template<int MaxStringSize>
442 {
443  if(this->GetType() != RscType::Array)
444  {
445  throw InvalidOperationException("RscVariant doesn't contain array information");
446  }
447  return this->typeInfo.arrayInformation;
448 }
449 
450 template<int MaxStringSize>
452 {
453  if(this->GetType() != RscType::Array)
454  {
455  throw InvalidOperationException("RscVariant doesn't contain array information");
456  }
457  return this->typeInfo.arrayInformation;
458 }
459 
460 template<int MaxStringSize>
462 {
463  if(this->GetType() != RscType::Struct)
464  {
465  throw InvalidOperationException("RscVariant doesn't contain struct information");
466  }
467  return this->typeInfo.structInformation;
468 }
469 
470 template<int MaxStringSize>
472 {
473  if(this->GetType() != RscType::Struct)
474  {
475  throw InvalidOperationException("RscVariant doesn't contain struct information");
476  }
477  return this->typeInfo.structInformation;
478 }
479 
480 template<int MaxStringSize>
482 {
483  return this->GetArrayInformation().Dimensions;
484 }
485 
486 template<int MaxStringSize>
488 {
489  return this->GetStructInformation().FieldCount;
490 }
491 
492 template<int MaxStringSize>
494 {
495  return this->buffer;
496 }
497 
498 template<int MaxStringSize>
500 {
501  return this->buffer;
502 }
503 
504 template<int MaxStringSize>
506 {
507  this->type = rscType;
508 }
509 
510 template<int MaxStringSize>
512 {
513  return (this->type == RscType::Struct || this->type == RscType::Array);
514 }
515 
516 template<int MaxStringSize>
517 template<class T>
519 {
520  this->type = GetRscType<T>();
521  if(this->type == RscType::None)
522  {
523  throw NotSupportedException("Cannot assign from argument: Type of argument is not supported");
524  }
525 #ifndef ARP_SYSTEM_RSC_SUPPORT_VERSION_GUID_AS_OBJECT
526  if (this->type == RscType::Version || this->type == RscType::Guid)
527  {
528  throw NotImplementedException("Type RscVersion and RscGuid are currently not supported by RscVariant");
529  }
530 #endif // ARP_SYSTEM_RSC_SUPPORT_VERSION_GUID_AS_OBJECT
531  *reinterpret_cast<T*>(this->buffer) = value;
532  return *this;
533 }
534 
535 template<int MaxStringSize>
537 {
538  RscVariant<MaxStringSize> result(RscType::Struct);
539  result.InitComplexTypeInfo();
540  result.GetStructInformation().FieldCount = fieldCount;
541  return result;
542 }
543 
544 template<int MaxStringSize>
545 inline RscVariant<MaxStringSize> RscVariant<MaxStringSize>::CreateArrayVariant(size_t arraySize, RscType elementType, size_t dimensions, size_t fieldCount)
546 {
547  RscVariant<MaxStringSize> result(arraySize, elementType, dimensions, fieldCount);
548  return result;
549 }
550 
551 template<int MaxStringSize>
552 inline RscVariant<MaxStringSize> RscVariant<MaxStringSize>::CreateStructVariant(size_t fieldCount, RemotingWriter& writer)
553 {
555  result.typeInfo.pWriter = &writer;
556  return result;
557 }
558 
559 template<int MaxStringSize>
560 inline RscVariant<MaxStringSize> RscVariant<MaxStringSize>::CreateArrayVariant(size_t arraySize, RscType elementType, RemotingWriter& writer, size_t dimensions, size_t fieldCount)
561 {
562  RscVariant<MaxStringSize> result(arraySize, elementType, dimensions, fieldCount);
563  result.typeInfo.pWriter = &writer;
564  return result;
565 }
566 
567 template<int MaxStringSize>
569 {
570  size_t len = value.Length();
571  this->Assign(value.CStr(), len);
572  return *this;
573 }
574 
575 template<int MaxStringSize>
577 {
578  size_t len = strlen(value);
579  this->Assign(value, len);
580  return *this;
581 }
582 
583 template<int MaxStringSize>
584 template<int N>
586 {
587  this->Assign(value.CStr(), strlen(value.CStr()), RscType::Utf8String);
588  return *this;
589 }
590 
591 template<int MaxStringSize>
592 template<int N>
594 {
595  this->Assign(value.CStr(), strlen(value.CStr()), RscType::SecureString);
596  return *this;
597 }
598 
599 template<int MaxStringSize>
600 inline void RscVariant<MaxStringSize>::Assign(const char* value, size_t len, RscType typeArg)
601 {
602  if (len >= MaxStringSize)
603  {
604  throw ArgumentException("Cannot copy string: argument string length {0} exceeds MaxStringSize {1}", len, MaxStringSize);
605  }
606  if (typeArg != RscType::Utf8String && typeArg != RscType::SecureString)
607  {
608  throw NotSupportedException("RscType '{0}' not supported", typeArg);
609  }
610  memcpy(this->buffer, value, len);
611  this->buffer[len] = '\0';
612  this->type = typeArg;
613 }
614 
615 template<int MaxStringSize>
616 inline bool RscVariant<MaxStringSize>::operator==(const RscVariant& value)const
617 {
618  if (this->GetType() != value.GetType())
619  {
620  return false;
621  }
622 
623  if (this->GetSize() != value.GetSize())
624  {
625  return false;
626  }
627 
628  if (memcmp(this->buffer, value.buffer, this->GetSize()) != 0)
629  {
630  return false;
631  }
632 
633  if (this->GetType() == RscType::Utf8String)
634  {
635  if (strcmp((char*)this->buffer, (char*)value.buffer) != 0)
636  {
637  return false;
638  }
639  }
640 
641  return true;
642 }
643 
644 template<int MaxStringSize>
645 inline bool RscVariant<MaxStringSize>::operator!=(const RscVariant& value)const
646 {
647  return !(*this == value);
648 }
649 
650 template<int MaxStringSize>
652 {
653  // needed, because elements of union are not initialized
654  this->typeInfo.pReader = nullptr;
655  this->typeInfo.pWriter = nullptr;
656  this->typeInfo.pReadElementFunction = nullptr;
657  this->typeInfo.pWriteElementFunction = nullptr;
658 }
659 
660 template<int MaxStringSize>
661 template<class T>
662 inline void RscVariant<MaxStringSize>::CopyTo(T& value) const
663 {
664  RscType argType = GetRscType<T>();
665  if(this->GetValueType() != argType)
666  {
667  throw InvalidCastException("Cannot copy value to argument: RscVariant contains data type {0} but arg is of type {1}", this->type, argType);
668  }
669  value = *reinterpret_cast<const T*>(this->buffer);
670 }
671 
672 template<int MaxStringSize>
673 inline const char* RscVariant<MaxStringSize>::GetChars() const
674 {
675  if (this->type != RscType::Utf8String && this->type != RscType::SecureString && this->type != RscType::AnsiString)
676  {
677  throw InvalidCastException("Cannot convert to string: RscVariant is of type {0}", this->type);
678  }
679  return reinterpret_cast<const char*>(this->buffer);
680 }
681 
682 template<int MaxStringSize>
683 inline void RscVariant<MaxStringSize>::SetWriteElementFunction(WriteElementFunction * pFunction) const
684 {
685  if(this->type != RscType::Array && this->type != RscType::Struct)
686  {
687  throw InvalidOperationException("Method only allowed for array and struct objects");
688  }
689  this->typeInfo.pWriteElementFunction = pFunction;
690 }
691 
692 template<int MaxStringSize>
693 template<class T>
695 {
696  T result;
697  this->CopyTo(result);
698  return result;
699 }
700 
701 template<int MaxStringSize>
703 {
704  const byte* pValue = this->GetDataAddress();
705 
706  switch (this->type)
707  {
708  case RscType::SecureString:
709  case RscType::AnsiString:
710  case RscType::Utf8String:
711  return reinterpret_cast<const char*>(pValue);
712  case RscType::DateTime:
713  return reinterpret_cast<const DateTime*>(pValue)->ToIso8601String();
714  case RscType::Bool:
715  {
716  std::ostringstream oss;
717  oss << std::boolalpha << *reinterpret_cast<const bool*>(pValue);
718  if (oss.fail())
719  {
720  throw InvalidOperationException("Value of RscVariant is not of type bool.");
721  }
722  return oss.str();
723  }
724  case RscType::Char:
725  return std::to_string(*reinterpret_cast<const char16*>(pValue));
726  case RscType::Int16:
727  return std::to_string(*reinterpret_cast<const int16*>(pValue));
728  case RscType::Int32:
729  case RscType::IecTime:
730  return std::to_string(*reinterpret_cast<const int32*>(pValue));
731  case RscType::Int8:
732  return std::to_string(*reinterpret_cast<const int8*>(pValue));
733  case RscType::Int64:
734  case RscType::IecTime64:
735  case RscType::IecDate64:
736  case RscType::IecDateTime64:
737  case RscType::IecTimeOfDay64:
738  return std::to_string(*reinterpret_cast<const int64*>(pValue));
739  case RscType::None:
740  case RscType::Null:
741  return String::Empty;
742  case RscType::Real32:
743  return std::to_string(*reinterpret_cast<const float*>(pValue));
744  case RscType::Real64:
745  return std::to_string(*reinterpret_cast<const double*>(pValue));
746  case RscType::Uint16:
747  return std::to_string(*reinterpret_cast<const uint16*>(pValue));
748  case RscType::Uint32:
749  return std::to_string(*reinterpret_cast<const uint32*>(pValue));
750  case RscType::Uint64:
751  return std::to_string(*reinterpret_cast<const uint64*>(pValue));
752  case RscType::Uint8:
753  return std::to_string(*reinterpret_cast<const uint8*>(pValue));
754  case RscType::Version:
755  return reinterpret_cast<const RscVersion*>(pValue)->ToString();
756  case RscType::Guid:
757  return reinterpret_cast<const RscGuid*>(pValue)->ToString();
758  case RscType::Void:
759  return String::Empty;
760  default:
761  // case RscType::Array:
762  throw NotSupportedException("RscVariant::ToString() not supported for type '{0}'", type);
763  }
764 }
765 
766 template<int MaxStringSize>
767 inline size_t RscVariant<MaxStringSize>::GetSize(void)const
768 {
769  switch (this->GetValueType())
770  {
771  case RscType::Void:
772  return 0;
773  break;
774  case RscType::Bool:
775  case RscType::Int8:
776  case RscType::Uint8:
777  return 1;
778  break;
779  case RscType::Char:
780  case RscType::Int16:
781  case RscType::Uint16:
782  return 2;
783  break;
784  case RscType::Int32:
785  case RscType::Uint32:
786  case RscType::Real32:
787  case RscType::IecTime:
788  return 4;
789  break;
790  case RscType::Int64:
791  case RscType::Uint64:
792  case RscType::Real64:
793  case RscType::DateTime:
794  case RscType::IecTime64:
795  case RscType::IecDate64:
796  case RscType::IecDateTime64:
797  case RscType::IecTimeOfDay64:
798  return 8;
799  break;
800  case RscType::Utf8String:
801  return strlen((char*)this->buffer);
802  break;
803  case RscType::Array:
804  {
805  return sizeof(RscArrayInformation);
806  break;
807  }
808  case RscType::Struct:
809  {
810  return sizeof(RscStructInformation);
811  break;
812  }
813  case RscType::SecureString:
814  default:
815  throw NotSupportedException("RscType {0} not supported.", this->GetValueType());
816  }
817 }
818 
819 }}}} // end of namespace Arp::System::Rsc::Services
820 
const char * CStr(void) const
Returns pointer to internal buffer.
Definition: RscString.hxx:109
Definition: RscGuid.hpp:17
Helper class to read a struct from an RscVariant. This class uses the struct information stored in Rs...
Definition: RscStructReader.hxx:24
const char * GetChars(void) const
Gets pointer to internal string buffer. Operation only valid for Utf8Strings.
Definition: RscVariant.hxx:673
Helper class to read an array of primtive types from an RscVariant. This class uses the array informa...
Definition: RscArrayWriter.hpp:21
bool operator!=(const BasicString< CharType, Alloc > &left, const BasicString< CharType, Alloc > &right)
Compares the left string to the right string on inequality.
Definition: BasicString.hxx:1763
This exception is used when a method is not supported.
Definition: NotSupportedException.hpp:14
String ToString(void) const
Converts this instance to string if the variant type has a reasonable string representation.
Definition: RscVariant.hxx:702
Arp::BasicVersion Version
The Arp Version class.
Definition: TypeSystem.h:29
This exception is used when a method is not implemented yet.
Definition: NotImplementedException.hpp:14
The class contains date and time informations.
Definition: DateTime.hpp:44
RscType GetArrayElementType(void) const
Gets the RscType of the array elements if RscVariant contains array information.
Definition: RscVariant.hxx:435
Helper class to read an array of primtive types from an RscVariant. This class uses the array informa...
Definition: RscArrayReader.hpp:22
This exception is used when an invalid cast occurs.
Definition: InvalidCastException.hpp:14
void SetWriteElementFunction(WriteElementFunction *pFunction) const
Sets callback for write function to write a single array element. This could only be used for Variant...
Definition: RscVariant.hxx:683
const CharType * CStr() const
Gets the character data of this string.
Definition: BasicString.hxx:1482
RscType
Datatypes supported by Rsc. Values are identical with CommonRemoting::RemotingMarshalType. Only supported types of RemotingMarshalType are included.
Definition: RscType.hpp:35
void CopyTo(T &value) const
Copies internal data to memory referenced by value. Only for primtive types. Read Strings with GetCha...
Definition: RscVariant.hxx:662
Rsc container class for primitive data type, strings or information about arrays or structs...
Definition: RscVariant.hxx:37
Object type handled by Rsc as RscVariant
Specifies a version with 4 version numbers and is marshalled to .NET type System.Version.
Definition: RscVersion.hpp:20
This exception is used when a method call is invalid for object&#39;s current state.
Definition: InvalidOperationException.hpp:14
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:493
size_type Length() const
Returns the number of char elements in this string.
Definition: BasicString.hxx:1037
void SetType(RscType rscType)
Forces the internal RscType to be set to another RscType. This Method does no conversion or validatio...
Definition: RscVariant.hxx:505
This exception is used when an invalid argument occurs.
Definition: ArgumentException.hpp:14
Specialized version of RscString for security context. Not implemented in this version. Wraps only RscString
Definition: RscType.hpp:27
Root namespace for the PLCnext API
RscType GetType(void) const
Gets the RscType of the contained element
Definition: RscVariant.hxx:411
Contains information to marshall an array
Definition: RscType.hpp:128
T GetValue(void) const
Converts this value to the given type T.
Definition: RscVariant.hxx:694
bool operator==(const BasicString< CharType, Alloc > &left, const BasicString< CharType, Alloc > &right)
Compares the left string to the right string on equality.
Definition: BasicString.hxx:1727
RscType GetValueType(void) const
Gets the value type as RscType of the contained element
Definition: RscVariant.hxx:417
size_t GetFieldCount(void) const
Returns field count, if RscVariant contains struct information
Definition: RscVariant.hxx:487
System components used by the System, Device, Plc or Io domains.
Contains information to marshall an struct
Definition: RscType.hpp:162
Helper class to write a struct from an RscVariant. This class uses the struct information stored in R...
Definition: RscStructWriter.hxx:18
static RscVariant< MaxStringSize > CreateArrayVariant(size_t arraySize, RscType elementType, size_t dimensions=1, size_t fieldCount=0)
Creates a new RscVariant initialized with RscArrayInformation
Definition: RscVariant.hxx:545
Contains a static string with string lentgh up to N characters. The string has to be null terminated...
Definition: RscString.hxx:18
This is a small immutable wrapper around the boost::uuids::uuid class and represents a universal uniq...
Definition: Uuid.hpp:18
size_t GetArrayDimensions(void) const
Gets the count of array dimensions (1 for simple array, 2 for array of array etc.). This method is only valid for RscVariants with array information.
Definition: RscVariant.hxx:481
static RscVariant< MaxStringSize > CreateStructVariant(size_t fieldCount)
Creates a new RscVariant initialized with RscStructInformation
Definition: RscVariant.hxx:536
RscVariant(RscType type=RscType::None)
Creates an empty instance of RscVariant
Definition: RscVariant.hxx:317
unsigned char byte
The Arp character type.
Definition: PrimitiveTypes.hpp:23