Diana Software
QEventList.cc
Go to the documentation of this file.
1 #include "QEventList.hh"
2 #include <sstream>
3 #include "QError.hh"
4 
5 using std::stringstream;
6 
8 
10 {
11 }
12 
14 {
15 }
16 
17 void QEventList::Push(const QEvent* obj)
18 {
19  fEvents.push_back(obj);
20 }
21 
23 {
24  fEvents.erase(fEvents.begin());
25 }
26 
27 const QEvent& QEventList::operator[] (const size_t i) const
28 {
29  if(i > (Size() -1) ) {
30  stringstream msg;
31  msg<<"QEventList::operator[]: index "
32  <<i<<" is out of range (size is "<<Size()<<")";
33  throw QError(QERR_OUT_OF_RANGE,msg.str());
34  }
35  return *fEvents[i];
36 }
37 
38 const QEvent& QEventList::operator[] (const size_t i)
39 {
40  if(i > (Size() -1) ) {
41  stringstream msg;
42  msg<<"QEventList::operator[]: index "
43  <<i<<" is out of range (size is "<<Size()<<")";
44  throw QError(QERR_OUT_OF_RANGE,msg.str());
45  }
46  return *fEvents[i];
47 }
48 
49 
#define Q_END_NAMESPACE
Definition: QDiana.hh:22
#define Q_BEGIN_NAMESPACE
Definition: QDiana.hh:20
@ QERR_OUT_OF_RANGE
Definition: QError.hh:28
error class with error type and description
Definition: QError.hh:115
QEventList()
constructor
Definition: QEventList.cc:9
void Pop()
remove the first QEvent in the list
Definition: QEventList.cc:22
std::vector< const QEvent * > fEvents
underlying vector of QEvent (s) references
Definition: QEventList.hh:52
~QEventList()
destructor
Definition: QEventList.cc:13
const QEvent & operator[](const size_t i)
operator[], if out of range throws an exception
Definition: QEventList.cc:38
void Push(const QEvent *obj)
add a QEvent
Definition: QEventList.cc:17
size_t Size() const
number of QEvent (s)
Definition: QEventList.hh:36
diana event
Definition: QEvent.hh:46