GNU Octave  3.8.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Public Member Functions | Private Member Functions | Private Attributes | List of all members
BlockArray Class Reference

#include "BlockArray.h"

Collaboration diagram for BlockArray:
Collaboration graph
[legend]

Public Member Functions

 BlockArray ()
 Creates a history file for holding maximal size blocks.
 ~BlockArray ()
 destructor
size_t append (Block *block)
 adds the Block at the end of history.
const Blockat (size_t index)
 gets the block at the index.
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.
bool setSize (size_t newsize)
 Convenient function to set the size in KBytes instead of blocks.

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 ( )

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.

BlockArray::~BlockArray ( )

destructor

Definition at line 54 of file BlockArray.cpp.

References lastblock, and setHistorySize().

Member Function Documentation

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 current, index, ion, length, SEEK_SET, setHistorySize(), and size.

Referenced by newBlock().

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 index, ion, lastblock, lastmap, lastmap_index, size, and unmap().

Referenced by HistoryScrollBlockArray::getCells().

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().

size_t BlockArray::getCurrent ( ) const
inline

Definition at line 97 of file BlockArray.h.

References current.

Referenced by HistoryScrollBlockArray::addCells().

bool BlockArray::has ( size_t  index) const

Definition at line 96 of file BlockArray.cpp.

References index, and length.

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().

Block * BlockArray::lastBlock ( ) const

Definition at line 91 of file BlockArray.cpp.

References lastblock.

Referenced by HistoryScrollBlockArray::addCells().

size_t BlockArray::len ( ) const
inline

Definition at line 93 of file BlockArray.h.

References length.

Referenced by lennob(), xermsg(), and xerprn().

size_t BlockArray::newBlock ( )

Definition at line 81 of file BlockArray.cpp.

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

Referenced by HistoryScrollBlockArray::addCells().

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 current, decreaseBuffer(), increaseBuffer(), ion, lastblock, length, size, and unmap().

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

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 setHistorySize().

void BlockArray::unmap ( )
private

Definition at line 141 of file BlockArray.cpp.

References lastmap, and lastmap_index.

Referenced by at(), and setHistorySize().

Member Data Documentation

size_t BlockArray::current
private

Definition at line 106 of file BlockArray.h.

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

size_t BlockArray::index
private

Definition at line 107 of file BlockArray.h.

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

int BlockArray::ion
private

Definition at line 113 of file BlockArray.h.

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

Block* BlockArray::lastblock
private

Definition at line 111 of file BlockArray.h.

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

Block* BlockArray::lastmap
private

Definition at line 109 of file BlockArray.h.

Referenced by at(), and unmap().

size_t BlockArray::lastmap_index
private

Definition at line 110 of file BlockArray.h.

Referenced by at(), and unmap().

size_t BlockArray::length
private

Definition at line 114 of file BlockArray.h.

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

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: