From d9935c2f9ef8f860aba85af8732d44a0e539b436 Mon Sep 17 00:00:00 2001 From: Ohisemega Date: Fri, 20 Mar 2026 17:39:52 +0000 Subject: [PATCH 1/6] boost::shared_ptr to std::shared_ptr Replace all boost::shared_ptr instances with std::shared_ptr. Replace boost::enabled_shared_from_this with std::enabled_shared_from_this. Replace boost::make_shared with std::make_shared. Fixes #463 --- cpp/common/include/ClassLoader.h | 13 ++--- cpp/common/include/IpcReactor.h | 4 +- cpp/common/include/SharedBufferManager.h | 5 +- cpp/common/src/IpcReactor.cpp | 2 +- cpp/frameProcessor/include/Acquisition.h | 16 +++---- cpp/frameProcessor/include/BloscPlugin.h | 4 +- cpp/frameProcessor/include/DataBlockFrame.h | 4 +- cpp/frameProcessor/include/DataBlockPool.h | 14 +++--- .../include/DummyUDPProcessPlugin.h | 4 +- cpp/frameProcessor/include/FileWriterPlugin.h | 10 ++-- .../include/FrameProcessorApp.h | 2 +- .../include/FrameProcessorController.h | 12 ++--- .../include/FrameProcessorPlugin.h | 14 +++--- cpp/frameProcessor/include/GapFillPlugin.h | 6 +-- cpp/frameProcessor/include/HDF5File.h | 2 +- cpp/frameProcessor/include/IFrameCallback.h | 8 ++-- .../include/KafkaProducerPlugin.h | 6 +-- cpp/frameProcessor/include/LiveViewPlugin.h | 4 +- .../include/OffsetAdjustmentPlugin.h | 2 +- .../include/ParameterAdjustmentPlugin.h | 2 +- .../include/RawFileWriterPlugin.h | 2 +- .../include/SharedMemoryController.h | 10 ++-- cpp/frameProcessor/include/SumPlugin.h | 2 +- cpp/frameProcessor/include/WatchdogTimer.h | 2 +- cpp/frameProcessor/src/Acquisition.cpp | 18 +++---- cpp/frameProcessor/src/BloscPlugin.cpp | 10 ++-- cpp/frameProcessor/src/DataBlockPool.cpp | 14 +++--- .../src/DummyUDPProcessPlugin.cpp | 8 ++-- cpp/frameProcessor/src/FileWriterPlugin.cpp | 16 +++---- cpp/frameProcessor/src/FrameProcessorApp.cpp | 4 +- .../src/FrameProcessorController.cpp | 28 +++++------ .../src/FrameProcessorPlugin.cpp | 22 ++++----- cpp/frameProcessor/src/GapFillPlugin.cpp | 12 ++--- cpp/frameProcessor/src/IFrameCallback.cpp | 8 ++-- .../src/KafkaProducerPlugin.cpp | 6 +-- cpp/frameProcessor/src/LiveViewPlugin.cpp | 4 +- .../src/OffsetAdjustmentPlugin.cpp | 2 +- .../src/ParameterAdjustmentPlugin.cpp | 2 +- .../src/RawFileWriterPlugin.cpp | 2 +- .../src/SharedMemoryController.cpp | 20 ++++---- cpp/frameProcessor/src/SumPlugin.cpp | 4 +- cpp/frameProcessor/test/BloscPluginTest.cpp | 8 ++-- .../test/FrameProcessorTest.cpp | 48 +++++++++---------- cpp/frameProcessor/test/GapFillPluginTest.cpp | 12 ++--- .../test/KafkaProducerPluginTest.cpp | 4 +- .../test/LiveViewPluginUnitTest.cpp | 12 ++--- cpp/frameProcessor/test/MetaMessageTest.cpp | 4 +- .../test/RawFileWriterPluginTest.cpp | 4 +- cpp/frameProcessor/test/TestHelperFunctions.h | 6 +-- .../include/DummyTCPFrameDecoder.h | 4 +- .../include/DummyUDPFrameDecoder.h | 6 +-- cpp/frameReceiver/include/FrameDecoder.h | 4 +- cpp/frameReceiver/include/FrameDecoderTCP.h | 4 +- cpp/frameReceiver/include/FrameDecoderUDP.h | 4 +- cpp/frameReceiver/include/FrameDecoderZMQ.h | 4 +- cpp/frameReceiver/include/FrameReceiverApp.h | 2 +- .../include/FrameReceiverController.h | 2 +- .../include/FrameReceiverRxThread.h | 2 +- cpp/frameReceiver/src/FrameReceiverApp.cpp | 4 +- .../src/FrameReceiverRxThread.cpp | 2 +- .../src/FrameReceiverTCPRxThread.cpp | 2 +- .../src/FrameReceiverUDPRxThread.cpp | 2 +- .../src/FrameReceiverZMQRxThread.cpp | 2 +- .../include/DummyUDPFrameSimulatorPlugin.h | 2 +- .../include/FrameSimulatorPluginUDP.h | 4 +- cpp/frameSimulator/include/UDPFrame.h | 5 +- .../src/DummyUDPFrameSimulatorPlugin.cpp | 2 +- cpp/frameSimulator/src/FrameSimulatorApp.cpp | 10 ++-- .../src/FrameSimulatorPluginUDP.cpp | 2 +- cpp/test/integrationTest/src/FrameTestApp.cpp | 2 +- 70 files changed, 251 insertions(+), 248 deletions(-) diff --git a/cpp/common/include/ClassLoader.h b/cpp/common/include/ClassLoader.h index c8c82ebe3..266605fc8 100644 --- a/cpp/common/include/ClassLoader.h +++ b/cpp/common/include/ClassLoader.h @@ -8,12 +8,13 @@ #ifndef ODIN_DATA_CLASSLOADER_H_ #define ODIN_DATA_CLASSLOADER_H_ -#include + #include #include #include #include #include +#include #include #define REGISTER(Base, Class, Name) OdinData::ClassLoader cl { Name, OdinData::maker }; @@ -23,9 +24,9 @@ namespace OdinData { * Function template to instantiate a class. * It returns a shared pointer to its base class */ -template boost::shared_ptr maker() +template std::shared_ptr maker() { - boost::shared_ptr ptr = boost::shared_ptr(new SubClass); + std::shared_ptr ptr = std::shared_ptr(new SubClass); return ptr; } @@ -43,7 +44,7 @@ template class ClassLoader { /** * Shared pointer to the specified BaseClass */ - typedef boost::shared_ptr maker_t(); + typedef std::shared_ptr maker_t(); public: /** @@ -61,7 +62,7 @@ template class ClassLoader { * \param[in] name - name of class to load * \param[in] path - full path of the library to load */ - static boost::shared_ptr load_class(const std::string& name, const std::string& path) + static std::shared_ptr load_class(const std::string& name, const std::string& path) { // First do we already have this class loaded? if (!is_registered(name)) { @@ -83,7 +84,7 @@ template class ClassLoader { // make function with the factory map ready to produce instances. } } - boost::shared_ptr obj; + std::shared_ptr obj; try { if (factory_map().count(name)) { obj = factory_map()[name](); diff --git a/cpp/common/include/IpcReactor.h b/cpp/common/include/IpcReactor.h index ef6a880b4..fc2b9df5f 100644 --- a/cpp/common/include/IpcReactor.h +++ b/cpp/common/include/IpcReactor.h @@ -26,7 +26,7 @@ #include #include #include -#include + #include #include "IpcChannel.h" @@ -97,7 +97,7 @@ typedef std::map ChannelMap; typedef std::map SocketMap; //! Internal map to associate timer ID with a timer -typedef std::map> TimerMap; +typedef std::map> TimerMap; class IpcReactor { public: diff --git a/cpp/common/include/SharedBufferManager.h b/cpp/common/include/SharedBufferManager.h index 0e05922d4..5d3a1d7bb 100644 --- a/cpp/common/include/SharedBufferManager.h +++ b/cpp/common/include/SharedBufferManager.h @@ -10,10 +10,11 @@ #include #include +#include #include #include -#include + #include "OdinDataException.h" @@ -63,7 +64,7 @@ class SharedBufferManager { static size_t last_manager_id; }; -typedef boost::shared_ptr SharedBufferManagerPtr; +typedef std::shared_ptr SharedBufferManagerPtr; } // namespace OdinData #endif /* SHAREDBUFFERMANAGER_H_ */ diff --git a/cpp/common/src/IpcReactor.cpp b/cpp/common/src/IpcReactor.cpp index ee21594f0..1a380842c 100644 --- a/cpp/common/src/IpcReactor.cpp +++ b/cpp/common/src/IpcReactor.cpp @@ -211,7 +211,7 @@ int IpcReactor::register_timer(size_t delay_ms, size_t times, TimerCallback call boost::lock_guard lock(mutex_); // Create a smart pointer to a new timer object - boost::shared_ptr timer(new IpcReactorTimer(delay_ms, times, callback)); + std::shared_ptr timer(new IpcReactorTimer(delay_ms, times, callback)); // Add the timer to the timer map timers_[timer->get_id()] = timer; diff --git a/cpp/frameProcessor/include/Acquisition.h b/cpp/frameProcessor/include/Acquisition.h index f87994741..246390a45 100644 --- a/cpp/frameProcessor/include/Acquisition.h +++ b/cpp/frameProcessor/include/Acquisition.h @@ -12,7 +12,7 @@ #include #include -#include + #include using namespace log4cxx; @@ -30,9 +30,9 @@ class Acquisition : public MetaMessagePublisher { Acquisition(const HDF5ErrorDefinition_t& hdf5_error_definition); ~Acquisition(); std::string get_last_error(); - ProcessFrameStatus process_frame(boost::shared_ptr frame, HDF5CallDurations_t& call_durations); + ProcessFrameStatus process_frame(std::shared_ptr frame, HDF5CallDurations_t& call_durations); void create_file(size_t file_number, HDF5CallDurations_t& call_durations); - void close_file(boost::shared_ptr file, HDF5CallDurations_t& call_durations); + void close_file(std::shared_ptr file, HDF5CallDurations_t& call_durations); void validate_dataset_definition(DatasetDefinition definition); bool start_acquisition( size_t concurrent_rank, @@ -50,11 +50,11 @@ class Acquisition : public MetaMessagePublisher { HDF5CallDurations_t& call_durations ); void stop_acquisition(HDF5CallDurations_t& call_durations); - bool check_frame_valid(boost::shared_ptr frame); + bool check_frame_valid(std::shared_ptr frame); size_t get_frame_offset_in_file(size_t frame_offset) const; size_t get_file_index(size_t frame_offset) const; - size_t adjust_frame_offset(boost::shared_ptr frame) const; - boost::shared_ptr get_file(size_t frame_offset, HDF5CallDurations_t& call_durations); + size_t adjust_frame_offset(std::shared_ptr frame) const; + std::shared_ptr get_file(size_t frame_offset, HDF5CallDurations_t& call_durations); std::string get_create_meta_header(); std::string get_meta_header(); std::string generate_filename(size_t file_number = 0); @@ -112,9 +112,9 @@ class Acquisition : public MetaMessagePublisher { std::string document_to_string(rapidjson::Document& document) const; /** The current file that frames are being written to */ - boost::shared_ptr current_file_; + std::shared_ptr current_file_; /** The previous file that frames were written to, held in case of late frames */ - boost::shared_ptr previous_file_; + std::shared_ptr previous_file_; /** Most recently generated error message */ std::string last_error_; }; diff --git a/cpp/frameProcessor/include/BloscPlugin.h b/cpp/frameProcessor/include/BloscPlugin.h index 1e3b490af..66059a347 100644 --- a/cpp/frameProcessor/include/BloscPlugin.h +++ b/cpp/frameProcessor/include/BloscPlugin.h @@ -38,7 +38,7 @@ class BloscPlugin : public FrameProcessorPlugin { public: BloscPlugin(); virtual ~BloscPlugin(); - boost::shared_ptr compress_frame(boost::shared_ptr frame); + std::shared_ptr compress_frame(std::shared_ptr frame); /** Configuration constants */ static const std::string CONFIG_BLOSC_COMPRESSOR; @@ -47,7 +47,7 @@ class BloscPlugin : public FrameProcessorPlugin { static const std::string CONFIG_BLOSC_SHUFFLE; // Baseclass API to implement: - void process_frame(boost::shared_ptr frame); + void process_frame(std::shared_ptr frame); void configure(OdinData::IpcMessage& config, OdinData::IpcMessage& reply); void requestConfiguration(OdinData::IpcMessage& reply); int get_version_major(); diff --git a/cpp/frameProcessor/include/DataBlockFrame.h b/cpp/frameProcessor/include/DataBlockFrame.h index be0ed506a..f6abcecbe 100644 --- a/cpp/frameProcessor/include/DataBlockFrame.h +++ b/cpp/frameProcessor/include/DataBlockFrame.h @@ -4,7 +4,7 @@ #include "DataBlock.h" #include "Frame.h" -#include + namespace FrameProcessor { @@ -36,7 +36,7 @@ class DataBlockFrame : public Frame { private: /** Pointer to raw data block */ - boost::shared_ptr raw_data_block_ptr_; + std::shared_ptr raw_data_block_ptr_; }; } diff --git a/cpp/frameProcessor/include/DataBlockPool.h b/cpp/frameProcessor/include/DataBlockPool.h index 607ad7f7b..4bd5040d1 100644 --- a/cpp/frameProcessor/include/DataBlockPool.h +++ b/cpp/frameProcessor/include/DataBlockPool.h @@ -10,7 +10,7 @@ #include -#include + #include #include "DataBlock.h" @@ -33,8 +33,8 @@ class DataBlockPool { virtual ~DataBlockPool(); static void allocate(size_t block_count, size_t block_size); - static boost::shared_ptr take(size_t block_size); - static void release(boost::shared_ptr block); + static std::shared_ptr take(size_t block_size); + static void release(std::shared_ptr block); static size_t get_free_blocks(size_t block_size); static size_t get_used_blocks(size_t block_size); static size_t get_total_blocks(size_t block_size); @@ -45,8 +45,8 @@ class DataBlockPool { static DataBlockPool* instance(size_t block_size); DataBlockPool(); void internal_allocate(size_t block_count, size_t block_size); - boost::shared_ptr internal_take(size_t block_size); - void internal_release(boost::shared_ptr block); + std::shared_ptr internal_take(size_t block_size); + void internal_release(std::shared_ptr block); size_t internal_get_free_blocks(); size_t internal_get_used_blocks(); size_t internal_get_total_blocks(); @@ -57,9 +57,9 @@ class DataBlockPool { /** Mutex used to make this class thread safe */ boost::recursive_mutex mutex_; /** List of currently available DataBlock objects */ - std::list> free_list_; + std::list> free_list_; /** Map of currently used DataBlock objects, indexed by their unique IDs */ - std::map> used_map_; + std::map> used_map_; /** Number of currently available DataBlock objects */ size_t free_blocks_; /** Number of currently used DataBlock objects */ diff --git a/cpp/frameProcessor/include/DummyUDPProcessPlugin.h b/cpp/frameProcessor/include/DummyUDPProcessPlugin.h index 718ef7ee4..508edf053 100644 --- a/cpp/frameProcessor/include/DummyUDPProcessPlugin.h +++ b/cpp/frameProcessor/include/DummyUDPProcessPlugin.h @@ -56,8 +56,8 @@ class DummyUDPProcessPlugin : public FrameProcessorPlugin { /** Command execution constant for print command **/ static const std::string EXECUTE_PRINT; - void process_frame(boost::shared_ptr frame); - void process_lost_packets(boost::shared_ptr& frame); + void process_frame(std::shared_ptr frame); + void process_lost_packets(std::shared_ptr& frame); /** Pointer to logger */ LoggerPtr logger_; diff --git a/cpp/frameProcessor/include/FileWriterPlugin.h b/cpp/frameProcessor/include/FileWriterPlugin.h index 85061adfe..13288e5b5 100644 --- a/cpp/frameProcessor/include/FileWriterPlugin.h +++ b/cpp/frameProcessor/include/FileWriterPlugin.h @@ -10,7 +10,7 @@ #include #include -#include + #include #include @@ -170,9 +170,9 @@ class FileWriterPlugin : public FrameProcessorPlugin { */ FileWriterPlugin(const FileWriterPlugin& src); // prevent copying one of these - void process_frame(boost::shared_ptr frame); + void process_frame(std::shared_ptr frame); void process_end_of_acquisition(); - bool frame_in_acquisition(boost::shared_ptr frame); + bool frame_in_acquisition(std::shared_ptr frame); /** Pointer to logger */ LoggerPtr logger_; @@ -185,9 +185,9 @@ class FileWriterPlugin : public FrameProcessorPlugin { /** Rank of this file writer */ size_t concurrent_rank_; /** Details of the acquisition currently being written */ - boost::shared_ptr current_acquisition_; + std::shared_ptr current_acquisition_; /** Details of the next acquisition to be written */ - boost::shared_ptr next_acquisition_; + std::shared_ptr next_acquisition_; /** Map of dataset definitions */ std::map dataset_defs_; /** Number of frames to write consecutively in a file */ diff --git a/cpp/frameProcessor/include/FrameProcessorApp.h b/cpp/frameProcessor/include/FrameProcessorApp.h index 0fb9cc34b..aae1ff5c7 100644 --- a/cpp/frameProcessor/include/FrameProcessorApp.h +++ b/cpp/frameProcessor/include/FrameProcessorApp.h @@ -25,7 +25,7 @@ class FrameProcessorApp { private: LoggerPtr logger_; //!< Log4CXX logger instance pointer - static boost::shared_ptr controller_; //!< FrameProcessor controller object + static std::shared_ptr controller_; //!< FrameProcessor controller object // Command line options unsigned int io_threads_; //!< Number of IO threads for IPC channels diff --git a/cpp/frameProcessor/include/FrameProcessorController.h b/cpp/frameProcessor/include/FrameProcessorController.h index 981118c8e..b0cf88502 100644 --- a/cpp/frameProcessor/include/FrameProcessorController.h +++ b/cpp/frameProcessor/include/FrameProcessorController.h @@ -8,7 +8,7 @@ #ifndef TOOLS_FILEWRITER_FrameProcessorController_H_ #define TOOLS_FILEWRITER_FrameProcessorController_H_ -#include + #include #include "ClassLoader.h" @@ -33,7 +33,7 @@ namespace FrameProcessor { * The class uses an IpcReactor to manage connections and status updates. */ class FrameProcessorController : public IFrameCallback, - public boost::enable_shared_from_this { + public std::enable_shared_from_this { public: FrameProcessorController(unsigned int num_io_threads = OdinData::Defaults::default_io_threads); virtual ~FrameProcessorController(); @@ -128,14 +128,14 @@ class FrameProcessorController : public IFrameCallback, void closeMetaTxInterface(); void runIpcService(void); void tickTimer(void); - void callback(boost::shared_ptr frame); + void callback(std::shared_ptr frame); /** Pointer to the logging facility */ log4cxx::LoggerPtr logger_; /** Pointer to the shared memory controller instance for this process */ - boost::shared_ptr sharedMemController_; + std::shared_ptr sharedMemController_; /** Map of plugins loaded, indexed by plugin index */ - std::map> plugins_; + std::map> plugins_; /** Map of stored configuration objects */ std::map stored_configs_; /** Condition for exiting this file writing process */ @@ -163,7 +163,7 @@ class FrameProcessorController : public IFrameCallback, /** Store for any messages occurring during thread initialisation */ std::string threadInitMsg_; /** Pointer to the IpcReactor for incoming frame handling */ - boost::shared_ptr reactor_; + std::shared_ptr reactor_; /** End point for control messages */ std::string ctrlChannelEndpoint_; /** ZMQ context for IPC channels */ diff --git a/cpp/frameProcessor/include/FrameProcessorPlugin.h b/cpp/frameProcessor/include/FrameProcessorPlugin.h index 3c96cc980..5a5437e77 100644 --- a/cpp/frameProcessor/include/FrameProcessorPlugin.h +++ b/cpp/frameProcessor/include/FrameProcessorPlugin.h @@ -69,14 +69,14 @@ class FrameProcessorPlugin : public IFrameCallback, public OdinData::IVersionedO void add_performance_stats(OdinData::IpcMessage& status); void reset_performance_stats(); void version(OdinData::IpcMessage& status); - void register_callback(const std::string& name, boost::shared_ptr cb, bool blocking = false); + void register_callback(const std::string& name, std::shared_ptr cb, bool blocking = false); void remove_callback(const std::string& name); void remove_all_callbacks(); void notify_end_of_acquisition(); protected: - void push(boost::shared_ptr frame); - void push(const std::string& plugin_name, boost::shared_ptr frame); + void push(std::shared_ptr frame); + void push(const std::string& plugin_name, std::shared_ptr frame); using ParameterMetadataMap_t = std::unordered_map; using All_val_vec_t = std::vector; @@ -217,7 +217,7 @@ class FrameProcessorPlugin : public IFrameCallback, public OdinData::IVersionedO } } - void callback(boost::shared_ptr frame); + void callback(std::shared_ptr frame); /** * This is called by the callback method when any new frames have @@ -225,15 +225,15 @@ class FrameProcessorPlugin : public IFrameCallback, public OdinData::IVersionedO * * \param[in] frame - Pointer to the frame. */ - virtual void process_frame(boost::shared_ptr frame) = 0; + virtual void process_frame(std::shared_ptr frame) = 0; virtual void process_end_of_acquisition(); /** Name of this plugin */ std::string name_; /** Map of registered plugins for callbacks, indexed by name */ - std::map> callbacks_; + std::map> callbacks_; /** Map of registered plugins for blocking callbacks, indexed by name */ - std::map> blocking_callbacks_; + std::map> blocking_callbacks_; /** Error message array */ std::vector error_messages_; /** Warning message array */ diff --git a/cpp/frameProcessor/include/GapFillPlugin.h b/cpp/frameProcessor/include/GapFillPlugin.h index 1fd06b9d6..4ced0b985 100644 --- a/cpp/frameProcessor/include/GapFillPlugin.h +++ b/cpp/frameProcessor/include/GapFillPlugin.h @@ -25,9 +25,9 @@ class GapFillPlugin : public FrameProcessorPlugin { public: GapFillPlugin(); virtual ~GapFillPlugin(); - void process_frame(boost::shared_ptr frame); - bool configuration_valid(boost::shared_ptr frame); - boost::shared_ptr insert_gaps(boost::shared_ptr frame); + void process_frame(std::shared_ptr frame); + bool configuration_valid(std::shared_ptr frame); + std::shared_ptr insert_gaps(std::shared_ptr frame); void configure(OdinData::IpcMessage& config, OdinData::IpcMessage& reply); int get_version_major(); int get_version_minor(); diff --git a/cpp/frameProcessor/include/HDF5File.h b/cpp/frameProcessor/include/HDF5File.h index 1b07625fc..2ccf31e77 100644 --- a/cpp/frameProcessor/include/HDF5File.h +++ b/cpp/frameProcessor/include/HDF5File.h @@ -12,7 +12,7 @@ #include #include -#include + #include #include diff --git a/cpp/frameProcessor/include/IFrameCallback.h b/cpp/frameProcessor/include/IFrameCallback.h index a57b41e64..0cdf5b4bf 100644 --- a/cpp/frameProcessor/include/IFrameCallback.h +++ b/cpp/frameProcessor/include/IFrameCallback.h @@ -8,7 +8,7 @@ #ifndef TOOLS_FILEWRITER_IFRAMECALLBACK_H_ #define TOOLS_FILEWRITER_IFRAMECALLBACK_H_ -#include + #include #include @@ -33,7 +33,7 @@ class IFrameCallback { public: IFrameCallback(); virtual ~IFrameCallback(); - boost::shared_ptr>> getWorkQueue(); + std::shared_ptr>> getWorkQueue(); void start(); void stop(); bool isWorking() const; @@ -47,7 +47,7 @@ class IFrameCallback { * * \param[in] frame - pointer to Frame object ready for processing by the IFrameCallback subclass. */ - virtual void callback(boost::shared_ptr frame) = 0; + virtual void callback(std::shared_ptr frame) = 0; private: /** Pointer to logger */ @@ -55,7 +55,7 @@ class IFrameCallback { /** Pointer to worker queue thread */ boost::thread* thread_; /** Pointer to WorkQueue for Frame object pointers */ - boost::shared_ptr>> queue_; + std::shared_ptr>> queue_; /** IFrameCallback run flag */ bool run_; /** Is this IFrameCallback working */ diff --git a/cpp/frameProcessor/include/KafkaProducerPlugin.h b/cpp/frameProcessor/include/KafkaProducerPlugin.h index 6a7ea257b..cf3ecef6c 100644 --- a/cpp/frameProcessor/include/KafkaProducerPlugin.h +++ b/cpp/frameProcessor/include/KafkaProducerPlugin.h @@ -70,7 +70,7 @@ class KafkaProducerPlugin : public FrameProcessorPlugin { void status(OdinData::IpcMessage& status); - void process_frame(boost::shared_ptr frame); + void process_frame(std::shared_ptr frame); bool reset_statistics(); @@ -91,9 +91,9 @@ class KafkaProducerPlugin : public FrameProcessorPlugin { void configure_dataset(std::string dataset); - void* create_message(boost::shared_ptr frame, size_t& nbytes); + void* create_message(std::shared_ptr frame, size_t& nbytes); - void enqueue_frame(boost::shared_ptr frame); + void enqueue_frame(std::shared_ptr frame); int get_version_major(); diff --git a/cpp/frameProcessor/include/LiveViewPlugin.h b/cpp/frameProcessor/include/LiveViewPlugin.h index 71b968ef5..33af87ae7 100644 --- a/cpp/frameProcessor/include/LiveViewPlugin.h +++ b/cpp/frameProcessor/include/LiveViewPlugin.h @@ -25,9 +25,9 @@ class LiveViewPlugin : public FrameProcessorPlugin { public: LiveViewPlugin(); virtual ~LiveViewPlugin(); - void process_frame(boost::shared_ptr frame); + void process_frame(std::shared_ptr frame); void configure(OdinData::IpcMessage& config, OdinData::IpcMessage& reply); - void pass_live_frame(boost::shared_ptr frame); + void pass_live_frame(std::shared_ptr frame); int get_version_major(); int get_version_minor(); int get_version_patch(); diff --git a/cpp/frameProcessor/include/OffsetAdjustmentPlugin.h b/cpp/frameProcessor/include/OffsetAdjustmentPlugin.h index 34847fe78..e193b20b6 100644 --- a/cpp/frameProcessor/include/OffsetAdjustmentPlugin.h +++ b/cpp/frameProcessor/include/OffsetAdjustmentPlugin.h @@ -31,7 +31,7 @@ class OffsetAdjustmentPlugin : public FrameProcessorPlugin { public: OffsetAdjustmentPlugin(); virtual ~OffsetAdjustmentPlugin(); - void process_frame(boost::shared_ptr frame); + void process_frame(std::shared_ptr frame); void configure(OdinData::IpcMessage& config, OdinData::IpcMessage& reply); int get_version_major(); int get_version_minor(); diff --git a/cpp/frameProcessor/include/ParameterAdjustmentPlugin.h b/cpp/frameProcessor/include/ParameterAdjustmentPlugin.h index 4d493b612..652aafb46 100644 --- a/cpp/frameProcessor/include/ParameterAdjustmentPlugin.h +++ b/cpp/frameProcessor/include/ParameterAdjustmentPlugin.h @@ -32,7 +32,7 @@ class ParameterAdjustmentPlugin : public FrameProcessorPlugin { public: ParameterAdjustmentPlugin(); virtual ~ParameterAdjustmentPlugin(); - void process_frame(boost::shared_ptr frame); + void process_frame(std::shared_ptr frame); void configure(OdinData::IpcMessage& config, OdinData::IpcMessage& reply); int get_version_major(); int get_version_minor(); diff --git a/cpp/frameProcessor/include/RawFileWriterPlugin.h b/cpp/frameProcessor/include/RawFileWriterPlugin.h index aa2fbce1a..7275967ac 100644 --- a/cpp/frameProcessor/include/RawFileWriterPlugin.h +++ b/cpp/frameProcessor/include/RawFileWriterPlugin.h @@ -20,7 +20,7 @@ namespace FrameProcessor { class RawFileWriterPlugin : public FrameProcessorPlugin { public: RawFileWriterPlugin(); - void process_frame(boost::shared_ptr frame); + void process_frame(std::shared_ptr frame); void configure(OdinData::IpcMessage& config, OdinData::IpcMessage& reply); void requestConfiguration(OdinData::IpcMessage& reply); void status(OdinData::IpcMessage& reply); diff --git a/cpp/frameProcessor/include/SharedMemoryController.h b/cpp/frameProcessor/include/SharedMemoryController.h index e6d55e62d..67a6e7e41 100644 --- a/cpp/frameProcessor/include/SharedMemoryController.h +++ b/cpp/frameProcessor/include/SharedMemoryController.h @@ -38,14 +38,14 @@ namespace FrameProcessor { class SharedMemoryController { public: SharedMemoryController( - boost::shared_ptr reactor, + std::shared_ptr reactor, const std::string& rxEndPoint, const std::string& txEndPoint ); virtual ~SharedMemoryController(); void setSharedBufferManager(const std::string& shared_buffer_name); void requestSharedBufferConfig(const bool deferred = false); - void registerCallback(const std::string& name, boost::shared_ptr cb); + void registerCallback(const std::string& name, std::shared_ptr cb); void removeCallback(const std::string& name); void handleRxChannel(); void status(OdinData::IpcMessage& status); @@ -55,11 +55,11 @@ class SharedMemoryController { /** Pointer to logger */ LoggerPtr logger_; /** Pointer to SharedBufferManager object */ - boost::shared_ptr sbm_; + std::shared_ptr sbm_; /** Map of IFrameCallback pointers, indexed by name */ - std::map> callbacks_; + std::map> callbacks_; /** IpcReactor pointer, for managing IpcMessage objects */ - boost::shared_ptr reactor_; + std::shared_ptr reactor_; /** IpcChannel for receiving notifications of new frames */ OdinData::IpcChannel rxChannel_; /** IpcChannel for sending notifications of frame release */ diff --git a/cpp/frameProcessor/include/SumPlugin.h b/cpp/frameProcessor/include/SumPlugin.h index 1ec445daf..b422f9340 100644 --- a/cpp/frameProcessor/include/SumPlugin.h +++ b/cpp/frameProcessor/include/SumPlugin.h @@ -28,7 +28,7 @@ class SumPlugin : public FrameProcessorPlugin { ~SumPlugin(); - void process_frame(boost::shared_ptr frame); + void process_frame(std::shared_ptr frame); int get_version_major(); diff --git a/cpp/frameProcessor/include/WatchdogTimer.h b/cpp/frameProcessor/include/WatchdogTimer.h index f4562a440..a123dead3 100644 --- a/cpp/frameProcessor/include/WatchdogTimer.h +++ b/cpp/frameProcessor/include/WatchdogTimer.h @@ -10,7 +10,7 @@ #include -#include + #include #include diff --git a/cpp/frameProcessor/src/Acquisition.cpp b/cpp/frameProcessor/src/Acquisition.cpp index 6c3265201..c369be6d7 100644 --- a/cpp/frameProcessor/src/Acquisition.cpp +++ b/cpp/frameProcessor/src/Acquisition.cpp @@ -81,7 +81,7 @@ std::string Acquisition::get_last_error() * \param[in] frame - The frame to process * \return - The Status of the processing. */ -ProcessFrameStatus Acquisition::process_frame(boost::shared_ptr frame, HDF5CallDurations_t& call_durations) +ProcessFrameStatus Acquisition::process_frame(std::shared_ptr frame, HDF5CallDurations_t& call_durations) { ProcessFrameStatus return_status = status_ok; @@ -103,7 +103,7 @@ ProcessFrameStatus Acquisition::process_frame(boost::shared_ptr frame, HD } } - boost::shared_ptr file = this->get_file(frame_offset, call_durations); + std::shared_ptr file = this->get_file(frame_offset, call_durations); if (file == 0) { last_error_ = "Unable to get file for this frame"; @@ -215,7 +215,7 @@ void Acquisition::create_file(size_t file_number, HDF5CallDurations_t& call_dura close_file(previous_file_, call_durations); previous_file_ = current_file_; - current_file_ = boost::shared_ptr(new HDF5File(hdf5_error_definition_)); + current_file_ = std::shared_ptr(new HDF5File(hdf5_error_definition_)); // Create the file boost::filesystem::path full_path = boost::filesystem::path(file_path_) / boost::filesystem::path(filename_); @@ -284,7 +284,7 @@ void Acquisition::create_file(size_t file_number, HDF5CallDurations_t& call_dura * * \param[in] file - The HDF5File to call to close its file */ -void Acquisition::close_file(boost::shared_ptr file, HDF5CallDurations_t& call_durations) +void Acquisition::close_file(std::shared_ptr file, HDF5CallDurations_t& call_durations) { if (file != 0) { LOG4CXX_INFO(logger_, "Closing file " << file->get_filename()); @@ -410,7 +410,7 @@ void Acquisition::stop_acquisition(HDF5CallDurations_t& call_durations) * \param[in] frame - Pointer to the Frame object. * \return - true if the frame was valid */ -bool Acquisition::check_frame_valid(boost::shared_ptr frame) +bool Acquisition::check_frame_valid(std::shared_ptr frame) { bool invalid = false; const FrameMetaData frame_meta_data = frame->get_meta_data(); @@ -540,7 +540,7 @@ size_t Acquisition::get_file_index(size_t frame_offset) const * \param[in] frame_offset - The frame offset to get the file for * \return - The file that should be used to write this frame */ -boost::shared_ptr Acquisition::get_file(size_t frame_offset, HDF5CallDurations_t& call_durations) +std::shared_ptr Acquisition::get_file(size_t frame_offset, HDF5CallDurations_t& call_durations) { if (blocks_per_file_ == 0) { return this->current_file_; @@ -569,7 +569,7 @@ boost::shared_ptr Acquisition::get_file(size_t frame_offset, HDF5CallD if (filename_.empty()) { last_error_ = "Failed to generate a valid file name - not creating file."; LOG4CXX_ERROR(logger_, last_error_); - return boost::shared_ptr(); + return std::shared_ptr(); } create_file(next_expected_file_index, call_durations); next_expected_file_index = current_file_->get_file_index() + concurrent_processes_; @@ -578,7 +578,7 @@ boost::shared_ptr Acquisition::get_file(size_t frame_offset, HDF5CallD return this->current_file_; } else { LOG4CXX_WARN(logger_, "Unable to write frame offset " << frame_offset << " as no suitable file found"); - return boost::shared_ptr(); + return std::shared_ptr(); } } @@ -593,7 +593,7 @@ boost::shared_ptr Acquisition::get_file(size_t frame_offset, HDF5CallD * * Returns the dataset offset for frame number (frame_no) */ -size_t Acquisition::adjust_frame_offset(boost::shared_ptr frame) const +size_t Acquisition::adjust_frame_offset(std::shared_ptr frame) const { size_t frame_no = frame->get_frame_number(); int64_t frame_offset_adjustment = frame->get_meta_data().get_frame_offset(); diff --git a/cpp/frameProcessor/src/BloscPlugin.cpp b/cpp/frameProcessor/src/BloscPlugin.cpp index 0f788a672..e274b6f0b 100644 --- a/cpp/frameProcessor/src/BloscPlugin.cpp +++ b/cpp/frameProcessor/src/BloscPlugin.cpp @@ -105,7 +105,7 @@ BloscPlugin::~BloscPlugin() * @param src_frame - source frame to compress * @return compressed frame */ -boost::shared_ptr BloscPlugin::compress_frame(boost::shared_ptr src_frame) +std::shared_ptr BloscPlugin::compress_frame(std::shared_ptr src_frame) { int compressed_size = 0; @@ -123,8 +123,8 @@ boost::shared_ptr BloscPlugin::compress_frame(boost::shared_ptr sr size_t dest_data_size = c_settings.uncompressed_size + BLOSC_MAX_OVERHEAD; - boost::shared_ptr dest_frame - = boost::shared_ptr(new DataBlockFrame(dest_meta_data, dest_data_size)); + std::shared_ptr dest_frame + = std::shared_ptr(new DataBlockFrame(dest_meta_data, dest_data_size)); std::stringstream ss_blosc_settings; ss_blosc_settings << " compressor=" << blosc_get_compressor() << " threads=" << blosc_get_nthreads() @@ -230,7 +230,7 @@ void* BloscPlugin::get_buffer(size_t nbytes) * * \param[in] frame - Pointer to a Frame object. */ -void BloscPlugin::process_frame(boost::shared_ptr src_frame) +void BloscPlugin::process_frame(std::shared_ptr src_frame) { // Protect this method boost::lock_guard lock(mutex_); @@ -245,7 +245,7 @@ void BloscPlugin::process_frame(boost::shared_ptr src_frame) this->update_compression_settings(); } - boost::shared_ptr compressed_frame = this->compress_frame(src_frame); + std::shared_ptr compressed_frame = this->compress_frame(src_frame); LOG4CXX_DEBUG_LEVEL(3, logger_, "Pushing compressed frame"); this->push(compressed_frame); } diff --git a/cpp/frameProcessor/src/DataBlockPool.cpp b/cpp/frameProcessor/src/DataBlockPool.cpp index 33894d88d..005a01fd3 100644 --- a/cpp/frameProcessor/src/DataBlockPool.cpp +++ b/cpp/frameProcessor/src/DataBlockPool.cpp @@ -38,7 +38,7 @@ void DataBlockPool::allocate(size_t block_count, size_t block_size) * \param[in] block_size - Size of the DataBlock required in bytes. * \return - DataBlock from the available pool. */ -boost::shared_ptr DataBlockPool::take(size_t block_size) +std::shared_ptr DataBlockPool::take(size_t block_size) { return DataBlockPool::instance(block_size)->internal_take(block_size); } @@ -50,7 +50,7 @@ boost::shared_ptr DataBlockPool::take(size_t block_size) * * \param[in] block - DataBlock to release. */ -void DataBlockPool::release(boost::shared_ptr block) +void DataBlockPool::release(std::shared_ptr block) { DataBlockPool::instance(block->get_size())->internal_release(block); } @@ -151,9 +151,9 @@ void DataBlockPool::internal_allocate(size_t block_count, size_t block_size) boost::lock_guard lock(mutex_); // Allocate the number of data blocks, each of size block_size - boost::shared_ptr block; + std::shared_ptr block; for (size_t count = 0; count < block_count; count++) { - block = boost::shared_ptr(new DataBlock(block_size)); + block = std::shared_ptr(new DataBlock(block_size)); free_list_.push_front(block); // Record the newly allocated block free_blocks_++; @@ -169,14 +169,14 @@ void DataBlockPool::internal_allocate(size_t block_count, size_t block_size) * \param[in] block_size - Size of the DataBlock required in bytes. * \return - DataBlock from the available pool. */ -boost::shared_ptr DataBlockPool::internal_take(size_t block_size) +std::shared_ptr DataBlockPool::internal_take(size_t block_size) { LOG4CXX_DEBUG_LEVEL(2, logger_, "Requesting DataBlock of " << block_size << " bytes"); // Protect this method boost::lock_guard lock(mutex_); - boost::shared_ptr block; + std::shared_ptr block; if (free_blocks_ == 0) { if (total_blocks_ == 0) { this->internal_allocate(2, block_size); @@ -206,7 +206,7 @@ boost::shared_ptr DataBlockPool::internal_take(size_t block_size) * * \param[in] block - DataBlock to release. */ -void DataBlockPool::internal_release(boost::shared_ptr block) +void DataBlockPool::internal_release(std::shared_ptr block) { LOG4CXX_DEBUG_LEVEL(2, logger_, "Releasing DataBlock [id=" << block->get_index() << "]"); diff --git a/cpp/frameProcessor/src/DummyUDPProcessPlugin.cpp b/cpp/frameProcessor/src/DummyUDPProcessPlugin.cpp index 18288724f..38676010f 100644 --- a/cpp/frameProcessor/src/DummyUDPProcessPlugin.cpp +++ b/cpp/frameProcessor/src/DummyUDPProcessPlugin.cpp @@ -197,7 +197,7 @@ bool DummyUDPProcessPlugin::reset_statistics(void) * * \param[in] frame - Pointer to a Frame object. */ -void DummyUDPProcessPlugin::process_frame(boost::shared_ptr frame) +void DummyUDPProcessPlugin::process_frame(std::shared_ptr frame) { LOG4CXX_TRACE(logger_, "Received a new frame"); @@ -242,8 +242,8 @@ void DummyUDPProcessPlugin::process_frame(boost::shared_ptr frame) LOG4CXX_DEBUG(logger_, "Copying data for frame " << hdr_ptr->frame_number << " to output"); // Construct a new data block object to output the processed frame - boost::shared_ptr output_frame; - output_frame = boost::shared_ptr(new DataBlockFrame(frame_meta, output_image_size)); + std::shared_ptr output_frame; + output_frame = std::shared_ptr(new DataBlockFrame(frame_meta, output_image_size)); // Get a pointer to the data buffer in the output frame void* output_ptr = output_frame->get_data_ptr(); @@ -275,7 +275,7 @@ void DummyUDPProcessPlugin::process_frame(boost::shared_ptr frame) * * \param[in] frame - Pointer to a Frame object. */ -void DummyUDPProcessPlugin::process_lost_packets(boost::shared_ptr& frame) +void DummyUDPProcessPlugin::process_lost_packets(std::shared_ptr& frame) { const DummyUDP::FrameHeader* hdr_ptr = static_cast(frame->get_data_ptr()); diff --git a/cpp/frameProcessor/src/FileWriterPlugin.cpp b/cpp/frameProcessor/src/FileWriterPlugin.cpp index 0c1ca5861..2f6bf0170 100644 --- a/cpp/frameProcessor/src/FileWriterPlugin.cpp +++ b/cpp/frameProcessor/src/FileWriterPlugin.cpp @@ -171,8 +171,8 @@ FileWriterPlugin::FileWriterPlugin() : this->logger_ = Logger::getLogger("FP.FileWriterPlugin"); LOG4CXX_INFO(logger_, "FileWriterPlugin version " << this->get_version_long() << " loaded"); - this->current_acquisition_ = boost::shared_ptr(new Acquisition(hdf5_error_definition_)); - this->next_acquisition_ = boost::shared_ptr(new Acquisition(hdf5_error_definition_)); + this->current_acquisition_ = std::shared_ptr(new Acquisition(hdf5_error_definition_)); + this->next_acquisition_ = std::shared_ptr(new Acquisition(hdf5_error_definition_)); hdf5_error_definition_.create_duration = 0; hdf5_error_definition_.write_duration = 0; hdf5_error_definition_.flush_duration = 0; @@ -213,7 +213,7 @@ FileWriterPlugin::~FileWriterPlugin() * * \param[in] frame - Pointer to the Frame object. */ -void FileWriterPlugin::process_frame(boost::shared_ptr frame) +void FileWriterPlugin::process_frame(std::shared_ptr frame) { // Protect this method boost::mutex::scoped_lock cflock(close_file_mutex_); @@ -274,7 +274,7 @@ void FileWriterPlugin::start_writing() // rank has been changed since the frame count was set next_acquisition_->frames_to_write_ = calc_num_frames(this->next_acquisition_->total_frames_); this->current_acquisition_ = next_acquisition_; - this->next_acquisition_ = boost::shared_ptr(new Acquisition(hdf5_error_definition_)); + this->next_acquisition_ = std::shared_ptr(new Acquisition(hdf5_error_definition_)); // Set up datasets within the current acquisition std::map::iterator iter; @@ -937,7 +937,7 @@ bool FileWriterPlugin::reset_statistics() * The function will set an error if the frame does not match a writing acquisition. * \param[in] frame - Pointer to the Frame object. */ -bool FileWriterPlugin::frame_in_acquisition(boost::shared_ptr frame) +bool FileWriterPlugin::frame_in_acquisition(std::shared_ptr frame) { std::string frame_acquisition_ID = frame->get_meta_data().get_acquisition_ID(); @@ -1018,7 +1018,7 @@ void FileWriterPlugin::stop_acquisition() if (next_acquisition_->total_frames_ > 0 && next_acquisition_->frames_to_write_ == 0) { // We're not expecting any frames, so just clear out the nextAcquisition for the next one and don't // start writing - this->next_acquisition_ = boost::shared_ptr(new Acquisition(hdf5_error_definition_)); + this->next_acquisition_ = std::shared_ptr(new Acquisition(hdf5_error_definition_)); LOG4CXX_INFO( logger_, "FrameProcessor will not receive any frames from this acquisition and so no output file will be " @@ -1123,9 +1123,9 @@ void FileWriterPlugin::execute(const std::string& command, OdinData::IpcMessage& if (next_acquisition_->total_frames_ > 0 && next_acquisition_->frames_to_write_ == 0) { // We're not expecting any frames, so just clear out the nextAcquisition for the next one and don't start // writing - this->next_acquisition_ = boost::shared_ptr(new Acquisition(hdf5_error_definition_)); + this->next_acquisition_ = std::shared_ptr(new Acquisition(hdf5_error_definition_)); if (!writing_) { - this->current_acquisition_ = boost::shared_ptr(new Acquisition(hdf5_error_definition_)); + this->current_acquisition_ = std::shared_ptr(new Acquisition(hdf5_error_definition_)); } LOG4CXX_INFO( logger_, diff --git a/cpp/frameProcessor/src/FrameProcessorApp.cpp b/cpp/frameProcessor/src/FrameProcessorApp.cpp index 1d9e3119e..1c8c8a1f5 100644 --- a/cpp/frameProcessor/src/FrameProcessorApp.cpp +++ b/cpp/frameProcessor/src/FrameProcessorApp.cpp @@ -41,7 +41,7 @@ using namespace rapidjson; using namespace FrameProcessor; -boost::shared_ptr FrameProcessorApp::controller_; +std::shared_ptr FrameProcessorApp::controller_; static bool has_suffix(const std::string& str, const std::string& suffix) { @@ -165,7 +165,7 @@ int FrameProcessorApp::run(void) LOG4CXX_INFO(logger_, "frameProcessor version " << ODIN_DATA_VERSION_STR << " starting up"); // Instantiate a controller - controller_ = boost::shared_ptr(new FrameProcessorController(io_threads_)); + controller_ = std::shared_ptr(new FrameProcessorController(io_threads_)); try { diff --git a/cpp/frameProcessor/src/FrameProcessorController.cpp b/cpp/frameProcessor/src/FrameProcessorController.cpp index 09df13438..e5d456ab0 100644 --- a/cpp/frameProcessor/src/FrameProcessorController.cpp +++ b/cpp/frameProcessor/src/FrameProcessorController.cpp @@ -254,7 +254,7 @@ void FrameProcessorController::handleMetaRxChannel() * * @param frame - Pointer to the frame */ -void FrameProcessorController::callback(boost::shared_ptr frame) +void FrameProcessorController::callback(std::shared_ptr frame) { // If frame is a master frame, or all frames are included (no master frames), increment frame count @@ -292,7 +292,7 @@ void FrameProcessorController::provideStatus(OdinData::IpcMessage& reply, bool m sharedMemController_->status(reply); } - std::map>::iterator iter; + std::map>::iterator iter; if (metadata) { for (iter = plugins_.begin(); iter != plugins_.end(); ++iter) { // Request status metadata for the plugin @@ -343,7 +343,7 @@ void FrameProcessorController::provideVersion(OdinData::IpcMessage& reply) reply.set_param("version/odin-data/full", std::string(ODIN_DATA_VERSION_STR)); // Loop over plugins, list version information from each - std::map>::iterator iter; + std::map>::iterator iter; for (iter = plugins_.begin(); iter != plugins_.end(); ++iter) { iter->second->version(reply); } @@ -380,7 +380,7 @@ void FrameProcessorController::configure(OdinData::IpcMessage& config, OdinData: // Check if we have been asked to reset any errors if (config.has_param("clear_errors")) { - std::map>::iterator iter; + std::map>::iterator iter; for (iter = plugins_.begin(); iter != plugins_.end(); ++iter) { iter->second->clear_errors(); } @@ -497,7 +497,7 @@ void FrameProcessorController::configure(OdinData::IpcMessage& config, OdinData: } // Loop over plugins, checking for configuration messages - std::map>::iterator iter; + std::map>::iterator iter; for (iter = plugins_.begin(); iter != plugins_.end(); ++iter) { if (config.has_param(iter->first)) { OdinData::IpcMessage subConfig( @@ -528,7 +528,7 @@ void FrameProcessorController::requestConfiguration(OdinData::IpcMessage& reply, reply.set_param(fr_cnxn_str + FrameProcessorController::CONFIG_FR_RELEASE, frReleaseEndpoint_); // Loop over plugins and request current configuration from each - std::map>::iterator iter; + std::map>::iterator iter; for (iter = plugins_.begin(); iter != plugins_.end(); ++iter) { iter->second->requestConfiguration(reply); } @@ -559,7 +559,7 @@ void FrameProcessorController::execute(OdinData::IpcMessage& config, OdinData::I LOG4CXX_DEBUG_LEVEL(1, logger_, "Command submitted: " << config.encode()); // Loop over plugins, checking for command messages - std::map>::iterator iter; + std::map>::iterator iter; bool commandPresent = false; for (iter = plugins_.begin(); iter != plugins_.end(); ++iter) { if (config.has_param(iter->first)) { @@ -595,7 +595,7 @@ void FrameProcessorController::requestCommands(OdinData::IpcMessage& reply) LOG4CXX_DEBUG_LEVEL(3, logger_, "Request for supported commands made"); // Loop over plugins and request current supported commands from each - std::map>::iterator iter; + std::map>::iterator iter; std::vector::iterator cmd; for (iter = plugins_.begin(); iter != plugins_.end(); ++iter) { std::vector commands = iter->second->requestCommands(); @@ -619,7 +619,7 @@ void FrameProcessorController::resetStatistics(OdinData::IpcMessage& reply) bool reset_ok = true; // Loop over plugins and call reset statistics on each - std::map>::iterator iter; + std::map>::iterator iter; for (iter = plugins_.begin(); iter != plugins_.end(); ++iter) { iter->second->reset_performance_stats(); reset_ok = iter->second->reset_statistics(); @@ -725,7 +725,7 @@ void FrameProcessorController::loadPlugin(const std::string& index, const std::s if (plugins_.count(index) == 0) { // Dynamically class load the plugin // Add the plugin to the map, indexed by the name - boost::shared_ptr plugin + std::shared_ptr plugin = OdinData::ClassLoader::load_class(name, library); if (plugin) { plugin->set_name(index); @@ -820,7 +820,7 @@ void FrameProcessorController::disconnectPlugin(const std::string& index, const void FrameProcessorController::disconnectAllPlugins() { // Loop over all plugins and remove the callbacks from each one - std::map>::iterator it; + std::map>::iterator it; for (it = plugins_.begin(); it != plugins_.end(); it++) { LOG4CXX_DEBUG_LEVEL(1, logger_, "Disconnecting plugin callbacks for " << it->first); it->second->remove_all_callbacks(); @@ -846,7 +846,7 @@ void FrameProcessorController::shutdown() LOG4CXX_INFO(logger_, "Received shutdown command"); // Stop all plugin worker threads LOG4CXX_DEBUG_LEVEL(1, logger_, "Stopping plugin worker threads"); - std::map>::iterator it; + std::map>::iterator it; for (it = plugins_.begin(); it != plugins_.end(); it++) { it->second->stop(); } @@ -918,7 +918,7 @@ void FrameProcessorController::setupFrameReceiverInterface( sharedMemController_.reset(); } // Create the new shared memory controller and give it the parser and publisher - sharedMemController_ = boost::shared_ptr( + sharedMemController_ = std::shared_ptr( new SharedMemoryController(reactor_, frSubscriberString, frPublisherString) ); frReadyEndpoint_ = frSubscriberString; @@ -1047,7 +1047,7 @@ void FrameProcessorController::runIpcService(void) LOG4CXX_DEBUG_LEVEL(1, logger_, "Running IPC thread service"); // Create the reactor - reactor_ = boost::shared_ptr(new OdinData::IpcReactor()); + reactor_ = std::shared_ptr(new OdinData::IpcReactor()); // Add the tick timer to the reactor int tick_timer_id = reactor_->register_timer(1000, 0, boost::bind(&FrameProcessorController::tickTimer, this)); diff --git a/cpp/frameProcessor/src/FrameProcessorPlugin.cpp b/cpp/frameProcessor/src/FrameProcessorPlugin.cpp index b0cc19ca4..8299d0adf 100644 --- a/cpp/frameProcessor/src/FrameProcessorPlugin.cpp +++ b/cpp/frameProcessor/src/FrameProcessorPlugin.cpp @@ -266,7 +266,7 @@ void FrameProcessorPlugin::version(OdinData::IpcMessage& status) */ void FrameProcessorPlugin::register_callback( const std::string& name, - boost::shared_ptr cb, + std::shared_ptr cb, bool blocking ) { @@ -312,7 +312,7 @@ void FrameProcessorPlugin::register_callback( */ void FrameProcessorPlugin::remove_callback(const std::string& name) { - boost::shared_ptr cb; + std::shared_ptr cb; if (callbacks_.count(name) > 0) { // Get the pointer cb = callbacks_[name]; @@ -336,13 +336,13 @@ void FrameProcessorPlugin::remove_callback(const std::string& name) void FrameProcessorPlugin::remove_all_callbacks() { // Loop over blocking callbacks, removing each one - std::map>::iterator bcbIter; + std::map>::iterator bcbIter; for (bcbIter = blocking_callbacks_.begin(); bcbIter != blocking_callbacks_.end(); ++bcbIter) { LOG4CXX_DEBUG_LEVEL(1, logger_, "Removing callback " << bcbIter->first << " from " << name_); bcbIter->second->confirmRemoval(name_); } // Loop over non-blocking callbacks, removing each one - std::map>::iterator cbIter; + std::map>::iterator cbIter; for (cbIter = callbacks_.begin(); cbIter != callbacks_.end(); ++cbIter) { LOG4CXX_DEBUG_LEVEL(1, logger_, "Removing callback " << cbIter->first << " from " << name_); cbIter->second->confirmRemoval(name_); @@ -359,7 +359,7 @@ void FrameProcessorPlugin::remove_all_callbacks() * * \param[in] frame - Pointer to the frame. */ -void FrameProcessorPlugin::callback(boost::shared_ptr frame) +void FrameProcessorPlugin::callback(std::shared_ptr frame) { // Calls process frame and times how long the process takes struct timespec start_time; @@ -384,8 +384,8 @@ void FrameProcessorPlugin::callback(boost::shared_ptr frame) void FrameProcessorPlugin::notify_end_of_acquisition() { // Create an EndOfAcquisitionFrame object and push it through the processing chain - boost::shared_ptr eoa - = boost::shared_ptr(new EndOfAcquisitionFrame()); + std::shared_ptr eoa + = std::shared_ptr(new EndOfAcquisitionFrame()); this->push(eoa); } @@ -397,18 +397,18 @@ void FrameProcessorPlugin::notify_end_of_acquisition() * * \param[in] frame - Pointer to the frame. */ -void FrameProcessorPlugin::push(boost::shared_ptr frame) +void FrameProcessorPlugin::push(std::shared_ptr frame) { if (!frame->get_end_of_acquisition() && !frame->is_valid()) { throw std::runtime_error("FrameProcessorPlugin::push Invalid frame pushed onto plugin chain"); } // Loop over blocking callbacks, calling each function and waiting for return - std::map>::iterator bcbIter; + std::map>::iterator bcbIter; for (bcbIter = blocking_callbacks_.begin(); bcbIter != blocking_callbacks_.end(); ++bcbIter) { bcbIter->second->callback(frame); } // Loop over non-blocking callbacks, placing frame onto each queue - std::map>::iterator cbIter; + std::map>::iterator cbIter; for (cbIter = callbacks_.begin(); cbIter != callbacks_.end(); ++cbIter) { cbIter->second->getWorkQueue()->add(frame); } @@ -422,7 +422,7 @@ void FrameProcessorPlugin::push(boost::shared_ptr frame) * \param[in] plugin_name - Name of the plugin to send the frame to. * \param[in] frame - Pointer to the frame. */ -void FrameProcessorPlugin::push(const std::string& plugin_name, boost::shared_ptr frame) +void FrameProcessorPlugin::push(const std::string& plugin_name, std::shared_ptr frame) { if (!frame->get_end_of_acquisition() && !frame->is_valid()) { throw std::runtime_error("FrameProcessorPlugin::push Invalid frame pushed onto plugin chain"); diff --git a/cpp/frameProcessor/src/GapFillPlugin.cpp b/cpp/frameProcessor/src/GapFillPlugin.cpp index e0201e704..423021df1 100644 --- a/cpp/frameProcessor/src/GapFillPlugin.cpp +++ b/cpp/frameProcessor/src/GapFillPlugin.cpp @@ -43,13 +43,13 @@ GapFillPlugin::~GapFillPlugin() * * \param[in] frame - pointer to a frame object. */ -void GapFillPlugin::process_frame(boost::shared_ptr frame) +void GapFillPlugin::process_frame(std::shared_ptr frame) { LOG4CXX_TRACE(logger_, "GapFillPlugin Process Frame."); // Call the insert gaps method and push the resulting frame if it is not null if (this->configuration_valid(frame)) { - boost::shared_ptr gap_frame = this->insert_gaps(frame); + std::shared_ptr gap_frame = this->insert_gaps(frame); if (gap_frame) { this->push(gap_frame); } @@ -65,7 +65,7 @@ void GapFillPlugin::process_frame(boost::shared_ptr frame) * \param[in] frame - pointer to a frame object. * \return verified - true if the configuration is valid, false otherwise. */ -bool GapFillPlugin::configuration_valid(boost::shared_ptr frame) +bool GapFillPlugin::configuration_valid(std::shared_ptr frame) { bool verified = false; dimensions_t frame_dimensions = frame->get_meta_data().get_dimensions(); @@ -115,10 +115,10 @@ bool GapFillPlugin::configuration_valid(boost::shared_ptr frame) * \param[in] frame - pointer to a frame object. * \return gap_frame - pointer to a frame that has gaps inserted. */ -boost::shared_ptr GapFillPlugin::insert_gaps(boost::shared_ptr frame) +std::shared_ptr GapFillPlugin::insert_gaps(std::shared_ptr frame) { - boost::shared_ptr gap_frame; + std::shared_ptr gap_frame; dimensions_t frame_dimensions = frame->get_meta_data().get_dimensions(); @@ -181,7 +181,7 @@ boost::shared_ptr GapFillPlugin::insert_gaps(boost::shared_ptr fra FrameProcessor::FrameMetaData frame_meta = frame->get_meta_data_copy(); frame_meta.set_dimensions(img_dims); - gap_frame = boost::shared_ptr(new FrameProcessor::DataBlockFrame( + gap_frame = std::shared_ptr(new FrameProcessor::DataBlockFrame( frame_meta, static_cast(new_image), img_x * img_y * get_size_from_enum(frame->get_meta_data().get_data_type()) )); diff --git a/cpp/frameProcessor/src/IFrameCallback.cpp b/cpp/frameProcessor/src/IFrameCallback.cpp index 0455ad4f7..35615ccfa 100644 --- a/cpp/frameProcessor/src/IFrameCallback.cpp +++ b/cpp/frameProcessor/src/IFrameCallback.cpp @@ -20,7 +20,7 @@ IFrameCallback::IFrameCallback() : working_(false) { // Create the work queue for message offload - queue_ = boost::shared_ptr>>(new WorkQueue>); + queue_ = std::shared_ptr>>(new WorkQueue>); } /** @@ -34,7 +34,7 @@ IFrameCallback::~IFrameCallback() * * \return a pointer to the WorkQueue owned by this IFrameCallback class. */ -boost::shared_ptr>> IFrameCallback::getWorkQueue() +std::shared_ptr>> IFrameCallback::getWorkQueue() { return queue_; } @@ -66,7 +66,7 @@ void IFrameCallback::stop() // Set the run condition flag to false run_ = false; // Now notify the work queue we have finished by adding a null ptr - boost::shared_ptr nullMsg; + std::shared_ptr nullMsg; queue_->add(nullMsg); } } @@ -123,7 +123,7 @@ void IFrameCallback::workerTask() // Check the queue for messages while (run_) { - boost::shared_ptr msg = queue_->remove(); + std::shared_ptr msg = queue_->remove(); if (msg) { // Once we have a message, call the callback this->callback(msg); diff --git a/cpp/frameProcessor/src/KafkaProducerPlugin.cpp b/cpp/frameProcessor/src/KafkaProducerPlugin.cpp index f81668ac6..c74e62802 100644 --- a/cpp/frameProcessor/src/KafkaProducerPlugin.cpp +++ b/cpp/frameProcessor/src/KafkaProducerPlugin.cpp @@ -285,7 +285,7 @@ void KafkaProducerPlugin::configure_partition(int32_t partition) * \param[in] frame - Pointer to a Frame object. * \param[out] nbytes - Reference to the message size in bytes. */ -void* KafkaProducerPlugin::create_message(boost::shared_ptr frame, size_t& nbytes) +void* KafkaProducerPlugin::create_message(std::shared_ptr frame, size_t& nbytes) { // creates header information rapidjson::StringBuffer string_buffer; @@ -353,7 +353,7 @@ void* KafkaProducerPlugin::create_message(boost::shared_ptr frame, size_t * * \param[in] frame - Pointer to a Frame object. */ -void KafkaProducerPlugin::enqueue_frame(boost::shared_ptr frame) +void KafkaProducerPlugin::enqueue_frame(std::shared_ptr frame) { LOG4CXX_TRACE(logger_, "Sending frame to message queue ..."); if (!this->kafka_topic_) { @@ -414,7 +414,7 @@ void KafkaProducerPlugin::on_message_error(const char* error) * * \param[in] frame - Pointer to a Frame object. */ -void KafkaProducerPlugin::process_frame(boost::shared_ptr frame) +void KafkaProducerPlugin::process_frame(std::shared_ptr frame) { LOG4CXX_TRACE(logger_, "Received a new frame..."); if (frame->get_meta_data().get_dataset_name() == this->dataset_name_) { diff --git a/cpp/frameProcessor/src/LiveViewPlugin.cpp b/cpp/frameProcessor/src/LiveViewPlugin.cpp index ebbe9e157..8a32ad91a 100644 --- a/cpp/frameProcessor/src/LiveViewPlugin.cpp +++ b/cpp/frameProcessor/src/LiveViewPlugin.cpp @@ -63,7 +63,7 @@ LiveViewPlugin::~LiveViewPlugin() * * \param[in] frame - pointer to a frame object. */ -void LiveViewPlugin::process_frame(boost::shared_ptr frame) +void LiveViewPlugin::process_frame(std::shared_ptr frame) { /** Static Frame Count will increment each time this method is called, basically as a count of how many frames have * been processed by the plugin*/ @@ -211,7 +211,7 @@ void LiveViewPlugin::requestConfiguration(OdinData::IpcMessage& reply) * \param[in] frame_num - the number of the frame * */ -void LiveViewPlugin::pass_live_frame(boost::shared_ptr frame) +void LiveViewPlugin::pass_live_frame(std::shared_ptr frame) { void* frame_data_copy = (void*)frame->get_image_ptr(); diff --git a/cpp/frameProcessor/src/OffsetAdjustmentPlugin.cpp b/cpp/frameProcessor/src/OffsetAdjustmentPlugin.cpp index 71e768798..00fd7b546 100644 --- a/cpp/frameProcessor/src/OffsetAdjustmentPlugin.cpp +++ b/cpp/frameProcessor/src/OffsetAdjustmentPlugin.cpp @@ -36,7 +36,7 @@ OffsetAdjustmentPlugin::~OffsetAdjustmentPlugin() * * \param[in] frame - Pointer to a Frame object. */ -void OffsetAdjustmentPlugin::process_frame(boost::shared_ptr frame) +void OffsetAdjustmentPlugin::process_frame(std::shared_ptr frame) { frame->meta_data().adjust_frame_offset(offset_adjustment_); this->push(frame); diff --git a/cpp/frameProcessor/src/ParameterAdjustmentPlugin.cpp b/cpp/frameProcessor/src/ParameterAdjustmentPlugin.cpp index 44cc5f402..8c709b885 100644 --- a/cpp/frameProcessor/src/ParameterAdjustmentPlugin.cpp +++ b/cpp/frameProcessor/src/ParameterAdjustmentPlugin.cpp @@ -34,7 +34,7 @@ ParameterAdjustmentPlugin::~ParameterAdjustmentPlugin() * * \param[in] frame - Pointer to a Frame object. */ -void ParameterAdjustmentPlugin::process_frame(boost::shared_ptr frame) +void ParameterAdjustmentPlugin::process_frame(std::shared_ptr frame) { // Apply any parameter adjustments if (parameter_adjustments_.size() != 0) { diff --git a/cpp/frameProcessor/src/RawFileWriterPlugin.cpp b/cpp/frameProcessor/src/RawFileWriterPlugin.cpp index 80f3857dd..13aa7ef8e 100644 --- a/cpp/frameProcessor/src/RawFileWriterPlugin.cpp +++ b/cpp/frameProcessor/src/RawFileWriterPlugin.cpp @@ -25,7 +25,7 @@ RawFileWriterPlugin::RawFileWriterPlugin() : LOG4CXX_TRACE(logger_, "RawFileWriterPlugin constructor."); } -void RawFileWriterPlugin::process_frame(boost::shared_ptr frame) +void RawFileWriterPlugin::process_frame(std::shared_ptr frame) { // Protect this method boost::lock_guard lock(mutex_); diff --git a/cpp/frameProcessor/src/SharedMemoryController.cpp b/cpp/frameProcessor/src/SharedMemoryController.cpp index 4e0b440cb..c73faef55 100644 --- a/cpp/frameProcessor/src/SharedMemoryController.cpp +++ b/cpp/frameProcessor/src/SharedMemoryController.cpp @@ -28,7 +28,7 @@ const std::string SharedMemoryController::SHARED_MEMORY_CONTROLLER_NAME = "share * \param[in] txEndPoint - string name of the publishing endpoint for frame release notifications. */ SharedMemoryController::SharedMemoryController( - boost::shared_ptr reactor, + std::shared_ptr reactor, const std::string& rxEndPoint, const std::string& txEndPoint ) : @@ -111,7 +111,7 @@ void SharedMemoryController::setSharedBufferManager(const std::string& shared_bu } // Create a new shared buffer manager - sbm_ = boost::shared_ptr(new OdinData::SharedBufferManager(shared_buffer_name)); + sbm_ = std::shared_ptr(new OdinData::SharedBufferManager(shared_buffer_name)); // Set configured status to true sharedBufferConfigured_ = true; @@ -187,13 +187,13 @@ void SharedMemoryController::handleRxChannel() frame_number, "raw", FrameProcessor::raw_64bit, "", std::vector() ); - boost::shared_ptr frame; - frame = boost::shared_ptr(new SharedBufferFrame( + std::shared_ptr frame; + frame = std::shared_ptr(new SharedBufferFrame( frame_meta, sbm_->get_buffer_address(bufferID), sbm_->get_buffer_size(), bufferID, &txChannel_ )); // Loop over registered callbacks, placing the frame onto each queue - std::map>::iterator cbIter; + std::map>::iterator cbIter; for (cbIter = callbacks_.begin(); cbIter != callbacks_.end(); ++cbIter) { cbIter->second->getWorkQueue()->add(frame, true); } @@ -245,7 +245,7 @@ void SharedMemoryController::handleRxChannel() * \param[in] name - string index of the callback. * \param[in] cb - IFrameCallback to register for updates. */ -void SharedMemoryController::registerCallback(const std::string& name, boost::shared_ptr cb) +void SharedMemoryController::registerCallback(const std::string& name, std::shared_ptr cb) { // Check if we own the callback already if (callbacks_.count(name) == 0) { @@ -264,7 +264,7 @@ void SharedMemoryController::registerCallback(const std::string& name, boost::sh */ void SharedMemoryController::removeCallback(const std::string& name) { - boost::shared_ptr cb; + std::shared_ptr cb; if (callbacks_.count(name) > 0) { // Get the pointer cb = callbacks_[name]; @@ -292,11 +292,11 @@ void SharedMemoryController::status(OdinData::IpcMessage& status) void SharedMemoryController::injectEOA() { // Create the EOA frame object - boost::shared_ptr eoa - = boost::shared_ptr(new FrameProcessor::EndOfAcquisitionFrame()); + std::shared_ptr eoa + = std::shared_ptr(new FrameProcessor::EndOfAcquisitionFrame()); // Loop over registered callbacks, placing the frame onto each queue - std::map>::iterator cbIter; + std::map>::iterator cbIter; for (cbIter = callbacks_.begin(); cbIter != callbacks_.end(); ++cbIter) { cbIter->second->getWorkQueue()->add(eoa, true); } diff --git a/cpp/frameProcessor/src/SumPlugin.cpp b/cpp/frameProcessor/src/SumPlugin.cpp index 751db2774..f34f29630 100644 --- a/cpp/frameProcessor/src/SumPlugin.cpp +++ b/cpp/frameProcessor/src/SumPlugin.cpp @@ -25,7 +25,7 @@ SumPlugin::~SumPlugin() LOG4CXX_TRACE(logger_, "SumPlugin destructor."); } -template static uint64_t calculate_sum(boost::shared_ptr frame) +template static uint64_t calculate_sum(std::shared_ptr frame) { uint64_t sum_value = 0; const PixelType* data = static_cast(frame->get_image_ptr()); @@ -43,7 +43,7 @@ template static uint64_t calculate_sum(boost::shared_ptr frame) +void SumPlugin::process_frame(std::shared_ptr frame) { LOG4CXX_TRACE(logger_, "Received a new frame..."); switch (frame->get_meta_data().get_data_type()) { diff --git a/cpp/frameProcessor/test/BloscPluginTest.cpp b/cpp/frameProcessor/test/BloscPluginTest.cpp index a493f815c..45a7e66be 100644 --- a/cpp/frameProcessor/test/BloscPluginTest.cpp +++ b/cpp/frameProcessor/test/BloscPluginTest.cpp @@ -37,7 +37,7 @@ class BloscPluginTestFixture { FrameProcessor::FrameMetaData frame_meta( 7, "data", FrameProcessor::raw_16bit, "scan1", img_dims, FrameProcessor::no_compression ); - frame = boost::shared_ptr( + frame = std::shared_ptr( new FrameProcessor::DataBlockFrame(frame_meta, static_cast(img), 24) ); @@ -47,7 +47,7 @@ class BloscPluginTestFixture { tmp_frame_meta.set_frame_number(i); tmp_frame_meta.set_acquisition_ID("scan2"); tmp_frame_meta.set_data_type(FrameProcessor::raw_32bit); - boost::shared_ptr tmp_frame( + std::shared_ptr tmp_frame( new FrameProcessor::DataBlockFrame(tmp_frame_meta, static_cast(img), 24) ); frames.push_back(tmp_frame); @@ -56,8 +56,8 @@ class BloscPluginTestFixture { ~BloscPluginTestFixture() { } - boost::shared_ptr frame; - std::vector> frames; + std::shared_ptr frame; + std::vector> frames; FrameProcessor::BloscPlugin blosc_plugin; FrameProcessor::DatasetDefinition dset_def; }; diff --git a/cpp/frameProcessor/test/FrameProcessorTest.cpp b/cpp/frameProcessor/test/FrameProcessorTest.cpp index aa5d17827..7eaacfa2a 100644 --- a/cpp/frameProcessor/test/FrameProcessorTest.cpp +++ b/cpp/frameProcessor/test/FrameProcessorTest.cpp @@ -64,13 +64,13 @@ BOOST_AUTO_TEST_CASE(DataBlockTest) { char data1[1024]; char data2[2048]; - boost::shared_ptr block1; - boost::shared_ptr block2; + std::shared_ptr block1; + std::shared_ptr block2; int initial_block_index_count = FrameProcessor::DataBlock::get_current_index_count(); - BOOST_CHECK_NO_THROW(block1 = boost::shared_ptr(new FrameProcessor::DataBlock(1024))); + BOOST_CHECK_NO_THROW(block1 = std::shared_ptr(new FrameProcessor::DataBlock(1024))); BOOST_CHECK_EQUAL(block1->get_index(), initial_block_index_count); BOOST_CHECK_EQUAL(block1->get_size(), 1024); - BOOST_CHECK_NO_THROW(block2 = boost::shared_ptr(new FrameProcessor::DataBlock(2048))); + BOOST_CHECK_NO_THROW(block2 = std::shared_ptr(new FrameProcessor::DataBlock(2048))); BOOST_CHECK_EQUAL(block2->get_index(), initial_block_index_count + 1); BOOST_CHECK_EQUAL(block2->get_size(), 2048); memset(data1, 1, 1024); @@ -90,8 +90,8 @@ BOOST_AUTO_TEST_CASE(DataBlockTest) BOOST_AUTO_TEST_CASE(DataBlockPoolTest) { - boost::shared_ptr block1; - boost::shared_ptr block2; + std::shared_ptr block1; + std::shared_ptr block2; // Allocate 100 blocks BOOST_CHECK_NO_THROW(FrameProcessor::DataBlockPool::allocate(100, 1024)); // Check pool statistics @@ -191,7 +191,7 @@ class FileWriterPluginTestFixture { FrameProcessor::FrameMetaData frame_meta( 7, "data", FrameProcessor::raw_16bit, "test", img_dims, FrameProcessor::no_compression ); - frame = boost::shared_ptr( + frame = std::shared_ptr( new FrameProcessor::DataBlockFrame(frame_meta, static_cast(img), 24) ); @@ -199,7 +199,7 @@ class FileWriterPluginTestFixture { FrameProcessor::FrameMetaData loop_frame_meta( i, "data", FrameProcessor::raw_16bit, "test", img_dims, FrameProcessor::no_compression ); - boost::shared_ptr tmp_frame( + std::shared_ptr tmp_frame( new FrameProcessor::DataBlockFrame(loop_frame_meta, static_cast(img), 24) ); img[0] = i; @@ -215,8 +215,8 @@ class FileWriterPluginTestFixture { ~FileWriterPluginTestFixture() { } - boost::shared_ptr frame; - std::vector> frames; + std::shared_ptr frame; + std::vector> frames; FrameProcessor::HDF5ErrorDefinition_t hdf5_error_definition; FrameProcessor::FileWriterPlugin fw; FrameProcessor::DatasetDefinition dset_def; @@ -326,7 +326,7 @@ BOOST_AUTO_TEST_CASE(FileWriterPluginMultipleFramesTest) BOOST_REQUIRE_NO_THROW(hdf5f.create_file("/tmp/blah_multiple.h5", 0, false, 1, 1)); BOOST_REQUIRE_NO_THROW(hdf5f.create_dataset(dset_def, -1, -1)); - std::vector>::iterator it; + std::vector>::iterator it; for (it = frames.begin(); it != frames.end(); ++it) { BOOST_TEST_MESSAGE("Writing frame: " << (*it)->get_frame_number()); BOOST_REQUIRE_NO_THROW(hdf5f.write_frame(*(*it), (*it)->get_frame_number(), 1, durations)); @@ -349,7 +349,7 @@ BOOST_AUTO_TEST_CASE(HDF5FileMultipleReverseTest) BOOST_TEST_MESSAGE("Writing frame: " << frame->get_frame_number()); BOOST_REQUIRE_NO_THROW(hdf5f.write_frame(*frame, frame->get_frame_number(), 1, durations)); - std::vector>::reverse_iterator rit; + std::vector>::reverse_iterator rit; for (rit = frames.rbegin(); rit != frames.rend(); ++rit) { BOOST_TEST_MESSAGE("Writing frame: " << (*rit)->get_frame_number()); BOOST_REQUIRE_NO_THROW(hdf5f.write_frame(*(*rit), (*rit)->get_frame_number(), 1, durations)); @@ -368,7 +368,7 @@ BOOST_AUTO_TEST_CASE(HDF5FileAdjustHugeOffset) hsize_t huge_offset = 100000; - std::vector>::iterator it; + std::vector>::iterator it; for (it = frames.begin(); it != frames.end(); ++it) { size_t frame_no = (*it)->get_frame_number(); // PercivalEmulator::FrameHeader img_header = *((*it)->get_header()); @@ -397,7 +397,7 @@ BOOST_AUTO_TEST_CASE(FileWriterPluginWriteParamTest) BOOST_REQUIRE_NO_THROW(hdf5f.create_dataset(param_dset_def, -1, -1)); - std::vector>::iterator it; + std::vector>::iterator it; uint64_t val = 0; for (it = frames.begin(); it != frames.end(); ++it) { (*it)->meta_data().set_parameter("p1", val); @@ -424,7 +424,7 @@ BOOST_AUTO_TEST_CASE(FileWriterPluginWriteParamWrongTypeTest) BOOST_REQUIRE_NO_THROW(hdf5f.create_dataset(param_dset_def, -1, -1)); - std::vector>::iterator it; + std::vector>::iterator it; for (it = frames.begin(); it != frames.end(); ++it) { uint64_t val = 123; (*it)->meta_data().set_parameter("p1", val); @@ -450,7 +450,7 @@ BOOST_AUTO_TEST_CASE(FileWriterPluginWriteParamNoParamTest) BOOST_REQUIRE_NO_THROW(hdf5f.create_dataset(param_dset_def, -1, -1)); - std::vector>::iterator it; + std::vector>::iterator it; for (it = frames.begin(); it != frames.end(); ++it) { uint64_t val = 123; (*it)->meta_data().set_parameter("p2", val); @@ -665,7 +665,7 @@ BOOST_AUTO_TEST_CASE(AcquisitionGetOffsetInFile) BOOST_AUTO_TEST_CASE(AcquisitionAdjustFrameOffset) { FrameProcessor::Acquisition acquisition(hdf5_error_definition); - boost::shared_ptr frame = get_dummy_frame(); + std::shared_ptr frame = get_dummy_frame(); frame->meta_data().set_frame_offset(0); size_t adjusted_offset = acquisition.adjust_frame_offset(frame); @@ -714,7 +714,7 @@ BOOST_AUTO_TEST_CASE(AcquisitionFrameVerification) acquisition.dataset_defs_["raw"] = dset_def; - boost::shared_ptr frame = get_dummy_frame(); + std::shared_ptr frame = get_dummy_frame(); frame->meta_data().set_compression_type(FrameProcessor::unknown_compression); bool verified = acquisition.check_frame_valid(frame); @@ -734,7 +734,7 @@ BOOST_FIXTURE_TEST_SUITE(ParameterAdjustmentPluginUnitTest, FileWriterPluginTest BOOST_AUTO_TEST_CASE(AddParameter) { FrameProcessor::ParameterAdjustmentPlugin plugin; - boost::shared_ptr frame = get_dummy_frame(); + std::shared_ptr frame = get_dummy_frame(); // Check 0 goes to 0 when no config has been sent, and frame doesn't have parameter frame->set_frame_number(0); @@ -789,7 +789,7 @@ BOOST_AUTO_TEST_CASE(AddParameter) BOOST_AUTO_TEST_CASE(AdjustExistingParameter) { FrameProcessor::ParameterAdjustmentPlugin plugin; - boost::shared_ptr frame = get_dummy_frame(); + std::shared_ptr frame = get_dummy_frame(); uint64_t uid = 0; @@ -841,7 +841,7 @@ BOOST_AUTO_TEST_CASE(AdjustOffset) ); char dummy_data[2] = { 0, 0 }; - boost::shared_ptr frame( + std::shared_ptr frame( new FrameProcessor::DataBlockFrame(frame_meta, static_cast(dummy_data), 2) ); uint64_t offset = 0; @@ -1050,7 +1050,7 @@ BOOST_AUTO_TEST_CASE(SumFrame) 1, "raw", FrameProcessor::raw_16bit, "test", img_dims, FrameProcessor::no_compression ); - boost::shared_ptr frame( + std::shared_ptr frame( new FrameProcessor::DataBlockFrame(frame_meta, static_cast(img), 24) ); @@ -1071,7 +1071,7 @@ BOOST_AUTO_TEST_CASE(SumEmptyFrame) 0, "raw", FrameProcessor::raw_16bit, "test", dims, FrameProcessor::no_compression ); char dummy_data[2] = { 0, 0 }; - boost::shared_ptr frame( + std::shared_ptr frame( new FrameProcessor::DataBlockFrame(frame_meta, static_cast(dummy_data), 2) ); @@ -1085,7 +1085,7 @@ BOOST_AUTO_TEST_CASE(SumNotSupportedDataType) { FrameProcessor::SumPlugin plugin; // check that sum parameter is not set in unsupported data types - boost::shared_ptr frame = get_dummy_frame(); + std::shared_ptr frame = get_dummy_frame(); frame->meta_data().set_data_type(FrameProcessor::raw_float); plugin.process_frame(frame); BOOST_CHECK(!frame->get_meta_data().has_parameter(FrameProcessor::SUM_PARAM_NAME)); diff --git a/cpp/frameProcessor/test/GapFillPluginTest.cpp b/cpp/frameProcessor/test/GapFillPluginTest.cpp index 02567a38d..bc5747330 100644 --- a/cpp/frameProcessor/test/GapFillPluginTest.cpp +++ b/cpp/frameProcessor/test/GapFillPluginTest.cpp @@ -30,7 +30,7 @@ class GapFillPluginTestFixture { 7, "data", FrameProcessor::raw_16bit, "scan1", img_dims, FrameProcessor::no_compression ); - frame = boost::shared_ptr( + frame = std::shared_ptr( new FrameProcessor::DataBlockFrame(frame_meta, static_cast(img), 24) ); @@ -45,7 +45,7 @@ class GapFillPluginTestFixture { 7, "data", FrameProcessor::raw_16bit, "scan1", img_dims, FrameProcessor::no_compression ); - frame_2 = boost::shared_ptr( + frame_2 = std::shared_ptr( new FrameProcessor::DataBlockFrame(frame_2_meta, static_cast(img_2), 32) ); } @@ -54,8 +54,8 @@ class GapFillPluginTestFixture { { } - boost::shared_ptr frame; - boost::shared_ptr frame_2; + std::shared_ptr frame; + std::shared_ptr frame_2; FrameProcessor::GapFillPlugin gap_fill_plugin; }; @@ -122,7 +122,7 @@ BOOST_AUTO_TEST_CASE(GapFillPlugin_process_frame) gap_fill_plugin.configure(cfg, reply); // Push the frame through the plugin to force the gap fill - boost::shared_ptr gap_frame = gap_fill_plugin.insert_gaps(frame); + std::shared_ptr gap_frame = gap_fill_plugin.insert_gaps(frame); unsigned short gap_img[117] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 2, 0, 0, 0, 3, 0, 0, 4, 0, 0, 0, 0, 0, @@ -160,7 +160,7 @@ BOOST_AUTO_TEST_CASE(GapFillPlugin_process_frame) gap_fill_plugin.configure(cfg_2, reply_2); // Push the frame through the plugin to force the gap fill - boost::shared_ptr gap_frame_2 = gap_fill_plugin.insert_gaps(frame_2); + std::shared_ptr gap_frame_2 = gap_fill_plugin.insert_gaps(frame_2); unsigned short gap_img_2[49] = { 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 2, 2, 0, 0, 1, 1, 0, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 0, 4, 4, 0, 0, 3, 3, 0, 4, 4, 0, 0, 0, 0, 0, 0, 0, 0 }; diff --git a/cpp/frameProcessor/test/KafkaProducerPluginTest.cpp b/cpp/frameProcessor/test/KafkaProducerPluginTest.cpp index 283146ed1..3fe0efa59 100644 --- a/cpp/frameProcessor/test/KafkaProducerPluginTest.cpp +++ b/cpp/frameProcessor/test/KafkaProducerPluginTest.cpp @@ -27,7 +27,7 @@ class KafkaProducerPluginTestFixture { FrameProcessor::FrameMetaData frame_meta( 7, "data", FrameProcessor::raw_16bit, "test", test_dims, FrameProcessor::no_compression ); - frame = boost::shared_ptr( + frame = std::shared_ptr( new FrameProcessor::DataBlockFrame(frame_meta, static_cast(test_data), 24) ); frame->meta_data().set_parameter(TEST_PARAM1_NAME, TEST_PARAM1_VALUE); @@ -43,7 +43,7 @@ class KafkaProducerPluginTestFixture { unsigned short test_data[12]; dimensions_t test_dims; FrameProcessor::KafkaProducerPlugin plugin; - boost::shared_ptr frame; + std::shared_ptr frame; }; BOOST_FIXTURE_TEST_SUITE(KafkaProducerPluginUnitTest, KafkaProducerPluginTestFixture); diff --git a/cpp/frameProcessor/test/LiveViewPluginUnitTest.cpp b/cpp/frameProcessor/test/LiveViewPluginUnitTest.cpp index 1f9b86613..ab97c7941 100644 --- a/cpp/frameProcessor/test/LiveViewPluginUnitTest.cpp +++ b/cpp/frameProcessor/test/LiveViewPluginUnitTest.cpp @@ -60,7 +60,7 @@ class LiveViewPluginTestFixture { ); // create test frame - frame = boost::shared_ptr( + frame = std::shared_ptr( new FrameProcessor::DataBlockFrame(frame_meta, static_cast(img_8), 12) ); @@ -69,7 +69,7 @@ class LiveViewPluginTestFixture { ); // create test frame with uint16 data - frame_16 = boost::shared_ptr( + frame_16 = std::shared_ptr( new FrameProcessor::DataBlockFrame(frame_16_meta, static_cast(img_16), 24) ); @@ -81,7 +81,7 @@ class LiveViewPluginTestFixture { ); if (i % 4) tmp_frame_meta.set_parameter("test_tag", 0); - boost::shared_ptr tmp_frame( + std::shared_ptr tmp_frame( new FrameProcessor::DataBlockFrame(tmp_frame_meta, static_cast(img_8), 12) ); frames.push_back(tmp_frame); @@ -113,9 +113,9 @@ class LiveViewPluginTestFixture { global_socket_port++; } - boost::shared_ptr frame; - boost::shared_ptr frame_16; - std::vector> frames; + std::shared_ptr frame; + std::shared_ptr frame_16; + std::vector> frames; uint8_t img_8[12]; uint16_t img_16[12]; diff --git a/cpp/frameProcessor/test/MetaMessageTest.cpp b/cpp/frameProcessor/test/MetaMessageTest.cpp index eb6961a79..1b5625aaf 100644 --- a/cpp/frameProcessor/test/MetaMessageTest.cpp +++ b/cpp/frameProcessor/test/MetaMessageTest.cpp @@ -7,7 +7,7 @@ #include -#include + #include #include @@ -30,7 +30,7 @@ BOOST_FIXTURE_TEST_SUITE(MetaMessageUnitTest, MetaMessageUnitTestFixture); BOOST_AUTO_TEST_CASE(MetaMessageTest) { int v1 = 12345; - boost::shared_ptr mm1( + std::shared_ptr mm1( new FrameProcessor::MetaMessage("name1", "item1", "integer", "header1", sizeof(int), &v1) ); diff --git a/cpp/frameProcessor/test/RawFileWriterPluginTest.cpp b/cpp/frameProcessor/test/RawFileWriterPluginTest.cpp index ab04c557b..4753b29fe 100644 --- a/cpp/frameProcessor/test/RawFileWriterPluginTest.cpp +++ b/cpp/frameProcessor/test/RawFileWriterPluginTest.cpp @@ -16,7 +16,7 @@ class RawFileWriterPluginTestFixture { public: RawFileWriterPluginTestFixture() : img { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 }, - frame { boost::make_shared( + frame { std::make_shared( FrameProcessor::FrameMetaData { 7, "data", FrameProcessor::raw_16bit, "scan1" /*Acq_ID*/, { 3, 4 } }, static_cast(img), 24 @@ -32,7 +32,7 @@ class RawFileWriterPluginTestFixture { } unsigned short img[12]; - boost::shared_ptr frame; + std::shared_ptr frame; FrameProcessor::RawFileWriterPlugin rfw_plugin; }; diff --git a/cpp/frameProcessor/test/TestHelperFunctions.h b/cpp/frameProcessor/test/TestHelperFunctions.h index 23e5e6c27..3bf3d5924 100644 --- a/cpp/frameProcessor/test/TestHelperFunctions.h +++ b/cpp/frameProcessor/test/TestHelperFunctions.h @@ -1,9 +1,9 @@ #ifndef FRAMEPROCESSOR_TESTHELPERFUNCTIONS_H #define FRAMEPROCESSOR_TESTHELPERFUNCTIONS_H -#include -static boost::shared_ptr get_dummy_frame() + +static std::shared_ptr get_dummy_frame() { dimensions_t dims(2, 0); @@ -13,7 +13,7 @@ static boost::shared_ptr get_dummy_frame() char dummy_data[2] = { 0, 0 }; - boost::shared_ptr frame( + std::shared_ptr frame( new FrameProcessor::DataBlockFrame(frame_meta, static_cast(dummy_data), 2) ); diff --git a/cpp/frameReceiver/include/DummyTCPFrameDecoder.h b/cpp/frameReceiver/include/DummyTCPFrameDecoder.h index 7fc66dda5..9dd340edf 100644 --- a/cpp/frameReceiver/include/DummyTCPFrameDecoder.h +++ b/cpp/frameReceiver/include/DummyTCPFrameDecoder.h @@ -1,7 +1,7 @@ #ifndef INCLUDE_DUMMYFRAMEDECODERTCP_H_ #define INCLUDE_DUMMYFRAMEDECODERTCP_H_ -#include + #include #include #include @@ -50,7 +50,7 @@ class DummyTCPFrameDecoder : public FrameDecoderTCP { uint32_t get_packet_number(void) const; private: - boost::shared_ptr frame_buffer_; + std::shared_ptr frame_buffer_; size_t frames_dropped_; size_t frames_sent_; size_t read_so_far_; diff --git a/cpp/frameReceiver/include/DummyUDPFrameDecoder.h b/cpp/frameReceiver/include/DummyUDPFrameDecoder.h index 1aaff4f1e..f9e25647d 100644 --- a/cpp/frameReceiver/include/DummyUDPFrameDecoder.h +++ b/cpp/frameReceiver/include/DummyUDPFrameDecoder.h @@ -8,7 +8,7 @@ #ifndef INCLUDE_DUMMYFRAMEDECODERUDP_H_ #define INCLUDE_DUMMYFRAMEDECODERUDP_H_ -#include + #include #include #include @@ -76,8 +76,8 @@ class DummyUDPFrameDecoder : public FrameDecoderUDP { std::size_t udp_packet_size_; unsigned int status_get_count_; - boost::shared_ptr current_packet_header_; - boost::shared_ptr dropped_frame_buffer_; + std::shared_ptr current_packet_header_; + std::shared_ptr dropped_frame_buffer_; int current_frame_seen_; int current_frame_buffer_id_; diff --git a/cpp/frameReceiver/include/FrameDecoder.h b/cpp/frameReceiver/include/FrameDecoder.h index 74540db9d..138650c40 100644 --- a/cpp/frameReceiver/include/FrameDecoder.h +++ b/cpp/frameReceiver/include/FrameDecoder.h @@ -16,7 +16,7 @@ #include #include -#include + #include using namespace log4cxx; @@ -98,7 +98,7 @@ class FrameDecoder : public OdinData::IVersionedObject { inline FrameDecoder::~FrameDecoder() { }; -typedef boost::shared_ptr FrameDecoderPtr; +typedef std::shared_ptr FrameDecoderPtr; } // namespace FrameReceiver #endif /* INCLUDE_FRAMEDECODER_H_ */ diff --git a/cpp/frameReceiver/include/FrameDecoderTCP.h b/cpp/frameReceiver/include/FrameDecoderTCP.h index ea9951461..454042b6e 100644 --- a/cpp/frameReceiver/include/FrameDecoderTCP.h +++ b/cpp/frameReceiver/include/FrameDecoderTCP.h @@ -16,7 +16,7 @@ #include #include -#include + #include using namespace log4cxx; @@ -43,7 +43,7 @@ class FrameDecoderTCP : public FrameDecoder { inline FrameDecoderTCP::~FrameDecoderTCP() { }; -typedef boost::shared_ptr FrameDecoderTCPPtr; +typedef std::shared_ptr FrameDecoderTCPPtr; } // namespace FrameReceiver #endif /* INCLUDE_FRAMEDECODER_TCP_H_ */ diff --git a/cpp/frameReceiver/include/FrameDecoderUDP.h b/cpp/frameReceiver/include/FrameDecoderUDP.h index 4ac5f97d5..7a72f3dd4 100644 --- a/cpp/frameReceiver/include/FrameDecoderUDP.h +++ b/cpp/frameReceiver/include/FrameDecoderUDP.h @@ -16,7 +16,7 @@ #include #include -#include + #include using namespace log4cxx; @@ -46,7 +46,7 @@ class FrameDecoderUDP : public FrameDecoder { inline FrameDecoderUDP::~FrameDecoderUDP() { }; -typedef boost::shared_ptr FrameDecoderUDPPtr; +typedef std::shared_ptr FrameDecoderUDPPtr; } // namespace FrameReceiver #endif /* INCLUDE_FRAMEDECODER_UDP_H_ */ diff --git a/cpp/frameReceiver/include/FrameDecoderZMQ.h b/cpp/frameReceiver/include/FrameDecoderZMQ.h index f5673e941..571008778 100644 --- a/cpp/frameReceiver/include/FrameDecoderZMQ.h +++ b/cpp/frameReceiver/include/FrameDecoderZMQ.h @@ -16,7 +16,7 @@ #include #include -#include + #include using namespace log4cxx; @@ -40,7 +40,7 @@ class FrameDecoderZMQ : public FrameDecoder { inline FrameDecoderZMQ::~FrameDecoderZMQ() { }; -typedef boost::shared_ptr FrameDecoderZMQPtr; +typedef std::shared_ptr FrameDecoderZMQPtr; } // namespace FrameReceiver #endif /* INCLUDE_FRAMEDECODER_ZMQ_H_ */ diff --git a/cpp/frameReceiver/include/FrameReceiverApp.h b/cpp/frameReceiver/include/FrameReceiverApp.h index baf3da4f0..8f0980193 100644 --- a/cpp/frameReceiver/include/FrameReceiverApp.h +++ b/cpp/frameReceiver/include/FrameReceiverApp.h @@ -33,7 +33,7 @@ class FrameReceiverApp { private: LoggerPtr logger_; //!< Log4CXX logger instance pointer - static boost::shared_ptr controller_; //!< FrameReceiver controller object + static std::shared_ptr controller_; //!< FrameReceiver controller object // Command line options unsigned int io_threads_; //!< Number of IO threads for IPC channels diff --git a/cpp/frameReceiver/include/FrameReceiverController.h b/cpp/frameReceiver/include/FrameReceiverController.h index 068293f2f..7157cdd99 100644 --- a/cpp/frameReceiver/include/FrameReceiverController.h +++ b/cpp/frameReceiver/include/FrameReceiverController.h @@ -17,7 +17,7 @@ #include "zmq/zmq.hpp" #include -#include + #include "ClassLoader.h" #include "FrameDecoder.h" diff --git a/cpp/frameReceiver/include/FrameReceiverRxThread.h b/cpp/frameReceiver/include/FrameReceiverRxThread.h index 04049c234..93fc8873d 100644 --- a/cpp/frameReceiver/include/FrameReceiverRxThread.h +++ b/cpp/frameReceiver/include/FrameReceiverRxThread.h @@ -78,7 +78,7 @@ class FrameReceiverRxThread { FrameDecoderPtr frame_decoder_; //!< Pointer to the frame decoder unsigned int tick_period_ms_; //!< Receiver thread tick timer period - boost::shared_ptr rx_thread_; //!< Pointer to RX thread + std::shared_ptr rx_thread_; //!< Pointer to RX thread IpcChannel rx_channel_; //!< Channel for communication with the main thread std::vector recv_sockets_; //!< List of receive socket file descriptors diff --git a/cpp/frameReceiver/src/FrameReceiverApp.cpp b/cpp/frameReceiver/src/FrameReceiverApp.cpp index b4a565ec5..8ac4df23e 100644 --- a/cpp/frameReceiver/src/FrameReceiverApp.cpp +++ b/cpp/frameReceiver/src/FrameReceiverApp.cpp @@ -32,7 +32,7 @@ namespace po = boost::program_options; using namespace FrameReceiver; -boost::shared_ptr FrameReceiverApp::controller_; +std::shared_ptr FrameReceiverApp::controller_; static bool has_suffix(const std::string& str, const std::string& suffix) { @@ -184,7 +184,7 @@ int FrameReceiverApp::run(void) LOG4CXX_INFO(logger_, "frameReceiver version " << ODIN_DATA_VERSION_STR << " starting up"); // Instantiate a controller - controller_ = boost::shared_ptr(new FrameReceiverController(io_threads_)); + controller_ = std::shared_ptr(new FrameReceiverController(io_threads_)); try { diff --git a/cpp/frameReceiver/src/FrameReceiverRxThread.cpp b/cpp/frameReceiver/src/FrameReceiverRxThread.cpp index 77e7b6887..dc1a0dedc 100644 --- a/cpp/frameReceiver/src/FrameReceiverRxThread.cpp +++ b/cpp/frameReceiver/src/FrameReceiverRxThread.cpp @@ -56,7 +56,7 @@ bool FrameReceiverRxThread::start() bool init_ok = true; rx_thread_ - = boost::shared_ptr(new boost::thread(boost::bind(&FrameReceiverRxThread::run_service, this))); + = std::shared_ptr(new boost::thread(boost::bind(&FrameReceiverRxThread::run_service, this))); // Wait for the thread service to initialise and be running properly, logging an error // an returning false if the thread fails to start within a reasonable time. Also diff --git a/cpp/frameReceiver/src/FrameReceiverTCPRxThread.cpp b/cpp/frameReceiver/src/FrameReceiverTCPRxThread.cpp index 365c54686..84b03956e 100644 --- a/cpp/frameReceiver/src/FrameReceiverTCPRxThread.cpp +++ b/cpp/frameReceiver/src/FrameReceiverTCPRxThread.cpp @@ -22,7 +22,7 @@ FrameReceiverTCPRxThread::FrameReceiverTCPRxThread( LOG4CXX_DEBUG_LEVEL(1, logger_, "FrameReceiverTCPRxThread constructor entered...."); // Store the frame decoder as a TCP type frame decoder - frame_decoder_ = boost::dynamic_pointer_cast(frame_decoder); + frame_decoder_ = std::dynamic_pointer_cast(frame_decoder); } FrameReceiverTCPRxThread::~FrameReceiverTCPRxThread() diff --git a/cpp/frameReceiver/src/FrameReceiverUDPRxThread.cpp b/cpp/frameReceiver/src/FrameReceiverUDPRxThread.cpp index 9115a8c6d..daf977d2f 100644 --- a/cpp/frameReceiver/src/FrameReceiverUDPRxThread.cpp +++ b/cpp/frameReceiver/src/FrameReceiverUDPRxThread.cpp @@ -23,7 +23,7 @@ FrameReceiverUDPRxThread::FrameReceiverUDPRxThread( LOG4CXX_DEBUG_LEVEL(1, logger_, "FrameReceiverUDPRxThread constructor entered...."); // Store the frame decoder as a UDP type frame decoder - frame_decoder_ = boost::dynamic_pointer_cast(frame_decoder); + frame_decoder_ = std::dynamic_pointer_cast(frame_decoder); } FrameReceiverUDPRxThread::~FrameReceiverUDPRxThread() diff --git a/cpp/frameReceiver/src/FrameReceiverZMQRxThread.cpp b/cpp/frameReceiver/src/FrameReceiverZMQRxThread.cpp index a51c89ffc..32cc436fb 100644 --- a/cpp/frameReceiver/src/FrameReceiverZMQRxThread.cpp +++ b/cpp/frameReceiver/src/FrameReceiverZMQRxThread.cpp @@ -22,7 +22,7 @@ FrameReceiverZMQRxThread::FrameReceiverZMQRxThread( LOG4CXX_DEBUG_LEVEL(1, logger_, "FrameReceiverZMQRxThread constructor entered...."); // Store the frame decoder as a UDP type frame decoder - frame_decoder_ = boost::dynamic_pointer_cast(frame_decoder); + frame_decoder_ = std::dynamic_pointer_cast(frame_decoder); } FrameReceiverZMQRxThread::~FrameReceiverZMQRxThread() diff --git a/cpp/frameSimulator/include/DummyUDPFrameSimulatorPlugin.h b/cpp/frameSimulator/include/DummyUDPFrameSimulatorPlugin.h index b6f9cd42e..3eb9616a0 100644 --- a/cpp/frameSimulator/include/DummyUDPFrameSimulatorPlugin.h +++ b/cpp/frameSimulator/include/DummyUDPFrameSimulatorPlugin.h @@ -8,7 +8,7 @@ using namespace log4cxx; using namespace log4cxx::helpers; -#include + #include #include #include diff --git a/cpp/frameSimulator/include/FrameSimulatorPluginUDP.h b/cpp/frameSimulator/include/FrameSimulatorPluginUDP.h index 4b8ca314d..de666a88b 100644 --- a/cpp/frameSimulator/include/FrameSimulatorPluginUDP.h +++ b/cpp/frameSimulator/include/FrameSimulatorPluginUDP.h @@ -9,7 +9,7 @@ using namespace log4cxx; using namespace log4cxx::helpers; -#include + #include "FrameSimulatorPlugin.h" #include "Packet.h" @@ -45,7 +45,7 @@ class FrameSimulatorPluginUDP : public FrameSimulatorPlugin { protected: static void pkt_callback(u_char* user, const pcap_pkthdr* hdr, const u_char* buffer); - int send_packet(const boost::shared_ptr& packet, const int& frame) const; + int send_packet(const std::shared_ptr& packet, const int& frame) const; /** Extract frames from pcap read data **/ virtual void extract_frames(const u_char* data, const int& size) = 0; diff --git a/cpp/frameSimulator/include/UDPFrame.h b/cpp/frameSimulator/include/UDPFrame.h index 89ca93028..6d6fd583b 100644 --- a/cpp/frameSimulator/include/UDPFrame.h +++ b/cpp/frameSimulator/include/UDPFrame.h @@ -2,12 +2,13 @@ #define FRAMESIMULATOR_UDPFRAME_H #include "Packet.h" -#include + #include +#include namespace FrameSimulator { -typedef std::vector> PacketList; +typedef std::vector> PacketList; /** UDPFrame class * diff --git a/cpp/frameSimulator/src/DummyUDPFrameSimulatorPlugin.cpp b/cpp/frameSimulator/src/DummyUDPFrameSimulatorPlugin.cpp index b1db30ef6..ea42aa828 100644 --- a/cpp/frameSimulator/src/DummyUDPFrameSimulatorPlugin.cpp +++ b/cpp/frameSimulator/src/DummyUDPFrameSimulatorPlugin.cpp @@ -186,7 +186,7 @@ void DummyUDPFrameSimulatorPlugin::extract_frames(const u_char* data, const int& } // Allocate a new packet, copy packet data and push into frame - boost::shared_ptr pkt(new Packet()); + std::shared_ptr pkt(new Packet()); unsigned char* datacp = new unsigned char[size]; memcpy(datacp, data, size); pkt->data = datacp; diff --git a/cpp/frameSimulator/src/FrameSimulatorApp.cpp b/cpp/frameSimulator/src/FrameSimulatorApp.cpp index 64c5c04f6..ff9b0245b 100644 --- a/cpp/frameSimulator/src/FrameSimulatorApp.cpp +++ b/cpp/frameSimulator/src/FrameSimulatorApp.cpp @@ -7,7 +7,7 @@ #include "FrameSimulatorPlugin.h" #include -#include + #include #include @@ -45,7 +45,7 @@ static const FrameSimulatorOption * /return shared pointer to an instance of the requested FrameSimulatorPlugin class * the 'detector' argument must match the library name prefix i.e. 'libFrameSimulatorPlugin.so' */ -boost::shared_ptr +std::shared_ptr get_requested_plugin(const po::variables_map& vm, LoggerPtr& logger) { @@ -54,7 +54,7 @@ get_requested_plugin(const po::variables_map& vm, LoggerPtr& logger) boost::filesystem::path libraryPathAndName = boost::filesystem::path(opt_libpath.get_val(vm)) / boost::filesystem::path("lib" + pluginClass + ".so"); - boost::shared_ptr plugin; + std::shared_ptr plugin; try { plugin = OdinData::ClassLoader::load_class( @@ -88,7 +88,7 @@ int parse_arguments( char** argv, po::variables_map& vm, LoggerPtr& logger, - boost::shared_ptr& plugin + std::shared_ptr& plugin ) { @@ -224,7 +224,7 @@ int main(int argc, char* argv[]) { - boost::shared_ptr plugin; + std::shared_ptr plugin; po::variables_map vm; parse_arguments(argc, argv, vm, logger, plugin); diff --git a/cpp/frameSimulator/src/FrameSimulatorPluginUDP.cpp b/cpp/frameSimulator/src/FrameSimulatorPluginUDP.cpp index c7c3998fb..0646bb54c 100644 --- a/cpp/frameSimulator/src/FrameSimulatorPluginUDP.cpp +++ b/cpp/frameSimulator/src/FrameSimulatorPluginUDP.cpp @@ -255,7 +255,7 @@ void FrameSimulatorPluginUDP::replay_frames() * /param[in] frame to which packet belongs * this ensures each frame is sent to the appropriate destination port */ -int FrameSimulatorPluginUDP::send_packet(const boost::shared_ptr& packet, const int& frame) const +int FrameSimulatorPluginUDP::send_packet(const std::shared_ptr& packet, const int& frame) const { if (frame != curr_frame) { curr_port_index = (curr_port_index + 1 < m_addrs.size()) ? curr_port_index + 1 : 0; diff --git a/cpp/test/integrationTest/src/FrameTestApp.cpp b/cpp/test/integrationTest/src/FrameTestApp.cpp index aa6eb086d..ee9f91bd1 100644 --- a/cpp/test/integrationTest/src/FrameTestApp.cpp +++ b/cpp/test/integrationTest/src/FrameTestApp.cpp @@ -9,7 +9,7 @@ #include #include -#include + #include #include From 838051098064fe9ca74a498463a7f2ff6bf1b990 Mon Sep 17 00:00:00 2001 From: Ohisemega Date: Mon, 23 Mar 2026 18:39:22 +0000 Subject: [PATCH 2/6] Convert Concurrency Primitives to C++17 versions Replace boost concurerency headers with C++ standard library headers - . Covert boost::mutex o sd::mutex. Convert boost::lock_guard to std::lock_guard. Convert boost:unique_lock to std::unique_lock. Convert boost::recursive_lock to std::recursive_lock. Convert boost::condition_variable to std::condition_variable. Convert boost::thread to std::thread. Convert boost::scoped_ptr to std::unique_ptr. Fixes #463 --- cpp/common/include/ClassLoader.h | 3 +-- cpp/common/include/IpcReactor.h | 5 ++--- cpp/common/include/SharedBufferManager.h | 3 +-- cpp/common/src/IpcReactor.cpp | 8 +++---- cpp/frameProcessor/include/Acquisition.h | 2 -- cpp/frameProcessor/include/BloscPlugin.h | 2 +- cpp/frameProcessor/include/DataBlockFrame.h | 2 -- cpp/frameProcessor/include/DataBlockPool.h | 5 +---- cpp/frameProcessor/include/FileWriterPlugin.h | 17 +++++++------- .../include/FrameProcessorController.h | 12 +++++----- .../include/FrameProcessorPlugin.h | 3 +-- cpp/frameProcessor/include/HDF5File.h | 5 +---- cpp/frameProcessor/include/IFrameCallback.h | 7 +++--- .../include/KafkaProducerPlugin.h | 2 +- .../include/RawFileWriterPlugin.h | 2 +- .../include/SharedMemoryController.h | 2 -- cpp/frameProcessor/include/WatchdogTimer.h | 6 ++--- cpp/frameProcessor/src/BloscPlugin.cpp | 4 ++-- cpp/frameProcessor/src/DataBlockPool.cpp | 6 ++--- cpp/frameProcessor/src/FileWriterPlugin.cpp | 22 ++++++++++--------- cpp/frameProcessor/src/FrameProcessorApp.cpp | 2 +- .../src/FrameProcessorController.cpp | 2 +- .../src/FrameProcessorPlugin.cpp | 19 ++++++---------- cpp/frameProcessor/src/HDF5File.cpp | 20 ++++++++--------- cpp/frameProcessor/src/IFrameCallback.cpp | 2 +- .../src/KafkaProducerPlugin.cpp | 6 ++--- cpp/frameProcessor/src/LiveViewPlugin.cpp | 2 +- .../src/RawFileWriterPlugin.cpp | 4 ++-- .../test/LiveViewPluginUnitTest.cpp | 2 +- cpp/frameProcessor/test/MetaMessageTest.cpp | 1 - cpp/frameProcessor/test/TestHelperFunctions.h | 2 -- .../include/DummyTCPFrameDecoder.h | 1 - .../include/DummyUDPFrameDecoder.h | 1 - cpp/frameReceiver/include/FrameDecoder.h | 1 - cpp/frameReceiver/include/FrameDecoderTCP.h | 1 - cpp/frameReceiver/include/FrameDecoderUDP.h | 1 - cpp/frameReceiver/include/FrameDecoderZMQ.h | 1 - .../include/FrameReceiverConfig.h | 4 +--- .../include/FrameReceiverController.h | 7 ++---- .../include/FrameReceiverRxThread.h | 3 +-- .../include/FrameReceiverTCPRxThread.h | 1 - .../include/FrameReceiverUDPRxThread.h | 1 - .../include/FrameReceiverZMQRxThread.h | 1 - .../src/FrameReceiverController.cpp | 2 +- .../src/FrameReceiverRxThread.cpp | 3 +-- .../include/DummyUDPFrameSimulatorPlugin.h | 1 - .../include/FrameSimulatorPluginUDP.h | 2 -- cpp/frameSimulator/include/UDPFrame.h | 2 +- cpp/frameSimulator/src/FrameSimulatorApp.cpp | 1 - cpp/test/integrationTest/src/FrameTestApp.cpp | 1 - 50 files changed, 84 insertions(+), 131 deletions(-) diff --git a/cpp/common/include/ClassLoader.h b/cpp/common/include/ClassLoader.h index 266605fc8..258081297 100644 --- a/cpp/common/include/ClassLoader.h +++ b/cpp/common/include/ClassLoader.h @@ -8,13 +8,12 @@ #ifndef ODIN_DATA_CLASSLOADER_H_ #define ODIN_DATA_CLASSLOADER_H_ - #include #include +#include #include #include #include -#include #include #define REGISTER(Base, Class, Name) OdinData::ClassLoader cl { Name, OdinData::maker }; diff --git a/cpp/common/include/IpcReactor.h b/cpp/common/include/IpcReactor.h index fc2b9df5f..702e79bc4 100644 --- a/cpp/common/include/IpcReactor.h +++ b/cpp/common/include/IpcReactor.h @@ -19,6 +19,7 @@ #include #include +#include #include #include @@ -27,8 +28,6 @@ #include #include -#include - #include "IpcChannel.h" #include "OdinDataException.h" @@ -143,7 +142,7 @@ class IpcReactor { ReactorCallback* callbacks_; //!< Ptr to matched array of callbacks std::size_t pollsize_; //!< Number if active items to poll bool needs_rebuild_; //!< Indicates that the poll item list needs rebuilding - boost::mutex mutex_; //!< Mutex used to make some calls in this class thread safe + std::mutex mutex_; //!< Mutex used to make some calls in this class thread safe }; } // namespace OdinData diff --git a/cpp/common/include/SharedBufferManager.h b/cpp/common/include/SharedBufferManager.h index 5d3a1d7bb..220bf1f81 100644 --- a/cpp/common/include/SharedBufferManager.h +++ b/cpp/common/include/SharedBufferManager.h @@ -8,14 +8,13 @@ #ifndef SHAREDBUFFERMANAGER_H_ #define SHAREDBUFFERMANAGER_H_ +#include #include #include -#include #include #include - #include "OdinDataException.h" namespace OdinData { diff --git a/cpp/common/src/IpcReactor.cpp b/cpp/common/src/IpcReactor.cpp index 1a380842c..585e7bec9 100644 --- a/cpp/common/src/IpcReactor.cpp +++ b/cpp/common/src/IpcReactor.cpp @@ -208,7 +208,7 @@ void IpcReactor::remove_socket(int socket_fd) int IpcReactor::register_timer(size_t delay_ms, size_t times, TimerCallback callback) { // Take lock while modifying timers_ - boost::lock_guard lock(mutex_); + std::lock_guard lock(mutex_); // Create a smart pointer to a new timer object std::shared_ptr timer(new IpcReactorTimer(delay_ms, times, callback)); @@ -228,7 +228,7 @@ int IpcReactor::register_timer(size_t delay_ms, size_t times, TimerCallback call void IpcReactor::remove_timer(int timer_id) { // Take lock while modifying timers_ - boost::lock_guard lock(mutex_); + std::lock_guard lock(mutex_); timers_.erase(timer_id); } @@ -244,7 +244,7 @@ void IpcReactor::remove_timer(int timer_id) int IpcReactor::run(void) { int rc = 0; - boost::unique_lock lock(mutex_, boost::defer_lock); + std::unique_lock lock(mutex_, std::defer_lock); // Loop until the terminate flag is set while (!terminate_reactor_) { @@ -387,7 +387,7 @@ void IpcReactor::rebuild_pollitems(void) long IpcReactor::calculate_timeout(void) { // Take lock while accessing timers_ - boost::lock_guard lock(mutex_); + std::lock_guard lock(mutex_); // Calculate shortest timeout up to one hour (!!), looping through // current timers to see which fires first diff --git a/cpp/frameProcessor/include/Acquisition.h b/cpp/frameProcessor/include/Acquisition.h index 246390a45..4ca6f7dd9 100644 --- a/cpp/frameProcessor/include/Acquisition.h +++ b/cpp/frameProcessor/include/Acquisition.h @@ -12,8 +12,6 @@ #include #include - - #include using namespace log4cxx; diff --git a/cpp/frameProcessor/include/BloscPlugin.h b/cpp/frameProcessor/include/BloscPlugin.h index 66059a347..12db13442 100644 --- a/cpp/frameProcessor/include/BloscPlugin.h +++ b/cpp/frameProcessor/include/BloscPlugin.h @@ -65,7 +65,7 @@ class BloscPlugin : public FrameProcessorPlugin { /** Pointer to logger */ LoggerPtr logger_; /** Mutex used to make this class thread safe */ - boost::recursive_mutex mutex_; + std::recursive_mutex mutex_; /** Current acquisition ID */ std::string current_acquisition_; /** Compression settings */ diff --git a/cpp/frameProcessor/include/DataBlockFrame.h b/cpp/frameProcessor/include/DataBlockFrame.h index f6abcecbe..408075c73 100644 --- a/cpp/frameProcessor/include/DataBlockFrame.h +++ b/cpp/frameProcessor/include/DataBlockFrame.h @@ -4,8 +4,6 @@ #include "DataBlock.h" #include "Frame.h" - - namespace FrameProcessor { class DataBlockFrame : public Frame { diff --git a/cpp/frameProcessor/include/DataBlockPool.h b/cpp/frameProcessor/include/DataBlockPool.h index 4bd5040d1..62f7d4fd6 100644 --- a/cpp/frameProcessor/include/DataBlockPool.h +++ b/cpp/frameProcessor/include/DataBlockPool.h @@ -10,9 +10,6 @@ #include - -#include - #include "DataBlock.h" namespace FrameProcessor { @@ -55,7 +52,7 @@ class DataBlockPool { /** Pointer to logger */ log4cxx::LoggerPtr logger_; /** Mutex used to make this class thread safe */ - boost::recursive_mutex mutex_; + std::recursive_mutex mutex_; /** List of currently available DataBlock objects */ std::list> free_list_; /** Map of currently used DataBlock objects, indexed by their unique IDs */ diff --git a/cpp/frameProcessor/include/FileWriterPlugin.h b/cpp/frameProcessor/include/FileWriterPlugin.h index 13288e5b5..2c92a8918 100644 --- a/cpp/frameProcessor/include/FileWriterPlugin.h +++ b/cpp/frameProcessor/include/FileWriterPlugin.h @@ -10,9 +10,6 @@ #include #include - -#include - #include using namespace log4cxx; @@ -21,6 +18,8 @@ using namespace log4cxx; #include "FrameProcessorDefinitions.h" #include "FrameProcessorPlugin.h" +#include + namespace FrameProcessor { class Frame; @@ -177,7 +176,7 @@ class FileWriterPlugin : public FrameProcessorPlugin { /** Pointer to logger */ LoggerPtr logger_; /** Mutex used to make this class thread safe */ - boost::recursive_mutex mutex_; + std::recursive_mutex mutex_; /** Is this plugin writing frames to file? */ bool writing_; /** Number of concurrent file writers executing */ @@ -203,19 +202,19 @@ class FileWriterPlugin : public FrameProcessorPlugin { /** Timeout for closing the file after receiving no data */ size_t timeout_period_; /** Mutex used to make starting the close file timeout thread safe */ - boost::mutex start_timeout_mutex_; + std::mutex start_timeout_mutex_; /** Mutex used to make running the close file timeout thread safe */ - boost::mutex close_file_mutex_; + std::mutex close_file_mutex_; /** Condition variable used to start the close file timeout */ - boost::condition_variable start_condition_; + std::condition_variable start_condition_; /** Condition variable used to run the close file timeout */ - boost::condition_variable timeout_condition_; + std::condition_variable timeout_condition_; /** Close file timeout active switch */ bool timeout_active_; /** Close file timeout thread running */ bool timeout_thread_running_; /** The close file timeout thread */ - boost::thread timeout_thread_; + std::thread timeout_thread_; /** Starting file index (default to 0 index based numbering) */ uint32_t first_file_index_; /** Do we use file numbers in the file name construction. Defaults to true */ diff --git a/cpp/frameProcessor/include/FrameProcessorController.h b/cpp/frameProcessor/include/FrameProcessorController.h index b0cf88502..501ea141c 100644 --- a/cpp/frameProcessor/include/FrameProcessorController.h +++ b/cpp/frameProcessor/include/FrameProcessorController.h @@ -8,7 +8,6 @@ #ifndef TOOLS_FILEWRITER_FrameProcessorController_H_ #define TOOLS_FILEWRITER_FrameProcessorController_H_ - #include #include "ClassLoader.h" @@ -20,6 +19,8 @@ #include "SharedMemoryController.h" #include "logging.h" +#include + namespace FrameProcessor { /** @@ -32,8 +33,7 @@ namespace FrameProcessor { * * The class uses an IpcReactor to manage connections and status updates. */ -class FrameProcessorController : public IFrameCallback, - public std::enable_shared_from_this { +class FrameProcessorController : public IFrameCallback, public std::enable_shared_from_this { public: FrameProcessorController(unsigned int num_io_threads = OdinData::Defaults::default_io_threads); virtual ~FrameProcessorController(); @@ -139,7 +139,7 @@ class FrameProcessorController : public IFrameCallback, /** Map of stored configuration objects */ std::map stored_configs_; /** Condition for exiting this file writing process */ - boost::condition_variable exitCondition_; + std::condition_variable exitCondition_; /** Frames to write before shutting down - 0 to disable shutdown */ unsigned int shutdownFrameCount_; /** Total frames processed */ @@ -147,7 +147,7 @@ class FrameProcessorController : public IFrameCallback, /** Master frame specifier - Frame to include in count of total frames processed */ std::string masterFrame_; /** Mutex used for locking the exitCondition */ - boost::mutex exitMutex_; + std::mutex exitMutex_; /** Used to check for Ipc tick timer termination */ bool runThread_; /** Is the main thread running */ @@ -159,7 +159,7 @@ class FrameProcessorController : public IFrameCallback, /** Have we successfully shutdown */ bool shutdown_; /** Main thread used for control message handling */ - boost::thread ctrlThread_; + std::thread ctrlThread_; /** Store for any messages occurring during thread initialisation */ std::string threadInitMsg_; /** Pointer to the IpcReactor for incoming frame handling */ diff --git a/cpp/frameProcessor/include/FrameProcessorPlugin.h b/cpp/frameProcessor/include/FrameProcessorPlugin.h index 5a5437e77..b94c8ce5c 100644 --- a/cpp/frameProcessor/include/FrameProcessorPlugin.h +++ b/cpp/frameProcessor/include/FrameProcessorPlugin.h @@ -8,7 +8,6 @@ #ifndef TOOLS_FILEWRITER_FrameProcessorPlugin_H_ #define TOOLS_FILEWRITER_FrameProcessorPlugin_H_ -#include #include #include "CallDuration.h" @@ -239,7 +238,7 @@ class FrameProcessorPlugin : public IFrameCallback, public OdinData::IVersionedO /** Warning message array */ std::vector warning_messages_; /** Mutex to make accessing error_messages_ threadsafe */ - boost::mutex mutex_; + std::mutex mutex_; /** process_frame performance stats */ CallDuration process_duration_; }; diff --git a/cpp/frameProcessor/include/HDF5File.h b/cpp/frameProcessor/include/HDF5File.h index 2ccf31e77..ca48bf0dd 100644 --- a/cpp/frameProcessor/include/HDF5File.h +++ b/cpp/frameProcessor/include/HDF5File.h @@ -12,9 +12,6 @@ #include #include - -#include - #include using namespace log4cxx; @@ -134,7 +131,7 @@ class HDF5File { /** Whether datasets use H5S_UNLIMITED as the outermost dimension extent */ bool unlimited_; /** Mutex used to make this class thread safe */ - boost::recursive_mutex mutex_; + std::recursive_mutex mutex_; /* Parameters memspace */ hid_t param_memspace_; /* Map containing time each dataset was last flushed*/ diff --git a/cpp/frameProcessor/include/IFrameCallback.h b/cpp/frameProcessor/include/IFrameCallback.h index 0cdf5b4bf..4443504d0 100644 --- a/cpp/frameProcessor/include/IFrameCallback.h +++ b/cpp/frameProcessor/include/IFrameCallback.h @@ -8,9 +8,6 @@ #ifndef TOOLS_FILEWRITER_IFRAMECALLBACK_H_ #define TOOLS_FILEWRITER_IFRAMECALLBACK_H_ - -#include - #include #include #include @@ -18,6 +15,8 @@ using namespace log4cxx; using namespace log4cxx::helpers; +#include + #include "Frame.h" #include "WorkQueue.h" @@ -53,7 +52,7 @@ class IFrameCallback { /** Pointer to logger */ LoggerPtr logger_; /** Pointer to worker queue thread */ - boost::thread* thread_; + std::thread* thread_; /** Pointer to WorkQueue for Frame object pointers */ std::shared_ptr>> queue_; /** IFrameCallback run flag */ diff --git a/cpp/frameProcessor/include/KafkaProducerPlugin.h b/cpp/frameProcessor/include/KafkaProducerPlugin.h index cf3ecef6c..8e4541542 100644 --- a/cpp/frameProcessor/include/KafkaProducerPlugin.h +++ b/cpp/frameProcessor/include/KafkaProducerPlugin.h @@ -135,7 +135,7 @@ class KafkaProducerPlugin : public FrameProcessorPlugin { int polling_timer_id_; /* For protecting critical region, specially when configuring, we don't * want to poll or produce while the handlers are been destroyed */ - boost::recursive_mutex mutex_; + std::recursive_mutex mutex_; /** True if frame parameters need to be included in the message header */ bool include_parameters_; diff --git a/cpp/frameProcessor/include/RawFileWriterPlugin.h b/cpp/frameProcessor/include/RawFileWriterPlugin.h index 7275967ac..b032e80a9 100644 --- a/cpp/frameProcessor/include/RawFileWriterPlugin.h +++ b/cpp/frameProcessor/include/RawFileWriterPlugin.h @@ -36,7 +36,7 @@ class RawFileWriterPlugin : public FrameProcessorPlugin { private: /** Mutex used to make this class thread safe */ - boost::recursive_mutex mutex_; + std::recursive_mutex mutex_; /** Pointer to logger */ LoggerPtr logger_; /** Flag to enable or disable file writing */ diff --git a/cpp/frameProcessor/include/SharedMemoryController.h b/cpp/frameProcessor/include/SharedMemoryController.h index 67a6e7e41..e9cfbc7f9 100644 --- a/cpp/frameProcessor/include/SharedMemoryController.h +++ b/cpp/frameProcessor/include/SharedMemoryController.h @@ -15,8 +15,6 @@ using namespace log4cxx; using namespace log4cxx::helpers; -#include "boost/date_time/posix_time/posix_time.hpp" - #include "IFrameCallback.h" #include "IpcChannel.h" #include "IpcMessage.h" diff --git a/cpp/frameProcessor/include/WatchdogTimer.h b/cpp/frameProcessor/include/WatchdogTimer.h index a123dead3..e499dab72 100644 --- a/cpp/frameProcessor/include/WatchdogTimer.h +++ b/cpp/frameProcessor/include/WatchdogTimer.h @@ -9,9 +9,7 @@ #define FRAMEPROCESSOR_SRC_WATCHDOGTIMER_H_ #include - - -#include +#include #include #include @@ -39,7 +37,7 @@ class WatchdogTimer { /* Store for start time of watchdog */ struct timespec start_time_; /* Timer watchdog thread */ - boost::thread worker_thread_; + std::thread worker_thread_; /** Flag to control start up timings of main thread and worker thread */ volatile bool worker_thread_running_; /** IpcReactor to use as a simple timer controller */ diff --git a/cpp/frameProcessor/src/BloscPlugin.cpp b/cpp/frameProcessor/src/BloscPlugin.cpp index e274b6f0b..5366308ed 100644 --- a/cpp/frameProcessor/src/BloscPlugin.cpp +++ b/cpp/frameProcessor/src/BloscPlugin.cpp @@ -233,7 +233,7 @@ void* BloscPlugin::get_buffer(size_t nbytes) void BloscPlugin::process_frame(std::shared_ptr src_frame) { // Protect this method - boost::lock_guard lock(mutex_); + std::lock_guard lock(mutex_); LOG4CXX_DEBUG_LEVEL(3, logger_, "Received a new frame..."); @@ -257,7 +257,7 @@ void BloscPlugin::process_frame(std::shared_ptr src_frame) void BloscPlugin::configure(OdinData::IpcMessage& config, OdinData::IpcMessage& reply) { // Protect this method - boost::lock_guard lock(mutex_); + std::lock_guard lock(mutex_); LOG4CXX_INFO(logger_, config.encode()); diff --git a/cpp/frameProcessor/src/DataBlockPool.cpp b/cpp/frameProcessor/src/DataBlockPool.cpp index 005a01fd3..e44c576e0 100644 --- a/cpp/frameProcessor/src/DataBlockPool.cpp +++ b/cpp/frameProcessor/src/DataBlockPool.cpp @@ -148,7 +148,7 @@ void DataBlockPool::internal_allocate(size_t block_count, size_t block_size) ); // Protect this method - boost::lock_guard lock(mutex_); + std::lock_guard lock(mutex_); // Allocate the number of data blocks, each of size block_size std::shared_ptr block; @@ -174,7 +174,7 @@ std::shared_ptr DataBlockPool::internal_take(size_t block_size) LOG4CXX_DEBUG_LEVEL(2, logger_, "Requesting DataBlock of " << block_size << " bytes"); // Protect this method - boost::lock_guard lock(mutex_); + std::lock_guard lock(mutex_); std::shared_ptr block; if (free_blocks_ == 0) { @@ -211,7 +211,7 @@ void DataBlockPool::internal_release(std::shared_ptr block) LOG4CXX_DEBUG_LEVEL(2, logger_, "Releasing DataBlock [id=" << block->get_index() << "]"); // Protect this method - boost::lock_guard lock(mutex_); + std::lock_guard lock(mutex_); if (used_map_.count(block->get_index()) > 0) { used_map_.erase(block->get_index()); diff --git a/cpp/frameProcessor/src/FileWriterPlugin.cpp b/cpp/frameProcessor/src/FileWriterPlugin.cpp index 2f6bf0170..17384a41f 100644 --- a/cpp/frameProcessor/src/FileWriterPlugin.cpp +++ b/cpp/frameProcessor/src/FileWriterPlugin.cpp @@ -189,11 +189,11 @@ FileWriterPlugin::~FileWriterPlugin() timeout_active_ = false; // Notify the close timeout thread to clean up resources { - boost::mutex::scoped_lock lock2(close_file_mutex_); + std::scoped_lock lock2(close_file_mutex_); timeout_condition_.notify_all(); } { - boost::mutex::scoped_lock lock(start_timeout_mutex_); + std::scoped_lock lock(start_timeout_mutex_); start_condition_.notify_all(); } timeout_thread_.join(); @@ -216,8 +216,8 @@ FileWriterPlugin::~FileWriterPlugin() void FileWriterPlugin::process_frame(std::shared_ptr frame) { // Protect this method - boost::mutex::scoped_lock cflock(close_file_mutex_); - boost::lock_guard lock(mutex_); + std::scoped_lock cflock(close_file_mutex_); + std::lock_guard lock(mutex_); // check it matches the current (or next) acquisition. // frames that don't match are dropped / ignored. @@ -322,7 +322,7 @@ void FileWriterPlugin::stop_writing() void FileWriterPlugin::configure(OdinData::IpcMessage& config, OdinData::IpcMessage& reply) { // Protect this method - boost::lock_guard lock(mutex_); + std::lock_guard lock(mutex_); LOG4CXX_INFO(logger_, config.encode()); @@ -1041,7 +1041,7 @@ void FileWriterPlugin::start_close_file_timeout() { if (timeout_active_ == false) { LOG4CXX_INFO(logger_, "Starting close file timeout"); - boost::mutex::scoped_lock lock(start_timeout_mutex_); + std::scoped_lock lock(start_timeout_mutex_); start_condition_.notify_all(); } else { LOG4CXX_INFO(logger_, "Close file timeout already active"); @@ -1060,17 +1060,19 @@ void FileWriterPlugin::start_close_file_timeout() void FileWriterPlugin::run_close_file_timeout() { OdinData::configure_logging_mdc(OdinData::app_path.c_str()); - boost::mutex::scoped_lock startLock(start_timeout_mutex_); + std::unique_lock startLock(start_timeout_mutex_); while (timeout_thread_running_) { start_condition_.wait(startLock); if (timeout_thread_running_) { timeout_active_ = true; - boost::mutex::scoped_lock lock(close_file_mutex_); + std::unique_lock lock(close_file_mutex_); while (timeout_active_) { - if (!timeout_condition_.timed_wait(lock, boost::posix_time::milliseconds(timeout_period_))) { + if (!timeout_condition_.wait_for(lock, std::chrono::milliseconds(timeout_period_), [this] { + return timeout_active_ == false; + })) { // Timeout LOG4CXX_DEBUG_LEVEL(1, logger_, "Close file Timeout timed out"); - boost::lock_guard lock(mutex_); + std::lock_guard lock(mutex_); if (writing_ && timeout_active_) { set_error("Timed out waiting for frames, stopping writing"); stop_acquisition(); diff --git a/cpp/frameProcessor/src/FrameProcessorApp.cpp b/cpp/frameProcessor/src/FrameProcessorApp.cpp index 1c8c8a1f5..446fafd7c 100644 --- a/cpp/frameProcessor/src/FrameProcessorApp.cpp +++ b/cpp/frameProcessor/src/FrameProcessorApp.cpp @@ -5,6 +5,7 @@ * Author: Alan Greer */ +#include #include #include #include @@ -20,7 +21,6 @@ using namespace std; using namespace log4cxx; using namespace log4cxx::helpers; -#include "boost/date_time/posix_time/posix_time.hpp" #include #include #include diff --git a/cpp/frameProcessor/src/FrameProcessorController.cpp b/cpp/frameProcessor/src/FrameProcessorController.cpp index e5d456ab0..5ac2956a5 100644 --- a/cpp/frameProcessor/src/FrameProcessorController.cpp +++ b/cpp/frameProcessor/src/FrameProcessorController.cpp @@ -885,7 +885,7 @@ void FrameProcessorController::shutdown() */ void FrameProcessorController::waitForShutdown() { - boost::unique_lock lock(exitMutex_); + std::unique_lock lock(exitMutex_); exitCondition_.wait(lock); } diff --git a/cpp/frameProcessor/src/FrameProcessorPlugin.cpp b/cpp/frameProcessor/src/FrameProcessorPlugin.cpp index 8299d0adf..9df9d5b23 100644 --- a/cpp/frameProcessor/src/FrameProcessorPlugin.cpp +++ b/cpp/frameProcessor/src/FrameProcessorPlugin.cpp @@ -61,7 +61,7 @@ std::string FrameProcessorPlugin::get_name() const void FrameProcessorPlugin::set_error(const std::string& msg) { // Take lock to access error_messages_ - boost::lock_guard lock(mutex_); + std::lock_guard lock(mutex_); // Loop over error messages, if this is a new message then add it std::vector::iterator iter; @@ -86,7 +86,7 @@ void FrameProcessorPlugin::set_error(const std::string& msg) void FrameProcessorPlugin::set_warning(const std::string& msg) { // Take lock to access warning_messages_ - boost::lock_guard lock(mutex_); + std::lock_guard lock(mutex_); // Loop over warning messages, if this is a new message then add it std::vector::iterator iter; @@ -107,7 +107,7 @@ void FrameProcessorPlugin::set_warning(const std::string& msg) void FrameProcessorPlugin::clear_errors() { // Take lock to access error_messages_ - boost::lock_guard lock(mutex_); + std::lock_guard lock(mutex_); error_messages_.clear(); warning_messages_.clear(); } @@ -128,7 +128,7 @@ bool FrameProcessorPlugin::reset_statistics() std::vector FrameProcessorPlugin::get_errors() { // Take lock to access error_messages_ - boost::lock_guard lock(mutex_); + std::lock_guard lock(mutex_); return error_messages_; } @@ -138,7 +138,7 @@ std::vector FrameProcessorPlugin::get_errors() std::vector FrameProcessorPlugin::get_warnings() { // Take lock to access warning_messages_ - boost::lock_guard lock(mutex_); + std::lock_guard lock(mutex_); return warning_messages_; } @@ -264,11 +264,7 @@ void FrameProcessorPlugin::version(OdinData::IpcMessage& status) * \param[in] cb - Pointer to an IFrameCallback interface (plugin). * \param[in] blocking - Whether call should block. */ -void FrameProcessorPlugin::register_callback( - const std::string& name, - std::shared_ptr cb, - bool blocking -) +void FrameProcessorPlugin::register_callback(const std::string& name, std::shared_ptr cb, bool blocking) { if (blocking) { if (callbacks_.count(name) != 0) { @@ -384,8 +380,7 @@ void FrameProcessorPlugin::callback(std::shared_ptr frame) void FrameProcessorPlugin::notify_end_of_acquisition() { // Create an EndOfAcquisitionFrame object and push it through the processing chain - std::shared_ptr eoa - = std::shared_ptr(new EndOfAcquisitionFrame()); + std::shared_ptr eoa = std::shared_ptr(new EndOfAcquisitionFrame()); this->push(eoa); } diff --git a/cpp/frameProcessor/src/HDF5File.cpp b/cpp/frameProcessor/src/HDF5File.cpp index 734863e47..c7379a7fd 100644 --- a/cpp/frameProcessor/src/HDF5File.cpp +++ b/cpp/frameProcessor/src/HDF5File.cpp @@ -104,7 +104,7 @@ void HDF5File::handle_h5_error( void HDF5File::hdf_error_handler(unsigned n, const H5E_error2_t* err_desc) { // Protect this method - boost::lock_guard lock(mutex_); + std::lock_guard lock(mutex_); hdf5_error_flag_ = true; hdf5_errors_.push_back(*err_desc); } @@ -112,7 +112,7 @@ void HDF5File::hdf_error_handler(unsigned n, const H5E_error2_t* err_desc) void HDF5File::clear_hdf_errors() { // Protect this method - boost::lock_guard lock(mutex_); + std::lock_guard lock(mutex_); // Empty the error array hdf5_errors_.clear(); @@ -140,7 +140,7 @@ size_t HDF5File::create_file( ) { // Protect this method - boost::lock_guard lock(mutex_); + std::lock_guard lock(mutex_); hid_t fapl; // File access property list hid_t fcpl; filename_ = filename; @@ -209,7 +209,7 @@ size_t HDF5File::create_file( size_t HDF5File::close_file() { // Protect this method - boost::lock_guard lock(mutex_); + std::lock_guard lock(mutex_); size_t close_duration = 0; if (this->hdf5_file_id_ >= 0) { @@ -248,7 +248,7 @@ void HDF5File::write_frame( ) { // Protect this method - boost::lock_guard lock(mutex_); + std::lock_guard lock(mutex_); LOG4CXX_TRACE( logger_, @@ -314,7 +314,7 @@ void HDF5File::write_frame( void HDF5File::write_parameter(const Frame& frame, DatasetDefinition dataset_definition, hsize_t frame_offset) { // Protect this method - boost::lock_guard lock(mutex_); + std::lock_guard lock(mutex_); void* data_ptr; size_t size = 0; @@ -426,7 +426,7 @@ void HDF5File::write_parameter(const Frame& frame, DatasetDefinition dataset_def void HDF5File::create_dataset(const DatasetDefinition& definition, int low_index, int high_index) { // Protect this method - boost::lock_guard lock(mutex_); + std::lock_guard lock(mutex_); // Handles all at the top so we can remember to close them hid_t dataspace = 0; hid_t prop = 0; @@ -626,7 +626,7 @@ void HDF5File::extend_dataset(HDF5Dataset_t& dset, size_t frame_no) size_t HDF5File::get_dataset_frames(const std::string& dset_name) { // Protect this method - boost::lock_guard lock(mutex_); + std::lock_guard lock(mutex_); return this->get_hdf5_dataset(dset_name).actual_dataset_size_; } @@ -638,7 +638,7 @@ size_t HDF5File::get_dataset_frames(const std::string& dset_name) size_t HDF5File::get_dataset_max_size(const std::string& dset_name) { // Protect this method - boost::lock_guard lock(mutex_); + std::lock_guard lock(mutex_); if (unlimited_) { return 0; } else { @@ -689,7 +689,7 @@ hid_t HDF5File::datatype_to_hdf_type(DataType data_type) const void HDF5File::start_swmr() { // Protect this method - boost::lock_guard lock(mutex_); + std::lock_guard lock(mutex_); #if H5_VERSION_GE(1, 9, 178) if (!use_earliest_version_) { ensure_h5_result(H5Fstart_swmr_write(this->hdf5_file_id_), "Failed to enable SWMR writing"); diff --git a/cpp/frameProcessor/src/IFrameCallback.cpp b/cpp/frameProcessor/src/IFrameCallback.cpp index 35615ccfa..195f227af 100644 --- a/cpp/frameProcessor/src/IFrameCallback.cpp +++ b/cpp/frameProcessor/src/IFrameCallback.cpp @@ -50,7 +50,7 @@ void IFrameCallback::start() // Set the run condition to true run_ = true; // Now start the worker thread to monitor the queue - thread_ = new boost::thread(&IFrameCallback::workerTask, this); + thread_ = new std::thread(&IFrameCallback::workerTask, this); } } diff --git a/cpp/frameProcessor/src/KafkaProducerPlugin.cpp b/cpp/frameProcessor/src/KafkaProducerPlugin.cpp index c74e62802..3d10f0aef 100644 --- a/cpp/frameProcessor/src/KafkaProducerPlugin.cpp +++ b/cpp/frameProcessor/src/KafkaProducerPlugin.cpp @@ -90,7 +90,7 @@ KafkaProducerPlugin::~KafkaProducerPlugin() */ void KafkaProducerPlugin::configure(OdinData::IpcMessage& config, OdinData::IpcMessage& reply) { - boost::lock_guard lock(mutex_); + std::lock_guard lock(mutex_); if (config.has_param(CONFIG_SERVERS)) { destroy_kafka(); configure_kafka_servers(config.get_param(CONFIG_SERVERS)); @@ -179,7 +179,7 @@ void KafkaProducerPlugin::destroy_kafka() void KafkaProducerPlugin::poll_delivery_message_report_queue() { if (kafka_producer_ != NULL) { - boost::lock_guard lock(mutex_); + std::lock_guard lock(mutex_); rd_kafka_poll(kafka_producer_, 0); } } @@ -361,7 +361,7 @@ void KafkaProducerPlugin::enqueue_frame(std::shared_ptr frame) return; } // This lock avoids configuring/destroying/enqueuing at the same time - boost::lock_guard lock(mutex_); + std::lock_guard lock(mutex_); char* buf; size_t len; // This buffer is freed by kafka (when there are no errors) diff --git a/cpp/frameProcessor/src/LiveViewPlugin.cpp b/cpp/frameProcessor/src/LiveViewPlugin.cpp index 8a32ad91a..0a074042d 100644 --- a/cpp/frameProcessor/src/LiveViewPlugin.cpp +++ b/cpp/frameProcessor/src/LiveViewPlugin.cpp @@ -256,7 +256,7 @@ void LiveViewPlugin::pass_live_frame(std::shared_ptr frame) size_t dim_size = dim.size(); for (size_t i = 0; i < dim_size; i++) { - std::string dimString = boost::to_string(dim[i]); + std::string dimString = std::to_string(dim[i]); rapidjson::Value dimStringVal(dimString.c_str(), document.GetAllocator()); valueDims.PushBack(dimStringVal, document.GetAllocator()); } diff --git a/cpp/frameProcessor/src/RawFileWriterPlugin.cpp b/cpp/frameProcessor/src/RawFileWriterPlugin.cpp index 13aa7ef8e..9c74cf95e 100644 --- a/cpp/frameProcessor/src/RawFileWriterPlugin.cpp +++ b/cpp/frameProcessor/src/RawFileWriterPlugin.cpp @@ -28,7 +28,7 @@ RawFileWriterPlugin::RawFileWriterPlugin() : void RawFileWriterPlugin::process_frame(std::shared_ptr frame) { // Protect this method - boost::lock_guard lock(mutex_); + std::lock_guard lock(mutex_); this->push(frame); if (!this->enabled_) { return; @@ -68,7 +68,7 @@ void RawFileWriterPlugin::process_frame(std::shared_ptr frame) void RawFileWriterPlugin::configure(OdinData::IpcMessage& config, OdinData::IpcMessage& reply) { // Protect this method - boost::lock_guard lock(mutex_); + std::lock_guard lock(mutex_); if (config.has_param(RawFileWriterPlugin::CONFIG_ENABLED)) { this->enabled_ = config.get_param(RawFileWriterPlugin::CONFIG_ENABLED); } diff --git a/cpp/frameProcessor/test/LiveViewPluginUnitTest.cpp b/cpp/frameProcessor/test/LiveViewPluginUnitTest.cpp index ab97c7941..20e69d444 100644 --- a/cpp/frameProcessor/test/LiveViewPluginUnitTest.cpp +++ b/cpp/frameProcessor/test/LiveViewPluginUnitTest.cpp @@ -27,7 +27,7 @@ class LiveViewPluginTestFixture { // set up the recieve sockets so we can read data from the plugin's live output. recv_socket.subscribe(""); recv_socket_other.subscribe(""); - std::string addr = global_socket_addr + boost::to_string(global_socket_port); + std::string addr = global_socket_addr + std::to_string(global_socket_port); BOOST_TEST_MESSAGE("Address: " + addr); recv_socket.connect(addr); recv_socket_other.connect("tcp://127.0.0.1:5050"); diff --git a/cpp/frameProcessor/test/MetaMessageTest.cpp b/cpp/frameProcessor/test/MetaMessageTest.cpp index 1b5625aaf..0572758c1 100644 --- a/cpp/frameProcessor/test/MetaMessageTest.cpp +++ b/cpp/frameProcessor/test/MetaMessageTest.cpp @@ -7,7 +7,6 @@ #include - #include #include diff --git a/cpp/frameProcessor/test/TestHelperFunctions.h b/cpp/frameProcessor/test/TestHelperFunctions.h index 3bf3d5924..5be97f885 100644 --- a/cpp/frameProcessor/test/TestHelperFunctions.h +++ b/cpp/frameProcessor/test/TestHelperFunctions.h @@ -1,8 +1,6 @@ #ifndef FRAMEPROCESSOR_TESTHELPERFUNCTIONS_H #define FRAMEPROCESSOR_TESTHELPERFUNCTIONS_H - - static std::shared_ptr get_dummy_frame() { diff --git a/cpp/frameReceiver/include/DummyTCPFrameDecoder.h b/cpp/frameReceiver/include/DummyTCPFrameDecoder.h index 9dd340edf..8da9a16dc 100644 --- a/cpp/frameReceiver/include/DummyTCPFrameDecoder.h +++ b/cpp/frameReceiver/include/DummyTCPFrameDecoder.h @@ -1,7 +1,6 @@ #ifndef INCLUDE_DUMMYFRAMEDECODERTCP_H_ #define INCLUDE_DUMMYFRAMEDECODERTCP_H_ - #include #include #include diff --git a/cpp/frameReceiver/include/DummyUDPFrameDecoder.h b/cpp/frameReceiver/include/DummyUDPFrameDecoder.h index f9e25647d..bfc36994f 100644 --- a/cpp/frameReceiver/include/DummyUDPFrameDecoder.h +++ b/cpp/frameReceiver/include/DummyUDPFrameDecoder.h @@ -8,7 +8,6 @@ #ifndef INCLUDE_DUMMYFRAMEDECODERUDP_H_ #define INCLUDE_DUMMYFRAMEDECODERUDP_H_ - #include #include #include diff --git a/cpp/frameReceiver/include/FrameDecoder.h b/cpp/frameReceiver/include/FrameDecoder.h index 138650c40..37676c43c 100644 --- a/cpp/frameReceiver/include/FrameDecoder.h +++ b/cpp/frameReceiver/include/FrameDecoder.h @@ -17,7 +17,6 @@ #include - #include using namespace log4cxx; using namespace log4cxx::helpers; diff --git a/cpp/frameReceiver/include/FrameDecoderTCP.h b/cpp/frameReceiver/include/FrameDecoderTCP.h index 454042b6e..15a9ad8d9 100644 --- a/cpp/frameReceiver/include/FrameDecoderTCP.h +++ b/cpp/frameReceiver/include/FrameDecoderTCP.h @@ -17,7 +17,6 @@ #include - #include using namespace log4cxx; using namespace log4cxx::helpers; diff --git a/cpp/frameReceiver/include/FrameDecoderUDP.h b/cpp/frameReceiver/include/FrameDecoderUDP.h index 7a72f3dd4..bab0c5f88 100644 --- a/cpp/frameReceiver/include/FrameDecoderUDP.h +++ b/cpp/frameReceiver/include/FrameDecoderUDP.h @@ -17,7 +17,6 @@ #include - #include using namespace log4cxx; using namespace log4cxx::helpers; diff --git a/cpp/frameReceiver/include/FrameDecoderZMQ.h b/cpp/frameReceiver/include/FrameDecoderZMQ.h index 571008778..c4aa46565 100644 --- a/cpp/frameReceiver/include/FrameDecoderZMQ.h +++ b/cpp/frameReceiver/include/FrameDecoderZMQ.h @@ -17,7 +17,6 @@ #include - #include using namespace log4cxx; using namespace log4cxx::helpers; diff --git a/cpp/frameReceiver/include/FrameReceiverConfig.h b/cpp/frameReceiver/include/FrameReceiverConfig.h index 7287c62a9..9345a92bb 100644 --- a/cpp/frameReceiver/include/FrameReceiverConfig.h +++ b/cpp/frameReceiver/include/FrameReceiverConfig.h @@ -16,8 +16,6 @@ #include #include -#include - #include "FrameReceiverDefaults.h" #include "IpcMessage.h" #include "OdinDataDefaults.h" @@ -176,7 +174,7 @@ class FrameReceiverConfig { std::size_t max_buffer_mem_; //!< Amount of shared buffer memory to allocate for frame buffers std::string decoder_path_; //!< Path to decoder library std::string decoder_type_; //!< Decoder type receiving data for - drives frame size - boost::scoped_ptr decoder_config_; //!< Decoder configuration data as IpcMessage + std::unique_ptr decoder_config_; //!< Decoder configuration data as IpcMessage Defaults::RxType rx_type_; //!< Type of receiver interface (UDP or ZMQ) std::vector rx_ports_; //!< Port(s) to receive frame data on std::string rx_address_; //!< IP address to receive frame data on diff --git a/cpp/frameReceiver/include/FrameReceiverController.h b/cpp/frameReceiver/include/FrameReceiverController.h index 7157cdd99..6c425fec4 100644 --- a/cpp/frameReceiver/include/FrameReceiverController.h +++ b/cpp/frameReceiver/include/FrameReceiverController.h @@ -16,9 +16,6 @@ #include "zmq/zmq.hpp" -#include - - #include "ClassLoader.h" #include "FrameDecoder.h" #include "FrameReceiverConfig.h" @@ -89,7 +86,7 @@ class FrameReceiverController { #endif log4cxx::LoggerPtr logger_; //!< Pointer to the logging facility - boost::scoped_ptr rx_thread_; //!< Receiver thread object + std::unique_ptr rx_thread_; //!< Receiver thread object FrameDecoderPtr frame_decoder_; //!< Frame decoder object SharedBufferManagerPtr buffer_manager_; //!< Buffer manager object @@ -121,7 +118,7 @@ class FrameReceiverController { std::string rx_thread_identity_; //!< Identity of the RX thread dealer channel - boost::scoped_ptr rx_thread_status_; //!< Status of the receiver thread + std::unique_ptr rx_thread_status_; //!< Status of the receiver thread }; const std::size_t deferred_action_delay_ms = 1000; //!< Default delay in ms for deferred actions diff --git a/cpp/frameReceiver/include/FrameReceiverRxThread.h b/cpp/frameReceiver/include/FrameReceiverRxThread.h index 93fc8873d..dc1f85eb4 100644 --- a/cpp/frameReceiver/include/FrameReceiverRxThread.h +++ b/cpp/frameReceiver/include/FrameReceiverRxThread.h @@ -9,7 +9,6 @@ #define FRAMERECEIVERRXTHREAD_H_ #include -#include #include using namespace log4cxx; @@ -78,7 +77,7 @@ class FrameReceiverRxThread { FrameDecoderPtr frame_decoder_; //!< Pointer to the frame decoder unsigned int tick_period_ms_; //!< Receiver thread tick timer period - std::shared_ptr rx_thread_; //!< Pointer to RX thread + std::shared_ptr rx_thread_; //!< Pointer to RX thread IpcChannel rx_channel_; //!< Channel for communication with the main thread std::vector recv_sockets_; //!< List of receive socket file descriptors diff --git a/cpp/frameReceiver/include/FrameReceiverTCPRxThread.h b/cpp/frameReceiver/include/FrameReceiverTCPRxThread.h index d86a9f583..ea978de91 100644 --- a/cpp/frameReceiver/include/FrameReceiverTCPRxThread.h +++ b/cpp/frameReceiver/include/FrameReceiverTCPRxThread.h @@ -7,7 +7,6 @@ #define FRAMERECEIVERTCPRXTHREAD_H_ #include -#include #include using namespace log4cxx; diff --git a/cpp/frameReceiver/include/FrameReceiverUDPRxThread.h b/cpp/frameReceiver/include/FrameReceiverUDPRxThread.h index cef2d0e86..668afad62 100644 --- a/cpp/frameReceiver/include/FrameReceiverUDPRxThread.h +++ b/cpp/frameReceiver/include/FrameReceiverUDPRxThread.h @@ -9,7 +9,6 @@ #define FRAMERECEIVERUDPRXTHREAD_H_ #include -#include #include using namespace log4cxx; diff --git a/cpp/frameReceiver/include/FrameReceiverZMQRxThread.h b/cpp/frameReceiver/include/FrameReceiverZMQRxThread.h index c3b698503..199061682 100644 --- a/cpp/frameReceiver/include/FrameReceiverZMQRxThread.h +++ b/cpp/frameReceiver/include/FrameReceiverZMQRxThread.h @@ -9,7 +9,6 @@ #define FRAMERECEIVERZMQRXTHREAD_H_ #include -#include #include using namespace log4cxx; diff --git a/cpp/frameReceiver/src/FrameReceiverController.cpp b/cpp/frameReceiver/src/FrameReceiverController.cpp index 88900cde3..f646a1e29 100644 --- a/cpp/frameReceiver/src/FrameReceiverController.cpp +++ b/cpp/frameReceiver/src/FrameReceiverController.cpp @@ -424,7 +424,7 @@ void FrameReceiverController::configure_frame_decoder(OdinData::IpcMessage& conf // IpcMessage to pass to the decoder initialisation. Test if this differs from the current // decoder configuration; update and force a reconfig if so if (config_msg.has_param(CONFIG_DECODER_CONFIG)) { - boost::scoped_ptr new_decoder_config( + std::unique_ptr new_decoder_config( new IpcMessage(config_msg.get_param(CONFIG_DECODER_CONFIG)) ); if (*new_decoder_config != *(config_.decoder_config_)) { diff --git a/cpp/frameReceiver/src/FrameReceiverRxThread.cpp b/cpp/frameReceiver/src/FrameReceiverRxThread.cpp index dc1a0dedc..523150087 100644 --- a/cpp/frameReceiver/src/FrameReceiverRxThread.cpp +++ b/cpp/frameReceiver/src/FrameReceiverRxThread.cpp @@ -55,8 +55,7 @@ bool FrameReceiverRxThread::start() bool init_ok = true; - rx_thread_ - = std::shared_ptr(new boost::thread(boost::bind(&FrameReceiverRxThread::run_service, this))); + rx_thread_ = std::shared_ptr(new std::thread(boost::bind(&FrameReceiverRxThread::run_service, this))); // Wait for the thread service to initialise and be running properly, logging an error // an returning false if the thread fails to start within a reasonable time. Also diff --git a/cpp/frameSimulator/include/DummyUDPFrameSimulatorPlugin.h b/cpp/frameSimulator/include/DummyUDPFrameSimulatorPlugin.h index 3eb9616a0..e35871205 100644 --- a/cpp/frameSimulator/include/DummyUDPFrameSimulatorPlugin.h +++ b/cpp/frameSimulator/include/DummyUDPFrameSimulatorPlugin.h @@ -8,7 +8,6 @@ using namespace log4cxx; using namespace log4cxx::helpers; - #include #include #include diff --git a/cpp/frameSimulator/include/FrameSimulatorPluginUDP.h b/cpp/frameSimulator/include/FrameSimulatorPluginUDP.h index de666a88b..a32f43b2e 100644 --- a/cpp/frameSimulator/include/FrameSimulatorPluginUDP.h +++ b/cpp/frameSimulator/include/FrameSimulatorPluginUDP.h @@ -9,8 +9,6 @@ using namespace log4cxx; using namespace log4cxx::helpers; - - #include "FrameSimulatorPlugin.h" #include "Packet.h" #include "UDPFrame.h" diff --git a/cpp/frameSimulator/include/UDPFrame.h b/cpp/frameSimulator/include/UDPFrame.h index 6d6fd583b..452add950 100644 --- a/cpp/frameSimulator/include/UDPFrame.h +++ b/cpp/frameSimulator/include/UDPFrame.h @@ -3,8 +3,8 @@ #include "Packet.h" -#include #include +#include namespace FrameSimulator { diff --git a/cpp/frameSimulator/src/FrameSimulatorApp.cpp b/cpp/frameSimulator/src/FrameSimulatorApp.cpp index ff9b0245b..4d2abc50f 100644 --- a/cpp/frameSimulator/src/FrameSimulatorApp.cpp +++ b/cpp/frameSimulator/src/FrameSimulatorApp.cpp @@ -8,7 +8,6 @@ #include - #include #include #include diff --git a/cpp/test/integrationTest/src/FrameTestApp.cpp b/cpp/test/integrationTest/src/FrameTestApp.cpp index ee9f91bd1..a0fab8515 100644 --- a/cpp/test/integrationTest/src/FrameTestApp.cpp +++ b/cpp/test/integrationTest/src/FrameTestApp.cpp @@ -10,7 +10,6 @@ #include #include - #include #include #include From e4d7e40f4d42dcfe8ac75aee447b9c16c65a2750 Mon Sep 17 00:00:00 2001 From: Ohisemega Date: Sat, 4 Apr 2026 20:13:44 +0100 Subject: [PATCH 3/6] Replace boost Libaries Replace boost::any with std::any. Replace boost::variant with std::variant. Replace boost::placeholders with std::placeholders. Replace boost::bind with std::bind. Replace boost::function with std::function. Replace boost::ref with std::ref. Replace boost::optional std::optional. Replace relevant boost headers with standard library headers. --- cpp/common/include/IpcChannel.h | 2 -- cpp/common/include/IpcReactor.h | 9 ++++----- cpp/common/include/ParamContainer.h | 20 +++++++++---------- cpp/frameProcessor/include/FrameMetaData.h | 12 +++++------ .../include/FrameProcessorPlugin.h | 6 +++--- cpp/frameProcessor/include/HDF5File.h | 2 +- cpp/frameProcessor/include/ParamMetadata.h | 4 ++-- cpp/frameProcessor/include/WatchdogTimer.h | 4 ++-- cpp/frameProcessor/src/Acquisition.cpp | 5 ++--- cpp/frameProcessor/src/FileWriterPlugin.cpp | 9 +++------ cpp/frameProcessor/src/FrameMetaData.cpp | 2 +- .../src/FrameProcessorController.cpp | 8 ++++---- .../src/SharedMemoryController.cpp | 4 ++-- cpp/frameProcessor/src/WatchdogTimer.cpp | 8 ++++---- .../test/FrameProcessorTest.cpp | 8 +++----- cpp/frameReceiver/include/FrameDecoder.h | 4 +--- cpp/frameReceiver/include/FrameDecoderTCP.h | 2 -- cpp/frameReceiver/include/FrameDecoderUDP.h | 2 -- cpp/frameReceiver/include/FrameDecoderZMQ.h | 2 -- .../include/FrameReceiverZMQRxThread.h | 2 -- .../src/FrameReceiverController.cpp | 14 ++++++------- .../src/FrameReceiverRxThread.cpp | 14 ++++++------- .../src/FrameReceiverTCPRxThread.cpp | 3 +-- .../src/FrameReceiverUDPRxThread.cpp | 2 +- .../src/FrameReceiverZMQRxThread.cpp | 2 +- cpp/frameReceiver/test/IpcReactorUnitTest.cpp | 8 ++++---- .../include/FrameSimulatorOption.h | 15 +++++++------- .../include/FrameSimulatorPlugin.h | 5 ++--- .../include/FrameSimulatorPluginUDP.h | 6 +++--- .../src/DummyUDPFrameSimulatorPlugin.cpp | 12 +++++------ .../src/FrameSimulatorOption.cpp | 2 +- .../src/FrameSimulatorPluginUDP.cpp | 12 +++++------ cpp/test/integrationTest/src/FrameTestApp.cpp | 1 - .../integrationTest/src/HDF5FrameTest.cpp | 1 + 34 files changed, 94 insertions(+), 118 deletions(-) diff --git a/cpp/common/include/IpcChannel.h b/cpp/common/include/IpcChannel.h index b589fe984..db8eae435 100644 --- a/cpp/common/include/IpcChannel.h +++ b/cpp/common/include/IpcChannel.h @@ -12,8 +12,6 @@ #include #include "zmq/zmq.hpp" -#include -#include namespace OdinData { diff --git a/cpp/common/include/IpcReactor.h b/cpp/common/include/IpcReactor.h index 702e79bc4..e7e43c616 100644 --- a/cpp/common/include/IpcReactor.h +++ b/cpp/common/include/IpcReactor.h @@ -17,16 +17,15 @@ #ifndef IPCREACTOR_H_ #define IPCREACTOR_H_ +#include #include #include +#include #include #include #include #include "zmq/zmq.hpp" -#include -#include -#include #include "IpcChannel.h" #include "OdinDataException.h" @@ -43,7 +42,7 @@ class IpcReactorException : public OdinDataException { }; //! Function signature for timer callback methods -typedef boost::function TimerCallback; +typedef std::function TimerCallback; //! Reactor millisecond time type typedef int64_t TimeMs; @@ -85,7 +84,7 @@ class IpcReactorTimer { }; //! Function signature for reactor callback methods -typedef boost::function ReactorCallback; +typedef std::function ReactorCallback; //! Pointer to underlying ZMQ socket of a channel typedef zmq::socket_t* SocketPtr; diff --git a/cpp/common/include/ParamContainer.h b/cpp/common/include/ParamContainer.h index 255564335..e3eae6f26 100644 --- a/cpp/common/include/ParamContainer.h +++ b/cpp/common/include/ParamContainer.h @@ -8,14 +8,12 @@ #ifndef PARAMCONTAINER_H_ #define PARAMCONTAINER_H_ -#include -#include +#include #include +#include #include -#ifdef BOOST_HAS_PLACEHOLDERS -using namespace boost::placeholders; -#endif +using namespace std::placeholders; namespace OdinData { @@ -66,11 +64,11 @@ namespace OdinData { class ParamContainer { //! Parameter setter function type definition - typedef boost::function SetterFunc; + typedef std::function SetterFunc; //! Parameter setter function map type definition typedef std::map SetterFuncMap; //! Parameter getter function type definition - typedef boost::function GetterFunc; + typedef std::function GetterFunc; //! Parameter getter function map type definition typedef std::map GetterFuncMap; @@ -120,10 +118,10 @@ class ParamContainer { template void bind_param(T& param, const std::string& path) { // Bind the parameter into the setter function map - setter_map_[path] = boost::bind(&ParamContainer::param_set, this, boost::ref(param), _1); + setter_map_[path] = std::bind(&ParamContainer::param_set, this, std::ref(param), _1); // Bind the parameter into the getter function map - getter_map_[path] = boost::bind(&ParamContainer::param_get, this, boost::ref(param), _1); + getter_map_[path] = std::bind(&ParamContainer::param_get, this, std::ref(param), _1); } //! Bind a vector parameter to a path in the container. @@ -138,10 +136,10 @@ class ParamContainer { template void bind_vector_param(std::vector& param, const std::string& path) { // Bind the vector parameter into the setter function map - setter_map_[path] = boost::bind(&ParamContainer::vector_param_set, this, boost::ref(param), _1); + setter_map_[path] = std::bind(&ParamContainer::vector_param_set, this, std::ref(param), _1); // Bind the vector parameter into the getter function map - getter_map_[path] = boost::bind(&ParamContainer::vector_param_get, this, boost::ref(param), _1); + getter_map_[path] = std::bind(&ParamContainer::vector_param_get, this, std::ref(param), _1); } //! Set the value of a parameter in the container. diff --git a/cpp/frameProcessor/include/FrameMetaData.h b/cpp/frameProcessor/include/FrameMetaData.h index 28b5a6921..2ee45d8a9 100644 --- a/cpp/frameProcessor/include/FrameMetaData.h +++ b/cpp/frameProcessor/include/FrameMetaData.h @@ -1,12 +1,12 @@ #ifndef FRAMEPROCESSOR_FRAMEMETADATA_H #define FRAMEPROCESSOR_FRAMEMETADATA_H +#include #include #include #include #include -#include #include #include "FrameProcessorDefinitions.h" @@ -33,7 +33,7 @@ class FrameMetaData { FrameMetaData(const FrameMetaData& frame); /** Return frame parameters */ - const std::map& get_parameters() const; + const std::map& get_parameters() const; /** Get frame parameter * @@ -43,14 +43,14 @@ class FrameMetaData { */ template T get_parameter(const std::string& parameter_name) const { - std::map::const_iterator iter = parameters_.find(parameter_name); + std::map::const_iterator iter = parameters_.find(parameter_name); if (iter == parameters_.end()) { LOG4CXX_ERROR(logger, "Unable to find parameter: " + parameter_name); throw std::runtime_error("Unable to find parameter"); } try { - return boost::any_cast(iter->second); - } catch (boost::bad_any_cast& e) { + return std::any_cast(iter->second); + } catch (std::bad_any_cast& e) { LOG4CXX_ERROR(logger, "Parameter has wrong type: " + parameter_name); throw std::runtime_error("Parameter has wrong type"); } catch (std::exception& e) { @@ -147,7 +147,7 @@ class FrameMetaData { CompressionType compression_type_; /** Map of parameters */ - std::map parameters_; + std::map parameters_; /** Frame offset */ int64_t frame_offset_; diff --git a/cpp/frameProcessor/include/FrameProcessorPlugin.h b/cpp/frameProcessor/include/FrameProcessorPlugin.h index b94c8ce5c..c45272e6b 100644 --- a/cpp/frameProcessor/include/FrameProcessorPlugin.h +++ b/cpp/frameProcessor/include/FrameProcessorPlugin.h @@ -203,12 +203,12 @@ class FrameProcessorPlugin : public IFrameCallback, public OdinData::IVersionedO auto itr = metadata.second.allowed_values_.begin(); auto end = metadata.second.allowed_values_.end(); for (; itr != end; ++itr) { - switch (itr->which()) { + switch (itr->index()) { case 1: - message.set_param(param_prefix, boost::get(*itr)); + message.set_param(param_prefix, std::get(*itr)); break; case 2: - message.set_param(param_prefix, boost::get(*itr)); + message.set_param(param_prefix, std::get(*itr)); break; default: return; diff --git a/cpp/frameProcessor/include/HDF5File.h b/cpp/frameProcessor/include/HDF5File.h index ca48bf0dd..8a98770d6 100644 --- a/cpp/frameProcessor/include/HDF5File.h +++ b/cpp/frameProcessor/include/HDF5File.h @@ -49,7 +49,7 @@ struct HDF5ErrorDefinition_t { unsigned int write_duration; unsigned int flush_duration; unsigned int close_duration; - boost::function callback; + std::function callback; }; class HDF5File { diff --git a/cpp/frameProcessor/include/ParamMetadata.h b/cpp/frameProcessor/include/ParamMetadata.h index 905684f53..fbcb36dc2 100644 --- a/cpp/frameProcessor/include/ParamMetadata.h +++ b/cpp/frameProcessor/include/ParamMetadata.h @@ -5,15 +5,15 @@ * Author: Famous Alele, sgr21863 */ -#include #include #include +#include namespace FrameProcessor { /** This struct is a representation of the metadata */ struct ParamMetadata { - using allowed_values_t = boost::variant; + using allowed_values_t = std::variant; enum class AccessMode { READ_ONLY, diff --git a/cpp/frameProcessor/include/WatchdogTimer.h b/cpp/frameProcessor/include/WatchdogTimer.h index e499dab72..24cc21f57 100644 --- a/cpp/frameProcessor/include/WatchdogTimer.h +++ b/cpp/frameProcessor/include/WatchdogTimer.h @@ -21,7 +21,7 @@ namespace FrameProcessor { class WatchdogTimer { public: - WatchdogTimer(const boost::function& timeout_callback); + WatchdogTimer(const std::function& timeout_callback); ~WatchdogTimer(); void start_timer(const std::string& function_name, unsigned int watchdog_timeout_ms); @@ -51,7 +51,7 @@ class WatchdogTimer { /** Counter to monitor number of ticks that have passed */ int ticks_; /** Callback function to call when the timer expires */ - const boost::function& timeout_callback_; + const std::function& timeout_callback_; }; } /* namespace FrameProcessor */ diff --git a/cpp/frameProcessor/src/Acquisition.cpp b/cpp/frameProcessor/src/Acquisition.cpp index c369be6d7..003879429 100644 --- a/cpp/frameProcessor/src/Acquisition.cpp +++ b/cpp/frameProcessor/src/Acquisition.cpp @@ -5,7 +5,6 @@ * Author: vtu42223 */ -#include #include #include "Acquisition.h" @@ -126,8 +125,8 @@ ProcessFrameStatus Acquisition::process_frame(std::shared_ptr frame, HDF5 file->write_frame(*frame, frame_offset_in_file, outer_chunk_dimension, call_durations); // Loops over all parameters, checking if there is a matching dataset and write to it if so - const std::map& frame_parameters = frame->get_meta_data().get_parameters(); - std::map::const_iterator param_iter; + const std::map& frame_parameters = frame->get_meta_data().get_parameters(); + std::map::const_iterator param_iter; for (param_iter = frame_parameters.begin(); param_iter != frame_parameters.end(); ++param_iter) { std::map::iterator dset_iter; dset_iter = dataset_defs_.find(param_iter->first); diff --git a/cpp/frameProcessor/src/FileWriterPlugin.cpp b/cpp/frameProcessor/src/FileWriterPlugin.cpp index 17384a41f..c6c466f67 100644 --- a/cpp/frameProcessor/src/FileWriterPlugin.cpp +++ b/cpp/frameProcessor/src/FileWriterPlugin.cpp @@ -16,10 +16,7 @@ #include "logging.h" #include "version.h" -#ifdef BOOST_HAS_PLACEHOLDERS -using namespace boost::placeholders; -#endif - +using namespace std::placeholders; namespace FrameProcessor { const std::string FileWriterPlugin::CONFIG_PROCESS = "process"; @@ -89,7 +86,7 @@ FileWriterPlugin::FileWriterPlugin() : alignment_value_(1), timeout_period_(0), timeout_thread_running_(true), - timeout_thread_(boost::bind(&FileWriterPlugin::run_close_file_timeout, this)) + timeout_thread_(std::bind(&FileWriterPlugin::run_close_file_timeout, this)) { std::string prefix = FileWriterPlugin::CONFIG_PROCESS + '/'; add_config_param_metadata( @@ -177,7 +174,7 @@ FileWriterPlugin::FileWriterPlugin() : hdf5_error_definition_.write_duration = 0; hdf5_error_definition_.flush_duration = 0; hdf5_error_definition_.close_duration = 0; - hdf5_error_definition_.callback = boost::bind(&FileWriterPlugin::set_warning, this, _1); + hdf5_error_definition_.callback = std::bind(&FileWriterPlugin::set_warning, this, _1); } /** diff --git a/cpp/frameProcessor/src/FrameMetaData.cpp b/cpp/frameProcessor/src/FrameMetaData.cpp index 087fc3e59..17066ab17 100644 --- a/cpp/frameProcessor/src/FrameMetaData.cpp +++ b/cpp/frameProcessor/src/FrameMetaData.cpp @@ -47,7 +47,7 @@ FrameMetaData::FrameMetaData(const FrameMetaData& frame) /** Get frame parameters * @return std::map map */ -const std::map& FrameMetaData::get_parameters() const +const std::map& FrameMetaData::get_parameters() const { return this->parameters_; }; diff --git a/cpp/frameProcessor/src/FrameProcessorController.cpp b/cpp/frameProcessor/src/FrameProcessorController.cpp index 5ac2956a5..38b15de23 100644 --- a/cpp/frameProcessor/src/FrameProcessorController.cpp +++ b/cpp/frameProcessor/src/FrameProcessorController.cpp @@ -59,7 +59,7 @@ FrameProcessorController::FrameProcessorController(unsigned int num_io_threads) pluginShutdownSent_(false), shutdown_(false), ipc_context_(OdinData::IpcContext::Instance(num_io_threads)), - ctrlThread_(boost::bind(&FrameProcessorController::runIpcService, this)), + ctrlThread_(std::bind(&FrameProcessorController::runIpcService, this)), ctrlChannelEndpoint_(""), ctrlChannel_(ZMQ_ROUTER), metaRxChannel_(ZMQ_PULL), @@ -969,7 +969,7 @@ void FrameProcessorController::setupControlInterface(const std::string& ctrlEndp } // Add the control channel to the reactor - reactor_->register_channel(ctrlChannel_, boost::bind(&FrameProcessorController::handleCtrlChannel, this)); + reactor_->register_channel(ctrlChannel_, std::bind(&FrameProcessorController::handleCtrlChannel, this)); } /** Close the control interface. @@ -997,7 +997,7 @@ void FrameProcessorController::setupMetaRxInterface() } // Add the control channel to the reactor - reactor_->register_channel(metaRxChannel_, boost::bind(&FrameProcessorController::handleMetaRxChannel, this)); + reactor_->register_channel(metaRxChannel_, std::bind(&FrameProcessorController::handleMetaRxChannel, this)); } void FrameProcessorController::closeMetaRxInterface() @@ -1050,7 +1050,7 @@ void FrameProcessorController::runIpcService(void) reactor_ = std::shared_ptr(new OdinData::IpcReactor()); // Add the tick timer to the reactor - int tick_timer_id = reactor_->register_timer(1000, 0, boost::bind(&FrameProcessorController::tickTimer, this)); + int tick_timer_id = reactor_->register_timer(1000, 0, std::bind(&FrameProcessorController::tickTimer, this)); // Set thread state to running, allows constructor to return threadRunning_ = true; diff --git a/cpp/frameProcessor/src/SharedMemoryController.cpp b/cpp/frameProcessor/src/SharedMemoryController.cpp index c73faef55..0fd693c58 100644 --- a/cpp/frameProcessor/src/SharedMemoryController.cpp +++ b/cpp/frameProcessor/src/SharedMemoryController.cpp @@ -55,7 +55,7 @@ SharedMemoryController::SharedMemoryController( } // Add the Frame Ready channel to the reactor - reactor_->register_channel(rxChannel_, boost::bind(&SharedMemoryController::handleRxChannel, this)); + reactor_->register_channel(rxChannel_, std::bind(&SharedMemoryController::handleRxChannel, this)); // Now connect the frame release response channel try { @@ -132,7 +132,7 @@ void SharedMemoryController::requestSharedBufferConfig(const bool deferred) { if (deferred) { LOG4CXX_DEBUG_LEVEL(1, logger_, "Registering timer for deferred shared buffer configuration request"); - reactor_->register_timer(1000, 1, boost::bind(&SharedMemoryController::requestSharedBufferConfig, this, false)); + reactor_->register_timer(1000, 1, std::bind(&SharedMemoryController::requestSharedBufferConfig, this, false)); sharedBufferConfigRequestDeferred_ = true; } else { // If this is being called by a deferred request timer but the shared buffer has been configured in the diff --git a/cpp/frameProcessor/src/WatchdogTimer.cpp b/cpp/frameProcessor/src/WatchdogTimer.cpp index 81f1ed824..19d40a2d4 100644 --- a/cpp/frameProcessor/src/WatchdogTimer.cpp +++ b/cpp/frameProcessor/src/WatchdogTimer.cpp @@ -14,9 +14,9 @@ namespace FrameProcessor { -WatchdogTimer::WatchdogTimer(const boost::function& timeout_callback) : +WatchdogTimer::WatchdogTimer(const std::function& timeout_callback) : worker_thread_running_(false), - worker_thread_(boost::bind(&WatchdogTimer::run, this)), + worker_thread_(std::bind(&WatchdogTimer::run, this)), timeout_callback_(timeout_callback) { this->logger_ = Logger::getLogger("FP.WatchdogTimer"); @@ -55,7 +55,7 @@ void WatchdogTimer::start_timer(const std::string& function_name, unsigned int w timer_id_ = reactor_.register_timer( watchdog_timeout_ms, 1, // Bind member function to this instance with function_name argument - boost::bind(&WatchdogTimer::call_timeout_callback, this, function_name) + std::bind(&WatchdogTimer::call_timeout_callback, this, function_name) ); } } @@ -99,7 +99,7 @@ void WatchdogTimer::run() worker_thread_running_ = true; // Register a repeating timer to keep the reactor alive and check for shutdown every millisecond - reactor_.register_timer(1, 0, boost::bind(&WatchdogTimer::heartbeat, this)); + reactor_.register_timer(1, 0, std::bind(&WatchdogTimer::heartbeat, this)); reactor_.run(); } diff --git a/cpp/frameProcessor/test/FrameProcessorTest.cpp b/cpp/frameProcessor/test/FrameProcessorTest.cpp index 7eaacfa2a..6a45a8fda 100644 --- a/cpp/frameProcessor/test/FrameProcessorTest.cpp +++ b/cpp/frameProcessor/test/FrameProcessorTest.cpp @@ -4,11 +4,7 @@ */ #include "DebugLevelLogger.h" -#include #include -#ifdef BOOST_HAS_PLACEHOLDERS -using namespace boost::placeholders; -#endif #include #include @@ -30,6 +26,8 @@ using namespace log4cxx::xml; #include "SumPlugin.h" #include "TestHelperFunctions.h" +using namespace std::placeholders; + void dummy_callback(const std::string& msg) { } @@ -210,7 +208,7 @@ class FileWriterPluginTestFixture { hdf5_error_definition.write_duration = 0; hdf5_error_definition.flush_duration = 0; hdf5_error_definition.close_duration = 0; - hdf5_error_definition.callback = boost::bind(&dummy_callback, _1); + hdf5_error_definition.callback = std::bind(&dummy_callback, _1); } ~FileWriterPluginTestFixture() { diff --git a/cpp/frameReceiver/include/FrameDecoder.h b/cpp/frameReceiver/include/FrameDecoder.h index 37676c43c..e92450e4a 100644 --- a/cpp/frameReceiver/include/FrameDecoder.h +++ b/cpp/frameReceiver/include/FrameDecoder.h @@ -15,8 +15,6 @@ #include #include -#include - #include using namespace log4cxx; using namespace log4cxx::helpers; @@ -38,7 +36,7 @@ class FrameDecoderException : public OdinData::OdinDataException { OdinData::OdinDataException(what) { }; }; -typedef boost::function FrameReadyCallback; +typedef std::function FrameReadyCallback; typedef std::queue EmptyBufferQueue; typedef std::map FrameBufferMap; diff --git a/cpp/frameReceiver/include/FrameDecoderTCP.h b/cpp/frameReceiver/include/FrameDecoderTCP.h index 15a9ad8d9..9c80bf09f 100644 --- a/cpp/frameReceiver/include/FrameDecoderTCP.h +++ b/cpp/frameReceiver/include/FrameDecoderTCP.h @@ -15,8 +15,6 @@ #include #include -#include - #include using namespace log4cxx; using namespace log4cxx::helpers; diff --git a/cpp/frameReceiver/include/FrameDecoderUDP.h b/cpp/frameReceiver/include/FrameDecoderUDP.h index bab0c5f88..e8d451bf2 100644 --- a/cpp/frameReceiver/include/FrameDecoderUDP.h +++ b/cpp/frameReceiver/include/FrameDecoderUDP.h @@ -15,8 +15,6 @@ #include #include -#include - #include using namespace log4cxx; using namespace log4cxx::helpers; diff --git a/cpp/frameReceiver/include/FrameDecoderZMQ.h b/cpp/frameReceiver/include/FrameDecoderZMQ.h index c4aa46565..74c9e577a 100644 --- a/cpp/frameReceiver/include/FrameDecoderZMQ.h +++ b/cpp/frameReceiver/include/FrameDecoderZMQ.h @@ -15,8 +15,6 @@ #include #include -#include - #include using namespace log4cxx; using namespace log4cxx::helpers; diff --git a/cpp/frameReceiver/include/FrameReceiverZMQRxThread.h b/cpp/frameReceiver/include/FrameReceiverZMQRxThread.h index 199061682..394fc7904 100644 --- a/cpp/frameReceiver/include/FrameReceiverZMQRxThread.h +++ b/cpp/frameReceiver/include/FrameReceiverZMQRxThread.h @@ -8,8 +8,6 @@ #ifndef FRAMERECEIVERZMQRXTHREAD_H_ #define FRAMERECEIVERZMQRXTHREAD_H_ -#include - #include using namespace log4cxx; using namespace log4cxx::helpers; diff --git a/cpp/frameReceiver/src/FrameReceiverController.cpp b/cpp/frameReceiver/src/FrameReceiverController.cpp index f646a1e29..872ba7257 100644 --- a/cpp/frameReceiver/src/FrameReceiverController.cpp +++ b/cpp/frameReceiver/src/FrameReceiverController.cpp @@ -133,7 +133,7 @@ void FrameReceiverController::run(void) #ifdef FR_CONTROLLER_TICK_TIMER int tick_timer_id - = reactor_.register_timer(deferred_action_delay_ms, 0, boost::bind(&FrameReceiverController::tick_timer, this)); + = reactor_.register_timer(deferred_action_delay_ms, 0, std::bind(&FrameReceiverController::tick_timer, this)); #endif // Run the reactor event loop @@ -165,7 +165,7 @@ void FrameReceiverController::run(void) void FrameReceiverController::stop(const bool deferred) { if (deferred) { - reactor_.register_timer(deferred_action_delay_ms, 1, boost::bind(&FrameReceiverController::stop, this, false)); + reactor_.register_timer(deferred_action_delay_ms, 1, std::bind(&FrameReceiverController::stop, this, false)); } else { LOG4CXX_TRACE(logger_, "FrameReceiverController::stop()"); terminate_controller_ = true; @@ -267,7 +267,7 @@ void FrameReceiverController::setup_control_channel(const std::string& endpoint) } // Add channel to the reactor - reactor_.register_channel(ctrl_channel_, boost::bind(&FrameReceiverController::handle_ctrl_channel, this)); + reactor_.register_channel(ctrl_channel_, std::bind(&FrameReceiverController::handle_ctrl_channel, this)); } //! Set up the receiver thread channel. @@ -290,7 +290,7 @@ void FrameReceiverController::setup_rx_channel(const std::string& endpoint) } // Add channel to the reactor - reactor_.register_channel(rx_channel_, boost::bind(&FrameReceiverController::handle_rx_channel, this)); + reactor_.register_channel(rx_channel_, std::bind(&FrameReceiverController::handle_rx_channel, this)); } //! Set up the frame ready notification channel. @@ -337,7 +337,7 @@ void FrameReceiverController::setup_frame_release_channel(const std::string& end // Add channel to the reactor reactor_.register_channel( - frame_release_channel_, boost::bind(&FrameReceiverController::handle_frame_release_channel, this) + frame_release_channel_, std::bind(&FrameReceiverController::handle_frame_release_channel, this) ); } @@ -357,7 +357,7 @@ void FrameReceiverController::unbind_channel(OdinData::IpcChannel* channel, std: if (deferred) { reactor_.register_timer( deferred_action_delay_ms, 1, - boost::bind(&FrameReceiverController::unbind_channel, this, channel, endpoint, false) + std::bind(&FrameReceiverController::unbind_channel, this, channel, endpoint, false) ); } else { LOG4CXX_DEBUG_LEVEL(1, logger_, "Unbinding channel endpoint " << endpoint); @@ -962,7 +962,7 @@ void FrameReceiverController::notify_buffer_config(const bool deferred) if (deferred) { reactor_.register_timer( - deferred_action_delay_ms, 1, boost::bind(&FrameReceiverController::notify_buffer_config, this, false) + deferred_action_delay_ms, 1, std::bind(&FrameReceiverController::notify_buffer_config, this, false) ); } else { LOG4CXX_DEBUG_LEVEL(1, logger_, "Notifying downstream processes of shared buffer configuration"); diff --git a/cpp/frameReceiver/src/FrameReceiverRxThread.cpp b/cpp/frameReceiver/src/FrameReceiverRxThread.cpp index 523150087..f5a1e4f19 100644 --- a/cpp/frameReceiver/src/FrameReceiverRxThread.cpp +++ b/cpp/frameReceiver/src/FrameReceiverRxThread.cpp @@ -7,9 +7,7 @@ #include "FrameReceiverRxThread.h" -#ifdef BOOST_HAS_PLACEHOLDERS -using namespace boost::placeholders; -#endif +using namespace std::placeholders; using namespace FrameReceiver; @@ -55,7 +53,7 @@ bool FrameReceiverRxThread::start() bool init_ok = true; - rx_thread_ = std::shared_ptr(new std::thread(boost::bind(&FrameReceiverRxThread::run_service, this))); + rx_thread_ = std::shared_ptr(new std::thread(std::bind(&FrameReceiverRxThread::run_service, this))); // Wait for the thread service to initialise and be running properly, logging an error // an returning false if the thread fails to start within a reasonable time. Also @@ -126,22 +124,22 @@ void FrameReceiverRxThread::run_service(void) } // Add the RX channel to the reactor - reactor_.register_channel(rx_channel_, boost::bind(&FrameReceiverRxThread::handle_rx_channel, this)); + reactor_.register_channel(rx_channel_, std::bind(&FrameReceiverRxThread::handle_rx_channel, this)); // Run the specific service setup implemented in subclass run_specific_service(); // Add the tick timer to the reactor int tick_timer_id - = reactor_.register_timer(tick_period_ms_, 0, boost::bind(&FrameReceiverRxThread::tick_timer, this)); + = reactor_.register_timer(tick_period_ms_, 0, std::bind(&FrameReceiverRxThread::tick_timer, this)); // Add the buffer monitor timer to the reactor int buffer_monitor_timer_id = reactor_.register_timer( - frame_decoder_->get_frame_timeout_ms(), 0, boost::bind(&FrameReceiverRxThread::buffer_monitor_timer, this) + frame_decoder_->get_frame_timeout_ms(), 0, std::bind(&FrameReceiverRxThread::buffer_monitor_timer, this) ); // Register the frame release callback with the decoder - frame_decoder_->register_frame_ready_callback(boost::bind(&FrameReceiverRxThread::frame_ready, this, _1, _2)); + frame_decoder_->register_frame_ready_callback(std::bind(&FrameReceiverRxThread::frame_ready, this, _1, _2)); // If there was any prior error setting the thread up, return if (thread_init_error_) { diff --git a/cpp/frameReceiver/src/FrameReceiverTCPRxThread.cpp b/cpp/frameReceiver/src/FrameReceiverTCPRxThread.cpp index 84b03956e..de9a656be 100644 --- a/cpp/frameReceiver/src/FrameReceiverTCPRxThread.cpp +++ b/cpp/frameReceiver/src/FrameReceiverTCPRxThread.cpp @@ -91,8 +91,7 @@ void FrameReceiverTCPRxThread::run_specific_service(void) // Register this socket this->register_socket( - recv_socket_, - boost::bind(&FrameReceiverTCPRxThread::handle_receive_socket, this, recv_socket_, (int)rx_port) + recv_socket_, std::bind(&FrameReceiverTCPRxThread::handle_receive_socket, this, recv_socket_, (int)rx_port) ); } } diff --git a/cpp/frameReceiver/src/FrameReceiverUDPRxThread.cpp b/cpp/frameReceiver/src/FrameReceiverUDPRxThread.cpp index daf977d2f..c7a417772 100644 --- a/cpp/frameReceiver/src/FrameReceiverUDPRxThread.cpp +++ b/cpp/frameReceiver/src/FrameReceiverUDPRxThread.cpp @@ -94,7 +94,7 @@ void FrameReceiverUDPRxThread::run_specific_service(void) // Register this socket this->register_socket( - recv_socket, boost::bind(&FrameReceiverUDPRxThread::handle_receive_socket, this, recv_socket, (int)rx_port) + recv_socket, std::bind(&FrameReceiverUDPRxThread::handle_receive_socket, this, recv_socket, (int)rx_port) ); } } diff --git a/cpp/frameReceiver/src/FrameReceiverZMQRxThread.cpp b/cpp/frameReceiver/src/FrameReceiverZMQRxThread.cpp index 32cc436fb..f4568eaaf 100644 --- a/cpp/frameReceiver/src/FrameReceiverZMQRxThread.cpp +++ b/cpp/frameReceiver/src/FrameReceiverZMQRxThread.cpp @@ -43,7 +43,7 @@ void FrameReceiverZMQRxThread::run_specific_service(void) skt_channel_.connect(ss.str().c_str()); // Register the IPC channel with the reactor - reactor_.register_channel(skt_channel_, boost::bind(&FrameReceiverZMQRxThread::handle_receive_socket, this)); + reactor_.register_channel(skt_channel_, std::bind(&FrameReceiverZMQRxThread::handle_receive_socket, this)); } } diff --git a/cpp/frameReceiver/test/IpcReactorUnitTest.cpp b/cpp/frameReceiver/test/IpcReactorUnitTest.cpp index 6856da3a9..e43aa0b4b 100644 --- a/cpp/frameReceiver/test/IpcReactorUnitTest.cpp +++ b/cpp/frameReceiver/test/IpcReactorUnitTest.cpp @@ -70,7 +70,7 @@ BOOST_AUTO_TEST_CASE(ReactorTimerTest) { int max_count = 10; - int timer_id = reactor.register_timer(10, max_count, boost::bind(&ReactorTestFixture::timer_handler, this)); + int timer_id = reactor.register_timer(10, max_count, std::bind(&ReactorTestFixture::timer_handler, this)); reactor.run(); BOOST_CHECK_EQUAL(timer_count, max_count); } @@ -78,7 +78,7 @@ BOOST_AUTO_TEST_CASE(ReactorTimerTest) BOOST_AUTO_TEST_CASE(ReactorChannelTest) { - reactor.register_channel(recv_channel, boost::bind(&ReactorTestFixture::recv_handler, this)); + reactor.register_channel(recv_channel, std::bind(&ReactorTestFixture::recv_handler, this)); send_channel.send(test_message); reactor.run(); @@ -88,8 +88,8 @@ BOOST_AUTO_TEST_CASE(ReactorChannelTest) BOOST_AUTO_TEST_CASE(ReactorSendFromTimerTest) { - reactor.register_channel(recv_channel, boost::bind(&ReactorTestFixture::recv_handler, this)); - int timer_id = reactor.register_timer(10, 1, boost::bind(&ReactorTestFixture::timed_send_handler, this)); + reactor.register_channel(recv_channel, std::bind(&ReactorTestFixture::recv_handler, this)); + int timer_id = reactor.register_timer(10, 1, std::bind(&ReactorTestFixture::timed_send_handler, this)); reactor.run(); BOOST_CHECK_EQUAL(test_message, received_message); diff --git a/cpp/frameSimulator/include/FrameSimulatorOption.h b/cpp/frameSimulator/include/FrameSimulatorOption.h index 52256f3ff..243a986e5 100644 --- a/cpp/frameSimulator/include/FrameSimulatorOption.h +++ b/cpp/frameSimulator/include/FrameSimulatorOption.h @@ -1,18 +1,19 @@ #ifndef FRAMESIMULATOR_FRAMESIMULATOROPTION_H #define FRAMESIMULATOR_FRAMESIMULATOROPTION_H -#include -#include #include +#include #include #include +#include + namespace po = boost::program_options; namespace FrameSimulator { void set_list_option(const std::string& option_val, std::vector& list); -void set_optionallist_option(const std::string& option_val, boost::optional>& list); +void set_optionallist_option(const std::string& option_val, std::optional>& list); /** Helper class for specifying frame simulator plugin command line options * specifies argument string for option @@ -64,12 +65,12 @@ template class FrameSimulatorOption { return vm[argstring].as(); } - void get_val(const po::variables_map& vm, boost::optional& val) const + void get_val(const po::variables_map& vm, std::optional& val) const { if (is_specified(vm)) val = get_val(vm); else if (defaultval) { - val = defaultval.get(); + val = defaultval.value(); } } @@ -77,14 +78,14 @@ template class FrameSimulatorOption { { if (defaultval) { options.add_options()( - argstring.c_str(), po::value()->default_value(defaultval.get()), description.c_str() + argstring.c_str(), po::value()->default_value(defaultval.value()), description.c_str() ); } else options.add_options()(argstring.c_str(), po::value(), description.c_str()); } private: - const boost::optional defaultval; + const std::optional defaultval; const std::string argstring; const std::string description; }; diff --git a/cpp/frameSimulator/include/FrameSimulatorPlugin.h b/cpp/frameSimulator/include/FrameSimulatorPlugin.h index 3210afd30..b072d298d 100644 --- a/cpp/frameSimulator/include/FrameSimulatorPlugin.h +++ b/cpp/frameSimulator/include/FrameSimulatorPlugin.h @@ -8,7 +8,6 @@ using namespace log4cxx; using namespace log4cxx::helpers; -#include #include #include #include @@ -43,9 +42,9 @@ class FrameSimulatorPlugin : public OdinData::IVersionedObject { protected: // Number of frames to replay; if simulator plugin has insufficient frames defined, available frames are cycled - boost::optional replay_numframes_; + std::optional replay_numframes_; // Time (in s) between frames during replay - boost::optional frame_gap_secs_; + std::optional frame_gap_secs_; private: /** Pointer to logger **/ diff --git a/cpp/frameSimulator/include/FrameSimulatorPluginUDP.h b/cpp/frameSimulator/include/FrameSimulatorPluginUDP.h index a32f43b2e..940bfcc7b 100644 --- a/cpp/frameSimulator/include/FrameSimulatorPluginUDP.h +++ b/cpp/frameSimulator/include/FrameSimulatorPluginUDP.h @@ -58,11 +58,11 @@ class FrameSimulatorPluginUDP : public FrameSimulatorPlugin { void replay_frames(); // Packet gap: pause between packet_gap packets; must be >0 - boost::optional packet_gap_; + std::optional packet_gap_; // proportion in [0.0,1.0] of packets to randomly drop - boost::optional drop_frac_; + std::optional drop_frac_; // List of packets to drop, these are simple ints held as strings. 0=first packet etc. - boost::optional> drop_packets_; + std::optional> drop_packets_; /** Frames **/ UDPFrames frames_; diff --git a/cpp/frameSimulator/src/DummyUDPFrameSimulatorPlugin.cpp b/cpp/frameSimulator/src/DummyUDPFrameSimulatorPlugin.cpp index ea42aa828..100efe7f4 100644 --- a/cpp/frameSimulator/src/DummyUDPFrameSimulatorPlugin.cpp +++ b/cpp/frameSimulator/src/DummyUDPFrameSimulatorPlugin.cpp @@ -51,21 +51,21 @@ bool DummyUDPFrameSimulatorPlugin::setup(const po::variables_map& vm) LOG4CXX_DEBUG(logger_, "Setting up DummyUDP simulator plugin"); // Extract optional arguments for this plugin - boost::optional image_width; - boost::optional image_height; - boost::optional packet_len; + std::optional image_width; + std::optional image_height; + std::optional packet_len; opt_image_width.get_val(vm, image_width); if (image_width) { - image_width_ = image_width.get(); + image_width_ = image_width.value(); } opt_image_height.get_val(vm, image_height); if (image_height) { - image_height_ = image_height.get(); + image_height_ = image_height.value(); } opt_packet_len.get_val(vm, packet_len); if (packet_len) { - packet_len_ = packet_len.get(); + packet_len_ = packet_len.value(); } LOG4CXX_DEBUG( diff --git a/cpp/frameSimulator/src/FrameSimulatorOption.cpp b/cpp/frameSimulator/src/FrameSimulatorOption.cpp index f06f8c35d..ee667313c 100644 --- a/cpp/frameSimulator/src/FrameSimulatorOption.cpp +++ b/cpp/frameSimulator/src/FrameSimulatorOption.cpp @@ -18,7 +18,7 @@ void set_list_option(const std::string& option_val, std::vector& li * /param[in] string of comma separated values * /param[out] required output list as std::vector */ -void set_optionallist_option(const std::string& option_val, boost::optional>& list) +void set_optionallist_option(const std::string& option_val, std::optional>& list) { std::vector tmp_list; set_list_option(option_val, tmp_list); diff --git a/cpp/frameSimulator/src/FrameSimulatorPluginUDP.cpp b/cpp/frameSimulator/src/FrameSimulatorPluginUDP.cpp index 0646bb54c..81f40fed4 100644 --- a/cpp/frameSimulator/src/FrameSimulatorPluginUDP.cpp +++ b/cpp/frameSimulator/src/FrameSimulatorPluginUDP.cpp @@ -101,7 +101,7 @@ bool FrameSimulatorPluginUDP::setup(const po::variables_map& vm) // Loop over the pcap file to read the packets and send them to pkt_callback pcap_loop(m_handle, -1, pkt_callback, reinterpret_cast(this)); } else { - create_frames(replay_numframes_.get()); + create_frames(replay_numframes_.value()); } return true; @@ -139,7 +139,7 @@ void FrameSimulatorPluginUDP::replay_frames() LOG4CXX_DEBUG(logger_, "Replaying frame(s)"); LOG4CXX_ASSERT(logger_, 0 < frames_.size(), "I have no frames to replay"); - int frames_to_replay = replay_numframes_ ? replay_numframes_.get() : frames_.size(); + int frames_to_replay = replay_numframes_ ? replay_numframes_.value() : frames_.size(); LOG4CXX_DEBUG(logger_, "Replaying frames"); LOG4CXX_DEBUG(logger_, frames_to_replay); @@ -173,7 +173,7 @@ void FrameSimulatorPluginUDP::replay_frames() // If drop fraction specified, decide if packet should be dropped if (drop_frac_) { - if (((double)rand() / RAND_MAX) < drop_frac_.get()) { + if (((double)rand() / RAND_MAX) < drop_frac_.value()) { frame_packets_dropped += 1; continue; } @@ -182,7 +182,7 @@ void FrameSimulatorPluginUDP::replay_frames() // If drop list was specified and this packet is in it, drop the packet if (drop_packets_) { - std::vector drop_packet_vec = drop_packets_.get(); + std::vector drop_packet_vec = drop_packets_.value(); if (std::find(drop_packet_vec.begin(), drop_packet_vec.end(), boost::lexical_cast(p)) != drop_packet_vec.end()) { frame_packets_dropped += 1; @@ -194,7 +194,7 @@ void FrameSimulatorPluginUDP::replay_frames() frame_packets_sent += 1; // Add brief pause between 'packet_gap' frames if packet gap specified - if (packet_gap_ && (frame_packets_sent % packet_gap_.get() == 0)) { + if (packet_gap_ && (frame_packets_sent % packet_gap_.value() == 0)) { LOG4CXX_DEBUG( logger_, "Pause - just sent packet - " + boost::lexical_cast(frame_packets_sent) ); @@ -209,7 +209,7 @@ void FrameSimulatorPluginUDP::replay_frames() // Calculate wait time and sleep so that frames are sent at requested intervals if (frame_gap_secs_) { - float wait_time_s = frame_gap_secs_.get() - frame_time_s; + float wait_time_s = frame_gap_secs_.value() - frame_time_s; if (wait_time_s > 0) { LOG4CXX_DEBUG(logger_, "Pause after frame " + boost::lexical_cast(n)); struct timespec wait_spec; diff --git a/cpp/test/integrationTest/src/FrameTestApp.cpp b/cpp/test/integrationTest/src/FrameTestApp.cpp index a0fab8515..f035b5fa6 100644 --- a/cpp/test/integrationTest/src/FrameTestApp.cpp +++ b/cpp/test/integrationTest/src/FrameTestApp.cpp @@ -8,7 +8,6 @@ #include #include -#include #include #include diff --git a/cpp/test/integrationTest/src/HDF5FrameTest.cpp b/cpp/test/integrationTest/src/HDF5FrameTest.cpp index 3894b77da..ebcdb3de6 100644 --- a/cpp/test/integrationTest/src/HDF5FrameTest.cpp +++ b/cpp/test/integrationTest/src/HDF5FrameTest.cpp @@ -1,4 +1,5 @@ #include +#include #include #include #include From 81328f4acc34adf0d16f8e1a89bbb1034b03f157 Mon Sep 17 00:00:00 2001 From: Ohisemega Date: Sat, 4 Apr 2026 20:45:32 +0100 Subject: [PATCH 4/6] Fix Bugs in KafkaProducerPlugin --- cpp/frameProcessor/src/FrameMetaData.cpp | 2 +- cpp/frameProcessor/src/KafkaProducerPlugin.cpp | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cpp/frameProcessor/src/FrameMetaData.cpp b/cpp/frameProcessor/src/FrameMetaData.cpp index 17066ab17..fd33f296d 100644 --- a/cpp/frameProcessor/src/FrameMetaData.cpp +++ b/cpp/frameProcessor/src/FrameMetaData.cpp @@ -45,7 +45,7 @@ FrameMetaData::FrameMetaData(const FrameMetaData& frame) } /** Get frame parameters - * @return std::map map + * @return std::map map */ const std::map& FrameMetaData::get_parameters() const { diff --git a/cpp/frameProcessor/src/KafkaProducerPlugin.cpp b/cpp/frameProcessor/src/KafkaProducerPlugin.cpp index 3d10f0aef..e2784c599 100644 --- a/cpp/frameProcessor/src/KafkaProducerPlugin.cpp +++ b/cpp/frameProcessor/src/KafkaProducerPlugin.cpp @@ -306,15 +306,15 @@ void* KafkaProducerPlugin::create_message(std::shared_ptr frame, size_t& writer.String(MSG_HEADER_FRAME_DIMENSIONS_KEY); writer.StartArray(); dimensions_t dims = frame->get_meta_data().get_dimensions(); - for (dimensions_t::iterator it = dims.begin(); it != dims.end(); it++) { + for (auto it = dims.begin(); it != dims.end(); ++it) { writer.Uint64(*it); } writer.EndArray(); if (this->include_parameters_) { - const std::map& parameters = frame->get_meta_data().get_parameters(); + const auto& parameters = frame->get_meta_data().get_parameters(); writer.String(MSG_HEADER_FRAME_PARAMETERS_KEY); writer.StartObject(); - for (std::map::const_iterator it = parameters.begin(); it != parameters.end(); it++) { + for (auto it = parameters.begin(); it != parameters.end(); ++it) { writer.String(it->first.c_str()); const std::type_info& ti = it->second.type(); if (it->second.type() == typeid(unsigned long)) { From dec41f2b222e2a21aef3e1c33ca12e756490536c Mon Sep 17 00:00:00 2001 From: Ohisemega Date: Wed, 8 Apr 2026 12:05:32 +0100 Subject: [PATCH 5/6] Replace boost Libaries Replace boost::filesystem with std::filesystem. --- cpp/frameProcessor/include/RawFileWriterPlugin.h | 6 +++--- cpp/frameProcessor/src/Acquisition.cpp | 5 ++--- cpp/frameProcessor/src/FileWriterPlugin.cpp | 10 +++++----- cpp/frameProcessor/src/FrameProcessorApp.cpp | 1 - cpp/frameProcessor/src/RawFileWriterPlugin.cpp | 11 ++++++----- .../test/RawFileWriterPluginTest.cpp | 15 ++++++++------- cpp/frameSimulator/src/FrameSimulatorApp.cpp | 11 +++++------ cpp/test/integrationTest/src/ControlUtility.cpp | 5 +++-- cpp/test/integrationTest/src/FrameTestApp.cpp | 2 -- 9 files changed, 32 insertions(+), 34 deletions(-) diff --git a/cpp/frameProcessor/include/RawFileWriterPlugin.h b/cpp/frameProcessor/include/RawFileWriterPlugin.h index b032e80a9..f775a95bb 100644 --- a/cpp/frameProcessor/include/RawFileWriterPlugin.h +++ b/cpp/frameProcessor/include/RawFileWriterPlugin.h @@ -10,11 +10,11 @@ #include using namespace log4cxx; -#include // boost::filesystem::path - #include "ClassLoader.h" #include "FrameProcessorPlugin.h" +#include + namespace FrameProcessor { class RawFileWriterPlugin : public FrameProcessorPlugin { @@ -43,7 +43,7 @@ class RawFileWriterPlugin : public FrameProcessorPlugin { bool enabled_; /** Root path to write files to - files will be created in this directory or a nested directory, depending on Frame * properties */ - boost::filesystem::path file_path_; + std::filesystem::path file_path_; /** Number of dropped frames */ std::size_t dropped_frames_; }; diff --git a/cpp/frameProcessor/src/Acquisition.cpp b/cpp/frameProcessor/src/Acquisition.cpp index 003879429..c589bcf59 100644 --- a/cpp/frameProcessor/src/Acquisition.cpp +++ b/cpp/frameProcessor/src/Acquisition.cpp @@ -4,8 +4,7 @@ * Created on: 31 Oct 2017 * Author: vtu42223 */ - -#include +#include #include "Acquisition.h" #include "DebugLevelLogger.h" @@ -217,7 +216,7 @@ void Acquisition::create_file(size_t file_number, HDF5CallDurations_t& call_dura current_file_ = std::shared_ptr(new HDF5File(hdf5_error_definition_)); // Create the file - boost::filesystem::path full_path = boost::filesystem::path(file_path_) / boost::filesystem::path(filename_); + std::filesystem::path full_path = std::filesystem::path(file_path_) / std::filesystem::path(filename_); size_t create_duration = current_file_->create_file( full_path.string(), file_number, use_earliest_hdf5_, alignment_threshold_, alignment_value_ ); diff --git a/cpp/frameProcessor/src/FileWriterPlugin.cpp b/cpp/frameProcessor/src/FileWriterPlugin.cpp index c6c466f67..0155bc064 100644 --- a/cpp/frameProcessor/src/FileWriterPlugin.cpp +++ b/cpp/frameProcessor/src/FileWriterPlugin.cpp @@ -4,8 +4,8 @@ */ #include +#include -#include #include #include "FileWriterPlugin.h" @@ -618,12 +618,12 @@ void FileWriterPlugin::configure_file(OdinData::IpcMessage& config, OdinData::Ip // Check for file path and file name if (config.has_param(FileWriterPlugin::CONFIG_FILE_PATH)) { std::string file_path = config.get_param(FileWriterPlugin::CONFIG_FILE_PATH); - boost::filesystem::path p(file_path); + std::filesystem::path p(file_path); // Check path exists - boost::system::error_code ec; - if (boost::filesystem::exists(p, ec)) { + std::error_code ec; + if (std::filesystem::exists(p, ec)) { // Check path is a directory - if (boost::filesystem::is_directory(p, ec)) { + if (std::filesystem::is_directory(p, ec)) { // Check directory has write permission if (eaccess(file_path.c_str(), W_OK)) { // Return code other then zero is a failure diff --git a/cpp/frameProcessor/src/FrameProcessorApp.cpp b/cpp/frameProcessor/src/FrameProcessorApp.cpp index 446fafd7c..d864e2609 100644 --- a/cpp/frameProcessor/src/FrameProcessorApp.cpp +++ b/cpp/frameProcessor/src/FrameProcessorApp.cpp @@ -21,7 +21,6 @@ using namespace std; using namespace log4cxx; using namespace log4cxx::helpers; -#include #include #include namespace po = boost::program_options; diff --git a/cpp/frameProcessor/src/RawFileWriterPlugin.cpp b/cpp/frameProcessor/src/RawFileWriterPlugin.cpp index 9c74cf95e..a9fee47c8 100644 --- a/cpp/frameProcessor/src/RawFileWriterPlugin.cpp +++ b/cpp/frameProcessor/src/RawFileWriterPlugin.cpp @@ -2,6 +2,7 @@ #include // open, O_CREAT, O_RDWR #include // PROT_WRITE, MAP_SHARED #include // mkdir +#include #include "logging.h" #include @@ -36,9 +37,9 @@ void RawFileWriterPlugin::process_frame(std::shared_ptr frame) const std::string& acq_id = frame->get_meta_data().get_acquisition_ID(); std::string&& full_file_path = this->file_path_.string() + acq_id + '/'; - boost::system::error_code ec; - boost::filesystem::create_directory(full_file_path, ec); - if (ec && (ec.value() != boost::system::errc::errc_t::file_exists)) { + std::error_code ec; + std::filesystem::create_directory(full_file_path, ec); + if (ec && (ec != make_error_code(std::errc::file_exists))) { this->enabled_ = false; ++this->dropped_frames_; LOG_WITH_ERRNO(logger_, "Failed to create directory: " << full_file_path); @@ -78,8 +79,8 @@ void RawFileWriterPlugin::configure(OdinData::IpcMessage& config, OdinData::IpcM path_str += '/'; this->file_path_ = std::move(path_str); try { - boost::filesystem::create_directories(this->file_path_.parent_path()); - } catch (boost::filesystem::filesystem_error& e) { + std::filesystem::create_directories(this->file_path_.parent_path()); + } catch (std::filesystem::filesystem_error& e) { this->enabled_ = false; std::stringstream error; error << "Failed to create directory: " << this->file_path_.c_str() << ", Error: " << e.what(); diff --git a/cpp/frameProcessor/test/RawFileWriterPluginTest.cpp b/cpp/frameProcessor/test/RawFileWriterPluginTest.cpp index 25d2aa4d7..fb034c97d 100644 --- a/cpp/frameProcessor/test/RawFileWriterPluginTest.cpp +++ b/cpp/frameProcessor/test/RawFileWriterPluginTest.cpp @@ -58,16 +58,17 @@ BOOST_AUTO_TEST_CASE(RawFileWriterPlugin_invalid_path) BOOST_AUTO_TEST_CASE(RawFileWriterPlugin_existing_path) { - using RFWP = RawFileWriterPluginTestFixture; + // std::filesystem does not treat an attempt to create an existing path as error. OdinData::IpcMessage reply_bad_; OdinData::IpcMessage bad_cfg_2; BOOST_CHECK_NO_THROW(bad_cfg_2.set_param(FrameProcessor::RawFileWriterPlugin::CONFIG_ENABLED, true)); - BOOST_CHECK_NO_THROW(bad_cfg_2.set_param(FrameProcessor::RawFileWriterPlugin::CONFIG_FILE_PATH, std::string("/"))); - BOOST_REQUIRE_EXCEPTION(rfw_plugin.configure(bad_cfg_2, reply_bad_), std::runtime_error, RFWP::is_not_critical); + BOOST_CHECK_NO_THROW(bad_cfg_2.set_param(FrameProcessor::RawFileWriterPlugin::CONFIG_FILE_PATH, std::string("/tmp")) + ); + BOOST_REQUIRE_NO_THROW(rfw_plugin.configure(bad_cfg_2, reply_bad_)); BOOST_REQUIRE_NO_THROW(rfw_plugin.requestConfiguration(reply_bad_)); BOOST_CHECK_EQUAL( reply_bad_.get_param(rfw_plugin.get_name() + '/' + FrameProcessor::RawFileWriterPlugin::CONFIG_ENABLED), - false + true ); } @@ -90,7 +91,7 @@ BOOST_AUTO_TEST_CASE(RawFileWriterPlugin_with_acq_id) ), 0 ); - BOOST_REQUIRE_NO_THROW(boost::filesystem::remove_all("/opt/RFW_valid_dir")); + BOOST_REQUIRE_NO_THROW(std::filesystem::remove_all("/opt/RFW_valid_dir")); } BOOST_AUTO_TEST_CASE(RawFileWriterPlugin_no_acq_id) @@ -112,7 +113,7 @@ BOOST_AUTO_TEST_CASE(RawFileWriterPlugin_no_acq_id) ), 0 ); - BOOST_REQUIRE_NO_THROW(boost::filesystem::remove_all("/opt/RFW_valid_dir_2")); + BOOST_REQUIRE_NO_THROW(std::filesystem::remove_all("/opt/RFW_valid_dir_2")); } BOOST_AUTO_TEST_CASE(RawFileWriterPlugin_dropped_frames) @@ -142,7 +143,7 @@ BOOST_AUTO_TEST_CASE(RawFileWriterPlugin_dropped_frames) ), process_times ); - BOOST_REQUIRE_NO_THROW(boost::filesystem::remove_all("/opt/RFW_testdir")); + BOOST_REQUIRE_NO_THROW(std::filesystem::remove_all("/opt/RFW_testdir")); } BOOST_AUTO_TEST_SUITE_END(); diff --git a/cpp/frameSimulator/src/FrameSimulatorApp.cpp b/cpp/frameSimulator/src/FrameSimulatorApp.cpp index 4d2abc50f..5be01b154 100644 --- a/cpp/frameSimulator/src/FrameSimulatorApp.cpp +++ b/cpp/frameSimulator/src/FrameSimulatorApp.cpp @@ -1,4 +1,5 @@ #include +#include #include #include #include @@ -6,8 +7,6 @@ #include "FrameSimulatorPlugin.h" -#include - #include #include #include @@ -50,8 +49,8 @@ get_requested_plugin(const po::variables_map& vm, LoggerPtr& logger) std::string pluginClass = opt_detector.get_val(vm) + librarySuffix; - boost::filesystem::path libraryPathAndName - = boost::filesystem::path(opt_libpath.get_val(vm)) / boost::filesystem::path("lib" + pluginClass + ".so"); + std::filesystem::path libraryPathAndName + = std::filesystem::path(opt_libpath.get_val(vm)) / std::filesystem::path("lib" + pluginClass + ".so"); std::shared_ptr plugin; @@ -146,8 +145,8 @@ int parse_arguments( po::options_description config("Detector options"); - boost::filesystem::path libraryPathAndName = boost::filesystem::path(opt_libpath.get_val(vm)) - / boost::filesystem::path("lib" + detector + librarySuffix + ".so"); + std::filesystem::path libraryPathAndName = std::filesystem::path(opt_libpath.get_val(vm)) + / std::filesystem::path("lib" + detector + librarySuffix + ".so"); std::string pluginClass = detector + librarySuffix; diff --git a/cpp/test/integrationTest/src/ControlUtility.cpp b/cpp/test/integrationTest/src/ControlUtility.cpp index 04607863e..d0845b7a0 100644 --- a/cpp/test/integrationTest/src/ControlUtility.cpp +++ b/cpp/test/integrationTest/src/ControlUtility.cpp @@ -2,8 +2,9 @@ #include "PropertyTreeUtility.h" #include "zmq/zmq.hpp" -#include + #include +#include #include namespace FrameSimulatorTest { @@ -37,7 +38,7 @@ ControlUtility::ControlUtility( process_path_ = ptree.get(process_entry); PropertyTreeUtility::expandEnvVars(process_path_); - boost::filesystem::path path(process_path_); + std::filesystem::path path(process_path_); // Prepend list of process (command) arguments with ( (deduced from path) and) (optionally) // diff --git a/cpp/test/integrationTest/src/FrameTestApp.cpp b/cpp/test/integrationTest/src/FrameTestApp.cpp index f035b5fa6..3d148ef27 100644 --- a/cpp/test/integrationTest/src/FrameTestApp.cpp +++ b/cpp/test/integrationTest/src/FrameTestApp.cpp @@ -7,8 +7,6 @@ #include -#include - #include #include #include From 3aec880f9ae280d18f92c27e971d6f41a272bc2d Mon Sep 17 00:00:00 2001 From: Ohisemega Date: Sat, 11 Apr 2026 13:40:38 +0100 Subject: [PATCH 6/6] Fix Breaking Merge Changes Replace boost::shared_ptr with std::shared_ptr in BloscPlugin and BloscPluginTest. --- cpp/frameProcessor/include/BloscPlugin.h | 4 ++-- cpp/frameProcessor/src/BloscPlugin.cpp | 14 +++++++------- cpp/frameProcessor/test/BloscPluginTest.cpp | 12 ++++++------ 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/cpp/frameProcessor/include/BloscPlugin.h b/cpp/frameProcessor/include/BloscPlugin.h index 384e63f26..c22f03ebd 100644 --- a/cpp/frameProcessor/include/BloscPlugin.h +++ b/cpp/frameProcessor/include/BloscPlugin.h @@ -58,8 +58,8 @@ class BloscPlugin : public FrameProcessorPlugin { private: // Methods unique to this class - std::pair, bool> compress_frame(const boost::shared_ptr& frame); - std::pair, bool> decompress_frame(const boost::shared_ptr& frame); + std::pair, bool> compress_frame(const std::shared_ptr& frame); + std::pair, bool> decompress_frame(const std::shared_ptr& frame); void update_compression_settings(); friend struct Mode_map; enum class Mode { diff --git a/cpp/frameProcessor/src/BloscPlugin.cpp b/cpp/frameProcessor/src/BloscPlugin.cpp index 200086a46..ac2b53b3c 100644 --- a/cpp/frameProcessor/src/BloscPlugin.cpp +++ b/cpp/frameProcessor/src/BloscPlugin.cpp @@ -134,7 +134,7 @@ BloscPlugin::~BloscPlugin() * @param src_frame - source frame to compress * @return pair, bool> - shared_ptr to compressed frame and boolean indicating success/fail */ -std::pair, bool> BloscPlugin::compress_frame(const boost::shared_ptr& src_frame) +std::pair, bool> BloscPlugin::compress_frame(const std::shared_ptr& src_frame) { int compressed_size = 0; bool comp_res = false; @@ -152,9 +152,9 @@ std::pair, bool> BloscPlugin::compress_frame(const boos size_t dest_data_size = c_settings.uncompressed_size + BLOSC_MAX_OVERHEAD; - boost::shared_ptr dest_frame; + std::shared_ptr dest_frame; try { - dest_frame = boost::make_shared(dest_meta_data, dest_data_size); + dest_frame = std::make_shared(dest_meta_data, dest_data_size); LOG4CXX_DEBUG_LEVEL( 2, logger_, @@ -211,7 +211,7 @@ std::pair, bool> BloscPlugin::compress_frame(const boos * @param src_frame - source frame to decompress * @return pair, bool> - shared_ptr to decompressed frame and boolean indicating success/fail */ -std::pair, bool> BloscPlugin::decompress_frame(const boost::shared_ptr& src_frame) +std::pair, bool> BloscPlugin::decompress_frame(const std::shared_ptr& src_frame) { size_t dest_size = 0; size_t compressed_size; @@ -219,9 +219,9 @@ std::pair, bool> BloscPlugin::decompress_frame(const bo // get destination buffer size - dest_size blosc_cbuffer_sizes(src_frame->get_data_ptr(), &dest_size, &compressed_size, &block_size); bool decomp_res = false; - boost::shared_ptr dest_frame; + std::shared_ptr dest_frame; try { - dest_frame = boost::make_shared(src_frame->get_meta_data(), dest_size); + dest_frame = std::make_shared(src_frame->get_meta_data(), dest_size); LOG4CXX_DEBUG_LEVEL( 2, logger_, @@ -310,7 +310,7 @@ void BloscPlugin::process_frame(std::shared_ptr src_frame) this->current_acquisition_ = src_frame_acquisition_ID; this->update_compression_settings(); } - std::pair, bool> output_frame; + std::pair, bool> output_frame; output_frame.second = false; switch (this->plugin_mode_) { case Mode::COMPRESS: diff --git a/cpp/frameProcessor/test/BloscPluginTest.cpp b/cpp/frameProcessor/test/BloscPluginTest.cpp index a9fecf73f..deec906a7 100644 --- a/cpp/frameProcessor/test/BloscPluginTest.cpp +++ b/cpp/frameProcessor/test/BloscPluginTest.cpp @@ -15,7 +15,7 @@ class BloscPluginTestFixture { vec.fill(2398); blosc_plugin.set_name("BloscPluginTest"); - frame = boost::make_shared( + frame = std::make_shared( FrameProcessor::FrameMetaData { 7, "data", FrameProcessor::raw_32bit, @@ -39,11 +39,11 @@ class BloscPluginTestFixture { // register the frame to itself so we can get the BOOST_REQUIRE_NO_THROW(blosc_plugin.register_callback( blosc_plugin.get_name(), - boost::shared_ptr(&blosc_plugin, [](FrameProcessor::IFrameCallback*) { }) + std::shared_ptr(&blosc_plugin, [](FrameProcessor::IFrameCallback*) { }) )); } ~BloscPluginTestFixture() = default; - boost::shared_ptr frame; + std::shared_ptr frame; FrameProcessor::BloscPlugin blosc_plugin; }; @@ -58,7 +58,7 @@ BOOST_AUTO_TEST_CASE(BloscPlugin_compress_decompress) setup_blosc_config(cfg_, reply); // Compress Test BOOST_REQUIRE_NO_THROW(blosc_plugin.process_frame(frame)); - boost::shared_ptr compressed_frame = blosc_plugin.getWorkQueue()->remove(); + std::shared_ptr compressed_frame = blosc_plugin.getWorkQueue()->remove(); BOOST_CHECK(compressed_frame->get_image_size() < frame->get_image_size()); BOOST_TEST_MESSAGE( "Compressed frame size = " << compressed_frame->get_image_size() @@ -69,7 +69,7 @@ BOOST_AUTO_TEST_CASE(BloscPlugin_compress_decompress) BOOST_CHECK_NO_THROW(cfg_.set_param(FrameProcessor::BloscPlugin::CONFIG_BLOSC_MODE, std::string("decompress"))); BOOST_REQUIRE_NO_THROW(blosc_plugin.configure(cfg_, reply)); BOOST_REQUIRE_NO_THROW(blosc_plugin.process_frame(compressed_frame)); - boost::shared_ptr decompressed_frame = blosc_plugin.getWorkQueue()->remove(); + std::shared_ptr decompressed_frame = blosc_plugin.getWorkQueue()->remove(); BOOST_CHECK( decompressed_frame->get_image_size() > compressed_frame->get_image_size() && decompressed_frame->get_image_size() == frame->get_image_size() @@ -91,7 +91,7 @@ BOOST_AUTO_TEST_CASE(BloscPlugin_off) BOOST_CHECK_NO_THROW(cfg_.set_param(FrameProcessor::BloscPlugin::CONFIG_BLOSC_MODE, std::string("off"))); BOOST_REQUIRE_NO_THROW(blosc_plugin.configure(cfg_, reply)); BOOST_REQUIRE_NO_THROW(blosc_plugin.process_frame(frame)); - boost::shared_ptr same_frame = blosc_plugin.getWorkQueue()->remove(); + std::shared_ptr same_frame = blosc_plugin.getWorkQueue()->remove(); BOOST_CHECK( same_frame->get_image_size() == frame->get_image_size() && frame->get_data_ptr() == same_frame->get_data_ptr() );