Woman, Life, Freedom


Adaptive AUTOSAR
ARA public interface header documentation
instance_specifier.h
1#ifndef INSTANCE_SPECIFIER_H
2#define INSTANCE_SPECIFIER_H
3
4#include <string>
5#include <vector>
6#include "./result.h"
7
8namespace ara
9{
10 namespace core
11 {
14 {
15 private:
16 std::string mMetaModelIdentifier;
17
18 public:
21 explicit InstanceSpecifier(std::string metaModelIdentifier);
22
24 InstanceSpecifier(InstanceSpecifier &&other) noexcept;
25
26 InstanceSpecifier &operator=(const InstanceSpecifier &other);
27 InstanceSpecifier &operator=(InstanceSpecifier &&other);
28
29 InstanceSpecifier() = delete;
30 ~InstanceSpecifier() noexcept = default;
31
35 static Result<InstanceSpecifier> Create(std::string metaModelIdentifier);
36
37 inline bool operator==(const InstanceSpecifier &other) const noexcept
38 {
39 return mMetaModelIdentifier == other.mMetaModelIdentifier;
40 }
41
42 inline bool operator==(std::string other) const noexcept
43 {
44 return mMetaModelIdentifier == other;
45 }
46
47 inline bool operator!=(const InstanceSpecifier &other) const noexcept
48 {
49 return mMetaModelIdentifier != other.mMetaModelIdentifier;
50 }
51
52 inline bool operator!=(std::string other) const noexcept
53 {
54 return mMetaModelIdentifier != other;
55 }
56
57 inline bool operator<(const InstanceSpecifier &other) const noexcept
58 {
59 return mMetaModelIdentifier < other.mMetaModelIdentifier;
60 }
61
62 inline bool operator>(const InstanceSpecifier &other) const noexcept
63 {
64 return mMetaModelIdentifier > other.mMetaModelIdentifier;
65 }
66
69 std::string ToString() const noexcept;
70
74 void Serialize(std::vector<uint8_t> &serializedObject) const;
75 };
76
77 inline bool operator==(std::string lhs, const InstanceSpecifier &rhs) noexcept
78 {
79 return lhs == rhs.ToString();
80 }
81
82 inline bool operator!=(std::string lhs, const InstanceSpecifier &rhs) noexcept
83 {
84 return lhs != rhs.ToString();
85 }
86 }
87}
88
89#endif
AUTOSAR shortname-path wrapper.
Definition: instance_specifier.h:14
std::string ToString() const noexcept
Convert the instance to a string.
Definition: instance_specifier.cpp:35
void Serialize(std::vector< uint8_t > &serializedObject) const
Serialized the object.
Definition: instance_specifier.cpp:40
static Result< InstanceSpecifier > Create(std::string metaModelIdentifier)
InstanceSpecifier factory.
Definition: instance_specifier.cpp:69
A wrapper around the callee's return value and its possible error.
Definition: result.h:16