CyberGloveObserver.h
Go to the documentation of this file.
1/*
2 * This file is part of ArmarX.
3 *
4 * ArmarX is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 *
8 * ArmarX is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * @package RobotAPI::ArmarXObjects::CyberGloveObserver
17 * @author JuliaStarke ( julia dot starke at kit dot edu )
18 * @date 2018
19 * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
20 * GNU General Public License
21 */
22
23#pragma once
24
25
26#include <mutex>
27
30
31#include <RobotAPI/interface/units/CyberGloveObserverInterface.h>
32#include <RobotAPI/interface/visualization/DebugDrawerInterface.h>
33
34namespace armarx
35{
36 /**
37 * @class CyberGloveObserverPropertyDefinitions
38 * @brief
39 */
41 {
42 public:
45 {
46 //defineRequiredProperty<std::string>("PropertyName", "Description");
48 "CyberGloveTopicName", "CyberGloveValues", "Name of the CyberGlove Topic");
49 }
50 };
51
52 /**
53 * @defgroup Component-CyberGloveObserver CyberGloveObserver
54 * @ingroup RobotAPI-Components
55 * A description of the component CyberGloveObserver.
56 *
57 * @class CyberGloveObserver
58 * @ingroup Component-CyberGloveObserver
59 * @brief Brief description of class CyberGloveObserver.
60 *
61 * Detailed description of class CyberGloveObserver.
62 */
63 class CyberGloveObserver : virtual public Observer, virtual public CyberGloveObserverInterface
64 {
65 public:
67 {
68 }
69
70 /**
71 * @see armarx::ManagedIceObject::getDefaultName()
72 */
73 std::string
74 getDefaultName() const override
75 {
76 return "CyberGloveObserver";
77 }
78
79 protected:
80 /**
81 * @see armarx::ManagedIceObject::onInitComponent()
82 */
83 void onInitObserver() override;
84
85 /**
86 * @see armarx::ManagedIceObject::onConnectComponent()
87 */
88 void onConnectObserver() override;
89
90 /**
91 * @see armarx::ManagedIceObject::onDisconnectComponent()
92 */
93 //void onDisconnectObserver() override;
94
95 /**
96 * @see armarx::ManagedIceObject::onExitComponent()
97 */
98 void onExitObserver() override;
99
100 /**
101 * @see PropertyUser::createPropertyDefinitions()
102 */
104
105 private:
106 std::mutex dataMutex;
107 CyberGloveValues latestValues;
108 IceUtil::Time lastUpdate;
109
110 // CyberGloveListenerInterface interface
111 public:
112 void reportGloveValues(const CyberGloveValues& gloveValues, const Ice::Current&) override;
113 CyberGloveValues getLatestValues(const Ice::Current&) override;
114 };
115} // namespace armarx
CyberGloveValues getLatestValues(const Ice::Current &) override
void reportGloveValues(const CyberGloveValues &gloveValues, const Ice::Current &) override
armarx::PropertyDefinitionsPtr createPropertyDefinitions() override
std::string getDefaultName() const override
ObserverPropertyDefinitions(std::string prefix)
Definition Observer.h:52
std::string prefix
Prefix of the properties such as namespace, domain, component name, etc.
PropertyDefinition< PropertyType > & defineOptionalProperty(const std::string &name, PropertyType defaultValue, const std::string &description="", PropertyDefinitionBase::PropertyConstness constness=PropertyDefinitionBase::eConstant)
This file offers overloads of toIce() and fromIce() functions for STL container types.
IceUtil::Handle< class PropertyDefinitionContainer > PropertyDefinitionsPtr
PropertyDefinitions smart pointer type.