diff --git a/etsi_its_conversion/etsi_its_primitives_conversion/include/etsi_its_primitives_conversion/convertINTEGER.h b/etsi_its_conversion/etsi_its_primitives_conversion/include/etsi_its_primitives_conversion/convertINTEGER.h index 36a3c3c43..45ab3b2fb 100644 --- a/etsi_its_conversion/etsi_its_primitives_conversion/include/etsi_its_primitives_conversion/convertINTEGER.h +++ b/etsi_its_conversion/etsi_its_primitives_conversion/include/etsi_its_primitives_conversion/convertINTEGER.h @@ -30,72 +30,43 @@ SOFTWARE. namespace etsi_its_primitives_conversion { template - void toRos_INTEGER(const T& _INTEGER_in, long& INTEGER_out) { - int status = asn_INTEGER2long(&_INTEGER_in, &INTEGER_out); - if (status != 0) - throw std::range_error("Failed to convert INTEGER_t to long"); - } - - template - void toRos_INTEGER(const T& _INTEGER_in, long long& 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"); - INTEGER_out = static_cast(out); - } - - template - void toRos_INTEGER(const T& _INTEGER_in, unsigned long& INTEGER_out) { - int status = asn_INTEGER2ulong(&_INTEGER_in, &INTEGER_out); - if (status != 0) - throw std::range_error("Failed to convert INTEGER_t to unsigned long"); + INTEGER_out = static_cast(out); } template - void toRos_INTEGER(const T& _INTEGER_in, unsigned long long& 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"); - INTEGER_out = static_cast(out); + INTEGER_out = static_cast(out); } template - void toRos_INTEGER(const long& _INTEGER_in, T& INTEGER_out) { + void toRos_INTEGER(const int64_t& _INTEGER_in, T& INTEGER_out) { if (std::numeric_limits::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::max()) + ")"); - INTEGER_out = _INTEGER_in; - } - - template - void toStruct_INTEGER(const long& _INTEGER_in, T& INTEGER_out) { - int status = asn_long2INTEGER(&INTEGER_out, _INTEGER_in); - if (status != 0) - throw std::range_error("Failed to convert long to INTEGER_t"); + throw std::range_error("Failed to convert int64_t (" + std::to_string(_INTEGER_in) + ") to smaller integer type (max: " + std::to_string(std::numeric_limits::max()) + ")"); + INTEGER_out = static_cast(_INTEGER_in); } template - void toStruct_INTEGER(const long long& _INTEGER_in, T& INTEGER_out) { + void toStruct_INTEGER(const int64_t& _INTEGER_in, T& INTEGER_out) { const long in = static_cast(_INTEGER_in); int status = asn_long2INTEGER(&INTEGER_out, in); if (status != 0) throw std::range_error("Failed to convert long to INTEGER_t"); } - void toStruct_INTEGER(const long& _INTEGER_in, long& INTEGER_out) { + void toStruct_INTEGER(const int64_t& _INTEGER_in, int64_t& INTEGER_out) { INTEGER_out = _INTEGER_in; } - void toStruct_INTEGER(const long long& _INTEGER_in, long long& INTEGER_out) { - INTEGER_out = _INTEGER_in; - } - - void toStruct_INTEGER(const long& _INTEGER_in, unsigned long& INTEGER_out) { - INTEGER_out = static_cast(_INTEGER_in); - } - - void toStruct_INTEGER(const long long& _INTEGER_in, unsigned long long& INTEGER_out) { - INTEGER_out = static_cast(_INTEGER_in); + void toStruct_INTEGER(const int64_t& _INTEGER_in, uint64_t& INTEGER_out) { + INTEGER_out = static_cast(_INTEGER_in); } } \ No newline at end of file