CMS 3D CMS Logo

Functions
7zStream.cc File Reference
#include <cstring>
#include "Types.h"

Go to the source code of this file.

Functions

SRes LookInStream_LookRead (ILookInStream *stream, void *buf, size_t *size)
 
SRes LookInStream_Read (ILookInStream *stream, void *buf, size_t size)
 
SRes LookInStream_Read2 (ILookInStream *stream, void *buf, size_t size, SRes errorType)
 
SRes LookInStream_SeekTo (ILookInStream *stream, UInt64 offset)
 
void LookToRead_CreateVTable (CLookToRead *p, int lookahead)
 
void LookToRead_Init (CLookToRead *p)
 
static SRes LookToRead_Look_Exact (void *pp, const void **buf, size_t *size)
 
static SRes LookToRead_Look_Lookahead (void *pp, const void **buf, size_t *size)
 
static SRes LookToRead_Read (void *pp, void *buf, size_t *size)
 
static SRes LookToRead_Seek (void *pp, Int64 *pos, ESzSeek origin)
 
static SRes LookToRead_Skip (void *pp, size_t offset)
 
void SecToLook_CreateVTable (CSecToLook *p)
 
static SRes SecToLook_Read (void *pp, void *buf, size_t *size)
 
void SecToRead_CreateVTable (CSecToRead *p)
 
static SRes SecToRead_Read (void *pp, void *buf, size_t *size)
 
SRes SeqInStream_Read (ISeqInStream *stream, void *buf, size_t size)
 
SRes SeqInStream_Read2 (ISeqInStream *stream, void *buf, size_t size, SRes errorType)
 
SRes SeqInStream_ReadByte (ISeqInStream *stream, Byte *buf)
 

Function Documentation

◆ LookInStream_LookRead()

SRes LookInStream_LookRead ( ILookInStream stream,
void *  buf,
size_t *  size 
)

Definition at line 35 of file 7zStream.cc.

35  {
36  const void *lookBuf;
37  if (*size == 0)
38  return SZ_OK;
39  RINOK(stream->Look(stream, &lookBuf, size));
40  memcpy(buf, lookBuf, *size);
41  return stream->Skip(stream, *size);
42 }

References visDQMUpload::buf, RINOK, findQualityFiles::size, cms::cuda::stream, and SZ_OK.

Referenced by SecToLook_Read().

◆ LookInStream_Read()

SRes LookInStream_Read ( ILookInStream stream,
void *  buf,
size_t  size 
)

◆ LookInStream_Read2()

SRes LookInStream_Read2 ( ILookInStream stream,
void *  buf,
size_t  size,
SRes  errorType 
)

Definition at line 44 of file 7zStream.cc.

44  {
45  while (size != 0) {
46  size_t processed = size;
47  RINOK(stream->Read(stream, buf, &processed));
48  if (processed == 0)
49  return errorType;
50  buf = (void *)((Byte *)buf + processed);
51  size -= processed;
52  }
53  return SZ_OK;
54 }

References visDQMUpload::buf, RINOK, findQualityFiles::size, cms::cuda::stream, and SZ_OK.

Referenced by LookInStream_Read().

◆ LookInStream_SeekTo()

SRes LookInStream_SeekTo ( ILookInStream stream,
UInt64  offset 
)

Definition at line 30 of file 7zStream.cc.

30  {
31  Int64 t = offset;
32  return stream->Seek(stream, &t, SZ_SEEK_SET);
33 }

References hltrates_dqm_sourceclient-live_cfg::offset, cms::cuda::stream, SZ_SEEK_SET, and submitPVValidationJobs::t.

◆ LookToRead_CreateVTable()

void LookToRead_CreateVTable ( CLookToRead p,
int  lookahead 
)

Definition at line 118 of file 7zStream.cc.

118  {
119  p->s.Look = lookahead ? LookToRead_Look_Lookahead : LookToRead_Look_Exact;
120  p->s.Skip = LookToRead_Skip;
121  p->s.Read = LookToRead_Read;
122  p->s.Seek = LookToRead_Seek;
123 }

References LookToRead_Look_Exact(), LookToRead_Look_Lookahead(), LookToRead_Read(), LookToRead_Seek(), LookToRead_Skip(), and AlCaHLTBitMon_ParallelJobs::p.

◆ LookToRead_Init()

void LookToRead_Init ( CLookToRead p)

Definition at line 125 of file 7zStream.cc.

125 { p->pos = p->size = 0; }

References AlCaHLTBitMon_ParallelJobs::p.

◆ LookToRead_Look_Exact()

static SRes LookToRead_Look_Exact ( void *  pp,
const void **  buf,
size_t *  size 
)
static

Definition at line 76 of file 7zStream.cc.

76  {
77  SRes res = SZ_OK;
79  size_t size2 = p->size - p->pos;
80  if (size2 == 0 && *size > 0) {
81  p->pos = 0;
84  res = p->realStream->Read(p->realStream, p->buf, size);
85  size2 = p->size = *size;
86  }
87  if (size2 < *size)
88  *size = size2;
89  *buf = p->buf + p->pos;
90  return res;
91 }

References visDQMUpload::buf, LookToRead_BUF_SIZE, AlCaHLTBitMon_ParallelJobs::p, createTree::pp, findQualityFiles::size, and SZ_OK.

Referenced by LookToRead_CreateVTable().

◆ LookToRead_Look_Lookahead()

static SRes LookToRead_Look_Lookahead ( void *  pp,
const void **  buf,
size_t *  size 
)
static

Definition at line 60 of file 7zStream.cc.

60  {
61  SRes res = SZ_OK;
63  size_t size2 = p->size - p->pos;
64  if (size2 == 0 && *size > 0) {
65  p->pos = 0;
66  size2 = LookToRead_BUF_SIZE;
67  res = p->realStream->Read(p->realStream, p->buf, &size2);
68  p->size = size2;
69  }
70  if (size2 < *size)
71  *size = size2;
72  *buf = p->buf + p->pos;
73  return res;
74 }

References visDQMUpload::buf, LookToRead_BUF_SIZE, AlCaHLTBitMon_ParallelJobs::p, createTree::pp, findQualityFiles::size, and SZ_OK.

Referenced by LookToRead_CreateVTable().

◆ LookToRead_Read()

static SRes LookToRead_Read ( void *  pp,
void *  buf,
size_t *  size 
)
static

Definition at line 99 of file 7zStream.cc.

99  {
100  CLookToRead *p = (CLookToRead *)pp;
101  size_t rem = p->size - p->pos;
102  if (rem == 0)
103  return p->realStream->Read(p->realStream, buf, size);
104  if (rem > *size)
105  rem = *size;
106  memcpy(buf, p->buf + p->pos, rem);
107  p->pos += rem;
108  *size = rem;
109  return SZ_OK;
110 }

References visDQMUpload::buf, AlCaHLTBitMon_ParallelJobs::p, createTree::pp, findQualityFiles::size, and SZ_OK.

Referenced by LookToRead_CreateVTable().

◆ LookToRead_Seek()

static SRes LookToRead_Seek ( void *  pp,
Int64 pos,
ESzSeek  origin 
)
static

Definition at line 112 of file 7zStream.cc.

112  {
113  CLookToRead *p = (CLookToRead *)pp;
114  p->pos = p->size = 0;
115  return p->realStream->Seek(p->realStream, pos, origin);
116 }

References AlCaHLTBitMon_ParallelJobs::p, and createTree::pp.

Referenced by LookToRead_CreateVTable().

◆ LookToRead_Skip()

static SRes LookToRead_Skip ( void *  pp,
size_t  offset 
)
static

Definition at line 93 of file 7zStream.cc.

93  {
95  p->pos += offset;
96  return SZ_OK;
97 }

References hltrates_dqm_sourceclient-live_cfg::offset, AlCaHLTBitMon_ParallelJobs::p, createTree::pp, and SZ_OK.

Referenced by LookToRead_CreateVTable().

◆ SecToLook_CreateVTable()

void SecToLook_CreateVTable ( CSecToLook p)

Definition at line 132 of file 7zStream.cc.

132 { p->s.Read = SecToLook_Read; }

References AlCaHLTBitMon_ParallelJobs::p, and SecToLook_Read().

◆ SecToLook_Read()

static SRes SecToLook_Read ( void *  pp,
void *  buf,
size_t *  size 
)
static

Definition at line 127 of file 7zStream.cc.

127  {
128  CSecToLook *p = (CSecToLook *)pp;
129  return LookInStream_LookRead(p->realStream, buf, size);
130 }

References visDQMUpload::buf, LookInStream_LookRead(), AlCaHLTBitMon_ParallelJobs::p, createTree::pp, and findQualityFiles::size.

Referenced by SecToLook_CreateVTable().

◆ SecToRead_CreateVTable()

void SecToRead_CreateVTable ( CSecToRead p)

Definition at line 139 of file 7zStream.cc.

139 { p->s.Read = SecToRead_Read; }

References AlCaHLTBitMon_ParallelJobs::p, and SecToRead_Read().

◆ SecToRead_Read()

static SRes SecToRead_Read ( void *  pp,
void *  buf,
size_t *  size 
)
static

Definition at line 134 of file 7zStream.cc.

134  {
135  CSecToRead *p = (CSecToRead *)pp;
136  return p->realStream->Read(p->realStream, buf, size);
137 }

References visDQMUpload::buf, AlCaHLTBitMon_ParallelJobs::p, createTree::pp, and findQualityFiles::size.

Referenced by SecToRead_CreateVTable().

◆ SeqInStream_Read()

SRes SeqInStream_Read ( ISeqInStream stream,
void *  buf,
size_t  size 
)

◆ SeqInStream_Read2()

SRes SeqInStream_Read2 ( ISeqInStream stream,
void *  buf,
size_t  size,
SRes  errorType 
)

Definition at line 8 of file 7zStream.cc.

8  {
9  while (size != 0) {
10  size_t processed = size;
11  RINOK(stream->Read(stream, buf, &processed));
12  if (processed == 0)
13  return errorType;
14  buf = (void *)((Byte *)buf + processed);
15  size -= processed;
16  }
17  return SZ_OK;
18 }

References visDQMUpload::buf, RINOK, findQualityFiles::size, cms::cuda::stream, and SZ_OK.

Referenced by SeqInStream_Read().

◆ SeqInStream_ReadByte()

SRes SeqInStream_ReadByte ( ISeqInStream stream,
Byte buf 
)

Definition at line 24 of file 7zStream.cc.

24  {
25  size_t processed = 1;
26  RINOK(stream->Read(stream, buf, &processed));
27  return (processed == 1) ? SZ_OK : SZ_ERROR_INPUT_EOF;
28 }

References visDQMUpload::buf, RINOK, cms::cuda::stream, SZ_ERROR_INPUT_EOF, and SZ_OK.

CSecToRead
Definition: Types.h:202
Byte
unsigned char Byte
Definition: Types.h:60
CLookToRead
Definition: Types.h:184
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
cms::cuda::stream
cudaStream_t stream
Definition: HistoContainer.h:57
pos
Definition: PixelAliasList.h:18
LookInStream_Read2
SRes LookInStream_Read2(ILookInStream *stream, void *buf, size_t size, SRes errorType)
Definition: 7zStream.cc:44
SZ_OK
#define SZ_OK
Definition: Types.h:25
SeqInStream_Read2
SRes SeqInStream_Read2(ISeqInStream *stream, void *buf, size_t size, SRes errorType)
Definition: 7zStream.cc:8
LookInStream_LookRead
SRes LookInStream_LookRead(ILookInStream *stream, void *buf, size_t *size)
Definition: 7zStream.cc:35
SecToLook_Read
static SRes SecToLook_Read(void *pp, void *buf, size_t *size)
Definition: 7zStream.cc:127
CSecToLook
Definition: Types.h:195
Int64
long long int Int64
Definition: Types.h:87
LookToRead_Seek
static SRes LookToRead_Seek(void *pp, Int64 *pos, ESzSeek origin)
Definition: 7zStream.cc:112
LookToRead_Look_Lookahead
static SRes LookToRead_Look_Lookahead(void *pp, const void **buf, size_t *size)
Definition: 7zStream.cc:60
SZ_SEEK_SET
Definition: Types.h:155
SRes
int SRes
Definition: Types.h:43
LookToRead_BUF_SIZE
#define LookToRead_BUF_SIZE
Definition: Types.h:182
res
Definition: Electron.h:6
visDQMUpload.buf
buf
Definition: visDQMUpload.py:154
LookToRead_Look_Exact
static SRes LookToRead_Look_Exact(void *pp, const void **buf, size_t *size)
Definition: 7zStream.cc:76
SecToRead_Read
static SRes SecToRead_Read(void *pp, void *buf, size_t *size)
Definition: 7zStream.cc:134
createTree.pp
pp
Definition: createTree.py:17
LookToRead_Skip
static SRes LookToRead_Skip(void *pp, size_t offset)
Definition: 7zStream.cc:93
hltrates_dqm_sourceclient-live_cfg.offset
offset
Definition: hltrates_dqm_sourceclient-live_cfg.py:82
LookToRead_Read
static SRes LookToRead_Read(void *pp, void *buf, size_t *size)
Definition: 7zStream.cc:99
submitPVValidationJobs.t
string t
Definition: submitPVValidationJobs.py:644
SZ_ERROR_INPUT_EOF
#define SZ_ERROR_INPUT_EOF
Definition: Types.h:32
findQualityFiles.size
size
Write out results.
Definition: findQualityFiles.py:443
RINOK
#define RINOK(x)
Definition: Types.h:52