-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBmsDataUnitId.hpp
More file actions
52 lines (45 loc) · 1.8 KB
/
BmsDataUnitId.hpp
File metadata and controls
52 lines (45 loc) · 1.8 KB
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
#pragma once
#ifndef LIBBMS_BMS_DATA_UNIT_ID_HPP_INCLUDED
#define LIBBMS_BMS_DATA_UNIT_ID_HPP_INCLUDED
#include <functional>
#include <string>
#include <tuple>
#include "BmsChannelId.hpp"
#include "BmsException.hpp"
#include "BmsSectionId.hpp"
namespace Bms {
struct BmsDataUnitId {
public:
using SelfType = BmsDataUnitId;
public:
BmsDataUnitId();
BmsDataUnitId(const BmsSectionId §ion, const BmsChannelId &channel);
BmsDataUnitId(const std::pair<BmsSectionId, BmsChannelId> &value);
BmsDataUnitId(const std::string &value) throw(BmsException);
public:
SelfType &operator=(const std::pair<BmsSectionId, BmsChannelId> &value);
SelfType &operator=(const std::string &value) throw(BmsException);
friend bool operator==(const SelfType &lhs, const SelfType &rhs);
friend bool operator!=(const SelfType &lhs, const SelfType &rhs);
friend bool operator<(const SelfType &lhs, const SelfType &rhs);
friend bool operator<=(const SelfType &lhs, const SelfType &rhs);
friend bool operator>(const SelfType &lhs, const SelfType &rhs);
friend bool operator>=(const SelfType &lhs, const SelfType &rhs);
friend std::istream &operator>>(std::istream &in, SelfType &id) throw(BmsException);
friend std::ostream &operator<<(std::ostream &out, const SelfType &id);
public:
BmsSectionId SectionPart() const;
BmsChannelId ChannelPart() const;
std::string StringValue() const;
private:
BmsSectionId Section;
BmsChannelId Channel;
};
}
template <>
struct std::hash<Bms::BmsDataUnitId> {
using argument_type = Bms::BmsDataUnitId;
using result_type = size_t;
size_t operator()(const argument_type &key) const;
};
#endif // !LIBBMS_BMS_DATA_UNIT_ID_HPP_INCLUDED