RemoteGuiBase.cpp
Go to the documentation of this file.
1 #include "RemoteGuiBase.h"
2 
5 
6 namespace armarx::RemoteGui
7 {
8 
9  RemoteGuiBase::RemoteGuiBase(const RemoteGuiInterfacePrx& remoteGui) : remoteGui(remoteGui)
10  {
11  }
12 
13  void
14  RemoteGuiBase::run()
15  {
16  constexpr int kCycleDurationMs = 100;
17 
18  CycleUtil c(kCycleDurationMs);
19  while (!runningTask->isStopped())
20  {
21  tab.receiveUpdates();
22 
23  handleEvents(tab);
24 
25  tab.sendUpdates();
26 
27  c.waitForCycleDuration();
28  }
29  }
30 
31  void
33  {
34  ARMARX_INFO << "RemoteGui: creating tab " << tabName();
35  remoteGui->createTab(tabName(), widget);
36  tab = TabProxy(remoteGui, tabName());
37 
38  runningTask = new RunningTask<RemoteGuiBase>(this, &RemoteGuiBase::run),
39  runningTask->start();
40  }
41 
42  void
44  {
45  if (!runningTask->isStopped())
46  {
47  runningTask->stop();
48  }
49 
50  ARMARX_DEBUG << "Removing tab: " << tabName();
51  remoteGui->removeTab(tabName());
52  }
53 
56  {
57  return tab;
58  }
59 
61  RemoteGuiBase::getTab() const
62  {
63  return tab;
64  }
65 
66  RemoteGuiInterfacePrx&
68  {
69  return remoteGui;
70  }
71 
72  const RemoteGuiInterfacePrx&
74  {
75  return remoteGui;
76  }
77 
78 } // namespace armarx::RemoteGui
armarx::RemoteGui::RemoteGuiBase::createTab
void createTab(const WidgetPtr &widget)
Definition: RemoteGuiBase.cpp:32
armarx::RemoteGui
Definition: LightweightRemoteGuiComponentPlugin.h:30
armarx::CycleUtil
This util class helps with keeping a cycle time during a control cycle.
Definition: CycleUtil.h:40
c
constexpr T c
Definition: UnscentedKalmanFilterTest.cpp:46
armarx::RunningTask
Definition: ArmarXMultipleObjectsScheduler.h:36
armarx::RemoteGui::RemoteGuiBase::tabName
virtual const std::string & tabName() const =0
armarx::RemoteGui::TabProxy
Definition: WidgetProxy.h:17
RemoteGuiBase.h
armarx::RemoteGui::TabProxy::receiveUpdates
void receiveUpdates()
Definition: WidgetProxy.h:135
armarx::RemoteGui::RemoteGuiBase::shutdown
void shutdown()
Definition: RemoteGuiBase.cpp:43
armarx::RemoteGui::RemoteGuiBase::getTab
armarx::RemoteGui::TabProxy & getTab()
Definition: RemoteGuiBase.cpp:55
ARMARX_DEBUG
#define ARMARX_DEBUG
Definition: Logging.h:184
armarx::WidgetDescription::WidgetPtr
::IceInternal::Handle<::armarx::WidgetDescription::Widget > WidgetPtr
Definition: NJointControllerBase.h:67
CycleUtil.h
ARMARX_INFO
#define ARMARX_INFO
Definition: Logging.h:181
armarx::RemoteGui::RemoteGuiBase::handleEvents
virtual void handleEvents(armarx::RemoteGui::TabProxy &tab)=0
armarx::RemoteGui::TabProxy::sendUpdates
void sendUpdates()
Definition: WidgetProxy.h:151
Logging.h
armarx::RemoteGui::RemoteGuiBase::getRemoteGui
RemoteGuiInterfacePrx & getRemoteGui()
Definition: RemoteGuiBase.cpp:67
armarx::RemoteGui::RemoteGuiBase::RemoteGuiBase
RemoteGuiBase(const RemoteGuiInterfacePrx &remoteGui)
Definition: RemoteGuiBase.cpp:9