MRPT
2.0.4
|
MRPT 2.0 includes several fundamental changes, most of them related to API clean ups and the introduction of C++17 as the minimum supported version of the language.
Existing user applications may need to be adapted to continue compiling and working as usual after updating to MRPT 2.*:
Mandatory changes
mrpt::math::CMatrix
–> mrpt::math::CMatrixF
<mrpt/math/lightweight_geom_data.h>
is deprecated. Instead, use<mrpt/math/TPose2D.h>
<mrpt/math/TPose3D.h>
<mrpt/math/TPoint2D.h>
std::shared_ptr<>
instead of those based on stlplus
. Required changes:ptr.clear()
–> ptr.reset()
. Also, notice that the former stlplus
semantics of clear()
deleting all copies of the object, as hold by different smart pointers, is no longer maintained. There is no longer such a possibility, since the C++11 standard does not allow it to happen (and it makes sense in this way).ptr.clear_unique()
–> ptr.reset()
. (Read this note above)ptr.make_unique()
does no longer exists, and does not make sense (read above).ptr.pointer()
–> ptr.get()
CFooPtr
to the more standard CFoo::Ptr
, with a new pointer-to-const version CFoo::ConstPtr
.CFoo::Ptr
smart pointers. Refer to changelog of mrpt 1.5.4.std::make_shared<CFoo>()
, or std::make_shared<CFoo>()
if the class must be memory-aligned (typically, if it contains Eigen matrices). The arguments of Create()
are now perfectly-forwarded to the class ctor, so the parameter list must exactly match any of the available ctors.mrpt::synch::CCriticalSection cs;
–> std::mutex cs;
mrpt::synch::CCriticalSectionLocker lock(&cs);
–> std::lock_guard<std::mutex> lock(cs);
mrpt::system::TThreadHandle h = mrpt::system::createThread(...);
–> std::thread h = std::thread(...);
mrpt::system::sleep(5);
–> std::this_thread::sleep_for(5ms);
mrpt::synch::CSemaphore sem; sem.waitForSignal(timeout); sem.release();
–> std::promise<void> sem; auto fut = sem.get_future(); fut.wait_for(...); sem.set_value();
<mrpt/system/scheduler.h>
, not in the old <mrpt/system/threads.h
:
mrpt::utils::CObject::duplicate()
has been removed, use the equivalent (redundant) mrpt::utils::CObject::clone()
.mrpt::utils::net
, sockets: have been moved to its own new module [mrpt-comms] under namespace mrpt::comms
.mrpt::math::randomGenerator
–> mrpt::math::getRandomGenerator()
mrpt::global_settings
old static variables have been replaced by getter/setter functions.ASSERT_*
macros must now be ended with a semicolon, e.g. ASSERT_(a>0);
writeToStream()
and readFromStream()
of old CSerializable
classes must be replaced by the three methods: serializeGetVersion()
, serializeTo()
, and serializeTo()
. See tutorials in [mrpt-serialization].IS_CLASS()
and IS_DERIVED()
now accept references to objects instead of pointers: Optional changes
Foo::ConstPtr
smart pointers when possible instead of its non-const counterpart. Page generated by Doxygen 1.8.14 for MRPT 2.0.4 Git: 33de1d0ad Sat Jun 20 11:02:42 2020 +0200 at sáb jun 20 17:35:17 CEST 2020 |