BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
raw_ofstream Class Reference

#include <raw_ofstream.h>

Inheritance diagram for raw_ofstream:

Public Member Functions

int write_event (const char *pbuf, int size)
void close ()
int write_event (const char *pbuf, int size)
void close ()
int write_event (const char *pbuf, int size)
void close ()

Static Public Member Functions

static raw_ofstreaminstance (const std::string &fname, int run=0)
static void release ()
static void lock ()
static void unlock ()
static raw_ofstreaminstance (const std::string &fname, int run=0)
static void release ()
static void lock ()
static void unlock ()
static raw_ofstreaminstance (const std::string &fname, int run=0)
static void release ()
static void lock ()
static void unlock ()

Detailed Description

Definition at line 11 of file Event/RawFile/include/RawFile/raw_ofstream.h.

Member Function Documentation

◆ close() [1/3]

void raw_ofstream::close ( )

Definition at line 62 of file raw_ofstream.cxx.

62 {
63 if ( is_open() )
64 {
65 m_fileEndRecord.setEventsInFile( m_nevt );
66 m_nevt = 0;
67
68 ( *this ) << m_fileEndRecord;
69 std::ofstream::close();
70
71 std::cout << "[RawFile] Finished writing file: " << real_fname() << std::endl;
72 }
73}

Referenced by write_event().

◆ close() [2/3]

void raw_ofstream::close ( )

◆ close() [3/3]

void raw_ofstream::close ( )

◆ instance() [1/3]

raw_ofstream * raw_ofstream::instance ( const std::string & fname,
int run = 0 )
static

Definition at line 13 of file raw_ofstream.cxx.

13 {
14 lock();
15
16 if ( _instance == 0 ) { _instance = new raw_ofstream( fname, run ); }
17
18 ++_nHandler;
19
20 unlock();
21
22 return _instance;
23}

Referenced by RawFileWriter::RawFileWriter().

◆ instance() [2/3]

raw_ofstream * raw_ofstream::instance ( const std::string & fname,
int run = 0 )
static

◆ instance() [3/3]

raw_ofstream * raw_ofstream::instance ( const std::string & fname,
int run = 0 )
static

◆ lock() [1/3]

void raw_ofstream::lock ( )
inlinestatic

Definition at line 16 of file Event/RawFile/include/RawFile/raw_ofstream.h.

16 {
17 int lstat = pthread_mutex_lock( &_pthread_lock );
18 assert( lstat == 0 );
19 };

Referenced by instance(), release(), and RawFileWriter::writeEvent().

◆ lock() [2/3]

void raw_ofstream::lock ( )
inlinestatic

Definition at line 16 of file InstallArea/x86_64-el9-gcc13-dbg/include/RawFile/raw_ofstream.h.

16 {
17 int lstat = pthread_mutex_lock( &_pthread_lock );
18 assert( lstat == 0 );
19 };

◆ lock() [3/3]

void raw_ofstream::lock ( )
inlinestatic

Definition at line 16 of file InstallArea/x86_64-el9-gcc13-opt/include/RawFile/raw_ofstream.h.

16 {
17 int lstat = pthread_mutex_lock( &_pthread_lock );
18 assert( lstat == 0 );
19 };

◆ release() [1/3]

void raw_ofstream::release ( )
static

Definition at line 25 of file raw_ofstream.cxx.

25 {
26 lock();
27
28 if ( _nHandler > 0 && --_nHandler == 0 )
29 {
30 delete _instance;
31 _instance = 0;
32 }
33
34 unlock();
35}

Referenced by RawFileWriter::~RawFileWriter().

◆ release() [2/3]

void raw_ofstream::release ( )
static

◆ release() [3/3]

void raw_ofstream::release ( )
static

◆ unlock() [1/3]

void raw_ofstream::unlock ( )
inlinestatic

Definition at line 20 of file Event/RawFile/include/RawFile/raw_ofstream.h.

20 {
21 int lstat = pthread_mutex_unlock( &_pthread_lock );
22 assert( lstat == 0 );
23 };

Referenced by instance(), release(), and RawFileWriter::writeEvent().

◆ unlock() [2/3]

void raw_ofstream::unlock ( )
inlinestatic

Definition at line 20 of file InstallArea/x86_64-el9-gcc13-dbg/include/RawFile/raw_ofstream.h.

20 {
21 int lstat = pthread_mutex_unlock( &_pthread_lock );
22 assert( lstat == 0 );
23 };

◆ unlock() [3/3]

void raw_ofstream::unlock ( )
inlinestatic

Definition at line 20 of file InstallArea/x86_64-el9-gcc13-opt/include/RawFile/raw_ofstream.h.

20 {
21 int lstat = pthread_mutex_unlock( &_pthread_lock );
22 assert( lstat == 0 );
23 };

◆ write_event() [1/3]

int raw_ofstream::write_event ( const char * pbuf,
int size )

Definition at line 45 of file raw_ofstream.cxx.

45 {
46 uint32_t fsize = tellp();
47 if ( fsize >= MAX_RAWFILE_SiZE )
48 {
49 this->close();
50 init_fstream();
51 }
52
53 m_dataSeparatorRecord.setDataBlockNumber( ++m_nevt );
54 m_dataSeparatorRecord.setDataBlockSize( size );
55
56 ( *this ) << m_dataSeparatorRecord;
57 std::ofstream::write( pbuf, size );
58
59 return m_nfile;
60}
#define MAX_RAWFILE_SiZE

◆ write_event() [2/3]

int raw_ofstream::write_event ( const char * pbuf,
int size )

◆ write_event() [3/3]

int raw_ofstream::write_event ( const char * pbuf,
int size )

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