PAASS
Software suite to Acquire and Analyze Data from Pixie16
PollOutputFile Class Reference

#include <hribf_buffers.h>

Collaboration diagram for PollOutputFile:

Public Member Functions

 PollOutputFile ()
 Default constructor. More...
 
 PollOutputFile (std::string filename_)
 Constructor to set the output filename prefix. More...
 
 ~PollOutputFile ()
 
std::streampos GetFilesize ()
 Get the size of the current file, in bytes. More...
 
std::string GetCurrentFilename ()
 Get the name of the current output file. More...
 
unsigned int GetNumberSpills ()
 Return the total number of spills written since the current file was opened. More...
 
PLD_headerGetPLDheader ()
 Return a pointer to the PLD header object. More...
 
PLD_dataGetPLDdata ()
 Return a pointer to the PLD data object. More...
 
DIR_bufferGetDIRbuffer ()
 Return a pointer to the DIR buffer object. More...
 
HEAD_bufferGetHEADbuffer ()
 Return a pointer to the HEAD buffer object. More...
 
DATA_bufferGetDATAbuffer ()
 Return a pointer to the DATA buffer object. More...
 
EOF_bufferGetEOFbuffer ()
 Return a pointer to the EOF buffer object. More...
 
void SetDebugMode (bool debug_=true)
 Toggle debug mode. More...
 
bool SetFileFormat (unsigned int format_)
 Set the output file format. More...
 
void SetFilenamePrefix (std::string filename_)
 Set the output filename prefix. More...
 
bool IsOpen ()
 Return true if an output file is open and writable and false otherwise. More...
 
int Write (char *data_, unsigned int nWords_)
 Write nWords_ of data to the file. More...
 
int SendPacket (Client *cli_)
 
bool OpenNewFile (std::string title_, unsigned int &run_num_, std::string prefix, std::string output_dir="./", bool continueRun=false)
 Close the current file, if one is open, and open a new file for data output. More...
 
std::string GetNextFileName (unsigned int &run_num_, std::string prefix, std::string output_dir, bool continueRun=false)
 Return the filename of the next output file. More...
 
unsigned int GetRunNumber ()
 
void CloseFile (float total_run_time_=0.0)
 Write the footer and close the file. More...
 

Private Member Functions

std::string get_filename ()
 Get the formatted filename of the current file. More...
 
bool get_full_filename (std::string &output)
 Get the full path of the current file. More...
 
bool overwrite_dir (int total_buffers_=-1)
 
void initialize ()
 Initialize the output file with initial parameters. More...
 

Private Attributes

std::ofstream output_file
 
std::string fname_prefix
 
std::string current_filename
 
std::string current_full_filename
 
PLD_header pldHead
 
PLD_data pldData
 
DIR_buffer dirBuff
 
HEAD_buffer headBuff
 
DATA_buffer dataBuff
 
EOF_buffer eofBuff
 
unsigned int max_spill_size
 
unsigned int current_file_num
 
unsigned int output_format
 
unsigned int number_spills
 
unsigned int run_num
 
bool debug_mode
 
unsigned int current_depth
 
std::string current_directory
 
std::vector< std::string > directories
 

Detailed Description

Definition at line 316 of file hribf_buffers.h.

Constructor & Destructor Documentation

§ PollOutputFile() [1/2]

PollOutputFile::PollOutputFile ( )

Default constructor.

Definition at line 1068 of file hribf_buffers.cpp.

§ PollOutputFile() [2/2]

PollOutputFile::PollOutputFile ( std::string  filename_)

Constructor to set the output filename prefix.

Definition at line 1073 of file hribf_buffers.cpp.

§ ~PollOutputFile()

PollOutputFile::~PollOutputFile ( )
inline

Definition at line 358 of file hribf_buffers.h.

Member Function Documentation

§ CloseFile()

void PollOutputFile::CloseFile ( float  total_run_time_ = 0.0)

Write the footer and close the file.

Definition at line 1279 of file hribf_buffers.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

§ get_filename()

std::string PollOutputFile::get_filename ( )
private

Get the formatted filename of the current file.

Definition at line 938 of file hribf_buffers.cpp.

§ get_full_filename()

bool PollOutputFile::get_full_filename ( std::string &  output)
private

Get the full path of the current file.

Get the full filename of the current file including path.

Definition at line 954 of file hribf_buffers.cpp.

§ GetCurrentFilename()

std::string PollOutputFile::GetCurrentFilename ( )
inline

Get the name of the current output file.

Definition at line 364 of file hribf_buffers.h.

Here is the caller graph for this function:

§ GetDATAbuffer()

DATA_buffer* PollOutputFile::GetDATAbuffer ( )
inline

Return a pointer to the DATA buffer object.

Definition at line 382 of file hribf_buffers.h.

§ GetDIRbuffer()

DIR_buffer* PollOutputFile::GetDIRbuffer ( )
inline

Return a pointer to the DIR buffer object.

Definition at line 376 of file hribf_buffers.h.

§ GetEOFbuffer()

EOF_buffer* PollOutputFile::GetEOFbuffer ( )
inline

Return a pointer to the EOF buffer object.

Definition at line 385 of file hribf_buffers.h.

Here is the call graph for this function:

§ GetFilesize()

std::streampos PollOutputFile::GetFilesize ( )
inline

Get the size of the current file, in bytes.

Definition at line 361 of file hribf_buffers.h.

Here is the caller graph for this function:

§ GetHEADbuffer()

HEAD_buffer* PollOutputFile::GetHEADbuffer ( )
inline

Return a pointer to the HEAD buffer object.

Definition at line 379 of file hribf_buffers.h.

§ GetNextFileName()

std::string PollOutputFile::GetNextFileName ( unsigned int &  run_num_,
std::string  prefix,
std::string  output_dir,
bool  continueRun = false 
)

Return the filename of the next output file.

Definition at line 1246 of file hribf_buffers.cpp.

Here is the caller graph for this function:

§ GetNumberSpills()

unsigned int PollOutputFile::GetNumberSpills ( )
inline

Return the total number of spills written since the current file was opened.

Definition at line 367 of file hribf_buffers.h.

§ GetPLDdata()

PLD_data* PollOutputFile::GetPLDdata ( )
inline

Return a pointer to the PLD data object.

Definition at line 373 of file hribf_buffers.h.

§ GetPLDheader()

PLD_header* PollOutputFile::GetPLDheader ( )
inline

Return a pointer to the PLD header object.

Definition at line 370 of file hribf_buffers.h.

§ GetRunNumber()

unsigned int PollOutputFile::GetRunNumber ( )

Definition at line 1271 of file hribf_buffers.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

§ initialize()

void PollOutputFile::initialize ( )
private

Initialize the output file with initial parameters.

Definition at line 1035 of file hribf_buffers.cpp.

§ IsOpen()

bool PollOutputFile::IsOpen ( )
inline

Return true if an output file is open and writable and false otherwise.

Definition at line 397 of file hribf_buffers.h.

Here is the call graph for this function:
Here is the caller graph for this function:

§ OpenNewFile()

bool PollOutputFile::OpenNewFile ( std::string  title_,
unsigned int &  run_num_,
std::string  prefix,
std::string  output_dir = "./",
bool  continueRun = false 
)

Close the current file, if one is open, and open a new file for data output.

Definition at line 1199 of file hribf_buffers.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

§ overwrite_dir()

bool PollOutputFile::overwrite_dir ( int  total_buffers_ = -1)
private

Overwrite the fourth word of the file with the total number of buffers and close the file Returns false if no output file is open or if the number of 4 byte words in the file is not evenly divisible by the number of words in a buffer

Overwrite the fourth word of the file with the total number of buffers and close the file. Returns false if no output file is open or if the number of 4 byte words in the file is not evenly divisible by the number of words in a buffer.

Definition at line 1000 of file hribf_buffers.cpp.

§ SendPacket()

int PollOutputFile::SendPacket ( Client cli_)

Build a data spill notification message for broadcast onto the network Return the total number of bytes in the packet upon success, and -1 otherwise

Broadcast a data spill notification message onto the network. Return the total number of bytes in the packet upon success, and -1 otherwise.

Definition at line 1133 of file hribf_buffers.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

§ SetDebugMode()

void PollOutputFile::SetDebugMode ( bool  debug_ = true)

Toggle debug mode.

Definition at line 1079 of file hribf_buffers.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

§ SetFileFormat()

bool PollOutputFile::SetFileFormat ( unsigned int  format_)

Set the output file format.

Set the output file data format.

Definition at line 1090 of file hribf_buffers.cpp.

Here is the caller graph for this function:

§ SetFilenamePrefix()

void PollOutputFile::SetFilenamePrefix ( std::string  filename_)

Set the output filename prefix.

Definition at line 1099 of file hribf_buffers.cpp.

§ Write()

int PollOutputFile::Write ( char *  data_,
unsigned int  nWords_ 
)

Write nWords_ of data to the file.

Write nWords_ words of pixie data to disk.

Definition at line 1105 of file hribf_buffers.cpp.

Here is the caller graph for this function:

Field Documentation

§ current_depth

unsigned int PollOutputFile::current_depth
private

Definition at line 335 of file hribf_buffers.h.

§ current_directory

std::string PollOutputFile::current_directory
private

Definition at line 336 of file hribf_buffers.h.

§ current_file_num

unsigned int PollOutputFile::current_file_num
private

Definition at line 329 of file hribf_buffers.h.

§ current_filename

std::string PollOutputFile::current_filename
private

Definition at line 320 of file hribf_buffers.h.

§ current_full_filename

std::string PollOutputFile::current_full_filename
private

Definition at line 321 of file hribf_buffers.h.

§ dataBuff

DATA_buffer PollOutputFile::dataBuff
private

Definition at line 326 of file hribf_buffers.h.

§ debug_mode

bool PollOutputFile::debug_mode
private

Definition at line 333 of file hribf_buffers.h.

§ dirBuff

DIR_buffer PollOutputFile::dirBuff
private

Definition at line 324 of file hribf_buffers.h.

§ directories

std::vector<std::string> PollOutputFile::directories
private

Definition at line 337 of file hribf_buffers.h.

§ eofBuff

EOF_buffer PollOutputFile::eofBuff
private

Definition at line 327 of file hribf_buffers.h.

§ fname_prefix

std::string PollOutputFile::fname_prefix
private

Definition at line 319 of file hribf_buffers.h.

§ headBuff

HEAD_buffer PollOutputFile::headBuff
private

Definition at line 325 of file hribf_buffers.h.

§ max_spill_size

unsigned int PollOutputFile::max_spill_size
private

Definition at line 328 of file hribf_buffers.h.

§ number_spills

unsigned int PollOutputFile::number_spills
private

Definition at line 331 of file hribf_buffers.h.

§ output_file

std::ofstream PollOutputFile::output_file
private

Definition at line 318 of file hribf_buffers.h.

§ output_format

unsigned int PollOutputFile::output_format
private

Definition at line 330 of file hribf_buffers.h.

§ pldData

PLD_data PollOutputFile::pldData
private

Definition at line 323 of file hribf_buffers.h.

§ pldHead

PLD_header PollOutputFile::pldHead
private

Definition at line 322 of file hribf_buffers.h.

§ run_num

unsigned int PollOutputFile::run_num
private

Definition at line 332 of file hribf_buffers.h.


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