OSSIA
Open Scenario System for Interactive Application
misc_visitors.hpp
1 #pragma once
3 #include <ossia/network/value/value.hpp>
4 namespace ossia
5 {
6 template <typename Functor>
7 auto apply(
8  Functor&& functor, const value_variant_type& arg0, const behavior_variant_type& arg1)
9 {
10  switch(arg0.m_type)
11  {
12  case value_variant_type::Type::Type0: {
13  switch(arg1.m_type)
14  {
15  case behavior_variant_type::Type::Type0: {
16  return functor(arg0.m_impl.m_value0, arg1.m_impl.m_value0);
17  }
18  case behavior_variant_type::Type::Type1: {
19  return functor(arg0.m_impl.m_value0, arg1.m_impl.m_value1);
20  }
21  default:
22  throw std::runtime_error("misc_visitors: bad type");
23  }
24  }
25  case value_variant_type::Type::Type1: {
26  switch(arg1.m_type)
27  {
28  case behavior_variant_type::Type::Type0: {
29  return functor(arg0.m_impl.m_value1, arg1.m_impl.m_value0);
30  }
31  case behavior_variant_type::Type::Type1: {
32  return functor(arg0.m_impl.m_value1, arg1.m_impl.m_value1);
33  }
34  default:
35  throw std::runtime_error("misc_visitors: bad type");
36  }
37  }
38  case value_variant_type::Type::Type2: {
39  switch(arg1.m_type)
40  {
41  case behavior_variant_type::Type::Type0: {
42  return functor(arg0.m_impl.m_value2, arg1.m_impl.m_value0);
43  }
44  case behavior_variant_type::Type::Type1: {
45  return functor(arg0.m_impl.m_value2, arg1.m_impl.m_value1);
46  }
47  default:
48  throw std::runtime_error("misc_visitors: bad type");
49  }
50  }
51  case value_variant_type::Type::Type3: {
52  switch(arg1.m_type)
53  {
54  case behavior_variant_type::Type::Type0: {
55  return functor(arg0.m_impl.m_value3, arg1.m_impl.m_value0);
56  }
57  case behavior_variant_type::Type::Type1: {
58  return functor(arg0.m_impl.m_value3, arg1.m_impl.m_value1);
59  }
60  default:
61  throw std::runtime_error("misc_visitors: bad type");
62  }
63  }
64  case value_variant_type::Type::Type4: {
65  switch(arg1.m_type)
66  {
67  case behavior_variant_type::Type::Type0: {
68  return functor(arg0.m_impl.m_value4, arg1.m_impl.m_value0);
69  }
70  case behavior_variant_type::Type::Type1: {
71  return functor(arg0.m_impl.m_value4, arg1.m_impl.m_value1);
72  }
73  default:
74  throw std::runtime_error("misc_visitors: bad type");
75  }
76  }
77  case value_variant_type::Type::Type5: {
78  switch(arg1.m_type)
79  {
80  case behavior_variant_type::Type::Type0: {
81  return functor(arg0.m_impl.m_value5, arg1.m_impl.m_value0);
82  }
83  case behavior_variant_type::Type::Type1: {
84  return functor(arg0.m_impl.m_value5, arg1.m_impl.m_value1);
85  }
86  default:
87  throw std::runtime_error("misc_visitors: bad type");
88  }
89  }
90  case value_variant_type::Type::Type6: {
91  switch(arg1.m_type)
92  {
93  case behavior_variant_type::Type::Type0: {
94  return functor(arg0.m_impl.m_value6, arg1.m_impl.m_value0);
95  }
96  case behavior_variant_type::Type::Type1: {
97  return functor(arg0.m_impl.m_value6, arg1.m_impl.m_value1);
98  }
99  default:
100  throw std::runtime_error("misc_visitors: bad type");
101  }
102  }
103  case value_variant_type::Type::Type7: {
104  switch(arg1.m_type)
105  {
106  case behavior_variant_type::Type::Type0: {
107  return functor(arg0.m_impl.m_value7, arg1.m_impl.m_value0);
108  }
109  case behavior_variant_type::Type::Type1: {
110  return functor(arg0.m_impl.m_value7, arg1.m_impl.m_value1);
111  }
112  default:
113  throw std::runtime_error("misc_visitors: bad type");
114  }
115  }
116  case value_variant_type::Type::Type8: {
117  switch(arg1.m_type)
118  {
119  case behavior_variant_type::Type::Type0: {
120  return functor(arg0.m_impl.m_value8, arg1.m_impl.m_value0);
121  }
122  case behavior_variant_type::Type::Type1: {
123  return functor(arg0.m_impl.m_value8, arg1.m_impl.m_value1);
124  }
125  default:
126  throw std::runtime_error("misc_visitors: bad type");
127  }
128  }
129  case value_variant_type::Type::Type9: {
130  switch(arg1.m_type)
131  {
132  case behavior_variant_type::Type::Type0: {
133  return functor(arg0.m_impl.m_value9, arg1.m_impl.m_value0);
134  }
135  case behavior_variant_type::Type::Type1: {
136  return functor(arg0.m_impl.m_value9, arg1.m_impl.m_value1);
137  }
138  default:
139  throw std::runtime_error("misc_visitors: bad type");
140  }
141  }
142  default:
143  throw std::runtime_error("misc_visitors: bad type");
144  }
145 }
146 }
Definition: git_info.h:7