1 /*  $Id: osg_fetch.cpp 629837 2021-04-22 12:47:49Z ivanov $
2  * ===========================================================================
3  *
4  *                            PUBLIC DOMAIN NOTICE
5  *               National Center for Biotechnology Information
6  *
7  *  This software/database is a "United States Government Work" under the
8  *  terms of the United States Copyright Act.  It was written as part of
9  *  the author's official duties as a United States Government employee and
10  *  thus cannot be copyrighted.  This software/database is freely available
11  *  to the public for use. The National Library of Medicine and the U.S.
12  *  Government have not placed any restriction on its use or reproduction.
13  *
14  *  Although all reasonable efforts have been taken to ensure the accuracy
15  *  and reliability of the software and data, the NLM and the U.S.
16  *  Government do not and cannot warrant the performance or results that
17  *  may be obtained by using this software or data. The NLM and the U.S.
18  *  Government disclaim all warranties, express or implied, including
19  *  warranties of performance, merchantability or fitness for any particular
20  *  purpose.
21  *
22  *  Please cite the author in any work or product based on this material.
23  *
24  * ===========================================================================
25  *
26  * Authors: Eugene Vasilchenko
27  *
28  * File Description: class to keep single ID2 request/replies
29  *
30  */
31 
32 #include <ncbi_pch.hpp>
33 
34 #include "osg_fetch.hpp"
35 
36 #include <corelib/request_ctx.hpp>
37 #include <objects/id2/ID2_Request.hpp>
38 #include <objects/id2/ID2_Reply.hpp>
39 
40 
41 BEGIN_NCBI_NAMESPACE;
42 BEGIN_NAMESPACE(psg);
43 BEGIN_NAMESPACE(osg);
44 
45 
COSGFetch(CRef<CID2_Request> request,const CRef<CRequestContext> & context)46 COSGFetch::COSGFetch(CRef<CID2_Request> request,
47                      const CRef<CRequestContext>& context)
48     : m_Request(request),
49       m_Context(context),
50       m_Status(eIdle)
51 {
52     _ASSERT(request);
53 }
54 
55 
~COSGFetch()56 COSGFetch::~COSGFetch()
57 {
58 }
59 
60 
ResetReplies()61 void COSGFetch::ResetReplies()
62 {
63     m_Replies.clear();
64 }
65 
66 
AddReply(CRef<CID2_Reply> && reply)67 void COSGFetch::AddReply(CRef<CID2_Reply>&& reply)
68 {
69     _ASSERT(!EndOfReplies());
70     m_Replies.push_back(reply);
71 }
72 
73 
EndOfReplies() const74 bool COSGFetch::EndOfReplies() const
75 {
76     return !m_Replies.empty() && m_Replies.back()->IsSetEnd_of_reply();
77 }
78 
79 
80 END_NAMESPACE(osg);
81 END_NAMESPACE(psg);
82 END_NCBI_NAMESPACE;
83