TPIK  1.0
Task Priority Inverse Kinematics
Loading...
Searching...
No Matches
Action.h
Go to the documentation of this file.
1#ifndef __ACTION_H__
2#define __ACTION_H__
3
4#include "PriorityLevel.h"
5#include "TPIKDefines.h"
6#include <iostream>
7#include <vector>
8
9namespace tpik {
10/*
11* @brief Hierarchy typedef.
12*/
13typedef std::vector<std::shared_ptr<tpik::PriorityLevel>> Hierarchy;
14
15/*
16* @brief Action class.
17* @details Implementation of the Action class. Each action is composed by an ID and a vector of std::shared_ptr to
18* tpik::PriorityLevels defining the action hierarchy.
19*/
20
21class Action {
22public:
23 /*
24 * @brief Default constructor.
25 */
27 /*
28 * @brief Default de constructor.
29 */
31 /*
32 * @brief Methods setting the Action ID.
33 */
34 auto ID() -> std::string& { return ID_; }
35 /*
36 * @brief Methods getting and the Action ID.
37 */
38 auto ID() const -> const std::string& { return ID_; }
39 /*
40 * @brief Method checking whether the input tpik::PriorityLevel is present in the tpik::Action.
41 * @param[in] priorityLevel std::shared_ptr to the tpik::PriorityLevel.
42 * @return true if priorityLevel is in the action hierarchy, false otherwise.
43 */
44 bool FindPriorityLevel(const std::shared_ptr<PriorityLevel>& priorityLevel);
45 /*
46 * @brief Method adding the input tpik::PriorityLevel to the action.
47 * @param[in] priorityLevel shared_ptr to the tpik::PriorityLevel to be added.
48 */
49 void AddPriorityLevel(const std::shared_ptr<PriorityLevel> priorityLevel);
50 /*
51 * Method returning the action hierarchy;
52 * @return Action Hierarchy.
53 */
54 auto PriorityLevels() const -> const Hierarchy& { return priorityLevels_; }
55 /*
56 * @brief Overloading of the cout operator.
57 */
58 friend std::ostream& operator<<(std::ostream& os, Action const& action)
59 {
60 return os << "\033[1;37m"
61 << "Action ID " << action.ID_ << "\n"
62 << std::setprecision(4);
63 }
64
65private:
66 Hierarchy priorityLevels_; // The action Hierarchy.
67 std::string ID_; // The action ID.
68};
69}
70#endif
Definition Action.h:21
auto ID() const -> const std::string &
Definition Action.h:38
auto ID() -> std::string &
Definition Action.h:34
auto PriorityLevels() const -> const Hierarchy &
Definition Action.h:54
void AddPriorityLevel(const std::shared_ptr< PriorityLevel > priorityLevel)
friend std::ostream & operator<<(std::ostream &os, Action const &action)
Definition Action.h:58
bool FindPriorityLevel(const std::shared_ptr< PriorityLevel > &priorityLevel)
Definition Action.h:9
std::vector< std::shared_ptr< tpik::PriorityLevel > > Hierarchy
Definition Action.h:13