aas-core3.1 0.0.1-alpha.1
Manipulate, verify and de/serialize asset administration shells V3.1 in C++.
Loading...
Searching...
No Matches
iteration.hpp
Go to the documentation of this file.
1#ifndef AAS_CORE_AAS_3_1_ITERATION_GUARD_
2#define AAS_CORE_AAS_3_1_ITERATION_GUARD_
3
4// This code has been automatically generated by aas-core-codegen.
5// Do NOT edit or append.
6
8
9#pragma warning(push, 0)
10#include <deque>
11#include <iterator>
12#include <memory>
13#include <string>
14#pragma warning(pop)
15
16namespace aas_core {
17namespace aas_3_1 {
18
23namespace iteration {
24
25// region Pathing
26
30enum class Property : std::uint32_t {
32 kAnnotations = 1,
35 kAssetKind = 4,
36 kAssetType = 5,
37 kCategory = 6,
39 kContentType = 8,
40 kCreator = 9,
43 kDataType = 12,
45 kDefinition = 14,
46 kDerivedFrom = 15,
47 kDescription = 16,
48 kDirection = 17,
49 kDisplayName = 18,
51 kEntityType = 20,
52 kExtensions = 21,
54 kFirst = 23,
55 kGlobalAssetId = 24,
56 kId = 25,
57 kIdShort = 26,
59 kInputVariables = 28,
60 kIsCaseOf = 29,
61 kKeys = 30,
62 kKind = 31,
63 kLanguage = 32,
64 kLastUpdate = 33,
65 kLevelType = 34,
66 kMax = 35,
67 kMaxInterval = 36,
68 kMessageBroker = 37,
69 kMessageTopic = 38,
70 kMin = 39,
71 kMinInterval = 40,
72 kName = 41,
73 kNom = 42,
76 kObserved = 45,
77 kOrderRelevant = 46,
79 kPath = 48,
80 kPayload = 49,
81 kPreferredName = 50,
82 kQualifiers = 51,
84 kRefersTo = 53,
85 kRevision = 54,
86 kSecond = 55,
87 kSemanticId = 56,
89 kShortName = 58,
90 kSource = 59,
94 kState = 63,
95 kStatements = 64,
96 kSubjectId = 65,
98 kSubmodels = 67,
100 kSymbol = 69,
101 kTemplateId = 70,
102 kText = 71,
103 kTimeStamp = 72,
104 kTopic = 73,
105 kTyp = 74,
106 kType = 75,
108 kUnit = 77,
109 kUnitId = 78,
110 kValue = 79,
111 kValueFormat = 80,
112 kValueId = 81,
113 kValueList = 82,
115 kValueType = 84,
117 kVersion = 86
118};
119
120std::wstring PropertyToWstring(
121 Property property
122);
123
127class ISegment {
128 public:
129 virtual std::wstring ToWstring() const = 0;
130 virtual std::unique_ptr<ISegment> Clone() const = 0;
131 virtual ~ISegment() = default;
132}; // class ISegment
133
137struct PropertySegment : public ISegment {
142
144 Property a_property
145 );
146
147 std::wstring ToWstring() const override;
148 std::unique_ptr<ISegment> Clone() const override;
149
150 ~PropertySegment() override = default;
151}; // struct PropertySegment
152
156struct IndexSegment : public ISegment {
160 size_t index;
161
162 explicit IndexSegment(
163 size_t an_index
164 );
165
166 std::wstring ToWstring() const override;
167 std::unique_ptr<ISegment> Clone() const override;
168
169 ~IndexSegment() override = default;
170}; // struct IndexSegment
171
181struct Path {
182 // NOTE (mristin):
183 // We did not implement the reflection at the moment since we did not have a use
184 // case for it. If you need reflection, please contact the developers. It should
185 // be a small step going from paths to dereferencing to getters and setters.
186
187 std::deque<std::unique_ptr<ISegment> > segments;
188
190 Path(const Path& other);
191 Path(Path&& other);
192 Path& operator=(const Path& other);
193 Path& operator=(Path&& other);
194
195 std::wstring ToWstring() const;
196}; // struct Path
197
198// endregion Pathing
199
200// region Iterators and descent
201
203namespace impl {
204class IIterator {
205 public:
206 virtual void Start() = 0;
207 virtual void Next() = 0;
208 virtual bool Done() const = 0;
209 virtual const std::shared_ptr<types::IClass>& Get() const = 0;
210 virtual long Index() const = 0;
211
213 virtual void PrependToPath(Path* path) const = 0;
214
215 virtual std::unique_ptr<IIterator> Clone() const = 0;
216
217 virtual ~IIterator() = default;
218}; // class IIterator
219} // namespace impl
221
271class Iterator {
272 using iterator_category = std::forward_iterator_tag;
274 using difference_type = std::ptrdiff_t;
275 using value_type = std::shared_ptr<types::IClass>;
276 using pointer = const std::shared_ptr<types::IClass>*;
277 using reference = const std::shared_ptr<types::IClass>&;
278
279 public:
280 Iterator(const Iterator& other);
282
285
286 reference operator*() const;
287 pointer operator->();
288
289 // Prefix increment
291
292 // Postfix increment
294
295 friend bool operator==(const Iterator& a, const Iterator& b);
296 friend bool operator!=(const Iterator& a, const Iterator& b);
297
298 friend class Descent;
299 friend class DescentOnce;
300 friend Path MaterializePath(const Iterator& iterator);
301 friend void PrependToPath(const Iterator& iterator, Path* path);
302
303 private:
304 explicit Iterator(
305 std::unique_ptr<impl::IIterator> implementation
306 ) :
307 implementation_(std::move(implementation)) {
308 // Intentionally empty.
309 }
310
311 std::unique_ptr<impl::IIterator> implementation_;
312};
313
314bool operator==(const Iterator& a, const Iterator& b);
315
316bool operator!=(const Iterator& a, const Iterator& b);
317
328
332class IDescent {
333 public:
334 virtual Iterator begin() const = 0;
335 virtual const Iterator& end() const = 0;
336 virtual ~IDescent() = default;
337}; // class IDescent
338
361class Descent : public IDescent {
362 public:
364 std::shared_ptr<types::IClass> instance
365 );
366
367 Iterator begin() const override;
368 const Iterator& end() const override;
369
370 ~Descent() override = default;
371
372 private:
373 std::shared_ptr<types::IClass> instance_;
374}; // class Descent
375
395class DescentOnce : public IDescent {
396 public:
398 std::shared_ptr<types::IClass> instance
399 );
400
401 Iterator begin() const override;
402 const Iterator& end() const override;
403
404 ~DescentOnce() override = default;
405
406 private:
407 std::shared_ptr<types::IClass> instance_;
408}; // class DescentOnce
409
410// endregion Iterators and descent
411
412// region Over enumerations
413
419extern const std::vector<types::ModellingKind> kOverModellingKind;
420
426extern const std::vector<types::QualifierKind> kOverQualifierKind;
427
433extern const std::vector<types::AssetKind> kOverAssetKind;
434
440extern const std::vector<types::AasSubmodelElements> kOverAasSubmodelElements;
441
447extern const std::vector<types::EntityType> kOverEntityType;
448
454extern const std::vector<types::Direction> kOverDirection;
455
461extern const std::vector<types::StateOfEvent> kOverStateOfEvent;
462
468extern const std::vector<types::ReferenceTypes> kOverReferenceTypes;
469
475extern const std::vector<types::KeyTypes> kOverKeyTypes;
476
482extern const std::vector<types::DataTypeDefXsd> kOverDataTypeDefXsd;
483
489extern const std::vector<types::DataTypeIec61360> kOverDataTypeIec61360;
490
491// endregion Over enumerations
492
493} // namespace iteration
496} // namespace aas_3_1
497} // namespace aas_core
498
499// This code has been automatically generated by aas-core-codegen.
500// Do NOT edit or append.
501
502#endif // AAS_CORE_AAS_3_1_ITERATION_GUARD_
Provide a non-recursive iterable over the instances referenced from an instance.
Definition iteration.hpp:395
DescentOnce(std::shared_ptr< types::IClass > instance)
const Iterator & end() const override
Provide a recursive iterable over all the instances referenced from an instance.
Definition iteration.hpp:361
Iterator begin() const override
Descent(std::shared_ptr< types::IClass > instance)
const Iterator & end() const override
Definition iteration.hpp:332
virtual Iterator begin() const =0
virtual const Iterator & end() const =0
Definition iteration.hpp:127
virtual std::unique_ptr< ISegment > Clone() const =0
virtual std::wstring ToWstring() const =0
Iterate over an AAS instance.
Definition iteration.hpp:271
friend bool operator!=(const Iterator &a, const Iterator &b)
Iterator & operator=(const Iterator &other)
Iterator & operator=(Iterator &&other)
friend Path MaterializePath(const Iterator &iterator)
Materialize the path that the iterator points to.
friend void PrependToPath(const Iterator &iterator, Path *path)
friend bool operator==(const Iterator &a, const Iterator &b)
const std::vector< types::QualifierKind > kOverQualifierKind
Give a container for all the literals of types::QualifierKind.
const std::vector< types::AasSubmodelElements > kOverAasSubmodelElements
Give a container for all the literals of types::AasSubmodelElements.
Path MaterializePath(const Iterator &iterator)
Materialize the path that the iterator points to.
const std::vector< types::KeyTypes > kOverKeyTypes
Give a container for all the literals of types::KeyTypes.
const std::vector< types::DataTypeDefXsd > kOverDataTypeDefXsd
Give a container for all the literals of types::DataTypeDefXsd.
std::wstring PropertyToWstring(Property property)
const std::vector< types::DataTypeIec61360 > kOverDataTypeIec61360
Give a container for all the literals of types::DataTypeIec61360.
const std::vector< types::ModellingKind > kOverModellingKind
Give a container for all the literals of types::ModellingKind.
Property
Definition iteration.hpp:30
bool operator!=(const Iterator &a, const Iterator &b)
const std::vector< types::EntityType > kOverEntityType
Give a container for all the literals of types::EntityType.
const std::vector< types::AssetKind > kOverAssetKind
Give a container for all the literals of types::AssetKind.
bool operator==(const Iterator &a, const Iterator &b)
const std::vector< types::ReferenceTypes > kOverReferenceTypes
Give a container for all the literals of types::ReferenceTypes.
const std::vector< types::StateOfEvent > kOverStateOfEvent
Give a container for all the literals of types::StateOfEvent.
const std::vector< types::Direction > kOverDirection
Give a container for all the literals of types::Direction.
Definition common.hpp:50
Definition iteration.hpp:156
std::wstring ToWstring() const override
std::unique_ptr< ISegment > Clone() const override
size_t index
Definition iteration.hpp:160
Represent a path to some value.
Definition iteration.hpp:181
std::deque< std::unique_ptr< ISegment > > segments
Definition iteration.hpp:187
std::wstring ToWstring() const
Path & operator=(Path &&other)
Path & operator=(const Path &other)
std::wstring ToWstring() const override
Property property
Definition iteration.hpp:141
std::unique_ptr< ISegment > Clone() const override