CStationListManager.h
Go to the documentation of this file.
1 #ifndef _fwk_CStationListManager_h_
2 #define _fwk_CStationListManager_h_
3 
4 #include <string>
5 #include <vector>
6 #include <iostream>
7 #include <det/VManager.h>
8 #include <cdet/CDetectorConstants.h>
9 #include <boost/multi_index_container.hpp>
10 #include <boost/multi_index/member.hpp>
11 #include <boost/multi_index/ordered_index.hpp>
12 #include <boost/multi_index/composite_key.hpp>
13 #include <utl/TimeRange.h>
14 
15 
16 namespace cdet {
17 
18  using ::boost::multi_index_container;
19  using ::boost::multi_index::index;
20  using namespace ::boost::multi_index;
21 
22 
37  public:
38  struct StationData {
39  int fId;
40  double fNorthing;
41  double fEasting;
42  double fAltitude;
43  std::string fName;
44  std::string fCommissionTime;
45  std::string fDecommissionTime;
46  std::vector<bool> fInGrid;
47  int fGroupId;
48  double fAxis1;
49  double fAxis2;
50  std::string fEllipsoid;
51  int fZone;
52  std::string fBand;
53  private:
55 
56  friend class CStationListManager;
57  };
58 
85  template<typename T>
87  GetData(T& returnData,
88  const std::string& componentProperty,
89  const det::VManager::IndexMap& componentIndex) const;
90 
93 
94  bool HasStationData(const int id) const;
95 
96  bool DumpXML(std::ostream& output, const std::string& indent = "") const;
97 
98  private:
99  static int GetStationId(const det::VManager::IndexMap& componentIndex)
100  { return det::VManager::FindComponent<int>("stationId", componentIndex); }
101 
102  void GetFullStationList(std::vector<int>& returnList) const;
103 
104  void GetFullStationGroups(std::vector<std::vector<int> >& returnList) const;
105 
107  GetGroupIds(std::vector<int>& returnData) const;
108 
110  GetGroup(std::vector<int>& returnData, const int groupId) const;
111 
113  GetStationGroup(std::vector<int>& returnData, const int id) const;
114 
116  GetStationCrown(std::vector<int>& crown,
117  const int id,
118  const int nCrown,
120 
121  // index tags
122  struct ByStationId { };
123  struct ByGroupId { };
124  struct ByAxes { };
125 
126  typedef multi_index_container<
127  StationData,
128  indexed_by<
129  ordered_unique<
130  tag<ByStationId>, BOOST_MULTI_INDEX_MEMBER(StationData, int, fId)
131  >,
132  ordered_non_unique<
133  tag<ByGroupId>, BOOST_MULTI_INDEX_MEMBER(StationData, int, fGroupId)
134  >,
135  ordered_non_unique<
136  tag<ByAxes>,
137  composite_key<
138  StationData,
139  BOOST_MULTI_INDEX_MEMBER(StationData, double, fAxis1),
140  BOOST_MULTI_INDEX_MEMBER(StationData, double, fAxis2)
141  >
142  >
143  >
145 
146  typedef index<StationContainer, ByStationId>::type StationIdIndex;
147  typedef index<StationContainer, ByGroupId>::type GroupIdIndex;
148  typedef index<StationContainer, ByAxes>::type AxesIndex;
149 
151 
152  };
153 
154 }
155 
156 
157 #endif
158 
159 // Configure (x)emacs for this file ...
160 // Local Variables:
161 // mode: c++
162 // End:
index< StationContainer, ByGroupId >::type GroupIdIndex
bool DumpXML(std::ostream &output, const std::string &indent="") const
det::VManager::Status GetGroupIds(std::vector< int > &returnData) const
Time interval defined by two TimeStamps.
Definition: TimeRange.h:23
static int GetStationId(const det::VManager::IndexMap &componentIndex)
bool ConditionalAddStationData(StationData &station)
adds station record only if it does not already exist
int crown(double x1, double x2, double y1, double y2)
Definition: XbArray.cc:14
bool HasStationData(const int id) const
det::VManager::Status GetData(T &returnData, const std::string &componentProperty, const det::VManager::IndexMap &componentIndex) const
Common implementation of the station list manager.
void GetFullStationGroups(std::vector< std::vector< int > > &returnList) const
det::VManager::Status GetStationGroup(std::vector< int > &returnData, const int id) const
det::VManager::Status GetStationCrown(std::vector< int > &crown, const int id, const int nCrown, CDetectorConstants::GridIndex index=CDetectorConstants::eStandard) const
Get crown accoding to detector time and station commission time range.
index< StationContainer, ByAxes >::type AxesIndex
std::map< std::string, std::string > IndexMap
Definition: VManager.h:133
void GetFullStationList(std::vector< int > &returnList) const
multi_index_container< StationData, indexed_by< ordered_unique< tag< ByStationId >, BOOST_MULTI_INDEX_MEMBER(StationData, int, fId) >, ordered_non_unique< tag< ByGroupId >, BOOST_MULTI_INDEX_MEMBER(StationData, int, fGroupId) >, ordered_non_unique< tag< ByAxes >, composite_key< StationData, BOOST_MULTI_INDEX_MEMBER(StationData, double, fAxis1), > > > > StationContainer
det::VManager::Status GetGroup(std::vector< int > &returnData, const int groupId) const
index< StationContainer, ByStationId >::type StationIdIndex
Status
Specifies success or (eventually) various possible failure modes.
Definition: VManager.h:127

, generated on Tue Sep 26 2023.