CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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.

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

Referenced by SecToLook_Read().

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 }
size
Write out results.
#define RINOK(x)
Definition: Types.h:52
uint32_t T const *__restrict__ uint32_t const *__restrict__ int32_t int Histo::index_type cudaStream_t stream
#define SZ_OK
Definition: Types.h:25

◆ LookInStream_Read()

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

Definition at line 56 of file 7zStream.cc.

References visDQMUpload::buf, LookInStream_Read2(), findQualityFiles::size, cms::cuda::stream, and SZ_ERROR_INPUT_EOF.

56  {
58 }
size
Write out results.
#define SZ_ERROR_INPUT_EOF
Definition: Types.h:32
uint32_t T const *__restrict__ uint32_t const *__restrict__ int32_t int Histo::index_type cudaStream_t stream
SRes LookInStream_Read2(ILookInStream *stream, void *buf, size_t size, SRes errorType)
Definition: 7zStream.cc:44

◆ LookInStream_Read2()

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

Definition at line 44 of file 7zStream.cc.

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

Referenced by LookInStream_Read().

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 }
size
Write out results.
#define RINOK(x)
Definition: Types.h:52
uint32_t T const *__restrict__ uint32_t const *__restrict__ int32_t int Histo::index_type cudaStream_t stream
#define SZ_OK
Definition: Types.h:25
unsigned char Byte
Definition: Types.h:60

◆ LookInStream_SeekTo()

SRes LookInStream_SeekTo ( ILookInStream stream,
UInt64  offset 
)

Definition at line 30 of file 7zStream.cc.

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

30  {
31  Int64 t = offset;
32  return stream->Seek(stream, &t, SZ_SEEK_SET);
33 }
uint32_t T const *__restrict__ uint32_t const *__restrict__ int32_t int Histo::index_type cudaStream_t stream
long long int Int64
Definition: Types.h:87

◆ LookToRead_CreateVTable()

void LookToRead_CreateVTable ( CLookToRead p,
int  lookahead 
)

Definition at line 118 of file 7zStream.cc.

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

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 }
static SRes LookToRead_Read(void *pp, void *buf, size_t *size)
Definition: 7zStream.cc:99
static SRes LookToRead_Look_Lookahead(void *pp, const void **buf, size_t *size)
Definition: 7zStream.cc:60
static SRes LookToRead_Look_Exact(void *pp, const void **buf, size_t *size)
Definition: 7zStream.cc:76
static SRes LookToRead_Skip(void *pp, size_t offset)
Definition: 7zStream.cc:93
static SRes LookToRead_Seek(void *pp, Int64 *pos, ESzSeek origin)
Definition: 7zStream.cc:112

◆ LookToRead_Init()

void LookToRead_Init ( CLookToRead p)

Definition at line 125 of file 7zStream.cc.

References AlCaHLTBitMon_ParallelJobs::p.

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

◆ 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.

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

Referenced by LookToRead_CreateVTable().

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 }
size
Write out results.
Definition: Electron.h:6
int SRes
Definition: Types.h:43
#define SZ_OK
Definition: Types.h:25
#define LookToRead_BUF_SIZE
Definition: Types.h:182

◆ 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.

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

Referenced by LookToRead_CreateVTable().

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 }
size
Write out results.
Definition: Electron.h:6
int SRes
Definition: Types.h:43
#define SZ_OK
Definition: Types.h:25
#define LookToRead_BUF_SIZE
Definition: Types.h:182

◆ LookToRead_Read()

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

Definition at line 99 of file 7zStream.cc.

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

Referenced by LookToRead_CreateVTable().

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 }
size
Write out results.
#define SZ_OK
Definition: Types.h:25

◆ LookToRead_Seek()

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

Definition at line 112 of file 7zStream.cc.

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

Referenced by LookToRead_CreateVTable().

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

◆ LookToRead_Skip()

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

◆ SecToLook_CreateVTable()

void SecToLook_CreateVTable ( CSecToLook p)

Definition at line 132 of file 7zStream.cc.

References AlCaHLTBitMon_ParallelJobs::p, and SecToLook_Read().

132 { p->s.Read = SecToLook_Read; }
static SRes SecToLook_Read(void *pp, void *buf, size_t *size)
Definition: 7zStream.cc:127

◆ SecToLook_Read()

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

Definition at line 127 of file 7zStream.cc.

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

Referenced by SecToLook_CreateVTable().

127  {
128  CSecToLook *p = (CSecToLook *)pp;
129  return LookInStream_LookRead(p->realStream, buf, size);
130 }
size
Write out results.
SRes LookInStream_LookRead(ILookInStream *stream, void *buf, size_t *size)
Definition: 7zStream.cc:35

◆ SecToRead_CreateVTable()

void SecToRead_CreateVTable ( CSecToRead p)

Definition at line 139 of file 7zStream.cc.

References AlCaHLTBitMon_ParallelJobs::p, and SecToRead_Read().

139 { p->s.Read = SecToRead_Read; }
static SRes SecToRead_Read(void *pp, void *buf, size_t *size)
Definition: 7zStream.cc:134

◆ SecToRead_Read()

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

Definition at line 134 of file 7zStream.cc.

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

Referenced by SecToRead_CreateVTable().

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

◆ SeqInStream_Read()

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

Definition at line 20 of file 7zStream.cc.

References visDQMUpload::buf, SeqInStream_Read2(), findQualityFiles::size, cms::cuda::stream, and SZ_ERROR_INPUT_EOF.

Referenced by LzmaFile::Open().

20  {
22 }
size
Write out results.
#define SZ_ERROR_INPUT_EOF
Definition: Types.h:32
uint32_t T const *__restrict__ uint32_t const *__restrict__ int32_t int Histo::index_type cudaStream_t stream
SRes SeqInStream_Read2(ISeqInStream *stream, void *buf, size_t size, SRes errorType)
Definition: 7zStream.cc:8

◆ SeqInStream_Read2()

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

Definition at line 8 of file 7zStream.cc.

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

Referenced by SeqInStream_Read().

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 }
size
Write out results.
#define RINOK(x)
Definition: Types.h:52
uint32_t T const *__restrict__ uint32_t const *__restrict__ int32_t int Histo::index_type cudaStream_t stream
#define SZ_OK
Definition: Types.h:25
unsigned char Byte
Definition: Types.h:60

◆ SeqInStream_ReadByte()

SRes SeqInStream_ReadByte ( ISeqInStream stream,
Byte buf 
)

Definition at line 24 of file 7zStream.cc.

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

24  {
25  size_t processed = 1;
26  RINOK(stream->Read(stream, buf, &processed));
27  return (processed == 1) ? SZ_OK : SZ_ERROR_INPUT_EOF;
28 }
#define SZ_ERROR_INPUT_EOF
Definition: Types.h:32
#define RINOK(x)
Definition: Types.h:52
uint32_t T const *__restrict__ uint32_t const *__restrict__ int32_t int Histo::index_type cudaStream_t stream
#define SZ_OK
Definition: Types.h:25