Skip to content

Commit

Permalink
Merge pull request #11 from ika-rwth-aachen/fix/buildfarm
Browse files Browse the repository at this point in the history
  • Loading branch information
lreiher authored Feb 21, 2024
2 parents afc9811 + b3175ba commit ca1f64b
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,39 +30,45 @@ SOFTWARE.
namespace etsi_its_primitives_conversion {

template <typename T>
void toRos_INTEGER(const T& _INTEGER_in, long& INTEGER_out) {
int status = asn_INTEGER2long(&_INTEGER_in, &INTEGER_out);
void toRos_INTEGER(const T& _INTEGER_in, int64_t& INTEGER_out) {
long out;
int status = asn_INTEGER2long(&_INTEGER_in, &out);
if (status != 0)
throw std::range_error("Failed to convert INTEGER_t to long");
throw std::range_error("Failed to convert INTEGER_t to int64_t");
INTEGER_out = static_cast<int64_t>(out);
}

template <typename T>
void toRos_INTEGER(const T& _INTEGER_in, unsigned long& INTEGER_out) {
int status = asn_INTEGER2ulong(&_INTEGER_in, &INTEGER_out);
void toRos_INTEGER(const T& _INTEGER_in, uint64_t& INTEGER_out) {
unsigned long out;
int status = asn_INTEGER2ulong(&_INTEGER_in, &out);
if (status != 0)
throw std::range_error("Failed to convert INTEGER_t to unsigned long");
throw std::range_error("Failed to convert INTEGER_t to uint64_t");
INTEGER_out = static_cast<uint64_t>(out);
}

template <typename T>
void toRos_INTEGER(const long& _INTEGER_in, T& INTEGER_out) {
if (std::numeric_limits<T>::max() < _INTEGER_in)
throw std::range_error("Failed to convert long (" + std::to_string(_INTEGER_in) + ") to smaller integer type (max: " + std::to_string(std::numeric_limits<T>::max()) + ")");
INTEGER_out = _INTEGER_in;
INTEGER_out = static_cast<T>(_INTEGER_in);
}

template <typename T>
void toStruct_INTEGER(const long& _INTEGER_in, T& INTEGER_out) {
int status = asn_long2INTEGER(&INTEGER_out, _INTEGER_in);
void toStruct_INTEGER(const int64_t& _INTEGER_in, T& INTEGER_out) {
const long in = static_cast<long>(_INTEGER_in);
int status = asn_long2INTEGER(&INTEGER_out, in);
if (status != 0)
throw std::range_error("Failed to convert long to INTEGER_t");
throw std::range_error("Failed to convert int64_t to INTEGER_t");
}

void toStruct_INTEGER(const long& _INTEGER_in, long& INTEGER_out) {
void toStruct_INTEGER(const int64_t& _INTEGER_in, long& INTEGER_out) {
INTEGER_out = _INTEGER_in;
}

void toStruct_INTEGER(const long& _INTEGER_in, unsigned long& INTEGER_out) {
if (std::numeric_limits<unsigned long>::max() < _INTEGER_in) throw std::range_error("Failed to convert long to smaller unsigned long");
INTEGER_out = _INTEGER_in;

void toStruct_INTEGER(const int64_t& _INTEGER_in, unsigned long& INTEGER_out) {
if (_INTEGER_in < 0)
throw std::range_error("Failed to convert int64_t to unsigned long");
INTEGER_out = static_cast<unsigned long>(_INTEGER_in);
}
}
9 changes: 3 additions & 6 deletions etsi_its_rviz_plugins/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,8 @@ if(${ROS_VERSION} EQUAL 2)
# === ROS (CATKIN) =============================================================
elseif(${ROS_VERSION} EQUAL 1)

# Currently no support for ROS1!
# Specify that the directory should be excluded from the install target
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
DESTINATION .
EXCLUDE_FROM_ALL
)
find_package(catkin REQUIRED)

catkin_package()

endif()
4 changes: 4 additions & 0 deletions etsi_its_rviz_plugins/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,11 @@
<exec_depend condition="$ROS_VERSION == 2">rviz_satellite</exec_depend>
<exec_depend condition="$ROS_VERSION == 2">rviz2</exec_depend>

<!-- ROS -->
<buildtool_depend condition="$ROS_VERSION == 1">catkin</buildtool_depend>

<export>
<build_type condition="$ROS_VERSION == 1">catkin</build_type>
<build_type condition="$ROS_VERSION == 2">ament_cmake</build_type>
</export>

Expand Down

0 comments on commit ca1f64b

Please sign in to comment.