TargetPriority.cpp
Go to the documentation of this file.
1 /*
2  * This file is part of ArmarX.
3  *
4  * ArmarX is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License version 2 as
6  * published by the Free Software Foundation.
7  *
8  * ArmarX is distributed in the hope that it will be useful, but
9  * WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program. If not, see <http://www.gnu.org/licenses/>.
15  *
16  * @package view_selection::ArmarXObjects::client
17  * @author Johann Mantel ( j-mantel at gmx dot net )
18  * @date 2022
19  * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
20  * GNU General Public License
21  */
22 
23 #include "TargetPriority.h"
24 
25 #include <iostream>
26 
28 {
29  TargetPriority::TargetPriority(const AttentionType& attentionType, double priority) :
30  attentionType(attentionType), priority(priority)
31  {
32  }
33 
34  bool
36  {
37  return attentionType < rhs.attentionType ||
38  (attentionType == rhs.attentionType && priority < rhs.priority);
39  }
40 
41  bool
43  {
44  return attentionType < rhs.attentionType ||
45  (attentionType == rhs.attentionType && priority <= rhs.priority);
46  }
47 
48  bool
50  {
51  return attentionType == rhs.attentionType && priority == rhs.priority;
52  }
53 
54  bool
56  {
57  return attentionType != rhs.attentionType || priority != rhs.priority;
58  }
59 
60  bool
62  {
63  return attentionType > rhs.attentionType ||
64  (attentionType == rhs.attentionType && priority >= rhs.priority);
65  }
66 
67  bool
69  {
70  return attentionType > rhs.attentionType ||
71  (attentionType == rhs.attentionType && priority > rhs.priority);
72  }
73 
74  std::ostream&
75  operator<<(std::ostream& os, const TargetPriority& prio)
76  {
77  return os << "{ " << AttentionTypeNames.to_name(prio.attentionType) << ", " << prio.priority
78  << " }";
79  }
80 
81 } // namespace armarx::view_selection::gaze_targets
armarx::view_selection::gaze_targets::TargetPriority::operator!=
bool operator!=(const TargetPriority &rhs) const
Definition: TargetPriority.cpp:55
armarx::view_selection::gaze_targets::AttentionTypeNames
const simox::meta::EnumNames< AttentionType > AttentionTypeNames
Definition: AttentionType.cpp:28
armarx::view_selection::gaze_targets::TargetPriority::priority
double priority
The priority among GazeTargets of same AttentionType.
Definition: TargetPriority.h:61
armarx::view_selection::gaze_targets::operator<<
::std::ostream & operator<<(::std::ostream &os, const GazeTarget &target)
Definition: GazeTarget.cpp:75
armarx::view_selection::gaze_targets::TargetPriority::operator==
bool operator==(const TargetPriority &rhs) const
Definition: TargetPriority.cpp:49
armarx::view_selection::gaze_targets::AttentionType
AttentionType
Describes the type of attention.
Definition: AttentionType.h:32
armarx::view_selection::gaze_targets::TargetPriority::operator<=
bool operator<=(const TargetPriority &rhs) const
Definition: TargetPriority.cpp:42
armarx::view_selection::gaze_targets
Definition: aron_conversions.cpp:25
armarx::view_selection::gaze_targets::TargetPriority::TargetPriority
TargetPriority(const AttentionType &attentionType=AttentionType::RandomEvent, double priority=-1)
Definition: TargetPriority.cpp:29
armarx::view_selection::gaze_targets::TargetPriority::operator>=
bool operator>=(const TargetPriority &rhs) const
Definition: TargetPriority.cpp:61
armarx::view_selection::gaze_targets::TargetPriority::attentionType
AttentionType attentionType
The type of attention, defining the first level of priority.
Definition: TargetPriority.h:59
TargetPriority.h
armarx::view_selection::gaze_targets::TargetPriority
The Priority of a GazeTarget.
Definition: TargetPriority.h:39
armarx::view_selection::gaze_targets::TargetPriority::operator>
bool operator>(const TargetPriority &rhs) const
Definition: TargetPriority.cpp:68
armarx::view_selection::gaze_targets::TargetPriority::operator<
bool operator<(const TargetPriority &rhs) const
Definition: TargetPriority.cpp:35