Belle II Software light-2406-ragdoll
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.
 
std::string getFileName () const
 Get the name of the downloaded payload file.
 
std::string getContent () const
 Read the content of the payload (text) file.
 

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 23 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 29 of file PayloadFile.h.

29: m_fileName(fileName) {};
std::string m_fileName
Name of the payload file.
Definition: PayloadFile.h:44

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 17 of file PayloadFile.cc.

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

◆ getFileName()

std::string getFileName ( ) const
inline

Get the name of the downloaded payload file.

Returns
Local file name.

Definition at line 35 of file PayloadFile.h.

35{return m_fileName;};

Member Data Documentation

◆ m_fileName

std::string m_fileName
private

Name of the payload file.

Definition at line 44 of file PayloadFile.h.


The documentation for this class was generated from the following files: