Skip to content

Commit

Permalink
De-boost
Browse files Browse the repository at this point in the history
  • Loading branch information
safijari committed Jun 2, 2024
1 parent 0fb03e2 commit c755ed7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
4 changes: 1 addition & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,8 @@ endif()

add_subdirectory(pybind11)

find_package(Boost COMPONENTS thread atomic REQUIRED)

pybind11_add_module(yag_slam_cpp src/PythonInterface.cpp src/Impls.cpp src/ScanMatcher.cpp)
target_link_libraries(yag_slam_cpp PRIVATE Boost::thread Boost::atomic)
target_link_libraries(yag_slam_cpp)

if (catkin_FOUND)
install(TARGETS yag_slam_cpp
Expand Down
17 changes: 9 additions & 8 deletions include/LocalizedRangeScan.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#ifndef LOCALIZED_RANGE_SCAN_H
#define LOCALIZED_RANGE_SCAN_H

#include <boost/thread.hpp>
#include <thread>
#include <shared_mutex>
#include <mutex>

#include "Transform.h"
#include "Vector2.h"
Expand Down Expand Up @@ -191,7 +192,7 @@ class LocalizedRangeScan : public LaserRangeScan {
virtual ~LocalizedRangeScan() {}

private:
mutable boost::shared_mutex m_Lock;
mutable std::shared_mutex m_Lock;

public:
/**
Expand Down Expand Up @@ -232,11 +233,11 @@ class LocalizedRangeScan : public LaserRangeScan {
* Gets barycenter of point readings
*/
inline const Pose2 &GetBarycenterPose() const {
boost::shared_lock<boost::shared_mutex> lock(m_Lock);
std::shared_lock<std::shared_mutex> lock(m_Lock);
if (m_IsDirty) {
// throw away constness and do an update!
lock.unlock();
boost::unique_lock<boost::shared_mutex> uniqueLock(m_Lock);
std::unique_lock<std::shared_mutex> uniqueLock(m_Lock);
const_cast<LocalizedRangeScan *>(this)->Update();
}

Expand All @@ -248,11 +249,11 @@ class LocalizedRangeScan : public LaserRangeScan {
* @return bounding box of this scan
*/
inline const BoundingBox2 &GetBoundingBox() const {
boost::shared_lock<boost::shared_mutex> lock(m_Lock);
std::shared_lock<std::shared_mutex> lock(m_Lock);
if (m_IsDirty) {
// throw away constness and do an update!
lock.unlock();
boost::unique_lock<boost::shared_mutex> uniqueLock(m_Lock);
std::unique_lock<std::shared_mutex> uniqueLock(m_Lock);
const_cast<LocalizedRangeScan *>(this)->Update();
}

Expand All @@ -264,11 +265,11 @@ class LocalizedRangeScan : public LaserRangeScan {
*/
inline const PointVectorDouble &
GetPointReadings(bool wantFiltered = false) const {
boost::shared_lock<boost::shared_mutex> lock(m_Lock);
std::shared_lock<std::shared_mutex> lock(m_Lock);
if (m_IsDirty) {
// throw away constness and do an update!
lock.unlock();
boost::unique_lock<boost::shared_mutex> uniqueLock(m_Lock);
std::unique_lock<std::shared_mutex> uniqueLock(m_Lock);
const_cast<LocalizedRangeScan *>(this)->Update();
}

Expand Down

0 comments on commit c755ed7

Please sign in to comment.