Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove remaining debug printings in vpIoTools #1355

Merged
merged 6 commits into from
Mar 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,8 @@
"xstring": "cpp",
"xtr1common": "cpp",
"xtree": "cpp",
"xutility": "cpp"
"xutility": "cpp",
"execution": "cpp"
},
"C_Cpp.vcFormat.indent.namespaceContents": false,
"editor.formatOnSave": true,
Expand Down
41 changes: 13 additions & 28 deletions cmake/VISPUtils.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -1333,37 +1333,22 @@ endmacro()

# Get package version from pkg-config
macro(vp_get_version_from_pkg LIBNAME PKG_PATH OUTPUT_VAR)
find_package(PkgConfig)
if(PkgConfig_FOUND)
# Since pkg_check_modules updates not only <xxx>_VERSION but also <xxx>_FOUND, <xxx>_INCLUDE_DIRS and <xxx>_LIBRARIES
# we make a backup of these 3 vars to ensure compat with previous vp_get_version_from_pkg() behavior
string(TOUPPER ${LIBNAME} LIBNAME_UPPER)
if(${LIBNAME_UPPER}_INCLUDE_DIRS)
set(${LIBNAME_UPPER}_INCLUDE_DIRS_backup ${${LIBNAME_UPPER}_INCLUDE_DIRS})
endif()
if(${LIBNAME_UPPER}_FOUND)
set(${LIBNAME_UPPER}_FOUND_backup ${${LIBNAME_UPPER}_FOUND})
endif()
if(${LIBNAME_UPPER}_LIBRARIES)
set(${LIBNAME_UPPER}_LIBRARIES_backup ${${LIBNAME_UPPER}_LIBRARIES})
endif()
pkg_check_modules(${LIBNAME_UPPER} QUIET ${LIBNAME})
if(${LIBNAME_UPPER}_FOUND_backup)
set(${LIBNAME_UPPER}_FOUND ${${LIBNAME_UPPER}_FOUND_backup})
endif()
if(${LIBNAME_UPPER}_INCLUDE_DIRS_backup)
set(${LIBNAME_UPPER}_INCLUDE_DIRS ${${LIBNAME_UPPER}_INCLUDE_DIRS_backup})
endif()
if(${LIBNAME_UPPER}_LIBRARIES_backup)
set(${LIBNAME_UPPER}_LIBRARIES ${${LIBNAME_UPPER}_LIBRARIES_backup})
endif()
if(${LIBNAME_UPPER}_VERSION)
set(${OUTPUT_VAR} ${${LIBNAME_UPPER}_VERSION})
endif()
elseif(EXISTS "${PKG_PATH}/${LIBNAME}.pc")
if(EXISTS "${PKG_PATH}/${LIBNAME}.pc")
# Consider the case where pkg-config is not installed
file(STRINGS "${PKG_PATH}/${LIBNAME}.pc" line_to_parse REGEX "^Version:[ \t]+[0-9.]*.*$" LIMIT_COUNT 1)
string(REGEX REPLACE ".*Version: ([^ ]+).*" "\\1" ${OUTPUT_VAR} "${line_to_parse}" )
else()
find_package(PkgConfig)
if(PkgConfig_FOUND)
string(TOUPPER ${LIBNAME} LIBNAME_UPPER)
pkg_get_variable(${LIBNAME_UPPER}_PCFILEDIR ${LIBNAME} pcfiledir)
if(EXISTS "${${LIBNAME_UPPER}_PCFILEDIR}/${LIBNAME}.pc")
file(STRINGS "${${LIBNAME_UPPER}_PCFILEDIR}/${LIBNAME}.pc" line_to_parse REGEX "^Version:[ \t]+[0-9.]*.*$" LIMIT_COUNT 1)
string(REGEX REPLACE ".*Version: ([^ ]+).*" "\\1" ${OUTPUT_VAR} "${line_to_parse}" )
unset(LIBNAME_UPPER)
mark_as_advanced(${LIBNAME_UPPER}_PCFILEDIR)
endif()
endif()
endif()
endmacro()

Expand Down
2 changes: 1 addition & 1 deletion modules/core/include/visp3/core/vpQuaternionVector.h
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ class VISP_EXPORT vpQuaternionVector : public vpRotationVector
vpQuaternionVector operator/(double l) const;
vpQuaternionVector &operator=(const vpColVector &q);
#if (VISP_CXX_STANDARD >= VISP_CXX_STANDARD_11)
vpQuaternionVector &operator=(const vpQuaternionVector &q) = default;
vpQuaternionVector &operator=(const vpQuaternionVector &) = default;
vpQuaternionVector &operator=(const std::initializer_list<double> &list);
#endif

Expand Down
8 changes: 4 additions & 4 deletions modules/core/include/visp3/core/vpRectOriented.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ class VISP_EXPORT vpRectOriented
{
public:
vpRectOriented();
#if (VISP_CXX_STANDARD > VISP_CXX_STANDARD_98)
vpRectOriented(const vpRectOriented &rect) = default;
#if (VISP_CXX_STANDARD >= VISP_CXX_STANDARD_11)
vpRectOriented(const vpRectOriented &) = default;
#else
vpRectOriented(const vpRectOriented &rect);
#endif
Expand All @@ -57,8 +57,8 @@ class VISP_EXPORT vpRectOriented

vpRectOriented(const vpRect &rect);

#if (VISP_CXX_STANDARD > VISP_CXX_STANDARD_98)
vpRectOriented &operator=(const vpRectOriented &rect) = default;
#if (VISP_CXX_STANDARD >= VISP_CXX_STANDARD_11)
vpRectOriented &operator=(const vpRectOriented &) = default;
#else
vpRectOriented &operator=(const vpRectOriented &rect);
#endif
Expand Down
2 changes: 1 addition & 1 deletion modules/core/include/visp3/core/vpRxyzVector.h
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ class VISP_EXPORT vpRxyzVector : public vpRotationVector
vpRxyzVector &operator=(const vpColVector &rxyz);
vpRxyzVector &operator=(double x);
#if (VISP_CXX_STANDARD >= VISP_CXX_STANDARD_11)
vpRxyzVector &operator=(const vpRxyzVector &rxyz) = default;
vpRxyzVector &operator=(const vpRxyzVector &) = default;
vpRxyzVector &operator=(const std::initializer_list<double> &list);
#endif
};
Expand Down
2 changes: 1 addition & 1 deletion modules/core/include/visp3/core/vpRzyxVector.h
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ class VISP_EXPORT vpRzyxVector : public vpRotationVector
vpRzyxVector &operator=(const vpColVector &rzyx);
vpRzyxVector &operator=(double x);
#if (VISP_CXX_STANDARD >= VISP_CXX_STANDARD_11)
vpRzyxVector &operator=(const vpRzyxVector &rzyx) = default;
vpRzyxVector &operator=(const vpRzyxVector &) = default;
vpRzyxVector &operator=(const std::initializer_list<double> &list);
#endif
};
Expand Down
2 changes: 1 addition & 1 deletion modules/core/include/visp3/core/vpRzyzVector.h
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ class VISP_EXPORT vpRzyzVector : public vpRotationVector
vpRzyzVector &operator=(const vpColVector &rzyz);
vpRzyzVector &operator=(double x);
#if (VISP_CXX_STANDARD >= VISP_CXX_STANDARD_11)
vpRzyzVector &operator=(const vpRzyzVector &rzyz) = default;
vpRzyzVector &operator=(const vpRzyzVector &) = default;
vpRzyzVector &operator=(const std::initializer_list<double> &list);
#endif
};
Expand Down
4 changes: 2 additions & 2 deletions modules/core/src/tools/geometry/vpRectOriented.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,13 @@ vpRectOriented::vpRectOriented(const vpRect &rect)
m_topRight.set_j(m_center.get_j() + m_width / 2.0);
}

#if (VISP_CXX_STANDARD < VISP_CXX_STANDARD_11)
#if (VISP_CXX_STANDARD == VISP_CXX_STANDARD_98)
/** Copy constructor.
* @param rectOriented Oriented rectangle to copy.
*/
vpRectOriented::vpRectOriented(const vpRectOriented &rectOriented) { *this = rectOriented; }

/** Assignement operator.
/** Assignment operator.
* @param rectOriented Oriented rectangle to copy.
*/
vpRectOriented &vpRectOriented::operator=(const vpRectOriented &rectOriented)
Expand Down
16 changes: 8 additions & 8 deletions modules/core/test/math/testQuaternion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -169,14 +169,14 @@ TEST_CASE("Quaternion operators", "[quaternion]")
vpQuaternionVector q_copy1 = vpQuaternionVector(0, 0, 1, 1);
std::cout << "q_copy1=" << q_copy1 << std::endl;
const vpQuaternionVector q_copy2 = q_copy1;
CHECK_FALSE((q_copy2.x() != q_copy1.x() || q_copy2.y() != q_copy1.y() ||
q_copy2.z() != q_copy1.z() || q_copy2.w() != q_copy1.w()));
CHECK_FALSE((!vpMath::equal(q_copy2.x(), q_copy1.x()) || !vpMath::equal(q_copy2.y(), q_copy1.y()) ||
!vpMath::equal(q_copy2.z(), q_copy1.z()) || !vpMath::equal(q_copy2.w(), q_copy1.w())));

// compare data pointers: verify that they're not the same
// compare data pointers: verify that they're not the same
CHECK(q_copy2.data != q_copy1.data);
q_copy1.set(1, 0, 1, 10);
CHECK_FALSE((q_copy2.x() == q_copy1.x() && q_copy2.y() == q_copy1.y() &&
q_copy2.z() == q_copy1.z() && q_copy2.w() == q_copy1.w()));
CHECK((vpMath::equal(q_copy2.x(), q_copy1.x()) || vpMath::equal(q_copy2.y(), q_copy1.y()) ||
vpMath::equal(q_copy2.z(), q_copy1.z()) || vpMath::equal(q_copy2.w(), q_copy1.w())));
std::cout << "q_copy1 after set = " << q_copy1 << std::endl;
std::cout << "q_copy2=" << q_copy2 << std::endl;
}
Expand All @@ -186,15 +186,15 @@ TEST_CASE("Quaternion operators", "[quaternion]")
const vpQuaternionVector q1 = vpQuaternionVector(0, 0, 1, 1);
vpQuaternionVector q_same(10, 10, 10, 10);
q_same = q1;
CHECK_FALSE((q_same.x() != q1.x() || q_same.y() != q1.y() ||
q_same.z() != q1.z() || q_same.w() != q1.w()));

CHECK_FALSE((!vpMath::equal(q_same.x(), q1.x()) || !vpMath::equal(q_same.y(), q1.y()) ||
!vpMath::equal(q_same.z(), q1.z()) || !vpMath::equal(q_same.w(), q1.w())));
// compare data pointers: verify that they're not the same
CHECK(q_same.data != q1.data);
}

}


int main(int argc, char *argv[])
{
Catch::Session session; // There must be exactly one instance
Expand Down
2 changes: 1 addition & 1 deletion modules/python/generator/visp_python_bindgen/methods.py
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ def make_keep_alive_str(values) -> str:
# Params that are only outputs: they should be declared in function. Assume that they are default constructible
param_is_only_output = [not is_input and is_output for is_input, is_output in zip(param_is_input, param_is_output)]
param_type_decl = [get_type_for_declaration(method.parameters[i].type, specs, header_env.mapping) for i in range(len(param_is_only_output))]
param_decl_data = [(param_type_decl[i], param_names[i], get_default_assignement_str(param_type_decl[i])) for i in range(len(param_is_only_output)) if param_is_only_output[i]]
param_decl_data = [(param_type_decl[i], param_names[i], get_default_assignment_str(param_type_decl[i])) for i in range(len(param_is_only_output)) if param_is_only_output[i]]
param_declarations = [f'{decl_type} {name}{assignment};' for (decl_type, name, assignment) in param_decl_data]
param_declarations = '\n'.join(param_declarations)

Expand Down
2 changes: 1 addition & 1 deletion modules/python/generator/visp_python_bindgen/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ def get_type_for_declaration(param: Union[types.FunctionType, types.DecoratedTyp
else:
return get_type(param, owner_specs, header_env_mapping)

def get_default_assignement_str(type: str) -> str:
def get_default_assignment_str(type: str) -> str:
inits = [
(['int', 'unsigned', 'uint8_t', 'uint16_t', 'size_t', 'ssize_t'], '0'),
(['float'], '0.f'),
Expand Down
2 changes: 1 addition & 1 deletion modules/sensor/include/visp3/sensor/vpLaserScan.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ class /*VISP_EXPORT*/ vpLaserScan
inline std::vector<vpScanPoint> getScanPoints() { return listScanPoints; }

#if VISP_CXX_STANDARD >= VISP_CXX_STANDARD_11
vpLaserScan &operator=(const vpLaserScan &scan) = default;
vpLaserScan &operator=(const vpLaserScan &) = default;
#endif

/*! Specifies the id of former measurements and increases with every measurement. */
Expand Down
3 changes: 1 addition & 2 deletions modules/tracker/mbt/src/vpMbtPolygon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,7 @@ vpMbtPolygon::vpMbtPolygon(const vpMbtPolygon &mbtp)
minLineLengthThresh(mbtp.minLineLengthThresh), minPolygonAreaThresh(mbtp.minPolygonAreaThresh), name(mbtp.name),
hasOrientation(mbtp.hasOrientation)
{
//*this = mbtp; // Should not be called by copy constructor to avoid multiple
// assignements.
//*this = mbtp; // Should not be called by copy constructor to avoid multiple assignments.
}

vpMbtPolygon &vpMbtPolygon::operator=(const vpMbtPolygon &mbtp)
Expand Down
Loading