Tapkee
methods_traits.hpp
Go to the documentation of this file.
00001 /* This software is distributed under BSD 3-clause license (see LICENSE file).
00002  *
00003  * Copyright (c) 2012-2013 Sergey Lisitsyn, Fernando Iglesias
00004  */
00005 
00006 #ifndef TAPKEE_METHOD_TRAITS_H_
00007 #define TAPKEE_METHOD_TRAITS_H_
00008 
00009 namespace tapkee
00010 {
00011 
00014 template <int method> struct MethodTraits
00015 {
00016     static const bool needs_kernel;
00017     static const bool needs_distance;
00018     static const bool needs_features;
00019 };
00020 
00021 #define METHOD_TRAIT(X,kernel_needed,distance_needed,features_needed)           \
00022 template <> const bool MethodTraits<X>::needs_kernel = kernel_needed;           \
00023 template <> const bool MethodTraits<X>::needs_distance = distance_needed;       \
00024 template <> const bool MethodTraits<X>::needs_features = features_needed        \
00025 
00026 #define METHOD_THAT_NEEDS_ONLY_KERNEL_IS(X) METHOD_TRAIT(X,true,false,false)
00027 #define METHOD_THAT_NEEDS_ONLY_DISTANCE_IS(X) METHOD_TRAIT(X,false,true,false)
00028 #define METHOD_THAT_NEEDS_KERNEL_AND_FEATURES_IS(X) METHOD_TRAIT(X,true,false,true)
00029 #define METHOD_THAT_NEEDS_DISTANCE_AND_FEATURES_IS(X) METHOD_TRAIT(X,false,true,true)
00030 #define METHOD_THAT_NEEDS_ONLY_FEATURES_IS(X) METHOD_TRAIT(X,false,false,true)
00031 #define METHOD_THAT_NEEDS_NOTHING_IS(X) METHOD_TRAIT(X,false,false,false)
00032 }
00033 
00034 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines