Skip to content

Feature/c3d updates - #285

Open
petersteneteg wants to merge 9 commits into
masterfrom
feature/c3d-updates
Open

Feature/c3d updates#285
petersteneteg wants to merge 9 commits into
masterfrom
feature/c3d-updates

Conversation

@petersteneteg

Copy link
Copy Markdown
Member

No description provided.

@github-actions

Copy link
Copy Markdown

Cpp-Linter Report ⚠️

Some files did not pass the configured checks!

clang-tidy (v19.1.7) reports: 10 concern(s)
  • misc/c3d/include/inviwo/c3d/datastructures/c3ddata.h:40:26: warning: [cppcoreguidelines-special-member-functions]

    class 'C3D' defines a copy constructor, a copy assignment operator, a move constructor and a move assignment operator but does not define a destructor

       40 | class IVW_MODULE_C3D_API C3D : public ezc3d::c3d {
          |                          ^
  • misc/c3d/src/datastructures/c3ddata.cpp:76:9: warning: [misc-const-correctness]

    variable 'pointsInfo' of type 'ezc3d::DataNS::Points3dNS::Info' can be declared 'const'

       76 |         ezc3d::DataNS::Points3dNS::Info pointsInfo{*this};
          |         ^
          |                                         const 
  • misc/c3d/src/datastructures/c3ddata.cpp:77:9: warning: [misc-const-correctness]

    variable 'analogsInfo' of type 'ezc3d::DataNS::AnalogsNS::Info' can be declared 'const'

       77 |         ezc3d::DataNS::AnalogsNS::Info analogsInfo{*this};
          |         ^
          |                                        const 
  • misc/c3d/src/datastructures/c3ddata.cpp:78:9: warning: [misc-const-correctness]

    variable 'rotationsInfo' of type 'ezc3d::DataNS::RotationNS::Info' can be declared 'const'

       78 |         ezc3d::DataNS::RotationNS::Info rotationsInfo{*this};
          |         ^
          |                                         const 
  • misc/c3d/src/datastructures/c3ddata.cpp:99:30: warning: [bugprone-narrowing-conversions]

    narrowing conversion from 'unsigned long' to signed type 'off_type' (aka 'long long') is implementation-defined

       99 |                 stream.seekg(sizeof(float) * _header->nbAnalogByFrame() * _header->nbAnalogs(),
          |                              ^
  • misc/c3d/src/datastructures/c3ddata.cpp:116:13: warning: [misc-const-correctness]

    variable 'fileSize' of type 'std::streampos' (aka 'fpos<__mbstate_t>') can be declared 'const'

      116 |             std::streampos fileSize = stream.seekg(0, std::ios::end).tellg();
          |             ^
          |                            const 
  • misc/c3d/src/datastructures/c3ddata.cpp:117:13: warning: [misc-const-correctness]

    variable 'targetPos' of type 'int' can be declared 'const'

      117 |             int targetPos(static_cast<int>(rotationsInfo.dataStart() - 1) * 512);
          |             ^
          |                 const 
  • misc/c3d/src/datastructures/c3ddatatraits.cpp:44:10: warning: [readability-qualified-auto]

    'auto &name' can be declared as 'const auto &name'

       44 |     for (auto& name : data.pointNames()) {
          |          ^
          |          const 
  • misc/c3d/src/io/c3dreader.cpp:63:31: warning: [bugprone-branch-clone]

    repeated branch body in conditional chain

       63 |     if (key == "ReadAnalogs") {
          |                               ^
    /home/runner/work/modules/modules/inviwo/misc/c3d/src/io/c3dreader.cpp:65:6: note: end of the original
       65 |     } else if (key == "ReadRotations") {
          |      ^
    /home/runner/work/modules/modules/inviwo/misc/c3d/src/io/c3dreader.cpp:65:40: note: clone 1 starts here
       65 |     } else if (key == "ReadRotations") {
          |                                        ^
  • misc/c3d/src/processors/c3dtomesh.cpp:114:30: warning: [cppcoreguidelines-pro-type-static-cast-downcast]

    do not use static_cast to downcast from a base to a derived class; use dynamic_cast instead

      114 |             const auto* sp = static_cast<const StringProperty*>(prop);
          |                              ^~~~~~~~~~~
          |                              dynamic_cast

Have any feedback or feature suggestions? Share it here.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cpp-linter Review

Used clang-tidy v19.1.7

Click here for the full clang-tidy patch
diff --git a/misc/c3d/src/datastructures/c3ddata.cpp b/misc/c3d/src/datastructures/c3ddata.cpp
index 8ac2f81..c9c1b21 100644
--- a/misc/c3d/src/datastructures/c3ddata.cpp
+++ b/misc/c3d/src/datastructures/c3ddata.cpp
@@ -76,3 +76,3 @@ C3D::C3D(const std::filesystem::path& path, Options options) : ezc3d::c3d{} {
-        ezc3d::DataNS::Points3dNS::Info pointsInfo{*this};
-        ezc3d::DataNS::AnalogsNS::Info analogsInfo{*this};
-        ezc3d::DataNS::RotationNS::Info rotationsInfo{*this};
+        const ezc3d::DataNS::Points3dNS::Info pointsInfo{*this};
+        const ezc3d::DataNS::AnalogsNS::Info analogsInfo{*this};
+        const ezc3d::DataNS::RotationNS::Info rotationsInfo{*this};
@@ -116,2 +116,2 @@ C3D::C3D(const std::filesystem::path& path, Options options) : ezc3d::c3d{} {
-            std::streampos fileSize = stream.seekg(0, std::ios::end).tellg();
-            int targetPos(static_cast<int>(rotationsInfo.dataStart() - 1) * 512);
+            const std::streampos fileSize = stream.seekg(0, std::ios::end).tellg();
+            const int targetPos(static_cast<int>(rotationsInfo.dataStart() - 1) * 512);
diff --git a/misc/c3d/src/datastructures/c3ddatatraits.cpp b/misc/c3d/src/datastructures/c3ddatatraits.cpp
index 6e537ea..0342fb8 100644
--- a/misc/c3d/src/datastructures/c3ddatatraits.cpp
+++ b/misc/c3d/src/datastructures/c3ddatatraits.cpp
@@ -44 +44 @@ Document DataTraits<C3D>::info(const C3D& data) {
-    for (auto& name : data.pointNames()) {
+    for (const auto& name : data.pointNames()) {
diff --git a/misc/c3d/src/processors/c3dtomesh.cpp b/misc/c3d/src/processors/c3dtomesh.cpp
index a63e93c..ece3f23 100644
--- a/misc/c3d/src/processors/c3dtomesh.cpp
+++ b/misc/c3d/src/processors/c3dtomesh.cpp
@@ -114 +114 @@ void C3DToMesh::process() {
-            const auto* sp = static_cast<const StringProperty*>(prop);
+            const auto* sp = dynamic_cast<const StringProperty*>(prop);

Have any feedback or feature suggestions? Share it here.


namespace inviwo {

class IVW_MODULE_C3D_API C3D : public ezc3d::c3d {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy diagnostic

misc/c3d/include/inviwo/c3d/datastructures/c3ddata.h:40:26: warning: [cppcoreguidelines-special-member-functions]

class 'C3D' defines a copy constructor, a copy assignment operator, a move constructor and a move assignment operator but does not define a destructor

   40 | class IVW_MODULE_C3D_API C3D : public ezc3d::c3d {
      |                          ^

Comment on lines +76 to +78
ezc3d::DataNS::Points3dNS::Info pointsInfo{*this};
ezc3d::DataNS::AnalogsNS::Info analogsInfo{*this};
ezc3d::DataNS::RotationNS::Info rotationsInfo{*this};

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy diagnostics

  • variable 'pointsInfo' of type 'ezc3d::DataNS::Points3dNS::Info' can be declared 'const' [misc-const-correctness]
  • variable 'analogsInfo' of type 'ezc3d::DataNS::AnalogsNS::Info' can be declared 'const' [misc-const-correctness]
  • variable 'rotationsInfo' of type 'ezc3d::DataNS::RotationNS::Info' can be declared 'const' [misc-const-correctness]
Suggested change
ezc3d::DataNS::Points3dNS::Info pointsInfo{*this};
ezc3d::DataNS::AnalogsNS::Info analogsInfo{*this};
ezc3d::DataNS::RotationNS::Info rotationsInfo{*this};
const ezc3d::DataNS::Points3dNS::Info pointsInfo{*this};
const ezc3d::DataNS::AnalogsNS::Info analogsInfo{*this};
const ezc3d::DataNS::RotationNS::Info rotationsInfo{*this};

Comment on lines +116 to +117
std::streampos fileSize = stream.seekg(0, std::ios::end).tellg();
int targetPos(static_cast<int>(rotationsInfo.dataStart() - 1) * 512);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy diagnostics

Suggested change
std::streampos fileSize = stream.seekg(0, std::ios::end).tellg();
int targetPos(static_cast<int>(rotationsInfo.dataStart() - 1) * 512);
const std::streampos fileSize = stream.seekg(0, std::ios::end).tellg();
const int targetPos(static_cast<int>(rotationsInfo.dataStart() - 1) * 512);

if (options.readAnalogs) {
f.add(ezc3d::DataNS::AnalogsNS::Analogs(*this, stream, analogsInfo));
} else {
stream.seekg(sizeof(float) * _header->nbAnalogByFrame() * _header->nbAnalogs(),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy diagnostic

misc/c3d/src/datastructures/c3ddata.cpp:99:30: warning: [bugprone-narrowing-conversions]

narrowing conversion from 'unsigned long' to signed type 'off_type' (aka 'long long') is implementation-defined

   99 |                 stream.seekg(sizeof(float) * _header->nbAnalogByFrame() * _header->nbAnalogs(),
      |                              ^


utildoc::TableBuilder tb2(doc.handle(), P::end());
tb2(H(fmt::format("Points ({})", data.header().nb3dPoints())));
for (auto& name : data.pointNames()) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy diagnostics

Suggested change
for (auto& name : data.pointNames()) {
for (const auto& name : data.pointNames()) {

return false;
}
std::any C3DReader::getOption(std::string_view key) {
if (key == "ReadAnalogs") {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy diagnostic

misc/c3d/src/io/c3dreader.cpp:63:31: warning: [bugprone-branch-clone]

repeated branch body in conditional chain

   63 |     if (key == "ReadAnalogs") {
      |                               ^
/home/runner/work/modules/modules/inviwo/misc/c3d/src/io/c3dreader.cpp:65:6: note: end of the original
   65 |     } else if (key == "ReadRotations") {
      |      ^
/home/runner/work/modules/modules/inviwo/misc/c3d/src/io/c3dreader.cpp:65:40: note: clone 1 starts here
   65 |     } else if (key == "ReadRotations") {
      |                                        ^

pointIndices.assign_range(std::views::iota(0uz, nbPoints));
} else {
for (const auto* prop : pointSelection_) {
const auto* sp = static_cast<const StringProperty*>(prop);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy diagnostics

Suggested change
const auto* sp = static_cast<const StringProperty*>(prop);
const auto* sp = dynamic_cast<const StringProperty*>(prop);

@github-actions
github-actions Bot dismissed their stale review September 1, 2026 14:46

outdated suggestion

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cpp-linter Review

Used clang-tidy v19.1.7

Click here for the full clang-tidy patch
diff --git a/misc/c3d/src/datastructures/c3ddata.cpp b/misc/c3d/src/datastructures/c3ddata.cpp
index 8ac2f81..c9c1b21 100644
--- a/misc/c3d/src/datastructures/c3ddata.cpp
+++ b/misc/c3d/src/datastructures/c3ddata.cpp
@@ -76,3 +76,3 @@ C3D::C3D(const std::filesystem::path& path, Options options) : ezc3d::c3d{} {
-        ezc3d::DataNS::Points3dNS::Info pointsInfo{*this};
-        ezc3d::DataNS::AnalogsNS::Info analogsInfo{*this};
-        ezc3d::DataNS::RotationNS::Info rotationsInfo{*this};
+        const ezc3d::DataNS::Points3dNS::Info pointsInfo{*this};
+        const ezc3d::DataNS::AnalogsNS::Info analogsInfo{*this};
+        const ezc3d::DataNS::RotationNS::Info rotationsInfo{*this};
@@ -116,2 +116,2 @@ C3D::C3D(const std::filesystem::path& path, Options options) : ezc3d::c3d{} {
-            std::streampos fileSize = stream.seekg(0, std::ios::end).tellg();
-            int targetPos(static_cast<int>(rotationsInfo.dataStart() - 1) * 512);
+            const std::streampos fileSize = stream.seekg(0, std::ios::end).tellg();
+            const int targetPos(static_cast<int>(rotationsInfo.dataStart() - 1) * 512);
diff --git a/misc/c3d/src/datastructures/c3ddatatraits.cpp b/misc/c3d/src/datastructures/c3ddatatraits.cpp
index 6e537ea..0342fb8 100644
--- a/misc/c3d/src/datastructures/c3ddatatraits.cpp
+++ b/misc/c3d/src/datastructures/c3ddatatraits.cpp
@@ -44 +44 @@ Document DataTraits<C3D>::info(const C3D& data) {
-    for (auto& name : data.pointNames()) {
+    for (const auto& name : data.pointNames()) {
diff --git a/misc/c3d/src/processors/c3dtomesh.cpp b/misc/c3d/src/processors/c3dtomesh.cpp
index a63e93c..ece3f23 100644
--- a/misc/c3d/src/processors/c3dtomesh.cpp
+++ b/misc/c3d/src/processors/c3dtomesh.cpp
@@ -114 +114 @@ void C3DToMesh::process() {
-            const auto* sp = static_cast<const StringProperty*>(prop);
+            const auto* sp = dynamic_cast<const StringProperty*>(prop);

Have any feedback or feature suggestions? Share it here.


namespace inviwo {

class IVW_MODULE_C3D_API C3D : public ezc3d::c3d {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy diagnostic

misc/c3d/include/inviwo/c3d/datastructures/c3ddata.h:40:26: warning: [cppcoreguidelines-special-member-functions]

class 'C3D' defines a copy constructor, a copy assignment operator, a move constructor and a move assignment operator but does not define a destructor

   40 | class IVW_MODULE_C3D_API C3D : public ezc3d::c3d {
      |                          ^

Comment on lines +76 to +78
ezc3d::DataNS::Points3dNS::Info pointsInfo{*this};
ezc3d::DataNS::AnalogsNS::Info analogsInfo{*this};
ezc3d::DataNS::RotationNS::Info rotationsInfo{*this};

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy diagnostics

  • variable 'pointsInfo' of type 'ezc3d::DataNS::Points3dNS::Info' can be declared 'const' [misc-const-correctness]
  • variable 'analogsInfo' of type 'ezc3d::DataNS::AnalogsNS::Info' can be declared 'const' [misc-const-correctness]
  • variable 'rotationsInfo' of type 'ezc3d::DataNS::RotationNS::Info' can be declared 'const' [misc-const-correctness]
Suggested change
ezc3d::DataNS::Points3dNS::Info pointsInfo{*this};
ezc3d::DataNS::AnalogsNS::Info analogsInfo{*this};
ezc3d::DataNS::RotationNS::Info rotationsInfo{*this};
const ezc3d::DataNS::Points3dNS::Info pointsInfo{*this};
const ezc3d::DataNS::AnalogsNS::Info analogsInfo{*this};
const ezc3d::DataNS::RotationNS::Info rotationsInfo{*this};

Comment on lines +116 to +117
std::streampos fileSize = stream.seekg(0, std::ios::end).tellg();
int targetPos(static_cast<int>(rotationsInfo.dataStart() - 1) * 512);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy diagnostics

Suggested change
std::streampos fileSize = stream.seekg(0, std::ios::end).tellg();
int targetPos(static_cast<int>(rotationsInfo.dataStart() - 1) * 512);
const std::streampos fileSize = stream.seekg(0, std::ios::end).tellg();
const int targetPos(static_cast<int>(rotationsInfo.dataStart() - 1) * 512);

if (options.readAnalogs) {
f.add(ezc3d::DataNS::AnalogsNS::Analogs(*this, stream, analogsInfo));
} else {
stream.seekg(sizeof(float) * _header->nbAnalogByFrame() * _header->nbAnalogs(),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy diagnostic

misc/c3d/src/datastructures/c3ddata.cpp:99:30: warning: [bugprone-narrowing-conversions]

narrowing conversion from 'unsigned long' to signed type 'off_type' (aka 'long long') is implementation-defined

   99 |                 stream.seekg(sizeof(float) * _header->nbAnalogByFrame() * _header->nbAnalogs(),
      |                              ^


utildoc::TableBuilder tb2(doc.handle(), P::end());
tb2(H(fmt::format("Points ({})", data.header().nb3dPoints())));
for (auto& name : data.pointNames()) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy diagnostics

Suggested change
for (auto& name : data.pointNames()) {
for (const auto& name : data.pointNames()) {

return false;
}
std::any C3DReader::getOption(std::string_view key) {
if (key == "ReadAnalogs") {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy diagnostic

misc/c3d/src/io/c3dreader.cpp:63:31: warning: [bugprone-branch-clone]

repeated branch body in conditional chain

   63 |     if (key == "ReadAnalogs") {
      |                               ^
/home/runner/work/modules/modules/inviwo/misc/c3d/src/io/c3dreader.cpp:65:6: note: end of the original
   65 |     } else if (key == "ReadRotations") {
      |      ^
/home/runner/work/modules/modules/inviwo/misc/c3d/src/io/c3dreader.cpp:65:40: note: clone 1 starts here
   65 |     } else if (key == "ReadRotations") {
      |                                        ^

pointIndices.assign_range(std::views::iota(0uz, nbPoints));
} else {
for (const auto* prop : pointSelection_) {
const auto* sp = static_cast<const StringProperty*>(prop);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy diagnostics

Suggested change
const auto* sp = static_cast<const StringProperty*>(prop);
const auto* sp = dynamic_cast<const StringProperty*>(prop);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants