1 /*  $Id: masked_range_set.hpp 163387 2009-06-15 18:32:16Z camacho $
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 * Author:  Kevin Bealer
27 *
28 */
29 
30 #ifndef _MASKED_RANGE_SET_HPP_
31 #define _MASKED_RANGE_SET_HPP_
32 
33 #include <objtools/blast/seqdb_writer/build_db.hpp>
34 
35 USING_NCBI_SCOPE;
36 USING_SCOPE(objects);
37 
38 /** @file masked_range_set.hpp
39   FIXME
40 */
41 
42 // First version will be simple -- it will use universal Seq-loc
43 // logic.  If performance is a problem then it might be best to have
44 // two containers, one with a Seq-loc key and one with an integer key.
45 
46 class CMaskedRangeSet : public IMaskDataSource {
47 public:
Insert(int algo_id,const CSeq_id & id,const CSeq_loc & v)48     void Insert(int              algo_id,
49                 const CSeq_id  & id,
50                 const CSeq_loc & v)
51     {
52         x_CombineLocs(x_Set(algo_id, CSeq_id_Handle::GetHandle(id)), v);
53     }
54 
55     virtual CMaskedRangesVector &
56     GetRanges(const list< CRef<CSeq_id> > & idlist);
57 
58 private:
59     void x_FindAndCombine(CConstRef<CSeq_loc> & L1, int algo_id,
60                           CSeq_id_Handle& id);
61 
62     static void x_CombineLocs(CConstRef<CSeq_loc> & L1, const CSeq_loc & L2);
63 
64     CConstRef<CSeq_loc> & x_Set(int algo_id, CSeq_id_Handle id);
65 
66     typedef map< CSeq_id_Handle, CConstRef<CSeq_loc> > TAlgoMap;
67 
68     CMaskedRangesVector m_Ranges;
69     vector< TAlgoMap > m_Values;
70 };
71 
72 #endif /* _MASKED_RANGE_SET_HPP_ */
73