1 #ifndef OPENPOSE_THREAD_PRIORITY_QUEUE_HPP
2 #define OPENPOSE_THREAD_PRIORITY_QUEUE_HPP
10 template<
typename TDatums,
typename TQueue = std::priority_queue<TDatums, std::vector<TDatums>, std::greater<TDatums>>>
16 TDatums
front()
const;
19 bool pop(TDatums& tDatums);
30 #include <type_traits>
33 template<
typename TDatums,
typename TQueue>
38 typedef typename TQueue::value_type underlyingValueType;
39 static_assert(std::is_same<TDatums, underlyingValueType>::value,
40 "Error: The type of the queue must be the same as the type of the container");
43 template<
typename TDatums,
typename TQueue>
48 const std::lock_guard<std::mutex> lock{this->mMutex};
49 return this->mTQueue.top();
51 catch (
const std::exception& e)
53 error(e.what(), __LINE__, __FUNCTION__, __FILE__);
58 template<
typename TDatums,
typename TQueue>
63 if (this->mPopIsStopped || this->mTQueue.empty())
66 tDatums = {std::move(this->mTQueue.top())};
68 this->mConditionVariable.notify_one();
71 catch (
const std::exception& e)
73 error(e.what(), __LINE__, __FUNCTION__, __FILE__);
81 #endif // OPENPOSE_THREAD_PRIORITY_QUEUE_HPP
Definition: queueBase.hpp:12
PriorityQueue(const long long maxSize=256)
Definition: priorityQueue.hpp:34
OP_API void error(const std::string &message, const int line=-1, const std::string &function="", const std::string &file="")
TDatums front() const
Definition: priorityQueue.hpp:44
Definition: priorityQueue.hpp:11
COMPILE_TEMPLATE_DATUM(WPoseTriangulation)