COMMS
Template library intended to help with implementation of communication protocols.
Loading...
Searching...
No Matches
gen_enum.h
1//
2// Copyright 2016 - 2024 (C). Alex Robenko. All rights reserved.
3//
4// This Source Code Form is subject to the terms of the Mozilla Public
5// License, v. 2.0. If a copy of the MPL was not distributed with this
6// file, You can obtain one at http://mozilla.org/MPL/2.0/.
7
8#pragma once
9
10#include <limits>
11
12#include "macro_common.h"
13
14#define COMMS_WRAP_ENUM(p_, v_) COMMS_CONCATENATE(p_, v_)
15
16#define COMMS_ENUM_VAL_0(...)
17#define COMMS_ENUM_VAL_1(p_, v_) COMMS_WRAP_ENUM(p_, v_)
18#define COMMS_ENUM_VAL_2(p_, v_, ...) COMMS_WRAP_ENUM(p_, v_), COMMS_EXPAND(COMMS_ENUM_VAL_1(p_, __VA_ARGS__))
19#define COMMS_ENUM_VAL_3(p_, v_, ...) COMMS_WRAP_ENUM(p_, v_), COMMS_EXPAND(COMMS_ENUM_VAL_2(p_, __VA_ARGS__))
20#define COMMS_ENUM_VAL_4(p_, v_, ...) COMMS_WRAP_ENUM(p_, v_), COMMS_EXPAND(COMMS_ENUM_VAL_3(p_, __VA_ARGS__))
21#define COMMS_ENUM_VAL_5(p_, v_, ...) COMMS_WRAP_ENUM(p_, v_), COMMS_EXPAND(COMMS_ENUM_VAL_4(p_, __VA_ARGS__))
22#define COMMS_ENUM_VAL_6(p_, v_, ...) COMMS_WRAP_ENUM(p_, v_), COMMS_EXPAND(COMMS_ENUM_VAL_5(p_, __VA_ARGS__))
23#define COMMS_ENUM_VAL_7(p_, v_, ...) COMMS_WRAP_ENUM(p_, v_), COMMS_EXPAND(COMMS_ENUM_VAL_6(p_, __VA_ARGS__))
24#define COMMS_ENUM_VAL_8(p_, v_, ...) COMMS_WRAP_ENUM(p_, v_), COMMS_EXPAND(COMMS_ENUM_VAL_7(p_, __VA_ARGS__))
25#define COMMS_ENUM_VAL_9(p_, v_, ...) COMMS_WRAP_ENUM(p_, v_), COMMS_EXPAND(COMMS_ENUM_VAL_8(p_, __VA_ARGS__))
26#define COMMS_ENUM_VAL_10(p_, v_, ...) COMMS_WRAP_ENUM(p_, v_), COMMS_EXPAND(COMMS_ENUM_VAL_9(p_, __VA_ARGS__))
27#define COMMS_ENUM_VAL_11(p_, v_, ...) COMMS_WRAP_ENUM(p_, v_), COMMS_EXPAND(COMMS_ENUM_VAL_10(p_, __VA_ARGS__))
28#define COMMS_ENUM_VAL_12(p_, v_, ...) COMMS_WRAP_ENUM(p_, v_), COMMS_EXPAND(COMMS_ENUM_VAL_11(p_, __VA_ARGS__))
29#define COMMS_ENUM_VAL_13(p_, v_, ...) COMMS_WRAP_ENUM(p_, v_), COMMS_EXPAND(COMMS_ENUM_VAL_12(p_, __VA_ARGS__))
30#define COMMS_ENUM_VAL_14(p_, v_, ...) COMMS_WRAP_ENUM(p_, v_), COMMS_EXPAND(COMMS_ENUM_VAL_13(p_, __VA_ARGS__))
31#define COMMS_ENUM_VAL_15(p_, v_, ...) COMMS_WRAP_ENUM(p_, v_), COMMS_EXPAND(COMMS_ENUM_VAL_14(p_, __VA_ARGS__))
32#define COMMS_ENUM_VAL_16(p_, v_, ...) COMMS_WRAP_ENUM(p_, v_), COMMS_EXPAND(COMMS_ENUM_VAL_15(p_, __VA_ARGS__))
33#define COMMS_ENUM_VAL_17(p_, v_, ...) COMMS_WRAP_ENUM(p_, v_), COMMS_EXPAND(COMMS_ENUM_VAL_16(p_, __VA_ARGS__))
34#define COMMS_ENUM_VAL_18(p_, v_, ...) COMMS_WRAP_ENUM(p_, v_), COMMS_EXPAND(COMMS_ENUM_VAL_17(p_, __VA_ARGS__))
35#define COMMS_ENUM_VAL_19(p_, v_, ...) COMMS_WRAP_ENUM(p_, v_), COMMS_EXPAND(COMMS_ENUM_VAL_18(p_, __VA_ARGS__))
36#define COMMS_ENUM_VAL_20(p_, v_, ...) COMMS_WRAP_ENUM(p_, v_), COMMS_EXPAND(COMMS_ENUM_VAL_19(p_, __VA_ARGS__))
37#define COMMS_ENUM_VAL_21(p_, v_, ...) COMMS_WRAP_ENUM(p_, v_), COMMS_EXPAND(COMMS_ENUM_VAL_20(p_, __VA_ARGS__))
38#define COMMS_ENUM_VAL_22(p_, v_, ...) COMMS_WRAP_ENUM(p_, v_), COMMS_EXPAND(COMMS_ENUM_VAL_21(p_, __VA_ARGS__))
39#define COMMS_ENUM_VAL_23(p_, v_, ...) COMMS_WRAP_ENUM(p_, v_), COMMS_EXPAND(COMMS_ENUM_VAL_22(p_, __VA_ARGS__))
40#define COMMS_ENUM_VAL_24(p_, v_, ...) COMMS_WRAP_ENUM(p_, v_), COMMS_EXPAND(COMMS_ENUM_VAL_23(p_, __VA_ARGS__))
41#define COMMS_ENUM_VAL_25(p_, v_, ...) COMMS_WRAP_ENUM(p_, v_), COMMS_EXPAND(COMMS_ENUM_VAL_24(p_, __VA_ARGS__))
42#define COMMS_ENUM_VAL_26(p_, v_, ...) COMMS_WRAP_ENUM(p_, v_), COMMS_EXPAND(COMMS_ENUM_VAL_25(p_, __VA_ARGS__))
43#define COMMS_ENUM_VAL_27(p_, v_, ...) COMMS_WRAP_ENUM(p_, v_), COMMS_EXPAND(COMMS_ENUM_VAL_26(p_, __VA_ARGS__))
44#define COMMS_ENUM_VAL_28(p_, v_, ...) COMMS_WRAP_ENUM(p_, v_), COMMS_EXPAND(COMMS_ENUM_VAL_27(p_, __VA_ARGS__))
45#define COMMS_ENUM_VAL_29(p_, v_, ...) COMMS_WRAP_ENUM(p_, v_), COMMS_EXPAND(COMMS_ENUM_VAL_28(p_, __VA_ARGS__))
46#define COMMS_ENUM_VAL_30(p_, v_, ...) COMMS_WRAP_ENUM(p_, v_), COMMS_EXPAND(COMMS_ENUM_VAL_29(p_, __VA_ARGS__))
47#define COMMS_ENUM_VAL_31(p_, v_, ...) COMMS_WRAP_ENUM(p_, v_), COMMS_EXPAND(COMMS_ENUM_VAL_30(p_, __VA_ARGS__))
48#define COMMS_ENUM_VAL_32(p_, v_, ...) COMMS_WRAP_ENUM(p_, v_), COMMS_EXPAND(COMMS_ENUM_VAL_31(p_, __VA_ARGS__))
49#define COMMS_ENUM_VAL_33(p_, v_, ...) COMMS_WRAP_ENUM(p_, v_), COMMS_EXPAND(COMMS_ENUM_VAL_32(p_, __VA_ARGS__))
50#define COMMS_ENUM_VAL_34(p_, v_, ...) COMMS_WRAP_ENUM(p_, v_), COMMS_EXPAND(COMMS_ENUM_VAL_33(p_, __VA_ARGS__))
51#define COMMS_ENUM_VAL_35(p_, v_, ...) COMMS_WRAP_ENUM(p_, v_), COMMS_EXPAND(COMMS_ENUM_VAL_34(p_, __VA_ARGS__))
52#define COMMS_ENUM_VAL_36(p_, v_, ...) COMMS_WRAP_ENUM(p_, v_), COMMS_EXPAND(COMMS_ENUM_VAL_35(p_, __VA_ARGS__))
53#define COMMS_ENUM_VAL_37(p_, v_, ...) COMMS_WRAP_ENUM(p_, v_), COMMS_EXPAND(COMMS_ENUM_VAL_36(p_, __VA_ARGS__))
54#define COMMS_ENUM_VAL_38(p_, v_, ...) COMMS_WRAP_ENUM(p_, v_), COMMS_EXPAND(COMMS_ENUM_VAL_37(p_, __VA_ARGS__))
55#define COMMS_ENUM_VAL_39(p_, v_, ...) COMMS_WRAP_ENUM(p_, v_), COMMS_EXPAND(COMMS_ENUM_VAL_38(p_, __VA_ARGS__))
56#define COMMS_ENUM_VAL_40(p_, v_, ...) COMMS_WRAP_ENUM(p_, v_), COMMS_EXPAND(COMMS_ENUM_VAL_39(p_, __VA_ARGS__))
57#define COMMS_ENUM_VAL_41(p_, v_, ...) COMMS_WRAP_ENUM(p_, v_), COMMS_EXPAND(COMMS_ENUM_VAL_40(p_, __VA_ARGS__))
58#define COMMS_ENUM_VAL_42(p_, v_, ...) COMMS_WRAP_ENUM(p_, v_), COMMS_EXPAND(COMMS_ENUM_VAL_41(p_, __VA_ARGS__))
59#define COMMS_ENUM_VAL_43(p_, v_, ...) COMMS_WRAP_ENUM(p_, v_), COMMS_EXPAND(COMMS_ENUM_VAL_42(p_, __VA_ARGS__))
60#define COMMS_ENUM_VAL_44(p_, v_, ...) COMMS_WRAP_ENUM(p_, v_), COMMS_EXPAND(COMMS_ENUM_VAL_43(p_, __VA_ARGS__))
61#define COMMS_ENUM_VAL_45(p_, v_, ...) COMMS_WRAP_ENUM(p_, v_), COMMS_EXPAND(COMMS_ENUM_VAL_44(p_, __VA_ARGS__))
62#define COMMS_ENUM_VAL_46(p_, v_, ...) COMMS_WRAP_ENUM(p_, v_), COMMS_EXPAND(COMMS_ENUM_VAL_45(p_, __VA_ARGS__))
63#define COMMS_ENUM_VAL_47(p_, v_, ...) COMMS_WRAP_ENUM(p_, v_), COMMS_EXPAND(COMMS_ENUM_VAL_46(p_, __VA_ARGS__))
64#define COMMS_ENUM_VAL_48(p_, v_, ...) COMMS_WRAP_ENUM(p_, v_), COMMS_EXPAND(COMMS_ENUM_VAL_47(p_, __VA_ARGS__))
65#define COMMS_ENUM_VAL_49(p_, v_, ...) COMMS_WRAP_ENUM(p_, v_), COMMS_EXPAND(COMMS_ENUM_VAL_48(p_, __VA_ARGS__))
66#define COMMS_ENUM_VAL_50(p_, v_, ...) COMMS_WRAP_ENUM(p_, v_), COMMS_EXPAND(COMMS_ENUM_VAL_49(p_, __VA_ARGS__))
67#define COMMS_ENUM_VAL_51(p_, v_, ...) COMMS_WRAP_ENUM(p_, v_), COMMS_EXPAND(COMMS_ENUM_VAL_50(p_, __VA_ARGS__))
68#define COMMS_ENUM_VAL_52(p_, v_, ...) COMMS_WRAP_ENUM(p_, v_), COMMS_EXPAND(COMMS_ENUM_VAL_51(p_, __VA_ARGS__))
69#define COMMS_ENUM_VAL_53(p_, v_, ...) COMMS_WRAP_ENUM(p_, v_), COMMS_EXPAND(COMMS_ENUM_VAL_52(p_, __VA_ARGS__))
70#define COMMS_ENUM_VAL_54(p_, v_, ...) COMMS_WRAP_ENUM(p_, v_), COMMS_EXPAND(COMMS_ENUM_VAL_53(p_, __VA_ARGS__))
71#define COMMS_ENUM_VAL_55(p_, v_, ...) COMMS_WRAP_ENUM(p_, v_), COMMS_EXPAND(COMMS_ENUM_VAL_54(p_, __VA_ARGS__))
72#define COMMS_ENUM_VAL_56(p_, v_, ...) COMMS_WRAP_ENUM(p_, v_), COMMS_EXPAND(COMMS_ENUM_VAL_55(p_, __VA_ARGS__))
73#define COMMS_ENUM_VAL_57(p_, v_, ...) COMMS_WRAP_ENUM(p_, v_), COMMS_EXPAND(COMMS_ENUM_VAL_56(p_, __VA_ARGS__))
74#define COMMS_ENUM_VAL_58(p_, v_, ...) COMMS_WRAP_ENUM(p_, v_), COMMS_EXPAND(COMMS_ENUM_VAL_57(p_, __VA_ARGS__))
75#define COMMS_ENUM_VAL_59(p_, v_, ...) COMMS_WRAP_ENUM(p_, v_), COMMS_EXPAND(COMMS_ENUM_VAL_58(p_, __VA_ARGS__))
76#define COMMS_ENUM_VAL_60(p_, v_, ...) COMMS_WRAP_ENUM(p_, v_), COMMS_EXPAND(COMMS_ENUM_VAL_59(p_, __VA_ARGS__))
77#define COMMS_ENUM_VAL_61(p_, v_, ...) COMMS_WRAP_ENUM(p_, v_), COMMS_EXPAND(COMMS_ENUM_VAL_60(p_, __VA_ARGS__))
78#define COMMS_ENUM_VAL_62(p_, v_, ...) COMMS_WRAP_ENUM(p_, v_), COMMS_EXPAND(COMMS_ENUM_VAL_61(p_, __VA_ARGS__))
79#define COMMS_ENUM_VAL_63(p_, v_, ...) COMMS_WRAP_ENUM(p_, v_), COMMS_EXPAND(COMMS_ENUM_VAL_62(p_, __VA_ARGS__))
80#define COMMS_ENUM_VAL_64(p_, v_, ...) COMMS_WRAP_ENUM(p_, v_), COMMS_EXPAND(COMMS_ENUM_VAL_63(p_, __VA_ARGS__))
81#define COMMS_ENUM_VAL_65(p_, v_, ...) COMMS_WRAP_ENUM(p_, v_), COMMS_EXPAND(COMMS_ENUM_VAL_64(p_, __VA_ARGS__))
82#define COMMS_ENUM_VAL_66(p_, v_, ...) COMMS_WRAP_ENUM(p_, v_), COMMS_EXPAND(COMMS_ENUM_VAL_65(p_, __VA_ARGS__))
83#define COMMS_ENUM_VAL_67(p_, v_, ...) COMMS_WRAP_ENUM(p_, v_), COMMS_EXPAND(COMMS_ENUM_VAL_66(p_, __VA_ARGS__))
84#define COMMS_ENUM_VAL_68(p_, v_, ...) COMMS_WRAP_ENUM(p_, v_), COMMS_EXPAND(COMMS_ENUM_VAL_67(p_, __VA_ARGS__))
85#define COMMS_ENUM_VAL_69(p_, v_, ...) COMMS_WRAP_ENUM(p_, v_), COMMS_EXPAND(COMMS_ENUM_VAL_68(p_, __VA_ARGS__))
86#define COMMS_ENUM_VAL_70(p_, v_, ...) COMMS_WRAP_ENUM(p_, v_), COMMS_EXPAND(COMMS_ENUM_VAL_69(p_, __VA_ARGS__))
87#define COMMS_ENUM_VAL_71(p_, v_, ...) COMMS_WRAP_ENUM(p_, v_), COMMS_EXPAND(COMMS_ENUM_VAL_70(p_, __VA_ARGS__))
88#define COMMS_ENUM_VAL_72(p_, v_, ...) COMMS_WRAP_ENUM(p_, v_), COMMS_EXPAND(COMMS_ENUM_VAL_71(p_, __VA_ARGS__))
89#define COMMS_ENUM_VAL_73(p_, v_, ...) COMMS_WRAP_ENUM(p_, v_), COMMS_EXPAND(COMMS_ENUM_VAL_72(p_, __VA_ARGS__))
90#define COMMS_ENUM_VAL_74(p_, v_, ...) COMMS_WRAP_ENUM(p_, v_), COMMS_EXPAND(COMMS_ENUM_VAL_73(p_, __VA_ARGS__))
91#define COMMS_ENUM_VAL_75(p_, v_, ...) COMMS_WRAP_ENUM(p_, v_), COMMS_EXPAND(COMMS_ENUM_VAL_74(p_, __VA_ARGS__))
92#define COMMS_ENUM_VAL_76(p_, v_, ...) COMMS_WRAP_ENUM(p_, v_), COMMS_EXPAND(COMMS_ENUM_VAL_75(p_, __VA_ARGS__))
93#define COMMS_ENUM_VAL_77(p_, v_, ...) COMMS_WRAP_ENUM(p_, v_), COMMS_EXPAND(COMMS_ENUM_VAL_76(p_, __VA_ARGS__))
94#define COMMS_ENUM_VAL_78(p_, v_, ...) COMMS_WRAP_ENUM(p_, v_), COMMS_EXPAND(COMMS_ENUM_VAL_77(p_, __VA_ARGS__))
95#define COMMS_ENUM_VAL_79(p_, v_, ...) COMMS_WRAP_ENUM(p_, v_), COMMS_EXPAND(COMMS_ENUM_VAL_78(p_, __VA_ARGS__))
96#define COMMS_ENUM_VAL_80(p_, v_, ...) COMMS_WRAP_ENUM(p_, v_), COMMS_EXPAND(COMMS_ENUM_VAL_79(p_, __VA_ARGS__))
97#define COMMS_ENUM_VAL_81(p_, v_, ...) COMMS_WRAP_ENUM(p_, v_), COMMS_EXPAND(COMMS_ENUM_VAL_80(p_, __VA_ARGS__))
98#define COMMS_ENUM_VAL_82(p_, v_, ...) COMMS_WRAP_ENUM(p_, v_), COMMS_EXPAND(COMMS_ENUM_VAL_81(p_, __VA_ARGS__))
99#define COMMS_ENUM_VAL_83(p_, v_, ...) COMMS_WRAP_ENUM(p_, v_), COMMS_EXPAND(COMMS_ENUM_VAL_82(p_, __VA_ARGS__))
100#define COMMS_ENUM_VAL_84(p_, v_, ...) COMMS_WRAP_ENUM(p_, v_), COMMS_EXPAND(COMMS_ENUM_VAL_83(p_, __VA_ARGS__))
101#define COMMS_ENUM_VAL_85(p_, v_, ...) COMMS_WRAP_ENUM(p_, v_), COMMS_EXPAND(COMMS_ENUM_VAL_84(p_, __VA_ARGS__))
102#define COMMS_ENUM_VAL_86(p_, v_, ...) COMMS_WRAP_ENUM(p_, v_), COMMS_EXPAND(COMMS_ENUM_VAL_85(p_, __VA_ARGS__))
103#define COMMS_ENUM_VAL_87(p_, v_, ...) COMMS_WRAP_ENUM(p_, v_), COMMS_EXPAND(COMMS_ENUM_VAL_86(p_, __VA_ARGS__))
104#define COMMS_ENUM_VAL_88(p_, v_, ...) COMMS_WRAP_ENUM(p_, v_), COMMS_EXPAND(COMMS_ENUM_VAL_87(p_, __VA_ARGS__))
105#define COMMS_ENUM_VAL_89(p_, v_, ...) COMMS_WRAP_ENUM(p_, v_), COMMS_EXPAND(COMMS_ENUM_VAL_88(p_, __VA_ARGS__))
106#define COMMS_ENUM_VAL_90(p_, v_, ...) COMMS_WRAP_ENUM(p_, v_), COMMS_EXPAND(COMMS_ENUM_VAL_89(p_, __VA_ARGS__))
107#define COMMS_ENUM_VAL_91(p_, v_, ...) COMMS_WRAP_ENUM(p_, v_), COMMS_EXPAND(COMMS_ENUM_VAL_90(p_, __VA_ARGS__))
108#define COMMS_ENUM_VAL_92(p_, v_, ...) COMMS_WRAP_ENUM(p_, v_), COMMS_EXPAND(COMMS_ENUM_VAL_91(p_, __VA_ARGS__))
109#define COMMS_ENUM_VAL_93(p_, v_, ...) COMMS_WRAP_ENUM(p_, v_), COMMS_EXPAND(COMMS_ENUM_VAL_92(p_, __VA_ARGS__))
110#define COMMS_ENUM_VAL_94(p_, v_, ...) COMMS_WRAP_ENUM(p_, v_), COMMS_EXPAND(COMMS_ENUM_VAL_93(p_, __VA_ARGS__))
111#define COMMS_ENUM_VAL_95(p_, v_, ...) COMMS_WRAP_ENUM(p_, v_), COMMS_EXPAND(COMMS_ENUM_VAL_94(p_, __VA_ARGS__))
112#define COMMS_ENUM_VAL_96(p_, v_, ...) COMMS_WRAP_ENUM(p_, v_), COMMS_EXPAND(COMMS_ENUM_VAL_95(p_, __VA_ARGS__))
113#define COMMS_ENUM_VAL_97(p_, v_, ...) COMMS_WRAP_ENUM(p_, v_), COMMS_EXPAND(COMMS_ENUM_VAL_96(p_, __VA_ARGS__))
114#define COMMS_ENUM_VAL_98(p_, v_, ...) COMMS_WRAP_ENUM(p_, v_), COMMS_EXPAND(COMMS_ENUM_VAL_97(p_, __VA_ARGS__))
115#define COMMS_ENUM_VAL_99(p_, v_, ...) COMMS_WRAP_ENUM(p_, v_), COMMS_EXPAND(COMMS_ENUM_VAL_98(p_, __VA_ARGS__))
116#define COMMS_ENUM_VAL_100(p_, v_, ...) COMMS_WRAP_ENUM(p_, v_), COMMS_EXPAND(COMMS_ENUM_VAL_99(p_, __VA_ARGS__))
117#define COMMS_ENUM_VAL_101(p_, v_, ...) COMMS_WRAP_ENUM(p_, v_), COMMS_EXPAND(COMMS_ENUM_VAL_100(p_, __VA_ARGS__))
118#define COMMS_ENUM_VAL_102(p_, v_, ...) COMMS_WRAP_ENUM(p_, v_), COMMS_EXPAND(COMMS_ENUM_VAL_101(p_, __VA_ARGS__))
119#define COMMS_ENUM_VAL_103(p_, v_, ...) COMMS_WRAP_ENUM(p_, v_), COMMS_EXPAND(COMMS_ENUM_VAL_102(p_, __VA_ARGS__))
120#define COMMS_ENUM_VAL_104(p_, v_, ...) COMMS_WRAP_ENUM(p_, v_), COMMS_EXPAND(COMMS_ENUM_VAL_103(p_, __VA_ARGS__))
121#define COMMS_ENUM_VAL_105(p_, v_, ...) COMMS_WRAP_ENUM(p_, v_), COMMS_EXPAND(COMMS_ENUM_VAL_104(p_, __VA_ARGS__))
122#define COMMS_ENUM_VAL_106(p_, v_, ...) COMMS_WRAP_ENUM(p_, v_), COMMS_EXPAND(COMMS_ENUM_VAL_105(p_, __VA_ARGS__))
123#define COMMS_ENUM_VAL_107(p_, v_, ...) COMMS_WRAP_ENUM(p_, v_), COMMS_EXPAND(COMMS_ENUM_VAL_106(p_, __VA_ARGS__))
124#define COMMS_ENUM_VAL_108(p_, v_, ...) COMMS_WRAP_ENUM(p_, v_), COMMS_EXPAND(COMMS_ENUM_VAL_107(p_, __VA_ARGS__))
125#define COMMS_ENUM_VAL_109(p_, v_, ...) COMMS_WRAP_ENUM(p_, v_), COMMS_EXPAND(COMMS_ENUM_VAL_108(p_, __VA_ARGS__))
126#define COMMS_ENUM_VAL_110(p_, v_, ...) COMMS_WRAP_ENUM(p_, v_), COMMS_EXPAND(COMMS_ENUM_VAL_109(p_, __VA_ARGS__))
127#define COMMS_ENUM_VAL_111(p_, v_, ...) COMMS_WRAP_ENUM(p_, v_), COMMS_EXPAND(COMMS_ENUM_VAL_110(p_, __VA_ARGS__))
128#define COMMS_ENUM_VAL_112(p_, v_, ...) COMMS_WRAP_ENUM(p_, v_), COMMS_EXPAND(COMMS_ENUM_VAL_111(p_, __VA_ARGS__))
129#define COMMS_ENUM_VAL_113(p_, v_, ...) COMMS_WRAP_ENUM(p_, v_), COMMS_EXPAND(COMMS_ENUM_VAL_112(p_, __VA_ARGS__))
130#define COMMS_ENUM_VAL_114(p_, v_, ...) COMMS_WRAP_ENUM(p_, v_), COMMS_EXPAND(COMMS_ENUM_VAL_113(p_, __VA_ARGS__))
131#define COMMS_ENUM_VAL_115(p_, v_, ...) COMMS_WRAP_ENUM(p_, v_), COMMS_EXPAND(COMMS_ENUM_VAL_114(p_, __VA_ARGS__))
132#define COMMS_ENUM_VAL_116(p_, v_, ...) COMMS_WRAP_ENUM(p_, v_), COMMS_EXPAND(COMMS_ENUM_VAL_115(p_, __VA_ARGS__))
133#define COMMS_ENUM_VAL_117(p_, v_, ...) COMMS_WRAP_ENUM(p_, v_), COMMS_EXPAND(COMMS_ENUM_VAL_116(p_, __VA_ARGS__))
134#define COMMS_ENUM_VAL_118(p_, v_, ...) COMMS_WRAP_ENUM(p_, v_), COMMS_EXPAND(COMMS_ENUM_VAL_117(p_, __VA_ARGS__))
135#define COMMS_ENUM_VAL_119(p_, v_, ...) COMMS_WRAP_ENUM(p_, v_), COMMS_EXPAND(COMMS_ENUM_VAL_118(p_, __VA_ARGS__))
136#define COMMS_ENUM_VAL_120(p_, v_, ...) COMMS_WRAP_ENUM(p_, v_), COMMS_EXPAND(COMMS_ENUM_VAL_119(p_, __VA_ARGS__))
137#define COMMS_ENUM_VAL_121(p_, v_, ...) COMMS_WRAP_ENUM(p_, v_), COMMS_EXPAND(COMMS_ENUM_VAL_120(p_, __VA_ARGS__))
138#define COMMS_ENUM_VAL_122(p_, v_, ...) COMMS_WRAP_ENUM(p_, v_), COMMS_EXPAND(COMMS_ENUM_VAL_121(p_, __VA_ARGS__))
139#define COMMS_ENUM_VAL_123(p_, v_, ...) COMMS_WRAP_ENUM(p_, v_), COMMS_EXPAND(COMMS_ENUM_VAL_122(p_, __VA_ARGS__))
140#define COMMS_ENUM_VAL_124(p_, v_, ...) COMMS_WRAP_ENUM(p_, v_), COMMS_EXPAND(COMMS_ENUM_VAL_123(p_, __VA_ARGS__))
141#define COMMS_ENUM_VAL_125(p_, v_, ...) COMMS_WRAP_ENUM(p_, v_), COMMS_EXPAND(COMMS_ENUM_VAL_124(p_, __VA_ARGS__))
142#define COMMS_ENUM_VAL_126(p_, v_, ...) COMMS_WRAP_ENUM(p_, v_), COMMS_EXPAND(COMMS_ENUM_VAL_125(p_, __VA_ARGS__))
143#define COMMS_ENUM_VAL_127(p_, v_, ...) COMMS_WRAP_ENUM(p_, v_), COMMS_EXPAND(COMMS_ENUM_VAL_126(p_, __VA_ARGS__))
144#define COMMS_ENUM_VAL_128(p_, v_, ...) COMMS_WRAP_ENUM(p_, v_), COMMS_EXPAND(COMMS_ENUM_VAL_127(p_, __VA_ARGS__))
145#define COMMS_ENUM_VAL_129(p_, v_, ...) COMMS_WRAP_ENUM(p_, v_), COMMS_EXPAND(COMMS_ENUM_VAL_128(p_, __VA_ARGS__))
146#define COMMS_ENUM_VAL_130(p_, v_, ...) COMMS_WRAP_ENUM(p_, v_), COMMS_EXPAND(COMMS_ENUM_VAL_129(p_, __VA_ARGS__))
147
148#define COMMS_CHOOSE_ENUM_(N, p_, ...) COMMS_EXPAND(COMMS_ENUM_VAL_ ## N(p_, __VA_ARGS__))
149#define COMMS_CHOOSE_ENUM(N, p_, ...) COMMS_EXPAND(COMMS_CHOOSE_ENUM_(N, p_, __VA_ARGS__))
150#define COMMS_DO_ENUM(p_, ...) COMMS_EXPAND(COMMS_CHOOSE_ENUM(COMMS_NUM_ARGS(__VA_ARGS__), p_, __VA_ARGS__))
151
152#define COMMS_END_ENUM(p_) \
153 COMMS_CONCATENATE(p_, _numOfValues), \
154 COMMS_CONCATENATE(p_, _typeLimit) = std::numeric_limits<unsigned>::max()
155
156#define COMMS_DEFINE_ENUM(p_, ...) \
157 enum p_ : unsigned { \
158 COMMS_EXPAND(COMMS_DO_ENUM(COMMS_CONCATENATE(p_, _), __VA_ARGS__)) \
159 , COMMS_END_ENUM(p_) \
160 };
161
162
163