/usr/include/actionlib/client_goal_status.h is in libactionlib-dev 1.11.4-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 | /*********************************************************************
* Software License Agreement (BSD License)
*
* Copyright (c) 2008, Willow Garage, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
* * Neither the name of the Willow Garage nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*********************************************************************/
#ifndef ACTIONLIB_CLIENT_GOAL_STATUS_H_
#define ACTIONLIB_CLIENT_GOAL_STATUS_H_
#include <string>
#include "actionlib/GoalStatus.h"
namespace actionlib
{
/**
* \brief Thin wrapper around an enum in order to help interpret the client-side status of a goal request
* The possible states are defined the ClientGoalStatus::StateEnum. They are also defined in StateEnum.
* we can also get there from \link ClientGoalStatus::StateEnum here \endlink
**/
class ClientGoalStatus
{
public:
//! \brief Defines the various states the Goal can be in, as perceived by the client
enum StateEnum
{
PENDING, //!< The goal has yet to be processed by the action server
ACTIVE, //!< The goal is currently being processed by the action server
PREEMPTED, //!< The goal was preempted by either another goal, or a preempt message being sent to the action server
SUCCEEDED, //!< The goal was achieved successfully by the action server
ABORTED, //!< The goal was aborted by the action server
REJECTED, //!< The ActionServer refused to start processing the goal, possibly because a goal is infeasible
LOST //!< The goal was sent by the ActionClient, but disappeared due to some communication error
} ;
ClientGoalStatus(StateEnum state)
{
state_ = state;
}
/**
* \brief Build a ClientGoalStatus from a GoalStatus.
* Note that the only GoalStatuses that can be converted into a
* ClientGoalStatus are {PREEMPTED, SUCCEEDED, ABORTED, REJECTED}
* \param goal_status The GoalStatus msg that we want to convert
*/
ClientGoalStatus(const GoalStatus& goal_status)
{
fromGoalStatus(goal_status);
}
/**
* \brief Check if the goal is in a terminal state
* \return TRUE if in PREEMPTED, SUCCEDED, ABORTED, REJECTED, or LOST
*/
inline bool isDone() const
{
if (state_ == PENDING || state_ == ACTIVE)
return false;
return true;
}
/**
* \brief Copy the raw enum into the object
*/
inline const StateEnum& operator=(const StateEnum& state)
{
state_ = state;
return state;
}
/**
* \brief Straightforward enum equality check
*/
inline bool operator==(const ClientGoalStatus& rhs) const
{
return state_ == rhs.state_;
}
/**
* \brief Straightforward enum inequality check
*/
inline bool operator!=(const ClientGoalStatus& rhs) const
{
return !(state_ == rhs.state_);
}
/**
* \brief Store a GoalStatus in a ClientGoalStatus
* Note that the only GoalStatuses that can be converted into a
* ClientGoalStatus are {PREEMPTED, SUCCEEDED, ABORTED, REJECTED}
* \param goal_status The GoalStatus msg that we want to convert
*/
void fromGoalStatus(const GoalStatus& goal_status)
{
switch(goal_status.status)
{
case GoalStatus::PREEMPTED:
state_ = ClientGoalStatus::PREEMPTED; break;
case GoalStatus::SUCCEEDED:
state_ = ClientGoalStatus::SUCCEEDED; break;
case GoalStatus::ABORTED:
state_ = ClientGoalStatus::ABORTED; break;
case GoalStatus::REJECTED:
state_ = ClientGoalStatus::REJECTED; break;
default:
state_ = ClientGoalStatus::LOST;
ROS_ERROR_NAMED("actionlib", "Cannot convert GoalStatus %u to ClientGoalState", goal_status.status); break;
}
}
/**
* \brief Stringify the enum
* \return String that has the name of the enum
*/
std::string toString() const
{
switch(state_)
{
case PENDING:
return "PENDING";
case ACTIVE:
return "ACTIVE";
case PREEMPTED:
return "PREEMPTED";
case SUCCEEDED:
return "SUCCEEDED";
case ABORTED:
return "ABORTED";
case REJECTED:
return "REJECTED";
case LOST:
return "LOST";
default:
ROS_ERROR_NAMED("actionlib", "BUG: Unhandled ClientGoalStatus");
break;
}
return "BUG-UNKNOWN";
}
private:
StateEnum state_;
ClientGoalStatus(); //!< Need to always specific an initial state. Thus, no empty constructor
};
}
#endif // ACTION_TOOLS_CLIENT_GOAL_STATE_H_
|