Heads.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 /// \file Heads.h
3 /// \brief Mapping from a subset of the library to their best matches
4 /// \author Christopher Backhouse - bckhouse@caltech.edu
5 ////////////////////////////////////////////////////////////////////////
6 
7 #ifndef LEM_HEADS_H
8 #define LEM_HEADS_H
9 
10 #include <ostream>
11 #include <string>
12 
13 namespace lem
14 {
15  /// Mapping from a subset of the library to their best matches
16  class Heads
17  {
18  public:
19  static Heads* FromMMap(const std::string& libPath, bool touchAll);
20  static Heads* FromMMapOnDemand(const std::string& libPath);
21 
22  ~Heads();
23 
24  friend std::ostream& operator<<(std::ostream&, const lem::Heads&);
25 
26  int NHeads() const {return fNHeads;}
27  int HeadIdx(int i) const {return fHeadIdxs[i];}
28  int HeadSeqsLen() const {return fHeadSeqsLen;}
29  int ChildIdxFor(int head, int child) const;
30  bool FlipEvenFor(int head, int child) const;
31  bool FlipOddFor(int head, int child) const;
32 
33  protected:
34  Heads() {}
35  Heads(const Heads&);
36  Heads& operator=(const Heads&);
37 
38  int fNHeads;
39  int* fHeadIdxs;
41  int** fHeadSeqs;
42 
44  };
45 
47  {
48  public:
49  static HeadsTranspose* FromMMap(const std::string& libPath);
50  static HeadsTranspose* FromMMapOnDemand(const std::string& libPath);
51 
52  ~HeadsTranspose();
53 
54  friend std::ostream& operator<<(std::ostream&, const lem::HeadsTranspose&);
55 
56  int NHeads() const {return fNHeads;}
57  int HeadIdx(int i) const {return fHeadIdxs[i];}
58 
59  int* pHeadSeqs() const {return fPSeqs;}
60 
61  protected:
65 
66  int fNHeads;
67  int fLibSize;
68  int* fHeadIdxs;
69  int* fPSeqs;
70 
72  };
73 
74  std::ostream& operator<<(std::ostream& os, const lem::Heads& hs);
75  std::ostream& operator<<(std::ostream& os, const lem::HeadsTranspose& hs);
76 }
77 
78 #endif
static Heads * FromMMapOnDemand(const std::string &libPath)
Definition: Heads.cxx:49
long fMappingSize
Definition: Heads.h:71
int ChildIdxFor(int head, int child) const
Definition: Heads.cxx:78
bool FlipEvenFor(int head, int child) const
Definition: Heads.cxx:85
int ** fHeadSeqs
Definition: Heads.h:41
Heads()
Definition: Heads.h:34
PID
Definition: FillPIDs.h:14
~Heads()
Definition: Heads.cxx:71
int * fHeadIdxs
Definition: Heads.h:68
int fHeadSeqsLen
Definition: Heads.h:40
bool FlipOddFor(int head, int child) const
Definition: Heads.cxx:92
int HeadIdx(int i) const
Definition: Heads.h:57
Mapping from a subset of the library to their best matches.
Definition: Heads.h:16
int NHeads() const
Definition: Heads.h:56
int * pHeadSeqs() const
Definition: Heads.h:59
int HeadSeqsLen() const
Definition: Heads.h:28
int NHeads() const
Definition: Heads.h:26
friend std::ostream & operator<<(std::ostream &, const lem::Heads &)
Definition: Heads.cxx:140
long fMappingSize
Definition: Heads.h:43
int fNHeads
Definition: Heads.h:38
Heads & operator=(const Heads &)
int * fHeadIdxs
Definition: Heads.h:39
static Heads * FromMMap(const std::string &libPath, bool touchAll)
Definition: Heads.cxx:23
int HeadIdx(int i) const
Definition: Heads.h:27
enum BeamMode string