Textractor_test/host/textthread.h
Akash Mozumdar db6b09a50e refactor
2018-08-24 11:32:10 -04:00

43 lines
793 B
C++

#pragma once
// textthread.h
// 8/23/2013 jichi
// Branch: ITH/TextThread.h, rev 120
#include "common.h"
#include "pipe.h"
class TextThread
{
typedef std::function<std::wstring(TextThread*, std::wstring)> ThreadOutputCallback;
public:
TextThread(ThreadParam tp, DWORD status);
virtual ~TextThread();
virtual std::wstring GetStore();
ThreadParam GetThreadParam() { return tp; }
void RegisterOutputCallBack(ThreadOutputCallback cb) { Output = cb; }
void AddText(const BYTE *con, int len);
void AddSentence(std::wstring sentence);
private:
bool Flush();
std::vector<char> buffer;
std::wstring storage;
std::recursive_mutex ttMutex;
HANDLE deletionEvent;
std::thread flushThread;
DWORD timestamp;
ThreadOutputCallback Output;
ThreadParam tp;
DWORD status;
};
// EOF