diff --git a/src/libaas/basyx/administrative_information.cpp b/src/libaas/basyx/administrativeInformation.cpp similarity index 86% rename from src/libaas/basyx/administrative_information.cpp rename to src/libaas/basyx/administrativeInformation.cpp index 454cc43..5c4b24e 100644 --- a/src/libaas/basyx/administrative_information.cpp +++ b/src/libaas/basyx/administrativeInformation.cpp @@ -1,4 +1,4 @@ -#include "administrative_information.h" +#include namespace basyx { @@ -9,4 +9,4 @@ AdministrativeInformation::AdministrativeInformation(util::string_view version) AdministrativeInformation::AdministrativeInformation(util::string_view version, util::string_view revision) : version(version.to_string()), revision(revision.to_string()) {} -}; \ No newline at end of file +}; diff --git a/src/libaas/basyx/administrativeInformation.h b/src/libaas/basyx/administrativeInformation.h new file mode 100644 index 0000000..3c58204 --- /dev/null +++ b/src/libaas/basyx/administrativeInformation.h @@ -0,0 +1,57 @@ +#ifndef ADMINISTRATIVEINFORMATION_H +#define ADMINISTRATIVEINFORMATION_H + +#include + +#include +#include +#include +#include +#include +#include +#include + +namespace basyx +{ + +class AdministrativeInformation: public HasDataSpecification +{ +public: + using VersionType = basyx::VersionRevisionType; + using RevisionType = basyx::VersionRevisionType; +private: + util::optional version; + util::optional revision; + util::optional creator; + util::optional templateId; +public: + AdministrativeInformation() = default; + AdministrativeInformation(util::string_view version); + AdministrativeInformation(util::string_view version, util::string_view revision); + + AdministrativeInformation(const AdministrativeInformation&) = default; + AdministrativeInformation(AdministrativeInformation&&) = default; + + AdministrativeInformation & operator=(const AdministrativeInformation&) = default; + AdministrativeInformation & operator=(AdministrativeInformation&&) = default; + + ~AdministrativeInformation() = default; +public: + const util::optional getVersion() const { return version; }; + void setVersion(util::string_view version) { this->version = version; }; + + const util::optional getRevision() const { return revision; }; + void setRevision(util::string_view revision) { this->revision = revision; }; + + const util::optional & getCreator() const { return creator; }; + void setCreator(Reference & creator) { this->creator = std::move(creator); }; + + const util::optional & getTemplateId() const { return templateId; }; + void setTemplateId(Identifier templateId) { + this->templateId = std::move(templateId); + }; +}; + +}; + +#endif /* ADMINISTRATIVEINFORMATION_H */ diff --git a/src/libaas/basyx/administrative_information.h b/src/libaas/basyx/administrative_information.h deleted file mode 100644 index 0ba8342..0000000 --- a/src/libaas/basyx/administrative_information.h +++ /dev/null @@ -1,39 +0,0 @@ -#pragma once - -#include - -#include - -#include - -#include - -namespace basyx -{ - -class AdministrativeInformation -{ -private: - util::optional version; - util::optional revision; -public: - AdministrativeInformation() = default; - AdministrativeInformation(util::string_view version); - AdministrativeInformation(util::string_view version, util::string_view revision); - - AdministrativeInformation(const AdministrativeInformation&) = default; - AdministrativeInformation(AdministrativeInformation&&) = default; - - AdministrativeInformation & operator=(const AdministrativeInformation&) = default; - AdministrativeInformation & operator=(AdministrativeInformation&&) = default; - - ~AdministrativeInformation() = default; -public: - const util::optional & get_version() const { return version; }; - void set_version(util::string_view version) { this->version = version.to_string(); }; - - const util::optional & get_revision() const { return revision; }; - void set_revision(util::string_view revision) { this->revision = revision.to_string(); }; -}; - -}; diff --git a/src/libaas/basyx/assetadministrationshell.h b/src/libaas/basyx/assetadministrationshell.h index 00a5d7f..0eca563 100644 --- a/src/libaas/basyx/assetadministrationshell.h +++ b/src/libaas/basyx/assetadministrationshell.h @@ -9,6 +9,7 @@ #include #include #include +#include #include @@ -23,8 +24,9 @@ using Security = int; //using AssetInformation = int; // -------------------------- -class AssetAdministrationShell : - public Identifiable, +class AssetAdministrationShell : + public Identifiable, + public HasDataSpecification, public ModelType, private Identifiable::Copyable { @@ -41,7 +43,7 @@ class AssetAdministrationShell : : Identifiable(idShort, Identifier(id)), assetInformation(std::move(assetInformation)) {}; public: AssetAdministrationShell(const AssetAdministrationShell &aas): - Identifiable(aas.getIdShort(), std::move(aas.getIdentification())), + Identifiable(aas.getIdShort(), std::move(aas.getId())), assetInformation(aas.getAssetInformation()) { this->submodels.append(aas.getSubmodels()); @@ -53,7 +55,7 @@ class AssetAdministrationShell : } AssetAdministrationShell& operator=(const AssetAdministrationShell &aas) { - this->Identifiable::setIdentification(aas.getIdentification()); + this->Identifiable::setId(aas.getId()); this->getIdShort() = aas.getIdShort(); this->submodels.append(aas.getSubmodels()); @@ -83,8 +85,8 @@ class AssetAdministrationShell : void setSubmodels(ElementContainer submodels) { this->submodels = std::move(submodels); }; // Identifiable - special purpose - void setIdentification(Token t, Identifier identifier) { - this->Identifiable::setIdentification(identifier); + void setId(Token t, Identifier id) { + this->Identifiable::setId(id); } }; diff --git a/src/libaas/basyx/haskind.h b/src/libaas/basyx/haskind.h index 76e4b2d..fff5b1d 100644 --- a/src/libaas/basyx/haskind.h +++ b/src/libaas/basyx/haskind.h @@ -6,8 +6,11 @@ namespace basyx { class HasKind { +private: + ModelingKind kind = ModelingKind::Instance; public: - ModelingKind kind = ModelingKind::Instance; + void setKind(ModelingKind kind) { this->kind = kind; } + const ModelingKind getKind() const { return kind; } }; }; diff --git a/src/libaas/basyx/identifiable.h b/src/libaas/basyx/identifiable.h index a92a129..7a1e161 100644 --- a/src/libaas/basyx/identifiable.h +++ b/src/libaas/basyx/identifiable.h @@ -1,6 +1,6 @@ #pragma once -#include +#include #include #include @@ -15,10 +15,10 @@ class Identifiable : public Referable { private: util::optional administration; - Identifier identification; + Identifier id; public: - Identifiable(util::string_view idShort, util::string_view id) : Referable(idShort), identification(id) {}; - Identifiable(util::string_view idShort, Identifier identification) : Referable(idShort), identification(std::move(identification)) {}; + Identifiable(util::string_view idShort, util::string_view id) : Referable(idShort), id(id) {}; + Identifiable(util::string_view idShort, Identifier id) : Referable(idShort), id(std::move(id)) {}; Identifiable(const Identifiable&) = default; Identifiable(Identifiable&&) = default; @@ -32,8 +32,8 @@ class Identifiable : public Referable util::optional & getAdministration() { return administration; }; void setAdministration(AdministrativeInformation administrativeInformation) { this->administration = std::move(administrativeInformation); } - const Identifier & getIdentification() const { return identification; }; - void setIdentification(Identifier identifier) { this->identification = std::move(identifier); }; + const Identifier & getId() const { return id; }; + void setId(Identifier id) { this->id = std::move(id); }; }; }; diff --git a/src/libaas/basyx/semantics/conceptdescription.h b/src/libaas/basyx/semantics/conceptdescription.h index 1776435..d493c31 100644 --- a/src/libaas/basyx/semantics/conceptdescription.h +++ b/src/libaas/basyx/semantics/conceptdescription.h @@ -7,7 +7,7 @@ #include #include -#include +#include #include #include diff --git a/src/libaas/basyx/semantics/hasDataSpecification.cpp b/src/libaas/basyx/semantics/hasDataSpecification.cpp new file mode 100644 index 0000000..ac53d66 --- /dev/null +++ b/src/libaas/basyx/semantics/hasDataSpecification.cpp @@ -0,0 +1,6 @@ +#include + +namespace basyx +{ + +}; diff --git a/src/libaas/basyx/semantics/hasDataSpecification.h b/src/libaas/basyx/semantics/hasDataSpecification.h new file mode 100644 index 0000000..5086e94 --- /dev/null +++ b/src/libaas/basyx/semantics/hasDataSpecification.h @@ -0,0 +1,50 @@ +#ifndef HASDATASPECIFICATION_H +#define HASDATASPECIFICATION_H + +#include + +#include + +#include + +namespace basyx +{ + +class HasDataSpecification +{ +private: + ElementVector dataSpecification; +public: + HasDataSpecification() = default; + + HasDataSpecification(const HasDataSpecification&) = default; + HasDataSpecification(HasDataSpecification&&) = default; + + HasDataSpecification & operator=(const HasDataSpecification&) noexcept = default; + HasDataSpecification & operator=(HasDataSpecification&&) noexcept = default; + + ~HasDataSpecification() = default; +public: + const ElementVector & getDataSpecification() const { + return this->dataSpecification; + }; + ElementVector & getDataSpecification() { + return this->dataSpecification; + }; + + void addDataSpecification(Reference dataSpecification) { + this->dataSpecification.add(dataSpecification); + }; + void addDataSpecification(util::string_view dataSpecification) { + this->dataSpecification.add(dataSpecification); + }; + + void setDataSpecication(ElementVector & dataSpecification) { + this->dataSpecification = std::move(dataSpecification); + } + +}; + +}; + +#endif /* HASDATASPECIFICATION_H */ diff --git a/src/libaas/basyx/semantics/hasdataspecification.cpp b/src/libaas/basyx/semantics/hasdataspecification.cpp deleted file mode 100644 index e69de29..0000000 diff --git a/src/libaas/basyx/semantics/hasdataspecification.h b/src/libaas/basyx/semantics/hasdataspecification.h deleted file mode 100644 index ede38a9..0000000 --- a/src/libaas/basyx/semantics/hasdataspecification.h +++ /dev/null @@ -1,41 +0,0 @@ -#pragma once - -#include - -#include -#include -#include - -#include -#include - -#include -#include -#include - -namespace basyx -{ - -class HasDataSpecification -{ -public: - using dataSpecification_t = std::vector; -private: - dataSpecification_t dataSpecification; -public: - HasDataSpecification() {}; -public: - HasDataSpecification(const HasDataSpecification &) = default; - HasDataSpecification& operator=(const HasDataSpecification &) = default; - - HasDataSpecification(HasDataSpecification &&) noexcept = default; - HasDataSpecification& operator=(HasDataSpecification &&) noexcept = default; -public: - std::size_t size() const { return dataSpecification.size(); }; -public: - const dataSpecification_t & getDataSpecification() const { return dataSpecification; }; - dataSpecification_t & getContainedElments() { return dataSpecification; }; - void setDataSpecification(dataSpecification_t dataSpecification) { this->dataSpecification = std::move(dataSpecification); }; -}; - -}; diff --git a/src/libaas/basyx/serialization/json/serializer.cpp b/src/libaas/basyx/serialization/json/serializer.cpp index ee3b019..1d7e12a 100644 --- a/src/libaas/basyx/serialization/json/serializer.cpp +++ b/src/libaas/basyx/serialization/json/serializer.cpp @@ -45,7 +45,7 @@ void serialize_helper(json_t & json, const HasSemantics & hasSemantics) void serialize_helper(json_t & json, const HasKind & hasKind) { - json["kind"] = ModelingKind_::to_string(hasKind.kind); + json["kind"] = ModelingKind_::to_string(hasKind.getKind()); }; void serialize_helper(json_t & json, const modeltype_base & modelType) @@ -159,14 +159,22 @@ void serialize_helper(json_t & json, const Capability & capability) void serialize_helper(json_t & json, const AdministrativeInformation & administrativeInformation) { - auto & version = administrativeInformation.get_version(); - auto & revision = administrativeInformation.get_revision(); + auto & version = administrativeInformation.getVersion(); + auto & revision = administrativeInformation.getRevision(); + auto & creator = administrativeInformation.getCreator(); + auto & templateId = administrativeInformation.getTemplateId(); - if(version) - json["version"] = *version; + if(version) + json["version"] = version->get(); - if(revision) - json["revision"] = *revision; + if(revision) + json["revision"] = revision->get(); + + if (creator) + json["creator"] = serialize(creator.value()); + + if (templateId) + json["templateId"] = serialize(templateId.value()); }; void serialize_helper(json_t & json, const ReferenceElement & ref_element) @@ -239,7 +247,7 @@ void serialize_helper(json_t & json, const Identifiable & identifiable) { serialize_helper_h(json, identifiable); - json["identification"] = serialize(identifiable.getIdentification()); + json["identification"] = serialize(identifiable.getId()); if (identifiable.getAdministration()) json["administration"] = serialize(*identifiable.getAdministration()); diff --git a/src/libaas/basyx/serialization/xml/xmldeserializer.cpp b/src/libaas/basyx/serialization/xml/xmldeserializer.cpp index bf21f6b..58013b7 100644 --- a/src/libaas/basyx/serialization/xml/xmldeserializer.cpp +++ b/src/libaas/basyx/serialization/xml/xmldeserializer.cpp @@ -283,7 +283,7 @@ void XMLDeSerializer::deSerializeIdentifiable(xml_node node, xml_node ident_node = findChildByName(node, XML_identification); if (ident_node.root()) { Identifier ident = deSerializeIdentifier(ident_node); - metamodelElement.setIdentification(ds->getToken(), ident); + metamodelElement.setId(ds->getToken(), ident); } } @@ -345,13 +345,13 @@ void XMLDeSerializer::deSerializeHasKind(pugi::xml_node node, xml_node mk_node = findChildByName(node, XML_modelingKind); if (mk_node.root()) { std::string mk_str = deSerializeString(mk_node); - metamodelElement.kind = ModelingKind_::from_string(mk_str); + metamodelElement.setKind(ModelingKind_::from_string(mk_str)); } /* As per spec: * "Default for an element is that it is representing an instance." */ else - metamodelElement.kind = ModelingKind::Instance; + metamodelElement.setKind(ModelingKind::Instance); } template diff --git a/src/libaas/basyx/submodel.h b/src/libaas/basyx/submodel.h index 44aaab6..28a69df 100644 --- a/src/libaas/basyx/submodel.h +++ b/src/libaas/basyx/submodel.h @@ -15,6 +15,9 @@ #include +#include +#include + #include #include #include @@ -27,8 +30,10 @@ using namespace basyx::serialization::priv; class Submodel : public Identifiable, - public HasKind, - public HasSemantics, + public HasKind, + public HasSemantics, + public Qualifiable, + public HasDataSpecification, public ModelType, private Identifiable::Copyable { @@ -38,12 +43,12 @@ class Submodel : Submodel(util::string_view idShort, util::string_view identifier) : Identifiable(idShort, Identifier(identifier)) {}; Submodel(util::string_view idShort, Identifier identifier) : Identifiable(idShort, std::move(identifier)) {}; public: - Submodel(const Submodel &sm) : Identifiable(sm.getIdShort(), std::move(sm.getIdentification().getId())) { + Submodel(const Submodel &sm) : Identifiable(sm.getIdShort(), std::move(sm.getId().getId())) { this->submodelElements.append(sm.getSubmodelElements()); }; Submodel& operator=(const Submodel &sm) { - this->Identifiable::setIdentification(sm.getIdentification()); + this->Identifiable::setId(sm.getId()); this->getIdShort() = sm.getIdShort(); this->submodelElements.append(sm.getSubmodelElements()); return *this; @@ -61,8 +66,8 @@ class Submodel : void setSubmodelElements(ElementContainer elements) { this->submodelElements = std::move(elements); }; // Identifiable - special purpose - void setIdentification(Token t, Identifier identifier) { - this->Identifiable::setIdentification(identifier); + void setId(Token t, Identifier id) { + this->Identifiable::setId(id); } }; diff --git a/src/libaas/basyx/submodelelement/submodelelement.h b/src/libaas/basyx/submodelelement/submodelelement.h index e89b3d3..5bfc77a 100644 --- a/src/libaas/basyx/submodelelement/submodelelement.h +++ b/src/libaas/basyx/submodelelement/submodelelement.h @@ -10,16 +10,20 @@ #include +#include +#include + #include namespace basyx { -class SubmodelElement : - public Referable, - public HasKind, - public HasSemantics, - public virtual serialization::serializable_base +class SubmodelElement : + public Referable, + public HasSemantics, + public Qualifiable, + public HasDataSpecification, + public virtual serialization::serializable_base { protected: SubmodelElement(util::string_view idShort) : Referable(idShort) {}; @@ -47,4 +51,4 @@ class SubmodelElementHelper static bool IsSubmodelElementCollection(const SubmodelElement& ele); }; -} \ No newline at end of file +} diff --git a/src/libaas/basyx/versionRevisionType.cpp b/src/libaas/basyx/versionRevisionType.cpp new file mode 100644 index 0000000..1552beb --- /dev/null +++ b/src/libaas/basyx/versionRevisionType.cpp @@ -0,0 +1,29 @@ +#include + +namespace basyx { + +VersionRevisionType &VersionRevisionType::operator=(const VersionRevisionType &id) noexcept { + operator=(id.get()); + return *this; +} + +VersionRevisionType &VersionRevisionType::operator=(const basyx::util::string_view& id) noexcept { + operator=(id.to_string()); + return *this; +} + +/* Funnel for all operator= of this class */ +VersionRevisionType &VersionRevisionType::operator=(const std::string& id) noexcept { + std::smatch matches; + if (std::regex_match(id, matches, VERSIONREVISIONTYPEREGEX)) + base::MinMaxString::operator=(id); + else + base::MinMaxString::operator=(std::string(&DEFAULT_VERSION)); + return *this; +} + +std::string VersionRevisionType::get() const { + return static_cast(*this); +} + +}; diff --git a/src/libaas/basyx/versionRevisionType.h b/src/libaas/basyx/versionRevisionType.h new file mode 100644 index 0000000..ae5c615 --- /dev/null +++ b/src/libaas/basyx/versionRevisionType.h @@ -0,0 +1,39 @@ +#ifndef VERSIONREVISIONTYPE_H +#define VERSIONREVISIONTYPE_H + +#include + +#include +#include + +namespace basyx +{ + +static const char DEFAULT_VERSION = '0'; +static std::regex VERSIONREVISIONTYPEREGEX("^([0-9]|[1-9][0-9]*)$"); + +class VersionRevisionType: public base::MinMaxString { +private: + static const unsigned int minLenght = 1; + static const unsigned int maxLenght = 4; +public: + VersionRevisionType(): base::MinMaxString(minLenght, maxLenght) {} + VersionRevisionType(const VersionRevisionType&) = default; + VersionRevisionType(const basyx::util::string_view &v): + base::MinMaxString(minLenght, maxLenght) { + operator=(v.to_string()); + } + VersionRevisionType(VersionRevisionType&&) = default; + + VersionRevisionType& operator=(const VersionRevisionType& id) noexcept; + VersionRevisionType& operator=(const basyx::util::string_view& id) noexcept; + VersionRevisionType& operator=(const std::string& id) noexcept; + //VersionRevisionType& operator=(VersionRevisionType &) noexcept = default; + + std::string get() const; + + ~VersionRevisionType() = default; +}; +}; + +#endif // VERSIONREVISIONTYPE_H diff --git a/src/libaas/sources.cmake b/src/libaas/sources.cmake index ee197c3..05d1b74 100644 --- a/src/libaas/sources.cmake +++ b/src/libaas/sources.cmake @@ -1,5 +1,5 @@ SET(SOURCE_FILES_BASYX_AAS - ${CMAKE_CURRENT_SOURCE_DIR}/basyx/administrative_information.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/basyx/administrativeInformation.cpp ${CMAKE_CURRENT_SOURCE_DIR}/basyx/asset/assetinformation.cpp ${CMAKE_CURRENT_SOURCE_DIR}/basyx/assetadministrationshell.cpp ${CMAKE_CURRENT_SOURCE_DIR}/basyx/base/basyx_enums.cpp @@ -37,7 +37,7 @@ SET(SOURCE_FILES_BASYX_AAS ${CMAKE_CURRENT_SOURCE_DIR}/basyx/referable.cpp ${CMAKE_CURRENT_SOURCE_DIR}/basyx/reference.cpp ${CMAKE_CURRENT_SOURCE_DIR}/basyx/semantics/conceptdescription.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/basyx/semantics/hasdataspecification.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/basyx/semantics/hasDataSpecification.cpp ${CMAKE_CURRENT_SOURCE_DIR}/basyx/serialization/json/deserializer.cpp ${CMAKE_CURRENT_SOURCE_DIR}/basyx/serialization/json/serializer.cpp ${CMAKE_CURRENT_SOURCE_DIR}/basyx/serialization/private/deserializer_priv.cpp @@ -61,10 +61,11 @@ SET(SOURCE_FILES_BASYX_AAS ${CMAKE_CURRENT_SOURCE_DIR}/basyx/submodelelement/relationshipelement.cpp ${CMAKE_CURRENT_SOURCE_DIR}/basyx/submodelelement/submodelelement.cpp ${CMAKE_CURRENT_SOURCE_DIR}/basyx/submodelelement/submodelelementcollection.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/basyx/versionRevisionType.cpp ) SET(HEADER_FILES_BASYX_AAS - ${CMAKE_CURRENT_SOURCE_DIR}/basyx/administrative_information.h + ${CMAKE_CURRENT_SOURCE_DIR}/basyx/administrativeInformation.h ${CMAKE_CURRENT_SOURCE_DIR}/basyx/asset/assetinformation.h ${CMAKE_CURRENT_SOURCE_DIR}/basyx/assetadministrationshell.h ${CMAKE_CURRENT_SOURCE_DIR}/basyx/base/basyx_enum_base.h @@ -114,7 +115,7 @@ SET(HEADER_FILES_BASYX_AAS ${CMAKE_CURRENT_SOURCE_DIR}/basyx/referable.h ${CMAKE_CURRENT_SOURCE_DIR}/basyx/reference.h ${CMAKE_CURRENT_SOURCE_DIR}/basyx/semantics/conceptdescription.h - ${CMAKE_CURRENT_SOURCE_DIR}/basyx/semantics/hasdataspecification.h + ${CMAKE_CURRENT_SOURCE_DIR}/basyx/semantics/hasDataSpecification.h ${CMAKE_CURRENT_SOURCE_DIR}/basyx/serialization/base/serialization.h ${CMAKE_CURRENT_SOURCE_DIR}/basyx/serialization/json/deserializer.h ${CMAKE_CURRENT_SOURCE_DIR}/basyx/serialization/json/serializer.h @@ -145,4 +146,5 @@ SET(HEADER_FILES_BASYX_AAS ${CMAKE_CURRENT_SOURCE_DIR}/basyx/submodelelement/relationshipelement.h ${CMAKE_CURRENT_SOURCE_DIR}/basyx/submodelelement/submodelelement.h ${CMAKE_CURRENT_SOURCE_DIR}/basyx/submodelelement/submodelelementcollection.h + ${CMAKE_CURRENT_SOURCE_DIR}/basyx/versionRevisionType.h ) diff --git a/tests/tests_libaas/test_basyx.cpp b/tests/tests_libaas/test_basyx.cpp index e532ee6..2738ea0 100644 --- a/tests/tests_libaas/test_basyx.cpp +++ b/tests/tests_libaas/test_basyx.cpp @@ -17,6 +17,9 @@ #include #include #include +#include + +#include #include @@ -76,6 +79,18 @@ TEST_F(BaseTest, MinMaxString) { } +TEST_F(BaseTest, VersionRevisionType) +{ + VersionRevisionType vrt1("22"); + ASSERT_STREQ("22", vrt1.str().data()); + + VersionRevisionType vrt2("Bad"); + ASSERT_STREQ("0", vrt2.str().data()); + + VersionRevisionType vrt3("1234567890"); + ASSERT_STREQ("1234", vrt3.str().data()); +} + TEST_F(BaseTest, LangStringSet) { basyx::langstring_t l { "de", "test" }; @@ -171,7 +186,6 @@ TEST_F(BaseTest, MultiLangProp) ASSERT_EQ(*ls1, "example"); ASSERT_EQ(*ls2, "beispiel"); - mlp.kind = basyx::ModelingKind::Instance; }; TEST_F(BaseTest, Enum) @@ -189,11 +203,11 @@ TEST_F(BaseTest, Enum) TEST_F(BaseTest, HasKind) { - auto mlp = std::make_unique("test"); + Submodel sm("test",Identifier("testId")); + sm.setKind(ModelingKind::Template); - mlp->kind = ModelingKind::Template; - HasKind* has_kind = mlp.get(); - has_kind->kind = ModelingKind::Instance; + HasKind has_kind = static_cast(sm); + ASSERT_EQ(ModelingKind::Template, has_kind.getKind()); }; TEST_F(BaseTest, RangeTest) diff --git a/tests/tests_libaas/test_json_deserializer.cpp b/tests/tests_libaas/test_json_deserializer.cpp index 3ec72c7..7f59787 100644 --- a/tests/tests_libaas/test_json_deserializer.cpp +++ b/tests/tests_libaas/test_json_deserializer.cpp @@ -204,7 +204,7 @@ TEST_F(JsonDeserializerTest, Submodel) auto sm = basyx::serialization::json::deserialize_submodel(json_submodel); ASSERT_EQ(sm.getIdShort(), "sm_1"); - ASSERT_EQ(sm.getIdentification().getId(), "submodel"); + ASSERT_EQ(sm.getId().getId(), "submodel"); ASSERT_EQ(sm.getSubmodelElements().size(), 2); }; @@ -227,7 +227,7 @@ TEST_F(JsonDeserializerTest, AssetAdministrationShell) auto aas = basyx::serialization::json::deserialize_aas(json_aas); ASSERT_EQ(aas.getIdShort(), "aas_1"); - ASSERT_EQ(aas.getIdentification().getId(), "asset_admin_shell_1"); + ASSERT_EQ(aas.getId().getId(), "asset_admin_shell_1"); ASSERT_EQ(aas.getSubmodels().size(), 1); };