Go to the documentation of this file.
30 #include <ArmarXCore/interface/core/ManagedIceObjectDefinitions.h>
36 bool hasObjectNameParameter) :
40 if (hasObjectNameParameter)
42 defineOptionalProperty<std::string>(
43 "ObjectName",
"",
"Name of IceGrid well-known object");
45 defineOptionalProperty<MessageTypeT>(
"MinimumLoggingLevel",
47 "Local logging level only for this component",
49 defineOptionalProperty<bool>(
"EnableProfiling",
51 "enable profiler which is used for logging performance events",
60 configDomain =
"ArmarX";
61 createdByComponentCreate =
false;
82 return configDomain +
"." + configName;
88 const std::string& configDomain)
93 this->configDomain = configDomain;
94 this->configName = configName;
116 ARMARX_DEBUG <<
"Subscribing to topic `" << offered_topic_name <<
"`.";
123 ARMARX_DEBUG <<
"Using component proxy `" << proxy_name <<
"`.";
130 ARMARX_DEBUG <<
"Offering topic `" << proxy_name <<
"`.";
148 additionalPropertyUsers.push_back(subPropertyUser);
151 std::vector<PropertyUserPtr>
155 return additionalPropertyUsers;
168 usingTopic(getProperty<std::string>(propertyName), orderedPublishing);
175 return usingProxy(getProperty<std::string>(propertyName), endpoints);
182 this->createdByComponentCreate =
true;
188 ARMARX_DEBUG <<
"call postCreatePropertyDefinitions for all plugins...";
190 [&](
const auto& typeidx,
const auto& name,
const auto& plugin)
195 <<
") postCreatePropertyDefinitions...";
196 ptr->postCreatePropertyDefinitions(props);
198 <<
") postCreatePropertyDefinitions...done!";
204 <<
") is no ComponentPlugin (not calling postCreatePropertyDefinitions)";
209 BOOST_CURRENT_FUNCTION);
210 ARMARX_DEBUG <<
"call postCreatePropertyDefinitions for all plugins...done!";
221 Component::icePropertiesUpdated(
const std::set<std::string>& changedProperties)
231 if (changedProperties.count(
"MinimumLoggingLevel") &&
232 getProperty<MessageTypeT>(
"MinimumLoggingLevel").isSet())
235 getProperty<MessageTypeT>(
"MinimumLoggingLevel").getValue());
240 if (changedProperties.count(
"ObjectName") && getProperty<std::string>(
"ObjectName").isSet())
250 if (changedProperties.count(
"EnableProfiling"))
256 if (
getState() > eManagedIceObjectInitialized)
259 ARMARX_DEBUG <<
"call componentPropertiesUpdated for all plugins...";
261 [&](
const auto& typeidx,
const auto& name,
const auto& plugin)
263 if (
auto ptr =
dynamic_cast<ComponentPlugin*
>(plugin))
266 <<
") componentPropertiesUpdated...";
267 ptr->componentPropertiesUpdated(changedProperties);
269 <<
") componentPropertiesUpdated...done!";
274 <<
"plugin '" << name <<
"' (" <<
GetTypeString(typeidx.name())
275 <<
") is no ComponentPlugin (not calling componentPropertiesUpdated)";
280 BOOST_CURRENT_FUNCTION);
281 ARMARX_DEBUG <<
"call componentPropertiesUpdated for all plugins...done!";
289 (void)changedProperties;
void setName(std::string name)
Override name of well-known object.
IceManagerPtr getIceManager() const
Returns the IceManager.
virtual void preOnInitComponent() override
void addPropertyUser(const PropertyUserPtr &subPropertyUser)
Add additional property users here that should show up in the application help text.
void updateProxies(IceManagerPtr)
virtual void componentPropertiesUpdated(const std::set< std::string > &changedProperties)
Implement this function if you would like to react to changes in the properties.
int getState() const
Retrieve current state of the ManagedIceObject.
void offeringTopicFromProperty(const std::string &propertyName)
Offer a topic whose name is specified by the given property.
bool usingProxyFromProperty(const std::string &propertyName, const std::string &endpoints="")
Use a proxy whose name is specified by the given property.
void injectPropertyDefinitions(PropertyDefinitionsPtr &props) override
PropertyDefinitionsPtr createPropertyDefinitions() override
bool empty(const std::string &s)
virtual void icePropertiesInitialized()
std::vector< std::string > getComponentProxyNames()
std::vector< std::string > getTopicProxyNames()
Ice::PropertiesPtr createProperties()
std::vector< PropertyUserPtr > getAdditionalPropertyUsers() const
void usingTopicFromProperty(const std::string &propertyName, bool orderedPublishing=false)
Use a topic whose name is specified by the given property.
void setLocalMinimumLoggingLevel(MessageTypeT level)
With setLocalMinimumLoggingLevel the minimum verbosity-level of log-messages can be set.
PropertyDefinitionContainer.
std::string getConfigDomain()
Retrieve config domain for this component as set in constructor.
std::string GetTypeString(const std::type_info &tinf, bool withoutNamespaceSpecifier=false)
T getValue(nlohmann::json &userConfig, nlohmann::json &defaultConfig, const std::string &entryName)
void usingTopic(const std::string &name, bool orderedPublishing=false)
Registers a proxy for subscription after initialization.
std::string getConfigIdentifier()
Retrieve config identifier for this component as set in constructor.
Default component property definition container.
void offeringTopic(const std::string &name)
Registers a topic for retrival after initialization.
void initializeProperties(const std::string &configName, Ice::PropertiesPtr const &properties, const std::string &configDomain)
initializes the properties of this component.
void forceComponentCreatedByComponentCreateFunc()
forces the flag to be set to true that the object instance was created by the Component::create funct...
void enableProfiler(bool enable)
setProfiler allows setting ManagedIceObject::profiler to a new instance (if the new instance is actua...
ComponentPropertyDefinitions(std::string prefix, bool hasObjectNameParameter=true)
virtual void preOnConnectComponent() override
std::string getName() const
Retrieve name of object.
void setTag(const LogTag &tag)
Component()
Protected default constructor. Used for virtual inheritance. Use createManagedIceObject() instead.
virtual void setIceProperties(Ice::PropertiesPtr properties)
Sets the Ice properties.
bool usingProxy(const std::string &name, const std::string &endpoints="")
Registers a proxy for retrieval after initialization and adds it to the dependency list.
std::string getConfigName()
Retrieve config name for this component as set in constructor.
std::vector< std::string > getSubscribedTopicNames()
This file offers overloads of toIce() and fromIce() functions for STL container types.