aas-core3 1.0.0
Manipulate, verify and de/serialize asset administration shells in C++.
Loading...
Searching...
No Matches
jsonization.hpp
Go to the documentation of this file.
1#ifndef AAS_CORE_AAS_3_0_JSONIZATION_GUARD_
2#define AAS_CORE_AAS_3_0_JSONIZATION_GUARD_
3
4// This code has been automatically generated by aas-core-codegen.
5// Do NOT edit or append.
6
10
11#pragma warning(push, 0)
12#include <nlohmann/json.hpp>
13
14#include <memory>
15#include <string>
16#include <utility>
17#pragma warning(pop)
18
19namespace aas_core {
20namespace aas_3_0 {
21
26namespace jsonization {
27
31class ISegment {
32 public:
36 virtual std::wstring ToWstring() const = 0;
37
38 virtual std::unique_ptr<ISegment> Clone() const = 0;
39
40 virtual ~ISegment() = default;
41}; // class ISegment
42
46struct PropertySegment : public ISegment {
50 std::wstring name;
51
53 std::wstring a_name
54 );
55
56 std::wstring ToWstring() const override;
57
58 std::unique_ptr<ISegment> Clone() const override;
59
60 ~PropertySegment() override = default;
61}; // struct PropertySegment
62
66struct IndexSegment : public ISegment {
70 size_t index;
71
72 explicit IndexSegment(
73 size_t an_index
74 );
75
76 std::wstring ToWstring() const override;
77
78 std::unique_ptr<ISegment> Clone() const override;
79
80 ~IndexSegment() override = default;
81}; // struct IndexSegment
82
86struct Path {
87 std::deque<std::unique_ptr<ISegment> > segments;
88
90 Path(const Path& other);
91 Path(Path&& other);
92 Path& operator=(const Path& other);
93 Path& operator=(Path&& other);
94
95 std::wstring ToWstring() const;
96}; // struct Path
97
98// region De-serialization
99
107 std::wstring cause;
108
113
114 explicit DeserializationError(std::wstring a_cause);
115 DeserializationError(std::wstring a_cause, Path a_path);
116}; // struct DeserializationError
117
127common::expected<
128 std::shared_ptr<types::IHasSemantics>,
131 const nlohmann::json& json,
132 bool additional_properties = false
133);
134
144common::expected<
145 std::shared_ptr<types::IExtension>,
148 const nlohmann::json& json,
149 bool additional_properties = false
150);
151
161common::expected<
162 std::shared_ptr<types::IHasExtensions>,
165 const nlohmann::json& json,
166 bool additional_properties = false
167);
168
178common::expected<
179 std::shared_ptr<types::IReferable>,
182 const nlohmann::json& json,
183 bool additional_properties = false
184);
185
195common::expected<
196 std::shared_ptr<types::IIdentifiable>,
199 const nlohmann::json& json,
200 bool additional_properties = false
201);
202
212common::expected<
213 std::shared_ptr<types::IHasKind>,
216 const nlohmann::json& json,
217 bool additional_properties = false
218);
219
229common::expected<
230 std::shared_ptr<types::IHasDataSpecification>,
233 const nlohmann::json& json,
234 bool additional_properties = false
235);
236
246common::expected<
247 std::shared_ptr<types::IAdministrativeInformation>,
250 const nlohmann::json& json,
251 bool additional_properties = false
252);
253
263common::expected<
264 std::shared_ptr<types::IQualifiable>,
267 const nlohmann::json& json,
268 bool additional_properties = false
269);
270
280common::expected<
281 std::shared_ptr<types::IQualifier>,
284 const nlohmann::json& json,
285 bool additional_properties = false
286);
287
297common::expected<
298 std::shared_ptr<types::IAssetAdministrationShell>,
301 const nlohmann::json& json,
302 bool additional_properties = false
303);
304
314common::expected<
315 std::shared_ptr<types::IAssetInformation>,
318 const nlohmann::json& json,
319 bool additional_properties = false
320);
321
331common::expected<
332 std::shared_ptr<types::IResource>,
335 const nlohmann::json& json,
336 bool additional_properties = false
337);
338
348common::expected<
349 std::shared_ptr<types::ISpecificAssetId>,
352 const nlohmann::json& json,
353 bool additional_properties = false
354);
355
365common::expected<
366 std::shared_ptr<types::ISubmodel>,
369 const nlohmann::json& json,
370 bool additional_properties = false
371);
372
382common::expected<
383 std::shared_ptr<types::ISubmodelElement>,
386 const nlohmann::json& json,
387 bool additional_properties = false
388);
389
399common::expected<
400 std::shared_ptr<types::IRelationshipElement>,
403 const nlohmann::json& json,
404 bool additional_properties = false
405);
406
416common::expected<
417 std::shared_ptr<types::ISubmodelElementList>,
420 const nlohmann::json& json,
421 bool additional_properties = false
422);
423
433common::expected<
434 std::shared_ptr<types::ISubmodelElementCollection>,
437 const nlohmann::json& json,
438 bool additional_properties = false
439);
440
450common::expected<
451 std::shared_ptr<types::IDataElement>,
454 const nlohmann::json& json,
455 bool additional_properties = false
456);
457
467common::expected<
468 std::shared_ptr<types::IProperty>,
471 const nlohmann::json& json,
472 bool additional_properties = false
473);
474
484common::expected<
485 std::shared_ptr<types::IMultiLanguageProperty>,
488 const nlohmann::json& json,
489 bool additional_properties = false
490);
491
501common::expected<
502 std::shared_ptr<types::IRange>,
505 const nlohmann::json& json,
506 bool additional_properties = false
507);
508
518common::expected<
519 std::shared_ptr<types::IReferenceElement>,
522 const nlohmann::json& json,
523 bool additional_properties = false
524);
525
535common::expected<
536 std::shared_ptr<types::IBlob>,
539 const nlohmann::json& json,
540 bool additional_properties = false
541);
542
552common::expected<
553 std::shared_ptr<types::IFile>,
556 const nlohmann::json& json,
557 bool additional_properties = false
558);
559
569common::expected<
570 std::shared_ptr<types::IAnnotatedRelationshipElement>,
573 const nlohmann::json& json,
574 bool additional_properties = false
575);
576
586common::expected<
587 std::shared_ptr<types::IEntity>,
590 const nlohmann::json& json,
591 bool additional_properties = false
592);
593
603common::expected<
604 std::shared_ptr<types::IEventPayload>,
607 const nlohmann::json& json,
608 bool additional_properties = false
609);
610
620common::expected<
621 std::shared_ptr<types::IEventElement>,
624 const nlohmann::json& json,
625 bool additional_properties = false
626);
627
637common::expected<
638 std::shared_ptr<types::IBasicEventElement>,
641 const nlohmann::json& json,
642 bool additional_properties = false
643);
644
654common::expected<
655 std::shared_ptr<types::IOperation>,
658 const nlohmann::json& json,
659 bool additional_properties = false
660);
661
671common::expected<
672 std::shared_ptr<types::IOperationVariable>,
675 const nlohmann::json& json,
676 bool additional_properties = false
677);
678
688common::expected<
689 std::shared_ptr<types::ICapability>,
692 const nlohmann::json& json,
693 bool additional_properties = false
694);
695
705common::expected<
706 std::shared_ptr<types::IConceptDescription>,
709 const nlohmann::json& json,
710 bool additional_properties = false
711);
712
722common::expected<
723 std::shared_ptr<types::IReference>,
726 const nlohmann::json& json,
727 bool additional_properties = false
728);
729
739common::expected<
740 std::shared_ptr<types::IKey>,
743 const nlohmann::json& json,
744 bool additional_properties = false
745);
746
756common::expected<
757 std::shared_ptr<types::IAbstractLangString>,
760 const nlohmann::json& json,
761 bool additional_properties = false
762);
763
773common::expected<
774 std::shared_ptr<types::ILangStringNameType>,
777 const nlohmann::json& json,
778 bool additional_properties = false
779);
780
790common::expected<
791 std::shared_ptr<types::ILangStringTextType>,
794 const nlohmann::json& json,
795 bool additional_properties = false
796);
797
807common::expected<
808 std::shared_ptr<types::IEnvironment>,
811 const nlohmann::json& json,
812 bool additional_properties = false
813);
814
824common::expected<
825 std::shared_ptr<types::IDataSpecificationContent>,
828 const nlohmann::json& json,
829 bool additional_properties = false
830);
831
841common::expected<
842 std::shared_ptr<types::IEmbeddedDataSpecification>,
845 const nlohmann::json& json,
846 bool additional_properties = false
847);
848
858common::expected<
859 std::shared_ptr<types::ILevelType>,
862 const nlohmann::json& json,
863 bool additional_properties = false
864);
865
875common::expected<
876 std::shared_ptr<types::IValueReferencePair>,
879 const nlohmann::json& json,
880 bool additional_properties = false
881);
882
892common::expected<
893 std::shared_ptr<types::IValueList>,
896 const nlohmann::json& json,
897 bool additional_properties = false
898);
899
909common::expected<
910 std::shared_ptr<types::ILangStringPreferredNameTypeIec61360>,
913 const nlohmann::json& json,
914 bool additional_properties = false
915);
916
926common::expected<
927 std::shared_ptr<types::ILangStringShortNameTypeIec61360>,
930 const nlohmann::json& json,
931 bool additional_properties = false
932);
933
943common::expected<
944 std::shared_ptr<types::ILangStringDefinitionTypeIec61360>,
947 const nlohmann::json& json,
948 bool additional_properties = false
949);
950
960common::expected<
961 std::shared_ptr<types::IDataSpecificationIec61360>,
964 const nlohmann::json& json,
965 bool additional_properties = false
966);
967
968// endregion Deserialization
969
970// region Serialization
971
975class SerializationException : public std::exception {
976 public:
978 std::wstring cause,
980 );
981
982 const char* what() const noexcept override;
983
984 const std::wstring& cause() const noexcept;
985 const iteration::Path& path() const noexcept;
986
987 ~SerializationException() noexcept override = default;
988
989 private:
990 const std::wstring cause_;
991 const iteration::Path path_;
992 const std::string msg_;
993}; // class SerializationException
994
1003nlohmann::json Serialize(
1004 const types::IClass& that
1005);
1006
1007// endregion Serialization
1008
1009} // namespace jsonization
1010
1011
1012} // namespace aas_3_0
1013} // namespace aas_core
1014
1015// This code has been automatically generated by aas-core-codegen.
1016// Do NOT edit or append.
1017
1018#endif // AAS_CORE_AAS_3_0_JSONIZATION_GUARD_
Definition jsonization.hpp:31
virtual std::wstring ToWstring() const =0
Convert the segment to a string in a JSON path.
virtual std::unique_ptr< ISegment > Clone() const =0
const char * what() const noexcept override
const std::wstring & cause() const noexcept
SerializationException(std::wstring cause, iteration::Path path)
const iteration::Path & path() const noexcept
Definition iteration.hpp:23
Definition jsonization.hpp:26
common::expected< std::shared_ptr< types::ILangStringPreferredNameTypeIec61360 >, DeserializationError > LangStringPreferredNameTypeIec61360From(const nlohmann::json &json, bool additional_properties=false)
Deserialize json value to an instance of types::ILangStringPreferredNameTypeIec61360.
common::expected< std::shared_ptr< types::IResource >, DeserializationError > ResourceFrom(const nlohmann::json &json, bool additional_properties=false)
Deserialize json value to an instance of types::IResource.
common::expected< std::shared_ptr< types::IHasKind >, DeserializationError > HasKindFrom(const nlohmann::json &json, bool additional_properties=false)
Deserialize json value to an instance of types::IHasKind.
common::expected< std::shared_ptr< types::IRange >, DeserializationError > RangeFrom(const nlohmann::json &json, bool additional_properties=false)
Deserialize json value to an instance of types::IRange.
common::expected< std::shared_ptr< types::IBlob >, DeserializationError > BlobFrom(const nlohmann::json &json, bool additional_properties=false)
Deserialize json value to an instance of types::IBlob.
common::expected< std::shared_ptr< types::IRelationshipElement >, DeserializationError > RelationshipElementFrom(const nlohmann::json &json, bool additional_properties=false)
Deserialize json value to an instance of types::IRelationshipElement.
common::expected< std::shared_ptr< types::IEmbeddedDataSpecification >, DeserializationError > EmbeddedDataSpecificationFrom(const nlohmann::json &json, bool additional_properties=false)
Deserialize json value to an instance of types::IEmbeddedDataSpecification.
common::expected< std::shared_ptr< types::IFile >, DeserializationError > FileFrom(const nlohmann::json &json, bool additional_properties=false)
Deserialize json value to an instance of types::IFile.
common::expected< std::shared_ptr< types::ICapability >, DeserializationError > CapabilityFrom(const nlohmann::json &json, bool additional_properties=false)
Deserialize json value to an instance of types::ICapability.
common::expected< std::shared_ptr< types::IEnvironment >, DeserializationError > EnvironmentFrom(const nlohmann::json &json, bool additional_properties=false)
Deserialize json value to an instance of types::IEnvironment.
common::expected< std::shared_ptr< types::IMultiLanguageProperty >, DeserializationError > MultiLanguagePropertyFrom(const nlohmann::json &json, bool additional_properties=false)
Deserialize json value to an instance of types::IMultiLanguageProperty.
common::expected< std::shared_ptr< types::ILangStringNameType >, DeserializationError > LangStringNameTypeFrom(const nlohmann::json &json, bool additional_properties=false)
Deserialize json value to an instance of types::ILangStringNameType.
common::expected< std::shared_ptr< types::IKey >, DeserializationError > KeyFrom(const nlohmann::json &json, bool additional_properties=false)
Deserialize json value to an instance of types::IKey.
nlohmann::json Serialize(const types::IClass &that)
Serialize that instance to a JSON value.
common::expected< std::shared_ptr< types::IHasExtensions >, DeserializationError > HasExtensionsFrom(const nlohmann::json &json, bool additional_properties=false)
Deserialize json value to an instance of types::IHasExtensions.
common::expected< std::shared_ptr< types::IReference >, DeserializationError > ReferenceFrom(const nlohmann::json &json, bool additional_properties=false)
Deserialize json value to an instance of types::IReference.
common::expected< std::shared_ptr< types::IAnnotatedRelationshipElement >, DeserializationError > AnnotatedRelationshipElementFrom(const nlohmann::json &json, bool additional_properties=false)
Deserialize json value to an instance of types::IAnnotatedRelationshipElement.
common::expected< std::shared_ptr< types::IDataSpecificationIec61360 >, DeserializationError > DataSpecificationIec61360From(const nlohmann::json &json, bool additional_properties=false)
Deserialize json value to an instance of types::IDataSpecificationIec61360.
common::expected< std::shared_ptr< types::ISubmodel >, DeserializationError > SubmodelFrom(const nlohmann::json &json, bool additional_properties=false)
Deserialize json value to an instance of types::ISubmodel.
common::expected< std::shared_ptr< types::IProperty >, DeserializationError > PropertyFrom(const nlohmann::json &json, bool additional_properties=false)
Deserialize json value to an instance of types::IProperty.
common::expected< std::shared_ptr< types::IIdentifiable >, DeserializationError > IdentifiableFrom(const nlohmann::json &json, bool additional_properties=false)
Deserialize json value to an instance of types::IIdentifiable.
common::expected< std::shared_ptr< types::IAdministrativeInformation >, DeserializationError > AdministrativeInformationFrom(const nlohmann::json &json, bool additional_properties=false)
Deserialize json value to an instance of types::IAdministrativeInformation.
common::expected< std::shared_ptr< types::IAssetInformation >, DeserializationError > AssetInformationFrom(const nlohmann::json &json, bool additional_properties=false)
Deserialize json value to an instance of types::IAssetInformation.
common::expected< std::shared_ptr< types::ISubmodelElementCollection >, DeserializationError > SubmodelElementCollectionFrom(const nlohmann::json &json, bool additional_properties=false)
Deserialize json value to an instance of types::ISubmodelElementCollection.
common::expected< std::shared_ptr< types::IReferable >, DeserializationError > ReferableFrom(const nlohmann::json &json, bool additional_properties=false)
Deserialize json value to an instance of types::IReferable.
common::expected< std::shared_ptr< types::IDataSpecificationContent >, DeserializationError > DataSpecificationContentFrom(const nlohmann::json &json, bool additional_properties=false)
Deserialize json value to an instance of types::IDataSpecificationContent.
common::expected< std::shared_ptr< types::IDataElement >, DeserializationError > DataElementFrom(const nlohmann::json &json, bool additional_properties=false)
Deserialize json value to an instance of types::IDataElement.
common::expected< std::shared_ptr< types::IExtension >, DeserializationError > ExtensionFrom(const nlohmann::json &json, bool additional_properties=false)
Deserialize json value to an instance of types::IExtension.
common::expected< std::shared_ptr< types::IHasSemantics >, DeserializationError > HasSemanticsFrom(const nlohmann::json &json, bool additional_properties=false)
Deserialize json value to an instance of types::IHasSemantics.
common::expected< std::shared_ptr< types::ILangStringShortNameTypeIec61360 >, DeserializationError > LangStringShortNameTypeIec61360From(const nlohmann::json &json, bool additional_properties=false)
Deserialize json value to an instance of types::ILangStringShortNameTypeIec61360.
common::expected< std::shared_ptr< types::IConceptDescription >, DeserializationError > ConceptDescriptionFrom(const nlohmann::json &json, bool additional_properties=false)
Deserialize json value to an instance of types::IConceptDescription.
common::expected< std::shared_ptr< types::IEntity >, DeserializationError > EntityFrom(const nlohmann::json &json, bool additional_properties=false)
Deserialize json value to an instance of types::IEntity.
common::expected< std::shared_ptr< types::IValueList >, DeserializationError > ValueListFrom(const nlohmann::json &json, bool additional_properties=false)
Deserialize json value to an instance of types::IValueList.
common::expected< std::shared_ptr< types::ISubmodelElementList >, DeserializationError > SubmodelElementListFrom(const nlohmann::json &json, bool additional_properties=false)
Deserialize json value to an instance of types::ISubmodelElementList.
common::expected< std::shared_ptr< types::IReferenceElement >, DeserializationError > ReferenceElementFrom(const nlohmann::json &json, bool additional_properties=false)
Deserialize json value to an instance of types::IReferenceElement.
common::expected< std::shared_ptr< types::ISpecificAssetId >, DeserializationError > SpecificAssetIdFrom(const nlohmann::json &json, bool additional_properties=false)
Deserialize json value to an instance of types::ISpecificAssetId.
common::expected< std::shared_ptr< types::IQualifier >, DeserializationError > QualifierFrom(const nlohmann::json &json, bool additional_properties=false)
Deserialize json value to an instance of types::IQualifier.
common::expected< std::shared_ptr< types::IEventPayload >, DeserializationError > EventPayloadFrom(const nlohmann::json &json, bool additional_properties=false)
Deserialize json value to an instance of types::IEventPayload.
common::expected< std::shared_ptr< types::ILevelType >, DeserializationError > LevelTypeFrom(const nlohmann::json &json, bool additional_properties=false)
Deserialize json value to an instance of types::ILevelType.
common::expected< std::shared_ptr< types::IOperation >, DeserializationError > OperationFrom(const nlohmann::json &json, bool additional_properties=false)
Deserialize json value to an instance of types::IOperation.
common::expected< std::shared_ptr< types::IAssetAdministrationShell >, DeserializationError > AssetAdministrationShellFrom(const nlohmann::json &json, bool additional_properties=false)
Deserialize json value to an instance of types::IAssetAdministrationShell.
common::expected< std::shared_ptr< types::IOperationVariable >, DeserializationError > OperationVariableFrom(const nlohmann::json &json, bool additional_properties=false)
Deserialize json value to an instance of types::IOperationVariable.
common::expected< std::shared_ptr< types::IBasicEventElement >, DeserializationError > BasicEventElementFrom(const nlohmann::json &json, bool additional_properties=false)
Deserialize json value to an instance of types::IBasicEventElement.
common::expected< std::shared_ptr< types::ILangStringDefinitionTypeIec61360 >, DeserializationError > LangStringDefinitionTypeIec61360From(const nlohmann::json &json, bool additional_properties=false)
Deserialize json value to an instance of types::ILangStringDefinitionTypeIec61360.
common::expected< std::shared_ptr< types::IValueReferencePair >, DeserializationError > ValueReferencePairFrom(const nlohmann::json &json, bool additional_properties=false)
Deserialize json value to an instance of types::IValueReferencePair.
common::expected< std::shared_ptr< types::IAbstractLangString >, DeserializationError > AbstractLangStringFrom(const nlohmann::json &json, bool additional_properties=false)
Deserialize json value to an instance of types::IAbstractLangString.
common::expected< std::shared_ptr< types::ISubmodelElement >, DeserializationError > SubmodelElementFrom(const nlohmann::json &json, bool additional_properties=false)
Deserialize json value to an instance of types::ISubmodelElement.
common::expected< std::shared_ptr< types::IQualifiable >, DeserializationError > QualifiableFrom(const nlohmann::json &json, bool additional_properties=false)
Deserialize json value to an instance of types::IQualifiable.
common::expected< std::shared_ptr< types::IHasDataSpecification >, DeserializationError > HasDataSpecificationFrom(const nlohmann::json &json, bool additional_properties=false)
Deserialize json value to an instance of types::IHasDataSpecification.
common::expected< std::shared_ptr< types::ILangStringTextType >, DeserializationError > LangStringTextTypeFrom(const nlohmann::json &json, bool additional_properties=false)
Deserialize json value to an instance of types::ILangStringTextType.
common::expected< std::shared_ptr< types::IEventElement >, DeserializationError > EventElementFrom(const nlohmann::json &json, bool additional_properties=false)
Deserialize json value to an instance of types::IEventElement.
Definition types.hpp:24
Definition common.hpp:47
Definition common.hpp:46
Represent a path to some value.
Definition iteration.hpp:181
DeserializationError(std::wstring a_cause, Path a_path)
Path path
Definition jsonization.hpp:112
std::wstring cause
Definition jsonization.hpp:107
std::unique_ptr< ISegment > Clone() const override
size_t index
Definition jsonization.hpp:70
std::wstring ToWstring() const override
Convert the segment to a string in a JSON path.
Definition jsonization.hpp:86
std::deque< std::unique_ptr< ISegment > > segments
Definition jsonization.hpp:87
Path & operator=(const Path &other)
std::unique_ptr< ISegment > Clone() const override
std::wstring ToWstring() const override
Convert the segment to a string in a JSON path.
std::wstring name
Definition jsonization.hpp:50