1 #ifndef OPENPOSE_THREAD_W_QUEUE_ASSEMBLER_HPP
2 #define OPENPOSE_THREAD_W_QUEUE_ASSEMBLER_HPP
16 template<
typename TDatums>
26 void work(std::shared_ptr<TDatums>& tDatums);
29 std::shared_ptr<TDatums> mNextTDatums;
42 template<
typename TDatums>
47 template<
typename TDatums>
52 template<
typename TDatums>
57 template<
typename TDatums>
68 if (tDatums->size() > 1)
69 error(
"This function assumes that WQueueSplitter (inside WDatumProducer)"
70 " was applied in the first place, i.e., that there is only 1 element"
71 " per TDatums (size = " + std::to_string(tDatums->size()) +
").",
72 __LINE__, __FUNCTION__, __FILE__);
73 auto tDatumPtr = (*tDatums)[0];
75 if (tDatumPtr->subIdMax == 0)
78 if (mNextTDatums ==
nullptr)
79 mNextTDatums = std::make_shared<TDatums>();
81 mNextTDatums->emplace_back(tDatumPtr);
83 if (mNextTDatums->back()->subId == mNextTDatums->back()->subIdMax)
85 tDatums = mNextTDatums;
86 mNextTDatums =
nullptr;
99 std::this_thread::sleep_for(std::chrono::milliseconds{1});
101 catch (
const std::exception& e)
105 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()
virtual ~WQueueAssembler()
void work(std::shared_ptr< TDatums > &tDatums)
bool checkNoNullNorEmpty(const TPointerContainer &tPointerContainer)
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="")