6db9678ddff802336202c962649fbdd714883a1e
[platform/upstream/dldt.git] / inference-engine / src / vpu / graph_transformer / include / vpu / utils / extra.hpp
1 // Copyright (C) 2018-2019 Intel Corporation
2 // SPDX-License-Identifier: Apache-2.0
3 //
4
5 #pragma once
6
7 #include <details/ie_exception.hpp>
8
9 namespace vpu {
10
11 //
12 // VPU_COMBINE
13 //
14
15 #define VPU_COMBINE_HELPER2(X, Y)  X##Y
16 #define VPU_COMBINE_HELPER3(X, Y, Z)  X##Y##Z
17
18 #define VPU_COMBINE(X, Y)   VPU_COMBINE_HELPER2(X, Y)
19 #define VPU_COMBINE3(X, Y, Z)   VPU_COMBINE_HELPER3(X, Y, Z)
20
21 //
22 // Exceptions
23 //
24
25 #define VPU_THROW_EXCEPTION \
26     THROW_IE_EXCEPTION << "[VPU] "
27
28 #define VPU_THROW_UNLESS(EXPRESSION) \
29     if (!(EXPRESSION)) VPU_THROW_EXCEPTION << "AssertionFailed: " << #EXPRESSION  // NOLINT
30
31 //
32 // Packed structure declaration
33 //
34
35 #ifdef _MSC_VER
36 #   define VPU_PACKED(body) __pragma(pack(push, 1)) struct body __pragma(pack(pop))
37 #elif defined(__GNUC__)
38 #   define VPU_PACKED(body) struct __attribute__((packed)) body
39 #endif
40
41 }  // namespace vpu