Point Cloud Library (PCL)
1.12.0
pcl
impl
instantiate.hpp
1
/*
2
* Software License Agreement (BSD License)
3
*
4
* Point Cloud Library (PCL) - www.pointclouds.org
5
* Copyright (c) 2010, Willow Garage, Inc.
6
* Copyright (c) 2012-, Open Perception, Inc.
7
*
8
* All rights reserved.
9
*
10
* Redistribution and use in source and binary forms, with or without
11
* modification, are permitted provided that the following conditions
12
* are met:
13
*
14
* * Redistributions of source code must retain the above copyright
15
* notice, this list of conditions and the following disclaimer.
16
* * Redistributions in binary form must reproduce the above
17
* copyright notice, this list of conditions and the following
18
* disclaimer in the documentation and/or other materials provided
19
* with the distribution.
20
* * Neither the name of the copyright holder(s) nor the names of its
21
* contributors may be used to endorse or promote products derived
22
* from this software without specific prior written permission.
23
*
24
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
25
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
26
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
27
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
28
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
29
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
30
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
31
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
32
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
33
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
34
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35
* POSSIBILITY OF SUCH DAMAGE.
36
*
37
*/
38
#ifndef PCL_IMPL_INSTANTIATE_H_
39
#define PCL_IMPL_INSTANTIATE_H_
40
41
#ifdef __GNUC__
42
#pragma GCC system_header
43
#endif
44
45
#include <pcl/pcl_config.h>
46
47
//#define PCL_POINT_TYPES (bool)(int)(float)(double)
48
//#define PCL_TEMPLATES (Type)(Othertype)
49
50
//
51
// PCL_INSTANTIATE: call to instantiate template TEMPLATE for all
52
// POINT_TYPES
53
//
54
55
#ifdef PCL_NO_PRECOMPILE
56
57
#define PCL_INSTANTIATE_IMPL(r, TEMPLATE, POINT_TYPE)
58
#define PCL_INSTANTIATE(TEMPLATE, POINT_TYPES)
59
#define PCL_INSTANTIATE_PRODUCT_IMPL(r, product)
60
#define PCL_INSTANTIATE_PRODUCT(TEMPLATE, PRODUCT)
61
62
#else
63
64
#include <boost/preprocessor/seq/for_each.hpp>
65
#include <boost/preprocessor/seq/for_each_product.hpp>
66
#include <boost/preprocessor/seq/to_tuple.hpp>
67
#include <boost/preprocessor/cat.hpp>
68
#include <boost/preprocessor/expand.hpp>
69
70
#define PCL_INSTANTIATE_IMPL(r, TEMPLATE, POINT_TYPE) \
71
BOOST_PP_CAT(PCL_INSTANTIATE_, TEMPLATE)(POINT_TYPE)
72
73
#define PCL_INSTANTIATE(TEMPLATE, POINT_TYPES) \
74
BOOST_PP_SEQ_FOR_EACH(PCL_INSTANTIATE_IMPL, TEMPLATE, POINT_TYPES)
75
76
77
//
78
// PCL_INSTANTIATE_PRODUCT(templatename, (seq1)(seq2)...(seqN))
79
//
80
// instantiate templates
81
//
82
// A call to PCL_INSTANTIATE_PRODUCT(T, ((a)(b)) ((d)(e)) ) results in calls
83
//
84
// PCL_INSTANTIATE_T(a, d)
85
// PCL_INSTANTIATE_T(a, e)
86
// PCL_INSTANTIATE_T(b, d)
87
// PCL_INSTANTIATE_T(b, e)
88
//
89
// That is, PCL_INSTANTIATE_T is called for the cartesian product of the sequences seq1 ... seqN
90
//
91
// BE CAREFUL WITH YOUR PARENTHESIS! The argument PRODUCT is a
92
// sequence of sequences. e.g. if it were three sequences of,
93
// 1. letters, 2. numbers, and 3. our favorite transylvanians, it
94
// would be
95
//
96
// ((x)(y)(z))((1)(2)(3))((dracula)(radu))
97
//
98
#ifdef _MSC_VER
99
#define PCL_INSTANTIATE_PRODUCT_IMPL(r, product) \
100
BOOST_PP_CAT(PCL_INSTANTIATE_, BOOST_PP_SEQ_HEAD(product)) \
101
BOOST_PP_EXPAND(BOOST_PP_SEQ_TO_TUPLE(BOOST_PP_SEQ_TAIL(product)))
102
#else
103
#define PCL_INSTANTIATE_PRODUCT_IMPL(r, product) \
104
BOOST_PP_EXPAND(BOOST_PP_CAT(PCL_INSTANTIATE_, BOOST_PP_SEQ_HEAD(product)) \
105
BOOST_PP_SEQ_TO_TUPLE(BOOST_PP_SEQ_TAIL(product)))
106
#endif
107
108
109
#define PCL_INSTANTIATE_PRODUCT(TEMPLATE, PRODUCT) \
110
BOOST_PP_SEQ_FOR_EACH_PRODUCT(PCL_INSTANTIATE_PRODUCT_IMPL, ((TEMPLATE))PRODUCT)
111
112
#endif
113
114
#endif