33 unsigned long guiTaskPeriod)
39 const std::string& name,
42 unsigned long guiTaskPeriod)
44 std::lock_guard g{_tabsMutex};
47 ARMARX_INFO <<
"Replacing the tab " << tabName(name);
49 auto&
data = _tabs[name];
55 data.fnc = std::move(guiTaskFnc);
56 data.taskPeriod = guiTaskPeriod;
62 unsigned long guiTaskPeriod)
64 std::lock_guard g{_tabsMutex};
67 throw armarx::LocalException(
"Can only update Tab with a name for an already existing Tab");
69 auto&
data = _tabs[name];
75 data.taskPeriod = guiTaskPeriod;
83 std::lock_guard g{_tabsMutex};
84 return _tabs.at(name).tab;
89 std::lock_guard g{_tabsMutex};
90 return _tabs.count(name);
95 std::lock_guard g{_tabsMutex};
96 if (_tabs.count(name))
98 auto&
data = _tabs.at(name);
113 parent<Component>().usingProxyFromProperty(
makePropertyName(_propertyName));
121 parent<Component>().getProxyFromProperty(_remoteGui,
makePropertyName(_propertyName));
126 std::lock_guard g{_tabsMutex};
127 for (
auto& [name,
data] : _tabs)
140 std::lock_guard g{_tabsMutex};
141 for (
auto& [name,
data] : _tabs)
150 _remoteGui =
nullptr;
157 properties->defineOptionalProperty<std::string>(
160 "Name of the remote gui provider");
164 std::string RemoteGuiComponentPlugin::tabName(
const std::string& name)
166 return parent<ManagedIceObject>().getName() + (name.empty() ?
"" :
"_" + name);
169 void RemoteGuiComponentPlugin::create(
const std::string& name, RemoteGuiComponentPlugin::TabData& td)
172 const auto state = parent<ManagedIceObject>().getState();
174 state != ManagedIceObjectState::eManagedIceObjectStarting &&
175 state != ManagedIceObjectState::eManagedIceObjectStarted
187 const auto tabname = tabName(name);
188 td.task =
new SimplePeriodicTask<>([&td] {td.fnc(td.tab);}, td.taskPeriod);
189 _remoteGui->createTab(tabname, td.widget);
190 td.tab = RemoteGui::TabProxy(_remoteGui, tabname);
193 void RemoteGuiComponentPlugin::remove(
const std::string& name, RemoteGuiComponentPlugin::TabData& td)
202 const auto tabname = tabName(name);
204 _remoteGui->removeTab(tabname);
238 return *_remoteGuiComponentPlugin;
242 return *_remoteGuiComponentPlugin;