CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
List of all members | Public Member Functions | Public Attributes
GzInputStream Struct Reference

Public Member Functions

 GzInputStream (const char *file)
 
 operator bool () const
 
void readLine ()
 
 ~GzInputStream ()
 

Public Attributes

char buffer [256]
 
bool eof
 
gzFile gzf
 
std::istringstream iss
 

Detailed Description

Definition at line 15 of file EcalTrigPrimESProducer.cc.

Constructor & Destructor Documentation

◆ GzInputStream()

GzInputStream::GzInputStream ( const char *  file)
inline

Definition at line 20 of file EcalTrigPrimESProducer.cc.

References eof, geometryDiff::file, gzf, and readLine().

20  : eof(false) {
21  gzf = gzopen(file, "rb");
22  if (gzf == Z_NULL) {
23  eof = true;
24  edm::LogWarning("EcalTPG") << "Database file " << file << " not found!!!";
25  } else
26  readLine();
27  }
Log< level::Warning, false > LogWarning

◆ ~GzInputStream()

GzInputStream::~GzInputStream ( )
inline

Definition at line 41 of file EcalTrigPrimESProducer.cc.

References gzf.

41 { gzclose(gzf); }

Member Function Documentation

◆ operator bool()

GzInputStream::operator bool ( ) const
inlineexplicit

Definition at line 42 of file EcalTrigPrimESProducer.cc.

References eof, and iss.

42 { return ((eof == true) ? false : !iss.fail()); }
std::istringstream iss

◆ readLine()

void GzInputStream::readLine ( )
inline

Definition at line 28 of file EcalTrigPrimESProducer.cc.

References buffer, Skims_PA_cff::content, eof, newFWLiteAna::found, gzf, and iss.

Referenced by GzInputStream(), and operator>>().

28  {
29  char *res = gzgets(gzf, buffer, 256);
30  eof = (res == Z_NULL);
31  if (!eof) {
32  iss.clear();
33  iss.str(buffer);
34  const auto content = iss.str();
35  std::size_t found = content.find("COMMENT");
36  if (found != std::string::npos) {
37  iss.str("");
38  }
39  }
40  }
Definition: Electron.h:6
std::istringstream iss

Member Data Documentation

◆ buffer

char GzInputStream::buffer[256]

Definition at line 17 of file EcalTrigPrimESProducer.cc.

Referenced by readLine().

◆ eof

bool GzInputStream::eof

Definition at line 19 of file EcalTrigPrimESProducer.cc.

Referenced by GzInputStream(), operator bool(), and readLine().

◆ gzf

gzFile GzInputStream::gzf

Definition at line 16 of file EcalTrigPrimESProducer.cc.

Referenced by GzInputStream(), readLine(), and ~GzInputStream().

◆ iss

std::istringstream GzInputStream::iss

Definition at line 18 of file EcalTrigPrimESProducer.cc.

Referenced by operator bool(), operator>>(), and readLine().