SEvent.cc
Go to the documentation of this file.
1 #include <iostream>
2 #include <boost/format.hpp>
3 #include <sevt/SEvent.h>
4 #include <sevt/EventTrigger.h>
5 #include <sevt/Header.h>
6 #include <sevt/Station.h>
7 #include <sevt/StationRecData.h>
8 #include <sevt/Meteo.h>
9 #include <utl/ErrorLogger.h>
10 #include <utl/AugerException.h>
11 
12 #include <utl/LameShadowPtr_imp.h>
14 
15 using namespace std;
16 using namespace sevt;
17 
18 
19 SEvent::~SEvent()
20 {
21  for (const auto p : fStations)
22  delete p;
23 }
24 
25 
26 SEvent&
27 SEvent::operator=(const SEvent& sEvent)
28 {
29  if (this != &sEvent) {
30 
31  for (const auto p : fStations)
32  delete p;
33  fStations.clear();
34 
35  for (const auto& s : sEvent.StationsRange())
36  fStations.push_back(new Station(s));
37 
38  fTrigger = sEvent.fTrigger;
39  fHeader = sEvent.fHeader;
40  fNErrorZeroStations = sEvent.fNErrorZeroStations;
41 
42  }
43 
44  return *this;
45 }
46 
47 
48 const Station&
49 SEvent::GetStation(const int id)
50  const
51 {
52  const ConstStationIterator sEnd = StationsEnd();
53  for (ConstStationIterator sIt = StationsBegin(); sIt != sEnd; ++sIt)
54  if (sIt->GetId() == id)
55  return *sIt;
56 
57  ostringstream error;
58  error << "Station " << id << " not present";
59  ERROR(error);
60  throw utl::NonExistentComponentException(error.str());
61 }
62 
63 
64 void
65 SEvent::MakeStation(const int id)
66 {
67  if (HasStation(id)) {
68 
69  ostringstream error;
70  error << "Station " << id << " already present";
71  WARNING(error);
72  return;
73 
74  }
75 
76  fStations.push_back(new Station(id));
77 }
78 
79 
80 bool
81 SEvent::HasStation(const int id)
82  const
83 {
84  const ConstStationIterator sEnd = StationsEnd();
85  for (ConstStationIterator sIt = StationsBegin(); sIt != sEnd; ++sIt)
86  if (sIt->GetId() == id)
87  return true;
88 
89  return false;
90 }
91 
92 
94 SEvent::RemoveStation(const StationIterator& it)
95 {
96  delete *it.base();
97  return SEvent::StationIterator(fStations.erase(it.base()));
98 }
99 
100 
101 void
102 SEvent::MakeTrigger()
103 {
104  if (fTrigger)
105  ERROR("Trigger Object already present - Not replacing");
106  else
107  fTrigger = new EventTrigger;
108 }
109 
110 
111 void
112 SEvent::MakeSimData()
113 {
114  if (fSimData)
115  ERROR("SimData Object already present - Not replacing");
116  else
117  fSimData = new SEventSimData;
118 }
119 
120 
121 void
122 SEvent::MakeMeteo()
123 {
124  if (fMeteo)
125  ERROR("Meteo Object already present - Not replacing");
126  else
127  fMeteo = new Meteo;
128 }
#define LAMESHADOWPTR_INST(_T_...)
Interface class to hold simulated data belonging to surface events.
Definition: SEventSimData.h:24
Interface class to access to the SD part of an event.
Definition: SEvent.h:39
Base class for exceptions trying to access non-existing components.
unsigned int fNErrorZeroStations
Definition: SEvent.h:208
class to hold data at Station level
constexpr double s
Definition: AugerUnits.h:163
Interface class to access the Event Trigger (T3)
#define WARNING(message)
Macro for logging warning messages.
Definition: ErrorLogger.h:163
Weather data from monitoring information.
Definition: Meteo.h:28
utl::LameShadowPtr< EventTrigger > fTrigger
Definition: SEvent.h:206
boost::indirect_iterator< InternalStationIterator, Station & > StationIterator
Iterator over all stations.
Definition: SEvent.h:52
Header fHeader
Definition: SEvent.h:207
boost::indirect_iterator< InternalConstStationIterator, const Station & > ConstStationIterator
Definition: SEvent.h:54
#define ERROR(message)
Macro for logging error messages.
Definition: ErrorLogger.h:165

, generated on Tue Sep 26 2023.