Skip to content

Commit

Permalink
Fix const correctness in IPositionDirect (YARP 3)
Browse files Browse the repository at this point in the history
  • Loading branch information
PeterBowman committed Jun 2, 2018
1 parent b873d6a commit c2023a1
Show file tree
Hide file tree
Showing 17 changed files with 79 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,14 @@ class CanBusControlboard : public yarp::dev::DeviceDriver, public yarp::dev::ICo
* refs 10 30 40
* @return true/false on success/failure
*/
virtual bool setPositions(const int n_joint, const int *joints, double *refs);
virtual bool setPositions(const int n_joint, const int *joints, const double *refs);

#if YARP_VERSION_MAJOR != 3
virtual bool setPositions(const int n_joint, const int *joints, double *refs)
{
return setPositions(n_joint, joints, const_cast<const double *>(refs));
}
#endif // YARP_VERSION_MAJOR != 3

/** Set new position for a set of axis.
* @param refs specifies the new reference points
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ bool roboticslab::CanBusControlboard::setPosition(int j, double ref)

// -----------------------------------------------------------------------------

bool roboticslab::CanBusControlboard::setPositions(const int n_joint, const int *joints, double *refs)
bool roboticslab::CanBusControlboard::setPositions(const int n_joint, const int *joints, const double *refs)
{
CD_DEBUG("n_joint:%d, drivers.size():" CD_SIZE_T "\n",n_joint,nodes.size());

Expand Down
6 changes: 6 additions & 0 deletions libraries/YarpPlugins/CuiAbsolute/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@ target_link_libraries(CuiAbsolute YARP::YARP_OS
YARP::YARP_dev
YarpDevicesInterfaces)

# Hack, fool CMake to think that YARP already switched to 3.0 while still at devel.
# https://github.com/roboticslab-uc3m/yarp-devices/issues/180
if(NOT YARP_VERSION_SHORT VERSION_LESS 2.3.73)
target_compile_definitions(CuiAbsolute PUBLIC YARP_VERSION_MAJOR=3)
endif()

yarp_install(TARGETS CuiAbsolute
COMPONENT runtime
LIBRARY DESTINATION ${ROBOTICSLAB-YARP-DEVICES_DYNAMIC_PLUGINS_INSTALL_DIR}
Expand Down
8 changes: 7 additions & 1 deletion libraries/YarpPlugins/CuiAbsolute/CuiAbsolute.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,13 @@ class CuiAbsolute : public yarp::dev::DeviceDriver, public yarp::dev::IControlLi

// ------- IPositionDirectRaw declarations. Implementation in IPositionDirectRawImpl.cpp -------
virtual bool setPositionRaw(int j, double ref);
virtual bool setPositionsRaw(const int n_joint, const int *joints, double *refs);
virtual bool setPositionsRaw(const int n_joint, const int *joints, const double *refs);
#if YARP_VERSION_MAJOR != 3
virtual bool setPositionsRaw(const int n_joint, const int *joints, double *refs)
{
return setPositionsRaw(n_joint, joints, const_cast<const double *>(refs));
}
#endif // YARP_VERSION_MAJOR != 3
virtual bool setPositionsRaw(const double *refs);

// -------- ITorqueControlRaw declarations. Implementation in ITorqueControlRawImpl.cpp --------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ bool roboticslab::CuiAbsolute::setPositionRaw(int j, double ref)
return true;
}

bool roboticslab::CuiAbsolute::setPositionsRaw(const int n_joint, const int *joints, double *refs)
bool roboticslab::CuiAbsolute::setPositionsRaw(const int n_joint, const int *joints, const double *refs)
{
CD_DEBUG("\n");
this->positionMoveRaw(0,refs[0]);
Expand Down
6 changes: 6 additions & 0 deletions libraries/YarpPlugins/FakeJoint/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@ target_link_libraries(FakeJoint YARP::YARP_OS
YARP::YARP_dev
YarpDevicesInterfaces)

# Hack, fool CMake to think that YARP already switched to 3.0 while still at devel.
# https://github.com/roboticslab-uc3m/yarp-devices/issues/180
if(NOT YARP_VERSION_SHORT VERSION_LESS 2.3.73)
target_compile_definitions(FakeJoint PUBLIC YARP_VERSION_MAJOR=3)
endif()

yarp_install(TARGETS FakeJoint
COMPONENT runtime
LIBRARY DESTINATION ${ROBOTICSLAB-YARP-DEVICES_DYNAMIC_PLUGINS_INSTALL_DIR}
Expand Down
8 changes: 7 additions & 1 deletion libraries/YarpPlugins/FakeJoint/FakeJoint.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,13 @@ class FakeJoint : public yarp::dev::DeviceDriver, public yarp::dev::IControlLimi

// ------- IPositionDirectRaw declarations. Implementation in IPositionDirectRawImpl.cpp -------
virtual bool setPositionRaw(int j, double ref);
virtual bool setPositionsRaw(const int n_joint, const int *joints, double *refs);
virtual bool setPositionsRaw(const int n_joint, const int *joints, const double *refs);
#if YARP_VERSION_MAJOR != 3
virtual bool setPositionsRaw(const int n_joint, const int *joints, double *refs)
{
return setPositionsRaw(n_joint, joints, const_cast<const double *>(refs));
}
#endif // YARP_VERSION_MAJOR != 3
virtual bool setPositionsRaw(const double *refs);

// -------- ITorqueControlRaw declarations. Implementation in ITorqueControlRawImpl.cpp --------
Expand Down
2 changes: 1 addition & 1 deletion libraries/YarpPlugins/FakeJoint/IPositionDirectRawImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ bool roboticslab::FakeJoint::setPositionRaw(int j, double ref)

// ------------------------------------------------------------------------------

bool roboticslab::FakeJoint::setPositionsRaw(const int n_joint, const int *joints, double *refs)
bool roboticslab::FakeJoint::setPositionsRaw(const int n_joint, const int *joints, const double *refs)
{
CD_DEBUG("\n");
this->positionMoveRaw(0,refs[0]);
Expand Down
6 changes: 6 additions & 0 deletions libraries/YarpPlugins/LacqueyFetch/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@ target_link_libraries(LacqueyFetch YARP::YARP_OS
YARP::YARP_dev
YarpDevicesInterfaces)

# Hack, fool CMake to think that YARP already switched to 3.0 while still at devel.
# https://github.com/roboticslab-uc3m/yarp-devices/issues/180
if(NOT YARP_VERSION_SHORT VERSION_LESS 2.3.73)
target_compile_definitions(LacqueyFetch PUBLIC YARP_VERSION_MAJOR=3)
endif()

yarp_install(TARGETS LacqueyFetch
COMPONENT runtime
LIBRARY DESTINATION ${ROBOTICSLAB-YARP-DEVICES_DYNAMIC_PLUGINS_INSTALL_DIR}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ bool roboticslab::LacqueyFetch::setPositionRaw(int j, double ref)
return true;
}

bool roboticslab::LacqueyFetch::setPositionsRaw(const int n_joint, const int *joints, double *refs)
bool roboticslab::LacqueyFetch::setPositionsRaw(const int n_joint, const int *joints, const double *refs)
{
CD_DEBUG("\n");
this->positionMoveRaw(0,refs[0]);
Expand Down
8 changes: 7 additions & 1 deletion libraries/YarpPlugins/LacqueyFetch/LacqueyFetch.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,13 @@ class LacqueyFetch : public yarp::dev::DeviceDriver, public yarp::dev::IControlL

// ------- IPositionDirectRaw declarations. Implementation in IPositionDirectRawImpl.cpp -------
virtual bool setPositionRaw(int j, double ref);
virtual bool setPositionsRaw(const int n_joint, const int *joints, double *refs);
virtual bool setPositionsRaw(const int n_joint, const int *joints, const double *refs);
#if YARP_VERSION_MAJOR != 3
virtual bool setPositionsRaw(const int n_joint, const int *joints, double *refs)
{
return setPositionsRaw(n_joint, joints, const_cast<const double *>(refs));
}
#endif // YARP_VERSION_MAJOR != 3
virtual bool setPositionsRaw(const double *refs);

// -------- ITorqueControlRaw declarations. Implementation in ITorqueControlRawImpl.cpp --------
Expand Down
6 changes: 6 additions & 0 deletions libraries/YarpPlugins/TechnosoftIpos/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@ target_link_libraries(TechnosoftIpos YARP::YARP_OS
YARP::YARP_dev
YarpDevicesInterfaces)

# Hack, fool CMake to think that YARP already switched to 3.0 while still at devel.
# https://github.com/roboticslab-uc3m/yarp-devices/issues/180
if(NOT YARP_VERSION_SHORT VERSION_LESS 2.3.73)
target_compile_definitions(TechnosoftIpos PUBLIC YARP_VERSION_MAJOR=3)
endif()

yarp_install(TARGETS TechnosoftIpos
COMPONENT runtime
LIBRARY DESTINATION ${ROBOTICSLAB-YARP-DEVICES_DYNAMIC_PLUGINS_INSTALL_DIR}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ bool roboticslab::TechnosoftIpos::setPositionRaw(int j, double ref)

// -----------------------------------------------------------------------------

bool roboticslab::TechnosoftIpos::setPositionsRaw(const int n_joint, const int *joints, double *refs)
bool roboticslab::TechnosoftIpos::setPositionsRaw(const int n_joint, const int *joints, const double *refs)
{
//CD_INFO("n_joint:%d, drivers.size():" CD_SIZE_T "\n",n_joint,drivers.size());

Expand Down
8 changes: 7 additions & 1 deletion libraries/YarpPlugins/TechnosoftIpos/TechnosoftIpos.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,13 @@ class TechnosoftIpos : public yarp::dev::DeviceDriver, public yarp::dev::IContro

// ------- IPositionDirectRaw declarations. Implementation in IPositionDirectRawImpl.cpp -------
virtual bool setPositionRaw(int j, double ref);
virtual bool setPositionsRaw(const int n_joint, const int *joints, double *refs);
virtual bool setPositionsRaw(const int n_joint, const int *joints, const double *refs);
#if YARP_VERSION_MAJOR != 3
virtual bool setPositionsRaw(const int n_joint, const int *joints, double *refs)
{
return setPositionsRaw(n_joint, joints, const_cast<const double *>(refs));
}
#endif // YARP_VERSION_MAJOR != 3
virtual bool setPositionsRaw(const double *refs);

// -------- ITorqueControlRaw declarations. Implementation in ITorqueControlRawImpl.cpp --------
Expand Down
6 changes: 6 additions & 0 deletions libraries/YarpPlugins/TextilesHand/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ target_link_libraries(TextilesHand YARP::YARP_OS
YARP::YARP_dev
YarpDevicesInterfaces)

# Hack, fool CMake to think that YARP already switched to 3.0 while still at devel.
# https://github.com/roboticslab-uc3m/yarp-devices/issues/180
if(NOT YARP_VERSION_SHORT VERSION_LESS 2.3.73)
target_compile_definitions(TextilesHand PUBLIC YARP_VERSION_MAJOR=3)
endif()

yarp_install(TARGETS TextilesHand
COMPONENT runtime
LIBRARY DESTINATION ${ROBOTICSLAB-YARP-DEVICES_DYNAMIC_PLUGINS_INSTALL_DIR}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ bool roboticslab::TextilesHand::setPositionRaw(int j, double ref)

// ----------------------------------------------------------------------------------------

bool roboticslab::TextilesHand::setPositionsRaw(const int n_joint, const int *joints, double *refs)
bool roboticslab::TextilesHand::setPositionsRaw(const int n_joint, const int *joints, const double *refs)
{
CD_DEBUG("\n");
this->positionMoveRaw(0,refs[0]);
Expand Down
8 changes: 7 additions & 1 deletion libraries/YarpPlugins/TextilesHand/TextilesHand.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,13 @@ class TextilesHand : public yarp::dev::DeviceDriver, public yarp::dev::IControlL

// ------- IPositionDirectRaw declarations. Implementation in IPositionDirectRawImpl.cpp -------
virtual bool setPositionRaw(int j, double ref);
virtual bool setPositionsRaw(const int n_joint, const int *joints, double *refs);
virtual bool setPositionsRaw(const int n_joint, const int *joints, const double *refs);
#if YARP_VERSION_MAJOR != 3
virtual bool setPositionsRaw(const int n_joint, const int *joints, double *refs)
{
return setPositionsRaw(n_joint, joints, const_cast<const double *>(refs));
}
#endif // YARP_VERSION_MAJOR != 3
virtual bool setPositionsRaw(const double *refs);

// -------- ITorqueControlRaw declarations. Implementation in ITorqueControlRawImpl.cpp --------
Expand Down

0 comments on commit c2023a1

Please sign in to comment.