summaryrefslogtreecommitdiffhomepage
path: root/Tobii-EyeX/include/eyex-cpp/Property.inl
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2017-09-30 15:01:35 +0200
committerStanislaw Halik <sthalik@misaki.pl>2017-09-30 15:02:01 +0200
commit72c46bdd7f5d430ab1ad1d420ed77c7f22df857a (patch)
treead288a9b0eecb5c9d6afa9a42fcb87b017080484 /Tobii-EyeX/include/eyex-cpp/Property.inl
parent6f1cc7dbf4af2503e6624d939c6f9dc7ee1cfd24 (diff)
rename
Diffstat (limited to 'Tobii-EyeX/include/eyex-cpp/Property.inl')
-rwxr-xr-xTobii-EyeX/include/eyex-cpp/Property.inl90
1 files changed, 90 insertions, 0 deletions
diff --git a/Tobii-EyeX/include/eyex-cpp/Property.inl b/Tobii-EyeX/include/eyex-cpp/Property.inl
new file mode 100755
index 0000000..9469af4
--- /dev/null
+++ b/Tobii-EyeX/include/eyex-cpp/Property.inl
@@ -0,0 +1,90 @@
+/*********************************************************************************************************************
+ * Copyright 2013-2014 Tobii Technology AB. All rights reserved.
+ * Property.inl
+ *********************************************************************************************************************/
+
+#if !defined(__TOBII_TX_CLIENT_CPPBINDINGS_PROPERTY__INL__)
+#define __TOBII_TX_CLIENT_CPPBINDINGS_PROPERTY__INL__
+
+/*********************************************************************************************************************/
+
+TX_NAMESPACE_BEGIN
+
+/*********************************************************************************************************************/
+
+template <typename TValue>
+bool Property::TryGetValue(TValue* pValue) const
+{
+ if(PropertyValueResolver<TValue>().GetValue(this, pValue) == TX_RESULT_OK)
+ return true;
+
+ return false;
+}
+
+/*********************************************************************************************************************/
+
+template <typename TValue>
+typename PropertyValueResolver<TValue>::ValueType Property::GetValue() const
+{
+ TValue value;
+ if(TryGetValue(&value))
+ return value;
+
+ throw APIException(TX_RESULT_INVALIDPROPERTYTYPE, "Invalid property type");
+}
+
+/*********************************************************************************************************************/
+
+template <typename TValue>
+void Property::SetValue(const TValue& value)
+{
+ TX_VALIDATE(PropertyValueResolver<TValue>().SetValue(this, value));
+}
+
+/*********************************************************************************************************************/
+
+inline Property::Property(const std::shared_ptr<const Context>& spContext, TX_PROPERTYHANDLE hProperty)
+: HandleWrapper<TX_PROPERTYHANDLE>(spContext, hProperty)
+{}
+
+/*********************************************************************************************************************/
+
+inline TX_PROPERTYVALUETYPE Property::GetValueType() const
+{
+ TX_PROPERTYVALUETYPE valueType;
+ TX_VALIDATE(txGetPropertyValueType(_hObject, &valueType));
+ return valueType;
+}
+
+/*********************************************************************************************************************/
+
+inline std::string Property::GetName() const
+{
+ return GetString(txGetPropertyName, _hObject);
+}
+
+/*********************************************************************************************************************/
+
+inline TX_PROPERTYFLAGS Property::GetFlags() const
+{
+ TX_PROPERTYFLAGS flags;
+ TX_VALIDATE(txGetPropertyFlags(_hObject, &flags));
+ return flags;
+}
+
+/*********************************************************************************************************************/
+
+inline void Property::Clear()
+{
+ TX_VALIDATE(txClearPropertyValue(_hObject));
+}
+
+/*********************************************************************************************************************/
+
+TX_NAMESPACE_END
+
+/*********************************************************************************************************************/
+
+#endif // !defined(__TOBII_TX_CLIENT_CPPBINDINGS_PROPERTY__INL__)
+
+/*********************************************************************************************************************/