-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #16 from tobijk2/development_v2_klausmannt
Identifier for V3 metamodel
- Loading branch information
Showing
22 changed files
with
105 additions
and
207 deletions.
There are no files selected for viewing
Empty file.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,7 @@ namespace basyx { | |
enum class AssetKind { | ||
Type, | ||
Instance, | ||
NotApplicable, | ||
}; | ||
|
||
class AssetKind_ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,25 @@ | ||
#include "identifier.h" | ||
|
||
namespace basyx | ||
{ | ||
#include <basyx/identifier.h> | ||
|
||
Identifier::Identifier(KeyType idType, util::string_view id) | ||
: idType(idType) | ||
, id(id.to_string()) | ||
{}; | ||
namespace basyx { | ||
|
||
Identifier::Identifier(util::string_view id) | ||
: idType(KeyType_::from_id(id)) | ||
, id(id.to_string()) | ||
{}; | ||
Identifier &Identifier::operator=(const Identifier &id) noexcept { | ||
std::string::operator=(id); | ||
return *this; | ||
} | ||
|
||
Identifier &Identifier::operator=(const basyx::util::string_view& id) noexcept { | ||
std::string::operator=(id.to_string()); | ||
return *this; | ||
} | ||
|
||
bool Identifier::operator==(const Identifier & other) const | ||
{ | ||
return (this->getIdType() == other.getIdType()) && (this->getId() == other.getId()); | ||
}; | ||
Identifier &Identifier::operator=(const std::string& id) noexcept { | ||
std::string::operator=(id); | ||
return *this; | ||
} | ||
|
||
std::string Identifier::getId() const { | ||
return static_cast<std::string>(*this); | ||
} | ||
|
||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,29 @@ | ||
#pragma once | ||
|
||
#include <basyx/util/optional/optional.hpp> | ||
|
||
#include <basyx/langstringset.h> | ||
|
||
#include <basyx/key.h> | ||
#ifndef IDENTIFIER_H | ||
#define IDENTIFIER_H | ||
|
||
#include <string> | ||
#include <basyx/util/string_view/string_view.hpp> | ||
|
||
namespace basyx | ||
{ | ||
|
||
class Identifier | ||
{ | ||
private: | ||
KeyType idType; | ||
std::string id; | ||
private: | ||
class Identifier: public std::string { | ||
public: | ||
Identifier(KeyType idType, util::string_view id); | ||
Identifier(util::string_view id); | ||
Identifier() = default; | ||
Identifier(const Identifier&) = default; | ||
Identifier(const basyx::util::string_view &v) { | ||
std::string::operator=(v.to_string()); | ||
} | ||
Identifier(Identifier&&) = default; | ||
|
||
Identifier(const Identifier&) = default; | ||
Identifier(Identifier&&) = default; | ||
Identifier& operator=(const Identifier& id) noexcept; | ||
Identifier& operator=(const basyx::util::string_view& id) noexcept; | ||
Identifier& operator=(const std::string& id) noexcept; | ||
//Identifier& operator=(Identifier &) noexcept = default; | ||
|
||
Identifier & operator=(const Identifier&) = default; | ||
Identifier & operator=(Identifier&&) = default; | ||
std::string getId() const; | ||
|
||
~Identifier() = default; | ||
public: | ||
const std::string & getId() const { return id; }; | ||
KeyType getIdType() const { return idType; }; | ||
public: | ||
bool operator==(const Identifier & other) const; | ||
public: | ||
static Identifier Custom(util::string_view id) { return Identifier(KeyType::Custom, id); } | ||
static Identifier IRDI(util::string_view id) { return Identifier(KeyType::IRDI, id); } | ||
static Identifier IRI(util::string_view id) { return Identifier(KeyType::IRI, id); } | ||
~Identifier() = default; | ||
}; | ||
|
||
}; | ||
#endif /* IDENTIFIER_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.