SkillID.cpp
Go to the documentation of this file.
1 #include "SkillID.h"
2 
3 namespace armarx
4 {
5  namespace skills
6  {
7  bool
8  SkillID::operator==(const SkillID& other) const
9  {
10  return this->toString() == other.toString();
11  }
12 
13  bool
14  SkillID::operator!=(const SkillID& other) const
15  {
16  return not(*this == other);
17  }
18 
19  bool
20  SkillID::operator<(const SkillID& other) const
21  {
22  return toString() < other.toString();
23  }
24 
25  bool
26  SkillID::operator<=(const SkillID& other) const
27  {
28  return toString() <= other.toString();
29  }
30 
31  SkillID
32  SkillID::FromIce(const manager::dto::SkillID& s)
33  {
34  return SkillID{.providerId =
35  skills::ProviderID{.providerName = s.providerId.providerName},
36  .skillName = s.skillName};
37  }
38 
39  SkillID
40  SkillID::FromIce(const provider::dto::SkillID& s,
41  const std::optional<ProviderID>& providerId)
42  {
43  if (providerId.has_value())
44  {
45  return SkillID{.providerId = *providerId, .skillName = s.skillName};
46  }
47  return SkillID{.skillName = s.skillName};
48  }
49 
50  manager::dto::SkillID
52  {
53  ARMARX_CHECK(isFullySpecified()) << "Got: " << toString();
54  return {providerId->toManagerIce(), skillName};
55  }
56 
57  provider::dto::SkillID
59  {
60  return {skillName};
61  }
62 
63  std::string
65  {
66  if (providerId.has_value())
67  {
68  return providerId->providerName + NAME_SEPARATOR + skillName;
69  }
70  return NAME_SEPARATOR + skillName;
71  }
72  } // namespace skills
73 
74  std::ostream&
75  skills::operator<<(std::ostream& os, const SkillID& id)
76  {
77  return os << "'" << id.toString() << "'";
78  }
79 } // namespace armarx
armarx::skills::SkillID::operator!=
bool operator!=(const SkillID &other) const
Definition: SkillID.cpp:14
armarx::skills::SkillID::toString
std::string toString() const
Definition: SkillID.cpp:64
skills
This file is part of ArmarX.
armarx::skills::SkillID::operator==
bool operator==(const SkillID &other) const
Definition: SkillID.cpp:8
SkillID.h
armarx::skills::SkillID::skillName
std::string skillName
Definition: SkillID.h:60
armarx::skills::ProviderID::providerName
std::string providerName
Definition: ProviderID.h:31
armarx::skills::SkillID::providerId
std::optional< ProviderID > providerId
Definition: SkillID.h:59
armarx::skills::SkillID::operator<=
bool operator<=(const SkillID &other) const
Definition: SkillID.cpp:26
armarx::skills::SkillID::toManagerIce
manager::dto::SkillID toManagerIce() const
Definition: SkillID.cpp:51
ARMARX_CHECK
#define ARMARX_CHECK(expression)
Shortcut for ARMARX_CHECK_EXPRESSION.
Definition: ExpressionException.h:82
armarx::skills::operator<<
std::ostream & operator<<(std::ostream &os, const ProviderID &id)
Definition: ProviderID.cpp:63
armarx::skills::ProviderID
Definition: ProviderID.h:15
armarx::skills::SkillID::FromIce
static SkillID FromIce(const manager::dto::SkillID &)
Definition: SkillID.cpp:32
armarx::skills::SkillID::operator<
bool operator<(const SkillID &other) const
Definition: SkillID.cpp:20
armarx::skills::SkillID::toProviderIce
provider::dto::SkillID toProviderIce() const
Definition: SkillID.cpp:58
armarx::skills::SkillID
Definition: SkillID.h:17
armarx::skills::SkillID::isFullySpecified
bool isFullySpecified() const
Definition: SkillID.h:29
armarx::ctrlutil::s
double s(double t, double s0, double v0, double a0, double j)
Definition: CtrlUtil.h:33
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:28
armarx::skills::SkillID::NAME_SEPARATOR
static const constexpr char * NAME_SEPARATOR
Definition: SkillID.h:20