53 : m_ostream{o_stream},
54 m_DuplicateIdPolicy{policy} {}
66 auto next_function = [
this]()
73 Write(topobj, next_function);
74 }, std::move(topobject));
98 if (duplicateIds.
empty()) {
101 string msg =
"duplicate Bioseq id";
102 if (duplicateIds.
size() > 1) {
105 for (
auto pId : duplicateIds) {
115 size_t bioseq_level = 0;
118 [&bioseq_level, get_next_entry]
122 if (bioseq_level == 1)
124 COStreamContainer out_container(out, object.GetTypeInfo());
125 CConstRef<CSeq_entry> entry;
126 while((entry = get_next_entry()))
129 out_container << *entry;
133 object.GetTypeInfo()->DefaultWriteData(out, object.GetObjectPtr());
139 TIdSet processedIds, duplicateIds;
146 out.WriteClassMember(member);
148 for (
auto pId : container) {
149 if (!processedIds.insert(pId).second) {
150 if (m_DuplicateIdPolicy == eThrowImmediately) {
154 duplicateIds.insert(pId);
161 m_ostream->Write(topobject, topobject->GetThisTypeInfo());
static void s_ReportDuplicateIds(const TIdSet &duplicateIds)
virtual ~CGenBankAsyncWriter()
std::future< void > m_writer_task
void PushNextEntry(CConstRef< CSeq_entry > entry)
void StartWriter(CConstRef< CSerialObject > topobject)
void Write(CConstRef< CSerialObject > topobject)
CMessageQueue< CConstRef< CSeq_entry > > m_write_queue
std::function< CConstRef< CSeq_entry >()> TGetNextFunction
CObjectOStream * m_ostream
std::ofstream out("events_result.xml")
main entry point for tests
#define NCBI_THROW(exception_class, err_code, message)
Generic macro to throw an exception, given the exception class, error code and message string.
virtual const CTypeInfo * GetThisTypeInfo(void) const =0
string GetLabel(const CSeq_id &id)
static C * GetUnchecked(const CObjectInfo &object)
CMemberIterator FindMember(const string &memberName) const
Find class member by its name.
void Write(const CConstObjectInfo &object)
#define END_SCOPE(ns)
End the previously defined scope.
#define BEGIN_SCOPE(ns)
Define a new scope.
Magic spell ;-) needed for some weird compilers... very empiric.
void SetLocalWriteHook(const CObjectTypeInfo &obj_type_info, CObjectOStream &ostr, _Func _func)
Compare objects pointed to by (smart) pointer.