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 {
30  ArmarXManagerItem::ArmarXManagerItem(const QString& name) : QStandardItem(name)
31  {
32  data.name = name;
33  }
34 
35  void
36  ArmarXManagerItem::clear(bool clearProxy)
37  {
38  // ScopedLock lock(getMutex());
39 
40  while (this->rowCount() > 0)
41  {
42  this->removeRow(0);
43  }
44 
45  data.objects.clear();
46 
47  if (clearProxy)
48  {
49  data.proxy = 0;
50  }
51  data.connection = nullptr;
52  data.online = false;
53  }
54 
55  QString
57  {
58  return data.name;
59  }
60 
61  bool
63  {
64  return data.online;
65  }
66 
67  ArmarXManagerInterfacePrx
69  {
70  return data.proxy;
71  }
72 
73  Ice::ConnectionPtr
75  {
76  return data.connection;
77  }
78 
79  QString
81  {
82  return data.endpointStr;
83  }
84 
87  {
88  return data.objects;
89  }
90 
91  void
93  {
94  // reset item if manager name has been changed
95  if (getName() != name)
96  {
97  clear();
98 
99  // ScopedLock lock(getMutex());
100  this->data.name = name;
101  }
102  }
103 
104  void
106  {
107  // ScopedLock lock(getMutex());
108 
109  this->data.online = online;
110  }
111 
112  void
113  ArmarXManagerItem::setManagerProxy(ArmarXManagerInterfacePrx proxy)
114  {
115  // ScopedLock lock(getMutex());
116 
117  this->data.proxy = proxy;
118  }
119 
120  void
121  ArmarXManagerItem::setAppProperties(const ObjectPropertyInfos& properties)
122  {
123  data.appProperties = properties;
124  }
125 
126  void
127  ArmarXManagerItem::setConnection(Ice::ConnectionPtr connection)
128  {
129  this->data.connection = connection;
130  }
131 
132  void
133  ArmarXManagerItem::setEndpointStr(const QString& endpointStr)
134  {
135  this->data.endpointStr = endpointStr;
136  }
137 
138  const ObjectPropertyInfos&
140  {
141  return data.appProperties;
142  }
143 
144  std::mutex&
146  {
147  return mutex;
148  }
149 } // namespace armarx
ArmarXManagerItem.h
armarx::ArmarXManagerItem::ManagerData::appProperties
ObjectPropertyInfos appProperties
Definition: ArmarXManagerItem.h:52
armarx::ArmarXManagerItem::getName
QString getName() const
Definition: ArmarXManagerItem.cpp:56
armarx::ArmarXManagerItem::getConnection
Ice::ConnectionPtr getConnection() const
Definition: ArmarXManagerItem.cpp:74
armarx::ArmarXManagerItem::isOnline
bool isOnline() const
Definition: ArmarXManagerItem.cpp:62
armarx::ArmarXManagerItem::setConnection
void setConnection(Ice::ConnectionPtr connection)
Definition: ArmarXManagerItem.cpp:127
armarx::ArmarXManagerItem::setOnline
void setOnline(bool online)
Definition: ArmarXManagerItem.cpp:105
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:121
armarx::ArmarXManagerItem::getAppProperties
const ObjectPropertyInfos & getAppProperties() const
Definition: ArmarXManagerItem.cpp:139
armarx::ArmarXManagerItem::setManagerProxy
void setManagerProxy(ArmarXManagerInterfacePrx proxy)
Definition: ArmarXManagerItem.cpp:113
armarx::ArmarXManagerItem::ManagerData::name
QString name
Definition: ArmarXManagerItem.h:48
armarx::ArmarXManagerItem::getMutex
std::mutex & getMutex()
Returns the access mutex.
Definition: ArmarXManagerItem.cpp:145
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:133
armarx::ArmarXManagerItem::clear
void clear(bool clearProxy=true)
Clears the item data.
Definition: ArmarXManagerItem.cpp:36
armarx::ArmarXManagerItem::ObjectMap
QMap< QString, ManagedIceObjectItem > ObjectMap
Definition: ArmarXManagerItem.h:44
armarx::ArmarXManagerItem::getObjects
ObjectMap & getObjects()
Definition: ArmarXManagerItem.cpp:86
armarx::ArmarXManagerItem::setName
void setName(QString name)
Definition: ArmarXManagerItem.cpp:92
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:27
armarx::ArmarXManagerItem::getManagerProxy
ArmarXManagerInterfacePrx getManagerProxy() const
Definition: ArmarXManagerItem.cpp:68
armarx::ArmarXManagerItem::getEndpointStr
QString getEndpointStr() const
Definition: ArmarXManagerItem.cpp:80