1 #ifndef OPENPOSE_PRODUCER_W_DATUM_PRODUCER_HPP
2 #define OPENPOSE_PRODUCER_W_DATUM_PRODUCER_HPP
12 template<
typename TDatum>
22 std::shared_ptr<std::vector<std::shared_ptr<TDatum>>>
workProducer();
25 std::shared_ptr<DatumProducer<TDatum>> spDatumProducer;
26 std::queue<std::shared_ptr<std::vector<std::shared_ptr<TDatum>>>> mQueuedElements;
40 template<
typename TDatum>
43 spDatumProducer{datumProducer}
47 template<
typename TDatum>
53 template<
typename TDatum>
58 template<
typename TDatum>
68 std::shared_ptr<std::vector<std::shared_ptr<TDatum>>> tDatums;
70 if (mQueuedElements.empty())
73 std::tie(isRunning, tDatums) = spDatumProducer->checkIfRunningAndGetDatum();
85 if (tDatums !=
nullptr && tDatums->size() > 1)
88 for (
auto i = 0u ; i < tDatums->size() ; i++)
90 auto& tDatumPtr = (*tDatums)[i];
92 tDatumPtr->subIdMax = tDatums->size()-1;
93 mQueuedElements.emplace(
94 std::make_shared<std::vector<std::shared_ptr<TDatum>>>(
95 std::vector<std::shared_ptr<TDatum>>{tDatumPtr}));
99 if (!mQueuedElements.empty())
101 tDatums = mQueuedElements.front();
102 mQueuedElements.pop();
107 catch (
const std::exception& e)
110 error(e.what(), __LINE__, __FUNCTION__, __FILE__);
static void printAveragedTimeMsOnIterationX(const std::string &key, const int line, const std::string &function, const std::string &file, const unsigned long long x=DEFAULT_X)
static const std::string timerInit(const int line, const std::string &function, const std::string &file)
static void timerEnd(const std::string &key)
void initializationOnThread()
WDatumProducer(const std::shared_ptr< DatumProducer< TDatum >> &datumProducer)
virtual ~WDatumProducer()
std::shared_ptr< std::vector< std::shared_ptr< TDatum > > > workProducer()
OP_API void error(const std::string &message, const int line=-1, const std::string &function="", const std::string &file="")
void opLogIfDebug(const T &message, const Priority priority=Priority::Max, const int line=-1, const std::string &function="", const std::string &file="")