FACT++  1.0
Event.cc
Go to the documentation of this file.
1 // **************************************************************************
11 // **************************************************************************
12 #include "Event.h"
13 
14 #include <iostream>
15 
16 #include "Time.h"
17 
18 using namespace std;
19 
20 // --------------------------------------------------------------------------
21 //
43 //
44 Event::Event(const string &name, const string &fmt) :
45  fName(name), fFormat(fmt), fTime(Time::none), fQoS(0), fEmpty(true)
46 {
47 }
48 
49 // --------------------------------------------------------------------------
50 //
57 //
58 Event::Event(const EventImp &evt) : EventImp(evt),
59 fName(evt.GetName()), fFormat(evt.GetFormat()),
60 fData(evt.GetText(), evt.GetText()+evt.GetSize()), fTime(evt.GetTime()),
61 fQoS(evt.GetQoS()), fEmpty(evt.IsEmpty())
62 {
63  const size_t pos = fName.find_first_of('/');
64  if (pos!=string::npos)
65  fName = fName.substr(pos+1);
66 }
67 
68 // --------------------------------------------------------------------------
69 //
82 //
83 Event::Event(const EventImp &evt, const char *ptr, size_t siz) : EventImp(evt),
84 fName(evt.GetName()), fFormat(evt.GetFormat()),
85 fData(ptr, ptr+siz), fTime(evt.GetTime()), fQoS(evt.GetQoS()), fEmpty(ptr==0)
86 {
87  const size_t pos = fName.find_first_of('/');
88  if (pos!=string::npos)
89  fName = fName.substr(pos+1);
90 }
bool fEmpty
Quality of service.
Definition: Event.h:17
A general base-class describing events issues in a state machine.
Definition: EventImp.h:11
const char * GetText() const
Definition: EventImp.h:88
std::string GetFormat() const
Return the stored format of the data.
Definition: Event.h:33
Adds some functionality to boost::posix_time::ptime for our needs.
Definition: Time.h:30
std::vector< char > fData
A human readable description of the event.
Definition: Event.h:13
STL namespace.
int GetQoS() const
Return Quality of Service.
Definition: Event.h:43
size_t GetSize() const
Return the size of the data.
Definition: Event.h:38
std::string GetName() const
Return the stored name of the event.
Definition: Event.h:31
Event()
Empty is true if received event was a NULL pointer.
Definition: Event.h:20
bool IsEmpty() const
Return if event is not just zero size but empty.
Definition: Event.h:45
int fQoS
Time stamp.
Definition: Event.h:16
Time GetTime() const
Return reference to a time stamp.
Definition: Event.h:41
std::string fFormat
A name associated with the event.
Definition: Event.h:10
Time fTime
Data associated with this event.
Definition: Event.h:15
std::string fName
Definition: Event.h:9