vil_cached_image_resource.cxx
Go to the documentation of this file.
1 // This is core/vil/vil_cached_image_resource.cxx
2 
5 
6 // Get a view that is the size of a block.
7 // Uses the cache to retrieve frequently used blocks
9 vil_cached_image_resource::get_block( unsigned block_index_i,
10  unsigned block_index_j ) const
11 {
12  // check if the block is already in the buffer
14  if (cache_.get_block(block_index_i, block_index_j, blk))
15  return blk;
16  // no - so get the block from the resource
17  blk = bir_->get_block(block_index_i, block_index_j);
18  if (!blk)
19  return blk; // get block failed
20  // put the block in the cache (cast away const since we are just caching)
21  auto* non_const = (vil_cached_image_resource*)this;
22  non_const->cache_.add_block(block_index_i, block_index_j, blk);
23  return blk;
24 }
A templated smart pointer class.
Definition: vil_fwd.h:16
A base class reference-counting view of some image data.
A cached and blocked representation of the image_resource.
bool get_block(const unsigned &block_index_i, const unsigned &block_index_j, vil_image_view_base_sptr &blk) const
retrieve a block from the buffer.
vil_blocked_image_resource_sptr bir_
vil_image_view_base_sptr get_block(unsigned block_index_i, unsigned block_index_j) const override
Block access.