Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
mitkPPSeqForEach.h
Go to the documentation of this file.
1 /*===================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center,
6 Division of Medical and Biological Informatics.
7 All rights reserved.
8 
9 This software is distributed WITHOUT ANY WARRANTY; without
10 even the implied warranty of MERCHANTABILITY or FITNESS FOR
11 A PARTICULAR PURPOSE.
12 
13 See LICENSE.txt or http://www.mitk.org for details.
14 
15 ===================================================================*/
16 #/* **************************************************************************
17 # * *
18 # * (C) Copyright Paul Mensonides 2002.
19 # * Distributed under the Boost Software License, Version 1.0. (See
20 # * accompanying file LICENSE_1_0.txt or copy at
21 # * http://www.boost.org/LICENSE_1_0.txt)
22 # * *
23 # ************************************************************************** */
24 #
25 #/* See http://www.boost.org for most recent version. */
26 #
27 #ifndef MITK_PREPROCESSOR_SEQ_FOR_EACH_HPP
28 #define MITK_PREPROCESSOR_SEQ_FOR_EACH_HPP
29 #
30 #include "mitkPPArithmeticDec.h"
31 #include "mitkPPConfig.h"
32 #include "mitkPPRepetitionFor.h"
33 #include "mitkPPSeq.h"
34 #include "mitkPPSeqSize.h"
35 #include "mitkPPTupleElem.h"
36 #include "mitkPPTupleRem.h"
37 #
38 #/* MITK_PP_SEQ_FOR_EACH */
39 #
40 #if ~MITK_PP_CONFIG_FLAGS() & MITK_PP_CONFIG_EDG()
41 #define MITK_PP_SEQ_FOR_EACH(macro, data, seq) \
42  MITK_PP_FOR((macro, data, seq(nil)), MITK_PP_SEQ_FOR_EACH_P, MITK_PP_SEQ_FOR_EACH_O, MITK_PP_SEQ_FOR_EACH_M)
43 #else
44 #define MITK_PP_SEQ_FOR_EACH(macro, data, seq) MITK_PP_SEQ_FOR_EACH_D(macro, data, seq)
45 #define MITK_PP_SEQ_FOR_EACH_D(macro, data, seq) \
46  MITK_PP_FOR((macro, data, seq(nil)), MITK_PP_SEQ_FOR_EACH_P, MITK_PP_SEQ_FOR_EACH_O, MITK_PP_SEQ_FOR_EACH_M)
47 #endif
48 #
49 #define MITK_PP_SEQ_FOR_EACH_P(r, x) MITK_PP_DEC(MITK_PP_SEQ_SIZE(MITK_PP_TUPLE_ELEM(3, 2, x)))
50 #
51 #if MITK_PP_CONFIG_FLAGS() & MITK_PP_CONFIG_STRICT()
52 #define MITK_PP_SEQ_FOR_EACH_O(r, x) MITK_PP_SEQ_FOR_EACH_O_I x
53 #else
54 #define MITK_PP_SEQ_FOR_EACH_O(r, x) \
55  MITK_PP_SEQ_FOR_EACH_O_I(MITK_PP_TUPLE_ELEM(3, 0, x), MITK_PP_TUPLE_ELEM(3, 1, x), MITK_PP_TUPLE_ELEM(3, 2, x))
56 #endif
57 #
58 #define MITK_PP_SEQ_FOR_EACH_O_I(macro, data, seq) (macro, data, MITK_PP_SEQ_TAIL(seq))
59 #
60 #if MITK_PP_CONFIG_FLAGS() & MITK_PP_CONFIG_STRICT()
61 #define MITK_PP_SEQ_FOR_EACH_M(r, x) MITK_PP_SEQ_FOR_EACH_M_IM(r, MITK_PP_TUPLE_REM_3 x)
62 #define MITK_PP_SEQ_FOR_EACH_M_IM(r, im) MITK_PP_SEQ_FOR_EACH_M_I(r, im)
63 #else
64 #define MITK_PP_SEQ_FOR_EACH_M(r, x) \
65  MITK_PP_SEQ_FOR_EACH_M_I(r, MITK_PP_TUPLE_ELEM(3, 0, x), MITK_PP_TUPLE_ELEM(3, 1, x), MITK_PP_TUPLE_ELEM(3, 2, x))
66 #endif
67 #
68 #define MITK_PP_SEQ_FOR_EACH_M_I(r, macro, data, seq) macro(r, data, MITK_PP_SEQ_HEAD(seq))
69 #
70 #/* MITK_PP_SEQ_FOR_EACH_R */
71 #
72 #if ~MITK_PP_CONFIG_FLAGS() & MITK_PP_CONFIG_EDG()
73 #define MITK_PP_SEQ_FOR_EACH_R(r, macro, data, seq) \
74  MITK_PP_FOR_##r((macro, data, seq(nil)), MITK_PP_SEQ_FOR_EACH_P, MITK_PP_SEQ_FOR_EACH_O, MITK_PP_SEQ_FOR_EACH_M)
75 #else
76 #define MITK_PP_SEQ_FOR_EACH_R(r, macro, data, seq) MITK_PP_SEQ_FOR_EACH_R_I(r, macro, data, seq)
77 #define MITK_PP_SEQ_FOR_EACH_R_I(r, macro, data, seq) \
78  MITK_PP_FOR_##r((macro, data, seq(nil)), MITK_PP_SEQ_FOR_EACH_P, MITK_PP_SEQ_FOR_EACH_O, MITK_PP_SEQ_FOR_EACH_M)
79 #endif
80 #
81 #endif