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 
34 namespace armarx
35 {
36  /**
37  * @class CyberGloveObserverPropertyDefinitions
38  * @brief
39  */
41  {
42  public:
45  {
46  //defineRequiredProperty<std::string>("PropertyName", "Description");
47  defineOptionalProperty<std::string>(
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
armarx::Observer
Baseclass for all ArmarX Observers.
Definition: Observer.h:84
armarx::CyberGloveObserver::getLatestValues
CyberGloveValues getLatestValues(const Ice::Current &) override
Definition: CyberGloveObserver.cpp:127
armarx::PropertyDefinitionContainer::prefix
std::string prefix
Prefix of the properties such as namespace, domain, component name, etc.
Definition: PropertyDefinitionContainer.h:345
Observer.h
armarx::CyberGloveObserver::onExitObserver
void onExitObserver() override
Definition: CyberGloveObserver.cpp:48
armarx::CyberGloveObserver::reportGloveValues
void reportGloveValues(const CyberGloveValues &gloveValues, const Ice::Current &) override
Definition: CyberGloveObserver.cpp:60
armarx::CyberGloveObserver::onInitObserver
void onInitObserver() override
Definition: CyberGloveObserver.cpp:30
armarx::CyberGloveObserver::onConnectObserver
void onConnectObserver() override
Definition: CyberGloveObserver.cpp:36
armarx::CyberGloveObserver::CyberGloveObserver
CyberGloveObserver()
Definition: CyberGloveObserver.h:66
armarx::CyberGloveValues
Definition: CyberGloveInterface.ice:30
armarx::armem::Time
armarx::core::time::DateTime Time
Definition: forward_declarations.h:13
TimeUtil.h
IceUtil::Handle< class PropertyDefinitionContainer >
armarx::CyberGloveObserver::createPropertyDefinitions
armarx::PropertyDefinitionsPtr createPropertyDefinitions() override
Definition: CyberGloveObserver.cpp:53
armarx::CyberGloveObserver
Brief description of class CyberGloveObserver.
Definition: CyberGloveObserver.h:63
armarx::CyberGloveObserver::getDefaultName
std::string getDefaultName() const override
Definition: CyberGloveObserver.h:74
armarx::CyberGloveObserverPropertyDefinitions
Definition: CyberGloveObserver.h:40
armarx::ObserverPropertyDefinitions
Definition: Observer.h:49
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:27
armarx::CyberGloveObserverPropertyDefinitions::CyberGloveObserverPropertyDefinitions
CyberGloveObserverPropertyDefinitions(std::string prefix)
Definition: CyberGloveObserver.h:43