CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
edm::ThreadSafeOutputFileStream Class Reference

#include <ThreadSafeOutputFileStream.h>

Public Member Functions

 operator bool () const
 
 ThreadSafeOutputFileStream (std::string const &name)
 
void write (std::string &&msg)
 
 ~ThreadSafeOutputFileStream ()
 

Private Attributes

std::ofstream file_
 
std::atomic< bool > msgBeingLogged_ {false}
 
tbb::concurrent_queue< std::string > waitingMessages_ {}
 

Detailed Description

Definition at line 11 of file ThreadSafeOutputFileStream.h.

Constructor & Destructor Documentation

◆ ThreadSafeOutputFileStream()

edm::ThreadSafeOutputFileStream::ThreadSafeOutputFileStream ( std::string const &  name)

Definition at line 7 of file ThreadSafeOutputFileStream.cc.

7 : file_{name} {}

References Skims_PA_cff::name.

◆ ~ThreadSafeOutputFileStream()

edm::ThreadSafeOutputFileStream::~ThreadSafeOutputFileStream ( )

Definition at line 9 of file ThreadSafeOutputFileStream.cc.

9  {
11  while (waitingMessages_.try_pop(tmp)) {
12  file_ << tmp;
13  }
14  file_.close();
15  }

References file_, AlCaHLTBitMon_QueryRunRegistry::string, createJobs::tmp, and waitingMessages_.

Member Function Documentation

◆ operator bool()

edm::ThreadSafeOutputFileStream::operator bool ( ) const
inlineexplicit

Definition at line 17 of file ThreadSafeOutputFileStream.h.

17 { return static_cast<bool>(file_); }

References file_.

◆ write()

void edm::ThreadSafeOutputFileStream::write ( std::string &&  msg)

Member Data Documentation

◆ file_

std::ofstream edm::ThreadSafeOutputFileStream::file_
private

Definition at line 20 of file ThreadSafeOutputFileStream.h.

Referenced by operator bool(), write(), and ~ThreadSafeOutputFileStream().

◆ msgBeingLogged_

std::atomic<bool> edm::ThreadSafeOutputFileStream::msgBeingLogged_ {false}
private

Definition at line 21 of file ThreadSafeOutputFileStream.h.

Referenced by write().

◆ waitingMessages_

tbb::concurrent_queue<std::string> edm::ThreadSafeOutputFileStream::waitingMessages_ {}
private

Definition at line 22 of file ThreadSafeOutputFileStream.h.

Referenced by write(), and ~ThreadSafeOutputFileStream().

mps_check.msg
tuple msg
Definition: mps_check.py:285
createJobs.tmp
tmp
align.sh
Definition: createJobs.py:716
edm::ThreadSafeOutputFileStream::waitingMessages_
tbb::concurrent_queue< std::string > waitingMessages_
Definition: ThreadSafeOutputFileStream.h:22
edm::ThreadSafeOutputFileStream::msgBeingLogged_
std::atomic< bool > msgBeingLogged_
Definition: ThreadSafeOutputFileStream.h:21
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
eostools.move
def move(src, dest)
Definition: eostools.py:511
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
edm::ThreadSafeOutputFileStream::file_
std::ofstream file_
Definition: ThreadSafeOutputFileStream.h:20