31#include <boost/current_function.hpp>
40#include <ArmarXCore/interface/core/ManagedIceObjectDefinitions.h>
47 bool hasObjectNameParameter) :
51 if (hasObjectNameParameter)
54 "ObjectName",
"",
"Name of IceGrid well-known object");
58 "Local logging level only for this component",
62 "enable profiler which is used for logging performance events",
71 configDomain =
"ArmarX";
72 createdByComponentCreate =
false;
93 return configDomain +
"." + configName;
99 const std::string& configDomain)
104 this->configDomain = configDomain;
105 this->configName = configName;
126 <<
"Logging level of this component is very low (Debug or Verbose). For debugging "
127 "and development purposes, this warning can be ignored and only serves as a "
128 "reminder. A low logging level can have a performance impact, so reset the "
129 "logging level to at least Info after it is not used anymore, and especially "
130 "for stable or production workspaces.";
139 ARMARX_DEBUG <<
"Subscribing to topic `" << offered_topic_name <<
"`.";
146 ARMARX_DEBUG <<
"Using component proxy `" << proxy_name <<
"`.";
153 ARMARX_DEBUG <<
"Offering topic `" << proxy_name <<
"`.";
171 additionalPropertyUsers.push_back(subPropertyUser);
174 std::vector<PropertyUserPtr>
178 return additionalPropertyUsers;
205 this->createdByComponentCreate =
true;
211 ARMARX_DEBUG <<
"call postCreatePropertyDefinitions for all plugins...";
213 [&](
const auto& typeidx,
const auto& name,
const auto& plugin)
218 <<
") postCreatePropertyDefinitions...";
219 ptr->postCreatePropertyDefinitions(props);
221 <<
") postCreatePropertyDefinitions...done!";
227 <<
") is no ComponentPlugin (not calling postCreatePropertyDefinitions)";
232 BOOST_CURRENT_FUNCTION);
233 ARMARX_DEBUG <<
"call postCreatePropertyDefinitions for all plugins...done!";
244 Component::icePropertiesUpdated(
const std::set<std::string>& changedProperties)
254 if (changedProperties.count(
"MinimumLoggingLevel") &&
273 if (changedProperties.count(
"EnableProfiling"))
279 if (
getState() > eManagedIceObjectInitialized)
282 ARMARX_DEBUG <<
"call componentPropertiesUpdated for all plugins...";
284 [&](
const auto& typeidx,
const auto& name,
const auto& plugin)
289 <<
") componentPropertiesUpdated...";
290 ptr->componentPropertiesUpdated(changedProperties);
292 <<
") componentPropertiesUpdated...done!";
297 <<
"plugin '" << name <<
"' (" <<
GetTypeString(typeidx.name())
298 <<
") is no ComponentPlugin (not calling componentPropertiesUpdated)";
303 BOOST_CURRENT_FUNCTION);
304 ARMARX_DEBUG <<
"call componentPropertiesUpdated for all plugins...done!";
312 (void)changedProperties;
Default component property definition container.
ComponentPropertyDefinitions(std::string prefix, bool hasObjectNameParameter=true)
Component()
Protected default constructor. Used for virtual inheritance. Use createManagedIceObject() instead.
std::string getConfigName()
Retrieve config name for this component as set in constructor.
void forceComponentCreatedByComponentCreateFunc()
forces the flag to be set to true that the object instance was created by the Component::create funct...
virtual void componentPropertiesUpdated(const std::set< std::string > &changedProperties)
Implement this function if you would like to react to changes in the properties.
std::vector< PropertyUserPtr > getAdditionalPropertyUsers() const
std::string getConfigDomain()
Retrieve config domain for this component as set in constructor.
bool usingProxyFromProperty(const std::string &propertyName, const std::string &endpoints="")
Use a proxy whose name is specified by the given property.
void offeringTopicFromProperty(const std::string &propertyName)
Offer a topic whose name is specified by the given property.
virtual void preOnInitComponent() override
virtual void preOnConnectComponent() override
void initializeProperties(const std::string &configName, Ice::PropertiesPtr const &properties, const std::string &configDomain)
initializes the properties of this component.
void usingTopicFromProperty(const std::string &propertyName, bool orderedPublishing=false)
Use a topic whose name is specified by the given property.
virtual void icePropertiesInitialized()
void addPropertyUser(const PropertyUserPtr &subPropertyUser)
Add additional property users here that should show up in the application help text.
PropertyDefinitionsPtr createPropertyDefinitions() override
std::string getConfigIdentifier()
Retrieve config identifier for this component as set in constructor.
Property< PropertyType > getProperty(const std::string &name)
void injectPropertyDefinitions(PropertyDefinitionsPtr &props) override
void setTag(const LogTag &tag)
void setLocalMinimumLoggingLevel(MessageTypeT level)
With setLocalMinimumLoggingLevel the minimum verbosity-level of log-messages can be set.
MessageTypeT getEffectiveLoggingLevel() const
void offeringTopic(const std::string &name)
Registers a topic for retrival after initialization.
bool usingProxy(const std::string &name, const std::string &endpoints="")
Registers a proxy for retrieval after initialization and adds it to the dependency list.
void usingTopic(const std::string &name, bool orderedPublishing=false)
Registers a proxy for subscription after initialization.
std::string getName() const
Retrieve name of object.
IceManagerPtr getIceManager() const
Returns the IceManager.
int getState() const
Retrieve current state of the ManagedIceObject.
void setName(std::string name)
Override name of well-known object.
void enableProfiler(bool enable)
setProfiler allows setting ManagedIceObject::profiler to a new instance (if the new instance is actua...
PropertyDefinitionContainer(const std::string &prefix)
std::string prefix
Prefix of the properties such as namespace, domain, component name, etc.
PropertyDefinition< PropertyType > & defineOptionalProperty(const std::string &name, PropertyType defaultValue, const std::string &description="", PropertyDefinitionBase::PropertyConstness constness=PropertyDefinitionBase::eConstant)
std::vector< std::string > getComponentProxyNames()
void updateProxies(IceManagerPtr)
virtual void setIceProperties(Ice::PropertiesPtr properties)
Sets the Ice properties.
std::vector< std::string > getSubscribedTopicNames()
std::vector< std::string > getTopicProxyNames()
#define ARMARX_DEBUG
The logging level for output that is only interesting while debugging.
#define ARMARX_WARNING
The logging level for unexpected behaviour, but not a serious problem.
Ice::PropertiesPtr createProperties()
::IceInternal::Handle<::Ice::Properties > PropertiesPtr
T getValue(nlohmann::json &userConfig, nlohmann::json &defaultConfig, const std::string &entryName)
client::plugins::ComponentPlugin ComponentPlugin
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.
IceUtil::Handle< class PropertyUser > PropertyUserPtr
PropertyUser smart pointer type.