OSSIA
Open Scenario System for Interactive Application
Loading...
Searching...
No Matches
minuit_name_table.hpp
1#pragma once
2#include <ossia/detail/string_view.hpp>
3#include <ossia/network/minuit/detail/minuit_common.hpp>
4
5#include <array>
6#include <string>
7namespace ossia::minuit
8{
9class name_table
10{
11public:
12 void set_device_name(const std::string& name)
13 {
14 m_actions[(int)minuit_action::NamespaceRequest] = name + "?namespace";
15 m_actions[(int)minuit_action::NamespaceReply] = name + ":namespace";
16 m_actions[(int)minuit_action::NamespaceError] = name + "!namespace";
17
18 m_actions[(int)minuit_action::GetRequest] = name + "?get";
19 m_actions[(int)minuit_action::GetReply] = name + ":get";
20 m_actions[(int)minuit_action::GetError] = name + "!get";
21
22 m_actions[(int)minuit_action::ListenRequest] = name + "?listen";
23 m_actions[(int)minuit_action::ListenReply] = name + ":listen";
24 m_actions[(int)minuit_action::ListenError] = name + "!listen";
25 }
26
27 std::string_view get_action(minuit_action c) const
28 {
29 return m_actions[static_cast<int>(c)];
30 }
31
32private:
33 std::array<std::string, 9> m_actions;
34};
35}