Skip to content

Commit

Permalink
Merge pull request #12 from ros/operator_constness
Browse files Browse the repository at this point in the history
make operators const (fix #10)
  • Loading branch information
dirk-thomas committed Aug 21, 2013
2 parents 4f87859 + 5b3efab commit c2edd7e
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions include/actionlib/client/client_goal_handle_imp.h
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ void ClientGoalHandle<ActionSpec>::cancel()
}

template<class ActionSpec>
bool ClientGoalHandle<ActionSpec>::operator==(const ClientGoalHandle<ActionSpec>& rhs)
bool ClientGoalHandle<ActionSpec>::operator==(const ClientGoalHandle<ActionSpec>& rhs) const
{
// Check if both are inactive
if (!active_ && !rhs.active_)
Expand All @@ -272,7 +272,7 @@ bool ClientGoalHandle<ActionSpec>::operator==(const ClientGoalHandle<ActionSpec>
}

template<class ActionSpec>
bool ClientGoalHandle<ActionSpec>::operator!=(const ClientGoalHandle<ActionSpec>& rhs)
bool ClientGoalHandle<ActionSpec>::operator!=(const ClientGoalHandle<ActionSpec>& rhs) const
{
return !(*this==rhs);
}
Expand Down
4 changes: 2 additions & 2 deletions include/actionlib/client/client_helpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -191,12 +191,12 @@ class ClientGoalHandle
* \brief Check if two goal handles point to the same goal
* \return TRUE if both point to the same goal. Also returns TRUE if both handles are inactive.
*/
bool operator==(const ClientGoalHandle<ActionSpec>& rhs);
bool operator==(const ClientGoalHandle<ActionSpec>& rhs) const;

/**
* \brief !(operator==())
*/
bool operator!=(const ClientGoalHandle<ActionSpec>& rhs);
bool operator!=(const ClientGoalHandle<ActionSpec>& rhs) const;

friend class GoalManager<ActionSpec>;
private:
Expand Down
4 changes: 2 additions & 2 deletions include/actionlib/client_goal_status.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,15 +101,15 @@ class ClientGoalStatus
/**
* \brief Straightforward enum equality check
*/
inline bool operator==(const ClientGoalStatus& rhs)
inline bool operator==(const ClientGoalStatus& rhs) const
{
return state_ == rhs.state_;
}

/**
* \brief Straightforward enum inequality check
*/
inline bool operator!=(const ClientGoalStatus& rhs)
inline bool operator!=(const ClientGoalStatus& rhs) const
{
return !(state_ == rhs.state_);
}
Expand Down
2 changes: 1 addition & 1 deletion include/actionlib/managed_list.h
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ class ManagedList
/**
* \brief Checks if two handles point to the same list elem
*/
bool operator==(const Handle& rhs)
bool operator==(const Handle& rhs) const
{
assert(valid_);
assert(rhs.valid_);
Expand Down
4 changes: 2 additions & 2 deletions include/actionlib/server/server_goal_handle.h
Original file line number Diff line number Diff line change
Expand Up @@ -144,14 +144,14 @@ namespace actionlib {
* @param other The ServerGoalHandle to compare to
* @return True if the ServerGoalHandles refer to the same goal, false otherwise
*/
bool operator==(const ServerGoalHandle& other);
bool operator==(const ServerGoalHandle& other) const;

/**
* @brief != operator for ServerGoalHandles
* @param other The ServerGoalHandle to compare to
* @return True if the ServerGoalHandles refer to different goals, false otherwise
*/
bool operator!=(const ServerGoalHandle& other);
bool operator!=(const ServerGoalHandle& other) const;

private:
/**
Expand Down
4 changes: 2 additions & 2 deletions include/actionlib/server/server_goal_handle_imp.h
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ namespace actionlib {
}

template <class ActionSpec>
bool ServerGoalHandle<ActionSpec>::operator==(const ServerGoalHandle& other){
bool ServerGoalHandle<ActionSpec>::operator==(const ServerGoalHandle& other) const{
if(!goal_ && !other.goal_)
return true;

Expand All @@ -304,7 +304,7 @@ namespace actionlib {
}

template <class ActionSpec>
bool ServerGoalHandle<ActionSpec>::operator!=(const ServerGoalHandle& other){
bool ServerGoalHandle<ActionSpec>::operator!=(const ServerGoalHandle& other) const{
return !(*this == other);
}

Expand Down

0 comments on commit c2edd7e

Please sign in to comment.