From 81805e292667eccfb99d25402f45c67750871abf Mon Sep 17 00:00:00 2001
From: Simon Ottenhaus <simon.ottenhaus@kit.edu>
Date: Wed, 4 Nov 2015 13:41:22 +0100
Subject: [PATCH] added isRequested to TCPControlUnit

---
 source/RobotAPI/components/units/TCPControlUnit.cpp | 10 ++++++++--
 source/RobotAPI/components/units/TCPControlUnit.h   |  2 ++
 source/RobotAPI/interface/units/TCPControlUnit.ice  |  5 +++++
 3 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/source/RobotAPI/components/units/TCPControlUnit.cpp b/source/RobotAPI/components/units/TCPControlUnit.cpp
index 8ddedde1f..19330a17f 100644
--- a/source/RobotAPI/components/units/TCPControlUnit.cpp
+++ b/source/RobotAPI/components/units/TCPControlUnit.cpp
@@ -87,7 +87,7 @@ namespace armarx
             {
                 auto nodesets = localReportRobot->getRobotNodeSets();
 
-                for (RobotNodeSetPtr& set : nodesets)
+                for (RobotNodeSetPtr & set : nodesets)
                 {
                     if (set->getTCP())
                     {
@@ -103,7 +103,7 @@ namespace armarx
                              boost::is_any_of(","),
                              boost::token_compress_on);
 
-                for (auto& name : nodesetNames)
+                for (auto & name : nodesetNames)
                 {
                     auto node = localReportRobot->getRobotNode(name);
 
@@ -288,6 +288,12 @@ namespace armarx
 
     }
 
+    bool TCPControlUnit::isRequested(const Ice::Current& c)
+    {
+        // no lock needed to read a single bool value.
+        return requested;
+    }
+
 
     void TCPControlUnit::periodicExec()
     {
diff --git a/source/RobotAPI/components/units/TCPControlUnit.h b/source/RobotAPI/components/units/TCPControlUnit.h
index 31ddf540c..efb111ea2 100644
--- a/source/RobotAPI/components/units/TCPControlUnit.h
+++ b/source/RobotAPI/components/units/TCPControlUnit.h
@@ -146,6 +146,8 @@ namespace armarx
          */
         void release(const Ice::Current& c = Ice::Current());
 
+        bool isRequested(const Ice::Current& c = Ice::Current());
+
     protected:
 
         void onInitComponent();
diff --git a/source/RobotAPI/interface/units/TCPControlUnit.ice b/source/RobotAPI/interface/units/TCPControlUnit.ice
index 33117e380..238ba4978 100644
--- a/source/RobotAPI/interface/units/TCPControlUnit.ice
+++ b/source/RobotAPI/interface/units/TCPControlUnit.ice
@@ -53,6 +53,11 @@ module armarx
 		**/
         void setTCPVelocity(string robotNodeSetName, string tcpNodeName, FramedDirectionBase translationVelocity, FramedDirectionBase orientationVelocityRPY);
 
+        /**
+         * @brief returns if the TCPControlUnit is requested.
+         * @return Request status.
+         */
+        bool isRequested();
     };
 
 	/**
-- 
GitLab