BaseList.h
1 #ifndef BASELIST_H
2 #define BASELIST_H
3 
4 #include "TString.h"
5 #include <vector>
6 #include "AntarcticaGeometry.h"
7 
8 namespace BaseList{
9 
10 
11 
14  {
15 
16  public:
17 
18  virtual const char * getName() const = 0;
19  virtual const char * getSource() const = 0;
20  virtual AntarcticCoord getPosition(unsigned time) const = 0;
21  virtual bool isValid(unsigned time) const { (void) time; return true; }
22 
23  virtual ~abstract_base() { ; }
24  virtual void Draw(const char *opt = "m") const= 0;
25  };
26 
27 
28  class base : public abstract_base {
29  public:
30  base(const TString& theName, const TString& source, double lat, double lon, double alt=0)
31  : name(theName), dataSource(source), position(AntarcticCoord::WGS84, lat, lon, alt) {;}
32  base(const TString& theName, double lat, double lon, double alt=0)
33  : name(theName), dataSource(""), position(AntarcticCoord::WGS84, lat, lon, alt) {;}
34 
35  virtual ~base() { ; }
36 
37  TString name;
38  TString dataSource;
39  AntarcticCoord position;
40 
41  virtual AntarcticCoord getPosition(unsigned t) const {
42  (void) t;
43  return position.as(AntarcticCoord::WGS84);
44  }
45  virtual const char * getName() const { return name.Data(); }
46  virtual const char * getSource() const { return dataSource.Data(); }
47  virtual void Draw(const char * opt = "p") const;
48  };
49 
50 
52  class path : public abstract_base
53  {
54  public:
55  path(const TString & name, TString & source,
56  int npoints, const double * lat, const double * lon,
57  const double * alt, const unsigned * time) ;
58  virtual ~path() {; }
59 
60 
61  TString name;
62  TString dataSource;
63  Bool_t isFlight;
64 
65  std::vector<AntarcticCoord> ps;
66  std::vector<unsigned> ts;
67 
68  virtual const char * getSource() const { return dataSource.Data(); }
69  virtual const char * getName() const { return name.Data(); }
70  virtual AntarcticCoord getPosition(unsigned time) const;
71  virtual bool isValid(unsigned time) const { return time >= ts[0] && time < ts[ts.size()-1] ; }
72  virtual void Draw(const char * opt = "lp") const;
73 
78  bool operator()(const path& other){
79  return name == other.name;
80  }
81  };
82 
83 
85  const base& getBase(UInt_t i);
86 
88  const path& getPath(UInt_t i);
89 
91  const abstract_base & getAbstractBase(UInt_t i); //both
92 
93 
94  void makeBaseList(); //refills base lists if empty. This does both paths and bases.
95  void makeEmptyBaseList(); //makes base/path lists empty. Not sure why you would ever do this, but this is called somewhere...
96 
98  size_t getNumBases();
99 
101  size_t getNumPaths();
102 
104  size_t getNumAbstractBases();
105 
106 
115  int findBases(const char * query, std::vector<int> * all_matches = 0, bool include_paths = false);
116 
117 };
118 
119 
120 #endif // BASELIST_H
std::vector< AntarcticCoord > ps
true for flight, false for traverse
Definition: BaseList.h:65
bool operator()(const path &other)
Definition: BaseList.h:78