Zao SDK for Jetson / libzao-endpoint API リファレンス 1.2.0.0 (2023-10-30)
Loading...
Searching...
No Matches
LineState.hpp
1#ifndef ZAO_ENDPOINT_MONITOR_LINE_STATE_HPP_
2#define ZAO_ENDPOINT_MONITOR_LINE_STATE_HPP_
3
4#include <vector>
5
6namespace zao {
7namespace endpoint {
8namespace monitor {
9
14 public:
19 LineStateEntry() noexcept {}
20
27 LineStateEntry(std::uint8_t number, bool is_active) noexcept {
28 SetNumber(number);
29 SetActive(is_active);
30 }
31
35 std::uint8_t GetNumber() const noexcept { return number_; }
36
42 void SetNumber(std::uint8_t number) noexcept { number_ = number; }
43
47 bool GetActive() const noexcept { return active_; }
48
54 void SetActive(bool active) noexcept { active_ = active; }
55
56 private:
60 std::uint8_t number_ = 0;
61
65 bool active_ = false;
66};
67
71class LineState {
72 public:
76 LineState() noexcept {}
77
82 void SetActiveCount(std::uint8_t active_count) noexcept {
83 active_count_ = active_count;
84 }
85
90 std::uint8_t GetActiveCount() const noexcept { return (active_count_); }
91
97 void SetLineState(const LineStateEntry& line_state) noexcept {
98 line_state_.push_back(line_state);
99 }
100
104 std::vector<LineStateEntry> GetLineState() const noexcept {
105 return line_state_;
106 }
107
112 std::uint8_t GetMaxCount() const noexcept {
113 return (static_cast<std::uint8_t>(line_state_.size()));
114 }
115
121 bool IsActive(int number) const noexcept {
122 for (const auto line_state : line_state_) {
123 if (line_state.GetNumber() == number) {
124 return line_state.GetActive();
125 }
126 }
127 return false;
128 }
129
130 private:
134 std::uint8_t active_count_ = 0;
135
139 std::vector<LineStateEntry> line_state_;
140};
141
142} // namespace monitor
143} // namespace endpoint
144} // namespace zao
145
146#endif // ZAO_ENDPOINT_MONITOR_LINE_STATE_HPP_
Line 状態を表すクラス.
Definition LineState.hpp:71
void SetLineState(const LineStateEntry &line_state) noexcept
LineStateEntry 構造体を動的配列に追加する.
Definition LineState.hpp:97
std::uint8_t GetActiveCount() const noexcept
Active Line 数を取得する.
Definition LineState.hpp:90
bool IsActive(int number) const noexcept
指定した回線がアクティブか否かを取得する.
Definition LineState.hpp:121
LineState() noexcept
LineState オブジェクトをデフォルト構築する.
Definition LineState.hpp:76
std::vector< LineStateEntry > GetLineState() const noexcept
LineStateEntry 構造体の動的配列を取得する.
Definition LineState.hpp:104
void SetActiveCount(std::uint8_t active_count) noexcept
Active Line 数を設定する.
Definition LineState.hpp:82
std::uint8_t GetMaxCount() const noexcept
最大 Line 数を取得する.
Definition LineState.hpp:112
Zao製品共通の名前空間
Definition FactoryInterface.hpp:11
RASCOW2 Line ステータス情報のフォーマット
Definition LineState.hpp:13
std::uint8_t GetNumber() const noexcept
Line 番号を取得する.
Definition LineState.hpp:35
void SetActive(bool active) noexcept
Line の Active 状態を設定する.
Definition LineState.hpp:54
LineStateEntry(std::uint8_t number, bool is_active) noexcept
LineStateEntry オブジェクトを初期値付きで構築する.
Definition LineState.hpp:27
void SetNumber(std::uint8_t number) noexcept
Line 番号を設定する.
Definition LineState.hpp:42
LineStateEntry() noexcept
LineStateEntry オブジェクトをデフォルト構築する.
Definition LineState.hpp:19
bool GetActive() const noexcept
Active 状態を取得する.
Definition LineState.hpp:47