Skip to content

Commit

Permalink
[measurement] Use unsigned type for topic id in hdf5 (#1883)
Browse files Browse the repository at this point in the history
  • Loading branch information
KerstinKeller authored Jan 10, 2025
1 parent c35f4dc commit 8e4d7f9
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 6 deletions.
19 changes: 19 additions & 0 deletions contrib/ecalhdf5/src/hdf5_helper.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
/* ========================= eCAL LICENSE =================================
*
* Copyright (C) 2024 - 2025 Continental Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* ========================= eCAL LICENSE =================================
*/

#include "hdf5_helper.h"

bool CreateStringEntryInRoot(hid_t root, const std::string& url, const std::string& dataset_content)
Expand Down
22 changes: 20 additions & 2 deletions contrib/ecalhdf5/src/hdf5_helper.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
/* ========================= eCAL LICENSE =================================
*
* Copyright (C) 2024 - 2025 Continental Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* ========================= eCAL LICENSE =================================
*/

#pragma once

#include <string>
Expand Down Expand Up @@ -54,8 +73,7 @@ inline std::string printHex(eCAL::experimental::measurement::base::Channel::id_t

inline eCAL::experimental::measurement::base::Channel::id_t parseHexID(std::string string_id)
{
auto unsigned_value = std::stoull(string_id, 0, 16);
return static_cast<eCAL::experimental::measurement::base::Channel::id_t>(unsigned_value);
return std::stoull(string_id, nullptr, 16);
}

namespace v6
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* ========================= eCAL LICENSE =================================
*
* Copyright (C) 2016 - 2024 Continental Corporation
* Copyright (C) 2016 - 2025 Continental Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -26,6 +26,7 @@

#include <cstdint>
#include <set>
#include <string>
#include <tuple>
#include <vector>

Expand Down Expand Up @@ -68,7 +69,7 @@ namespace eCAL

struct Channel
{
using id_t = std::int64_t;
using id_t = std::uint64_t;

std::string name = "";
id_t id = 0;
Expand Down
3 changes: 1 addition & 2 deletions tests/contrib/ecalhdf5/hdf5_test/src/hdf5_test.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* ========================= eCAL LICENSE =================================
*
* Copyright (C) 2016 - 2024 Continental Corporation
* Copyright (C) 2016 - 2025 Continental Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -1032,7 +1032,6 @@ TEST(HDF5, PrintParseHex)
std::vector<Channel::id_t> numeric_values =
{
0,
-1,
1,
std::numeric_limits<Channel::id_t>::min(),
std::numeric_limits<Channel::id_t>::max()
Expand Down

0 comments on commit 8e4d7f9

Please sign in to comment.