Monarch  v3.8.2
Project 8 Data File Format Library
Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
Monarch3 Class Reference

Egg file read/write access. More...

#include <M3Monarch.hh>

Public Types

enum  State {
  eOpenToRead, eOpenToWrite, eReadyToRead, eReadyToWrite,
  eClosed
}
 

Public Member Functions

State GetState () const
 
 ~Monarch3 ()
 
void ReadHeader () const
 
const M3HeaderGetHeader () const
 Get the pointer to the header. More...
 
const M3StreamGetStream (unsigned stream) const
 Get the pointer to a particular stream. More...
 
void FinishReading () const
 Close the file. More...
 
void WriteHeader ()
 
M3HeaderGetHeader ()
 Get the pointer to the header. More...
 
M3StreamGetStream (unsigned stream)
 Get the pointer to a particular stream. More...
 
void FinishWriting ()
 Close the file. More...
 

Static Public Member Functions

static const Monarch3OpenForReading (const std::string &filename)
 
static Monarch3OpenForWriting (const std::string &filename)
 

Private Member Functions

 Monarch3 ()
 
 Monarch3 (const Monarch3 &)=delete
 
 Monarch3 (Monarch3 &&)=delete
 

Private Attributes

State fState
 
H5::H5File * fFile
 
M3HeaderfHeader
 
std::vector< M3Stream *> fStreams
 
mutex_ptr fMutexPtr
 

Detailed Description

Egg file read/write access.

Author
N. S. Oblath (v3), D. Furse (original)

Monarch3 objects are created with one of the two static Open functions:

The data structure and general header information is setup/read via the header (accessed with GetHeader()).

Stream data is written or read via the stream objects (accessed with GetStream( unsigned )).

Definition at line 40 of file M3Monarch.hh.

Member Enumeration Documentation

◆ State

enum State
Enumerator
eOpenToRead 
eOpenToWrite 
eReadyToRead 
eReadyToWrite 
eClosed 

Definition at line 54 of file M3Monarch.hh.

Constructor & Destructor Documentation

◆ Monarch3() [1/3]

Monarch3 ( )
private

Definition at line 19 of file M3Monarch.cc.

◆ Monarch3() [2/3]

Monarch3 ( const Monarch3 )
privatedelete

◆ Monarch3() [3/3]

Monarch3 ( Monarch3 &&  )
privatedelete

◆ ~Monarch3()

~Monarch3 ( )

Definition at line 27 of file M3Monarch.cc.

Member Function Documentation

◆ FinishReading()

void FinishReading ( ) const

Close the file.

Definition at line 224 of file M3Monarch.cc.

◆ FinishWriting()

void FinishWriting ( )

Close the file.

Definition at line 255 of file M3Monarch.cc.

◆ GetHeader() [1/2]

const M3Header * GetHeader ( ) const
inline

Get the pointer to the header.

Definition at line 135 of file M3Monarch.hh.

◆ GetHeader() [2/2]

M3Header * GetHeader ( )
inline

Get the pointer to the header.

Definition at line 139 of file M3Monarch.hh.

◆ GetState()

Monarch3::State GetState ( ) const

Definition at line 51 of file M3Monarch.cc.

◆ GetStream() [1/2]

const M3Stream * GetStream ( unsigned  stream) const
inline

Get the pointer to a particular stream.

Definition at line 144 of file M3Monarch.hh.

◆ GetStream() [2/2]

M3Stream * GetStream ( unsigned  stream)
inline

Get the pointer to a particular stream.

Definition at line 155 of file M3Monarch.hh.

◆ OpenForReading()

const Monarch3 * OpenForReading ( const std::string &  filename)
static

This static method opens the file for reading. If the file exists and can be read, this returns a prepared monarch pointer, and memory is allocated for the header. Upon successful return monarch is in the eOpen state.

Definition at line 56 of file M3Monarch.cc.

◆ OpenForWriting()

Monarch3 * OpenForWriting ( const std::string &  filename)
static

This static method opens the file for writing. If the file exists and can be written, this returns a prepared monarch pointer, and memory is allocated for the header. Upon successful return monarch is in the eOpen state.

Definition at line 92 of file M3Monarch.cc.

◆ ReadHeader()

void ReadHeader ( ) const

This method extracts the header information from the file. If the header read correctly, this returns and the header may be examined, and memory is allocated for the record. Upon successful return monarch is in the eReady state. An exception is thrown if the header is not read.

Definition at line 128 of file M3Monarch.cc.

◆ WriteHeader()

void WriteHeader ( )

This method marshals the current header to the file. If the header marshalled correctly, this returns true, memory is allocated for the record(s). Upon successful return monarch is in the eReady state.

Definition at line 176 of file M3Monarch.cc.

Member Data Documentation

◆ fFile

H5::H5File* fFile
mutableprivate

Definition at line 122 of file M3Monarch.hh.

◆ fHeader

M3Header* fHeader
mutableprivate

Definition at line 125 of file M3Monarch.hh.

◆ fMutexPtr

mutex_ptr fMutexPtr
mutableprivate

Definition at line 131 of file M3Monarch.hh.

◆ fState

State fState
mutableprivate

Definition at line 64 of file M3Monarch.hh.

◆ fStreams

std::vector< M3Stream* > fStreams
mutableprivate

Definition at line 128 of file M3Monarch.hh.


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