Hitmap 1.3
 All Data Structures Namespaces Files Functions Variables Typedefs Friends Macros Groups Pages
hitmap2.h
Go to the documentation of this file.
1 
14 /*
15  *
16  * @section License Hitmap license
17  * <license>
18  *
19  * Hitmap v2.0
20  *
21  * This software is provided to enhance knowledge and encourage progress in the scientific
22  * community. It should be used only for research and educational purposes. Any reproduction
23  * or use for commercial purpose, public redistribution, in source or binary forms, with or
24  * without modifications, is NOT ALLOWED without the previous authorization of the copyright
25  * holder. The origin of this software must not be misrepresented; you must not claim that you
26  * wrote the original software. If you use this software for any purpose (e.g. publication),
27  * a reference to the software package and the authors must be included.
28  *
29  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS" AND ANY
30  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
31  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
32  * THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
33  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
34  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
35  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
36  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
37  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
38  *
39  * Copyright (c) 2007-2017, Trasgo Group, Universidad de Valladolid.
40  * All rights reserved.
41  *
42  * More information on http://trasgo.infor.uva.es/
43  *
44  * </license>
45  *
46  */
47 
48 #ifndef _HITMAP2_
49 #define _HITMAP2_
50 
51 #include "hitmap.h"
52 
56 #undef HITMAP_VERSION
57 #define HITMAP_VERSION 2.0
58 
64 #define HIT2_COUNTPARAM( ... ) HIT2_COUNTPARAM_N( __VA_ARGS__, 20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1 )
65 #define HIT2_COUNTPARAM_N( n1, n2, n3, n4, n5, n6, n7, n8, n9, n10, n11, n12, n13, n14, n15, n16, n17, n18, n19, n20, num, ... ) num
66 
70 #define hit(var, ...) HIT2_HIT_VARIADIC( var, HIT2_COUNTPARAM( __VA_ARGS__ ), __VA_ARGS__ )
71 #define HIT2_HIT_VARIADIC(var, num, ...) hit_tileElemAtNoStride( var, num, __VA_ARGS__ )
72 
73 #define hitStrided(var, ...) HIT2_HITSTRIDED_VARIADIC( var, HIT2_COUNTPARAM( __VA_ARGS__ ), __VA_ARGS__ )
74 #define HIT2_HITSTRIDED_VARIADIC(var, num, ...) hit_tileElemAt( var, num, __VA_ARGS__ )
75 
79 #define hitNewShape( ... ) HIT2_SHAPE_VARIADIC( HIT2_COUNTPARAM( __VA_ARGS__ ), __VA_ARGS__ )
80 #define HIT2_SHAPE_VARIADIC( num, ... ) HIT2_SHAPE_VARIADIC_2( num, __VA_ARGS__ )
81 #define HIT2_SHAPE_VARIADIC_2( num, ... ) hit_shape( num, HIT2_HITSIGS_##num( __VA_ARGS__ ) )
82 #define HIT2_HITSIGS_1( tuple ) hitNewSig tuple
83 #define HIT2_HITSIGS_2( tuple, ... ) hitNewSig tuple, HIT2_HITSIGS_1( __VA_ARGS__ )
84 #define HIT2_HITSIGS_3( tuple, ... ) hitNewSig tuple, HIT2_HITSIGS_2( __VA_ARGS__ )
85 #define HIT2_HITSIGS_4( tuple, ... ) hitNewSig tuple, HIT2_HITSIGS_3( __VA_ARGS__ )
86 
90 #define hitNewSig( ... ) HIT2_HITSIG_VARIADIC( HIT2_COUNTPARAM(__VA_ARGS__), __VA_ARGS__ )
91 #define HIT2_HITSIG_VARIADIC( num, ... ) HIT2_HITSIG_VARIADIC_2( num, __VA_ARGS__ )
92 #define HIT2_HITSIG_VARIADIC_2( num, ... ) hitSig_##num( __VA_ARGS__ )
93 #define hitSig_1( a ) hit_sig( a, a, 1 )
94 #define hitSig_2( a, b ) hit_sig( a, b, 1 )
95 #define hitSig_3( a, b, c ) hit_sig( a, b, c )
96 
100 #define hitNewType( type ) hit_tileNewType( type ); \
101  static inline HitTile_##type hitNewTile_##type( HitShape shp ) { \
102  HitTile_##type new = HIT_TILE_NULL_STATIC; \
103  hit_tileDomainShapeAlloc( &new, type, shp ); \
104  return new; \
105  }
106 
110 #define hitNewTile( type, shape ) hitNewTile_##type( shape )
111 
117 #endif // HITMAP v2.0
118