gpulog_ilogstream.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00027 #ifndef bits_gpulog_ilogstream_h__
00028 #define bits_gpulog_ilogstream_h__
00029
00030 namespace gpulog
00031 {
00032 namespace internal
00033 {
00034
00036 struct ilogstream
00037 {
00038 protected:
00039 header hend;
00040
00041 protected:
00042 const char *const ptr;
00043 int at, len;
00044
00045 public:
00047 __device__ __host__ ilogstream(const char *ptr_, int len_) : ptr(ptr_), at(0), len(len_), hend(-1, 0) {}
00049 __device__ __host__ ilogstream(const host_log &l) : ptr(l.internal_buffer()), at(0), len(l.size()), hend(-1, 0) {}
00050
00052 __device__ __host__ logrecord next()
00053 {
00054
00055 if(at == len) { return logrecord((char *)&hend); }
00056
00057
00058 logrecord rec(ptr + at);
00059 at += rec.len();
00060
00061 return rec;
00062 }
00063 };
00064
00065 }
00066 }
00067
00068 #endif