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>>>
18 TDatums
front()
const;
21 bool pop(TDatums& tDatums);
32 #include <type_traits>
35 template<
typename TDatums,
typename TQueue>
40 typedef typename TQueue::value_type underlyingValueType;
41 static_assert(std::is_same<TDatums, underlyingValueType>::value,
42 "Error: The type of the queue must be the same as the type of the container");
45 template<
typename TDatums,
typename TQueue>
50 template<
typename TDatums,
typename TQueue>
55 const std::lock_guard<std::mutex> lock{this->mMutex};
56 return this->mTQueue.top();
58 catch (
const std::exception& e)
60 error(e.what(), __LINE__, __FUNCTION__, __FILE__);
65 template<
typename TDatums,
typename TQueue>
70 if (this->mPopIsStopped || this->mTQueue.empty())
73 tDatums = {std::move(this->mTQueue.top())};
75 this->mConditionVariable.notify_one();
78 catch (
const std::exception& e)
80 error(e.what(), __LINE__, __FUNCTION__, __FILE__);
PriorityQueue(const long long maxSize=256)
COMPILE_TEMPLATE_DATUM(WPoseTriangulation)
OP_API void error(const std::string &message, const int line=-1, const std::string &function="", const std::string &file="")