OpendTect  6.3
Classes | Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Network::FileCache Class Referenceabstract
Inheritance diagram for Network::FileCache:
[legend]

Classes

class  Block
 

Public Types

typedef unsigned char BufType
 
typedef int ChunkSizeType
 
typedef od_stream_Count FileSizeType
 
typedef od_stream_Pos FilePosType
 
typedef Interval< FilePosTypeFileChunkType
 
typedef TypeSet< FileChunkTypeFileChunkSetType
 
typedef ObjectSet< Block >::size_type BlockIdxType
 
typedef Block::SizeType BlockSizeType
 

Public Member Functions

virtual ~FileCache ()
 
FileSizeType size () const
 
bool isEmpty () const
 
virtual void clearData ()=0
 
virtual void setMinCacheSize (FileSizeType)=0
 
BlockIdxType blockIdx (FilePosType) const
 
BlockSizeType blockSize (BlockIdxType) const
 
bool validBlockIdx (BlockIdxType bidx) const
 
bool isLiveBlock (BlockIdxType) const
 
BufTypegetBlock (BlockIdxType)
 
const BufTypegetBlock (BlockIdxType) const
 

Static Public Member Functions

static FilePosType blockStart (BlockIdxType)
 

Protected Member Functions

 FileCache (FileSizeType)
 
BlockgtBlk (BlockIdxType) const
 
void dismissBlock (BlockIdxType)
 
void clearBlocks ()
 
FilePosType lastBlockPos () const
 
FilePosType lastFilePos () const
 
virtual void handleNewLiveBlock (BlockIdxType)
 

Protected Attributes

ObjectSet< Blockblocks_
 
const BlockSizeType lastblocksz_
 
const FileSizeType knownfilesize_
 

Detailed Description

< Cache for files in blocks of a couple of MBs. Not MT protected. Read Cache.

When reading, we need some buffering to avoid lots of HTTP requests. The idea if to stuff data into blocks, and keep track of the 'oldest' blocks so we can dump them as we go (we'll haveto, otherwise we end up holding the entire file in memory). As headers and trailers are often revisited, we will always keep the first and last block.

Member Typedef Documentation

typedef unsigned char Network::FileCache::BufType

Constructor & Destructor Documentation

virtual Network::FileCache::~FileCache ( )
virtual
Network::FileCache::FileCache ( FileSizeType  )
protected

Member Function Documentation

BlockIdxType Network::FileCache::blockIdx ( FilePosType  ) const
BlockSizeType Network::FileCache::blockSize ( BlockIdxType  ) const
static FilePosType Network::FileCache::blockStart ( BlockIdxType  )
static
void Network::FileCache::clearBlocks ( )
protected
virtual void Network::FileCache::clearData ( )
pure virtual
void Network::FileCache::dismissBlock ( BlockIdxType  )
protected
BufType* Network::FileCache::getBlock ( BlockIdxType  )
const BufType* Network::FileCache::getBlock ( BlockIdxType  ) const
Block* Network::FileCache::gtBlk ( BlockIdxType  ) const
protected
virtual void Network::FileCache::handleNewLiveBlock ( BlockIdxType  )
inlineprotectedvirtual

Reimplemented in Network::WriteCache, and Network::ReadCache.

bool Network::FileCache::isEmpty ( ) const
inline
bool Network::FileCache::isLiveBlock ( BlockIdxType  ) const
FilePosType Network::FileCache::lastBlockPos ( ) const
inlineprotected
FilePosType Network::FileCache::lastFilePos ( ) const
inlineprotected
virtual void Network::FileCache::setMinCacheSize ( FileSizeType  )
pure virtual
FileSizeType Network::FileCache::size ( ) const
bool Network::FileCache::validBlockIdx ( BlockIdxType  bidx) const
inline

Member Data Documentation

ObjectSet<Block> Network::FileCache::blocks_
protected
const FileSizeType Network::FileCache::knownfilesize_
protected
const BlockSizeType Network::FileCache::lastblocksz_
protected

Generated at for the OpendTect seismic interpretation project. Copyright (C): dGB Beheer B. V. 2017