RobotUnitModuleUnits.ipp
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::RobotUnit
17  * @author Raphael Grimm ( raphael dot grimm 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 #include "RobotUnitModuleUnits.h"
26 
28  {
30  {
31  return ModuleBase::Instance<Units>();
32  }
33 
34  inline KinematicUnitInterfacePrx Units::getKinematicUnit(const Ice::Current&) const
35  {
36  throwIfInControlThread(BOOST_CURRENT_FUNCTION);
37  return getUnitPrx<KinematicUnitInterface>();
38  }
39  inline ForceTorqueUnitInterfacePrx Units::getForceTorqueUnit(const Ice::Current&) const
40  {
41  throwIfInControlThread(BOOST_CURRENT_FUNCTION);
42  return getUnitPrx<ForceTorqueUnitInterface>();
43  }
44  inline InertialMeasurementUnitInterfacePrx Units::getInertialMeasurementUnit(const Ice::Current&) const
45  {
46  throwIfInControlThread(BOOST_CURRENT_FUNCTION);
47  return getUnitPrx<InertialMeasurementUnitInterface>();
48  }
49  inline PlatformUnitInterfacePrx Units::getPlatformUnit(const Ice::Current&) const
50  {
51  throwIfInControlThread(BOOST_CURRENT_FUNCTION);
52  return getUnitPrx<PlatformUnitInterface>();
53  }
54  inline TCPControlUnitInterfacePrx Units::getTCPControlUnit(const Ice::Current&) const
55  {
56  throwIfInControlThread(BOOST_CURRENT_FUNCTION);
57  return getUnitPrx<TCPControlUnitInterface>();
58  }
59  inline TrajectoryPlayerInterfacePrx Units::getTrajectoryPlayer(const Ice::Current&) const
60  {
61  throwIfInControlThread(BOOST_CURRENT_FUNCTION);
62  return getUnitPrx<TrajectoryPlayerInterface>();
63  }
64 
65  template<class T>
66  inline typename T::PointerType Units::getUnit() const
67  {
68  throwIfInControlThread(BOOST_CURRENT_FUNCTION);
69  return T::PointerType::dynamicCast(getUnit(T::ice_staticId()));
70  }
71 
72  template<class T>
73  inline typename T::ProxyType Units::getUnitPrx() const
74  {
75  throwIfInControlThread(BOOST_CURRENT_FUNCTION);
76  return T::ProxyType::uncheckedCast(getUnit(T::ice_staticId(), Ice::emptyCurrent));
77  }
78 
79  inline KinematicUnitInterfacePtr Units::getKinematicUnit() const
80  {
81  throwIfInControlThread(BOOST_CURRENT_FUNCTION);
82  return getUnit<KinematicUnitInterface>();
83  }
84  inline ForceTorqueUnitInterfacePtr Units::getForceTorqueUnit() const
85  {
86  throwIfInControlThread(BOOST_CURRENT_FUNCTION);
87  return getUnit<ForceTorqueUnitInterface>();
88  }
89  inline InertialMeasurementUnitInterfacePtr Units::getInertialMeasurementUnit() const
90  {
91  throwIfInControlThread(BOOST_CURRENT_FUNCTION);
92  return getUnit<InertialMeasurementUnitInterface>();
93  }
94  inline PlatformUnitInterfacePtr Units::getPlatformUnit() const
95  {
96  throwIfInControlThread(BOOST_CURRENT_FUNCTION);
97  return getUnit<PlatformUnitInterface>();
98  }
99  inline TCPControlUnitInterfacePtr Units::getTCPControlUnit() const
100  {
101  throwIfInControlThread(BOOST_CURRENT_FUNCTION);
102  return getUnit<TCPControlUnitInterface>();
103  }
104  inline TrajectoryPlayerInterfacePtr Units::getTrajectoryPlayer() const
105  {
106  throwIfInControlThread(BOOST_CURRENT_FUNCTION);
107  return getUnit<TrajectoryPlayerInterface>();
108  }
109  }
RobotUnitModuleUnits.h
armarx::RobotUnitModule::Units
This Module manages all Units of a RobotUnit.
Definition: RobotUnitModuleUnits.h:103
armarx::RobotUnitModule::Units::getKinematicUnit
KinematicUnitInterfacePtr getKinematicUnit() const
Returns a pointer to the KinematicUnit.
Definition: RobotUnitModuleUnits.ipp:79
armarx::RobotUnitModule::Units::getInertialMeasurementUnit
InertialMeasurementUnitInterfacePtr getInertialMeasurementUnit() const
Returns a pointer to the InertialMeasurementUnit.
Definition: RobotUnitModuleUnits.ipp:89
armarx::RobotUnitModule::Units::getUnit
T::PointerType getUnit() const
Returns a pointer to the Unit for the given type (or null if there is none)
Definition: RobotUnitModuleUnits.ipp:66
armarx::RobotUnitModule::Units::getForceTorqueUnit
ForceTorqueUnitInterfacePtr getForceTorqueUnit() const
Returns a pointer to the ForceTorqueUnit.
Definition: RobotUnitModuleUnits.ipp:84
armarx::RobotUnitModule::Units::Instance
static Units & Instance()
Returns the singleton instance of this class.
Definition: RobotUnitModuleUnits.ipp:29
armarx::RobotUnitModule::Units::getTrajectoryPlayer
TrajectoryPlayerInterfacePtr getTrajectoryPlayer() const
Returns a pointer to the TrajectoryPlayer.
Definition: RobotUnitModuleUnits.ipp:104
armarx::RobotUnitModule::Units::getTCPControlUnit
TCPControlUnitInterfacePtr getTCPControlUnit() const
Returns a pointer to the TCPControlUnit.
Definition: RobotUnitModuleUnits.ipp:99
armarx::RobotUnitModule::Units::getPlatformUnit
PlatformUnitInterfacePtr getPlatformUnit() const
Returns a pointer to the PlatformUnit.
Definition: RobotUnitModuleUnits.ipp:94
armarx::ProxyType
ProxyType
Definition: ProxyPropertyDefinition.h:41
armarx::RobotUnitModule::Units::getUnitPrx
T::ProxyType getUnitPrx() const
Returns a proxy to the Unit for the given type (or null if there is none)
Definition: RobotUnitModuleUnits.ipp:73
armarx::RobotUnitModule::ModuleBase::throwIfInControlThread
void throwIfInControlThread(const std::string &fnc) const
Throws if the current thread is the ControlThread.
Definition: RobotUnitModuleBase.cpp:416
armarx::RobotUnitModule
Definition: ControlDevice.h:34