CARMA C++
FastPdb.h
Go to the documentation of this file.
1 // $Id: FastPdb.h,v 1.1 2014/05/05 22:48:22 eml Exp $
2 
3 #ifndef SZA_UTIL_FASTPDB_H
4 #define SZA_UTIL_FASTPDB_H
5 
15 #include <map>
16 #include <string>
17 #include <vector>
18 
19 namespace sza {
20  namespace util {
21 
22  class FastPdb {
23  public:
24 
25  //------------------------------------------------------------
26  // Source enum
27  //------------------------------------------------------------
28 
29  enum EmlSrcType {
30  SRC_UNKNOWN,
31  SRC_SRC,
32  SRC_CAL
33  };
34 
35  //------------------------------------------------------------
36  // Frequency object
37  //------------------------------------------------------------
38 
39  struct EmlFreq {
40  double minFreq_;
41  double maxFreq_;
42 
43  EmlFreq();
44  EmlFreq(const EmlFreq& proj);
45  EmlFreq(EmlFreq& proj);
46 
47  void operator=(const EmlFreq& proj);
48  void operator=(EmlFreq& proj);
49  };
50 
51  //------------------------------------------------------------
52  // Source object
53  //------------------------------------------------------------
54 
55  struct EmlSrc {
56  std::string name_;
57  std::vector<EmlSrcType> types_;
58  EmlSrcType type_;
59 
60  static std::string typeString(FastPdb::EmlSrcType type);
61 
62  EmlSrc();
63  EmlSrc(const EmlSrc& proj);
64  EmlSrc(EmlSrc& proj);
65 
66  //------------------------------------------------------------
67  // Add the type if it doesn't already exist
68  //------------------------------------------------------------
69 
70  void addType(EmlSrcType type);
71  void operator=(const EmlSrc& proj);
72  void operator=(EmlSrc& proj);
73  };
74 
75  struct EmlTrial {
76  unsigned trialNo_;
77  std::string startDate_;
78  std::string stopDate_;
79  std::vector<EmlSrc> sources_;
80  std::vector<EmlFreq> freqs_;
81  std::map<std::string, EmlSrc*> srcMap_;
82 
83  void initialize();
84  EmlTrial();
85  EmlTrial(const EmlTrial& proj);
86  EmlTrial(EmlTrial& proj);
87 
88  //------------------------------------------------------------
89  // Add a source to this trial
90  //------------------------------------------------------------
91 
92  void addSource(EmlSrc& src);
93  void addFreq(EmlFreq& freq);
94  void operator=(const EmlTrial& proj);
95  void operator=(EmlTrial& proj);
96  };
97 
98  struct EmlSubObsblock {
99  std::string name_;
100  std::vector<EmlTrial> trials_;
101 
102  EmlSubObsblock();
103  EmlSubObsblock(const EmlSubObsblock& proj);
104  EmlSubObsblock(EmlSubObsblock& proj);
105  void operator=(const EmlSubObsblock& proj);
106  void operator=(EmlSubObsblock& proj);
107  };
108 
109  struct EmlObsblock {
110  std::string name_;
111  std::vector<EmlSubObsblock> subObsblocks_;
112  std::map<std::string, EmlSubObsblock*> subObsblockMap_;
113 
114  EmlObsblock();
115  EmlObsblock(const EmlObsblock& proj);
116  EmlObsblock(EmlObsblock& proj);
117  void operator=(const EmlObsblock& proj);
118  void operator=(EmlObsblock& proj);
119  };
120 
121  struct EmlProject {
122  std::string name_;
123  std::vector<EmlObsblock> obsblocks_;
124  std::map<std::string, EmlObsblock*> obsblockMap_;
125 
126  EmlProject();
127  EmlProject(const EmlProject& proj);
128  EmlProject(EmlProject& proj);
129 
130  void operator=(const EmlProject& proj);
131  void operator=(EmlProject& proj);
132  };
133 
137  FastPdb();
138 
142  virtual ~FastPdb();
143 
144  void createDatabase(std::string file);
145  std::string listTrialsMatchingProject(std::string project);
146  std::string listTrialsMatchingSource(std::string source, bool doFreq=false, double freq=0.0);
147  void listDatabase();
148 
149  private:
150 
151  bool html_;
152  std::vector<EmlProject> projects_;
153 
154  }; // End class FastPdb
155 
156  } // End namespace util
157 } // End namespace sza
158 
159 
160 
161 #endif // End #ifndef SZA_UTIL_FASTPDB_H