Skip to content

Commit ea0b13a

Browse files
authored
Merge pull request #1927 from fspindle/fix_various_doc_cxx98
Various improvements in doc, cxx98 compat and java
2 parents 18ab466 + 41a3fb2 commit ea0b13a

File tree

8 files changed

+95
-38
lines changed

8 files changed

+95
-38
lines changed

CMakeLists.txt

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -487,7 +487,7 @@ VP_OPTION(BUILD_TESTS "" "" "Build ViSP tests" "" ON)
487487
VP_OPTION(BUILD_COVERAGE "" "" "Enables test coverage" "" OFF IF (BUILD_TESTS AND (CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_CLANGCXX)))
488488

489489
# Build java as an option
490-
VP_OPTION(BUILD_JAVA "" "" "Enable Java support" "" (ANDROID OR NOT CMAKE_CROSSCOMPILING) IF (ANDROID OR (NOT APPLE_FRAMEWORK AND NOT WINRT)) )
490+
VP_OPTION(BUILD_JAVA "" "" "Enable Java support" "" (ANDROID OR NOT CMAKE_CROSSCOMPILING) IF (ANDROID OR ((NOT APPLE_FRAMEWORK AND NOT WINRT)) AND NOT (VISP_CXX_STANDARD LESS VISP_CXX_STANDARD_11)) )
491491
VP_OPTION(BUILD_FAT_JAVA_LIB "" "" "Create Java wrapper exporting all functions of ViSP library (requires static build of ViSP modules)" "" ANDROID IF NOT BUILD_SHARED_LIBS)
492492
VP_OPTION(BUILD_ANDROID_SERVICE "" "" "Build ViSP Manager for Google Play" "" OFF IF ANDROID )
493493
VP_OPTION(BUILD_ANDROID_PROJECTS "" "" "Build Android projects providing .apk files" "" ON IF ANDROID )
@@ -598,7 +598,7 @@ VP_CHECK_PACKAGE(C99)
598598
VP_OPTION(USE_AFMA6 "" "" "Include Afma6 robot support" "" ON IF (RAW1394_FOUND AND RT_FOUND AND CALINUX_FOUND AND IRISA_FOUND AND NOT WINRT AND NOT IOS))
599599
VP_OPTION(USE_VIPER650 "" "" "Include Viper s650 robot support" "" ON IF (RAW1394_FOUND AND RT_FOUND AND CALINUX_FOUND AND IRISA_FOUND AND NOT WINRT AND NOT IOS))
600600
VP_OPTION(USE_VIPER850 "" "" "Include Viper s850 robot support" "" ON IF (RAW1394_FOUND AND RT_FOUND AND CALINUX_FOUND AND IRISA_FOUND AND NOT WINRT AND NOT IOS))
601-
VP_OPTION(USE_UR_RTDE ur_rtde QUIET "Include Universal Robot RTDE C++ interface support for UR robots" "" ON IF NOT WINRT AND NOT IOS)
601+
VP_OPTION(USE_UR_RTDE ur_rtde QUIET "Include Universal Robot RTDE C++ interface support for UR robots" "" ON IF NOT WINRT AND NOT IOS AND NOT (USE_CXX_STANDARD STREQUAL "98"))
602602
VP_OPTION(USE_VIRTUOSE Virtuose "" "Include Virtuose SDK support for Haption devices" "" ON IF NOT WINRT)
603603
VP_OPTION(USE_ARSDK ARSDK QUIET "Include Parrot ARSDK support" "" ON IF NOT WINRT AND NOT IOS)
604604
if(USE_ARSDK)
@@ -820,6 +820,11 @@ if(VISP_CXX_STANDARD LESS VISP_CXX_STANDARD_11)
820820
unset(USE_XML2)
821821
set(USE_XML2 OFF CACHE BOOL "Include libxml2 support" FORCE)
822822
endif()
823+
if(USE_VICON)
824+
message(WARNING "Vicon SDK 3rd party was detected and needs at least c++11 standard compiler flag while you have set c++${USE_CXX_STANDARD}. Thus we disable vicon usage turning USE_VICON=OFF.")
825+
unset(USE_VICON)
826+
set(USE_VICON OFF CACHE BOOL "Include Vicon SDK support" FORCE)
827+
endif()
823828
if(USE_QUALISYS)
824829
message(WARNING "Qualisys SDK 3rd party was detected and needs at least c++11 standard compiler flag while you have set c++${USE_CXX_STANDARD}. Thus we disable qualisys usage turning USE_QUALISYS=OFF.")
825830
unset(USE_QUALISYS)

ChangeLog.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ ViSP 3.7.1 (current version)
2929
. [#1901] The app visp-calibrate-camera references default-chessboard.cfg and
3030
default-circles.cfg config files that are missing from installation
3131
. [#1909] Fix build failure when apriltag is deactivated
32+
. [#1929] Support for the C++98 standard is not properly implemented
33+
. [#1930] Build issue in vpMocapVicon.cpp when c++98 enabled
3234
----------------------------------------------
3335
ViSP 3.7.0 (released December 19, 2025)
3436
- Contributors:

cmake/AddExtraCompilationFlags.cmake

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,12 @@ macro(add_extra_compiler_options options)
4545
foreach(option ${options})
4646
vp_check_flag_support(CXX "${option}" _varname "${VISP_EXTRA_CXX_FLAGS}")
4747
if(${_varname})
48-
set(VISP_EXTRA_CXX_FLAGS "${VISP_EXTRA_CXX_FLAGS} ${option}")
48+
list(APPEND VISP_EXTRA_CXX_FLAGS ${option})
4949
endif()
5050

5151
vp_check_flag_support(C "${option}" _varname "${VISP_EXTRA_C_FLAGS}")
5252
if(${_varname})
53-
set(VISP_EXTRA_C_FLAGS "${VISP_EXTRA_C_FLAGS} ${option}")
53+
list(APPEND VISP_EXTRA_C_FLAGS ${option})
5454
endif()
5555
endforeach()
5656
endmacro()
@@ -65,7 +65,7 @@ macro(add_extra_compiler_option_enabling option var_enabling flag)
6565
set(${var_enabling} ${flag} CACHE BOOL ${__msg})
6666
endif()
6767
if(${${var_enabling}})
68-
set(VISP_EXTRA_CXX_FLAGS "${VISP_EXTRA_CXX_FLAGS} ${option}")
68+
list(APPEND VISP_EXTRA_CXX_FLAGS ${option})
6969
else()
7070
vp_list_filterout(VISP_EXTRA_CXX_FLAGS ${option})
7171
endif()
@@ -144,7 +144,9 @@ if(USE_THREADS OR USE_PTHREAD)
144144
endif()
145145
endif()
146146

147-
if((VISP_CXX_STANDARD EQUAL VISP_CXX_STANDARD_11) AND CXX11_CXX_FLAGS)
147+
if((VISP_CXX_STANDARD EQUAL VISP_CXX_STANDARD_98) AND CXX98_CXX_FLAGS)
148+
add_extra_compiler_options("${CXX98_CXX_FLAGS}")
149+
elseif((VISP_CXX_STANDARD EQUAL VISP_CXX_STANDARD_11) AND CXX11_CXX_FLAGS)
148150
add_extra_compiler_options("${CXX11_CXX_FLAGS}")
149151
elseif((VISP_CXX_STANDARD EQUAL VISP_CXX_STANDARD_14) AND CXX14_CXX_FLAGS)
150152
add_extra_compiler_options("${CXX14_CXX_FLAGS}")

doc/tutorial/windows/tutorial-install-win10-mingw-w64.dox

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -381,11 +381,11 @@ We give hereafter the two ways to get this data set:
381381
\subsection install_win10_mingw_dataset_release 5.1. Get data set release
382382

383383
- Download the latest dataset release from https://visp.inria.fr/download and uncompress it in your workspace
384-
`%%VISP_WS%`. At the time this tutorial was written, the latest release was `visp-images-3.73zip`.
384+
`%%VISP_WS%`. At the time this tutorial was written, the latest release was `visp-images-3.7.3.zip`.
385385
\image html img-win-visp-images-git.jpg
386386
- Once downloaded, you need to set `VISP_INPUT_IMAGE_PATH` environment variable to help ViSP examples
387387
and tests to detect automatically the location of the requested data. In our case, this variable should
388-
be set to `%%VISP_WS%\visp-images-3.7.3. Open a `cmd` Command Prompt and run
388+
be set to `%%VISP_WS%\visp-images-3.7.3`. Open a `cmd` Command Prompt and run
389389
\code{.sh}
390390
C:\\> setx VISP_INPUT_IMAGE_PATH %VISP_WS%\visp-images-3.7.3
391391
C:\\> exit

modules/core/include/visp3/core/vpColVector.h

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -698,10 +698,14 @@ class VISP_EXPORT vpColVector : public vpArray2D<double>
698698
*/
699699
vpColVector &operator=(vpColVector &&v);
700700

701-
/*!
702-
* Set vector elements and size from a list of values.
703-
* \param list : List of double. Vector size matches the number of elements.
704-
* \return The modified vector.
701+
/**
702+
* \brief Assigns a list of values to the vector using an initializer list.
703+
* This operator allows for easy vector population using the curly brace syntax.
704+
* The vector is automatically resized to match the size of the provided list.
705+
*
706+
* \param[in] list A {value1, value2, ...} list of doubles.
707+
* \return A reference to the modified vpColVector (*this).
708+
*
705709
* \code
706710
* #include <visp3/core/vpColVector.h>
707711
*
@@ -711,17 +715,17 @@ class VISP_EXPORT vpColVector : public vpArray2D<double>
711715
*
712716
* int main()
713717
* {
714-
* vpColVector c;
715-
* c = { 0, -1, -2 };
716-
* std::cout << "c:\n" << c << std::endl;
718+
* vpColVector v;
719+
* v = { 0.1, -1.1, -2.2 }; // Vector is resized to 3 and filled
720+
* std::cout << "v:\n" << v << std::endl;
717721
* }
718722
* \endcode
719723
* It produces the following printings:
720724
* \code
721-
* c:
722-
* 0
723-
* -1
724-
* -2
725+
* v:
726+
* 0.1
727+
* -1.1
728+
* -2.2
725729
* \endcode
726730
* \sa operator<<()
727731
*/

modules/core/src/math/matrix/vpColVector.cpp

Lines changed: 26 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -493,14 +493,19 @@ vpColVector &vpColVector::operator=(vpColVector &&other)
493493
}
494494

495495
/**
496-
* @brief Create a column vector view of a raw data array.
497-
* The view can modify the contents of the raw data array,
498-
* but may not resize it and does not own it: the memory is not released by the vector
499-
* and it should be freed by the user after the view is released.
500-
*
501-
* @param[in] raw_data The raw data.
502-
* @param[in] nrows : Number of rows of the raw data.
503-
* @return The column vector view.
496+
* \brief Creates a column vector that acts as a view over an existing raw data array.
497+
* This factory method wraps an external buffer into a vpColVector object.
498+
* Modifications made through the returned vector will directly affect the original
499+
* buffer.
500+
* \warning
501+
* - The vector **does not own** the memory.
502+
* - The user is responsible for ensuring the `raw_data` pointer remains valid
503+
* as long as the view is in use.
504+
* - The memory must be manually freed by the user after the view is destroyed.
505+
* - The vector cannot be resized.
506+
* \param[in] raw_data Pointer to the external double array.
507+
* \param[in] nrows Number of elements (rows) in the array.
508+
* \return A vpColVector mapping the provided memory buffer.
504509
*/
505510
vpColVector vpColVector::view(double *raw_data, unsigned int nrows)
506511
{
@@ -509,14 +514,21 @@ vpColVector vpColVector::view(double *raw_data, unsigned int nrows)
509514
return v;
510515
}
511516

512-
513-
void vpColVector::view(vpColVector &v, double *data, unsigned int rows)
517+
/**
518+
* \brief Maps an existing vpColVector instance to a raw data array.
519+
* Similar to the static factory method, this version configures a pre-existing
520+
* vector object to point to the external `raw_data`.
521+
* \note This is more memory-efficient if you already have a vector object allocated
522+
* on the stack, as it avoids a return-by-value.
523+
* \param[out] v The vector to be configured as a view.
524+
* \param[in] raw_data Pointer to the external double array.
525+
* \param[in] rows Number of elements (rows) in the array.
526+
*/
527+
void vpColVector::view(vpColVector &v, double *raw_data, unsigned int rows)
514528
{
515-
vpArray2D<double>::view(v, data, rows, 1);
529+
vpArray2D<double>::view(v, raw_data, rows, 1);
516530
}
517531

518-
519-
520532
vpColVector &vpColVector::operator=(const std::initializer_list<double> &list)
521533
{
522534
resize(static_cast<unsigned int>(list.size()), false);
@@ -971,7 +983,7 @@ vpColVector vpColVector::hadamard(const vpColVector &v) const
971983
}
972984
#endif
973985
return out;
974-
}
986+
}
975987

976988
double vpColVector::infinityNorm() const
977989
{

modules/detection/src/tag/vpDetectorAprilTag.cpp

Lines changed: 36 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1528,11 +1528,19 @@ std::string vpDetectorAprilTag::tagFamilyToString(const vpDetectorAprilTag::vpAp
15281528

15291529
vpDetectorAprilTag::vpAprilTagFamily vpDetectorAprilTag::tagFamilyFromString(const std::string &name)
15301530
{
1531+
#if (VISP_CXX_STANDARD < VISP_CXX_STANDARD_11)
1532+
vpDetectorAprilTag::vpAprilTagFamily res = vpDetectorAprilTag::TAG_COUNT;
1533+
#else
15311534
vpDetectorAprilTag::vpAprilTagFamily res = vpDetectorAprilTag::vpAprilTagFamily::TAG_COUNT;
1535+
#endif
15321536
bool wasFound = false;
15331537
std::string lowerCaseName = vpIoTools::toLowerCase(name);
15341538
unsigned int i = 0;
1539+
#if (VISP_CXX_STANDARD < VISP_CXX_STANDARD_11)
1540+
while ((i < vpDetectorAprilTag::TAG_COUNT) && (!wasFound)) {
1541+
#else
15351542
while ((i < vpDetectorAprilTag::vpAprilTagFamily::TAG_COUNT) && (!wasFound)) {
1543+
#endif
15361544
vpDetectorAprilTag::vpAprilTagFamily candidate = static_cast<vpDetectorAprilTag::vpAprilTagFamily>(i);
15371545
if (lowerCaseName == tagFamilyToString(candidate)) {
15381546
res = candidate;
@@ -1544,19 +1552,27 @@ vpDetectorAprilTag::vpAprilTagFamily vpDetectorAprilTag::tagFamilyFromString(con
15441552
throw(vpException(vpException::badValue, "Could not find a tag family that corresponds to the name '%s'", name.c_str()));
15451553
}
15461554
return res;
1547-
}
1555+
}
15481556

15491557
std::string vpDetectorAprilTag::getAvailableTagFamily(const std::string &prefix, const std::string &sep, const std::string &suffix)
15501558
{
15511559
std::string modes(prefix);
1560+
#if (VISP_CXX_STANDARD < VISP_CXX_STANDARD_11)
1561+
for (unsigned int i = 0; i < vpDetectorAprilTag::TAG_COUNT - 1; ++i) {
1562+
#else
15521563
for (unsigned int i = 0; i < vpDetectorAprilTag::vpAprilTagFamily::TAG_COUNT - 1; ++i) {
1564+
#endif
15531565
vpDetectorAprilTag::vpAprilTagFamily candidate = static_cast<vpDetectorAprilTag::vpAprilTagFamily>(i);
15541566
modes += tagFamilyToString(candidate) + sep;
15551567
}
1568+
#if (VISP_CXX_STANDARD < VISP_CXX_STANDARD_11)
1569+
vpDetectorAprilTag::vpAprilTagFamily candidate = static_cast<vpDetectorAprilTag::vpAprilTagFamily>(vpDetectorAprilTag::TAG_COUNT - 1);
1570+
#else
15561571
vpDetectorAprilTag::vpAprilTagFamily candidate = static_cast<vpDetectorAprilTag::vpAprilTagFamily>(vpDetectorAprilTag::vpAprilTagFamily::TAG_COUNT - 1);
1572+
#endif
15571573
modes += tagFamilyToString(candidate) + suffix;
15581574
return modes;
1559-
}
1575+
}
15601576

15611577
std::string vpDetectorAprilTag::poseMethodToString(const vpDetectorAprilTag::vpPoseEstimationMethod &method)
15621578
{
@@ -1592,11 +1608,19 @@ std::string vpDetectorAprilTag::poseMethodToString(const vpDetectorAprilTag::vpP
15921608

15931609
vpDetectorAprilTag::vpPoseEstimationMethod vpDetectorAprilTag::poseMethodFromString(const std::string &name)
15941610
{
1611+
#if (VISP_CXX_STANDARD < VISP_CXX_STANDARD_11)
1612+
vpDetectorAprilTag::vpPoseEstimationMethod res = vpDetectorAprilTag::POSE_COUNT;
1613+
#else
15951614
vpDetectorAprilTag::vpPoseEstimationMethod res = vpDetectorAprilTag::vpPoseEstimationMethod::POSE_COUNT;
1615+
#endif
15961616
bool wasFound = false;
15971617
std::string lowerCaseName = vpIoTools::toLowerCase(name);
15981618
unsigned int i = 0;
1619+
#if (VISP_CXX_STANDARD < VISP_CXX_STANDARD_11)
1620+
while ((i < vpDetectorAprilTag::POSE_COUNT) && (!wasFound)) {
1621+
#else
15991622
while ((i < vpDetectorAprilTag::vpPoseEstimationMethod::POSE_COUNT) && (!wasFound)) {
1623+
#endif
16001624
vpDetectorAprilTag::vpPoseEstimationMethod candidate = static_cast<vpDetectorAprilTag::vpPoseEstimationMethod>(i);
16011625
if (lowerCaseName == poseMethodToString(candidate)) {
16021626
res = candidate;
@@ -1608,19 +1632,27 @@ vpDetectorAprilTag::vpPoseEstimationMethod vpDetectorAprilTag::poseMethodFromStr
16081632
throw(vpException(vpException::badValue, "Could not find a pose estimation method that corresponds to the name '%s'", name.c_str()));
16091633
}
16101634
return res;
1611-
}
1635+
}
16121636

16131637
std::string vpDetectorAprilTag::getAvailablePoseMethod(const std::string &prefix, const std::string &sep, const std::string &suffix)
16141638
{
16151639
std::string modes(prefix);
1640+
#if (VISP_CXX_STANDARD < VISP_CXX_STANDARD_11)
1641+
for (unsigned int i = 0; i < vpDetectorAprilTag::POSE_COUNT - 1; ++i) {
1642+
#else
16161643
for (unsigned int i = 0; i < vpDetectorAprilTag::vpPoseEstimationMethod::POSE_COUNT - 1; ++i) {
1644+
#endif
16171645
vpDetectorAprilTag::vpPoseEstimationMethod candidate = static_cast<vpDetectorAprilTag::vpPoseEstimationMethod>(i);
16181646
modes += poseMethodToString(candidate) + sep;
16191647
}
1648+
#if (VISP_CXX_STANDARD < VISP_CXX_STANDARD_11)
1649+
vpDetectorAprilTag::vpPoseEstimationMethod candidate = static_cast<vpDetectorAprilTag::vpPoseEstimationMethod>(vpDetectorAprilTag::POSE_COUNT - 1);
1650+
#else
16201651
vpDetectorAprilTag::vpPoseEstimationMethod candidate = static_cast<vpDetectorAprilTag::vpPoseEstimationMethod>(vpDetectorAprilTag::vpPoseEstimationMethod::POSE_COUNT - 1);
1652+
#endif
16211653
modes += poseMethodToString(candidate) + suffix;
16221654
return modes;
1623-
}
1655+
}
16241656

16251657
#ifdef VISP_HAVE_NLOHMANN_JSON
16261658
void to_json(nlohmann::json &j, const vpDetectorAprilTag &detector)

modules/tracker/mbt/include/visp3/mbt/vpMbtTukeyEstimator.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ END_VISP_NAMESPACE
135135
#if ((__cplusplus >= 201402L) || (defined(_MSVC_LANG) && (_MSVC_LANG >= 201402L)))
136136
auto AbsDiff = [](const auto &a, const auto &b) { return std::fabs(a - b); };
137137
#else
138-
template <typename T> struct AbsDiff : public std::binary_function<T, T, T>
138+
template <typename T> struct AbsDiff
139139
{
140140
T operator()(const T a, const T b) const { return std::fabs(a - b); }
141141
};

0 commit comments

Comments
 (0)