OpendTect  7.0
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 ObjectSet< Block >::size_type block_idx_type
 
typedef Block::SizeType BlockSizeType
 
typedef unsigned char BufType
 
typedef int ChunkSizeType
 
typedef od_stream_Count file_size_type
 
typedef TypeSet< FileChunkTypeFileChunkSetType
 
typedef Interval< FilePosTypeFileChunkType
 
typedef od_stream_Pos FilePosType
 

Public Member Functions

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

Static Public Member Functions

static FilePosType blockStart (block_idx_type)
 

Protected Member Functions

 FileCache (file_size_type)
 
void clearBlocks ()
 
void dismissBlock (block_idx_type)
 
BlockgtBlk (block_idx_type) const
 
virtual void handleNewLiveBlock (block_idx_type)
 
FilePosType lastBlockPos () const
 
FilePosType lastFilePos () const
 

Protected Attributes

ObjectSet< Blockblocks_
 
const file_size_type knownfilesize_
 
const BlockSizeType lastblocksz_
 

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

◆ block_idx_type

◆ BlockSizeType

◆ BufType

typedef unsigned char Network::FileCache::BufType

◆ ChunkSizeType

◆ file_size_type

typedef od_stream_Count Network::FileCache::file_size_type

◆ FileChunkSetType

◆ FileChunkType

◆ FilePosType

typedef od_stream_Pos Network::FileCache::FilePosType

Constructor & Destructor Documentation

◆ ~FileCache()

virtual Network::FileCache::~FileCache ( )
virtual

◆ FileCache()

Network::FileCache::FileCache ( file_size_type  )
protected

Member Function Documentation

◆ blockIdx()

block_idx_type Network::FileCache::blockIdx ( FilePosType  ) const

◆ blockSize()

BlockSizeType Network::FileCache::blockSize ( block_idx_type  ) const

◆ blockStart()

static FilePosType Network::FileCache::blockStart ( block_idx_type  )
static

◆ clearBlocks()

void Network::FileCache::clearBlocks ( )
protected

◆ clearData()

virtual void Network::FileCache::clearData ( )
pure virtual

◆ dismissBlock()

void Network::FileCache::dismissBlock ( block_idx_type  )
protected

◆ getBlock() [1/2]

BufType* Network::FileCache::getBlock ( block_idx_type  )

◆ getBlock() [2/2]

const BufType* Network::FileCache::getBlock ( block_idx_type  ) const

◆ gtBlk()

Block* Network::FileCache::gtBlk ( block_idx_type  ) const
protected

◆ handleNewLiveBlock()

virtual void Network::FileCache::handleNewLiveBlock ( block_idx_type  )
inlineprotectedvirtual

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

◆ isEmpty()

bool Network::FileCache::isEmpty ( ) const
inline

◆ isLiveBlock()

bool Network::FileCache::isLiveBlock ( block_idx_type  ) const

◆ lastBlockPos()

FilePosType Network::FileCache::lastBlockPos ( ) const
inlineprotected

◆ lastFilePos()

FilePosType Network::FileCache::lastFilePos ( ) const
inlineprotected

◆ setMinCacheSize()

virtual void Network::FileCache::setMinCacheSize ( file_size_type  )
pure virtual

◆ size()

file_size_type Network::FileCache::size ( ) const

◆ validBlockIdx()

bool Network::FileCache::validBlockIdx ( block_idx_type  bidx) const
inline

Member Data Documentation

◆ blocks_

ObjectSet<Block> Network::FileCache::blocks_
protected

◆ knownfilesize_

const file_size_type Network::FileCache::knownfilesize_
protected

◆ lastblocksz_

const BlockSizeType Network::FileCache::lastblocksz_
protected

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