SLAMflex SE  0.1.0
SLAMflex provides detection and tracking of dominant planes for smartphone devices. This plane can then be used to show AR content relative to the plane orientation. The detection of plane is performed in the field of view of the smartphone camera. In subsequent frames it is tracked. The interface returns the plane position and orientation.
size_mismatch.hh
Go to the documentation of this file.
1 // -*- c++ -*-
2 
3 // Copyright (C) 2009 Tom Drummond (twd20@cam.ac.uk),
4 // Ed Rosten (er258@cam.ac.uk)
5 //
6 // This file is part of the TooN Library. This library is free
7 // software; you can redistribute it and/or modify it under the
8 // terms of the GNU General Public License as published by the
9 // Free Software Foundation; either version 2, or (at your option)
10 // any later version.
11 
12 // This library is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU General Public License for more details.
16 
17 // You should have received a copy of the GNU General Public License along
18 // with this library; see the file COPYING. If not, write to the Free
19 // Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
20 // USA.
21 
22 // As a special exception, you may use this file as part of a free software
23 // library without restriction. Specifically, if other files instantiate
24 // templates or use macros or inline functions from this file, or you compile
25 // this file and link it with other files to produce an executable, this
26 // file does not by itself cause the resulting executable to be covered by
27 // the GNU General Public License. This exception does not however
28 // invalidate any other reasons why the executable file might be covered by
29 // the GNU General Public License.
30 
31 namespace TooN {
32 
33 // class to generate compile time error
34 // general case which doesn't exist
35 template<int Size1, int Size2>
37 
38 // special cases which do exist
39 template<int Size>
40 struct SizeMismatch_<Size,Size>{
41  static inline void test(int, int){}
42 };
43 
44 template<int Size>
45 struct SizeMismatch_<Dynamic,Size>{
46  static inline void test(int size1, int size2){
47  if(size1!=size2){
48  #ifdef TOON_TEST_INTERNALS
49  throw Internal::SizeMismatch();
50  #elif !defined TOON_NDEBUG_SIZE
51  std::cerr << "TooN Size Mismatch" << std::endl;
52  std::abort();
53  #endif
54  }
55  }
56 };
57 
58 template<int Size>
59 struct SizeMismatch_<Size,Dynamic>{
60  static inline void test(int size1, int size2){
61  if(size1!=size2){
62  #ifdef TOON_TEST_INTERNALS
63  throw Internal::SizeMismatch();
64  #elif !defined TOON_NDEBUG_SIZE
65  std::cerr << "TooN Size Mismatch" << std::endl;
66  std::abort();
67  #endif
68  }
69  }
70 };
71 
72 template <>
74  static inline void test(int size1, int size2){
75  if(size1!=size2){
76  #ifdef TOON_TEST_INTERNALS
77  throw Internal::SizeMismatch();
78  #elif !defined TOON_NDEBUG_SIZE
79  std::cerr << "TooN Size Mismatch" << std::endl;
80  std::abort();
81  #endif
82  }
83  }
84 };
85 
86 #if(0)
87 namespace Internal
88 {
89  struct BadSize;
90 }
91 #endif
92 
93 #ifdef TOON_TEST_INTERNALS
94 template<int Size1, int Size2>
95 struct SizeMismatch_
96 {
97  static inline void test(int, int)
98  {
99 
100  throw Internal::StaticSizeMismatch();
101 
102  }
103 };
104 #endif
105 template<int Size1, int Size2>
107 {
108  static inline void test(int s1, int s2)
109  {
110  SizeMismatch_< (Size1 == Dynamic || Size1 == Resizable)?Dynamic:Size1,
111  (Size2 == Dynamic || Size2 == Resizable)?Dynamic:Size2 >::test(s1, s2);
112  }
113 };
114 
115 }
Everything lives inside this namespace.
Definition: allocator.hh:48
static const int Dynamic
Template size value used to indicate dynamically sized vectors and matrices.
Definition: TooN.h:272
static void test(int s1, int s2)
static void test(int size1, int size2)
static void test(int size1, int size2)
static const int Resizable
Definition: TooN.h:273
static void test(int size1, int size2)