GazeTarget.cpp
Go to the documentation of this file.
1#include "GazeTarget.h"
2
3#include <iostream>
4#include <optional>
5#include <string>
6
10
12
14
16{
17 GazeTarget::GazeTarget() = default;
18
34
35 bool
37 {
38 return activationTimestamp.isValid();
39 }
40
41 bool
42 GazeTarget::isExpired(std::optional<DateTime> reference) const
43 {
44 // TODO: Expiry time point should actually be the target reached time point + duration, but
45 // since target reached cannot be assessed at this point, we use the activation as
46 // surrogate.
48
49 return reached.isValid() and duration.isPositive() and
50 reached + duration < reference.value_or(Clock::Now());
51 }
52
53 ::std::ostream&
54 operator<<(::std::ostream& os, const GazeTarget& target)
55 {
56 return os << "<GazeTarget name=" << target.name << ", creation=" << target.creationTimestamp
57 << ", priority=" << target.priority << ", duration=" << target.duration
58 << ", position=" << target.position.toEigen().transpose() << " (frame "
59 << target.position.agent << "/" << target.position.frame << ")>";
60 }
61} // namespace armarx::view_selection::gaze_targets
static DateTime Now()
Current time on the virtual clock.
Definition Clock.cpp:93
static DateTime Invalid()
Definition DateTime.cpp:57
The FramedPosition class.
Definition FramedPose.h:158
Represents a point in time.
Definition DateTime.h:25
Represents a duration.
Definition Duration.h:17
bool isExpired(std::optional< DateTime > reference=std::nullopt) const
::std::ostream & operator<<(::std::ostream &os, const GazeTarget &target)