SkillID.cpp
Go to the documentation of this file.
1
#include "
SkillID.h
"
2
3
namespace
armarx
4
{
5
namespace
skills
6
{
7
SkillID::SkillID
(
const
std::string& providerName,
const
std::string& skillName) : providerName(providerName), skillName(skillName)
8
{
9
if
(
simox::alg::contains
(
providerName
,
NAME_SEPARATOR
) ||
simox::alg::contains
(
skillName
,
NAME_SEPARATOR
))
10
{
11
throw
error::SkillException
(__PRETTY_FUNCTION__, std::string(
"A skill provider or a skill contains the blacklisted token '"
) +
NAME_SEPARATOR
+
"'."
);
12
}
13
14
if
(
simox::alg::contains
(
providerName
,
PREFIX_SEPARATOR
) ||
simox::alg::contains
(
skillName
,
PREFIX_SEPARATOR
))
15
{
16
throw
error::SkillException
(__PRETTY_FUNCTION__, std::string(
"A skill provider or a skill contains the blacklisted token '"
) +
PREFIX_SEPARATOR
+
"'."
);
17
}
18
}
19
20
bool
SkillID::operator==
(
const
SkillID
& other)
const
21
{
22
return
toString
() == other.
toString
();
23
}
24
25
bool
SkillID::operator<
(
const
SkillID
& other)
const
26
{
27
return
toString
() < other.
toString
();
28
}
29
30
provider::dto::SkillID
SkillID::toIce
()
const
31
{
32
return
{
providerName
,
skillName
};
33
}
34
35
std::string
SkillID::toString
(
const
std::string& prefix)
const
36
{
37
return
(prefix.empty() ? std::string(
""
) : (prefix +
PREFIX_SEPARATOR
)) +
providerName
+
NAME_SEPARATOR
+
skillName
;
38
}
39
}
40
41
std::ostream&
skills::operator<<
(std::ostream& os,
const
SkillID
&
id
)
42
{
43
return
os <<
"'"
<<
id
.toString() <<
"'"
;
44
}
45
}
armarx::skills::SkillID::toIce
provider::dto::SkillID toIce() const
Definition:
SkillID.cpp:30
armarx::skills::operator<<
std::ostream & operator<<(std::ostream &os, const SkillID &id)
Definition:
SkillID.cpp:41
armarx::skills::SkillID::toString
std::string toString(const std::string &prefix="") const
Definition:
SkillID.cpp:35
armarx::skills::SkillID::providerName
std::string providerName
Definition:
SkillID.h:23
skills
This file is part of ArmarX.
armarx::skills::SkillID::operator==
bool operator==(const SkillID &other) const
Definition:
SkillID.cpp:20
SkillID.h
armarx::skills::SkillID::skillName
std::string skillName
Definition:
SkillID.h:24
armarx::skills::SkillID::SkillID
SkillID()=delete
armarx::armem::contains
bool contains(const MemoryID &general, const MemoryID &specific)
Indicates whether general is "less specific" than, or equal to, specific, i.e.
Definition:
MemoryID.cpp:459
armarx::skills::SkillID::PREFIX_SEPARATOR
static const constexpr char * PREFIX_SEPARATOR
Definition:
SkillID.h:20
armarx::skills::error::SkillException
A base class for aron exceptions.
Definition:
Exception.h:41
armarx::skills::SkillID::operator<
bool operator<(const SkillID &other) const
Definition:
SkillID.cpp:25
armarx::skills::SkillID
Definition:
SkillID.h:17
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:21
RobotAPI
libraries
skills
provider
SkillID.cpp
Generated on Fri Sep 29 2023 06:18:26 for armarx_documentation by
1.8.17