00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef UserData_UserFloatArray_H
00016 #define UserData_UserFloatArray_H 1
00017
00018
00019 #include "Event/UserData.h"
00020 #include "GaudiKernel/boost_allocator.h"
00021 #include "GaudiKernel/SerializeSTL.h"
00022 #include <vector>
00023 #include <ostream>
00024
00025
00026
00027 namespace DayaBay
00028 {
00029
00030
00031 using GaudiUtils::operator<<;
00032
00033
00043 class UserFloatArray: public UserData
00044 {
00045 public:
00046
00048 UserFloatArray(const std::string& name,
00049 const std::vector<float>& value) : UserData(name),
00050 m_value(value) {}
00051
00053 UserFloatArray() : m_value() {}
00054
00056 virtual ~UserFloatArray();
00057
00059 virtual std::ostream& fillStream(std::ostream& s) const;
00060
00062 virtual UserData::DataType type() const;
00063
00066 const std::vector<float>& value() const;
00067
00070 void setValue(const std::vector<float>& value);
00071
00072
00073 #ifndef GOD_NOALLOC
00075 static void* operator new ( size_t size )
00076 {
00077 return ( sizeof(UserFloatArray) == size ?
00078 boost::singleton_pool<UserFloatArray, sizeof(UserFloatArray)>::malloc() :
00079 ::operator new(size) );
00080 }
00081
00085 static void* operator new ( size_t size, void* pObj )
00086 {
00087 return ::operator new (size,pObj);
00088 }
00089
00091 static void operator delete ( void* p )
00092 {
00093 boost::singleton_pool<UserFloatArray, sizeof(UserFloatArray)>::is_from(p) ?
00094 boost::singleton_pool<UserFloatArray, sizeof(UserFloatArray)>::free(p) :
00095 ::operator delete(p);
00096 }
00097
00100 static void operator delete ( void* p, void* pObj )
00101 {
00102 ::operator delete (p, pObj);
00103 }
00104 #endif
00105 protected:
00106
00107 private:
00108
00109 std::vector<float> m_value;
00110
00111 };
00112
00113 inline std::ostream& operator<< (std::ostream& str, const UserFloatArray& obj)
00114 {
00115 return obj.fillStream(str);
00116 }
00117
00118 }
00119
00120
00121
00122
00123
00124
00125
00126 inline std::ostream& DayaBay::UserFloatArray::fillStream(std::ostream& s) const
00127 {
00128 UserData::fillStream(s);
00129 s << "{ " << "value : " << m_value << std::endl << " }";
00130 return s;
00131 }
00132
00133
00134 inline const std::vector<float>& DayaBay::UserFloatArray::value() const
00135 {
00136 return m_value;
00137 }
00138
00139 inline void DayaBay::UserFloatArray::setValue(const std::vector<float>& value)
00140 {
00141 m_value = value;
00142 }
00143
00144 inline DayaBay::UserData::DataType DayaBay::UserFloatArray::type() const
00145 {
00146 return DayaBay::UserData::FloatArray;
00147 }
00148
00149
00150 #endif