GNU Octave  6.2.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
BlockArray Class Reference

#include "BlockArray.h"

Collaboration diagram for BlockArray:

Public Member Functions

 BlockArray ()
 Creates a history file for holding maximal size blocks. More...
 
 ~BlockArray ()
 destructor More...
 
size_t append (Block *block)
 adds the Block at the end of history. More...
 
const Blockat (size_t index)
 gets the block at the index. More...
 
size_t getCurrent () const
 
bool has (size_t index) const
 
BlocklastBlock () const
 
size_t len () const
 
size_t newBlock ()
 
bool setHistorySize (size_t newsize)
 reorders blocks as needed. More...
 
bool setSize (size_t newsize)
 Convenient function to set the size in KBytes instead of blocks. More...
 

Private Member Functions

void decreaseBuffer (size_t newsize)
 
void increaseBuffer ()
 
void unmap ()
 

Private Attributes

size_t current
 
size_t index
 
int ion
 
Blocklastblock
 
Blocklastmap
 
size_t lastmap_index
 
size_t length
 
size_t size
 

Detailed Description

Definition at line 39 of file BlockArray.h.

Constructor & Destructor Documentation

◆ BlockArray()

BlockArray::BlockArray ( )

Creates a history file for holding maximal size blocks.

If more blocks are requested, then it drops earlier added ones.

Definition at line 39 of file BlockArray.cpp.

References blocksize.

◆ ~BlockArray()

BlockArray::~BlockArray ( )

destructor

Definition at line 54 of file BlockArray.cpp.

References lastblock, and setHistorySize().

Member Function Documentation

◆ append()

size_t BlockArray::append ( Block block)

adds the Block at the end of history.

This may drop other blocks.

The ownership on the block is transfered. An unique index number is returned for accessing it later (if not yet dropped then)

Note, that the block may be dropped completely if history is turned off.

Definition at line 60 of file BlockArray.cpp.

References blocksize, current, index, ion, length, SEEK_SET, setHistorySize(), and size.

Referenced by newBlock().

◆ at()

const Block * BlockArray::at ( size_t  index)

gets the block at the index.

Function may return 0 if the block isn't available any more.

The returned block is strictly readonly as only maped in memory - and will be invalid on the next operation on this class.

Definition at line 108 of file BlockArray.cpp.

References blocksize, index, ion, lastblock, lastmap, lastmap_index, size, and unmap().

Referenced by HistoryScrollBlockArray::getCells().

◆ decreaseBuffer()

void BlockArray::decreaseBuffer ( size_t  newsize)
private

Definition at line 227 of file BlockArray.cpp.

References blocksize, current, index, ion, length, moveBlock(), and size.

Referenced by setHistorySize().

◆ getCurrent()

size_t BlockArray::getCurrent ( ) const
inline

Definition at line 97 of file BlockArray.h.

References current.

Referenced by HistoryScrollBlockArray::addCells().

◆ has()

bool BlockArray::has ( size_t  index) const

Definition at line 96 of file BlockArray.cpp.

References index, and length.

◆ increaseBuffer()

void BlockArray::increaseBuffer ( )
private

Definition at line 273 of file BlockArray.cpp.

References blocksize, current, index, ion, length, moveBlock(), SEEK_SET, and size.

Referenced by setHistorySize().

◆ lastBlock()

Block * BlockArray::lastBlock ( ) const

Definition at line 91 of file BlockArray.cpp.

References lastblock.

Referenced by HistoryScrollBlockArray::addCells().

◆ len()

size_t BlockArray::len ( ) const
inline

Definition at line 93 of file BlockArray.h.

References length.

◆ newBlock()

size_t BlockArray::newBlock ( )

Definition at line 81 of file BlockArray.cpp.

References append(), index, lastblock, and size.

Referenced by HistoryScrollBlockArray::addCells().

◆ setHistorySize()

bool BlockArray::setHistorySize ( size_t  newsize)

reorders blocks as needed.

If newsize is null, the history is emptied completely. The indices returned on append won't change their semantic, but they may not be valid after this call.

Definition at line 156 of file BlockArray.cpp.

References blocksize, current, decreaseBuffer(), increaseBuffer(), ion, lastblock, length, size, and unmap().

Referenced by HistoryScrollBlockArray::HistoryScrollBlockArray(), ~BlockArray(), append(), and setSize().

◆ setSize()

bool BlockArray::setSize ( size_t  newsize)

Convenient function to set the size in KBytes instead of blocks.

Definition at line 151 of file BlockArray.cpp.

References blocksize, and setHistorySize().

◆ unmap()

void BlockArray::unmap ( )
private

Definition at line 141 of file BlockArray.cpp.

References blocksize, lastmap, and lastmap_index.

Referenced by at(), and setHistorySize().

Member Data Documentation

◆ current

size_t BlockArray::current
private

Definition at line 106 of file BlockArray.h.

Referenced by append(), decreaseBuffer(), getCurrent(), increaseBuffer(), and setHistorySize().

◆ index

size_t BlockArray::index
private

Definition at line 107 of file BlockArray.h.

Referenced by append(), at(), decreaseBuffer(), has(), increaseBuffer(), and newBlock().

◆ ion

int BlockArray::ion
private

Definition at line 113 of file BlockArray.h.

Referenced by append(), at(), decreaseBuffer(), increaseBuffer(), and setHistorySize().

◆ lastblock

Block* BlockArray::lastblock
private

Definition at line 111 of file BlockArray.h.

Referenced by ~BlockArray(), at(), lastBlock(), newBlock(), and setHistorySize().

◆ lastmap

Block* BlockArray::lastmap
private

Definition at line 109 of file BlockArray.h.

Referenced by at(), and unmap().

◆ lastmap_index

size_t BlockArray::lastmap_index
private

Definition at line 110 of file BlockArray.h.

Referenced by at(), and unmap().

◆ length

size_t BlockArray::length
private

Definition at line 114 of file BlockArray.h.

Referenced by append(), decreaseBuffer(), has(), increaseBuffer(), len(), and setHistorySize().

◆ size

size_t BlockArray::size
private

Definition at line 104 of file BlockArray.h.

Referenced by append(), at(), decreaseBuffer(), increaseBuffer(), newBlock(), and setHistorySize().


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