ArmarXManagerItem.cpp
Go to the documentation of this file.
1 /*
2  * This file is part of ArmarX.
3  *
4  * Copyright (C) 2011-2016, High Performance Humanoid Technologies (H2T), Karlsruhe Institute of Technology (KIT), all rights reserved.
5  *
6  * ArmarX is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 as
8  * published by the Free Software Foundation.
9  *
10  * ArmarX is distributed in the hope that it will be useful, but
11  * WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17  *
18  * @package ArmarX::Gui
19  * @author Jan Issac ( jan.issac at gmail dot com)
20  * @date 2012
21  * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
22  * GNU General Public License
23  */
24 
25 
26 #include "ArmarXManagerItem.h"
27 
28 namespace armarx
29 {
31  QStandardItem(name)
32  {
33  data.name = name;
34  }
35 
36 
37  void ArmarXManagerItem::clear(bool clearProxy)
38  {
39  // ScopedLock lock(getMutex());
40 
41  while (this->rowCount() > 0)
42  {
43  this->removeRow(0);
44  }
45 
46  data.objects.clear();
47 
48  if (clearProxy)
49  {
50  data.proxy = 0;
51  }
52  data.connection = nullptr;
53  data.online = false;
54  }
55 
56 
58  {
59  return data.name;
60  }
61 
62 
64  {
65  return data.online;
66  }
67 
68 
69  ArmarXManagerInterfacePrx ArmarXManagerItem::getManagerProxy() const
70  {
71  return data.proxy;
72  }
73 
74  Ice::ConnectionPtr ArmarXManagerItem::getConnection() const
75  {
76  return data.connection;
77  }
78 
80  {
81  return data.endpointStr;
82  }
83 
84 
86  {
87  return data.objects;
88  }
89 
90 
91  void ArmarXManagerItem::setName(QString name)
92  {
93  // reset item if manager name has been changed
94  if (getName() != name)
95  {
96  clear();
97 
98  // ScopedLock lock(getMutex());
99  this->data.name = name;
100  }
101  }
102 
103 
105  {
106  // ScopedLock lock(getMutex());
107 
108  this->data.online = online;
109  }
110 
111 
112  void ArmarXManagerItem::setManagerProxy(ArmarXManagerInterfacePrx proxy)
113  {
114  // ScopedLock lock(getMutex());
115 
116  this->data.proxy = proxy;
117  }
118 
119  void ArmarXManagerItem::setAppProperties(const ObjectPropertyInfos& properties)
120  {
121  data.appProperties = properties;
122  }
123 
124  void ArmarXManagerItem::setConnection(Ice::ConnectionPtr connection)
125  {
126  this->data.connection = connection;
127  }
128 
129  void ArmarXManagerItem::setEndpointStr(const QString& endpointStr)
130  {
131  this->data.endpointStr = endpointStr;
132  }
133 
134  const ObjectPropertyInfos& ArmarXManagerItem::getAppProperties() const
135  {
136  return data.appProperties;
137  }
138 
139 
141  {
142  return mutex;
143  }
144 }
ArmarXManagerItem.h
armarx::ArmarXManagerItem::ManagerData::appProperties
ObjectPropertyInfos appProperties
Definition: ArmarXManagerItem.h:52
armarx::ArmarXManagerItem::getName
QString getName() const
Definition: ArmarXManagerItem.cpp:57
armarx::ArmarXManagerItem::getConnection
Ice::ConnectionPtr getConnection() const
Definition: ArmarXManagerItem.cpp:74
armarx::ArmarXManagerItem::isOnline
bool isOnline() const
Definition: ArmarXManagerItem.cpp:63
armarx::ArmarXManagerItem::setConnection
void setConnection(Ice::ConnectionPtr connection)
Definition: ArmarXManagerItem.cpp:124
armarx::ArmarXManagerItem::setOnline
void setOnline(bool online)
Definition: ArmarXManagerItem.cpp:104
armarx::ArmarXManagerItem::ManagerData::proxy
ArmarXManagerInterfacePrx proxy
Definition: ArmarXManagerItem.h:50
armarx::ArmarXManagerItem::ManagerData::online
bool online
Definition: ArmarXManagerItem.h:49
armarx::ArmarXManagerItem::setAppProperties
void setAppProperties(const ObjectPropertyInfos &properties)
Definition: ArmarXManagerItem.cpp:119
armarx::ArmarXManagerItem::getAppProperties
const ObjectPropertyInfos & getAppProperties() const
Definition: ArmarXManagerItem.cpp:134
armarx::ArmarXManagerItem::setManagerProxy
void setManagerProxy(ArmarXManagerInterfacePrx proxy)
Definition: ArmarXManagerItem.cpp:112
armarx::ArmarXManagerItem::ManagerData::name
QString name
Definition: ArmarXManagerItem.h:48
armarx::ArmarXManagerItem::getMutex
std::mutex & getMutex()
Returns the access mutex.
Definition: ArmarXManagerItem.cpp:140
armarx::ArmarXManagerItem::ArmarXManagerItem
ArmarXManagerItem(const QString &name)
Definition: ArmarXManagerItem.cpp:30
armarx::ArmarXManagerItem::ManagerData::objects
ObjectMap objects
Definition: ArmarXManagerItem.h:51
armarx::ArmarXManagerItem::ManagerData::connection
Ice::ConnectionPtr connection
Definition: ArmarXManagerItem.h:53
armarx::ArmarXManagerItem::setEndpointStr
void setEndpointStr(const QString &endpointStr)
Definition: ArmarXManagerItem.cpp:129
armarx::ArmarXManagerItem::clear
void clear(bool clearProxy=true)
Clears the item data.
Definition: ArmarXManagerItem.cpp:37
armarx::ArmarXManagerItem::ObjectMap
QMap< QString, ManagedIceObjectItem > ObjectMap
Definition: ArmarXManagerItem.h:44
armarx::ArmarXManagerItem::getObjects
ObjectMap & getObjects()
Definition: ArmarXManagerItem.cpp:85
armarx::ArmarXManagerItem::setName
void setName(QString name)
Definition: ArmarXManagerItem.cpp:91
armarx::ArmarXManagerItem::ManagerData::endpointStr
QString endpointStr
Definition: ArmarXManagerItem.h:54
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:28
armarx::ArmarXManagerItem::getManagerProxy
ArmarXManagerInterfacePrx getManagerProxy() const
Definition: ArmarXManagerItem.cpp:69
armarx::ArmarXManagerItem::getEndpointStr
QString getEndpointStr() const
Definition: ArmarXManagerItem.cpp:79