NCBI C++ ToolKit
cuRowSourceTable.hpp
Go to the documentation of this file.

Go to the SVN repository for this file.

1 #ifndef CU_ROW_SOURCE_TABLE_HPP
2 #define CU_ROW_SOURCE_TABLE_HPP
3 
4 //#include <algo/structure/cd_utils/cuCppNCBI.hpp>
8 BEGIN_SCOPE(cd_utils)
9 
10 struct RowSource
11 {
12  RowSource() : cd(0), normal(false), rowInSrc(-1), master(false){}
13  RowSource(CCdCore* cd, int row, bool norm):cd(cd), normal(norm), rowInSrc(row)
14  {master = (row==0) && normal;}
15  RowSource(const RowSource& rhs):cd(rhs.cd), normal(rhs.normal), rowInSrc(rhs.rowInSrc), master(rhs.master){}
16 
17  bool isPending() const { return !normal;}
18  bool wasMaster() const {return master;}
20  bool normal; //normal or pending
21  int rowInSrc; // row in the source cd
22  bool master;
23 };
24 
27 {
28 public:
30 
31  void addEntry(int row, CCdCore* cd, int rowInCD, bool normal=true, bool scoped = true);
32  void addEntry(int row, RowSource rs, bool scoped = true);
33  int findEntries(int row, vector<RowSource>& src, bool scopedOnly=false)const;
34  void removeEntriesForCD(vector<int>& colRows, CCdCore* cd);
35  const RowSource& findEntry(int row)const ;
36  RowSource& findEntry(int row);
37  //int findEntriesBySourceCD(const CCdCore* cd, vector<int> rows)const;
38  //int findRowBySource(const RowSource& rs)const;
39  bool isPending(int row)const;
40  void getMasterRows(vector<int>& masters);
41  //get all CDs involved in this AlignmentCollection
42  int getCDs(vector<CCdCore*>& cds);
43  //get only CDs whose alignment rows are included
44  int getCDsInScope(vector<CCdCore*>& cds);
45  //get CDs which are only used to map row membership of duplicated SeqLoc
46  int getCDsOutofScope(vector<CCdCore*>& cds);
47  bool isCDInScope(CCdCore* cd)const;
48  bool isEntryInScope(const RowSource& rs)const;
49  void clear();
50  void convertFromCDRows(CCdCore* cd, const vector<int>& cdRows, set<int>& colRows)const;
51  int convertFromCDRow(CCdCore* cd, int cdRows)const;
52  void convertToCDRows(const vector<int>& colRows, CDRowsMap& cdRows) const;
53 
54  //void getAllRowsForCD(CCdCore* cd, vector<int>& colRows)const;
55  bool isRowInCD(int row, CCdCore* cd)const;
56 private:
62  //pending row starts at CCdCore::PENDING_ROW_START
63  string makeCDRowKey(CCdCore* cd, int row)const ;
64  //necessary indice to speed lookup
67 
68  void transferCDs(const set<CCdCore*>& cdSet, vector<CCdCore*>& cdVec);
69 };
70 
71 END_SCOPE(cd_utils)
73 #endif
74 
75 
multimap< int, RowSource > RowSourceMap
set< int > m_masters
CDRowIndexMap m_cdRowIndexMap
set< CCdCore * > m_cdsInScope
RowSourceMap m_table
map< string, int > CDRowIndexMap
set< CCdCore * > m_cdsOutofScope
Definition: map.hpp:338
USING_SCOPE(objects)
map< CCdCore *, vector< int > > CDRowsMap
#define false
Definition: bool.h:36
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define END_SCOPE(ns)
End the previously defined scope.
Definition: ncbistl.hpp:75
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
#define BEGIN_SCOPE(ns)
Define a new scope.
Definition: ncbistl.hpp:72
#define NCBI_CDUTILS_EXPORT
Definition: ncbi_export.h:376
#define row(bind, expected)
Definition: string_bind.c:73
bool isPending() const
RowSource(CCdCore *cd, int row, bool norm)
RowSource(const RowSource &rhs)
bool wasMaster() const
CCdCore * cd
Modified on Sun Apr 21 03:41:52 2024 by modify_doxy.py rev. 669887