pp.hpp
Go to the documentation of this file.
1 //*****************************************************************************
2 // Copyright 2017-2020 Intel Corporation
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //*****************************************************************************
16 
17 /**
18  * @brief Set of macro used by openvino
19  * @file pp.hpp
20  */
21 
22 #pragma once
23 
24 // Macros for string conversion
25 #define OV_PP_TOSTRING(...) OV_PP_TOSTRING_(__VA_ARGS__)
26 #define OV_PP_TOSTRING_(...) #__VA_ARGS__
27 
28 #define OV_PP_EXPAND(X) X
29 
30 #define OV_PP_NARG(...) OV_PP_EXPAND( OV_PP_NARG_(__VA_ARGS__, OV_PP_RSEQ_N()) )
31 #define OV_PP_NARG_(...) OV_PP_EXPAND( OV_PP_ARG_N(__VA_ARGS__) )
32 #define OV_PP_ARG_N(_1, _2, _3, _4, N, ...) N
33 #define OV_PP_RSEQ_N() 4, 3, 2, 1, 0
34 
35 // Macros for names concatenation
36 #define OV_PP_CAT_(x, y) x ## y
37 #define OV_PP_CAT(x, y) OV_PP_CAT_(x, y)
38 #define OV_PP_CAT3_(x, y, z) x ## y ## z
39 #define OV_PP_CAT3(x, y, z) OV_PP_CAT3_(x, y, z)
40 #define OV_PP_CAT4_(x, y, z, w) x ## y ## z ## w
41 #define OV_PP_CAT4(x, y, z, w) OV_PP_CAT4_(x, y, z, w)
42 
43 
44 #define OV_PP_OVERLOAD(NAME, ...) OV_PP_EXPAND( OV_PP_CAT3(NAME, _, OV_PP_EXPAND( OV_PP_NARG(__VA_ARGS__) ))(__VA_ARGS__) )