// /* // * This Source Code Form is subject to the terms of the Mozilla Public // * License, v. 2.0. If a copy of the MPL was not distributed with this // * file, You can obtain one at https://mozilla.org/MPL/2.0/. // */ // /** // * @file BasicMessageQueue.cpp // * @brief class which encapsulates queue // * @author Christina Sander // * @date 25.06.2020 // * @copyright MPLv2 // */ // #include // #include // #include // template // WHISPER::threadSafeQueue threadSafeQueue(){ // } // // appends the given message to the message queue // template // void WHISPER::threadSafeQueue< T>::addElement(std::unique_ptr elem) // { // std::unique_lock lk(mx); // q.push( std::move(elem) ); // lk.unlock(); // condVar.notify_one(); // } // // gets a message from the queue // template // std::unique_ptr WHISPER::threadSafeQueue::getElement() // { // std::unique_lock lk(mx); // if( 0 == q.size() ) // { // lk.unlock(); // throw std::length_error("Empty Queue\n"); // } // std::unique_ptr elem = std::move( q.front() ); // q.pop(); // lk.unlock(); // return std::move(elem); // } // //returns the size of the message queue // template // unsigned int WHISPER::threadSafeQueue::size() // { // std::unique_lock lk(mx); // unsigned int size = q.size(); // lk.unlock(); // return size; // }