7#include <RobotAPI/libraries/armem_skills/aron/Statechart.aron.generated.h>
23 const std::string& prefix)
26 defs->optional(p.statechartCoreSegmentName,
27 "StatechartCoreSegmentName",
28 "Name of the core segment for statecharts.");
29 defs->optional(p.statechartTransitionsProviderSegmentName,
30 "TransitionsProviderSegmentName",
31 "Name of the provider segment for statechart transitions.");
32 defs->optional(p.statechartTransitionsTopicName,
33 "tpc.sub.ProfilerListener",
34 "Name of the ProfilerListenerInterface topics to subscribe.");
49 const ProfilerStatechartTransitionWithParameters& t)
56 static std::atomic_flag warned = ATOMIC_FLAG_INIT;
57 if (!warned.test_and_set())
60 "transition before init() or after shutdown; "
61 "dropping. This warning is only logged once.";
66 const std::string& entityName = getStatechartName(t.targetStateIdentifier);
71 update.entityID =
segmentPtr->id().withEntityName(entityName);
73 update.referencedTime = transitionTime;
74 skills::arondto::Statechart::Transition
data;
76 update.instancesData.push_back(
data.toAron());
94 const ProfilerStatechartTransitionWithParametersList& transitions)
96 for (
const auto& t : transitions)
103 StatechartListenerProviderSegment::getStatechartName(std::string stateName)
105 const std::string delimiter =
"->";
106 const int maxLevels = 2;
110 std::string statechartName;
111 while ((pos = stateName.find(delimiter)) != std::string::npos && levels < maxLevels)
115 statechartName += delimiter;
117 statechartName += stateName.substr(0, pos);
118 stateName.erase(0, pos + delimiter.length());
122 return statechartName;
Base class for all exceptions thrown by the armem library.
Helps connecting a Memory server to the Ice interface.
virtual void defineProperties(armarx::PropertyDefinitionsPtr defs, const std::string &prefix="") override
SpecializedCoreSegment coreSegment
void setDefaultMaxHistorySize(int64_t maxHistorySize)
virtual void init() override
MemoryToIceAdapter & iceMemory
server::wm::ProviderSegment * segmentPtr
static Duration MicroSeconds(std::int64_t microSeconds)
Constructs a duration in microseconds.
void reportStatechartTransitionWithParameters(const ProfilerStatechartTransitionWithParameters &)
StatechartListenerProviderSegment(armem::server::MemoryToIceAdapter &iceMemory)
void reportStatechartTransitionWithParametersList(const ProfilerStatechartTransitionWithParametersList &)
void defineProperties(PropertyDefinitionsPtr defs, const std::string &prefix)
#define ARMARX_WARNING
The logging level for unexpected behaviour, but not a serious problem.
armarx::core::time::DateTime Time
void toAron(arondto::MemoryID &dto, const MemoryID &bo)
IceUtil::Handle< class PropertyDefinitionContainer > PropertyDefinitionsPtr
PropertyDefinitions smart pointer type.
A bundle of updates to be sent to the memory.
An update of an entity for a specific point in time.