MemoryStatusHandlerBase.cpp
Go to the documentation of this file.
2
3#include <algorithm>
4#include <mutex>
5#include <vector>
6
9
11
13#include <armarx/view_selection/gaze_targets/aron/GazeTargetStatus.aron.generated.h>
16
18{
19
20 void
22 {
23 const std::scoped_lock lock(statusHandlingMutex);
24
25 const armem::wm::CoreSegment* coreSegment =
27
28 if (coreSegment == nullptr)
29 {
30 return;
31 }
32
33 std::vector<armem::wm::EntityInstance> instances;
34 coreSegment->forEachInstance([&](const armem::wm::EntityInstance& instance)
35 { instances.push_back(instance); });
36
37 // Transitions must be handled in the order they happened, or a client could see `Reached`
38 // after the `Released` that followed it.
39 std::sort(instances.begin(),
40 instances.end(),
42 {
43 ARMARX_CHECK(lhs.id().hasTimestamp());
44 ARMARX_CHECK(rhs.id().hasTimestamp());
45
46 return lhs.id().timestamp < rhs.id().timestamp;
47 });
48
49 for (const auto& instance : instances)
50 {
52 fromAron(gaze_targets::arondto::GazeTargetStatus::FromAron(instance.data()), status);
53
55 }
56 }
57
58} // namespace armarx::view_selection::client
Client-side working memory core segment.
Client-side working entity instance.
Client-side working memory.
void handleMemory(const armem::wm::Memory &memory)
Dispatches every GazeTargetStatus instance found, oldest first.
void handleStatus(const gaze_targets::GazeTargetStatus &status)
Logs the update and hands it to the matching callbacks.
Business Object (BO) class of GazeTargetStatus: the lifecycle of one gaze target request,...
const std::string GazeTargetStatusCoreSegmentName
Lifecycle of the requests in GazeTarget.
Definition constants.h:35
void fromAron(const arondto::PackagePath &dto, PackageFileLocation &bo)