motion-ocr 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (67) hide show
  1. data/.gitignore +17 -0
  2. data/Gemfile +3 -0
  3. data/Gemfile.lock +10 -0
  4. data/LICENSE +28 -0
  5. data/README.md +22 -0
  6. data/Rakefile +17 -0
  7. data/app/app_delegate.rb +2 -0
  8. data/lib/motion-ocr.rb +26 -0
  9. data/lib/motion-ocr/version.rb +3 -0
  10. data/motion-ocr.gemspec +20 -0
  11. data/resources/tessdata/configs/nodict +3 -0
  12. data/resources/tessdata/eng.traineddata +0 -0
  13. data/spec/motion_ocr_spec.rb +23 -0
  14. data/spec/support/phototest.gif +0 -0
  15. data/vendor/MotionOCR/MotionOCR.bridgesupport +14722 -0
  16. data/vendor/MotionOCR/MotionOCR.xcodeproj/project.pbxproj +390 -0
  17. data/vendor/MotionOCR/MotionOCR.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
  18. data/vendor/MotionOCR/MotionOCR.xcodeproj/project.xcworkspace/xcuserdata/fer.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
  19. data/vendor/MotionOCR/MotionOCR.xcodeproj/xcuserdata/fer.xcuserdatad/xcschemes/MotionOCR.xcscheme +59 -0
  20. data/vendor/MotionOCR/MotionOCR.xcodeproj/xcuserdata/fer.xcuserdatad/xcschemes/xcschememanagement.plist +22 -0
  21. data/vendor/MotionOCR/MotionOCR/MotionOCR-Prefix.pch +7 -0
  22. data/vendor/MotionOCR/MotionOCR/MotionOCR.h +22 -0
  23. data/vendor/MotionOCR/MotionOCR/MotionOCR.mm +89 -0
  24. data/vendor/MotionOCR/MotionOCR/build_dependencies/dependencies/include/leptonica/allheaders.h +32 -0
  25. data/vendor/MotionOCR/MotionOCR/build_dependencies/dependencies/include/leptonica/alltypes.h +49 -0
  26. data/vendor/MotionOCR/MotionOCR/build_dependencies/dependencies/include/leptonica/array.h +125 -0
  27. data/vendor/MotionOCR/MotionOCR/build_dependencies/dependencies/include/leptonica/arrayaccess.h +194 -0
  28. data/vendor/MotionOCR/MotionOCR/build_dependencies/dependencies/include/leptonica/bbuffer.h +46 -0
  29. data/vendor/MotionOCR/MotionOCR/build_dependencies/dependencies/include/leptonica/bmf.h +51 -0
  30. data/vendor/MotionOCR/MotionOCR/build_dependencies/dependencies/include/leptonica/bmp.h +74 -0
  31. data/vendor/MotionOCR/MotionOCR/build_dependencies/dependencies/include/leptonica/ccbord.h +103 -0
  32. data/vendor/MotionOCR/MotionOCR/build_dependencies/dependencies/include/leptonica/dewarp.h +57 -0
  33. data/vendor/MotionOCR/MotionOCR/build_dependencies/dependencies/include/leptonica/endianness.h +11 -0
  34. data/vendor/MotionOCR/MotionOCR/build_dependencies/dependencies/include/leptonica/environ.h +281 -0
  35. data/vendor/MotionOCR/MotionOCR/build_dependencies/dependencies/include/leptonica/freetype.h +23 -0
  36. data/vendor/MotionOCR/MotionOCR/build_dependencies/dependencies/include/leptonica/gplot.h +77 -0
  37. data/vendor/MotionOCR/MotionOCR/build_dependencies/dependencies/include/leptonica/heap.h +73 -0
  38. data/vendor/MotionOCR/MotionOCR/build_dependencies/dependencies/include/leptonica/imageio.h +153 -0
  39. data/vendor/MotionOCR/MotionOCR/build_dependencies/dependencies/include/leptonica/jbclass.h +122 -0
  40. data/vendor/MotionOCR/MotionOCR/build_dependencies/dependencies/include/leptonica/leptprotos.h +2058 -0
  41. data/vendor/MotionOCR/MotionOCR/build_dependencies/dependencies/include/leptonica/leptwin.h +34 -0
  42. data/vendor/MotionOCR/MotionOCR/build_dependencies/dependencies/include/leptonica/list.h +76 -0
  43. data/vendor/MotionOCR/MotionOCR/build_dependencies/dependencies/include/leptonica/morph.h +218 -0
  44. data/vendor/MotionOCR/MotionOCR/build_dependencies/dependencies/include/leptonica/pix.h +945 -0
  45. data/vendor/MotionOCR/MotionOCR/build_dependencies/dependencies/include/leptonica/ptra.h +80 -0
  46. data/vendor/MotionOCR/MotionOCR/build_dependencies/dependencies/include/leptonica/queue.h +63 -0
  47. data/vendor/MotionOCR/MotionOCR/build_dependencies/dependencies/include/leptonica/readbarcode.h +220 -0
  48. data/vendor/MotionOCR/MotionOCR/build_dependencies/dependencies/include/leptonica/regutils.h +122 -0
  49. data/vendor/MotionOCR/MotionOCR/build_dependencies/dependencies/include/leptonica/stack.h +55 -0
  50. data/vendor/MotionOCR/MotionOCR/build_dependencies/dependencies/include/leptonica/sudoku.h +62 -0
  51. data/vendor/MotionOCR/MotionOCR/build_dependencies/dependencies/include/leptonica/watershed.h +52 -0
  52. data/vendor/MotionOCR/MotionOCR/build_dependencies/dependencies/include/tesseract/apitypes.h +31 -0
  53. data/vendor/MotionOCR/MotionOCR/build_dependencies/dependencies/include/tesseract/baseapi.h +664 -0
  54. data/vendor/MotionOCR/MotionOCR/build_dependencies/dependencies/include/tesseract/errcode.h +104 -0
  55. data/vendor/MotionOCR/MotionOCR/build_dependencies/dependencies/include/tesseract/genericvector.h +763 -0
  56. data/vendor/MotionOCR/MotionOCR/build_dependencies/dependencies/include/tesseract/helpers.h +139 -0
  57. data/vendor/MotionOCR/MotionOCR/build_dependencies/dependencies/include/tesseract/host.h +180 -0
  58. data/vendor/MotionOCR/MotionOCR/build_dependencies/dependencies/include/tesseract/ndminx.h +31 -0
  59. data/vendor/MotionOCR/MotionOCR/build_dependencies/dependencies/include/tesseract/ocrclass.h +335 -0
  60. data/vendor/MotionOCR/MotionOCR/build_dependencies/dependencies/include/tesseract/platform.h +48 -0
  61. data/vendor/MotionOCR/MotionOCR/build_dependencies/dependencies/include/tesseract/publictypes.h +202 -0
  62. data/vendor/MotionOCR/MotionOCR/build_dependencies/dependencies/include/tesseract/tesscallback.h +1238 -0
  63. data/vendor/MotionOCR/MotionOCR/build_dependencies/dependencies/include/tesseract/thresholder.h +170 -0
  64. data/vendor/MotionOCR/MotionOCR/build_dependencies/dependencies/include/tesseract/unichar.h +85 -0
  65. data/vendor/MotionOCR/MotionOCR/build_dependencies/dependencies/lib/liblept.a +0 -0
  66. data/vendor/MotionOCR/MotionOCR/build_dependencies/dependencies/lib/libtesseract_all.a +0 -0
  67. metadata +113 -0
@@ -0,0 +1,48 @@
1
+ ///////////////////////////////////////////////////////////////////////
2
+ // File: platform.h
3
+ // Description: Place holder
4
+ // Author:
5
+ // Created:
6
+ //
7
+ // (C) Copyright 2006, Google Inc.
8
+ // Licensed under the Apache License, Version 2.0 (the "License");
9
+ // you may not use this file except in compliance with the License.
10
+ // You may obtain a copy of the License at
11
+ // http://www.apache.org/licenses/LICENSE-2.0
12
+ // Unless required by applicable law or agreed to in writing, software
13
+ // distributed under the License is distributed on an "AS IS" BASIS,
14
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ // See the License for the specific language governing permissions and
16
+ // limitations under the License.
17
+ //
18
+ ///////////////////////////////////////////////////////////////////////
19
+
20
+ #ifndef TESSERACT_CCUTIL_PLATFORM_H__
21
+ #define TESSERACT_CCUTIL_PLATFORM_H__
22
+
23
+ #define DLLSYM
24
+ #ifdef __MSW32__
25
+ #ifdef __GNUC__
26
+ #define ultoa _ultoa
27
+ typedef struct _BLOB {
28
+ unsigned int cbSize;
29
+ char *pBlobData;
30
+ } BLOB, *LPBLOB;
31
+ #endif /* __GNUC__ */
32
+ #define SIGNED
33
+ #define snprintf _snprintf
34
+ #if (_MSC_VER <= 1400)
35
+ #define vsnprintf _vsnprintf
36
+ #endif /* __MSW32__ */
37
+ #else
38
+ #define __UNIX__
39
+ #include <limits.h>
40
+ #ifndef PATH_MAX
41
+ #define MAX_PATH 4096
42
+ #else
43
+ #define MAX_PATH PATH_MAX
44
+ #endif
45
+ #define SIGNED signed
46
+ #endif
47
+
48
+ #endif // TESSERACT_CCUTIL_PLATFORM_H__
@@ -0,0 +1,202 @@
1
+ ///////////////////////////////////////////////////////////////////////
2
+ // File: publictypes.h
3
+ // Description: Types used in both the API and internally
4
+ // Author: Ray Smith
5
+ // Created: Wed Mar 03 09:22:53 PST 2010
6
+ //
7
+ // (C) Copyright 2010, Google Inc.
8
+ // Licensed under the Apache License, Version 2.0 (the "License");
9
+ // you may not use this file except in compliance with the License.
10
+ // You may obtain a copy of the License at
11
+ // http://www.apache.org/licenses/LICENSE-2.0
12
+ // Unless required by applicable law or agreed to in writing, software
13
+ // distributed under the License is distributed on an "AS IS" BASIS,
14
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ // See the License for the specific language governing permissions and
16
+ // limitations under the License.
17
+ //
18
+ ///////////////////////////////////////////////////////////////////////
19
+
20
+ #ifndef TESSERACT_CCSTRUCT_PUBLICTYPES_H__
21
+ #define TESSERACT_CCSTRUCT_PUBLICTYPES_H__
22
+
23
+ // This file contains types that are used both by the API and internally
24
+ // to Tesseract. In order to decouple the API from Tesseract and prevent cyclic
25
+ // dependencies, THIS FILE SHOULD NOT DEPEND ON ANY OTHER PART OF TESSERACT.
26
+ // Restated: It is OK for low-level Tesseract files to include publictypes.h,
27
+ // but not for the low-level tesseract code to include top-level API code.
28
+ // This file should not use other Tesseract types, as that would drag
29
+ // their includes into the API-level.
30
+ // API-level code should include apitypes.h in preference to this file.
31
+
32
+ // Number of printers' points in an inch. The unit of the pointsize return.
33
+ const int kPointsPerInch = 72;
34
+
35
+ // Possible types for a POLY_BLOCK or ColPartition.
36
+ // Must be kept in sync with kPBColors in polyblk.cpp and PTIs*Type functions
37
+ // below, as well as kPolyBlockNames in publictypes.cpp.
38
+ // Used extensively by ColPartition, and POLY_BLOCK.
39
+ enum PolyBlockType {
40
+ PT_UNKNOWN, // Type is not yet known. Keep as the first element.
41
+ PT_FLOWING_TEXT, // Text that lives inside a column.
42
+ PT_HEADING_TEXT, // Text that spans more than one column.
43
+ PT_PULLOUT_TEXT, // Text that is in a cross-column pull-out region.
44
+ PT_TABLE, // Partition belonging to a table region.
45
+ PT_VERTICAL_TEXT, // Text-line runs vertically.
46
+ PT_CAPTION_TEXT, // Text that belongs to an image.
47
+ PT_FLOWING_IMAGE, // Image that lives inside a column.
48
+ PT_HEADING_IMAGE, // Image that spans more than one column.
49
+ PT_PULLOUT_IMAGE, // Image that is in a cross-column pull-out region.
50
+ PT_HORZ_LINE, // Horizontal Line.
51
+ PT_VERT_LINE, // Vertical Line.
52
+ PT_NOISE, // Lies outside of any column.
53
+ PT_COUNT
54
+ };
55
+
56
+ // Returns true if PolyBlockType is of horizontal line type
57
+ inline bool PTIsLineType(PolyBlockType type) {
58
+ return type == PT_HORZ_LINE || type == PT_VERT_LINE;
59
+ }
60
+ // Returns true if PolyBlockType is of image type
61
+ inline bool PTIsImageType(PolyBlockType type) {
62
+ return type == PT_FLOWING_IMAGE || type == PT_HEADING_IMAGE ||
63
+ type == PT_PULLOUT_IMAGE;
64
+ }
65
+ // Returns true if PolyBlockType is of text type
66
+ inline bool PTIsTextType(PolyBlockType type) {
67
+ return type == PT_FLOWING_TEXT || type == PT_HEADING_TEXT ||
68
+ type == PT_PULLOUT_TEXT || type == PT_TABLE ||
69
+ type == PT_VERTICAL_TEXT || type == PT_CAPTION_TEXT;
70
+ }
71
+
72
+ // String name for each block type. Keep in sync with PolyBlockType.
73
+ extern const char* kPolyBlockNames[];
74
+
75
+ namespace tesseract {
76
+ // +------------------+ Orientation Example:
77
+ // | 1 Aaaa Aaaa Aaaa | ====================
78
+ // | Aaa aa aaa aa | To left is a diagram of some (1) English and
79
+ // | aaaaaa A aa aaa. | (2) Chinese text and a (3) photo credit.
80
+ // | 2 |
81
+ // | ####### c c C | Upright Latin characters are represented as A and a.
82
+ // | ####### c c c | '<' represents a latin character rotated
83
+ // | < ####### c c c | anti-clockwise 90 degrees.
84
+ // | < ####### c c |
85
+ // | < ####### . c | Upright Chinese characters are represented C and c.
86
+ // | 3 ####### c |
87
+ // +------------------+ NOTA BENE: enum values here should match goodoc.proto
88
+
89
+ // If you orient your head so that "up" aligns with Orientation,
90
+ // then the characters will appear "right side up" and readable.
91
+ //
92
+ // In the example above, both the English and Chinese paragraphs are oriented
93
+ // so their "up" is the top of the page (page up). The photo credit is read
94
+ // with one's head turned leftward ("up" is to page left).
95
+ //
96
+ // The values of this enum match the convention of Tesseract's osdetect.h
97
+ enum Orientation {
98
+ ORIENTATION_PAGE_UP = 0,
99
+ ORIENTATION_PAGE_RIGHT = 1,
100
+ ORIENTATION_PAGE_DOWN = 2,
101
+ ORIENTATION_PAGE_LEFT = 3,
102
+ };
103
+
104
+ // The grapheme clusters within a line of text are laid out logically
105
+ // in this direction, judged when looking at the text line rotated so that
106
+ // its Orientation is "page up".
107
+ //
108
+ // For English text, the writing direction is left-to-right. For the
109
+ // Chinese text in the above example, the writing direction is top-to-bottom.
110
+ enum WritingDirection {
111
+ WRITING_DIRECTION_LEFT_TO_RIGHT = 0,
112
+ WRITING_DIRECTION_RIGHT_TO_LEFT = 1,
113
+ WRITING_DIRECTION_TOP_TO_BOTTOM = 2,
114
+ };
115
+
116
+ // The text lines are read in the given sequence.
117
+ //
118
+ // In English, the order is top-to-bottom.
119
+ // In Chinese, vertical text lines are read right-to-left. Mongolian is
120
+ // written in vertical columns top to bottom like Chinese, but the lines
121
+ // order left-to right.
122
+ //
123
+ // Note that only some combinations make sense. For example,
124
+ // WRITING_DIRECTION_LEFT_TO_RIGHT implies TEXTLINE_ORDER_TOP_TO_BOTTOM
125
+ enum TextlineOrder {
126
+ TEXTLINE_ORDER_LEFT_TO_RIGHT = 0,
127
+ TEXTLINE_ORDER_RIGHT_TO_LEFT = 1,
128
+ TEXTLINE_ORDER_TOP_TO_BOTTOM = 2,
129
+ };
130
+
131
+ // Possible modes for page layout analysis. These *must* be kept in order
132
+ // of decreasing amount of layout analysis to be done, except for OSD_ONLY,
133
+ // so that the inequality test macros below work.
134
+ enum PageSegMode {
135
+ PSM_OSD_ONLY, ///< Orientation and script detection only.
136
+ PSM_AUTO_OSD, ///< Automatic page segmentation with orientation and
137
+ ///< script detection. (OSD)
138
+ PSM_AUTO_ONLY, ///< Automatic page segmentation, but no OSD, or OCR.
139
+ PSM_AUTO, ///< Fully automatic page segmentation, but no OSD.
140
+ PSM_SINGLE_COLUMN, ///< Assume a single column of text of variable sizes.
141
+ PSM_SINGLE_BLOCK_VERT_TEXT, ///< Assume a single uniform block of vertically
142
+ ///< aligned text.
143
+ PSM_SINGLE_BLOCK, ///< Assume a single uniform block of text. (Default.)
144
+ PSM_SINGLE_LINE, ///< Treat the image as a single text line.
145
+ PSM_SINGLE_WORD, ///< Treat the image as a single word.
146
+ PSM_CIRCLE_WORD, ///< Treat the image as a single word in a circle.
147
+ PSM_SINGLE_CHAR, ///< Treat the image as a single character.
148
+
149
+ PSM_COUNT ///< Number of enum entries.
150
+ };
151
+
152
+ // Macros that act on a PageSegMode to determine whether components of
153
+ // layout analysis are enabled.
154
+ // *Depend critically on the order of elements of PageSegMode.*
155
+ #define PSM_OSD_ENABLED(pageseg_mode) ((pageseg_mode) <= PSM_AUTO_OSD)
156
+ #define PSM_COL_FIND_ENABLED(pageseg_mode) \
157
+ ((pageseg_mode) >= PSM_AUTO_OSD && (pageseg_mode) <= PSM_AUTO)
158
+ #define PSM_BLOCK_FIND_ENABLED(pageseg_mode) \
159
+ ((pageseg_mode) >= PSM_AUTO_OSD && (pageseg_mode) <= PSM_SINGLE_COLUMN)
160
+ #define PSM_LINE_FIND_ENABLED(pageseg_mode) \
161
+ ((pageseg_mode) >= PSM_AUTO_OSD && (pageseg_mode) <= PSM_SINGLE_BLOCK)
162
+ #define PSM_WORD_FIND_ENABLED(pageseg_mode) \
163
+ ((pageseg_mode) >= PSM_AUTO_OSD && (pageseg_mode) <= PSM_SINGLE_LINE)
164
+
165
+ // enum of the elements of the page hierarchy, used in ResultIterator
166
+ // to provide functions that operate on each level without having to
167
+ // have 5x as many functions.
168
+ // NOTE: At present RIL_PARA and RIL_BLOCK are equivalent as there is
169
+ // no paragraph internally yet.
170
+ // TODO(rays) Add paragraph detection.
171
+ enum PageIteratorLevel {
172
+ RIL_BLOCK, // Block of text/image/separator line.
173
+ RIL_PARA, // Paragraph within a block.
174
+ RIL_TEXTLINE, // Line within a paragraph.
175
+ RIL_WORD, // Word within a textline.
176
+ RIL_SYMBOL // Symbol/character within a word.
177
+ };
178
+
179
+ // When Tesseract/Cube is initialized we can choose to instantiate/load/run
180
+ // only the Tesseract part, only the Cube part or both along with the combiner.
181
+ // The preference of which engine to use is stored in tessedit_ocr_engine_mode.
182
+ //
183
+ // ATTENTION: When modifying this enum, please make sure to make the
184
+ // appropriate changes to all the enums mirroring it (e.g. OCREngine in
185
+ // cityblock/workflow/detection/detection_storage.proto). Such enums will
186
+ // mention the connection to OcrEngineMode in the comments.
187
+ enum OcrEngineMode {
188
+ OEM_TESSERACT_ONLY, // Run Tesseract only - fastest
189
+ OEM_CUBE_ONLY, // Run Cube only - better accuracy, but slower
190
+ OEM_TESSERACT_CUBE_COMBINED, // Run both and combine results - best accuracy
191
+ OEM_DEFAULT // Specify this mode when calling init_*(),
192
+ // to indicate that any of the above modes
193
+ // should be automatically inferred from the
194
+ // variables in the language-specific config,
195
+ // command-line configs, or if not specified
196
+ // in any of the above should be set to the
197
+ // default OEM_TESSERACT_ONLY.
198
+ };
199
+
200
+ } // namespace tesseract.
201
+
202
+ #endif // TESSERACT_CCSTRUCT_PUBLICTYPES_H__
@@ -0,0 +1,1238 @@
1
+ ///////////////////////////////////////////////////////////////////////
2
+ // File: tesscallback.h
3
+ // Description: classes and functions to replace pointer-to-functions
4
+ // Author: Samuel Charron
5
+ //
6
+ // (C) Copyright 2006, Google Inc.
7
+ // Licensed under the Apache License, Version 2.0 (the "License");
8
+ // you may not use this file except in compliance with the License.
9
+ // You may obtain a copy of the License at
10
+ // http://www.apache.org/licenses/LICENSE-2.0
11
+ // Unless required by applicable law or agreed to in writing, software
12
+ // distributed under the License is distributed on an "AS IS" BASIS,
13
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ // See the License for the specific language governing permissions and
15
+ // limitations under the License.
16
+ //
17
+ ///////////////////////////////////////////////////////////////////////
18
+
19
+ #ifndef _TESS_CALLBACK_SPECIALIZATIONS_H
20
+ #define _TESS_CALLBACK_SPECIALIZATIONS_H
21
+
22
+ #include "host.h" // For NULL.
23
+
24
+ struct TessCallbackUtils_ {
25
+ static void FailIsRepeatable(const char* name);
26
+ };
27
+
28
+
29
+ class TessClosure {
30
+ public:
31
+ virtual ~TessClosure() { }
32
+ virtual void Run() = 0;
33
+ };
34
+
35
+ template <class R>
36
+ class TessResultCallback {
37
+ public:
38
+ virtual ~TessResultCallback() { }
39
+ virtual R Run() = 0;
40
+ };
41
+
42
+ template <bool del, class R, class T>
43
+ class _ConstTessMemberResultCallback_0_0 : public TessResultCallback<R> {
44
+ public:
45
+ typedef TessResultCallback<R> base;
46
+ typedef R (T::*MemberSignature)() const;
47
+
48
+ private:
49
+ const T* object_;
50
+ MemberSignature member_;
51
+
52
+ public:
53
+ inline _ConstTessMemberResultCallback_0_0(
54
+ const T* object, MemberSignature member)
55
+ : object_(object),
56
+ member_(member) {
57
+ }
58
+
59
+ virtual R Run() {
60
+ if (!del) {
61
+ R result = (object_->*member_)();
62
+ return result;
63
+ } else {
64
+ R result = (object_->*member_)();
65
+ // zero out the pointer to ensure segfault if used again
66
+ member_ = NULL;
67
+ delete this;
68
+ return result;
69
+ }
70
+ }
71
+ };
72
+
73
+ template <bool del, class T>
74
+ class _ConstTessMemberResultCallback_0_0<del, void, T>
75
+ : public TessClosure {
76
+ public:
77
+ typedef TessClosure base;
78
+ typedef void (T::*MemberSignature)() const;
79
+
80
+ private:
81
+ const T* object_;
82
+ MemberSignature member_;
83
+
84
+ public:
85
+ inline _ConstTessMemberResultCallback_0_0(
86
+ const T* object, MemberSignature member)
87
+ : object_(object),
88
+ member_(member) {
89
+ }
90
+
91
+ virtual void Run() {
92
+ if (!del) {
93
+ (object_->*member_)();
94
+ } else {
95
+ (object_->*member_)();
96
+ // zero out the pointer to ensure segfault if used again
97
+ member_ = NULL;
98
+ delete this;
99
+ }
100
+ }
101
+ };
102
+
103
+ #ifndef SWIG
104
+ template <class T1, class T2, class R>
105
+ inline typename _ConstTessMemberResultCallback_0_0<true,R,T1>::base*
106
+ NewTessCallback(
107
+ const T1* obj, R (T2::*member)() const) {
108
+ return new _ConstTessMemberResultCallback_0_0<true,R,T1>(
109
+ obj, member);
110
+ }
111
+ #endif
112
+
113
+ #ifndef SWIG
114
+ template <class T1, class T2, class R>
115
+ inline typename _ConstTessMemberResultCallback_0_0<false,R,T1>::base*
116
+ NewPermanentTessCallback(
117
+ const T1* obj, R (T2::*member)() const) {
118
+ return new _ConstTessMemberResultCallback_0_0<false,R,T1>(
119
+ obj, member);
120
+ }
121
+ #endif
122
+
123
+ template <bool del, class R, class T>
124
+ class _TessMemberResultCallback_0_0 : public TessResultCallback<R> {
125
+ public:
126
+ typedef TessResultCallback<R> base;
127
+ typedef R (T::*MemberSignature)() ;
128
+
129
+ private:
130
+ T* object_;
131
+ MemberSignature member_;
132
+
133
+ public:
134
+ inline _TessMemberResultCallback_0_0(
135
+ T* object, MemberSignature member)
136
+ : object_(object),
137
+ member_(member) {
138
+ }
139
+
140
+ virtual R Run() {
141
+ if (!del) {
142
+ R result = (object_->*member_)();
143
+ return result;
144
+ } else {
145
+ R result = (object_->*member_)();
146
+ // zero out the pointer to ensure segfault if used again
147
+ member_ = NULL;
148
+ delete this;
149
+ return result;
150
+ }
151
+ }
152
+ };
153
+
154
+ template <bool del, class T>
155
+ class _TessMemberResultCallback_0_0<del, void, T>
156
+ : public TessClosure {
157
+ public:
158
+ typedef TessClosure base;
159
+ typedef void (T::*MemberSignature)() ;
160
+
161
+ private:
162
+ T* object_;
163
+ MemberSignature member_;
164
+
165
+ public:
166
+ inline _TessMemberResultCallback_0_0(
167
+ T* object, MemberSignature member)
168
+ : object_(object),
169
+ member_(member) {
170
+ }
171
+
172
+ virtual void Run() {
173
+ if (!del) {
174
+ (object_->*member_)();
175
+ } else {
176
+ (object_->*member_)();
177
+ // zero out the pointer to ensure segfault if used again
178
+ member_ = NULL;
179
+ delete this;
180
+ }
181
+ }
182
+ };
183
+
184
+ #ifndef SWIG
185
+ template <class T1, class T2, class R>
186
+ inline typename _TessMemberResultCallback_0_0<true,R,T1>::base*
187
+ NewTessCallback(
188
+ T1* obj, R (T2::*member)() ) {
189
+ return new _TessMemberResultCallback_0_0<true,R,T1>(
190
+ obj, member);
191
+ }
192
+ #endif
193
+
194
+ #ifndef SWIG
195
+ template <class T1, class T2, class R>
196
+ inline typename _TessMemberResultCallback_0_0<false,R,T1>::base*
197
+ NewPermanentTessCallback(
198
+ T1* obj, R (T2::*member)() ) {
199
+ return new _TessMemberResultCallback_0_0<false,R,T1>(
200
+ obj, member);
201
+ }
202
+ #endif
203
+
204
+ template <bool del, class R>
205
+ class _TessFunctionResultCallback_0_0 : public TessResultCallback<R> {
206
+ public:
207
+ typedef TessResultCallback<R> base;
208
+ typedef R (*FunctionSignature)();
209
+
210
+ private:
211
+ FunctionSignature function_;
212
+
213
+ public:
214
+ inline _TessFunctionResultCallback_0_0(
215
+ FunctionSignature function)
216
+ : function_(function) {
217
+ }
218
+
219
+ virtual R Run() {
220
+ if (!del) {
221
+ R result = (*function_)();
222
+ return result;
223
+ } else {
224
+ R result = (*function_)();
225
+ // zero out the pointer to ensure segfault if used again
226
+ function_ = NULL;
227
+ delete this;
228
+ return result;
229
+ }
230
+ }
231
+ };
232
+
233
+ template <bool del>
234
+ class _TessFunctionResultCallback_0_0<del, void>
235
+ : public TessClosure {
236
+ public:
237
+ typedef TessClosure base;
238
+ typedef void (*FunctionSignature)();
239
+
240
+ private:
241
+ FunctionSignature function_;
242
+
243
+ public:
244
+ inline _TessFunctionResultCallback_0_0(
245
+ FunctionSignature function)
246
+ : function_(function) {
247
+ }
248
+
249
+ virtual void Run() {
250
+ if (!del) {
251
+ (*function_)();
252
+ } else {
253
+ (*function_)();
254
+ // zero out the pointer to ensure segfault if used again
255
+ function_ = NULL;
256
+ delete this;
257
+ }
258
+ }
259
+ };
260
+
261
+ template <class R>
262
+ inline typename _TessFunctionResultCallback_0_0<true,R>::base*
263
+ NewTessCallback(R (*function)()) {
264
+ return new _TessFunctionResultCallback_0_0<true,R>(function);
265
+ }
266
+
267
+ template <class R>
268
+ inline typename _TessFunctionResultCallback_0_0<false,R>::base*
269
+ NewPermanentTessCallback(R (*function)()) {
270
+ return new _TessFunctionResultCallback_0_0<false,R>(function);
271
+ }
272
+
273
+ template <class A1>
274
+ class TessCallback1 {
275
+ public:
276
+ virtual ~TessCallback1() { }
277
+ virtual void Run(A1) = 0;
278
+ };
279
+
280
+ template <class R, class A1>
281
+ class TessResultCallback1 {
282
+ public:
283
+ virtual ~TessResultCallback1() { }
284
+ virtual R Run(A1) = 0;
285
+ };
286
+
287
+ template <bool del, class R, class T, class A1>
288
+ class _ConstTessMemberResultCallback_0_1 : public TessResultCallback1<R,A1> {
289
+ public:
290
+ typedef TessResultCallback1<R,A1> base;
291
+ typedef R (T::*MemberSignature)(A1) const;
292
+
293
+ private:
294
+ const T* object_;
295
+ MemberSignature member_;
296
+
297
+ public:
298
+ inline _ConstTessMemberResultCallback_0_1(
299
+ const T* object, MemberSignature member)
300
+ : object_(object),
301
+ member_(member) {
302
+ }
303
+
304
+ virtual R Run(A1 a1) {
305
+ if (!del) {
306
+ R result = (object_->*member_)(a1);
307
+ return result;
308
+ } else {
309
+ R result = (object_->*member_)(a1);
310
+ // zero out the pointer to ensure segfault if used again
311
+ member_ = NULL;
312
+ delete this;
313
+ return result;
314
+ }
315
+ }
316
+ };
317
+
318
+ template <bool del, class T, class A1>
319
+ class _ConstTessMemberResultCallback_0_1<del, void, T, A1>
320
+ : public TessCallback1<A1> {
321
+ public:
322
+ typedef TessCallback1<A1> base;
323
+ typedef void (T::*MemberSignature)(A1) const;
324
+
325
+ private:
326
+ const T* object_;
327
+ MemberSignature member_;
328
+
329
+ public:
330
+ inline _ConstTessMemberResultCallback_0_1(
331
+ const T* object, MemberSignature member)
332
+ : object_(object),
333
+ member_(member) {
334
+ }
335
+
336
+ virtual void Run(A1 a1) {
337
+ if (!del) {
338
+ (object_->*member_)(a1);
339
+ } else {
340
+ (object_->*member_)(a1);
341
+ // zero out the pointer to ensure segfault if used again
342
+ member_ = NULL;
343
+ delete this;
344
+ }
345
+ }
346
+ };
347
+
348
+ #ifndef SWIG
349
+ template <class T1, class T2, class R, class A1>
350
+ inline typename _ConstTessMemberResultCallback_0_1<true,R,T1,A1>::base*
351
+ NewTessCallback(
352
+ const T1* obj, R (T2::*member)(A1) const) {
353
+ return new _ConstTessMemberResultCallback_0_1<true,R,T1,A1>(
354
+ obj, member);
355
+ }
356
+ #endif
357
+
358
+ #ifndef SWIG
359
+ template <class T1, class T2, class R, class A1>
360
+ inline typename _ConstTessMemberResultCallback_0_1<false,R,T1,A1>::base*
361
+ NewPermanentTessCallback(
362
+ const T1* obj, R (T2::*member)(A1) const) {
363
+ return new _ConstTessMemberResultCallback_0_1<false,R,T1,A1>(
364
+ obj, member);
365
+ }
366
+ #endif
367
+
368
+ template <bool del, class R, class T, class A1>
369
+ class _TessMemberResultCallback_0_1 : public TessResultCallback1<R,A1> {
370
+ public:
371
+ typedef TessResultCallback1<R,A1> base;
372
+ typedef R (T::*MemberSignature)(A1) ;
373
+
374
+ private:
375
+ T* object_;
376
+ MemberSignature member_;
377
+
378
+ public:
379
+ inline _TessMemberResultCallback_0_1(
380
+ T* object, MemberSignature member)
381
+ : object_(object),
382
+ member_(member) {
383
+ }
384
+
385
+ virtual R Run(A1 a1) {
386
+ if (!del) {
387
+ R result = (object_->*member_)(a1);
388
+ return result;
389
+ } else {
390
+ R result = (object_->*member_)(a1);
391
+ // zero out the pointer to ensure segfault if used again
392
+ member_ = NULL;
393
+ delete this;
394
+ return result;
395
+ }
396
+ }
397
+ };
398
+
399
+ template <bool del, class T, class A1>
400
+ class _TessMemberResultCallback_0_1<del, void, T, A1>
401
+ : public TessCallback1<A1> {
402
+ public:
403
+ typedef TessCallback1<A1> base;
404
+ typedef void (T::*MemberSignature)(A1) ;
405
+
406
+ private:
407
+ T* object_;
408
+ MemberSignature member_;
409
+
410
+ public:
411
+ inline _TessMemberResultCallback_0_1(
412
+ T* object, MemberSignature member)
413
+ : object_(object),
414
+ member_(member) {
415
+ }
416
+
417
+ virtual void Run(A1 a1) {
418
+ if (!del) {
419
+ (object_->*member_)(a1);
420
+ } else {
421
+ (object_->*member_)(a1);
422
+ // zero out the pointer to ensure segfault if used again
423
+ member_ = NULL;
424
+ delete this;
425
+ }
426
+ }
427
+ };
428
+
429
+ #ifndef SWIG
430
+ template <class T1, class T2, class R, class A1>
431
+ inline typename _TessMemberResultCallback_0_1<true,R,T1,A1>::base*
432
+ NewTessCallback(
433
+ T1* obj, R (T2::*member)(A1) ) {
434
+ return new _TessMemberResultCallback_0_1<true,R,T1,A1>(
435
+ obj, member);
436
+ }
437
+ #endif
438
+
439
+ #ifndef SWIG
440
+ template <class T1, class T2, class R, class A1>
441
+ inline typename _TessMemberResultCallback_0_1<false,R,T1,A1>::base*
442
+ NewPermanentTessCallback(
443
+ T1* obj, R (T2::*member)(A1) ) {
444
+ return new _TessMemberResultCallback_0_1<false,R,T1,A1>(
445
+ obj, member);
446
+ }
447
+ #endif
448
+
449
+ template <bool del, class R, class A1>
450
+ class _TessFunctionResultCallback_0_1 : public TessResultCallback1<R,A1> {
451
+ public:
452
+ typedef TessResultCallback1<R,A1> base;
453
+ typedef R (*FunctionSignature)(A1);
454
+
455
+ private:
456
+ FunctionSignature function_;
457
+
458
+ public:
459
+ inline _TessFunctionResultCallback_0_1(
460
+ FunctionSignature function)
461
+ : function_(function) {
462
+ }
463
+
464
+ virtual R Run(A1 a1) {
465
+ if (!del) {
466
+ R result = (*function_)(a1);
467
+ return result;
468
+ } else {
469
+ R result = (*function_)(a1);
470
+ // zero out the pointer to ensure segfault if used again
471
+ function_ = NULL;
472
+ delete this;
473
+ return result;
474
+ }
475
+ }
476
+ };
477
+
478
+ template <bool del, class A1>
479
+ class _TessFunctionResultCallback_0_1<del, void, A1>
480
+ : public TessCallback1<A1> {
481
+ public:
482
+ typedef TessCallback1<A1> base;
483
+ typedef void (*FunctionSignature)(A1);
484
+
485
+ private:
486
+ FunctionSignature function_;
487
+
488
+ public:
489
+ inline _TessFunctionResultCallback_0_1(
490
+ FunctionSignature function)
491
+ : function_(function) {
492
+ }
493
+
494
+ virtual void Run(A1 a1) {
495
+ if (!del) {
496
+ (*function_)(a1);
497
+ } else {
498
+ (*function_)(a1);
499
+ // zero out the pointer to ensure segfault if used again
500
+ function_ = NULL;
501
+ delete this;
502
+ }
503
+ }
504
+ };
505
+
506
+ template <class R, class A1>
507
+ inline typename _TessFunctionResultCallback_0_1<true,R,A1>::base*
508
+ NewTessCallback(R (*function)(A1)) {
509
+ return new _TessFunctionResultCallback_0_1<true,R,A1>(function);
510
+ }
511
+
512
+ template <class R, class A1>
513
+ inline typename _TessFunctionResultCallback_0_1<false,R,A1>::base*
514
+ NewPermanentTessCallback(R (*function)(A1)) {
515
+ return new _TessFunctionResultCallback_0_1<false,R,A1>(function);
516
+ }
517
+
518
+ template <class A1,class A2>
519
+ class TessCallback2 {
520
+ public:
521
+ virtual ~TessCallback2() { }
522
+ virtual void Run(A1,A2) = 0;
523
+ };
524
+
525
+ template <class R, class A1,class A2>
526
+ class TessResultCallback2 {
527
+ public:
528
+ virtual ~TessResultCallback2() { }
529
+ virtual R Run(A1,A2) = 0;
530
+ };
531
+
532
+ template <bool del, class R, class T, class A1, class A2>
533
+ class _ConstTessMemberResultCallback_0_2 : public TessResultCallback2<R,A1,A2> {
534
+ public:
535
+ typedef TessResultCallback2<R,A1,A2> base;
536
+ typedef R (T::*MemberSignature)(A1,A2) const;
537
+
538
+ private:
539
+ const T* object_;
540
+ MemberSignature member_;
541
+
542
+ public:
543
+ inline _ConstTessMemberResultCallback_0_2(
544
+ const T* object, MemberSignature member)
545
+ : object_(object),
546
+ member_(member) {
547
+ }
548
+
549
+ virtual R Run(A1 a1,A2 a2) {
550
+ if (!del) {
551
+ R result = (object_->*member_)(a1,a2);
552
+ return result;
553
+ } else {
554
+ R result = (object_->*member_)(a1,a2);
555
+ // zero out the pointer to ensure segfault if used again
556
+ member_ = NULL;
557
+ delete this;
558
+ return result;
559
+ }
560
+ }
561
+ };
562
+
563
+ template <bool del, class T, class A1, class A2>
564
+ class _ConstTessMemberResultCallback_0_2<del, void, T, A1, A2>
565
+ : public TessCallback2<A1,A2> {
566
+ public:
567
+ typedef TessCallback2<A1,A2> base;
568
+ typedef void (T::*MemberSignature)(A1,A2) const;
569
+
570
+ private:
571
+ const T* object_;
572
+ MemberSignature member_;
573
+
574
+ public:
575
+ inline _ConstTessMemberResultCallback_0_2(
576
+ const T* object, MemberSignature member)
577
+ : object_(object),
578
+ member_(member) {
579
+ }
580
+
581
+ virtual void Run(A1 a1,A2 a2) {
582
+ if (!del) {
583
+ (object_->*member_)(a1,a2);
584
+ } else {
585
+ (object_->*member_)(a1,a2);
586
+ // zero out the pointer to ensure segfault if used again
587
+ member_ = NULL;
588
+ delete this;
589
+ }
590
+ }
591
+ };
592
+
593
+ #ifndef SWIG
594
+ template <class T1, class T2, class R, class A1, class A2>
595
+ inline typename _ConstTessMemberResultCallback_0_2<true,R,T1,A1,A2>::base*
596
+ NewTessCallback(
597
+ const T1* obj, R (T2::*member)(A1,A2) const) {
598
+ return new _ConstTessMemberResultCallback_0_2<true,R,T1,A1,A2>(
599
+ obj, member);
600
+ }
601
+ #endif
602
+
603
+ #ifndef SWIG
604
+ template <class T1, class T2, class R, class A1, class A2>
605
+ inline typename _ConstTessMemberResultCallback_0_2<false,R,T1,A1,A2>::base*
606
+ NewPermanentTessCallback(
607
+ const T1* obj, R (T2::*member)(A1,A2) const) {
608
+ return new _ConstTessMemberResultCallback_0_2<false,R,T1,A1,A2>(
609
+ obj, member);
610
+ }
611
+ #endif
612
+
613
+ template <bool del, class R, class T, class A1, class A2>
614
+ class _TessMemberResultCallback_0_2 : public TessResultCallback2<R,A1,A2> {
615
+ public:
616
+ typedef TessResultCallback2<R,A1,A2> base;
617
+ typedef R (T::*MemberSignature)(A1,A2) ;
618
+
619
+ private:
620
+ T* object_;
621
+ MemberSignature member_;
622
+
623
+ public:
624
+ inline _TessMemberResultCallback_0_2(
625
+ T* object, MemberSignature member)
626
+ : object_(object),
627
+ member_(member) {
628
+ }
629
+
630
+ virtual R Run(A1 a1,A2 a2) {
631
+ if (!del) {
632
+ R result = (object_->*member_)(a1,a2);
633
+ return result;
634
+ } else {
635
+ R result = (object_->*member_)(a1,a2);
636
+ // zero out the pointer to ensure segfault if used again
637
+ member_ = NULL;
638
+ delete this;
639
+ return result;
640
+ }
641
+ }
642
+ };
643
+
644
+ template <bool del, class T, class A1, class A2>
645
+ class _TessMemberResultCallback_0_2<del, void, T, A1, A2>
646
+ : public TessCallback2<A1,A2> {
647
+ public:
648
+ typedef TessCallback2<A1,A2> base;
649
+ typedef void (T::*MemberSignature)(A1,A2) ;
650
+
651
+ private:
652
+ T* object_;
653
+ MemberSignature member_;
654
+
655
+ public:
656
+ inline _TessMemberResultCallback_0_2(
657
+ T* object, MemberSignature member)
658
+ : object_(object),
659
+ member_(member) {
660
+ }
661
+
662
+ virtual void Run(A1 a1,A2 a2) {
663
+ if (!del) {
664
+ (object_->*member_)(a1,a2);
665
+ } else {
666
+ (object_->*member_)(a1,a2);
667
+ // zero out the pointer to ensure segfault if used again
668
+ member_ = NULL;
669
+ delete this;
670
+ }
671
+ }
672
+ };
673
+
674
+ #ifndef SWIG
675
+ template <class T1, class T2, class R, class A1, class A2>
676
+ inline typename _TessMemberResultCallback_0_2<true,R,T1,A1,A2>::base*
677
+ NewTessCallback(
678
+ T1* obj, R (T2::*member)(A1,A2) ) {
679
+ return new _TessMemberResultCallback_0_2<true,R,T1,A1,A2>(
680
+ obj, member);
681
+ }
682
+ #endif
683
+
684
+ #ifndef SWIG
685
+ template <class T1, class T2, class R, class A1, class A2>
686
+ inline typename _TessMemberResultCallback_0_2<false,R,T1,A1,A2>::base*
687
+ NewPermanentTessCallback(
688
+ T1* obj, R (T2::*member)(A1,A2) ) {
689
+ return new _TessMemberResultCallback_0_2<false,R,T1,A1,A2>(
690
+ obj, member);
691
+ }
692
+ #endif
693
+
694
+ template <bool del, class R, class A1, class A2>
695
+ class _TessFunctionResultCallback_0_2 : public TessResultCallback2<R,A1,A2> {
696
+ public:
697
+ typedef TessResultCallback2<R,A1,A2> base;
698
+ typedef R (*FunctionSignature)(A1,A2);
699
+
700
+ private:
701
+ FunctionSignature function_;
702
+
703
+ public:
704
+ inline _TessFunctionResultCallback_0_2(
705
+ FunctionSignature function)
706
+ : function_(function) {
707
+ }
708
+
709
+ virtual R Run(A1 a1,A2 a2) {
710
+ if (!del) {
711
+ R result = (*function_)(a1,a2);
712
+ return result;
713
+ } else {
714
+ R result = (*function_)(a1,a2);
715
+ // zero out the pointer to ensure segfault if used again
716
+ function_ = NULL;
717
+ delete this;
718
+ return result;
719
+ }
720
+ }
721
+ };
722
+
723
+ template <bool del, class A1, class A2>
724
+ class _TessFunctionResultCallback_0_2<del, void, A1, A2>
725
+ : public TessCallback2<A1,A2> {
726
+ public:
727
+ typedef TessCallback2<A1,A2> base;
728
+ typedef void (*FunctionSignature)(A1,A2);
729
+
730
+ private:
731
+ FunctionSignature function_;
732
+
733
+ public:
734
+ inline _TessFunctionResultCallback_0_2(
735
+ FunctionSignature function)
736
+ : function_(function) {
737
+ }
738
+
739
+ virtual void Run(A1 a1,A2 a2) {
740
+ if (!del) {
741
+ (*function_)(a1,a2);
742
+ } else {
743
+ (*function_)(a1,a2);
744
+ // zero out the pointer to ensure segfault if used again
745
+ function_ = NULL;
746
+ delete this;
747
+ }
748
+ }
749
+ };
750
+
751
+ template <class R, class A1, class A2>
752
+ inline typename _TessFunctionResultCallback_0_2<true,R,A1,A2>::base*
753
+ NewTessCallback(R (*function)(A1,A2)) {
754
+ return new _TessFunctionResultCallback_0_2<true,R,A1,A2>(function);
755
+ }
756
+
757
+ template <class R, class A1, class A2>
758
+ inline typename _TessFunctionResultCallback_0_2<false,R,A1,A2>::base*
759
+ NewPermanentTessCallback(R (*function)(A1,A2)) {
760
+ return new _TessFunctionResultCallback_0_2<false,R,A1,A2>(function);
761
+ }
762
+
763
+ template <class A1,class A2,class A3>
764
+ class TessCallback3 {
765
+ public:
766
+ virtual ~TessCallback3() { }
767
+ virtual void Run(A1,A2,A3) = 0;
768
+ };
769
+
770
+ template <class R, class A1,class A2,class A3>
771
+ class TessResultCallback3 {
772
+ public:
773
+ virtual ~TessResultCallback3() { }
774
+ virtual R Run(A1,A2,A3) = 0;
775
+ };
776
+
777
+ template <bool del, class R, class T, class A1, class A2, class A3>
778
+ class _ConstTessMemberResultCallback_0_3 : public TessResultCallback3<R,A1,A2,A3> {
779
+ public:
780
+ typedef TessResultCallback3<R,A1,A2,A3> base;
781
+ typedef R (T::*MemberSignature)(A1,A2,A3) const;
782
+
783
+ private:
784
+ const T* object_;
785
+ MemberSignature member_;
786
+
787
+ public:
788
+ inline _ConstTessMemberResultCallback_0_3(
789
+ const T* object, MemberSignature member)
790
+ : object_(object),
791
+ member_(member) {
792
+ }
793
+
794
+ virtual R Run(A1 a1,A2 a2,A3 a3) {
795
+ if (!del) {
796
+ R result = (object_->*member_)(a1,a2,a3);
797
+ return result;
798
+ } else {
799
+ R result = (object_->*member_)(a1,a2,a3);
800
+ // zero out the pointer to ensure segfault if used again
801
+ member_ = NULL;
802
+ delete this;
803
+ return result;
804
+ }
805
+ }
806
+ };
807
+
808
+ template <bool del, class T, class A1, class A2, class A3>
809
+ class _ConstTessMemberResultCallback_0_3<del, void, T, A1, A2, A3>
810
+ : public TessCallback3<A1,A2,A3> {
811
+ public:
812
+ typedef TessCallback3<A1,A2,A3> base;
813
+ typedef void (T::*MemberSignature)(A1,A2,A3) const;
814
+
815
+ private:
816
+ const T* object_;
817
+ MemberSignature member_;
818
+
819
+ public:
820
+ inline _ConstTessMemberResultCallback_0_3(
821
+ const T* object, MemberSignature member)
822
+ : object_(object),
823
+ member_(member) {
824
+ }
825
+
826
+ virtual void Run(A1 a1,A2 a2,A3 a3) {
827
+ if (!del) {
828
+ (object_->*member_)(a1,a2,a3);
829
+ } else {
830
+ (object_->*member_)(a1,a2,a3);
831
+ // zero out the pointer to ensure segfault if used again
832
+ member_ = NULL;
833
+ delete this;
834
+ }
835
+ }
836
+ };
837
+
838
+ #ifndef SWIG
839
+ template <class T1, class T2, class R, class A1, class A2, class A3>
840
+ inline typename _ConstTessMemberResultCallback_0_3<true,R,T1,A1,A2,A3>::base*
841
+ NewTessCallback(
842
+ const T1* obj, R (T2::*member)(A1,A2,A3) const) {
843
+ return new _ConstTessMemberResultCallback_0_3<true,R,T1,A1,A2,A3>(
844
+ obj, member);
845
+ }
846
+ #endif
847
+
848
+ #ifndef SWIG
849
+ template <class T1, class T2, class R, class A1, class A2, class A3>
850
+ inline typename _ConstTessMemberResultCallback_0_3<false,R,T1,A1,A2,A3>::base*
851
+ NewPermanentTessCallback(
852
+ const T1* obj, R (T2::*member)(A1,A2,A3) const) {
853
+ return new _ConstTessMemberResultCallback_0_3<false,R,T1,A1,A2,A3>(
854
+ obj, member);
855
+ }
856
+ #endif
857
+
858
+ template <bool del, class R, class T, class A1, class A2, class A3>
859
+ class _TessMemberResultCallback_0_3 : public TessResultCallback3<R,A1,A2,A3> {
860
+ public:
861
+ typedef TessResultCallback3<R,A1,A2,A3> base;
862
+ typedef R (T::*MemberSignature)(A1,A2,A3) ;
863
+
864
+ private:
865
+ T* object_;
866
+ MemberSignature member_;
867
+
868
+ public:
869
+ inline _TessMemberResultCallback_0_3(
870
+ T* object, MemberSignature member)
871
+ : object_(object),
872
+ member_(member) {
873
+ }
874
+
875
+ virtual R Run(A1 a1,A2 a2,A3 a3) {
876
+ if (!del) {
877
+ R result = (object_->*member_)(a1,a2,a3);
878
+ return result;
879
+ } else {
880
+ R result = (object_->*member_)(a1,a2,a3);
881
+ // zero out the pointer to ensure segfault if used again
882
+ member_ = NULL;
883
+ delete this;
884
+ return result;
885
+ }
886
+ }
887
+ };
888
+
889
+ template <bool del, class T, class A1, class A2, class A3>
890
+ class _TessMemberResultCallback_0_3<del, void, T, A1, A2, A3>
891
+ : public TessCallback3<A1,A2,A3> {
892
+ public:
893
+ typedef TessCallback3<A1,A2,A3> base;
894
+ typedef void (T::*MemberSignature)(A1,A2,A3) ;
895
+
896
+ private:
897
+ T* object_;
898
+ MemberSignature member_;
899
+
900
+ public:
901
+ inline _TessMemberResultCallback_0_3(
902
+ T* object, MemberSignature member)
903
+ : object_(object),
904
+ member_(member) {
905
+ }
906
+
907
+ virtual void Run(A1 a1,A2 a2,A3 a3) {
908
+ if (!del) {
909
+ (object_->*member_)(a1,a2,a3);
910
+ } else {
911
+ (object_->*member_)(a1,a2,a3);
912
+ // zero out the pointer to ensure segfault if used again
913
+ member_ = NULL;
914
+ delete this;
915
+ }
916
+ }
917
+ };
918
+
919
+ #ifndef SWIG
920
+ template <class T1, class T2, class R, class A1, class A2, class A3>
921
+ inline typename _TessMemberResultCallback_0_3<true,R,T1,A1,A2,A3>::base*
922
+ NewTessCallback(
923
+ T1* obj, R (T2::*member)(A1,A2,A3) ) {
924
+ return new _TessMemberResultCallback_0_3<true,R,T1,A1,A2,A3>(
925
+ obj, member);
926
+ }
927
+ #endif
928
+
929
+ #ifndef SWIG
930
+ template <class T1, class T2, class R, class A1, class A2, class A3>
931
+ inline typename _TessMemberResultCallback_0_3<false,R,T1,A1,A2,A3>::base*
932
+ NewPermanentTessCallback(
933
+ T1* obj, R (T2::*member)(A1,A2,A3) ) {
934
+ return new _TessMemberResultCallback_0_3<false,R,T1,A1,A2,A3>(
935
+ obj, member);
936
+ }
937
+ #endif
938
+
939
+ template <bool del, class R, class A1, class A2, class A3>
940
+ class _TessFunctionResultCallback_0_3 : public TessResultCallback3<R,A1,A2,A3> {
941
+ public:
942
+ typedef TessResultCallback3<R,A1,A2,A3> base;
943
+ typedef R (*FunctionSignature)(A1,A2,A3);
944
+
945
+ private:
946
+ FunctionSignature function_;
947
+
948
+ public:
949
+ inline _TessFunctionResultCallback_0_3(
950
+ FunctionSignature function)
951
+ : function_(function) {
952
+ }
953
+
954
+ virtual R Run(A1 a1,A2 a2,A3 a3) {
955
+ if (!del) {
956
+ R result = (*function_)(a1,a2,a3);
957
+ return result;
958
+ } else {
959
+ R result = (*function_)(a1,a2,a3);
960
+ // zero out the pointer to ensure segfault if used again
961
+ function_ = NULL;
962
+ delete this;
963
+ return result;
964
+ }
965
+ }
966
+ };
967
+
968
+ template <bool del, class A1, class A2, class A3>
969
+ class _TessFunctionResultCallback_0_3<del, void, A1, A2, A3>
970
+ : public TessCallback3<A1,A2,A3> {
971
+ public:
972
+ typedef TessCallback3<A1,A2,A3> base;
973
+ typedef void (*FunctionSignature)(A1,A2,A3);
974
+
975
+ private:
976
+ FunctionSignature function_;
977
+
978
+ public:
979
+ inline _TessFunctionResultCallback_0_3(
980
+ FunctionSignature function)
981
+ : function_(function) {
982
+ }
983
+
984
+ virtual void Run(A1 a1,A2 a2,A3 a3) {
985
+ if (!del) {
986
+ (*function_)(a1,a2,a3);
987
+ } else {
988
+ (*function_)(a1,a2,a3);
989
+ // zero out the pointer to ensure segfault if used again
990
+ function_ = NULL;
991
+ delete this;
992
+ }
993
+ }
994
+ };
995
+
996
+ template <class R, class A1, class A2, class A3>
997
+ inline typename _TessFunctionResultCallback_0_3<true,R,A1,A2,A3>::base*
998
+ NewTessCallback(R (*function)(A1,A2,A3)) {
999
+ return new _TessFunctionResultCallback_0_3<true,R,A1,A2,A3>(function);
1000
+ }
1001
+
1002
+ template <class R, class A1, class A2, class A3>
1003
+ inline typename _TessFunctionResultCallback_0_3<false,R,A1,A2,A3>::base*
1004
+ NewPermanentTessCallback(R (*function)(A1,A2,A3)) {
1005
+ return new _TessFunctionResultCallback_0_3<false,R,A1,A2,A3>(function);
1006
+ }
1007
+
1008
+ // Specified by TR1 [4.7.2] Reference modifications.
1009
+ template <class T> struct remove_reference;
1010
+ template<typename T> struct remove_reference { typedef T type; };
1011
+ template<typename T> struct remove_reference<T&> { typedef T type; };
1012
+
1013
+ // Identity<T>::type is a typedef of T. Useful for preventing the
1014
+ // compiler from inferring the type of an argument in templates.
1015
+ template <typename T>
1016
+ struct Identity {
1017
+ typedef T type;
1018
+ };
1019
+
1020
+ template <bool del, class R, class T, class P1, class A1, class A2>
1021
+ class _ConstTessMemberResultCallback_1_2
1022
+ : public TessResultCallback2<R,A1,A2> {
1023
+ public:
1024
+ typedef TessResultCallback2<R,A1,A2> base;
1025
+ typedef R (T::*MemberSignature)(P1,A1,A2) const;
1026
+
1027
+ private:
1028
+ T* object_;
1029
+ MemberSignature member_;
1030
+ typename remove_reference<P1>::type p1_;
1031
+
1032
+ public:
1033
+ inline _ConstTessMemberResultCallback_1_2(T* object,
1034
+ MemberSignature member, P1 p1)
1035
+ : object_(object), member_(member), p1_(p1) { }
1036
+
1037
+ virtual R Run(A1 a1, A2 a2) {
1038
+ if (!del) {
1039
+ R result = (object_->*member_)(p1_,a1,a2);
1040
+ return result;
1041
+ } else {
1042
+ R result = (object_->*member_)(p1_,a1,a2);
1043
+ // zero out the pointer to ensure segfault if used again
1044
+ member_ = NULL;
1045
+ delete this;
1046
+ return result;
1047
+ }
1048
+ }
1049
+ };
1050
+
1051
+ template <bool del, class T, class P1, class A1, class A2>
1052
+ class _ConstTessMemberResultCallback_1_2<del, void, T, P1, A1, A2>
1053
+ : public TessCallback2<A1,A2> {
1054
+ public:
1055
+ typedef TessCallback2<A1,A2> base;
1056
+ typedef void (T::*MemberSignature)(P1,A1,A2) const;
1057
+
1058
+ private:
1059
+ T* object_;
1060
+ MemberSignature member_;
1061
+ typename remove_reference<P1>::type p1_;
1062
+
1063
+ public:
1064
+ inline _ConstTessMemberResultCallback_1_2(T* object,
1065
+ MemberSignature member, P1 p1)
1066
+ : object_(object), member_(member), p1_(p1) { }
1067
+
1068
+ virtual void Run(A1 a1, A2 a2) {
1069
+ if (!del) {
1070
+ (object_->*member_)(p1_,a1,a2);
1071
+ } else {
1072
+ (object_->*member_)(p1_,a1,a2);
1073
+ // zero out the pointer to ensure segfault if used again
1074
+ member_ = NULL;
1075
+ delete this;
1076
+ }
1077
+ }
1078
+ };
1079
+
1080
+ #ifndef SWIG
1081
+ template <class T1, class T2, class R, class P1, class A1, class A2>
1082
+ inline typename _ConstTessMemberResultCallback_1_2<true,R,T1,P1,A1,A2>::base*
1083
+ NewTessCallback( T1* obj, R (T2::*member)(P1,A1,A2) , typename Identity<P1>::type p1) {
1084
+ return new _ConstTessMemberResultCallback_1_2<true,R,T1,P1,A1,A2>(obj, member, p1);
1085
+ }
1086
+ #endif
1087
+
1088
+ #ifndef SWIG
1089
+ template <class T1, class T2, class R, class P1, class A1, class A2>
1090
+ inline typename _ConstTessMemberResultCallback_1_2<false,R,T1,P1,A1,A2>::base*
1091
+ NewPermanentTessCallback( T1* obj, R (T2::*member)(P1,A1,A2) , typename Identity<P1>::type p1) {
1092
+ return new _ConstTessMemberResultCallback_1_2<false,R,T1,P1,A1,A2>(obj, member, p1);
1093
+ }
1094
+ #endif
1095
+
1096
+ template <bool del, class R, class T, class P1, class A1, class A2>
1097
+ class _TessMemberResultCallback_1_2 : public TessResultCallback2<R,A1,A2> {
1098
+ public:
1099
+ typedef TessResultCallback2<R,A1,A2> base;
1100
+ typedef R (T::*MemberSignature)(P1,A1,A2) ;
1101
+
1102
+ private:
1103
+ T* object_;
1104
+ MemberSignature member_;
1105
+ typename remove_reference<P1>::type p1_;
1106
+
1107
+ public:
1108
+ inline _TessMemberResultCallback_1_2(T* object,
1109
+ MemberSignature member, P1 p1)
1110
+ : object_(object), member_(member), p1_(p1) { }
1111
+
1112
+ virtual R Run(A1 a1, A2 a2) {
1113
+ if (!del) {
1114
+ R result = (object_->*member_)(p1_,a1,a2);
1115
+ return result;
1116
+ } else {
1117
+ R result = (object_->*member_)(p1_,a1,a2);
1118
+ // zero out the pointer to ensure segfault if used again
1119
+ member_ = NULL;
1120
+ delete this;
1121
+ return result;
1122
+ }
1123
+ }
1124
+ };
1125
+
1126
+ template <bool del, class T, class P1, class A1, class A2>
1127
+ class _TessMemberResultCallback_1_2<del, void, T, P1, A1, A2>
1128
+ : public TessCallback2<A1,A2> {
1129
+ public:
1130
+ typedef TessCallback2<A1,A2> base;
1131
+ typedef void (T::*MemberSignature)(P1,A1,A2) ;
1132
+
1133
+ private:
1134
+ T* object_;
1135
+ MemberSignature member_;
1136
+ typename remove_reference<P1>::type p1_;
1137
+
1138
+ public:
1139
+ inline _TessMemberResultCallback_1_2(T* object,
1140
+ MemberSignature member, P1 p1)
1141
+ : object_(object), member_(member), p1_(p1) { }
1142
+
1143
+ virtual void Run(A1 a1, A2 a2) {
1144
+ if (!del) {
1145
+ (object_->*member_)(p1_,a1,a2);
1146
+ } else {
1147
+ (object_->*member_)(p1_,a1,a2);
1148
+ // zero out the pointer to ensure segfault if used again
1149
+ member_ = NULL;
1150
+ delete this;
1151
+ }
1152
+ }
1153
+ };
1154
+
1155
+ #ifndef SWIG
1156
+ template <class T1, class T2, class R, class P1, class A1, class A2>
1157
+ inline typename _TessMemberResultCallback_1_2<true,R,T1,P1,A1,A2>::base*
1158
+ NewTessCallback( T1* obj, R (T2::*member)(P1,A1,A2) , typename Identity<P1>::type p1) {
1159
+ return new _TessMemberResultCallback_1_2<true,R,T1,P1,A1,A2>(obj, member, p1);
1160
+ }
1161
+ #endif
1162
+
1163
+ #ifndef SWIG
1164
+ template <class T1, class T2, class R, class P1, class A1, class A2>
1165
+ inline typename _TessMemberResultCallback_1_2<false,R,T1,P1,A1,A2>::base*
1166
+ NewPermanentTessCallback( T1* obj, R (T2::*member)(P1,A1,A2) , typename Identity<P1>::type p1) {
1167
+ return new _TessMemberResultCallback_1_2<false,R,T1,P1,A1,A2>(obj, member, p1);
1168
+ }
1169
+ #endif
1170
+
1171
+ template <bool del, class R, class P1, class A1, class A2>
1172
+ class _TessFunctionResultCallback_1_2 : public TessCallback2<A1,A2> {
1173
+ public:
1174
+ typedef TessCallback2<A1,A2> base;
1175
+ typedef R (*FunctionSignature)(P1,A1,A2);
1176
+
1177
+ private:
1178
+ FunctionSignature function_;
1179
+ typename remove_reference<P1>::type p1_;
1180
+
1181
+ public:
1182
+ inline _TessFunctionResultCallback_1_2(FunctionSignature function, P1 p1)
1183
+ : function_(function), p1_(p1) { }
1184
+
1185
+ virtual R Run(A1 a1, A2 a2) {
1186
+ if (!del) {
1187
+ R result = (*function_)(p1_,a1,a2);
1188
+ return result;
1189
+ } else {
1190
+ R result = (*function_)(p1_,a1,a2);
1191
+ // zero out the pointer to ensure segfault if used again
1192
+ function_ = NULL;
1193
+ delete this;
1194
+ return result;
1195
+ }
1196
+ }
1197
+ };
1198
+
1199
+ template <bool del, class P1, class A1, class A2>
1200
+ class _TessFunctionResultCallback_1_2<del, void, P1, A1, A2>
1201
+ : public TessCallback2<A1,A2> {
1202
+ public:
1203
+ typedef TessCallback2<A1,A2> base;
1204
+ typedef void (*FunctionSignature)(P1,A1,A2);
1205
+
1206
+ private:
1207
+ FunctionSignature function_;
1208
+ typename remove_reference<P1>::type p1_;
1209
+
1210
+ public:
1211
+ inline _TessFunctionResultCallback_1_2(FunctionSignature function, P1 p1)
1212
+ : function_(function), p1_(p1) { }
1213
+
1214
+ virtual void Run(A1 a1, A2 a2) {
1215
+ if (!del) {
1216
+ (*function_)(p1_,a1,a2);
1217
+ } else {
1218
+ (*function_)(p1_,a1,a2);
1219
+ // zero out the pointer to ensure segfault if used again
1220
+ function_ = NULL;
1221
+ delete this;
1222
+ }
1223
+ }
1224
+ };
1225
+
1226
+ template <class R, class P1, class A1, class A2>
1227
+ inline typename _TessFunctionResultCallback_1_2<true,R,P1,A1,A2>::base*
1228
+ NewTessCallback(R (*function)(P1,A1,A2), typename Identity<P1>::type p1) {
1229
+ return new _TessFunctionResultCallback_1_2<true,R,P1,A1,A2>(function, p1);
1230
+ }
1231
+
1232
+ template <class R, class P1, class A1, class A2>
1233
+ inline typename _TessFunctionResultCallback_1_2<false,R,P1,A1,A2>::base*
1234
+ NewPermanentTessCallback(R (*function)(P1,A1,A2), typename Identity<P1>::type p1) {
1235
+ return new _TessFunctionResultCallback_1_2<false,R,P1,A1,A2>(function, p1);
1236
+ }
1237
+
1238
+ #endif /* _TESS_CALLBACK_SPECIALIZATIONS_H */