blob: f81399c796d7d194d365ffda60f3f5df48faba58 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
#include "generator/composite_id.hpp"
#include <sstream>
#include <tuple>
namespace generator
{
CompositeId::CompositeId(std::string const & str)
{
std::stringstream stream(str);
stream.exceptions(std::ios::failbit);
stream >> m_mainId;
stream >> m_additionalId;
}
CompositeId::CompositeId(base::GeoObjectId mainId, base::GeoObjectId additionalId)
: m_mainId(mainId), m_additionalId(additionalId)
{
}
CompositeId::CompositeId(base::GeoObjectId mainId)
: CompositeId(mainId, base::GeoObjectId() /* additionalId */)
{
}
bool CompositeId::operator<(CompositeId const & other) const
{
return std::tie(m_mainId, m_additionalId) < std::tie(other.m_mainId, other.m_additionalId);
}
bool CompositeId::operator==(CompositeId const & other) const
{
return std::tie(m_mainId, m_additionalId) == std::tie(other.m_mainId, other.m_additionalId);
}
bool CompositeId::operator!=(CompositeId const & other) const
{
return !(*this == other);
}
std::string CompositeId::ToString() const
{
std::stringstream stream;
stream.exceptions(std::ios::failbit);
stream << m_mainId << " " << m_additionalId;
return stream.str();
}
std::string DebugPrint(CompositeId const & id)
{
return DebugPrint(id.m_mainId) + "|" + DebugPrint(id.m_additionalId);
}
} // namespace generator
|