RStationListManager.h
Go to the documentation of this file.
1 #ifndef _revt_RStationListManager_h_
2 #define _revt_RStationListManager_h_
3 
4 #include <boost/multi_index_container.hpp>
5 #include <boost/multi_index/member.hpp>
6 #include <boost/multi_index/ordered_index.hpp>
7 #include <boost/multi_index/composite_key.hpp>
8 
9 #include <det/VManager.h>
10 #include <det/Detector.h>
11 
12 #include <utl/TimeRange.h>
13 
14 #include <string>
15 #include <vector>
16 #include <iostream>
17 
18 
19 namespace rdet {
20 
21  using ::boost::multi_index_container;
22  using ::boost::multi_index::index;
23 
40  public:
41  struct StationData {
42  int fId;
43  double fNorthing;
44  double fEasting;
45  double fAltitude;
46  std::string fName;
47  std::string fCommissionTime;
48  std::string fDecommissionTime;
49  std::string fEllipsoid;
50  std::string fBand;
51  int fInGrid;
52  int fZone;
56  std::string fSource;
58 
60  fId(0),
61  fNorthing(0),
62  fEasting(0),
63  fAltitude(0),
64  fName(""),
65  fCommissionTime(""),
67  fEllipsoid(""),
68  fBand(""),
69  fInGrid(0),
70  fZone(0),
71  fNChannels(0),
72  fFirstChannelId(0),
73  fLastChannelId(0),
74  fSource(""),
75  fIsVirtual(0)
76  { }
77 
78  private:
80 
81  /* enum DescriptionSourceType {
82  eNone,
83  eSQL,
84  eXML
85  }; */
86 
87  friend class RStationListManager;
88  };
89 
113  template<typename T>
115  GetData(T& returnData,
116  const std::string& componentProperty,
117  const det::VManager::IndexMap& componentIndex) const;
118 
120  bool ConditionalAddStationData(StationData& station);
121 
123  void AddOrReplaceStationData(StationData& station);
124 
126  bool RemoveStationData(StationData& station);
127 
128  bool HasStationData(const int id) const;
129 
130  bool DumpXML(std::ostream& output, const std::string& indent = "") const;
131 
132  void ClearStationList() { fStations.clear(); }
133 
135  void ClearStations(const std::string source_type);
136 
137  static int GetStationId(const det::VManager::IndexMap& componentIndex)
138  { return det::VManager::FindComponent<int>("stationId", componentIndex); }
139 
140  private:
141  void GetFullStationList(std::vector<int>& returnList) const;
142 
143  // index tags
144  struct ByStationId { };
145 
146  typedef multi_index_container<
147  StationData,
148  ::boost::multi_index::indexed_by<
149  ::boost::multi_index::ordered_unique<
150  ::boost::multi_index::tag<ByStationId>, BOOST_MULTI_INDEX_MEMBER(StationData, int, fId)
151  >
152  >
154 
155  typedef index<StationContainer, ByStationId>::type StationIdIndex;
156 
158 
159  };
160 
161 }
162 
163 
164 #endif
bool ConditionalAddStationData(StationData &station)
adds station record only if it does not already exist
bool RemoveStationData(StationData &station)
Removes station data if manager has station.
Time interval defined by two TimeStamps.
Definition: TimeRange.h:23
det::VManager::Status GetData(T &returnData, const std::string &componentProperty, const det::VManager::IndexMap &componentIndex) const
bool DumpXML(std::ostream &output, const std::string &indent="") const
void GetFullStationList(std::vector< int > &returnList) const
multi_index_container< StationData,::boost::multi_index::indexed_by< ::boost::multi_index::ordered_unique< ::boost::multi_index::tag< ByStationId >, BOOST_MULTI_INDEX_MEMBER(StationData, int, fId) > > > StationContainer
bool HasStationData(const int id) const
index< StationContainer, ByStationId >::type StationIdIndex
std::map< std::string, std::string > IndexMap
Definition: VManager.h:133
void ClearStations(const std::string source_type)
Removes all stations from fStations with fSource == source_type.
static int GetStationId(const det::VManager::IndexMap &componentIndex)
Common implementation of the station list manager.
void AddOrReplaceStationData(StationData &station)
adds station record and might overright old entry
Status
Specifies success or (eventually) various possible failure modes.
Definition: VManager.h:127

, generated on Tue Sep 26 2023.