9 #if !defined(__Leap_h__)
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;
28 #if defined(_WIN32) // Windows
31 #elif LEAP_API_IMPLEMENTATION
32 #define LEAP_EXPORT __declspec(dllexport)
34 #define LEAP_EXPORT __declspec(dllimport)
36 #define LEAP_EXPORT_CLASS
37 #define LEAP_EXPORT_PLUGIN __declspec(dllexport)
39 #define LEAP_EXPORT __attribute__((visibility("default")))
40 #define LEAP_EXPORT_CLASS __attribute__((visibility("default")))
41 #define LEAP_EXPORT_PLUGIN __attribute__((visibility("default")))
44 #define LEAP_EXPORT_CLASS
45 #define LEAP_EXPORT_PLUGIN
51 class LEAP_EXPORT_CLASS Interface {
53 struct Implementation {
54 LEAP_EXPORT
virtual ~Implementation() {}
57 LEAP_EXPORT Interface(
void* owner);
58 LEAP_EXPORT Interface(Implementation* reference,
void* owner);
59 LEAP_EXPORT Interface(
const Interface& rhs);
60 LEAP_EXPORT Interface& operator=(
const Interface& rhs);
61 LEAP_EXPORT
virtual ~Interface();
62 template<
typename T> T*
get()
const {
return static_cast<T*
>(reference()); }
63 class SharedObject* m_object;
65 LEAP_EXPORT Implementation* reference()
const;
69 class PointableImplementation;
70 class FingerImplementation;
71 class ToolImplementation;
72 class HandImplementation;
73 class GestureImplementation;
74 class ScreenImplementation;
75 class FrameImplementation;
76 class ControllerImplementation;
77 template<
typename T>
class ListBaseImplementation;
136 LEAP_EXPORT int32_t
id()
const;
190 LEAP_EXPORT
float width()
const;
200 LEAP_EXPORT
float length()
const;
216 LEAP_EXPORT
bool isTool()
const;
223 LEAP_EXPORT
bool isValid()
const;
234 LEAP_EXPORT
static const Pointable&
invalid();
241 LEAP_EXPORT
bool operator==(
const Pointable&)
const;
248 LEAP_EXPORT
bool operator!=(
const Pointable&)
const;
251 LEAP_EXPORT
friend std::ostream&
operator<<(std::ostream&,
const Pointable&);
258 LEAP_EXPORT std::string
toString()
const;
277 Finger(FingerImplementation*);
302 LEAP_EXPORT
static const Finger&
invalid();
309 LEAP_EXPORT std::string
toString()
const;
331 Tool(ToolImplementation*);
356 LEAP_EXPORT
static const Tool&
invalid();
363 LEAP_EXPORT std::string
toString()
const;
380 class Hand :
public Interface {
383 Hand(HandImplementation*);
405 LEAP_EXPORT int32_t
id()
const;
503 LEAP_EXPORT
Tool tool(int32_t
id)
const;
728 LEAP_EXPORT
bool isValid()
const;
739 LEAP_EXPORT
static const Hand&
invalid();
746 LEAP_EXPORT
bool operator==(
const Hand&)
const;
753 LEAP_EXPORT
bool operator!=(
const Hand&)
const;
756 LEAP_EXPORT
friend std::ostream&
operator<<(std::ostream&,
const Hand&);
763 LEAP_EXPORT std::string
toString()
const;
831 Gesture(GestureImplementation*);
895 LEAP_EXPORT int32_t
id()
const;
908 LEAP_EXPORT int64_t
duration()
const;
955 LEAP_EXPORT
bool isValid()
const;
977 LEAP_EXPORT std::string
toString()
const;
1072 LEAP_EXPORT
float speed()
const;
1187 LEAP_EXPORT
float progress()
const;
1194 LEAP_EXPORT
float radius()
const;
1283 LEAP_EXPORT
float progress()
const;
1374 LEAP_EXPORT
float progress()
const;
1411 Screen(ScreenImplementation*);
1428 LEAP_EXPORT int32_t
id()
const;
1610 LEAP_EXPORT
Vector project(
const Vector& position,
bool normalize,
float clampRatio = 1.0f)
const;
1703 LEAP_EXPORT
bool isValid()
const;
1714 LEAP_EXPORT
static const Screen&
invalid();
1721 LEAP_EXPORT
bool operator==(
const Screen&)
const;
1728 LEAP_EXPORT
bool operator!=(
const Screen&)
const;
1731 LEAP_EXPORT
friend std::ostream&
operator<<(std::ostream&,
const Screen&);
1738 LEAP_EXPORT std::string
toString()
const;
1742 template<
typename L,
typename T>
1743 class ConstListIterator {
1745 ConstListIterator<L,T>(
const L& list,
int index) : m_list(list), m_index(index) {}
1747 const T operator*()
const {
return m_list[m_index]; }
1748 const ConstListIterator<L,T>& operator++() { ++m_index;
return *
this; }
1749 bool operator!=(
const ConstListIterator<L,T>& rhs)
const {
return m_index != rhs.m_index; }
1751 typedef std::ptrdiff_t difference_type;
1752 typedef T value_type;
1753 typedef const T* pointer;
1754 typedef const T& reference;
1755 typedef std::forward_iterator_tag iterator_category;
1781 LEAP_EXPORT
int count()
const;
1787 LEAP_EXPORT
bool isEmpty()
const;
1793 LEAP_EXPORT
bool empty()
const;
1807 LEAP_EXPORT PointableList&
append(
const PointableList& other);
1866 FingerList(
const ListBaseImplementation<Finger>&);
1875 LEAP_EXPORT
int count()
const;
1881 LEAP_EXPORT
bool isEmpty()
const;
1887 LEAP_EXPORT
bool empty()
const;
1901 LEAP_EXPORT FingerList&
append(
const FingerList& other);
1945 ToolList(
const ListBaseImplementation<Tool>&);
1954 LEAP_EXPORT
int count()
const;
1960 LEAP_EXPORT
bool isEmpty()
const;
1966 LEAP_EXPORT
bool empty()
const;
1980 LEAP_EXPORT ToolList&
append(
const ToolList& other);
2024 HandList(
const ListBaseImplementation<Hand>&);
2033 LEAP_EXPORT
int count()
const;
2039 LEAP_EXPORT
bool isEmpty()
const;
2045 LEAP_EXPORT
bool empty()
const;
2059 LEAP_EXPORT HandList&
append(
const HandList& other);
2103 GestureList(
const ListBaseImplementation<Gesture>&);
2112 LEAP_EXPORT
int count()
const;
2118 LEAP_EXPORT
bool isEmpty()
const;
2124 LEAP_EXPORT
bool empty()
const;
2138 LEAP_EXPORT GestureList&
append(
const GestureList& other);
2167 ScreenList(
const ListBaseImplementation<Screen>&);
2176 LEAP_EXPORT
int count()
const;
2182 LEAP_EXPORT
bool isEmpty()
const;
2188 LEAP_EXPORT
bool empty()
const;
2288 Frame(FrameImplementation*);
2296 LEAP_EXPORT
Frame();
2304 LEAP_EXPORT int64_t
id()
const;
2338 LEAP_EXPORT
Hand hand(int32_t
id)
const;
2419 LEAP_EXPORT
Tool tool(int32_t
id)
const;
2531 LEAP_EXPORT
float rotationAngle(
const Frame& sinceFrame)
const;
2606 LEAP_EXPORT
float scaleFactor(
const Frame& sinceFrame)
const;
2642 LEAP_EXPORT
bool isValid()
const;
2653 LEAP_EXPORT
static const Frame&
invalid();
2660 LEAP_EXPORT
bool operator==(
const Frame&)
const;
2667 LEAP_EXPORT
bool operator!=(
const Frame&)
const;
2670 LEAP_EXPORT
friend std::ostream&
operator<<(std::ostream&,
const Frame&);
2677 LEAP_EXPORT std::string
toString()
const;
2737 LEAP_EXPORT
bool getBool(
const std::string& key)
const;
2742 LEAP_EXPORT
bool setBool(
const std::string& key,
bool value);
2745 LEAP_EXPORT int32_t
getInt32(
const std::string& key)
const;
2750 LEAP_EXPORT
bool setInt32(
const std::string& key, int32_t value);
2753 LEAP_EXPORT
float getFloat(
const std::string& key)
const;
2758 LEAP_EXPORT
bool setFloat(
const std::string& key,
float value);
2761 LEAP_EXPORT std::string
getString(
const std::string& key)
const;
2766 LEAP_EXPORT
bool setString(
const std::string& key,
const std::string& value);
2778 LEAP_EXPORT
bool save();
2835 LEAP_EXPORT
virtual ~Controller();
2978 LEAP_EXPORT
Frame frame(
int history = 0)
const;
3081 LEAP_EXPORT
virtual void onInit(
const Controller&) {}
3117 LEAP_EXPORT
virtual void onExit(
const Controller&) {}
3135 LEAP_EXPORT
virtual void onFrame(
const Controller&) {}
3166 #endif // __Leap_h__