PLCnext API Documentation  20.6.0.30321
ChildInfo.hpp
1 //
3 // Copyright PHOENIX CONTACT Electronics GmbH
4 //
6 #pragma once
7 #include "Arp/System/Core/Arp.h"
8 #include "Arp/Plc/Commons/DataType.hpp"
9 #include "Arp/Plc/Commons/Meta/ArrayDimensions.hpp"
10 #include "Arp/Plc/Commons/Meta/TypeIdentifier.hpp"
11 #include "Arp/Plc/Commons/Meta/TypeInfo.hpp"
12 
13 //TODO(OR): remove this
14 
15 namespace Arp { namespace Plc { namespace Commons { namespace Meta
16 {
17 
18 class ChildInfo
19 {
20 public: // typedefs
21 
22 public: // construction/destruction
24  ChildInfo(void) = default;
26  ChildInfo(size_t offset, DataType dataType, const ArrayDimensions& dimensions = ArrayDimensions());
28  ChildInfo(size_t offset, DataType dataType, const TypeIdentifier& typeId, const ArrayDimensions& dimensions = ArrayDimensions());
29 
30 public: // static properties
31  static const ChildInfo Empty;
32 
33 public: // static operations
34  static ChildInfo Create(size_t offset, const TypeInfo& typeInfo);
35 
36 public: // setter/getter operations
37  bool IsEmpty(void)const;
38  size_t GetOffset(void)const;
39  DataType GetDataType(void)const;
40  const ArrayDimensions& GetArrayDimensions(void)const;
41  const TypeIdentifier& GetTypeIdentifier(void)const;
42 
43 public: // operations
44 
45 private: // methods
46 
47 private: // fields
48  size_t offset = (size_t) -1;
49  DataType dataType = DataType::None;
50  ArrayDimensions dimensions;
51  TypeIdentifier typeId;
52 };
53 
55 // inline methods of class ChildInfo
56 inline bool ChildInfo::IsEmpty()const
57 {
58  return this->dataType == DataType::None;
59 }
60 
61 inline size_t ChildInfo::GetOffset()const
62 {
63  return this->offset;
64 }
65 
66 inline DataType ChildInfo::GetDataType()const
67 {
68  return this->dataType;
69 }
70 
71 inline const ArrayDimensions& ChildInfo::GetArrayDimensions()const
72 {
73  return this->dimensions;
74 }
75 
76 inline const TypeIdentifier& ChildInfo::GetTypeIdentifier()const
77 {
78  return this->typeId;
79 }
80 
81 inline ChildInfo ChildInfo::Create(size_t offset, const TypeInfo& typeInfo)
82 {
83 #pragma warning( push )
84 #pragma warning( disable : 4996 )
85 #pragma warning( disable : 4068 )
86 #pragma GCC diagnostic push
87 #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
88 
89  return ChildInfo(offset, typeInfo.GetDataType(), typeInfo.GetTypeIdentifier(), typeInfo.GetArrayDimensions());
90 
91 #pragma GCC diagnostic pop
92 #pragma warning( pop )
93 }
94 
95 }}}} // end of namespace Arp::Plc::Commons::Meta
Definition: ChildInfo.hpp:18
Includes name and namespace of type object.
Definition: TypeIdentifier.hpp:21
const ArrayDimensions & GetArrayDimensions(void) const
List of array dimensions and their informations.
Definition: TypeInfo.hpp:192
ChildInfo(void)=default
Constructs an ChildInfo instance.
Provide array information.
Definition: ArrayDimensions.hpp:17
DataTypeEnum GetDataType() const
Get respective data type.
Definition: TypeInfo.hpp:172
Provides detailed informations within TypeBrowser interface.
Definition: TypeInfo.hpp:27
const TypeIdentifier & GetTypeIdentifier(void) const
The TypeIdentifier of a struct, program or any other complex type.
Definition: TypeInfo.hpp:187
Root namespace for the PLCnext API
DataType
Definition: DataType.hpp:14