1 #ifndef OPENPOSE_THREAD_QUEUE_HPP
2 #define OPENPOSE_THREAD_QUEUE_HPP
10 template<
typename TDatums,
typename TQueue = std::queue<TDatums>>
14 explicit Queue(
const long long maxSize);
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.front();
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.front())};
68 this->mConditionVariable.notify_one();
71 catch (
const std::exception& e)
73 error(e.what(), __LINE__, __FUNCTION__, __FILE__);
81 #endif // OPENPOSE_THREAD_QUEUE_HPP
Definition: queueBase.hpp:12
OP_API void error(const std::string &message, const int line=-1, const std::string &function="", const std::string &file="")
TDatums front() const
Definition: queue.hpp:44
Queue(const long long maxSize)
Definition: queue.hpp:34
COMPILE_TEMPLATE_DATUM(WPoseTriangulation)