SOFA plugin: LeapMotion  master
Open source framework for multi-physics simuation
All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
Leap::Config Class Reference

#include <Leap.h>

Inheritance diagram for Leap::Config:

Detailed Description

The Config class provides access to Leap system configuration information.

You can get and set gesture configuration parameters using the Config object obtained from a connected Controller object. The key strings required to identify a configuration parameter include:

Key string Value type Default value Units
Gesture.Circle.MinRadius float 5.0 mm
Gesture.Circle.MinArc float 1.5*pi radians
Gesture.Swipe.MinLength float 150 mm
Gesture.Swipe.MinVelocity float 1000 mm/s
Gesture.KeyTap.MinDownVelocity float 50 mm/s
Gesture.KeyTap.HistorySeconds float 0.1 s
Gesture.KeyTap.MinDistance float 3.0 mm
Gesture.ScreenTap.MinForwardVelocity float 50 mm/s
Gesture.ScreenTap.HistorySeconds float 0.1 s
Gesture.ScreenTap.MinDistance float 5.0 mm

After setting a configuration value, you must call the Config::save method to commit the changes. The configuration value changes are not persistent; your application needs to set the values every time it runs.

See also
CircleGesture
KeyTapGesture
ScreenTapGesture
SwipeGesture

Public Member Functions

LEAP_EXPORT Config ()
 
LEAP_EXPORT ValueType type (const std::string &key) const
 
LEAP_EXPORT bool getBool (const std::string &key) const
 
LEAP_EXPORT bool setBool (const std::string &key, bool value)
 
LEAP_EXPORT int32_t getInt32 (const std::string &key) const
 
LEAP_EXPORT bool setInt32 (const std::string &key, int32_t value)
 
LEAP_EXPORT float getFloat (const std::string &key) const
 
LEAP_EXPORT bool setFloat (const std::string &key, float value)
 
LEAP_EXPORT std::string getString (const std::string &key) const
 
LEAP_EXPORT bool setString (const std::string &key, const std::string &value)
 
LEAP_EXPORT bool save ()
 

Additional Inherited Members

- Protected Attributes inherited from Leap::Interface
class SharedObject * m_object
 
- Protected Member Functions inherited from Leap::Interface
LEAP_EXPORT Interface (void *owner)
 
LEAP_EXPORT Interface (Implementation *reference, void *owner)
 
LEAP_EXPORT Interface (const Interface &rhs)
 
LEAP_EXPORT Interfaceoperator= (const Interface &rhs)
 
virtual LEAP_EXPORT ~Interface ()
 
template<typename T >
T * get () const
 

Constructor details

◆ Config()

LEAP_EXPORT Leap::Config::Config ( )

Constructs a Config object.

Function details

◆ getBool()

LEAP_EXPORT bool Leap::Config::getBool ( const std::string &  key) const

Gets the boolean representation for the specified key.

◆ getFloat()

LEAP_EXPORT float Leap::Config::getFloat ( const std::string &  key) const

Gets the floating point representation for the specified key.

◆ getInt32()

LEAP_EXPORT int32_t Leap::Config::getInt32 ( const std::string &  key) const

Gets the 32-bit integer representation for the specified key.

◆ getString()

LEAP_EXPORT std::string Leap::Config::getString ( const std::string &  key) const

Gets the string representation for the specified key.

◆ save()

LEAP_EXPORT bool Leap::Config::save ( )

Saves the current state of the config.

Call save() after making a set of configuration changes. The save() function transfers the configuration changes to the Leap application. The configuration value changes are not persistent; your application needs to set the values every time it runs.

Returns
true on success, false on failure.

◆ setBool()

LEAP_EXPORT bool Leap::Config::setBool ( const std::string &  key,
bool  value 
)

Sets the boolean representation for the specified key.

Returns
true on success, false on failure.

◆ setFloat()

LEAP_EXPORT bool Leap::Config::setFloat ( const std::string &  key,
float  value 
)

Sets the floating point representation for the specified key.

Returns
true on success, false on failure.

◆ setInt32()

LEAP_EXPORT bool Leap::Config::setInt32 ( const std::string &  key,
int32_t  value 
)

Sets the 32-bit integer representation for the specified key.

Returns
true on success, false on failure.

◆ setString()

LEAP_EXPORT bool Leap::Config::setString ( const std::string &  key,
const std::string &  value 
)

Sets the string representation for the specified key.

Returns
true on success, false on failure.

◆ type()

LEAP_EXPORT ValueType Leap::Config::type ( const std::string &  key) const

Reports the natural data type for the value related to the specified key.

Parameters
keyThe key for the looking up the value in the configuration dictionary.
Returns
The native data type of the value, that is, the type that does not require a data conversion.

Enum details

◆ ValueType

Enumerates the possible data types for configuration values.

The Config::type() function returns an item from the ValueType enumeration.

Enumerator
TYPE_UNKNOWN 

The data type is unknown.

TYPE_BOOLEAN 

A boolean value.

TYPE_INT32 

A 32-bit integer.

TYPE_FLOAT 

A floating-point number.

TYPE_STRING 

A string of characters.