00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef BaseEvent_TemporalContainedObject_H
00016 #define BaseEvent_TemporalContainedObject_H 1
00017
00018
00019 #include "GaudiKernel/ContainedObject.h"
00020 #include "Event/ITemporal.h"
00021 #include "Context/TimeStamp.h"
00022 #include "GaudiKernel/ObjectVector.h"
00023 #include "GaudiKernel/boost_allocator.h"
00024 #include <ostream>
00025
00026
00027
00028 namespace DayaBay
00029 {
00030
00031
00032
00043 class TemporalContainedObject: public ContainedObject, virtual public ITemporal
00044 {
00045 public:
00046
00048 typedef ObjectVector<TemporalContainedObject> Container;
00049
00051 TemporalContainedObject() : m_earliest(),
00052 m_latest() {}
00053
00055 virtual ~TemporalContainedObject() {}
00056
00058 virtual std::ostream& fillStream(std::ostream& s) const;
00059
00062 virtual const TimeStamp& earliest() const;
00063
00066 void setEarliest(const TimeStamp& value);
00067
00070 virtual const TimeStamp& latest() const;
00071
00074 void setLatest(const TimeStamp& value);
00075
00076
00077 #ifndef GOD_NOALLOC
00079 static void* operator new ( size_t size )
00080 {
00081 return ( sizeof(TemporalContainedObject) == size ?
00082 boost::singleton_pool<TemporalContainedObject, sizeof(TemporalContainedObject)>::malloc() :
00083 ::operator new(size) );
00084 }
00085
00089 static void* operator new ( size_t size, void* pObj )
00090 {
00091 return ::operator new (size,pObj);
00092 }
00093
00095 static void operator delete ( void* p )
00096 {
00097 boost::singleton_pool<TemporalContainedObject, sizeof(TemporalContainedObject)>::is_from(p) ?
00098 boost::singleton_pool<TemporalContainedObject, sizeof(TemporalContainedObject)>::free(p) :
00099 ::operator delete(p);
00100 }
00101
00104 static void operator delete ( void* p, void* pObj )
00105 {
00106 ::operator delete (p, pObj);
00107 }
00108 #endif
00109 protected:
00110
00111 private:
00112
00113 TimeStamp m_earliest;
00114 TimeStamp m_latest;
00115
00116 };
00117
00119 typedef ObjectVector<TemporalContainedObject> TemporalContainedObjects;
00120
00121 inline std::ostream& operator<< (std::ostream& str, const TemporalContainedObject& obj)
00122 {
00123 return obj.fillStream(str);
00124 }
00125
00126 }
00127
00128
00129
00130
00131
00132
00133
00134 inline std::ostream& DayaBay::TemporalContainedObject::fillStream(std::ostream& s) const
00135 {
00136 ITemporal::fillStream(s);
00137 s << "{ " << "earliest : " << m_earliest << std::endl
00138 << "latest : " << m_latest << std::endl << " }";
00139 return s;
00140 }
00141
00142
00143 inline const TimeStamp& DayaBay::TemporalContainedObject::earliest() const
00144 {
00145 return m_earliest;
00146 }
00147
00148 inline void DayaBay::TemporalContainedObject::setEarliest(const TimeStamp& value)
00149 {
00150 m_earliest = value;
00151 }
00152
00153 inline const TimeStamp& DayaBay::TemporalContainedObject::latest() const
00154 {
00155 return m_latest;
00156 }
00157
00158 inline void DayaBay::TemporalContainedObject::setLatest(const TimeStamp& value)
00159 {
00160 m_latest = value;
00161 }
00162
00163
00164 #endif