HOPS
HOPS class reference
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
hops::MHO_BinaryFileStreamer Class Reference

Class MHO_BinaryFileStreamer declare the concrete class which does the work for file streams. More...

#include <MHO_BinaryFileStreamer.hh>

Inheritance diagram for hops::MHO_BinaryFileStreamer:
[legend]

Public Member Functions

 MHO_BinaryFileStreamer ()
 
virtual ~MHO_BinaryFileStreamer ()
 
virtual void AddBytesWritten (uint64_t b) override
 Increments the total bytes written by the given amount. More...
 
virtual void Close () override
 Closes the open file if it exists and sets the file state to closed. More...
 
virtual uint64_t GetNBytesWritten () const override
 Getter for N bytes written. More...
 
virtual const std::fstream & GetStream () const override
 Getter for fstream object. More...
 
virtual std::fstream & GetStream () override
 Getter for fstream object. More...
 
virtual void OpenToAppend () override
 Opens a binary file for appending and sets appropriate file state. More...
 
virtual void OpenToRead () override
 Opens a file for binary reading and sets appropriate state. More...
 
virtual void OpenToWrite () override
 Opens a file for binary writing and sets appropriate state. More...
 
virtual void ResetByteCount () override
 Resets byte count to zero. More...
 
- Public Member Functions inherited from hops::MHO_FileStreamer
 MHO_FileStreamer ()
 
virtual ~MHO_FileStreamer ()
 
std::string GetFilename ()
 Getter for filename. More...
 
virtual bool IsClosed ()
 Checks if the file is closed. More...
 
virtual bool IsObjectUnknown ()
 Checks if object state is unknown. More...
 
virtual bool IsOpenForRead ()
 Checks if a file is open for reading. More...
 
virtual bool IsOpenForWrite ()
 Checks if file is open for writing. More...
 
virtual void ResetObjectState ()
 Resets the object state to unset. More...
 
void SetFilename (const std::string filename)
 Setter for filename. More...
 
virtual void SetObjectUnknown ()
 Setter for object state - if an unrecognized object is encountered in streaming, flag this object by changing the 'object' state to 'unknown'. More...
 
virtual void SkipAhead (size_t n_bytes)
 Seeks ahead in file by specified number of bytes and updates object state. More...
 

Protected Member Functions

MHO_BinaryFileStreamerSelf () override
 Returns a reference to the current instance of MHO_BinaryFileStreamer. More...
 

Protected Attributes

uint64_t fNBytesWritten
 
- Protected Attributes inherited from hops::MHO_FileStreamer
char * fBuffer
 
std::streamsize fBufferSize
 
std::fstream fFile
 
std::string fFilename
 
FileState fFileState
 
ObjectState fObjectState
 

Additional Inherited Members

- Protected Types inherited from hops::MHO_FileStreamer
enum  FileState { writeable , readable , closed , undefined }
 
enum  ObjectState { unset , unknown }
 

Detailed Description

Class MHO_BinaryFileStreamer declare the concrete class which does the work for file streams.

variadic template parameter implemenation of a gen scatter hierarchy streamer for POD (plain-old-data) and JSON types to a file stream

Author
J. Barrett - barre.nosp@m.ttj@.nosp@m.mit.e.nosp@m.du
Date
Wed Apr 21 13:40:18 2021 -0400

Constructor & Destructor Documentation

◆ MHO_BinaryFileStreamer()

hops::MHO_BinaryFileStreamer::MHO_BinaryFileStreamer ( )
inline

◆ ~MHO_BinaryFileStreamer()

virtual hops::MHO_BinaryFileStreamer::~MHO_BinaryFileStreamer ( )
inlinevirtual

Member Function Documentation

◆ AddBytesWritten()

virtual void hops::MHO_BinaryFileStreamer::AddBytesWritten ( uint64_t  b)
inlineoverridevirtual

Increments the total bytes written by the given amount.

Parameters
bThe number of bytes to add to the total.
Note
This is a virtual function.

◆ Close()

void hops::MHO_BinaryFileStreamer::Close ( )
overridevirtual

Closes the open file if it exists and sets the file state to closed.

Note
This is a virtual function.

Implements hops::MHO_FileStreamer.

◆ GetNBytesWritten()

virtual uint64_t hops::MHO_BinaryFileStreamer::GetNBytesWritten ( ) const
inlineoverridevirtual

Getter for N bytes written.

Returns
The total number of bytes written as a uint64_t.
Note
This is a virtual function.

◆ GetStream() [1/2]

virtual const std::fstream& hops::MHO_BinaryFileStreamer::GetStream ( ) const
inlineoverridevirtual

Getter for fstream object.

Returns
Reference to std::fstream object.
Note
This is a virtual function.

Reimplemented from hops::MHO_FileStreamer.

◆ GetStream() [2/2]

virtual std::fstream& hops::MHO_BinaryFileStreamer::GetStream ( )
inlineoverridevirtual

Getter for fstream object.

Returns
Reference to std::fstream& representing the current file stream.
Note
This is a virtual function.

Reimplemented from hops::MHO_FileStreamer.

◆ OpenToAppend()

void hops::MHO_BinaryFileStreamer::OpenToAppend ( )
overridevirtual

Opens a binary file for appending and sets appropriate file state.

Note
This is a virtual function.

Implements hops::MHO_FileStreamer.

◆ OpenToRead()

void hops::MHO_BinaryFileStreamer::OpenToRead ( )
overridevirtual

Opens a file for binary reading and sets appropriate state.

Note
This is a virtual function.

Implements hops::MHO_FileStreamer.

◆ OpenToWrite()

void hops::MHO_BinaryFileStreamer::OpenToWrite ( )
overridevirtual

Opens a file for binary writing and sets appropriate state.

Note
This is a virtual function.

Implements hops::MHO_FileStreamer.

◆ ResetByteCount()

virtual void hops::MHO_BinaryFileStreamer::ResetByteCount ( )
inlineoverridevirtual

Resets byte count to zero.

Note
This is a virtual function.

◆ Self()

MHO_BinaryFileStreamer& hops::MHO_BinaryFileStreamer::Self ( )
inlineoverrideprotected

Returns a reference to the current instance of MHO_BinaryFileStreamer.

Returns
MHO_BinaryFileStreamer&: Reference to the current instance

Member Data Documentation

◆ fNBytesWritten

uint64_t hops::MHO_BinaryFileStreamer::fNBytesWritten
protected

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