1 #ifndef OBJECTS_OBJMGR_IMPL___SYNONYMS__HPP 2 #define OBJECTS_OBJMGR_IMPL___SYNONYMS__HPP 3 4 /* $Id: synonyms.hpp 446824 2014-09-18 14:47:47Z vasilche $ 5 * =========================================================================== 6 * 7 * PUBLIC DOMAIN NOTICE 8 * National Center for Biotechnology Information 9 * 10 * This software/database is a "United States Government Work" under the 11 * terms of the United States Copyright Act. It was written as part of 12 * the author's official duties as a United States Government employee and 13 * thus cannot be copyrighted. This software/database is freely available 14 * to the public for use. The National Library of Medicine and the U.S. 15 * Government have not placed any restriction on its use or reproduction. 16 * 17 * Although all reasonable efforts have been taken to ensure the accuracy 18 * and reliability of the software and data, the NLM and the U.S. 19 * Government do not and cannot warrant the performance or results that 20 * may be obtained by using this software or data. The NLM and the U.S. 21 * Government disclaim all warranties, express or implied, including 22 * warranties of performance, merchantability or fitness for any particular 23 * purpose. 24 * 25 * Please cite the author in any work or product based on this material. 26 * 27 * =========================================================================== 28 * 29 * Author: Aleksey Grichenko 30 * 31 * File Description: 32 * Set of seq-id synonyms for CScope cache 33 * 34 */ 35 36 #include <corelib/ncbiobj.hpp> 37 #include <objects/seq/seq_id_handle.hpp> 38 #include <vector> 39 #include <utility> 40 41 BEGIN_NCBI_SCOPE 42 BEGIN_SCOPE(objects) 43 44 class CBioseq_ScopeInfo; 45 class CBioseq_Handle; 46 47 //////////////////////////////////////////////////////////////////// 48 // 49 // CSynonymsSet:: 50 // 51 // Set of seq-id synonyms for CScope cache 52 // 53 54 class NCBI_XOBJMGR_EXPORT CSynonymsSet : public CObject 55 { 56 public: 57 typedef CSeq_id_Handle value_type; 58 typedef vector<value_type> TIdSet; 59 typedef TIdSet::const_iterator const_iterator; 60 61 CSynonymsSet(void); 62 ~CSynonymsSet(void); 63 64 const_iterator begin(void) const; 65 const_iterator end(void) const; 66 bool empty(void) const; 67 68 static CSeq_id_Handle GetSeq_id_Handle(const const_iterator& iter); 69 70 void AddSynonym(const value_type& syn); 71 bool ContainsSynonym(const CSeq_id_Handle& id) const; 72 73 private: 74 // Prohibit copy functions 75 CSynonymsSet(const CSynonymsSet&); 76 CSynonymsSet& operator=(const CSynonymsSet&); 77 78 TIdSet m_IdSet; 79 }; 80 81 ///////////////////////////////////////////////////////////////////// 82 // 83 // Inline methods 84 // 85 ///////////////////////////////////////////////////////////////////// 86 87 88 inline begin(void) const89CSynonymsSet::const_iterator CSynonymsSet::begin(void) const 90 { 91 return m_IdSet.begin(); 92 } 93 94 95 inline end(void) const96CSynonymsSet::const_iterator CSynonymsSet::end(void) const 97 { 98 return m_IdSet.end(); 99 } 100 101 102 inline empty(void) const103bool CSynonymsSet::empty(void) const 104 { 105 return m_IdSet.empty(); 106 } 107 108 109 END_SCOPE(objects) 110 END_NCBI_SCOPE 111 112 #endif /* OBJECTS_OBJMGR_IMPL___SYNONYMS__HPP */ 113