00001
00002
00011 #ifndef ATHCONTAINERS_PACKEDCONVERTER_H
00012 #define ATHCONTAINERS_PACKEDCONVERTER_H
00013
00014
00015 #include "AthContainers/PackedParameters.h"
00016 #include "CxxUtils/FloatPacker.h"
00017 #include "CxxUtils/BitPacker.h"
00018 #include "CxxUtils/BitUnpacker.h"
00019 #include <vector>
00020 #include <stdint.h>
00021
00022
00023 namespace SG {
00024
00025
00041 class PackedConverter
00042 {
00043 public:
00048 PackedConverter (const PackedParameters& parms);
00049
00050
00057 template <class U, class STREAM>
00058 void write (size_t nelt,
00059 const std::vector<U>& vec,
00060 STREAM& stream);
00061
00062
00069 template <class U, class STREAM>
00070 void write (size_t nelt,
00071 const std::vector<std::vector<U> >& vec,
00072 STREAM& stream);
00073
00074
00081 template <class U, class STREAM>
00082 void read (size_t nelt,
00083 std::vector<U>& vec,
00084 STREAM& stream);
00085
00086
00093 template <class U, class STREAM>
00094 void read (size_t nelt,
00095 std::vector<std::vector<U> >& vec,
00096 STREAM& stream);
00097
00098
00099 private:
00106 template <template<class> class PACKER, class U, class STREAM>
00107 void writeUnsigned (size_t nelt,
00108 const std::vector<U>& vec,
00109 STREAM& stream);
00110
00111
00118 template <template<class> class PACKER, class U, class STREAM>
00119 void writeSigned (size_t nelt,
00120 const std::vector<U>& vec,
00121 STREAM& stream);
00122
00123
00130 template <template<class> class PACKER, class U, class STREAM>
00131 void writeFloat (size_t nelt,
00132 const std::vector<U>& vec,
00133 STREAM& stream);
00134
00135
00142 template <template<class> class UNPACKER, class U, class STREAM>
00143 void readUnsigned (size_t nelt,
00144 std::vector<U>& vec,
00145 STREAM& stream);
00146
00147
00154 template <template<class> class UNPACKER, class U, class STREAM>
00155 void readSigned (size_t nelt,
00156 std::vector<U>& vec,
00157 STREAM& stream);
00158
00159
00160
00167 template <template<class> class UNPACKER, class U, class STREAM>
00168 void readFloat (size_t nelt,
00169 std::vector<U>& vec,
00170 STREAM& stream);
00171
00173 PackedParameters m_parms;
00174
00176 CxxUtils::FloatPacker m_packer;
00177 };
00178
00179
00180 }
00181
00182
00183 #include "AthContainers/PackedConverter.icc"
00184
00185
00186 #endif // not ATHCONTAINERS_PACKEDCONVERTER_H