/search.css" rel="stylesheet" type="text/css"/> /search.js">
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

In This Package:

TemporalObjectVector.h
Go to the documentation of this file.
00001 #ifndef DATAUTILITIES_TEMPORALOBJECTVECTOR_H
00002 #define DATAUTILITIES_TEMPORALOBJECTVECTOR_H
00003 
00004 
00005 // Include files
00006 #include "GaudiKernel/ObjectVector.h"
00007 #include "Event/ITemporal.h"
00008 
00018 template <class TYPE>
00019 class TemporalObjectVector : public ObjectVector<TYPE>, 
00020                              virtual public DayaBay::ITemporal
00021 {
00022  public:
00023 
00025   TemporalObjectVector() : m_earliest(TimeStamp::GetEOT()),
00026     m_latest(TimeStamp::GetBOT()) {}
00027   
00029   virtual ~TemporalObjectVector() {}
00030   
00032   virtual std::ostream& fillStream(std::ostream& s) const;
00033   
00036   virtual const TimeStamp& earliest() const;
00037   
00040   void setEarliest(const TimeStamp& value);
00041   
00044   const TimeStamp& latest() const;
00045   
00048   void setLatest(const TimeStamp& value);
00049   
00051   virtual long add(ContainedObject* pObject);
00052   
00053 #ifndef _WIN32
00054 
00055   static void* operator new ( size_t size )
00056     {
00057       return ( sizeof(TemporalObjectVector) == size ? 
00058                boost::singleton_pool<TemporalObjectVector, sizeof(TemporalObjectVector)>::malloc() :
00059                ::operator new(size) );
00060     }
00061   
00065   static void* operator new ( size_t size, void* pObj )
00066     {
00067       return ::operator new (size,pObj);
00068     }
00069   
00071   static void operator delete ( void* p )
00072     {
00073       boost::singleton_pool<TemporalObjectVector, sizeof(TemporalObjectVector)>::is_from(p) ?
00074         boost::singleton_pool<TemporalObjectVector, sizeof(TemporalObjectVector)>::free(p) :
00075         ::operator delete(p);
00076     }
00077   
00080   static void operator delete ( void* p, void* pObj )
00081     {
00082       ::operator delete (p, pObj);
00083     }
00084 #endif
00085  protected:
00086   
00087  private:
00088   
00089   TimeStamp m_earliest; 
00090   TimeStamp m_latest;   
00091   
00092 }; // class TemporalObjectVector
00093 
00094 template <class TYPE>
00095 std::ostream& TemporalObjectVector<TYPE>::fillStream(std::ostream& s) const
00096 {
00097   DayaBay::ITemporal::fillStream(s);
00098   s << "{ " << "earliest :      " << m_earliest << std::endl
00099             << "latest :        " << m_latest << std::endl << " }";
00100   return s;
00101 }
00102 
00103 
00104 template <class TYPE>
00105 const TimeStamp& TemporalObjectVector<TYPE>::earliest() const 
00106 {
00107   return m_earliest;
00108 }
00109 
00110 template <class TYPE>
00111 void TemporalObjectVector<TYPE>::setEarliest(const TimeStamp& value) 
00112 {
00113   m_earliest = value;
00114 }
00115 
00116 template <class TYPE>
00117 const TimeStamp& TemporalObjectVector<TYPE>::latest() const 
00118 {
00119   return m_latest;
00120 }
00121 
00122 template <class TYPE>
00123 void TemporalObjectVector<TYPE>::setLatest(const TimeStamp& value) 
00124 {
00125   m_latest = value;
00126 }
00127 
00128 template <class TYPE>
00129 long TemporalObjectVector<TYPE>::add(ContainedObject* pObject)
00130 {
00131   try {
00132     long result = ObjectVector<TYPE>::add(pObject);
00133     if (-1 == result) {
00134       return result;
00135     }
00136 
00137     ITemporal* temporal = dynamic_cast<ITemporal*>(pObject);
00138     if (0 != temporal) {
00139       if (temporal->earliest() < earliest()) {
00140         setEarliest(temporal->earliest());
00141       }
00142       if (temporal->latest() > latest()) {
00143         setLatest(temporal->latest());
00144       }
00145     }
00146 
00147     return result;
00148   }
00149   catch (...) {
00150   }
00151   return -1;
00152 }
00153 
00154 #endif    // DATAUTILITIES_TEMPORALOBJECTVECTOR_H
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Fri May 16 2014 10:08:31 for DataUtilities by doxygen 1.7.4