SStationListManager.h
Go to the documentation of this file.
1 #ifndef _fwk_SStationListManager_h_
2 #define _fwk_SStationListManager_h_
3 
4 #include <string>
5 #include <vector>
6 #include <iostream>
7 #include <det/VManager.h>
8 #include <sdet/SDetectorConstants.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 sdet {
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 = 0;
40  double fNorthing = 0;
41  double fEasting = 0;
42  double fAltitude = 0;
43  std::string fName;
44  std::string fCommissionTime;
45  std::string fUUBCommissionTime;
46  std::string fDecommissionTime;
47  int fIsUUB = 0;
48  int fHasSmallPMT = 0;
50  std::vector<bool> fInGrid;
51  int fGroupId = 0;
52  double fAxis1 = 0;
53  double fAxis2 = 0;
54  std::string fEllipsoid;
55  int fZone = 0;
56  std::string fBand;
57  private:
59 
60  friend class SStationListManager;
61  };
62 
89  template<typename T>
91  GetData(T& returnData,
92  const std::string& componentProperty,
93  const det::VManager::IndexMap& componentIndex) const;
94 
97 
98  bool HasStationData(const int id) const;
99 
100  bool DumpXML(std::ostream& output, const std::string& indent = "") const;
101 
102  private:
103  static int GetStationId(const det::VManager::IndexMap& componentIndex)
104  { return det::VManager::FindComponent<int>("stationId", componentIndex); }
105 
106  void GetFullStationList(std::vector<int>& returnList) const;
107 
108  void GetFullStationGroups(std::vector<std::vector<int> >& returnList) const;
109 
111  GetGroupIds(std::vector<int>& returnData) const;
112 
114  GetGroup(std::vector<int>& returnData, const int groupId) const;
115 
117  GetStationGroup(std::vector<int>& returnData, const int id) const;
118 
120  GetStationCrown(std::vector<int>& crown,
121  const int id,
122  const int nCrown,
124 
125  // index tags
126  struct ByStationId { };
127  struct ByGroupId { };
128  struct ByAxes { };
129 
130  typedef multi_index_container<
131  StationData,
132  indexed_by<
133  ordered_unique<
134  tag<ByStationId>, BOOST_MULTI_INDEX_MEMBER(StationData, int, fId)
135  >,
136  ordered_non_unique<
137  tag<ByGroupId>, BOOST_MULTI_INDEX_MEMBER(StationData, int, fGroupId)
138  >,
139  ordered_non_unique<
140  tag<ByAxes>,
141  composite_key<
142  StationData,
143  BOOST_MULTI_INDEX_MEMBER(StationData, double, fAxis1),
144  BOOST_MULTI_INDEX_MEMBER(StationData, double, fAxis2)
145  >
146  >
147  >
149 
150  typedef index<StationContainer, ByStationId>::type StationIdIndex;
151  typedef index<StationContainer, ByGroupId>::type GroupIdIndex;
152  typedef index<StationContainer, ByAxes>::type AxesIndex;
153 
155 
156  };
157 
158 }
159 
160 
161 #endif
det::VManager::Status GetStationGroup(std::vector< int > &returnData, const int id) const
Time interval defined by two TimeStamps.
Definition: TimeRange.h:23
index< StationContainer, ByStationId >::type StationIdIndex
int crown(double x1, double x2, double y1, double y2)
Definition: XbArray.cc:14
bool HasStationData(const int id) const
det::VManager::Status GetStationCrown(std::vector< int > &crown, const int id, const int nCrown, SDetectorConstants::GridIndex index=SDetectorConstants::eStandard) const
Get crown accoding to detector time and station commission time range.
static int GetStationId(const det::VManager::IndexMap &componentIndex)
index< StationContainer, ByAxes >::type AxesIndex
det::VManager::Status GetGroupIds(std::vector< int > &returnData) const
det::VManager::Status GetData(T &returnData, const std::string &componentProperty, const det::VManager::IndexMap &componentIndex) const
void GetFullStationGroups(std::vector< std::vector< int > > &returnList) const
index< StationContainer, ByGroupId >::type GroupIdIndex
det::VManager::Status GetGroup(std::vector< int > &returnData, const int groupId) const
Common implementation of the station list manager.
std::map< std::string, std::string > IndexMap
Definition: VManager.h:133
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
bool DumpXML(std::ostream &output, const std::string &indent="") const
void GetFullStationList(std::vector< int > &returnList) const
bool ConditionalAddStationData(StationData &station)
adds station record only if it does not already exist
Status
Specifies success or (eventually) various possible failure modes.
Definition: VManager.h:127

, generated on Tue Sep 26 2023.