From 1854cdc6229760f347bc6db214c4c073884307d4 Mon Sep 17 00:00:00 2001 From: cvvergara Date: Mon, 7 Oct 2024 13:59:24 -0600 Subject: [PATCH 1/5] (driving_distance) Standarizing filenames --- .../{drivedist_driver.h => driving_distance_driver.h} | 0 ...thPoints_dd_driver.h => driving_distance_with_points_driver.h} | 0 .../{many_to_dist_driving_distance.c => driving_distance.c} | 0 .../{drivedist_driver.cpp => driving_distance_driver.cpp} | 0 ...{many_to_dist_withPointsDD.c => driving_distance_withPoints.c} | 0 ...oints_dd_driver.cpp => driving_distance_withPoints_driver.cpp} | 0 6 files changed, 0 insertions(+), 0 deletions(-) rename include/drivers/driving_distance/{drivedist_driver.h => driving_distance_driver.h} (100%) rename include/drivers/driving_distance/{withPoints_dd_driver.h => driving_distance_with_points_driver.h} (100%) rename src/driving_distance/{many_to_dist_driving_distance.c => driving_distance.c} (100%) rename src/driving_distance/{drivedist_driver.cpp => driving_distance_driver.cpp} (100%) rename src/driving_distance/{many_to_dist_withPointsDD.c => driving_distance_withPoints.c} (100%) rename src/driving_distance/{withPoints_dd_driver.cpp => driving_distance_withPoints_driver.cpp} (100%) diff --git a/include/drivers/driving_distance/drivedist_driver.h b/include/drivers/driving_distance/driving_distance_driver.h similarity index 100% rename from include/drivers/driving_distance/drivedist_driver.h rename to include/drivers/driving_distance/driving_distance_driver.h diff --git a/include/drivers/driving_distance/withPoints_dd_driver.h b/include/drivers/driving_distance/driving_distance_with_points_driver.h similarity index 100% rename from include/drivers/driving_distance/withPoints_dd_driver.h rename to include/drivers/driving_distance/driving_distance_with_points_driver.h diff --git a/src/driving_distance/many_to_dist_driving_distance.c b/src/driving_distance/driving_distance.c similarity index 100% rename from src/driving_distance/many_to_dist_driving_distance.c rename to src/driving_distance/driving_distance.c diff --git a/src/driving_distance/drivedist_driver.cpp b/src/driving_distance/driving_distance_driver.cpp similarity index 100% rename from src/driving_distance/drivedist_driver.cpp rename to src/driving_distance/driving_distance_driver.cpp diff --git a/src/driving_distance/many_to_dist_withPointsDD.c b/src/driving_distance/driving_distance_withPoints.c similarity index 100% rename from src/driving_distance/many_to_dist_withPointsDD.c rename to src/driving_distance/driving_distance_withPoints.c diff --git a/src/driving_distance/withPoints_dd_driver.cpp b/src/driving_distance/driving_distance_withPoints_driver.cpp similarity index 100% rename from src/driving_distance/withPoints_dd_driver.cpp rename to src/driving_distance/driving_distance_withPoints_driver.cpp From a4ee2a208fd5c847f0208b89f1870ff8237bc40d Mon Sep 17 00:00:00 2001 From: cvvergara Date: Mon, 7 Oct 2024 14:16:47 -0600 Subject: [PATCH 2/5] (build) Adjusting build and files to name changes --- .../driving_distance/driving_distance_driver.h | 6 +++--- ..._driver.h => driving_distance_withPoints_driver.h} | 6 +++--- src/driving_distance/CMakeLists.txt | 11 ++++++----- src/driving_distance/driving_distance.c | 4 ++-- src/driving_distance/driving_distance_driver.cpp | 4 ++-- src/driving_distance/driving_distance_withPoints.c | 4 ++-- .../driving_distance_withPoints_driver.cpp | 4 ++-- 7 files changed, 20 insertions(+), 19 deletions(-) rename include/drivers/driving_distance/{driving_distance_with_points_driver.h => driving_distance_withPoints_driver.h} (87%) diff --git a/include/drivers/driving_distance/driving_distance_driver.h b/include/drivers/driving_distance/driving_distance_driver.h index d82a977f632..7a37facf8c0 100644 --- a/include/drivers/driving_distance/driving_distance_driver.h +++ b/include/drivers/driving_distance/driving_distance_driver.h @@ -27,8 +27,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. ********************************************************************PGR-GNU*/ -#ifndef INCLUDE_DRIVERS_DRIVING_DISTANCE_DRIVEDIST_DRIVER_H_ -#define INCLUDE_DRIVERS_DRIVING_DISTANCE_DRIVEDIST_DRIVER_H_ +#ifndef INCLUDE_DRIVERS_DRIVING_DISTANCE_DRIVING_DISTANCE_DRIVER_H_ +#define INCLUDE_DRIVERS_DRIVING_DISTANCE_DRIVING_DISTANCE_DRIVER_H_ #ifdef __cplusplus extern "C" { @@ -68,4 +68,4 @@ void pgr_do_drivingDistance( } #endif -#endif // INCLUDE_DRIVERS_DRIVING_DISTANCE_DRIVEDIST_DRIVER_H_ +#endif // INCLUDE_DRIVERS_DRIVING_DISTANCE_DRIVING_DISTANCE_DRIVER_H_ diff --git a/include/drivers/driving_distance/driving_distance_with_points_driver.h b/include/drivers/driving_distance/driving_distance_withPoints_driver.h similarity index 87% rename from include/drivers/driving_distance/driving_distance_with_points_driver.h rename to include/drivers/driving_distance/driving_distance_withPoints_driver.h index 64bd4636ca3..c4d1c8fba2e 100644 --- a/include/drivers/driving_distance/driving_distance_with_points_driver.h +++ b/include/drivers/driving_distance/driving_distance_withPoints_driver.h @@ -29,8 +29,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. ********************************************************************PGR-GNU*/ -#ifndef INCLUDE_DRIVERS_DRIVING_DISTANCE_WITHPOINTS_DD_DRIVER_H_ -#define INCLUDE_DRIVERS_DRIVING_DISTANCE_WITHPOINTS_DD_DRIVER_H_ +#ifndef INCLUDE_DRIVERS_DRIVING_DISTANCE_DRIVING_DISTANCE_WITHPOINTS_DRIVER_H_ +#define INCLUDE_DRIVERS_DRIVING_DISTANCE_DRIVING_DISTANCE_WITHPOINTS_DRIVER_H_ #pragma once @@ -76,4 +76,4 @@ void pgr_do_withPointsDD( } #endif -#endif // INCLUDE_DRIVERS_DRIVING_DISTANCE_WITHPOINTS_DD_DRIVER_H_ +#endif // INCLUDE_DRIVERS_DRIVING_DISTANCE_DRIVING_DISTANCE_WITHPOINTS_DRIVER_H_ diff --git a/src/driving_distance/CMakeLists.txt b/src/driving_distance/CMakeLists.txt index 9d568dfd70c..44c6a598a2a 100644 --- a/src/driving_distance/CMakeLists.txt +++ b/src/driving_distance/CMakeLists.txt @@ -1,7 +1,8 @@ ADD_LIBRARY(driving_distance OBJECT - many_to_dist_driving_distance.c - many_to_dist_withPointsDD.c + driving_distance.c + driving_distance_withPoints.c - drivedist_driver.cpp - withPoints_dd_driver.cpp - ) + driving_distance_driver.cpp + driving_distance_withPoints_driver.cpp + +) diff --git a/src/driving_distance/driving_distance.c b/src/driving_distance/driving_distance.c index 3fa5a97001a..c60255f819b 100644 --- a/src/driving_distance/driving_distance.c +++ b/src/driving_distance/driving_distance.c @@ -1,5 +1,5 @@ /*PGR-GNU***************************************************************** -File: many_to_dist_driving_distance.c +File: driving_distance.c Copyright (c) 2015 pgRouting developers Mail: project@pgrouting.org @@ -35,7 +35,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. #include "c_common/e_report.h" #include "c_common/time_msg.h" -#include "drivers/driving_distance/drivedist_driver.h" +#include "drivers/driving_distance/driving_distance_driver.h" PGDLLEXPORT Datum _pgr_drivingdistance(PG_FUNCTION_ARGS); diff --git a/src/driving_distance/driving_distance_driver.cpp b/src/driving_distance/driving_distance_driver.cpp index b6fa1b4521c..c531a1fad2e 100644 --- a/src/driving_distance/driving_distance_driver.cpp +++ b/src/driving_distance/driving_distance_driver.cpp @@ -1,5 +1,5 @@ /*PGR-GNU***************************************************************** -File: drivedist_driver.cpp +File: driving_distance_driver.cpp Copyright (c) 2015 pgRouting developers Mail: project@pgrouting.org @@ -27,7 +27,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. ********************************************************************PGR-GNU*/ -#include "drivers/driving_distance/drivedist_driver.h" +#include "drivers/driving_distance/driving_distance_driver.h" #include #include diff --git a/src/driving_distance/driving_distance_withPoints.c b/src/driving_distance/driving_distance_withPoints.c index 8071d29b826..b320009d351 100644 --- a/src/driving_distance/driving_distance_withPoints.c +++ b/src/driving_distance/driving_distance_withPoints.c @@ -1,5 +1,5 @@ /*PGR-GNU***************************************************************** -File: many_to_dist_withPointsDD.c +File: driving_distance_withPoints.c Copyright (c) 2015 pgRouting developers Mail: project@pgrouting.org @@ -35,7 +35,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. #include "c_common/e_report.h" #include "c_common/time_msg.h" #include "drivers/withPoints/get_new_queries.h" -#include "drivers/driving_distance/withPoints_dd_driver.h" +#include "drivers/driving_distance/driving_distance_withPoints_driver.h" PGDLLEXPORT Datum _pgr_withpointsddv4(PG_FUNCTION_ARGS); PG_FUNCTION_INFO_V1(_pgr_withpointsddv4); diff --git a/src/driving_distance/driving_distance_withPoints_driver.cpp b/src/driving_distance/driving_distance_withPoints_driver.cpp index d8101d738fb..ce56926bc6a 100644 --- a/src/driving_distance/driving_distance_withPoints_driver.cpp +++ b/src/driving_distance/driving_distance_withPoints_driver.cpp @@ -1,5 +1,5 @@ /*PGR-GNU***************************************************************** -File: withPoints_dd_driver.cpp +File: driving_distance_withPoints_driver.cpp Generated with Template by: Copyright (c) 2015 pgRouting developers @@ -30,7 +30,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. ********************************************************************PGR-GNU*/ -#include "drivers/driving_distance/withPoints_dd_driver.h" +#include "drivers/driving_distance/driving_distance_withPoints_driver.h" #include #include From 150e01100373e48b0beb39d9038cd8016a13aa46 Mon Sep 17 00:00:00 2001 From: cvvergara Date: Mon, 7 Oct 2024 15:59:27 -0600 Subject: [PATCH 3/5] Removing unused header files --- include/cpp_common/signalhandler.hpp | 155 --------------------------- include/vrp/book_keeping.hpp | 114 -------------------- 2 files changed, 269 deletions(-) delete mode 100644 include/cpp_common/signalhandler.hpp delete mode 100644 include/vrp/book_keeping.hpp diff --git a/include/cpp_common/signalhandler.hpp b/include/cpp_common/signalhandler.hpp deleted file mode 100644 index db799ae886f..00000000000 --- a/include/cpp_common/signalhandler.hpp +++ /dev/null @@ -1,155 +0,0 @@ -/*PGR-GNU***************************************************************** -File: signalhandler.hpp - -Copyright (c) 2015 pgRouting developers -Mail: project@pgrouting.org - ------- - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - - ********************************************************************PGR-GNU*/ -/*PGR-MIT****************************************************************** - * - * file signalhandler.h - * - * Copyright 2014 Stephen Woodbridge - * Copyright 2014 Vicky Vergara - * - * This is free software; you can redistribute and/or modify it under - * the terms of the MIT License. Please file MIT-LICENSE for details. - * - *****************************************************************PGR-MIT*/ - -#ifndef INCLUDE_CPP_COMMON_SIGNALHANDLER_HPP_ -#define INCLUDE_CPP_COMMON_SIGNALHANDLER_HPP_ -#pragma once - -// defines NULL -#include -#include -#include - -// #include "./pgr_assert.hpp" - -class UserQuitException: public std::exception { - private: - const char *str; ///< str Holds the what() string for the exception. - - public: - virtual const char *what() const throw() { - return str; - } - - explicit UserQuitException(const char *_str): str(_str) {} -}; - - -class EventHandler { - public: - // Hook method for the signal hook method. - virtual void handleSignal(int signum) = 0; - - // ... other hook methods for other types of - // events such as timers, I/O, and - // synchronization objects. -}; - - -class SignalHandler { - public: - // Entry point. - static SignalHandler *instance(void); - - // Register an event handler for - // and return a pointer to any existing - // that was previously registered to handle . - EventHandler *registerHandler(int signum, EventHandler *eh); - - // Remove the for - // by setting the slot in the - // table to NULL. - void removeHandler(int signum); - - private: - // Ensure we're a Singleton. - SignalHandler(void) {} - - // Singleton pointer. - static SignalHandler *instance_; - - // Entry point adapter installed into - // (must be a static method or a stand-alone - // extern "C" function). - static void dispatcher(int signum); - - // Table of pointers to concrete s - // registered by applications. NSIG is the number of - // signals defined in . - static EventHandler *signalHandlers_[NSIG]; -}; - - -// --------------------------------------------------------- -// -- some concrete signal handlers -// --------------------------------------------------------- - -class SIGINT_Handler: public EventHandler { - public: - SIGINT_Handler(void): graceful_quit_(0) {} - - // Hook method. - virtual void handleSignal(int signum) { - if (signum == SIGINT) this->graceful_quit_ = 1; - } - - // Accessor. - sig_atomic_t gracefulQuit(void) { return this->graceful_quit_;} - - private: - sig_atomic_t graceful_quit_; -}; - - -class SIGQUIT_Handler: public EventHandler { - public: - SIGQUIT_Handler(void): abortive_quit_(0) {} - - // Hook method. - virtual void handleSignal(int signum) { - if (signum == SIGQUIT) this->abortive_quit_ = 1; - } - - // Accessor. - sig_atomic_t abortiveQuit(void) { return this->abortive_quit_;} - - private: - sig_atomic_t abortive_quit_; -}; - - -#define REG_SIGINT SIGINT_Handler sigint_handler; \ - SignalHandler::instance()->registerHandler(SIGINT, &sigint_handler); - -#define REG_SIGQUIT SIGQUIT_Handler sigquit_handler; \ - SignalHandler::instance()->registerHandler(SIGQUIT, &sigquit_handler); - -#define THROW_ON_SIGINT do { \ - if ( sigint_handler.gracefulQuit() == 1 ) \ - throw(UserQuitException("Abort on User Request!")); \ - } while (0); - -#endif // INCLUDE_CPP_COMMON_SIGNALHANDLER_HPP_ - diff --git a/include/vrp/book_keeping.hpp b/include/vrp/book_keeping.hpp deleted file mode 100644 index 0f205ad7590..00000000000 --- a/include/vrp/book_keeping.hpp +++ /dev/null @@ -1,114 +0,0 @@ -/*PGR-GNU***************************************************************** -File: book_keeping.hpp - - * Copyright (c) 2017 pgRouting developers - * Mail: project@pgrouting.org - * - * ------ - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - - ********************************************************************PGR-GNU*/ - -/*! @file */ - -#ifndef INCLUDE_VRP_BOOK_KEEPING_HPP_ -#define INCLUDE_VRP_BOOK_KEEPING_HPP_ -#pragma once - -#include -#include -#include -#include "vrp/vehicle_pickDeliver.hpp" -/** - * Book keeping class for swapping orders between vehicles - */ - -namespace pgrouting { -namespace vrp { - -class Swap_bk; -class Swap_info { - friend class Swap_bk; - - public: - Swap_info() = delete; - Swap_info(const Swap_info &) = default; - Swap_info(const Vehicle_pickDeliver &from, - const Vehicle_pickDeliver &to, - size_t from_o, - size_t to_o, - double delta); - friend std::ostream& operator << (std::ostream& log, const Swap_info &d); -#if 0 - { - log - << "\n" << d.from_truck.tau() << " --> " - << d.from_order - << "(" - << d.from_truck.orders()[d.from_order].pickup().original_id() - << ")" - << "\n" << d.to_truck.tau() << " --> " - << d.to_order - << "(" - << d.to_truck.orders()[d.to_order].pickup().original_id() - << ")" - << "\n" << "delta = " << d.estimated_delta; - return log; - } -#endif - - public: - Vehicle_pickDeliver from_truck; - Vehicle_pickDeliver to_truck; - size_t from_order; - size_t to_order; - double estimated_delta; -}; - - -class Swap_bk { - private: - class Compare { - public: - bool operator() (const Swap_info &lhs, const Swap_info rhs) { - return lhs.estimated_delta > rhs.estimated_delta; - } - }; - - public: - typedef std::priority_queue< - Swap_info, - std::vector, - Compare > Swaps_queue; - - - Swaps_queue m_swaps; - friend std::ostream& operator<< (std::ostream &log, const Swap_bk &data); - - public: - Swap_bk() = default; - Swap_bk(const Swap_bk &bk) = default; - Swaps_queue& possible_swaps() {return m_swaps;} - void push(const Swap_info& data) {m_swaps.push(data);} - Swap_info top() {return m_swaps.top();} - void pop() {return m_swaps.pop();} - bool empty() {return m_swaps.empty();} -}; - -} // namespace vrp -} // namespace pgrouting - -#endif // INCLUDE_VRP_BOOK_KEEPING_HPP_ From 4073295522359e5430bc876e7427f9f6d7e6a227 Mon Sep 17 00:00:00 2001 From: cvvergara Date: Wed, 9 Oct 2024 09:34:11 -0600 Subject: [PATCH 4/5] fix clang-tidy error --- src/driving_distance/driving_distance_withPoints.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/driving_distance/driving_distance_withPoints.c b/src/driving_distance/driving_distance_withPoints.c index b320009d351..130e633f972 100644 --- a/src/driving_distance/driving_distance_withPoints.c +++ b/src/driving_distance/driving_distance_withPoints.c @@ -70,7 +70,7 @@ process( } } else { /* TODO remove on v4 */ - char d_side = (char)tolower(driving_side[0]); + d_side = (char)tolower(driving_side[0]); if (!((d_side == 'r') || (d_side == 'l'))) d_side = 'b'; } From b9210abcbecdf2eb45692c90b31957b378556901 Mon Sep 17 00:00:00 2001 From: cvvergara Date: Wed, 9 Oct 2024 09:34:38 -0600 Subject: [PATCH 5/5] (clan-tidy) fix script not finding postgres.h --- .github/scripts/tidy-vs-commit.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/scripts/tidy-vs-commit.sh b/.github/scripts/tidy-vs-commit.sh index 2b0db9f07ba..4a370d58454 100755 --- a/.github/scripts/tidy-vs-commit.sh +++ b/.github/scripts/tidy-vs-commit.sh @@ -33,7 +33,7 @@ if [ ${#MODIFIED_HEADERS[@]} != 0 ] ; then for f in ${MODIFIED_HEADERS} do echo "${f}" - clang-tidy "${CHECKS}" -header-filter=.* "${f}" \ - -- -I./include "${POSTGRES_SERVER}" + echo clang-tidy "${CHECKS}" -header-filter=.* "${f}" -- -I./include "${POSTGRES_SERVER}" + clang-tidy "${CHECKS}" -header-filter=.* "${f}" -- -I./include ${POSTGRES_SERVER} done fi