00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef SimTrigEvent_SimTrigCommandCollection_H
00016 #define SimTrigEvent_SimTrigCommandCollection_H 1
00017
00018
00019 #include "Event/SimTrigCommand.h"
00020 #include "GaudiKernel/boost_allocator.h"
00021 #include <vector>
00022 #include <ostream>
00023
00024
00025
00026 namespace DayaBay
00027 {
00028
00029
00030 class SimTrigCommandHeader;
00031
00032
00042 class SimTrigCommandCollection
00043 {
00044 public:
00045
00047 typedef std::vector<DayaBay::SimTrigCommand*> CommandContainer;
00048
00050 SimTrigCommandCollection(DayaBay::SimTrigCommandHeader* header,
00051 const DayaBay::Detector& det,
00052 const CommandContainer& container) : m_header(header),
00053 m_commands(container),
00054 m_detector(det) {}
00055
00057 SimTrigCommandCollection(const DayaBay::Detector& det,
00058 const CommandContainer& container) : m_header(0),
00059 m_commands(container),
00060 m_detector(det) {}
00061
00063 SimTrigCommandCollection() : m_header(0),
00064 m_commands(),
00065 m_detector() {}
00066
00068 ~SimTrigCommandCollection();
00069
00071 std::ostream& fillStream(std::ostream& s) const;
00072
00074 void addCommand(DayaBay::SimTrigCommand* tc);
00075
00077 void sort();
00078
00081 const DayaBay::SimTrigCommandHeader* header() const;
00082
00085 void setHeader(DayaBay::SimTrigCommandHeader* value);
00086
00089 const CommandContainer& commands() const;
00090
00093 void setCommands(const CommandContainer& value);
00094
00097 const DayaBay::Detector& detector() const;
00098
00101 void setDetector(const DayaBay::Detector& value);
00102
00103
00104 #ifndef GOD_NOALLOC
00106 static void* operator new ( size_t size )
00107 {
00108 return ( sizeof(SimTrigCommandCollection) == size ?
00109 boost::singleton_pool<SimTrigCommandCollection, sizeof(SimTrigCommandCollection)>::malloc() :
00110 ::operator new(size) );
00111 }
00112
00116 static void* operator new ( size_t size, void* pObj )
00117 {
00118 return ::operator new (size,pObj);
00119 }
00120
00122 static void operator delete ( void* p )
00123 {
00124 boost::singleton_pool<SimTrigCommandCollection, sizeof(SimTrigCommandCollection)>::is_from(p) ?
00125 boost::singleton_pool<SimTrigCommandCollection, sizeof(SimTrigCommandCollection)>::free(p) :
00126 ::operator delete(p);
00127 }
00128
00131 static void operator delete ( void* p, void* pObj )
00132 {
00133 ::operator delete (p, pObj);
00134 }
00135 #endif
00136 protected:
00137
00138 private:
00139
00140 DayaBay::SimTrigCommandHeader* m_header;
00141 CommandContainer m_commands;
00142 DayaBay::Detector m_detector;
00143
00144 };
00145
00146 inline std::ostream& operator<< (std::ostream& str, const SimTrigCommandCollection& obj)
00147 {
00148 return obj.fillStream(str);
00149 }
00150
00151 }
00152
00153
00154
00155
00156
00157
00158 #include "SimTrigCommandHeader.h"
00159
00160
00161 inline DayaBay::SimTrigCommandCollection::~SimTrigCommandCollection()
00162 {
00163
00164 DayaBay::SimTrigCommandCollection::CommandContainer::iterator it;
00165 for(it=m_commands.begin();it!=m_commands.end();++it) delete *it;
00166
00167 }
00168
00169 inline const DayaBay::SimTrigCommandHeader* DayaBay::SimTrigCommandCollection::header() const
00170 {
00171 return m_header;
00172 }
00173
00174 inline void DayaBay::SimTrigCommandCollection::setHeader(DayaBay::SimTrigCommandHeader* value)
00175 {
00176 m_header = value;
00177 }
00178
00179 inline const DayaBay::SimTrigCommandCollection::CommandContainer& DayaBay::SimTrigCommandCollection::commands() const
00180 {
00181 return m_commands;
00182 }
00183
00184 inline void DayaBay::SimTrigCommandCollection::setCommands(const CommandContainer& value)
00185 {
00186 m_commands = value;
00187 }
00188
00189 inline const DayaBay::Detector& DayaBay::SimTrigCommandCollection::detector() const
00190 {
00191 return m_detector;
00192 }
00193
00194 inline void DayaBay::SimTrigCommandCollection::setDetector(const DayaBay::Detector& value)
00195 {
00196 m_detector = value;
00197 }
00198
00199
00200 #endif