Leap.h
Go to the documentation of this file.
1 /******************************************************************************\
2 * Copyright (C) 2012-2015 Leap Motion, Inc. All rights reserved. *
3 * Leap Motion proprietary and confidential. Not for distribution. *
4 * Use subject to the terms of the Leap Motion SDK Agreement available at *
5 * https://developer.leapmotion.com/sdk_agreement, or another agreement *
6 * between Leap Motion and you, your company or other organization. *
7 \******************************************************************************/
8 
9 #if !defined(__Leap_h__)
10 #define __Leap_h__
11 
12 #include "LeapMath.h"
13 #include <string>
14 #include <vector>
15 #include <cstring>
16 
17 // Define integer types for Visual Studio 2008 and earlier
18 #if defined(_MSC_VER) && (_MSC_VER < 1600)
19 typedef __int32 int32_t;
20 typedef __int64 int64_t;
21 typedef unsigned __int32 uint32_t;
22 typedef unsigned __int64 uint64_t;
23 #else
24 #include <stdint.h>
25 #endif
26 
27 // Define Leap export macros
28 #if defined(_MSC_VER) // Visual C++
29 #if LEAP_API_INTERNAL
30 #define LEAP_EXPORT
31 #elif LEAP_API_IMPLEMENTATION
32 #define LEAP_EXPORT __declspec(dllexport)
33 #else
34 #define LEAP_EXPORT __declspec(dllimport)
35 #endif
36 #define LEAP_EXPORT_CLASS
37 #define LEAP_EXPORT_PLUGIN __declspec(dllexport)
38 #elif !defined(SWIG)
39 #define LEAP_EXPORT __attribute__((visibility("default")))
40 #define LEAP_EXPORT_CLASS __attribute__((visibility("default")))
41 #define LEAP_EXPORT_PLUGIN __attribute__((visibility("default")))
42 #else
43 #define LEAP_EXPORT
44 #define LEAP_EXPORT_CLASS
45 #define LEAP_EXPORT_PLUGIN
46 #endif
47 
48 namespace Leap {
49 
50  // Interface for internal use only
52  public:
53  struct Implementation {
55  };
56  protected:
57  LEAP_EXPORT Interface(void* owner);
58  LEAP_EXPORT Interface(Implementation* reference, void* owner);
59  LEAP_EXPORT Interface(const Interface& rhs);
60  Interface(class SharedObject* object);
61  LEAP_EXPORT Interface& operator=(const Interface& rhs);
62  LEAP_EXPORT virtual ~Interface();
63  template<typename T> T* get() const { return static_cast<T*>(reference()); }
64  class SharedObject* m_object;
65  LEAP_EXPORT static void deleteCString(const char* cstr);
66  private:
67  LEAP_EXPORT Implementation* reference() const;
68  };
69 
70  // Forward declarations for internal use only
71  class PointableImplementation;
72  class BoneImplementation;
73  class FingerImplementation;
74  class ToolImplementation;
75  class HandImplementation;
76  class GestureImplementation;
77  class ScreenImplementation;
78  class DeviceImplementation;
79  class ImageImplementation;
80  class InteractionBoxImplementation;
81  class BugReportImplementation;
82  class FrameImplementation;
83  class ControllerImplementation;
84  class MaskImplementation;
85  class TrackedQuadImplementation;
86  template<typename T> class ListBaseImplementation;
87 
88  // Forward declarations
89  class PointableList;
90  class FingerList;
91  class ToolList;
92  class HandList;
93  class GestureList;
94  class ImageList;
95  class MaskList;
96  class Hand;
97  class Gesture;
98  class Screen;
99  class InteractionBox;
100  class Frame;
101  class Listener;
102 
129  class Pointable : public Interface {
130  public:
131 
137  enum Zone {
143  ZONE_NONE = 0,
149  ZONE_HOVERING = 1,
154  ZONE_TOUCHING = 2,
155 #ifdef SWIGCSHARP
156  // deprecated
157  ZONENONE = ZONE_NONE,
158  ZONEHOVERING = ZONE_HOVERING,
159  ZONETOUCHING = ZONE_TOUCHING,
160 #endif
161  };
162 
163  // For internal use only.
164  Pointable(PointableImplementation*);
165  // For internal use only.
166  Pointable(FingerImplementation*);
167  // For internal use only.
168  Pointable(ToolImplementation*);
169 
181 
200  LEAP_EXPORT int32_t id() const;
201 
211  LEAP_EXPORT Frame frame() const;
212 
225  LEAP_EXPORT Hand hand() const;
226 
235  LEAP_EXPORT Vector tipPosition() const;
236 
245  LEAP_EXPORT Vector tipVelocity() const;
246 
261  LEAP_EXPORT Vector direction() const;
262 
271  LEAP_EXPORT float width() const;
272 
281  LEAP_EXPORT float length() const;
282 
291  LEAP_EXPORT bool isFinger() const;
292 
301  LEAP_EXPORT bool isTool() const;
302 
315  LEAP_EXPORT bool isExtended() const;
316 
325  LEAP_EXPORT bool isValid() const;
326 
353  LEAP_EXPORT Zone touchZone() const;
354 
376  LEAP_EXPORT float touchDistance() const;
377 
392  LEAP_EXPORT Vector stabilizedTipPosition() const;
393 
402  LEAP_EXPORT float timeVisible() const;
403 
416  LEAP_EXPORT static const Pointable& invalid();
417 
427  LEAP_EXPORT bool operator==(const Pointable&) const;
428 
438  LEAP_EXPORT bool operator!=(const Pointable&) const;
439 
447  LEAP_EXPORT friend std::ostream& operator<<(std::ostream&, const Pointable&);
448 
455  std::string toString() const {
456  const char* cstr = toCString();
457  std::string str(cstr);
458  deleteCString(cstr);
459  return str;
460  }
461  private:
462  LEAP_EXPORT const char* toCString() const;
463 
464  };
465 
470  class Arm : public Interface {
471  public:
472  // For internal use only.
473  Arm(HandImplementation*);
474 
484  LEAP_EXPORT Arm();
485 
493  LEAP_EXPORT float width() const;
494 
502  LEAP_EXPORT Vector direction() const;
503 
534  LEAP_EXPORT Matrix basis() const;
535 
546  LEAP_EXPORT Vector elbowPosition() const;
547 
559  LEAP_EXPORT Vector wristPosition() const;
560 
569  LEAP_EXPORT Vector center() const;
570 
579  LEAP_EXPORT bool isValid() const;
580 
589  LEAP_EXPORT static const Arm& invalid();
590 
600  LEAP_EXPORT bool operator==(const Arm&) const;
601 
611  LEAP_EXPORT bool operator!=(const Arm&) const;
612 
620  LEAP_EXPORT friend std::ostream& operator<<(std::ostream&, const Arm&);
621 
630  std::string toString() const {
631  const char* cstr = toCString();
632  std::string str(cstr);
633  deleteCString(cstr);
634  return str;
635  }
636  private:
637  LEAP_EXPORT const char* toCString() const;
638 
639  };
640 
662  class Bone : public Interface {
663  public:
671  enum Type {
672  TYPE_METACARPAL = 0,
673  TYPE_PROXIMAL = 1,
674  TYPE_INTERMEDIATE = 2,
675  TYPE_DISTAL = 3,
676  };
677 
678  // For internal use only.
679  Bone(BoneImplementation*);
680 
690  LEAP_EXPORT Bone();
691 
702  LEAP_EXPORT Vector prevJoint() const;
703 
714  LEAP_EXPORT Vector nextJoint() const;
715 
724  LEAP_EXPORT Vector center() const;
725 
734  LEAP_EXPORT Vector direction() const;
735 
744  LEAP_EXPORT float length() const;
745 
754  LEAP_EXPORT float width() const;
755 
765  LEAP_EXPORT Type type() const;
766 
800  LEAP_EXPORT Matrix basis() const;
801 
810  LEAP_EXPORT bool isValid() const;
811 
824  LEAP_EXPORT static const Bone& invalid();
825 
833  LEAP_EXPORT bool operator==(const Bone&) const;
834 
842  LEAP_EXPORT bool operator!=(const Bone&) const;
843 
849  LEAP_EXPORT friend std::ostream& operator<<(std::ostream&, const Bone&);
850 
859  std::string toString() const {
860  const char* cstr = toCString();
861  std::string str(cstr);
862  deleteCString(cstr);
863  return str;
864  }
865 
866  private:
867  LEAP_EXPORT const char* toCString() const;
868  };
869 
891  class Finger : public Pointable {
892  public:
896  enum Joint {
897  JOINT_MCP = 0,
898  JOINT_PIP = 1,
899  JOINT_DIP = 2,
900  JOINT_TIP = 3
901  };
902 
910  enum Type {
911  TYPE_THUMB = 0,
912  TYPE_INDEX = 1,
913  TYPE_MIDDLE = 2,
914  TYPE_RING = 3,
915  TYPE_PINKY = 4
916  };
917 
918  // For internal use only.
919  Finger(FingerImplementation*);
920 
929 
938  LEAP_EXPORT explicit Finger(const Pointable&);
939 
944  LEAP_EXPORT Vector jointPosition(Joint jointIx) const;
945 
956  LEAP_EXPORT Bone bone(Bone::Type boneIx) const;
957 
967  LEAP_EXPORT Type type() const;
968 
981  LEAP_EXPORT static const Finger& invalid();
982 
991  std::string toString() const {
992  const char* cstr = toCString();
993  std::string str(cstr);
994  deleteCString(cstr);
995  return str;
996  }
997 
998  private:
999  LEAP_EXPORT const char* toCString() const;
1000  };
1001 
1019  class Tool : public Pointable {
1020  public:
1021  // For internal use only.
1022  Tool(ToolImplementation*);
1023 
1034  LEAP_EXPORT Tool();
1035 
1044  LEAP_EXPORT explicit Tool(const Pointable&);
1045 
1058  LEAP_EXPORT static const Tool& invalid();
1059 
1066  std::string toString() const {
1067  const char* cstr = toCString();
1068  std::string str(cstr);
1069  deleteCString(cstr);
1070  return str;
1071  }
1072 
1073  private:
1074  LEAP_EXPORT const char* toCString() const;
1075  };
1076 
1096  class Hand : public Interface {
1097  public:
1098  // For internal use only.
1099  Hand(HandImplementation*);
1100 
1111  LEAP_EXPORT Hand();
1112 
1128  LEAP_EXPORT int32_t id() const;
1129 
1139  LEAP_EXPORT Frame frame() const;
1140 
1153  LEAP_EXPORT PointableList pointables() const;
1154 
1176  LEAP_EXPORT Pointable pointable(int32_t id) const;
1177 
1189  LEAP_EXPORT FingerList fingers() const;
1190 
1211  LEAP_EXPORT Finger finger(int32_t id) const;
1212 
1213  /*
1214  * The list of Tool objects detected in this frame that are held by this
1215  * hand, given in arbitrary order.
1216  * The list can be empty if no tools held by this hand are detected.
1217  *
1218  * \include Hand_tools.txt
1219  *
1220  * @returns The ToolList containing all Tool objects held by this hand.
1221  * @since 1.0
1222  */
1229  LEAP_EXPORT ToolList tools() const;
1230 
1231  /*
1232  * The Tool object with the specified ID held by this hand.
1233  *
1234  * Use the Hand::tool() function to retrieve a Tool object held by
1235  * this hand using an ID value obtained from a previous frame.
1236  * This function always returns a Tool object, but if no tool
1237  * with the specified ID is present, an invalid Tool object is returned.
1238  *
1239  * \include Hand_tool.txt
1240  *
1241  * Note that ID values persist across frames, but only until tracking of a
1242  * particular object is lost. If tracking of a tool is lost and subsequently
1243  * regained, the new Tool object representing that tool may have a
1244  * different ID than that representing the tool in an earlier frame.
1245  *
1246  * @param id The ID value of a Tool object from a previous frame.
1247  * @returns The Tool object with the matching ID if one exists for this
1248  * hand in this frame; otherwise, an invalid Tool object is returned.
1249  * @since 1.0
1250  */
1257  LEAP_EXPORT Tool tool(int32_t id) const;
1258 
1267  LEAP_EXPORT Vector palmPosition() const;
1268 
1283  LEAP_EXPORT Vector stabilizedPalmPosition() const;
1284 
1293  LEAP_EXPORT Vector palmVelocity() const;
1294 
1312  LEAP_EXPORT Vector palmNormal() const;
1313 
1322  LEAP_EXPORT float palmWidth() const;
1323 
1338  LEAP_EXPORT Vector direction() const;
1339 
1359  LEAP_EXPORT Matrix basis() const;
1360 
1372  LEAP_EXPORT Arm arm() const;
1373 
1380  LEAP_EXPORT Vector wristPosition() const;
1381 
1394  LEAP_EXPORT Vector sphereCenter() const;
1395 
1407  LEAP_EXPORT float sphereRadius() const;
1408 
1422  LEAP_EXPORT float pinchStrength() const;
1423 
1436  LEAP_EXPORT float grabStrength() const;
1437 
1457  LEAP_EXPORT Vector translation(const Frame& sinceFrame) const;
1458 
1475  LEAP_EXPORT float translationProbability(const Frame& sinceFrame) const;
1476 
1496  LEAP_EXPORT Vector rotationAxis(const Frame& sinceFrame) const;
1497 
1519  LEAP_EXPORT float rotationAngle(const Frame& sinceFrame) const;
1520 
1543  LEAP_EXPORT float rotationAngle(const Frame& sinceFrame, const Vector& axis) const;
1544 
1562  LEAP_EXPORT Matrix rotationMatrix(const Frame& sinceFrame) const;
1563 
1580  LEAP_EXPORT float rotationProbability(const Frame& sinceFrame) const;
1581 
1606  LEAP_EXPORT float scaleFactor(const Frame& sinceFrame) const;
1607 
1624  LEAP_EXPORT float scaleProbability(const Frame& sinceFrame) const;
1625 
1634  LEAP_EXPORT float timeVisible() const;
1635 
1645  LEAP_EXPORT float confidence() const;
1646 
1655  LEAP_EXPORT bool isLeft() const;
1656 
1665  LEAP_EXPORT bool isRight() const;
1666 
1675  LEAP_EXPORT bool isValid() const;
1676 
1689  LEAP_EXPORT static const Hand& invalid();
1690 
1700  LEAP_EXPORT bool operator==(const Hand&) const;
1701 
1711  LEAP_EXPORT bool operator!=(const Hand&) const;
1712 
1720  LEAP_EXPORT friend std::ostream& operator<<(std::ostream&, const Hand&);
1721 
1728  std::string toString() const {
1729  const char* cstr = toCString();
1730  std::string str(cstr);
1731  deleteCString(cstr);
1732  return str;
1733  }
1734 
1735  private:
1736  LEAP_EXPORT const char* toCString() const;
1737  };
1738 
1812  class Gesture : public Interface {
1813  public:
1814  // For internal use only.
1815  Gesture(GestureImplementation*);
1816 
1821  enum Type {
1826  TYPE_INVALID = -1,
1831  TYPE_SWIPE = 1,
1836  TYPE_CIRCLE = 4,
1841  TYPE_SCREEN_TAP = 5,
1846  TYPE_KEY_TAP = 6,
1847 #ifdef SWIGCSHARP
1848  // deprecated
1849  TYPEINVALID = TYPE_INVALID,
1850  TYPESWIPE = TYPE_SWIPE,
1851  TYPECIRCLE = TYPE_CIRCLE,
1852  TYPESCREENTAP = TYPE_SCREEN_TAP,
1853  TYPEKEYTAP = TYPE_KEY_TAP,
1854 #endif
1855  };
1856 
1861  enum State {
1866  STATE_INVALID = -1,
1871  STATE_START = 1,
1876  STATE_UPDATE = 2,
1881  STATE_STOP = 3,
1882 #ifdef SWIGCSHARP
1883  // deprecated
1884  STATEINVALID = STATE_INVALID,
1885  STATESTART = STATE_START,
1886  STATEUPDATE = STATE_UPDATE,
1887  STATESTOP = STATE_STOP,
1888 #endif
1889  };
1890 
1899  LEAP_EXPORT Gesture();
1900 
1908  LEAP_EXPORT Gesture(const Gesture& rhs);
1909 
1918  LEAP_EXPORT Type type() const;
1919 
1932  LEAP_EXPORT State state() const;
1933 
1946  LEAP_EXPORT int32_t id() const;
1947 
1962  LEAP_EXPORT int64_t duration() const;
1963 
1973  LEAP_EXPORT float durationSeconds() const;
1974 
1983  LEAP_EXPORT Frame frame() const;
1984 
1995  LEAP_EXPORT HandList hands() const;
1996 
2007  LEAP_EXPORT PointableList pointables() const;
2008 
2025  LEAP_EXPORT bool isValid() const;
2026 
2036  LEAP_EXPORT bool operator==(const Gesture& rhs) const;
2037 
2047  LEAP_EXPORT bool operator!=(const Gesture& rhs) const;
2048 
2057  std::string toString() const {
2058  const char* cstr = toCString();
2059  std::string str(cstr);
2060  deleteCString(cstr);
2061  return str;
2062  }
2063 
2076  LEAP_EXPORT static const Gesture& invalid();
2077 
2078  private:
2079  LEAP_EXPORT const char* toCString() const;
2080  };
2081 
2119  class SwipeGesture : public Gesture
2120  {
2121  public:
2130  static Type classType() { return TYPE_SWIPE; }
2131 
2133 
2143  LEAP_EXPORT SwipeGesture(const Gesture& rhs);
2144 
2154  LEAP_EXPORT Vector startPosition() const;
2155 
2165  LEAP_EXPORT Vector position() const;
2166 
2181  LEAP_EXPORT Vector direction() const;
2182 
2192  LEAP_EXPORT float speed() const;
2193 
2202  LEAP_EXPORT Pointable pointable() const;
2203  };
2204 
2251  class CircleGesture : public Gesture
2252  {
2253  public:
2262  static Type classType() { return TYPE_CIRCLE; }
2263 
2272 
2282  LEAP_EXPORT CircleGesture(const Gesture& rhs);
2283 
2291  LEAP_EXPORT Vector center() const;
2292 
2307  LEAP_EXPORT Vector normal() const;
2308 
2327  LEAP_EXPORT float progress() const;
2328 
2337  LEAP_EXPORT float radius() const;
2338 
2347  LEAP_EXPORT Pointable pointable() const;
2348  };
2349 
2393  class ScreenTapGesture : public Gesture
2394  {
2395  public:
2404  static Type classType() { return TYPE_SCREEN_TAP; }
2405 
2414 
2424  LEAP_EXPORT ScreenTapGesture(const Gesture& rhs);
2425 
2434  LEAP_EXPORT Vector position() const;
2435 
2444  LEAP_EXPORT Vector direction() const;
2445 
2452  LEAP_EXPORT float progress() const;
2453 
2462  LEAP_EXPORT Pointable pointable() const;
2463  };
2464 
2509  class KeyTapGesture : public Gesture
2510  {
2511  public:
2520  static Type classType() { return TYPE_KEY_TAP; }
2521 
2530 
2540  LEAP_EXPORT KeyTapGesture(const Gesture& rhs);
2541 
2550  LEAP_EXPORT Vector position() const;
2551 
2561  LEAP_EXPORT Vector direction() const;
2562 
2569  LEAP_EXPORT float progress() const;
2570 
2579  LEAP_EXPORT Pointable pointable() const;
2580  };
2581 
2582  /*
2583  * Deprecated as of version 1.2.
2584  */
2585  class Screen : public Interface {
2586  public:
2587  // For internal use only.
2588  Screen(ScreenImplementation*);
2589 
2590  LEAP_EXPORT Screen();
2591 
2592  LEAP_EXPORT int32_t id() const;
2593 
2594  LEAP_EXPORT Vector intersect(const Pointable& pointable, bool normalize, float clampRatio = 1.0f) const;
2595 
2596  LEAP_EXPORT Vector intersect(const Vector& position, const Vector& direction, bool normalize, float clampRatio = 1.0f) const;
2597 
2598  LEAP_EXPORT Vector project(const Vector& position, bool normalize, float clampRatio = 1.0f) const;
2599 
2600  LEAP_EXPORT Vector horizontalAxis() const;
2601 
2602  LEAP_EXPORT Vector verticalAxis() const;
2603 
2604  LEAP_EXPORT Vector bottomLeftCorner() const;
2605 
2606  LEAP_EXPORT Vector normal() const;
2607 
2608  LEAP_EXPORT int widthPixels() const;
2609 
2610  LEAP_EXPORT int heightPixels() const;
2611 
2612  LEAP_EXPORT float distanceToPoint(const Vector& point) const;
2613 
2614  LEAP_EXPORT bool isValid() const;
2615 
2616  LEAP_EXPORT static const Screen& invalid();
2617 
2618  LEAP_EXPORT bool operator==(const Screen&) const;
2619 
2620  LEAP_EXPORT bool operator!=(const Screen&) const;
2621 
2622  LEAP_EXPORT friend std::ostream& operator<<(std::ostream&, const Screen&);
2623 
2624  std::string toString() const {
2625  const char* cstr = toCString();
2626  std::string str(cstr);
2627  deleteCString(cstr);
2628  return str;
2629  }
2630 
2631  private:
2632  LEAP_EXPORT const char* toCString() const;
2633  };
2634 
2651  class Device : public Interface {
2652  public:
2653 
2658  enum Type
2659  {
2664  TYPE_PERIPHERAL = 1,
2674  TYPE_KEYBOARD
2675  };
2676 
2677  // For internal use only.
2678  Device(DeviceImplementation*);
2679 
2691  LEAP_EXPORT Device();
2692 
2707  LEAP_EXPORT float horizontalViewAngle() const;
2708 
2723  LEAP_EXPORT float verticalViewAngle() const;
2724 
2738  LEAP_EXPORT float range() const;
2739 
2749  LEAP_EXPORT float baseline() const;
2750 
2766  LEAP_EXPORT float distanceToBoundary(const Vector& position) const;
2767 
2776  LEAP_EXPORT bool isEmbedded() const;
2777 
2784  LEAP_EXPORT bool isStreaming() const;
2785 
2786  // primarily for the image API
2793  LEAP_EXPORT bool isFlipped() const;
2794 
2806  LEAP_EXPORT Type type() const;
2807 
2817  std::string serialNumber() const {
2818  const char* cstr = serialNumberCString();
2819  std::string str(cstr);
2820  deleteCString(cstr);
2821  return str;
2822  }
2823 
2824  /*
2825  * This API is experimental and not currently intended for external use.
2826  * Position and orientation can only be manually configured via a config file.
2827  * This API and the config file may change in the future or be removed entirely.
2828  *
2829  * The position of the center of the device in global coordinates (currently defined
2830  * in the configuration file).
2831  * @since 2.2.2
2832  */
2833  LEAP_EXPORT Vector position() const;
2834 
2835  /*
2836  * This API is experimental and not currently intended for external use.
2837  * Position and orientation can only be manually configured via a config file.
2838  * This API and the config file may change in the future or be removed entirely.
2839  *
2840  * The orientation of the device is described by a right-handed basis:
2841  * xBasis : Unit vector along baseline axis between camera centers
2842  * yBasis : Unit vector in the direction of the center of view of both cameras
2843  * zBasis : The completion of the right-handed basis (perpendicular to the
2844  * x and y vectors)
2845  *
2846  * In the case of a peripheral device, the z-basis vector points
2847  * out from the green-status-LED side of the device. When multiple-device
2848  * tracking is enabled, automatic coordinate system orientation is disabled.
2849  *
2850  * \image html images/Leap_Axes.png
2851  *
2852  * @since 2.2.2
2853  */
2854  LEAP_EXPORT Matrix orientation() const;
2855 
2864  LEAP_EXPORT bool isValid() const;
2865 
2878  LEAP_EXPORT static const Device& invalid();
2879 
2889  LEAP_EXPORT bool operator==(const Device&) const;
2890 
2900  LEAP_EXPORT bool operator!=(const Device&) const;
2901 
2909  LEAP_EXPORT friend std::ostream& operator<<(std::ostream&, const Device&);
2910 
2917  std::string toString() const {
2918  const char* cstr = toCString();
2919  std::string str(cstr);
2920  deleteCString(cstr);
2921  return str;
2922  }
2923 
2924  private:
2925  LEAP_EXPORT const char* toCString() const;
2926  LEAP_EXPORT const char* serialNumberCString() const;
2927  };
2928 
2942  class Image : public Interface {
2943  public:
2944 
2945  // For internal use only.
2946  Image(ImageImplementation*);
2947 
2958  LEAP_EXPORT Image();
2959 
2967  LEAP_EXPORT int64_t sequenceId() const;
2968 
2978  LEAP_EXPORT int32_t id() const;
2979 
2991  LEAP_EXPORT const unsigned char* data() const;
2992 
3029  LEAP_EXPORT const float* distortion() const;
3030 
3031  /*
3032  * Do not call this version of data(). It is intended only as a helper for C#,
3033  * Java, and other languages. Use the primary version of data() which returns a
3034  * pointer.
3035  *
3036  * @since 2.1.0
3037  */
3038  void data(unsigned char* dst) const {
3039  const unsigned char* src = data();
3040  memcpy(dst, src, width() * height() * bytesPerPixel() * sizeof(unsigned char));
3041  }
3042 
3043  /*
3044  * Do not call this version of distortion(). It is intended only as a helper for C#,
3045  * Java, and other languages. Use the primary version of distortion() which returns
3046  * a pointer.
3047  *
3048  * @since 2.1.0
3049  */
3050  void distortion(float* dst) const {
3051  const float* src = distortion();
3052  memcpy(dst, src, distortionWidth() * distortionHeight() * sizeof(float));
3053  }
3054 
3055  /* Do not call dataPointer(). It is intended only as a helper for C#.
3056  *
3057  * @since 2.2.7
3058  */
3059  void* dataPointer() const {
3060  return (void*) data();
3061  }
3062 
3063  /* Do not call distortionPointer(). It is intended only as a helper for C#.
3064  *
3065  * @since 2.2.7
3066  */
3067  void* distortionPointer() const {
3068  return (void*) distortion();
3069  }
3070 
3078  LEAP_EXPORT int width() const;
3079 
3087  LEAP_EXPORT int height() const;
3088 
3099  LEAP_EXPORT int bytesPerPixel() const;
3100 
3107  enum FormatType {
3108  INFRARED = 0
3109  };
3110 
3118  LEAP_EXPORT FormatType format() const;
3119 
3131  LEAP_EXPORT int distortionWidth() const;
3132 
3142  LEAP_EXPORT int distortionHeight() const;
3143 
3154  LEAP_EXPORT float rayOffsetX() const;
3155 
3166  LEAP_EXPORT float rayOffsetY() const;
3167 
3178  LEAP_EXPORT float rayScaleX() const;
3179 
3190  LEAP_EXPORT float rayScaleY() const;
3191 
3211  LEAP_EXPORT Vector rectify(const Vector& uv) const; // returns a vector (x, y, 0). The z-component is ignored
3212 
3237  LEAP_EXPORT Vector warp(const Vector& xy) const; // returns vector (u, v, 0). The z-component is ignored
3238 
3244  LEAP_EXPORT int64_t timestamp() const;
3245 
3252  LEAP_EXPORT bool isValid() const;
3253 
3264  LEAP_EXPORT static const Image& invalid();
3265 
3273  LEAP_EXPORT bool operator==(const Image&) const;
3274 
3283  LEAP_EXPORT bool operator!=(const Image&) const;
3284 
3290  LEAP_EXPORT friend std::ostream& operator<<(std::ostream&, const Image&);
3291 
3298  std::string toString() const {
3299  const char* cstr = toCString();
3300  std::string str(cstr);
3301  deleteCString(cstr);
3302  return str;
3303  }
3304 
3305  private:
3306  LEAP_EXPORT const char* toCString() const;
3307  };
3308 
3327  class Mask : public Interface {
3328  public:
3329 
3330  // For internal use only.
3331  Mask(MaskImplementation*);
3332 
3339  LEAP_EXPORT Mask();
3340 
3347  LEAP_EXPORT int64_t sequenceId() const;
3348 
3354  LEAP_EXPORT int32_t id() const;
3355 
3365  LEAP_EXPORT const unsigned char* data() const;
3366 
3367  void data(unsigned char* dst) const {
3368  const unsigned char* src = data();
3369  memcpy(dst, src, width() * height() * sizeof(unsigned char));
3370  }
3371 
3372  void* dataPointer() const {
3373  return (void*) data();
3374  }
3375 
3381  LEAP_EXPORT int width() const;
3382 
3388  LEAP_EXPORT int height() const;
3389 
3395  LEAP_EXPORT int offsetX() const;
3396 
3402  LEAP_EXPORT int offsetY() const;
3403 
3408  LEAP_EXPORT bool isValid() const;
3409 
3413  LEAP_EXPORT static const Mask& invalid();
3414 
3418  LEAP_EXPORT bool operator==(const Mask&) const;
3419 
3423  LEAP_EXPORT bool operator!=(const Mask&) const;
3424 
3428  LEAP_EXPORT friend std::ostream& operator<<(std::ostream&, const Mask&);
3429 
3430  std::string toString() const {
3431  const char* cstr = toCString();
3432  std::string str(cstr);
3433  deleteCString(cstr);
3434  return str;
3435  }
3436 
3437  private:
3438  LEAP_EXPORT const char* toCString() const;
3439  };
3440 
3441  // For internal use only.
3442  template<typename L, typename T>
3444  public:
3445  ConstListIterator<L,T>() : m_list(0), m_index(-1) {}
3446  ConstListIterator<L,T>(const L& list, int index) : m_list(&list), m_index(index) {}
3447 
3448  const T operator*() const { return (*m_list)[m_index]; }
3449  const ConstListIterator<L,T> operator++(int) { ConstListIterator<L,T> ip(*this); ++m_index; return ip; }
3450  const ConstListIterator<L,T>& operator++() { ++m_index; return *this; }
3451  bool operator!=(const ConstListIterator<L,T>& rhs) const { return m_index != rhs.m_index; }
3452  bool operator==(const ConstListIterator<L,T>& rhs) const { return m_index == rhs.m_index; }
3453 
3454  typedef std::ptrdiff_t difference_type;
3455  typedef T value_type;
3456  typedef const T* pointer;
3457  typedef const T& reference;
3458  typedef std::forward_iterator_tag iterator_category;
3459 
3460  private:
3461  const L* m_list;
3462  int m_index;
3463  };
3464 
3476  class PointableList : public Interface {
3477  public:
3478  // For internal use only.
3480 
3486 
3495  LEAP_EXPORT int count() const;
3496 
3505  LEAP_EXPORT bool isEmpty() const;
3506 
3516  LEAP_EXPORT Pointable operator[](int index) const;
3517 
3524  LEAP_EXPORT PointableList& append(const PointableList& other);
3525 
3532  LEAP_EXPORT PointableList& append(const FingerList& other);
3533 
3540  LEAP_EXPORT PointableList& append(const ToolList& other);
3541 
3551  LEAP_EXPORT Pointable leftmost() const;
3552 
3562  LEAP_EXPORT Pointable rightmost() const;
3563 
3564 
3574  LEAP_EXPORT Pointable frontmost() const;
3575 
3583  LEAP_EXPORT PointableList extended() const;
3584 
3593 
3601  LEAP_EXPORT const_iterator begin() const;
3602 
3610  LEAP_EXPORT const_iterator end() const;
3611  };
3612 
3622  class FingerList : public Interface {
3623  public:
3624  // For internal use only.
3626 
3632 
3641  LEAP_EXPORT int count() const;
3642 
3651  LEAP_EXPORT bool isEmpty() const;
3652 
3662  LEAP_EXPORT Finger operator[](int index) const;
3663 
3670  LEAP_EXPORT FingerList& append(const FingerList& other);
3671 
3681  LEAP_EXPORT Finger leftmost() const;
3682 
3692  LEAP_EXPORT Finger rightmost() const;
3693 
3703  LEAP_EXPORT Finger frontmost() const;
3704 
3714  LEAP_EXPORT FingerList extended() const;
3715 
3725  LEAP_EXPORT FingerList fingerType(Finger::Type type) const;
3726 
3735 
3743  LEAP_EXPORT const_iterator begin() const;
3744 
3752  LEAP_EXPORT const_iterator end() const;
3753  };
3754 
3764  class ToolList : public Interface {
3765  public:
3766  // For internal use only.
3768 
3774 
3783  LEAP_EXPORT int count() const;
3784 
3793  LEAP_EXPORT bool isEmpty() const;
3794 
3804  LEAP_EXPORT Tool operator[](int index) const;
3805 
3812  LEAP_EXPORT ToolList& append(const ToolList& other);
3813 
3823  LEAP_EXPORT Tool leftmost() const;
3824 
3834  LEAP_EXPORT Tool rightmost() const;
3835 
3845  LEAP_EXPORT Tool frontmost() const;
3846 
3855 
3862  LEAP_EXPORT const_iterator begin() const;
3863 
3871  LEAP_EXPORT const_iterator end() const;
3872  };
3873 
3883  class HandList : public Interface {
3884  public:
3885  // For internal use only.
3887 
3893 
3901  LEAP_EXPORT int count() const;
3902 
3911  LEAP_EXPORT bool isEmpty() const;
3912 
3922  LEAP_EXPORT Hand operator[](int index) const;
3923 
3929  LEAP_EXPORT HandList& append(const HandList& other);
3930 
3942  LEAP_EXPORT Hand leftmost() const;
3943 
3955  LEAP_EXPORT Hand rightmost() const;
3956 
3966  LEAP_EXPORT Hand frontmost() const;
3967 
3976 
3984  LEAP_EXPORT const_iterator begin() const;
3985 
3993  LEAP_EXPORT const_iterator end() const;
3994  };
3995 
4002  class GestureList : public Interface {
4003  public:
4004  // For internal use only.
4006 
4012 
4021  LEAP_EXPORT int count() const;
4022 
4031  LEAP_EXPORT bool isEmpty() const;
4032 
4042  LEAP_EXPORT Gesture operator[](int index) const;
4043 
4050  LEAP_EXPORT GestureList& append(const GestureList& other);
4051 
4059 
4067  LEAP_EXPORT const_iterator begin() const;
4068 
4076  LEAP_EXPORT const_iterator end() const;
4077  };
4078 
4079  /*
4080  * Deprecated as of version 1.2.
4081  */
4082  class ScreenList : public Interface {
4083  public:
4084  // For internal use only.
4086 
4088 
4089  LEAP_EXPORT int count() const;
4090 
4091  LEAP_EXPORT bool isEmpty() const;
4092 
4093  LEAP_EXPORT Screen operator[](int index) const;
4094 
4096 
4097  LEAP_EXPORT const_iterator begin() const;
4098 
4099  LEAP_EXPORT const_iterator end() const;
4100 
4101  LEAP_EXPORT Screen closestScreenHit(const Pointable& pointable) const;
4102 
4103  LEAP_EXPORT Screen closestScreenHit(const Vector& position, const Vector& direction) const;
4104 
4105  LEAP_EXPORT Screen closestScreen(const Vector& position) const;
4106  };
4107 
4114  class DeviceList : public Interface {
4115  public:
4116  // For internal use only.
4118 
4124 
4130  LEAP_EXPORT int count() const;
4131 
4140  LEAP_EXPORT bool isEmpty() const;
4141 
4148  LEAP_EXPORT Device operator[](int index) const;
4149 
4156  LEAP_EXPORT DeviceList& append(const DeviceList& other);
4157 
4163 
4168  LEAP_EXPORT const_iterator begin() const;
4169 
4174  LEAP_EXPORT const_iterator end() const;
4175  };
4176 
4187  class ImageList : public Interface {
4188  public:
4189  // For internal use only.
4191 
4197 
4204  LEAP_EXPORT int count() const;
4205 
4214  LEAP_EXPORT bool isEmpty() const;
4215 
4222  LEAP_EXPORT Image operator[](int index) const;
4223 
4230  LEAP_EXPORT ImageList& append(const ImageList& other);
4231 
4237 
4242  LEAP_EXPORT const_iterator begin() const;
4243 
4248  LEAP_EXPORT const_iterator end() const;
4249  };
4250 
4264  class TrackedQuad : public Interface {
4265  public:
4266 
4267  // For internal use only.
4268  TrackedQuad(TrackedQuadImplementation*);
4269 
4278 
4284  LEAP_EXPORT float width() const;
4285 
4291  LEAP_EXPORT float height() const;
4292 
4299  LEAP_EXPORT int resolutionX() const;
4300 
4307  LEAP_EXPORT int resolutionY() const;
4308 
4315  LEAP_EXPORT bool visible() const;
4316 
4322  LEAP_EXPORT Matrix orientation() const;
4323 
4330  LEAP_EXPORT Vector position() const;
4331 
4342  LEAP_EXPORT MaskList masks() const;
4343 
4351  LEAP_EXPORT ImageList images() const;
4352 
4358  LEAP_EXPORT bool isValid() const;
4359 
4364  LEAP_EXPORT static const TrackedQuad& invalid();
4365 
4370  LEAP_EXPORT bool operator==(const TrackedQuad&) const;
4371 
4376  LEAP_EXPORT bool operator!=(const TrackedQuad&) const;
4377 
4382  LEAP_EXPORT friend std::ostream& operator<<(std::ostream&, const TrackedQuad&);
4383 
4384  std::string toString() const {
4385  const char* cstr = toCString();
4386  std::string str(cstr);
4387  deleteCString(cstr);
4388  return str;
4389  }
4390 
4391  private:
4392  LEAP_EXPORT const char* toCString() const;
4393  };
4394 
4402  class MaskList : public Interface {
4403  public:
4404  // For internal use only.
4406 
4412 
4417  LEAP_EXPORT int count() const;
4418 
4423  LEAP_EXPORT bool isEmpty() const;
4424 
4429  LEAP_EXPORT Mask operator[](int index) const;
4430 
4435  LEAP_EXPORT MaskList& append(const MaskList& other);
4436 
4438 
4443  LEAP_EXPORT const_iterator begin() const;
4444 
4449  LEAP_EXPORT const_iterator end() const;
4450  };
4451 
4469  class InteractionBox : public Interface {
4470  public:
4471  // For internal use only.
4472  InteractionBox(InteractionBoxImplementation*);
4473 
4475 
4491  LEAP_EXPORT Vector normalizePoint(const Vector& position, bool clamp = true) const;
4492 
4505  LEAP_EXPORT Vector denormalizePoint(const Vector& normalizedPosition) const;
4506 
4516  LEAP_EXPORT Vector center() const;
4517 
4526  LEAP_EXPORT float width() const;
4527 
4536  LEAP_EXPORT float height() const;
4537 
4546  LEAP_EXPORT float depth() const;
4547 
4556  LEAP_EXPORT bool isValid() const;
4557 
4570  LEAP_EXPORT static const InteractionBox& invalid();
4571 
4581  LEAP_EXPORT bool operator==(const InteractionBox&) const;
4582 
4592  LEAP_EXPORT bool operator!=(const InteractionBox&) const;
4593 
4601  LEAP_EXPORT friend std::ostream& operator<<(std::ostream&, const InteractionBox&);
4602 
4609  std::string toString() const {
4610  const char* cstr = toCString();
4611  std::string str(cstr);
4612  deleteCString(cstr);
4613  return str;
4614  }
4615 
4616  private:
4617  LEAP_EXPORT const char* toCString() const;
4618  };
4619 
4634  class Frame : public Interface {
4635  public:
4636  // For internal use only.
4637  Frame(FrameImplementation*);
4638 
4653  LEAP_EXPORT Frame();
4654 
4671  LEAP_EXPORT int64_t id() const;
4672 
4684  LEAP_EXPORT int64_t timestamp() const;
4685 
4695  LEAP_EXPORT HandList hands() const;
4696 
4717  LEAP_EXPORT Hand hand(int32_t id) const;
4718 
4730  LEAP_EXPORT PointableList pointables() const;
4731 
4752  LEAP_EXPORT Pointable pointable(int32_t id) const;
4753 
4765  LEAP_EXPORT FingerList fingers() const;
4766 
4787  LEAP_EXPORT Finger finger(int32_t id) const;
4788 
4798  LEAP_EXPORT ToolList tools() const;
4799 
4820  LEAP_EXPORT Tool tool(int32_t id) const;
4821 
4839  LEAP_EXPORT Gesture gesture(int32_t id) const;
4840 
4852  LEAP_EXPORT GestureList gestures() const;
4853 
4867  LEAP_EXPORT GestureList gestures(const Frame& sinceFrame) const;
4868 
4875  LEAP_EXPORT ImageList images() const;
4876 
4898  LEAP_EXPORT Vector translation(const Frame& sinceFrame) const;
4899 
4915  LEAP_EXPORT float translationProbability(const Frame& sinceFrame) const;
4916 
4937  LEAP_EXPORT Vector rotationAxis(const Frame& sinceFrame) const;
4938 
4961  LEAP_EXPORT float rotationAngle(const Frame& sinceFrame) const;
4962 
4986  LEAP_EXPORT float rotationAngle(const Frame& sinceFrame, const Vector& axis) const;
4987 
5006  LEAP_EXPORT Matrix rotationMatrix(const Frame& sinceFrame) const;
5007 
5023  LEAP_EXPORT float rotationProbability(const Frame& sinceFrame) const;
5024 
5048  LEAP_EXPORT float scaleFactor(const Frame& sinceFrame) const;
5049 
5065  LEAP_EXPORT float scaleProbability(const Frame& sinceFrame) const;
5066 
5076  LEAP_EXPORT InteractionBox interactionBox() const;
5077 
5091  LEAP_EXPORT float currentFramesPerSecond() const;
5092 
5112  LEAP_EXPORT bool isValid() const;
5113 
5126  LEAP_EXPORT static const Frame& invalid();
5127 
5137  LEAP_EXPORT bool operator==(const Frame&) const;
5138 
5148  LEAP_EXPORT bool operator!=(const Frame&) const;
5149 
5157  LEAP_EXPORT friend std::ostream& operator<<(std::ostream&, const Frame&);
5158 
5169  LEAP_EXPORT TrackedQuad trackedQuad() const;
5170 
5179  std::string serialize() const {
5180  size_t length = 0;
5181  const char* cstr = serializeCString(length);
5182  std::string str(cstr, length);
5183  deleteCString(cstr);
5184  return str;
5185  }
5186 
5214  void deserialize(const std::string& str) {
5215  deserializeCString(str.data(), str.length());
5216  }
5217 
5218  /*
5219  * Do not call this version of serialize(). It is intended only as
5220  * a helper for C#, Java, and other language bindings.
5221  */
5222  void serialize(unsigned char* ptr) const {
5223  size_t length;
5224  const unsigned char* cstr = reinterpret_cast<const unsigned char*>(serializeCString(length));
5225  memcpy(ptr, cstr, length * sizeof(unsigned char));
5226  }
5227 
5228  /*
5229  * Do not call serializeLength(). It is intended only as a helper for
5230  * C#, Java, and other language bindings. To get the length of the
5231  * serialized byte array, use serialize().length()
5232  */
5233  int serializeLength() const {
5234  size_t length = 0;
5235  serializeCString(length);
5236  return static_cast<int>(length);
5237  }
5238 
5239  /*
5240  * Do not call this version of deserialize(). It is intended only as
5241  * a helper for C#, Java, and other language bindings.
5242  */
5243  void deserialize(const unsigned char* ptr, int length) {
5244  deserializeCString(reinterpret_cast<const char*>(ptr), static_cast<size_t>(length));
5245  }
5246 
5253  std::string toString() const {
5254  const char* cstr = toCString();
5255  std::string str(cstr);
5256  deleteCString(cstr);
5257  return str;
5258  }
5259 
5260  private:
5261  LEAP_EXPORT const char* toCString() const;
5262  LEAP_EXPORT const char* serializeCString(size_t& length) const;
5263  LEAP_EXPORT void deserializeCString(const char* str, size_t length);
5264  };
5265 
5266  /* For internal use only. */
5267  class BugReport : public Interface {
5268  public:
5269  // For internal use only
5270  BugReport(BugReportImplementation*);
5271 
5273 
5274  /* Starts recording data. The recording ends when endRecording() is called
5275  * or after 10 seconds. The recording is saved to the local hard drive. */
5276  LEAP_EXPORT bool beginRecording();
5277  /* Ends the recording. */
5278  LEAP_EXPORT void endRecording();
5279 
5280  /* True while recording is in progress. */
5281  LEAP_EXPORT bool isActive() const;
5282  /* Progress as a fraction of the maximum recording length (i.e. 10 seconds).
5283  * The range of the progress value is [0..1]. */
5284  LEAP_EXPORT float progress() const;
5285  /* The recording duration in seconds. */
5286  LEAP_EXPORT float duration() const;
5287  };
5288 
5326  class Config : public Interface {
5327  public:
5337  LEAP_EXPORT Config();
5338 
5345  enum ValueType {
5350  TYPE_UNKNOWN = 0,
5355  TYPE_BOOLEAN = 1,
5360  TYPE_INT32 = 2,
5365  TYPE_FLOAT = 6,
5370  TYPE_STRING = 8,
5371 #ifdef SWIGCSHARP
5372  // deprecated
5373  TYPEUNKNOWN = TYPE_UNKNOWN,
5374  TYPEBOOLEAN = TYPE_BOOLEAN,
5375  TYPEINT32 = TYPE_INT32,
5376  TYPEFLOAT = TYPE_FLOAT,
5377  TYPESTRING = TYPE_STRING,
5378 #endif
5379  };
5380 
5391  ValueType type(const std::string& key) const {
5392  return typeCString(key.c_str());
5393  }
5394 
5402  bool getBool(const std::string& key) const {
5403  return getBoolCString(key.c_str());
5404  }
5405 
5413  bool setBool(const std::string& key, bool value) {
5414  return setBoolCString(key.c_str(), value);
5415  }
5416 
5424  int32_t getInt32(const std::string& key) const {
5425  return getInt32CString(key.c_str());
5426  }
5427 
5435  bool setInt32(const std::string& key, int32_t value) {
5436  return setInt32CString(key.c_str(), value);
5437  }
5438 
5446  float getFloat(const std::string& key) const {
5447  return getFloatCString(key.c_str());
5448  }
5449 
5457  bool setFloat(const std::string& key, float value) {
5458  return setFloatCString(key.c_str(), value);
5459  }
5460 
5468  std::string getString(const std::string& key) const {
5469  const char* cstr = getStringCString(key.c_str());
5470  std::string str(cstr);
5471  deleteCString(cstr);
5472  return str;
5473  }
5474 
5482  bool setString(const std::string& key, const std::string& value) {
5483  return setStringCString(key.c_str(), value.c_str());
5484  }
5485 
5502  LEAP_EXPORT bool save();
5503  private:
5504  LEAP_EXPORT ValueType typeCString(const char* key) const;
5505  LEAP_EXPORT bool getBoolCString(const char* key) const;
5506  LEAP_EXPORT bool setBoolCString(const char* key, bool value);
5507  LEAP_EXPORT int32_t getInt32CString(const char* key) const;
5508  LEAP_EXPORT bool setInt32CString(const char* key, int32_t value);
5509  LEAP_EXPORT float getFloatCString(const char* key) const;
5510  LEAP_EXPORT bool setFloatCString(const char* key, float value);
5511  LEAP_EXPORT const char* getStringCString(const char* key) const;
5512  LEAP_EXPORT bool setStringCString(const char* key, const char* value);
5513  };
5514 
5559  public:
5560  // For internal use only.
5561  Controller(ControllerImplementation*);
5562 
5573  LEAP_EXPORT virtual ~Controller();
5587  LEAP_EXPORT Controller(Listener& listener);
5588 
5606  LEAP_EXPORT bool isConnected() const;
5607 
5613  LEAP_EXPORT bool isServiceConnected() const;
5614 
5630  LEAP_EXPORT bool hasFocus() const;
5631 
5669  enum PolicyFlag {
5674  POLICY_DEFAULT = 0,
5679  POLICY_BACKGROUND_FRAMES = (1 << 0),
5680 
5685  POLICY_IMAGES = (1 << 1),
5686 
5691  POLICY_OPTIMIZE_HMD = (1 << 2),
5692 
5693 #ifdef SWIGCSHARP
5694  // deprecated
5695  POLICYDEFAULT = POLICY_DEFAULT,
5696  POLICYBACKGROUNDFRAMES = POLICY_BACKGROUND_FRAMES,
5697 #endif
5698  };
5699 
5704  LEAP_EXPORT PolicyFlag policyFlags() const;
5705 
5710  LEAP_EXPORT void setPolicyFlags(PolicyFlag flags) const;
5711 
5729  LEAP_EXPORT void setPolicy(PolicyFlag policy) const;
5730 
5744  LEAP_EXPORT void clearPolicy(PolicyFlag policy) const;
5745 
5764  LEAP_EXPORT bool isPolicySet(PolicyFlag policy) const;
5765 
5787  LEAP_EXPORT bool addListener(Listener& listener);
5788 
5801  LEAP_EXPORT bool removeListener(Listener& listener);
5802 
5824  LEAP_EXPORT Frame frame(int history = 0) const;
5825 
5838  LEAP_EXPORT ImageList images() const;
5839 
5849  LEAP_EXPORT Config config() const;
5850 
5866  LEAP_EXPORT DeviceList devices() const;
5867 
5868  /*
5869  * Deprecated as of version 1.2.
5870  */
5871  LEAP_EXPORT ScreenList locatedScreens() const;
5872 
5873  /* For internal use only. */
5874  LEAP_EXPORT BugReport bugReport() const;
5875 
5895  LEAP_EXPORT void enableGesture(Gesture::Type type, bool enable = true) const;
5896 
5907  LEAP_EXPORT bool isGestureEnabled(Gesture::Type type) const;
5908 
5919  LEAP_EXPORT TrackedQuad trackedQuad() const;
5920 
5927  LEAP_EXPORT int64_t now() const;
5928  };
5929 
5944  public:
5950 
5954  LEAP_EXPORT virtual ~Listener() {}
5955 
5964  LEAP_EXPORT virtual void onInit(const Controller&) {}
5965 
5980  LEAP_EXPORT virtual void onConnect(const Controller&) {}
5981 
5998  LEAP_EXPORT virtual void onDisconnect(const Controller&) {}
5999 
6009  LEAP_EXPORT virtual void onExit(const Controller&) {}
6010 
6028  LEAP_EXPORT virtual void onFrame(const Controller&) {}
6029 
6042  LEAP_EXPORT virtual void onFocusGained(const Controller&) {}
6043 
6056  LEAP_EXPORT virtual void onFocusLost(const Controller&) {}
6057 
6058  // onServiceConnect/onServiceDisconnect are for connection established/lost.
6059  // in normal course of events onServiceConnect will get called once after onInit
6060  // and onServiceDisconnect will not get called. disconnect notification only happens
6061  // if service stops running or something else bad happens to disconnect controller from service.
6070  LEAP_EXPORT virtual void onServiceConnect(const Controller&) {}
6082  LEAP_EXPORT virtual void onServiceDisconnect(const Controller&) {}
6083 
6096  LEAP_EXPORT virtual void onDeviceChange(const Controller&) {}
6097 
6107  LEAP_EXPORT virtual void onImages(const Controller&) {}
6108 
6109  };
6110 }
6111 
6112 #endif // __Leap_h__
void serialize(unsigned char *ptr) const
Definition: Leap.h:5222
void * distortionPointer() const
Definition: Leap.h:3067
virtual LEAP_EXPORT void onFrame(const Controller &)
Definition: Leap.h:6028
std::string toString() const
Definition: Leap.h:4384
bool setBool(const std::string &key, bool value)
Definition: Leap.h:5413
ConstListIterator< GestureList, Gesture > const_iterator
Definition: Leap.h:4058
std::string toString() const
Definition: Leap.h:3430
const ConstListIterator< L, T > operator++(int)
Definition: Leap.h:3449
std::string toString() const
Definition: Leap.h:3298
static Type classType()
Definition: Leap.h:2520
ConstListIterator< HandList, Hand > const_iterator
Definition: Leap.h:3975
bool getBool(const std::string &key) const
Definition: Leap.h:5402
bool setInt32(const std::string &key, int32_t value)
Definition: Leap.h:5435
ConstListIterator< ToolList, Tool > const_iterator
Definition: Leap.h:3854
f
static Type classType()
Definition: Leap.h:2262
class SharedObject * m_object
Definition: Leap.h:64
virtual LEAP_EXPORT void onFocusGained(const Controller &)
Definition: Leap.h:6042
virtual LEAP_EXPORT ~Implementation()
Definition: Leap.h:54
TFSIMD_FORCE_INLINE bool operator==(const Matrix3x3 &m1, const Matrix3x3 &m2)
void data(unsigned char *dst) const
Definition: Leap.h:3367
void deserialize(const std::string &str)
Definition: Leap.h:5214
std::string getString(const std::string &key) const
Definition: Leap.h:5468
bool operator==(const ConstListIterator< L, T > &rhs) const
Definition: Leap.h:3452
def listener()
Definition: subscriber.py:23
std::string serialNumber() const
Definition: Leap.h:2817
virtual LEAP_EXPORT void onServiceConnect(const Controller &)
Definition: Leap.h:6070
std::string toString() const
Definition: Leap.h:4609
const T operator*() const
Definition: Leap.h:3448
#define LEAP_EXPORT
Definition: Leap.h:39
ValueType type(const std::string &key) const
Definition: Leap.h:5391
void * dataPointer() const
Definition: Leap.h:3372
const L * m_list
Definition: Leap.h:3461
void deserialize(const unsigned char *ptr, int length)
Definition: Leap.h:5243
std::string toString() const
Definition: Leap.h:2917
std::string toString() const
Definition: Leap.h:5253
virtual LEAP_EXPORT void onDeviceChange(const Controller &)
Definition: Leap.h:6096
Definition: Leap.h:48
invalid
Definition: Leap.py:520
std::string toString() const
Definition: Leap.h:1728
std::string toString() const
Definition: Leap.h:2057
std::string toString() const
Definition: Leap.h:455
bool operator!=(const ConstListIterator< L, T > &rhs) const
Definition: Leap.h:3451
const T & reference
Definition: Leap.h:3457
ConstListIterator< DeviceList, Device > const_iterator
Definition: Leap.h:4162
void data(unsigned char *dst) const
Definition: Leap.h:3038
#define LEAP_EXPORT_CLASS
Definition: Leap.h:40
static Type classType()
Definition: Leap.h:2130
virtual LEAP_EXPORT void onDisconnect(const Controller &)
Definition: Leap.h:5998
std::forward_iterator_tag iterator_category
Definition: Leap.h:3458
std::string toString() const
Definition: Leap.h:991
virtual LEAP_EXPORT void onConnect(const Controller &)
Definition: Leap.h:5980
std::vector< std::vector< lpf > > hands
TFSIMD_FORCE_INLINE bool operator!=(const Vector3 &other) const
LEAP_EXPORT Listener()
Definition: Leap.h:5949
virtual LEAP_EXPORT void onExit(const Controller &)
Definition: Leap.h:6009
ConstListIterator< PointableList, Pointable > const_iterator
Definition: Leap.h:3592
bool setFloat(const std::string &key, float value)
Definition: Leap.h:5457
ConstListIterator< MaskList, Mask > const_iterator
Definition: Leap.h:4437
std::string toString() const
Definition: Leap.h:2624
TFSIMD_FORCE_INLINE Vector3 & normalize()
virtual LEAP_EXPORT ~Listener()
Definition: Leap.h:5954
std::ptrdiff_t difference_type
Definition: Leap.h:3454
bool setString(const std::string &key, const std::string &value)
Definition: Leap.h:5482
virtual LEAP_EXPORT void onServiceDisconnect(const Controller &)
Definition: Leap.h:6082
float getFloat(const std::string &key) const
Definition: Leap.h:5446
virtual LEAP_EXPORT void onImages(const Controller &)
Definition: Leap.h:6107
const T * pointer
Definition: Leap.h:3456
virtual LEAP_EXPORT void onInit(const Controller &)
Definition: Leap.h:5964
std::string toString() const
Definition: Leap.h:630
ROSCPP_DECL std::string append(const std::string &left, const std::string &right)
int32_t getInt32(const std::string &key) const
Definition: Leap.h:5424
void * dataPointer() const
Definition: Leap.h:3059
ConstListIterator< ImageList, Image > const_iterator
Definition: Leap.h:4236
TFSIMD_FORCE_INLINE tfScalar length(const Quaternion &q)
static Type classType()
Definition: Leap.h:2404
const ConstListIterator< L, T > & operator++()
Definition: Leap.h:3450
std::string serialize() const
Definition: Leap.h:5179
ConstListIterator< FingerList, Finger > const_iterator
Definition: Leap.h:3734
int serializeLength() const
Definition: Leap.h:5233
std::string toString() const
Definition: Leap.h:1066
std::string toString() const
Definition: Leap.h:859
ConstListIterator< ScreenList, Screen > const_iterator
Definition: Leap.h:4095
virtual LEAP_EXPORT void onFocusLost(const Controller &)
Definition: Leap.h:6056
void distortion(float *dst) const
Definition: Leap.h:3050


leap_motion
Author(s): Florian Lier , Mirza Shah , Isaac IY Saito
autogenerated on Tue Jun 2 2020 03:58:01