Publishing 2019 R1 content
[platform/upstream/dldt.git] / inference-engine / thirdparty / clDNN / src / include / meta_utils.h
1 /*
2 // Copyright (c) 2017 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 #pragma once
17
18 #include <type_traits>
19 #include "api/CPP/meta_utils.hpp"
20 #include "internal_primitive.h"
21
22 namespace cldnn
23 {
24
25 struct primitive;
26
27 namespace meta
28 {
29
30 template <class... T>
31 struct pack {};
32
33 //helper type for deducing return type from member function pointer
34 //doesn't require passing arguments like std::result_of
35 template <class T>
36 struct deduce_ret_type;
37
38 template <class Ret, class C, class... Args>
39 struct deduce_ret_type<Ret(C::*)(Args...)>
40 {
41     using type = Ret;
42 };
43
44 template <class T>
45 using deduce_ret_type_t = typename deduce_ret_type<T>::type;
46
47 template <class T>
48 struct is_primitive : public std::integral_constant<bool,
49                                                     std::is_base_of<primitive, T>::value &&
50                                                     !std::is_same<primitive, typename std::remove_cv<T>::type>::value &&
51                                                     std::is_same<T, typename std::remove_cv<T>::type>::value> {};
52
53 template <class T>
54 struct is_api_primitive : public std::integral_constant<bool,
55                                                     is_primitive<T>::value &&
56                                                     !std::is_base_of<internal_primitive, T>::value> {};
57
58 template <class T>
59 struct is_internal_primitive : public std::integral_constant<bool,
60                                                     std::is_base_of<internal_primitive, T>::value &&
61                                                     !std::is_same<internal_primitive, typename std::remove_cv<T>::type>::value &&
62                                                     std::is_same<T, typename std::remove_cv<T>::type>::value> {};
63
64 }
65 }