List of all members | Classes | Public Types | Public Member Functions | Static Public Attributes | Private Member Functions | Private Attributes
io::Corsika::RawFile Class Reference

Raw disk file. More...

#include "Corsika/RawCorsikaFile.h"

Classes

class  ThinnedDiskBlock
 Padding bytes at the beginning of a raw block. More...
 
class  UnthinnedDiskBlock
 

Public Types

typedef unsigned long int PositionType
 

Public Member Functions

void Close ()
 Close file (no-op for closed file). More...
 
bool GetNextBlock (Block &block)
 Read one block and advance. More...
 
bool GetNextBlockUnthinned (BlockUnthinned &block)
 Read one block and advance. More...
 
PositionType GetNextPosition () const
 Number of the block read by the next call to GetNextBlock. More...
 
bool IsOpen () const
 Check if the file is open. More...
 
bool Open (const std::string &name, const bool noException=false)
 
 RawFile ()
 
 RawFile (const std::string &name)
 Construct and open file. More...
 
void SeekTo (const PositionType position, const bool reset=false)
 Seek to a given block, the next block will be thePosition. More...
 

Static Public Attributes

static const unsigned int kBlocksInDiskBlock = 21
 

Private Member Functions

bool ReadDiskBlock (const bool thinned)
 Read the block at the current position from disk. More...
 

Private Attributes

bool fBlockBufferValid = false
 
PositionType fCurrentBlockNumber = 0
 
std::ifstream fDiskStream
 
ThinnedDiskBlock fDiskThinnBlockBuffer
 
UnthinnedDiskBlock fDiskUnthinnBlockBuffer
 
unsigned int fIndexInDiskBlock = 0
 
int fPaddingSize = 4
 

Detailed Description

Raw disk file.

This class provides block-wise read access to a Corsika ground particles file on disk. Simple random access is supported.

This class handles the grouping of individual blocks into a disk block with padding. It doesn't provide tools for unpacking the individual particles from a block.

Author
Lukas Nellen
Date
08 Dec 2003

Definition at line 30 of file RawCorsikaFile.h.

Member Typedef Documentation

typedef unsigned long int io::Corsika::RawFile::PositionType

Definition at line 32 of file RawCorsikaFile.h.

Constructor & Destructor Documentation

io::Corsika::RawFile::RawFile ( )
inline

Definition at line 63 of file RawCorsikaFile.h.

RawFile::RawFile ( const std::string &  name)

Construct and open file.

Definition at line 15 of file RawCorsikaFile.cc.

References ERROR, and fDiskStream.

Member Function Documentation

void RawFile::Close ( )

Close file (no-op for closed file).

Definition at line 89 of file RawCorsikaFile.cc.

References fDiskStream.

Referenced by testRawFile::testClose(), and testRawFile::testOpenCloseOpen().

bool RawFile::GetNextBlock ( Block block)
bool RawFile::GetNextBlockUnthinned ( BlockUnthinned block)
RawFile::PositionType RawFile::GetNextPosition ( ) const

Number of the block read by the next call to GetNextBlock.

Definition at line 166 of file RawCorsikaFile.cc.

References fCurrentBlockNumber, fIndexInDiskBlock, and kBlocksInDiskBlock.

Referenced by io::CorsikaShowerFile::ScanGroundFile(), and testRawFile::testRandomAccess().

bool RawFile::IsOpen ( ) const

Check if the file is open.

Definition at line 188 of file RawCorsikaFile.cc.

References fDiskStream.

Referenced by io::CorsikaShowerFile::Read(), and testRawFile::testOpen().

bool RawFile::Open ( const std::string &  name,
const bool  noException = false 
)
bool RawFile::ReadDiskBlock ( const bool  thinned)
private

Read the block at the current position from disk.

Definition at line 136 of file RawCorsikaFile.cc.

References fBlockBufferValid, fCurrentBlockNumber, fDiskStream, fDiskThinnBlockBuffer, fDiskUnthinnBlockBuffer, and fPaddingSize.

Referenced by GetNextBlock(), and GetNextBlockUnthinned().

void RawFile::SeekTo ( const PositionType  position,
const bool  reset = false 
)

Member Data Documentation

bool io::Corsika::RawFile::fBlockBufferValid = false
private

Definition at line 100 of file RawCorsikaFile.h.

Referenced by GetNextBlock(), GetNextBlockUnthinned(), Open(), ReadDiskBlock(), and SeekTo().

PositionType io::Corsika::RawFile::fCurrentBlockNumber = 0
private
std::ifstream io::Corsika::RawFile::fDiskStream
mutableprivate

Definition at line 92 of file RawCorsikaFile.h.

Referenced by Close(), IsOpen(), Open(), RawFile(), and ReadDiskBlock().

ThinnedDiskBlock io::Corsika::RawFile::fDiskThinnBlockBuffer
private

Definition at line 97 of file RawCorsikaFile.h.

Referenced by GetNextBlock(), and ReadDiskBlock().

UnthinnedDiskBlock io::Corsika::RawFile::fDiskUnthinnBlockBuffer
private

Definition at line 96 of file RawCorsikaFile.h.

Referenced by GetNextBlockUnthinned(), and ReadDiskBlock().

unsigned int io::Corsika::RawFile::fIndexInDiskBlock = 0
private

Definition at line 99 of file RawCorsikaFile.h.

Referenced by GetNextBlock(), GetNextBlockUnthinned(), GetNextPosition(), Open(), and SeekTo().

int io::Corsika::RawFile::fPaddingSize = 4
private

Definition at line 93 of file RawCorsikaFile.h.

Referenced by Open(), and ReadDiskBlock().

const unsigned int io::Corsika::RawFile::kBlocksInDiskBlock = 21
static

Definition at line 34 of file RawCorsikaFile.h.

Referenced by GetNextBlock(), GetNextBlockUnthinned(), GetNextPosition(), and SeekTo().


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

, generated on Tue Sep 26 2023.