Diana Software
QEventAssembler.hh
Go to the documentation of this file.
1 #ifndef _Q_EVENT_ASSEMBLER_HH_
2 #define _Q_EVENT_ASSEMBLER_HH_
16 #include "QEvent.hh"
17 
18 
20 
22 {
23  public:
25  QEventAssembler() ;
26 
29 
32 
35 
37  QEvent& GetEvent() { return fEvent; }
38 
40  const QEvent& GetEvent() const { return fEvent; }
41 
43  void SetReadNumber(const unsigned int readNumber) { fEvent.SetReadNumber(readNumber); }
44 
46  void SetOverWrite(const bool ow = true) { fEvent.SetOverWrite(ow); }
47 
49  void SetOwner(const std::string* owner) { fEvent.SetOwner(owner); }
54  template<typename Q> void Add(const char* owner,WriteHandle<Q>& handle)
55  {
56  fEvent.Add(owner,handle);
57  }
58 
63  template<typename Q> Q& Add(const char* owner, const char* name)
64  {
65  return fEvent.Add<Q>(owner,name);
66  }
67 
72  void Add(const char* owner, const char* name,QObject** evData)
73  {
74  fEvent.Add(owner,name,evData);
75  }
76 
81  template<typename Q> void Get(const char* owner,WriteHandle<Q>& handle)
82  {
83  fEvent.Get(owner,handle);
84  }
85 
90  template<typename Q> Q& Get(const char* owner,const char* name)
91  {
92  WriteHandle<Q> handle(name);
93  Get(owner,handle);
94  return handle.Get();
95  }
96 
98  void Assign(const QEvent& ev)
99  {
100  fEvent = ev;
101  }
102 
104  void Clear()
105  {
106  fEvent.Clear();
107  }
108 
110  std::vector<QEventLabel> GetLabels() const
111  {
112  return fEvent.GetLabels();
113  }
114 
116  QObject** Get(const char* owner, const char* name) const
117  {
118  return fEvent.GetObject(owner,name);
119  }
120 
122  std::vector<QEventLabel> GetWriteLabels() const ;
123 
125  std::vector<QEventLabel> GetRequiredLabels(const std::string& owner = "all") const ;
126 
128  void SetRequiredLabels(const std::vector<QEventLabel>& labels, bool incremental = true);
129 
132 
134  const QAliases& GetAliases() const { return fEvent.GetAliases(); }
137 
139  template<typename Q> bool Contains(const char *owner,const char *name) const
140  {
141  return fEvent.Contains<Q>(owner,name);
142  }
144  template<typename Q> bool Contains(const char *label) const
145  {
146  return fEvent.Contains<Q>(label);
147  }
148 
149 
150  private:
153 
154 
155 };
156 
158 
159 #endif
#define Q_END_NAMESPACE
Definition: QDiana.hh:22
#define Q_BEGIN_NAMESPACE
Definition: QDiana.hh:20
Visitor class of QEvent that provides full handling of QEvent.
void SetOverWrite(const bool ow=true)
set that all the QEvent QObject (s) can be overwritten (calls QEvent::SetOverWrite())
QObject ** Get(const char *owner, const char *name) const
Get the QObject Address.
Q & Add(const char *owner, const char *name)
Add QObject to the event. This method has to be called before the event loop, e.g....
QEvent fEvent
the QEvent object.
QEvent & GetEvent()
Get the QEvent.
std::vector< QEventLabel > GetLabels() const
Get the list of all QObject labels in the event.
void Get(const char *owner, WriteHandle< Q > &handle)
Get QObject from the event in write mode. This method has to be called in the event loop,...
void SetOwner(const std::string *owner)
set the module that is currently acting on the QEvent calls (QEvent::SetOwner())
void Consolidate()
Consolidate QEvent.
void Assign(const QEvent &ev)
copies the underlying QEvent (calls QEvent::operator=)
const QAliases & GetAliases() const
get aliases (const version)
void Clear()
clear the underlying QEvent (calls QEvent::Clear())
bool Contains(const char *label) const
Check to see if the event contains a particular object.
Q & Get(const char *owner, const char *name)
Get QObject from the event in write mode. This method has to be called in the event loop,...
void Add(const char *owner, WriteHandle< Q > &handle)
Add QObject to the event. This method has to be called before the event loop, e.g....
void SetRequiredLabels(const std::vector< QEventLabel > &labels, bool incremental=true)
set which QObjects are required. If incremental = false, labels not in the vector are set to not requ...
std::vector< QEventLabel > GetWriteLabels() const
Get the list of all writable QObject labels.
QEventAssembler()
constructor
const QEvent & GetEvent() const
Get the QEvent (const version.
void SetReadNumber(const unsigned int readNumber)
set the event number as read by the current QReader (calls QEvent::SetReadNumber())
std::vector< QEventLabel > GetRequiredLabels(const std::string &owner="all") const
Get the list of all required QObject labels.
bool Contains(const char *owner, const char *name) const
Check to see if the event contains a particular object.
QAliases & GetAliases()
get aliases
void Add(const char *owner, const char *name, QObject **evData)
Add QObject to the event. This method has to be called before the event loop, e.g....
~QEventAssembler()
destructor
const QEventAssembler & operator=(const QEventAssembler &)
operator= (copies also the underlying QEvent)
diana event
Definition: QEvent.hh:46
void SetReadNumber(const unsigned int readNumber)
set the event number as read by the current reader.
Definition: QEvent.hh:363
QObject ** GetObject(const char *owner, const char *name) const
Definition: QEvent.cc:167
void Clear()
reset members to default values
Definition: QEvent.cc:74
void Consolidate()
keep only Required and JustAdded QObjects
Definition: QEvent.cc:84
void Get(const char *owner, ReadHandle< Q > &handle) const
Get a QObject Handle in read mode.
Definition: QEvent.hh:74
void SetOverWrite(const bool ow=true)
set whether an object can be overwritten
Definition: QEvent.hh:366
std::vector< QEventLabel > GetLabels() const
Get all object labels.
Definition: QEvent.cc:156
void SetOwner(const std::string *owner) const
set the name of the module that is currently acting on the event
Definition: QEvent.hh:354
void Add(WriteHandle< Q > &handle)
Add a QObject to the event.
Definition: QEvent.hh:193
bool Contains(const char *owner, const char *name) const
Check to see if the event contains a particular object.
Definition: QEvent.hh:279
const QAliases & GetAliases() const
get aliases (const version)
Definition: QEvent.hh:274
base class for objects handled by QEvent and QGlobalDataManager.
Definition: QObject.hh:76
write handle to access and add QEvent QObject's.
Definition: QHandle.hh:155
T & Get()
get object
Definition: QHandle.hh:161