Mantid
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
Mantid::Kernel::FreeBlock Class Reference

FreeBlock: a simple class that holds the position and size of block of free space in a file. More...

#include <FreeBlock.h>

Public Member Functions

 FreeBlock ()
 Default constructor. More...
 
 FreeBlock (uint64_t pos, uint64_t size)
 Constructor. More...
 
uint64_t getFilePosition () const
 
uint64_t getSize () const
 

Static Public Member Functions

static bool merge (FreeBlock &first, const FreeBlock &second)
 Attempt to merge an adjacent block into this one. More...
 

Public Attributes

uint64_t m_filePos
 
uint64_t m_size
 

Detailed Description

FreeBlock: a simple class that holds the position and size of block of free space in a file.

This is used by the DiskBuffer class to track and defrag free space.

Author
Janik Zikovsky, SNS
Date
2011-08-04

Definition at line 22 of file FreeBlock.h.

Constructor & Destructor Documentation

◆ FreeBlock() [1/2]

Mantid::Kernel::FreeBlock::FreeBlock ( )
inline

Default constructor.

Definition at line 25 of file FreeBlock.h.

◆ FreeBlock() [2/2]

Mantid::Kernel::FreeBlock::FreeBlock ( uint64_t  pos,
uint64_t  size 
)
inline

Constructor.

Parameters
pos:: position in the file
size:: size of the block

Definition at line 30 of file FreeBlock.h.

Member Function Documentation

◆ getFilePosition()

uint64_t Mantid::Kernel::FreeBlock::getFilePosition ( ) const
inline
Returns
the position of the free block in the file

Definition at line 33 of file FreeBlock.h.

◆ getSize()

uint64_t Mantid::Kernel::FreeBlock::getSize ( ) const
inline
Returns
the size of the free block in the file

Definition at line 36 of file FreeBlock.h.

References m_size.

◆ merge()

static bool Mantid::Kernel::FreeBlock::merge ( FreeBlock first,
const FreeBlock second 
)
inlinestatic

Attempt to merge an adjacent block into this one.

If the blocks are contiguous, they get merged into one larger block. NOTE: "second" must be AFTER "first" in the file.

Parameters
first:: block to be merged and which will remain
second:: other block to merge with this one
Returns
true if the merge was successful and the "other" block should be dropped because "this" has taken its space.

Definition at line 49 of file FreeBlock.h.

References m_filePos, and m_size.

Referenced by Mantid::Kernel::DiskBuffer::defragFreeBlocks(), and Mantid::Kernel::DiskBuffer::freeBlock().

Member Data Documentation

◆ m_filePos

uint64_t Mantid::Kernel::FreeBlock::m_filePos

Definition at line 60 of file FreeBlock.h.

Referenced by merge().

◆ m_size

uint64_t Mantid::Kernel::FreeBlock::m_size

Definition at line 61 of file FreeBlock.h.

Referenced by merge().


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