YARP
Yet Another Robot Platform
Action.cpp
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2006-2021 Istituto Italiano di Tecnologia (IIT)
3 * SPDX-License-Identifier: BSD-3-Clause
4 */
5
7
9
10#include <yarp/os/LogStream.h>
11
12#include <string>
13
14
16{
17public:
18 Private(Action* /*parent*/) :
21 level(0)
22 {
23 }
24
27 unsigned int level;
29};
30
32{
33 dbg << "(\"" << ActionPhaseToString(t.phase()) << ":" << ActionTypeToString(t.type()) << ":" << t.level() << "\"";
34 if (!t.params().empty()) {
35 dbg << ", params = [";
36 dbg << t.params();
37 dbg << "]";
38 }
39 dbg << ")";
40 return dbg;
41}
42
44 mPriv(new Private(this))
45{
46}
47
48yarp::robotinterface::Action::Action(const std::string& phase, const std::string& type, unsigned int level) :
49 mPriv(new Private(this))
50{
53 mPriv->level = level;
54}
55
57 mPriv(new Private(this))
58{
59 mPriv->phase = phase;
60 mPriv->type = type;
61 mPriv->level = level;
62}
63
65 mPriv(new Private(this))
66{
67 mPriv->phase = other.mPriv->phase;
68 mPriv->type = other.mPriv->type;
69 mPriv->level = other.mPriv->level;
70 mPriv->params = other.mPriv->params;
71}
72
74{
75 if (&other != this) {
76 mPriv->phase = other.mPriv->phase;
77 mPriv->type = other.mPriv->type;
78 mPriv->level = other.mPriv->level;
79
80 mPriv->params.clear();
81 mPriv->params = other.mPriv->params;
82 }
83
84 return *this;
85}
86
88{
89 delete mPriv;
90}
91
93{
94 return mPriv->phase;
95}
96
98{
99 return mPriv->type;
100}
101
103{
104 return mPriv->level;
105}
106
108{
109 return mPriv->params;
110}
111
113{
114 return mPriv->phase;
115}
116
118{
119 return mPriv->type;
120}
121
123{
124 return mPriv->level;
125}
126
128{
129 return mPriv->params;
130}
131
132bool yarp::robotinterface::Action::hasParam(const std::string& name) const
133{
134 return yarp::robotinterface::hasParam(mPriv->params, name);
135}
136
137std::string yarp::robotinterface::Action::findParam(const std::string& name) const
138{
139 return yarp::robotinterface::findParam(mPriv->params, name);
140}
yarp::os::LogStream operator<<(yarp::os::LogStream dbg, const yarp::robotinterface::Action &t)
Definition: Action.cpp:31
float t
Action & operator=(const Action &other)
Definition: Action.cpp:73
bool hasParam(const std::string &name) const
Definition: Action.cpp:132
unsigned int & level()
Definition: Action.cpp:102
ActionPhase & phase()
Definition: Action.cpp:92
std::string findParam(const std::string &name) const
Definition: Action.cpp:137
std::string ActionTypeToString(robotinterface::ActionType actiontype)
Definition: Types.cpp:147
bool hasParam(const robotinterface::ParamList &list, const std::string &name)
Definition: Types.cpp:16
std::vector< robotinterface::Param > ParamList
Definition: Types.h:30
robotinterface::ActionPhase StringToActionPhase(const std::string &phase)
Definition: Types.cpp:81
robotinterface::ActionType StringToActionType(const std::string &type)
Definition: Types.cpp:126
std::string findParam(const robotinterface::ParamList &list, const std::string &name)
Definition: Types.cpp:26
std::string ActionPhaseToString(robotinterface::ActionPhase actionphase)
Definition: Types.cpp:99