Belle II Software  release-05-01-25
PayloadFile Class Reference

A wrapper class for payload files used by the Database and DBStore classes. More...

#include <PayloadFile.h>

Collaboration diagram for PayloadFile:

Public Member Functions

 PayloadFile (const std::string &fileName)
 Constructor. More...
 
std::string getFileName () const
 Get the name of the downloaded payload file. More...
 
std::string getContent () const
 Read the content of the payload (text) file. More...
 

Private Attributes

std::string m_fileName
 Name of the payload file.
 

Detailed Description

A wrapper class for payload files used by the Database and DBStore classes.

Definition at line 33 of file PayloadFile.h.

Constructor & Destructor Documentation

◆ PayloadFile()

PayloadFile ( const std::string &  fileName)
inlineexplicit

Constructor.

Parameters
fileNameName of the payload file obtained from the database.

Definition at line 39 of file PayloadFile.h.

Member Function Documentation

◆ getContent()

string getContent ( ) const

Read the content of the payload (text) file.

Returns
The content of the payload file

Definition at line 19 of file PayloadFile.cc.

20 {
21  ifstream file(m_fileName.c_str());
22  if (!file.is_open()) {
23  B2ERROR("Opening of payload file " << m_fileName << " failed.");
24  return "";
25  }
26  stringstream buffer;
27  buffer << file.rdbuf();
28  return buffer.str();
29 }

◆ getFileName()

std::string getFileName ( ) const
inline

Get the name of the downloaded payload file.

Returns
Local file name.

Definition at line 45 of file PayloadFile.h.


The documentation for this class was generated from the following files:
Belle2::PayloadFile::m_fileName
std::string m_fileName
Name of the payload file.
Definition: PayloadFile.h:54