From 7ab11615f6df04da3885ff791ada2e4d858b75bf Mon Sep 17 00:00:00 2001 From: f4exb Date: Mon, 28 Feb 2022 23:32:23 +0100 Subject: [PATCH] Message pipes rework: renaming pipes2 to pipes --- plugins/channelrx/demodvorsc/vordemodsc.cpp | 4 ++-- plugins/feature/vorlocalizer/vorlocalizer.cpp | 2 +- sdrbase/CMakeLists.txt | 8 +++---- sdrbase/maincore.h | 6 ++--- .../{messagepipes2.cpp => messagepipes.cpp} | 24 +++++++++---------- .../pipes/{messagepipes2.h => messagepipes.h} | 20 ++++++++-------- ...2gcworker.cpp => messagepipesgcworker.cpp} | 12 +++++----- ...ipes2gcworker.h => messagepipesgcworker.h} | 12 +++++----- 8 files changed, 44 insertions(+), 44 deletions(-) rename sdrbase/pipes/{messagepipes2.cpp => messagepipes.cpp} (73%) rename sdrbase/pipes/{messagepipes2.h => messagepipes.h} (83%) rename sdrbase/pipes/{messagepipes2gcworker.cpp => messagepipesgcworker.cpp} (85%) rename sdrbase/pipes/{messagepipes2gcworker.h => messagepipesgcworker.h} (84%) diff --git a/plugins/channelrx/demodvorsc/vordemodsc.cpp b/plugins/channelrx/demodvorsc/vordemodsc.cpp index 12aca1fba..f3cb284d7 100644 --- a/plugins/channelrx/demodvorsc/vordemodsc.cpp +++ b/plugins/channelrx/demodvorsc/vordemodsc.cpp @@ -157,7 +157,7 @@ bool VORDemodSC::handleMessage(const Message& cmd) m_guiMessageQueue->push(msg); } - MessagePipes2& messagePipes = MainCore::instance()->getMessagePipes2(); + MessagePipes& messagePipes = MainCore::instance()->getMessagePipes2(); QList pipes; messagePipes.getMessagePipes(this, "report", pipes); @@ -178,7 +178,7 @@ bool VORDemodSC::handleMessage(const Message& cmd) m_guiMessageQueue->push(msg); } - MessagePipes2& messagePipes = MainCore::instance()->getMessagePipes2(); + MessagePipes& messagePipes = MainCore::instance()->getMessagePipes2(); QList pipes; messagePipes.getMessagePipes(this, "report", pipes); diff --git a/plugins/feature/vorlocalizer/vorlocalizer.cpp b/plugins/feature/vorlocalizer/vorlocalizer.cpp index 91fe360a0..0c3798b3e 100644 --- a/plugins/feature/vorlocalizer/vorlocalizer.cpp +++ b/plugins/feature/vorlocalizer/vorlocalizer.cpp @@ -336,7 +336,7 @@ void VORLocalizer::applySettings(const VORLocalizerSettings& settings, bool forc void VORLocalizer::updateChannels() { MainCore *mainCore = MainCore::instance(); - MessagePipes2& messagePipes = mainCore->getMessagePipes2(); + MessagePipes& messagePipes = mainCore->getMessagePipes2(); std::vector& deviceSets = mainCore->getDeviceSets(); std::vector::const_iterator it = deviceSets.begin(); m_availableChannels.clear(); diff --git a/sdrbase/CMakeLists.txt b/sdrbase/CMakeLists.txt index 5a247fba9..d190b530b 100644 --- a/sdrbase/CMakeLists.txt +++ b/sdrbase/CMakeLists.txt @@ -171,10 +171,10 @@ set(sdrbase_SOURCES pipes/datapipes.cpp pipes/datapipesgcworker.cpp pipes/messagepipeslegacy.cpp - pipes/messagepipes2.cpp + pipes/messagepipes.cpp pipes/messagepipeslegacycommon.cpp pipes/messagepipeslegacygcworker.cpp - pipes/messagepipes2gcworker.cpp + pipes/messagepipesgcworker.cpp pipes/messagequeuestore.cpp pipes/pipeendpoint.cpp pipes/objectpipe.cpp @@ -382,10 +382,10 @@ set(sdrbase_HEADERS pipes/elementpipescommon.h pipes/elementpipesgc.h pipes/messagepipeslegacy.h - pipes/messagepipes2.h + pipes/messagepipes.h pipes/messagepipeslegacycommon.h pipes/messagepipeslegacygcworker.h - pipes/messagepipes2gcworker.h + pipes/messagepipesgcworker.h pipes/messagequeuestore.h pipes/pipeendpoint.h pipes/objectpipe.h diff --git a/sdrbase/maincore.h b/sdrbase/maincore.h index 9f37565db..c608a8c87 100644 --- a/sdrbase/maincore.h +++ b/sdrbase/maincore.h @@ -28,7 +28,7 @@ #include "settings/mainsettings.h" #include "util/message.h" #include "pipes/messagepipeslegacy.h" -#include "pipes/messagepipes2.h" +#include "pipes/messagepipes.h" #include "pipes/datapipes.h" #include "channel/channelapi.h" @@ -732,7 +732,7 @@ public: void clearFeatures(FeatureSet *featureSet); // pipes MessagePipesLegacy& getMessagePipes() { return m_messagePipes; } - MessagePipes2& getMessagePipes2() { return m_messagePipes2; } + MessagePipes& getMessagePipes2() { return m_messagePipes2; } DataPipes& getDataPipes() { return m_dataPipes; } friend class MainServer; @@ -753,7 +753,7 @@ private: QMap m_featuresMap; //!< Feature to feature set map PluginManager* m_pluginManager; MessagePipesLegacy m_messagePipes; - MessagePipes2 m_messagePipes2; + MessagePipes m_messagePipes2; DataPipes m_dataPipes; void debugMaps(); diff --git a/sdrbase/pipes/messagepipes2.cpp b/sdrbase/pipes/messagepipes.cpp similarity index 73% rename from sdrbase/pipes/messagepipes2.cpp rename to sdrbase/pipes/messagepipes.cpp index 7f4202015..168cb07d6 100644 --- a/sdrbase/pipes/messagepipes2.cpp +++ b/sdrbase/pipes/messagepipes.cpp @@ -15,18 +15,18 @@ // along with this program. If not, see . // /////////////////////////////////////////////////////////////////////////////////// -#include "messagepipes2.h" -#include "messagepipes2gcworker.h" +#include "messagepipes.h" +#include "messagepipesgcworker.h" -MessagePipes2::MessagePipes2() : +MessagePipes::MessagePipes() : m_registrations(&m_messageQueueStore) { - m_gcWorker = new MessagePipes2GCWorker(m_registrations); + m_gcWorker = new MessagePipesGCWorker(m_registrations); m_gcWorker->moveToThread(&m_gcThread); startGC(); } -MessagePipes2::~MessagePipes2() +MessagePipes::~MessagePipes() { if (m_gcWorker->isRunning()) { stopGC(); @@ -35,32 +35,32 @@ MessagePipes2::~MessagePipes2() m_gcWorker->deleteLater(); } -ObjectPipe *MessagePipes2::registerProducerToConsumer(const QObject *producer, const QObject *consumer, const QString& type) +ObjectPipe *MessagePipes::registerProducerToConsumer(const QObject *producer, const QObject *consumer, const QString& type) { return m_registrations.registerProducerToConsumer(producer, consumer, type); } -ObjectPipe *MessagePipes2::unregisterProducerToConsumer(const QObject *producer, const QObject *consumer, const QString& type) +ObjectPipe *MessagePipes::unregisterProducerToConsumer(const QObject *producer, const QObject *consumer, const QString& type) { return m_registrations.unregisterProducerToConsumer(producer, consumer, type); } -void MessagePipes2::getMessagePipes(const QObject *producer, const QString& type, QList& pipes) +void MessagePipes::getMessagePipes(const QObject *producer, const QString& type, QList& pipes) { return m_registrations.getPipes(producer, type, pipes); } -void MessagePipes2::startGC() +void MessagePipes::startGC() { - qDebug("MessagePipes2::startGC"); + qDebug("MessagePipes::startGC"); m_gcWorker->startWork(); m_gcThread.start(); } -void MessagePipes2::stopGC() +void MessagePipes::stopGC() { - qDebug("MessagePipes2::stopGC"); + qDebug("MessagePipes::stopGC"); m_gcWorker->stopWork(); m_gcThread.quit(); m_gcThread.wait(); diff --git a/sdrbase/pipes/messagepipes2.h b/sdrbase/pipes/messagepipes.h similarity index 83% rename from sdrbase/pipes/messagepipes2.h rename to sdrbase/pipes/messagepipes.h index fe51edfd0..d8eacde45 100644 --- a/sdrbase/pipes/messagepipes2.h +++ b/sdrbase/pipes/messagepipes.h @@ -15,8 +15,8 @@ // along with this program. If not, see . // /////////////////////////////////////////////////////////////////////////////////// -#ifndef SDRBASE_PIPES_MESSAGEPIPES2_H_ -#define SDRBASE_PIPES_MESSAGEPIPES2_H_ +#ifndef SDRBASE_PIPES_MESSAGEPIPES_H_ +#define SDRBASE_PIPES_MESSAGEPIPES_H_ #include #include @@ -25,16 +25,16 @@ #include "objectpipesregistrations.h" #include "messagequeuestore.h" -class MessagePipes2GCWorker; +class MessagePipesGCWorker; -class SDRBASE_API MessagePipes2 : public QObject +class SDRBASE_API MessagePipes : public QObject { Q_OBJECT public: - MessagePipes2(); - MessagePipes2(const MessagePipes2&) = delete; - MessagePipes2& operator=(const MessagePipes2&) = delete; - ~MessagePipes2(); + MessagePipes(); + MessagePipes(const MessagePipes&) = delete; + MessagePipes& operator=(const MessagePipes&) = delete; + ~MessagePipes(); ObjectPipe *registerProducerToConsumer(const QObject *producer, const QObject *consumer, const QString& type); ObjectPipe *unregisterProducerToConsumer(const QObject *producer, const QObject *consumer, const QString& type); @@ -44,11 +44,11 @@ private: MessageQueueStore m_messageQueueStore; ObjectPipesRegistrations m_registrations; QThread m_gcThread; //!< Garbage collector thread - MessagePipes2GCWorker *m_gcWorker; //!< Garbage collector + MessagePipesGCWorker *m_gcWorker; //!< Garbage collector void startGC(); //!< Start garbage collector void stopGC(); //!< Stop garbage collector }; -#endif // SDRBASE_PIPES_MESSAGEPIPES2_H_ +#endif // SDRBASE_PIPES_MESSAGEPIPES_H_ diff --git a/sdrbase/pipes/messagepipes2gcworker.cpp b/sdrbase/pipes/messagepipesgcworker.cpp similarity index 85% rename from sdrbase/pipes/messagepipes2gcworker.cpp rename to sdrbase/pipes/messagepipesgcworker.cpp index 6591f060e..bdecb2a26 100644 --- a/sdrbase/pipes/messagepipes2gcworker.cpp +++ b/sdrbase/pipes/messagepipesgcworker.cpp @@ -15,31 +15,31 @@ // along with this program. If not, see . // /////////////////////////////////////////////////////////////////////////////////// -#include "messagepipes2gcworker.h" +#include "messagepipesgcworker.h" -MessagePipes2GCWorker::MessagePipes2GCWorker(ObjectPipesRegistrations& objectPipesRegistrations) : +MessagePipesGCWorker::MessagePipesGCWorker(ObjectPipesRegistrations& objectPipesRegistrations) : m_running(false), m_objectPipesRegistrations(objectPipesRegistrations) {} -MessagePipes2GCWorker::~MessagePipes2GCWorker() +MessagePipesGCWorker::~MessagePipesGCWorker() {} -void MessagePipes2GCWorker::startWork() +void MessagePipesGCWorker::startWork() { connect(&m_gcTimer, SIGNAL(timeout()), this, SLOT(processGC())); m_gcTimer.start(10000); // collect garbage every 10s m_running = true; } -void MessagePipes2GCWorker::stopWork() +void MessagePipesGCWorker::stopWork() { m_running = false; m_gcTimer.stop(); disconnect(&m_gcTimer, SIGNAL(timeout()), this, SLOT(processGC())); } -void MessagePipes2GCWorker::processGC() +void MessagePipesGCWorker::processGC() { m_objectPipesRegistrations.processGC(); } diff --git a/sdrbase/pipes/messagepipes2gcworker.h b/sdrbase/pipes/messagepipesgcworker.h similarity index 84% rename from sdrbase/pipes/messagepipes2gcworker.h rename to sdrbase/pipes/messagepipesgcworker.h index a34097315..d642c8fff 100644 --- a/sdrbase/pipes/messagepipes2gcworker.h +++ b/sdrbase/pipes/messagepipesgcworker.h @@ -15,8 +15,8 @@ // along with this program. If not, see . // /////////////////////////////////////////////////////////////////////////////////// -#ifndef SDRBASE_PIPES_MESSAGEPIPES2GCWORKER_H_ -#define SDRBASE_PIPES_MESSAGEPIPES2GCWORKER_H_ +#ifndef SDRBASE_PIPES_MESSAGEPIPESGCWORKER_H_ +#define SDRBASE_PIPES_MESSAGEPIPESGCWORKER_H_ #include #include @@ -24,12 +24,12 @@ #include "export.h" #include "objectpipesregistrations.h" -class SDRBASE_API MessagePipes2GCWorker : public QObject +class SDRBASE_API MessagePipesGCWorker : public QObject { Q_OBJECT public: - MessagePipes2GCWorker(ObjectPipesRegistrations& objectPipesRegistrations); - ~MessagePipes2GCWorker(); + MessagePipesGCWorker(ObjectPipesRegistrations& objectPipesRegistrations); + ~MessagePipesGCWorker(); void startWork(); void stopWork(); @@ -44,4 +44,4 @@ private slots: void processGC(); //!< Collect garbage }; -#endif // SDRBASE_PIPES_MESSAGEPIPES2GCWORKER_H_ +#endif // SDRBASE_PIPES_MESSAGEPIPESGCWORKER_H_