1 #ifndef _ASYNC_WRITERS_HPP_
2 #define _ASYNC_WRITERS_HPP_
50 template<
typename _token>
80 std::promise<TToken> exc_prom;
81 std::future<TToken> fut = exc_prom.get_future();
82 exc_prom.set_exception(_excp_ptr);
107 return std::async(std::launch::async, [
this, pull_next_token, process_func]()
112 while ((pull_next_token(token)))
165 template<
class _Token>
190 if (!token_future.valid()) {
196 token = token_future.get();
209 Write(topobject, get_next_entry);
221 while ((pull_next_token(token)))
249 if (!pull_next_token(token))
261 Write(topobject, get_next_entry);
typename _Pipeline::TPullNextFunction TPullNextFunction
void WriteAsyncMT(CConstRef< CSerialObject > topobject, TPullNextFunction pull_next_token, TProcessFunction process_func={}, TProcessFunction chain_func={})
void WriteAsyncST(CConstRef< CSerialObject > topobject, TPullNextFunction pull_next_token, TProcessFunction process_func={}, TProcessFunction chain_func={})
void WriteAsync2T(CConstRef< CSerialObject > topobject, TPullNextFunction pull_next_token, TProcessFunction process_func={}, TProcessFunction chain_func={})
void SetDepth(size_t depth)
typename _Pipeline::TProcessFunction TProcessFunction
CGenBankAsyncWriter(CObjectOStream *o_stream, EDuplicateIdPolicy policy=eReportAll)
std::future< void > m_writer_task
void PushNextEntry(CConstRef< CSeq_entry > entry)
EDuplicateIdPolicy m_DuplicateIdPolicy
void StartWriter(CConstRef< CSerialObject > topobject)
void Write(CConstRef< CSerialObject > topobject)
CMessageQueue< CConstRef< CSeq_entry > > m_write_queue
std::function< CConstRef< CSeq_entry >()> TGetNextFunction
Base class for all serializable objects.
std::function< void(TToken &)> TProcessFunction
void PostData(TToken data, TProcessFunction process_func)
void PostException(std::exception_ptr _excp_ptr)
std::future< TToken > TFuture
std::future< void > make_producer_task(TPullNextFunction pull_next_token, TProcessFunction process_func)
std::function< bool(TToken &)> TPullNextFunction
virtual ~TAsyncPipeline()
void push_back(value_type msg)
static unsigned char depth[2 *(256+1+29)+1]
void Write(CObjectOStream &out, TConstObjectPtr object, const CTypeRef &type)
#define END_SCOPE(ns)
End the previously defined scope.
#define BEGIN_SCOPE(ns)
Define a new scope.
#define NCBI_XOBJWRITE_EXPORT
Magic spell ;-) needed for some weird compilers... very empiric.
Portable reference counted smart and weak pointers using CWeakRef, CRef, CObject and CObjectEx.