1 #ifndef __BUFFERUTILSPVP_HPP__ 2 #define __BUFFERUTILSPVP_HPP__ 4 #include "io/FileStream.hpp" 5 #include "structures/Buffer.hpp" 6 #include "structures/SparseList.hpp" 16 namespace BufferUtils {
21 typedef enum HeaderDataTypeEnum {
23 UNRECOGNIZED_DATATYPE = 0,
35 vector<long> frameStartOffsets;
36 vector<long> frameLengths;
41 int headerSize, numParams, fileType, nx, ny, nf, numRecords, recordSize, dataSize, dataType,
42 nxProcs, nyProcs, nxExtended, nyExtended, kx0, ky0, nBatch, nBands;
60 double readFrameWindow(
69 BufferUtils::HeaderDataType returnDataType();
72 ActivityHeader buildActivityHeader(
int width,
int height,
int features,
int numFrames);
75 ActivityHeader buildSparseActivityHeader(
int width,
int height,
int features,
int numFrames);
78 void writeToPvp(
const char *fName,
Buffer<T> *buffer,
double timeStamp,
bool verifyWrites =
false);
86 bool verifyWrites =
false);
97 double readActivityFromPvp(
107 template <
typename T>
108 double readDenseFromPvp(
const char *fName,
Buffer<T> *buffer,
int frameReadIndex);
110 template <
typename T>
113 template <
typename T>
116 template <
typename T>
119 template <
typename T>
120 void writeSparseToPvp(
127 bool verifyWrites =
false);
129 template <
typename T>
130 void appendSparseToPvp(
135 bool verifyWrites =
false);
137 template <
typename T>
138 double readSparseFromPvp(
149 template <
typename T>
150 double readDenseFromSparsePvp(
156 template <
typename T>
157 double readSparseBinaryFromPvp(
169 template <
typename T>
170 double readDenseFromSparseBinaryPvp(
180 template <
typename T>
181 std::size_t weightPatchSize(
int numWeightsInPatch);
183 std::size_t weightPatchSize(
int numWeightsInPatch,
bool compressed);
276 int numColumnProcesses,
282 void calcNumberOfPatches(
285 int numColumnProcesses,
294 int &numPatchesYExt);
298 #include "BufferUtilsPvp.tpp"