#ifndef OPENPOSE_CORE_W_VERBOSE_PRINTER_HPP #define OPENPOSE_CORE_W_VERBOSE_PRINTER_HPP #include #include #include namespace op { template class WVerbosePrinter : public Worker { public: explicit WVerbosePrinter(const std::shared_ptr& verbosePrinter); virtual ~WVerbosePrinter(); void initializationOnThread(); void work(TDatums& tDatums); private: const std::shared_ptr spVerbosePrinter; DELETE_COPY(WVerbosePrinter); }; } // Implementation #include namespace op { template WVerbosePrinter::WVerbosePrinter( const std::shared_ptr& verbosePrinter) : spVerbosePrinter{verbosePrinter} { } template WVerbosePrinter::~WVerbosePrinter() { } template void WVerbosePrinter::initializationOnThread() { } template void WVerbosePrinter::work(TDatums& tDatums) { try { if (checkNoNullNorEmpty(tDatums)) { // Debugging log opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); // Profiling speed const auto profilerKey = Profiler::timerInit(__LINE__, __FUNCTION__, __FILE__); // Print verbose if (checkNoNullNorEmpty(tDatums)) { const auto tDatumPtr = (*tDatums)[0]; spVerbosePrinter->printVerbose(tDatumPtr->frameNumber); } // Profiling speed Profiler::timerEnd(profilerKey); Profiler::printAveragedTimeMsOnIterationX(profilerKey, __LINE__, __FUNCTION__, __FILE__); // Debugging log opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); } } catch (const std::exception& e) { this->stop(); tDatums = nullptr; error(e.what(), __LINE__, __FUNCTION__, __FILE__); } } COMPILE_TEMPLATE_DATUM(WVerbosePrinter); } #endif // OPENPOSE_CORE_W_VERBOSE_PRINTER_HPP