73 fillRecursively(RemoteGui::WidgetStateMap& widgetStates,
75 RemoteGui::WidgetPtr
const& widget,
76 RemoteGui::WidgetPtr
const& rootWidget)
81 out <<
"\nall state names: " <<
getMapKeys(widgetStates)
82 <<
"\nall value names: " <<
getMapKeys(values) <<
"\nwidget tree\n";
84 std::function<void(RemoteGui::WidgetPtr
const&, std::size_t)>
dump =
85 [&](RemoteGui::WidgetPtr
const& node, std::size_t lvl)
87 out << std::string(lvl * 4,
'-') <<
" " << node->name <<
" ["
89 for (
const auto&
c : node->children)
99 if (!handler.isValid(*widget, s))
101 throw LocalException()
102 <<
"Widget is not valid: " << widget->name <<
", WidgetT: " << widget->ice_id()
103 <<
", HandlerT: " << handler.getHandlerT() <<
"\nMessage:\n"
104 <<
s.str() << dumpInfo;
108 std::string
const& name = widget->name;
112 bool nameIsNew = widgetStates.emplace(widget->name, widget->defaultState).second;
116 throw LocalException()
117 <<
"Widget with name '" << widget->name <<
"' already exists" << dumpInfo;
119 nameIsNew =
values.emplace(widget->name, widget->defaultValue).second;
123 for (
auto& child : widget->children)
126 fillRecursively(widgetStates, values, child, rootWidget);
132 const RemoteGui::WidgetPtr& rootWidget,
138 std::unique_lock<std::mutex> lock(tabMutex);
139 tabs[tabId] = rootWidget;
142 auto& widgetStates = tabWidgetStates[tabId];
143 widgetStates.clear();
144 auto& values = tabStates[tabId];
148 fillRecursively(tabWidgetStates[tabId], tabStates[tabId], rootWidget, rootWidget);
151 topic->reportTabChanged(tabId);
160 std::unique_lock<std::mutex> lock(tabMutex);
162 tabWidgetStates.erase(tabId);
163 tabStates.erase(tabId);
165 topic->reportTabsRemoved();
171 std::unique_lock<std::mutex> lock(tabMutex);
175 RemoteGui::TabWidgetStateMap
178 std::unique_lock<std::mutex> lock(tabMutex);
179 return tabWidgetStates;
182 RemoteGui::TabValueMap
185 std::unique_lock<std::mutex> lock(tabMutex);
192 std::unique_lock<std::mutex> lock(tabMutex);
193 return tabStates.at(tabId);
198 const std::string& widgetName,
199 const RemoteGui::ValueVariant& value,
203 std::unique_lock<std::mutex> lock(tabMutex);
205 tabState.at(widgetName) = value;
207 delta[widgetName] = value;
208 topic->reportStateChanged(tabId, delta);
217 std::unique_lock<std::mutex> lock(tabMutex);
219 for (
const auto& pair : values)
221 merged[pair.first] = pair.second;
223 topic->reportStateChanged(tabId, values);
226 RemoteGui::WidgetStateMap
229 std::unique_lock<std::mutex> lock(tabMutex);
230 return tabWidgetStates.at(tabId);
235 const RemoteGui::WidgetStateMap& state,
239 std::unique_lock<std::mutex> lock(tabMutex);
240 RemoteGui::WidgetStateMap& tabWidgetState = tabWidgetStates.at(tabId);
241 tabWidgetState = state;
242 topic->reportWidgetChanged(tabId, tabWidgetState);
#define ARMARX_STREAM_PRINTER
use this macro to write output code that is executed when printed and thus not executed if the debug ...
std::string getConfigIdentifier()
Retrieve config identifier for this component as set in constructor.
Property< PropertyType > getProperty(const std::string &name)
void offeringTopic(const std::string &name)
Registers a topic for retrival after initialization.
TopicProxyType getTopic(const std::string &name)
Returns a proxy of the specified topic.
RemoteGui::TabWidgetStateMap getTabStates(const Ice::Current &) override
void onInitComponent() override
RemoteGui::WidgetStateMap getWidgetStates(const std::string &tabId, const Ice::Current &) override
void removeTab(const std::string &tabId, const Ice::Current &) override
void createTab(const std::string &tabId, const RemoteGui::WidgetPtr &rootWidget, const Ice::Current &) override
void onDisconnectComponent() override
void setWidgetStates(const std::string &tabId, const RemoteGui::WidgetStateMap &state, const Ice::Current &) override
armarx::PropertyDefinitionsPtr createPropertyDefinitions() override
RemoteGui::ValueMap getValues(const std::string &tabId, const Ice::Current &) override
RemoteGui::WidgetMap getTabs(const Ice::Current &) override
RemoteGui::TabValueMap getValuesForAllTabs(const Ice::Current &) override
void onConnectComponent() override
std::string getTopicName(const Ice::Current &) override
void onExitComponent() override
void setValues(const std::string &tabId, const RemoteGui::ValueMap &values, const Ice::Current &) override
void setValue(const std::string &tabId, const std::string &widgetName, const RemoteGui::ValueVariant &value, const Ice::Current &) override
void dump(vec_point_2d &vec)
#define ARMARX_CHECK_EXPRESSION(expression)
This macro evaluates the expression and if it turns out to be false it will throw an ExpressionExcept...
#define ARMARX_INFO
The normal logging level.
std::map< std::string, ValueVariant > ValueMap
const WidgetHandler & getWidgetHandler(WidgetPtr const &desc)
double s(double t, double s0, double v0, double a0, double j)
This file offers overloads of toIce() and fromIce() functions for STL container types.
std::string GetTypeString(const std::type_info &tinf, bool withoutNamespaceSpecifier=false)
IceUtil::Handle< class PropertyDefinitionContainer > PropertyDefinitionsPtr
PropertyDefinitions smart pointer type.
void getMapKeys(const MapType &map, OutputIteratorType it)