SEvent.h
Go to the documentation of this file.
1 #ifndef _sevt_SEvent_h_
2 #define _sevt_SEvent_h_
3 
4 #include <sevt/SEventSimData.h>
5 #include <utl/LameShadowPtr.h>
6 #include <utl/IteratorRange.h>
7 #include <sevt/Station.h>
8 #include <sevt/Header.h>
9 
10 #include <boost/iterator/indirect_iterator.hpp>
11 #include <boost/iterator/filter_iterator.hpp>
12 
13 #include <vector>
14 #include <map>
15 #include <algorithm>
16 
17 
18 namespace evt {
19  class Event;
20 }
21 
22 namespace sevt {
23 
24  //class Station;
25  class EventTrigger;
26  class Meteo;
27 
28 
39  class SEvent {
40 
41  private:
42  typedef std::vector<Station*> InternalStationCollection;
43  typedef InternalStationCollection::iterator InternalStationIterator;
44  typedef InternalStationCollection::const_iterator InternalConstStationIterator;
45 
46  public:
47  SEvent(const SEvent& sEvent) { *this = sEvent; }
48  SEvent& operator=(const SEvent& sEvent);
49 
51  typedef boost::indirect_iterator<InternalStationIterator,
53  typedef boost::indirect_iterator<InternalConstStationIterator,
55 
65 
66 
67  typedef boost::filter_iterator<CandidateStationFilter,
69  typedef boost::filter_iterator<CandidateStationFilter,
71 
72  CandidateStationIterator CandidateStationsBegin()
81 
82 
83  typedef boost::filter_iterator<SilentStationFilter,
85  typedef boost::filter_iterator<SilentStationFilter,
87 
88  SilentStationIterator SilentStationsBegin()
97 
98 
99  typedef boost::filter_iterator<RejectedStationFilter,
101  typedef boost::filter_iterator<RejectedStationFilter,
103 
104  // DV: maybe in the future the rejectionMask should be replaced with an expression template
105  RejectedStationIterator RejectedStationsBegin(const int rejectionMask = ~0)
106  { return RejectedStationIterator(RejectedStationFilter(rejectionMask), StationsBegin(), StationsEnd()); }
107  RejectedStationIterator RejectedStationsEnd(const int rejectionMask = ~0)
108  { return RejectedStationIterator(RejectedStationFilter(rejectionMask), StationsEnd(), StationsEnd()); }
109  ConstRejectedStationIterator RejectedStationsBegin(const int rejectionMask = ~0) const
111  ConstRejectedStationIterator RejectedStationsEnd(const int rejectionMask = ~0) const
114 
115 
116  Station& GetStation(const int stationId) { return OFFLINE_CAST_CONST_METHOD(GetStation(stationId)); }
117  const Station& GetStation(const int stationId) const;
118 
120  void MakeStation(const int stationId);
122  bool HasStation(const int stationId) const;
124  int GetNumberOfStations() const { return fStations.size(); }
125 
126  // The following methods map from IoSdEvent
127  // and set and get the actual number of stations
128  // in the T3
129 
133  void SetNErrorZeroStations(const unsigned int n) { fNErrorZeroStations = n; }
134 
135  // SD Event SimData
136 
139  const SEventSimData& GetSimData() const { return *fSimData; }
141  void MakeSimData();
143  bool HasSimData() const { return bool(fSimData); }
144 
145  // SD Event Central Trigger Information
146 
149  const EventTrigger& GetTrigger() const { return *fTrigger; }
151  void MakeTrigger();
153  bool HasTrigger() const { return bool(fTrigger); }
154 
156  const sevt::Header& GetHeader() const { return fHeader; }
157 
159 
171  template<class OrderingCriterion>
172  void SortStations(const OrderingCriterion ord) const
173  { std::sort(fStations.begin(), fStations.end(), ord); }
174 
175  // new Meteo weather information
176 
177  bool HasMeteo() const { return bool(fMeteo); }
178 
179  void MakeMeteo();
180 
181  Meteo& GetMeteo() { return *fMeteo; }
182  const Meteo& GetMeteo() const { return *fMeteo; }
183 
184  private:
185  SEvent() = default;
186  ~SEvent();
187 
189 
203 
208  unsigned int fNErrorZeroStations = 0;
210 
211  friend class evt::Event;
212  friend class utl::LameShadowPtr<SEvent>;
213 
214  };
215 
216 }
217 
218 
219 #endif
void MakeMeteo()
Definition: SEvent.cc:122
#define OFFLINE_MAKE_BOTH_ITERATOR_RANGES_ARG(_Iterator_, _ConstIterator_, _NamePrefix_, _Arg_)
Definition: IteratorRange.h:69
const Meteo & GetMeteo() const
Definition: SEvent.h:182
Meteo & GetMeteo()
Definition: SEvent.h:181
ConstStationIterator StationsBegin() const
Beginning of all const stations.
Definition: SEvent.h:61
StationIterator StationsEnd()
End of all stations.
Definition: SEvent.h:59
Interface class to hold simulated data belonging to surface events.
Definition: SEventSimData.h:24
boost::filter_iterator< RejectedStationFilter, StationIterator > RejectedStationIterator
Iterator over rejected stations that match some rejection mask.
Definition: SEvent.h:100
SilentStationIterator SilentStationsEnd()
Definition: SEvent.h:90
bool HasStation(const int stationId) const
Check whether station exists.
Definition: SEvent.cc:81
#define OFFLINE_MAKE_BOTH_ITERATOR_RANGES(_Iterator_, _ConstIterator_, _NamePrefix_)
Definition: IteratorRange.h:43
ConstCandidateStationIterator CandidateStationsEnd() const
Definition: SEvent.h:78
int GetNumberOfStations() const
Get total number of stations in the event.
Definition: SEvent.h:124
Interface class to access to the SD part of an event.
Definition: SEvent.h:39
EventTrigger & GetTrigger()
Get the object with central trigger data, throw if n.a.
Definition: SEvent.h:148
std::vector< Station * > InternalStationCollection
Definition: SEvent.h:42
ConstRejectedStationIterator RejectedStationsEnd(const int rejectionMask=~0) const
Definition: SEvent.h:111
boost::filter_iterator< CandidateStationFilter, StationIterator > CandidateStationIterator
Iterator over candidate stations.
Definition: SEvent.h:68
Header file holding the SD Event Trigger class definition.
Definition: SEvent/Header.h:16
SEvent & operator=(const SEvent &sEvent)
Definition: SEvent.cc:27
unsigned int fNErrorZeroStations
Definition: SEvent.h:208
boost::filter_iterator< SilentStationFilter, ConstStationIterator > ConstSilentStationIterator
Definition: SEvent.h:86
ConstSilentStationIterator SilentStationsEnd() const
Definition: SEvent.h:94
bool HasSimData() const
check whether the SimData object exists
Definition: SEvent.h:143
void SortStations(const OrderingCriterion ord) const
Sort the list of stations by the criterion specified in an OrderingCriterion object.
Definition: SEvent.h:172
InternalStationCollection::iterator InternalStationIterator
Definition: SEvent.h:43
utl::LameShadowPtr< Meteo > fMeteo
Definition: SEvent.h:209
CandidateStationIterator CandidateStationsBegin()
Definition: SEvent.h:72
boost::filter_iterator< RejectedStationFilter, ConstStationIterator > ConstRejectedStationIterator
Definition: SEvent.h:102
class to hold data at Station level
ConstCandidateStationIterator CandidateStationsBegin() const
Definition: SEvent.h:76
void SetNErrorZeroStations(const unsigned int n)
Set number of error zero stations.
Definition: SEvent.h:133
StationIterator RemoveStation(const StationIterator &it)
remove a station from the list
Definition: SEvent.cc:94
SilentStationIterator SilentStationsBegin()
Definition: SEvent.h:88
ConstRejectedStationIterator RejectedStationsBegin(const int rejectionMask=~0) const
Definition: SEvent.h:109
ConstSilentStationIterator SilentStationsBegin() const
Definition: SEvent.h:92
Interface class to access the Event Trigger (T3)
void MakeSimData()
Create the SimData object.
Definition: SEvent.cc:112
#define OFFLINE_CAST_CONST_METHOD(_Method_)
Definition: ClassHelpers.h:51
bool HasTrigger() const
check whether the central trigger object exists
Definition: SEvent.h:153
void MakeTrigger()
Create the central trigger object.
Definition: SEvent.cc:102
SEvent()=default
int GetNErrorZeroStations() const
Get number of error zero stations (mapped over from IoSdEvent)
Definition: SEvent.h:131
void MakeStation(const int stationId)
make a station with specifying Id, throw if invalid stationId
Definition: SEvent.cc:65
SEventSimData & GetSimData()
Get the object with simulated data, throw if n.a.
Definition: SEvent.h:138
Weather data from monitoring information.
Definition: Meteo.h:28
Station & GetStation(const int stationId)
retrieve station by id throw utl::NonExistentComponentException if n.a.
Definition: SEvent.h:116
SEvent(const SEvent &sEvent)
Definition: SEvent.h:47
boost::filter_iterator< SilentStationFilter, StationIterator > SilentStationIterator
Iterator over silent stations.
Definition: SEvent.h:84
utl::LameShadowPtr< SEventSimData > fSimData
Definition: SEvent.h:205
InternalStationCollection fStations
Definition: SEvent.h:204
utl::LameShadowPtr< EventTrigger > fTrigger
Definition: SEvent.h:206
StationIterator StationsBegin()
Beginning of all stations.
Definition: SEvent.h:57
const sevt::Header & GetHeader() const
Definition: SEvent.h:156
ConstStationIterator StationsEnd() const
End of all const stations.
Definition: SEvent.h:63
const SEventSimData & GetSimData() const
Definition: SEvent.h:139
RejectedStationIterator RejectedStationsBegin(const int rejectionMask=~0)
Definition: SEvent.h:105
sevt::Header & GetHeader()
Definition: SEvent.h:155
boost::indirect_iterator< InternalStationIterator, Station & > StationIterator
Iterator over all stations.
Definition: SEvent.h:52
const EventTrigger & GetTrigger() const
Definition: SEvent.h:149
Header fHeader
Definition: SEvent.h:207
CandidateStationIterator CandidateStationsEnd()
Definition: SEvent.h:74
boost::indirect_iterator< InternalConstStationIterator, const Station & > ConstStationIterator
Definition: SEvent.h:54
bool HasMeteo() const
Definition: SEvent.h:177
boost::filter_iterator< CandidateStationFilter, ConstStationIterator > ConstCandidateStationIterator
Definition: SEvent.h:70
RejectedStationIterator RejectedStationsEnd(const int rejectionMask=~0)
Definition: SEvent.h:107
InternalStationCollection::const_iterator InternalConstStationIterator
Definition: SEvent.h:44

, generated on Tue Sep 26 2023.