no class is derived from container

pull/1/head
Tom Early 6 years ago
parent c92db03398
commit e6f4096f2c

@ -4,6 +4,7 @@
// //
// Created by Jean-Luc on 05/12/2015. // Created by Jean-Luc on 05/12/2015.
// Copyright © 2015 Jean-Luc. All rights reserved. // Copyright © 2015 Jean-Luc. All rights reserved.
// Copyright © 2020 Thomas A. Early, N7TAE
// //
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// This file is part of xlxd. // This file is part of xlxd.
@ -27,6 +28,9 @@
#ifndef cnotificationqueue_h #ifndef cnotificationqueue_h
#define cnotificationqueue_h #define cnotificationqueue_h
#include <queue>
#include <mutex>
#include "cnotification.h" #include "cnotification.h"
@ -35,22 +39,29 @@
//////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////
// class // class
class CNotificationQueue : public std::queue<CNotification> class CNotificationQueue
{ {
public: public:
// constructor // constructor
CNotificationQueue() {}; CNotificationQueue() {}
// destructor // destructor
~CNotificationQueue() {}; ~CNotificationQueue() {}
// lock // lock
void Lock() { m_Mutex.lock(); } void Lock() { m_Mutex.lock(); }
void Unlock() { m_Mutex.unlock(); } void Unlock() { m_Mutex.unlock(); }
// pass thru
CNotification front() { return queue.front(); }
void pop() { queue.pop(); }
void push(CNotification note) { queue.push(note); }
bool empty() const { return queue.empty(); }
protected: protected:
// data // data
std::mutex m_Mutex; std::mutex m_Mutex;
std::queue<CNotification> queue;
}; };
//////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////

@ -4,6 +4,7 @@
// //
// Created by Jean-Luc Deltombe (LX3JL) on 02/11/2015. // Created by Jean-Luc Deltombe (LX3JL) on 02/11/2015.
// Copyright © 2015 Jean-Luc Deltombe (LX3JL). All rights reserved. // Copyright © 2015 Jean-Luc Deltombe (LX3JL). All rights reserved.
// Copyright © 2020 Thomas A. Early, N7TAE
// //
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// This file is part of xlxd. // This file is part of xlxd.
@ -35,18 +36,33 @@
class CClient; class CClient;
class CPacketQueue : public std::queue<CPacket *> class CPacketQueue
{ {
public: public:
// constructor // constructor
CPacketQueue() {}; CPacketQueue() {}
// destructor // destructor
~CPacketQueue() {}; ~CPacketQueue()
{
Lock();
while (! queue.empty())
{
delete queue.front();
queue.pop();
}
Unlock();
}
// lock // lock
void Lock() { m_Mutex.lock(); } void Lock() { m_Mutex.lock(); }
void Unlock() { m_Mutex.unlock(); } void Unlock() { m_Mutex.unlock(); }
// pass thru
CPacket *front() { return queue.front(); }
void pop() { queue.pop(); }
void push(CPacket *packet) { queue.push(packet); }
bool empty() const { return queue.empty(); }
protected: protected:
// status // status
@ -55,7 +71,8 @@ protected:
std::mutex m_Mutex; std::mutex m_Mutex;
// owner // owner
CClient *m_Client; CClient *m_Client;
std::queue<CPacket *> queue;
}; };
//////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////

@ -4,6 +4,7 @@
// //
// Created by Jean-Luc Deltombe (LX3JL) on 09/10/2019. // Created by Jean-Luc Deltombe (LX3JL) on 09/10/2019.
// Copyright © 2019 Jean-Luc Deltombe (LX3JL). All rights reserved. // Copyright © 2019 Jean-Luc Deltombe (LX3JL). All rights reserved.
// Copyright © 2020 Thomas A. Early, N7TAE
// //
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// This file is part of xlxd. // This file is part of xlxd.
@ -33,22 +34,29 @@
//////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////
// class // class
class CWiresxCmdQueue : public std::queue<CWiresxCmd> class CWiresxCmdQueue
{ {
public: public:
// constructor // constructor
CWiresxCmdQueue() {}; CWiresxCmdQueue() {}
// destructor // destructor
~CWiresxCmdQueue() {}; ~CWiresxCmdQueue() {}
// lock // lock
void Lock() { m_Mutex.lock(); } void Lock() { m_Mutex.lock(); }
void Unlock() { m_Mutex.unlock(); } void Unlock() { m_Mutex.unlock(); }
// pass thru
CWiresxCmd front() { return queue.front(); }
void pop() { queue.pop(); }
void push(CWiresxCmd cmd) { queue.push(cmd); }
bool empty() const { return queue.empty(); }
protected: protected:
// status // status
std::mutex m_Mutex; std::mutex m_Mutex;
std::queue<CWiresxCmd> queue;
}; };
//////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////

@ -4,6 +4,7 @@
// //
// Created by Jean-Luc Deltombe (LX3JL) on 09/10/2019. // Created by Jean-Luc Deltombe (LX3JL) on 09/10/2019.
// Copyright © 2019 Jean-Luc Deltombe (LX3JL). All rights reserved. // Copyright © 2019 Jean-Luc Deltombe (LX3JL). All rights reserved.
// Copyright © 2020 Thomas A. Early, N7TAE
// //
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// This file is part of xlxd. // This file is part of xlxd.
@ -32,22 +33,29 @@
//////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////
// class // class
class CWiresxPacketQueue : public std::queue<CWiresxPacket> class CWiresxPacketQueue
{ {
public: public:
// constructor // constructor
CWiresxPacketQueue() {}; CWiresxPacketQueue() {}
// destructor // destructor
~CWiresxPacketQueue() {}; ~CWiresxPacketQueue() {}
// lock // lock
void Lock() { m_Mutex.lock(); } void Lock() { m_Mutex.lock(); }
void Unlock() { m_Mutex.unlock(); } void Unlock() { m_Mutex.unlock(); }
// pass thru
CWiresxPacket front() { return queue.front(); }
void pop() { queue.pop(); }
void push(CWiresxPacket packet) { queue.push(packet); }
bool empty() const { return queue.empty(); }
protected: protected:
// status // status
std::mutex m_Mutex; std::mutex m_Mutex;
std::queue<CWiresxPacket> queue;
}; };
//////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////

Loading…
Cancel
Save

Powered by TurnKey Linux.