OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
Public Member Functions | Public Attributes | List of all members
ossim::BlockBufInfo Class Reference

This is a utility class used by the BlockStreamBuffer. More...

#include <BlockStreamBuffer.h>

Public Member Functions

 BlockBufInfo ()
 
ossim_int64 getBlockIndex (ossim_int64 pos)
 Returns the index of a block. More...
 
bool isWithinWindow (ossim_int64 pos) const
 This just tests if the given abolute position is within a block window. More...
 
bool isWithinValidWindow (ossim_int64 pos) const
 This just tests if the given abolute position is within a valid window. More...
 
ossim_int64 getEndByte () const
 Convenient method to get the absolute byte position of the end byte. More...
 
const char * getBufferStart (ossim_int64 absolutePosition) const
 Get the starting address in the buffer of the absolute position. More...
 
const char * getBuffer () const
 
char * getBuffer ()
 
bool isLoaded () const
 
void setBuffer (char *bufPtr, ossim_uint32 blockSize)
 Will set the buffer and then reset the loaded flag to be false. More...
 

Public Attributes

ossim_int64 m_startByte
 Is the starting absolute byte offset for the buffer. More...
 
ossim_int64 m_blockSize
 Is the size of the buffer. More...
 
ossim_int64 m_validSize
 is the valid size of the buffer. More...
 
char * m_blockBufferPtr
 Starting address of the block. More...
 
bool m_blockLoaded
 Variable used to invalidate a block or specify whether the block is loaded. More...
 

Detailed Description

This is a utility class used by the BlockStreamBuffer.

This class will hold information regarding the block that is currently loaded. It holds the start byte and the valid size and the block size of the buffer. The valid size is used because if we are at the end of a stream we could have a partial block.

Definition at line 18 of file BlockStreamBuffer.h.

Constructor & Destructor Documentation

◆ BlockBufInfo()

ossim::BlockBufInfo::BlockBufInfo ( )
inline

Definition at line 20 of file BlockStreamBuffer.h.

20  :
21  m_startByte(0),
22  m_blockSize(0),
23  m_validSize(0),
25  m_blockLoaded(false){
26 
27  }
ossim_int64 m_blockSize
Is the size of the buffer.
ossim_int64 m_startByte
Is the starting absolute byte offset for the buffer.
bool m_blockLoaded
Variable used to invalidate a block or specify whether the block is loaded.
char * m_blockBufferPtr
Starting address of the block.
ossim_int64 m_validSize
is the valid size of the buffer.

Member Function Documentation

◆ getBlockIndex()

ossim_int64 ossim::BlockBufInfo::getBlockIndex ( ossim_int64  pos)
inline

Returns the index of a block.

Parameters
posIs the aboslute byte position
Returns
The block index for the abosolute position

Definition at line 36 of file BlockStreamBuffer.h.

36  {
37  ossim_int64 result = -1;
38  if(m_blockSize&&m_blockBufferPtr&&(pos>=0))
39  {
40  result = pos/m_blockSize;
41  }
42 
43  return result;
44  }
ossim_int64 m_blockSize
Is the size of the buffer.
char * m_blockBufferPtr
Starting address of the block.
long long ossim_int64

◆ getBuffer() [1/2]

const char* ossim::BlockBufInfo::getBuffer ( ) const
inline
Returns
The starting address of the block buffer

Definition at line 103 of file BlockStreamBuffer.h.

103  {
104  return m_blockBufferPtr;
105  }
char * m_blockBufferPtr
Starting address of the block.

◆ getBuffer() [2/2]

char* ossim::BlockBufInfo::getBuffer ( )
inline
Returns
The starting address of the block buffer

Definition at line 110 of file BlockStreamBuffer.h.

110  {
111  return m_blockBufferPtr;
112  }
char * m_blockBufferPtr
Starting address of the block.

◆ getBufferStart()

const char* ossim::BlockBufInfo::getBufferStart ( ossim_int64  absolutePosition) const
inline

Get the starting address in the buffer of the absolute position.

Parameters
absolutePositionThe absolute byte position
Returns
The starting address at the aboslute position or 0 if the absolute position is outside the windows

Definition at line 91 of file BlockStreamBuffer.h.

91  {
92  if(isWithinValidWindow(absolutePosition))
93  {
94  return m_blockBufferPtr+(absolutePosition-m_startByte);
95  }
96 
97  return 0;
98  }
ossim_int64 m_startByte
Is the starting absolute byte offset for the buffer.
char * m_blockBufferPtr
Starting address of the block.
bool isWithinValidWindow(ossim_int64 pos) const
This just tests if the given abolute position is within a valid window.

◆ getEndByte()

ossim_int64 ossim::BlockBufInfo::getEndByte ( ) const
inline

Convenient method to get the absolute byte position of the end byte.

Returns
the absolute byte position of the end byte

Definition at line 80 of file BlockStreamBuffer.h.

80  {
81  if(m_validSize>=0) return m_startByte+(m_validSize);
82  return m_startByte;
83  }
ossim_int64 m_startByte
Is the starting absolute byte offset for the buffer.
ossim_int64 m_validSize
is the valid size of the buffer.

◆ isLoaded()

bool ossim::BlockBufInfo::isLoaded ( ) const
inline
Returns
true if the the block is valid and loaded or false otherwise.

Definition at line 118 of file BlockStreamBuffer.h.

118 {return m_blockLoaded;}
bool m_blockLoaded
Variable used to invalidate a block or specify whether the block is loaded.

◆ isWithinValidWindow()

bool ossim::BlockBufInfo::isWithinValidWindow ( ossim_int64  pos) const
inline

This just tests if the given abolute position is within a valid window.

A valid window represents partial blocks.

Parameters
posAbsolute position
Returns
true if we are inside the defined window and false otherwise.

Definition at line 68 of file BlockStreamBuffer.h.

68  {
69  return (m_blockLoaded&&
70  (pos>=m_startByte)&&
71  (pos<getEndByte()));
72  }
ossim_int64 m_startByte
Is the starting absolute byte offset for the buffer.
bool m_blockLoaded
Variable used to invalidate a block or specify whether the block is loaded.
ossim_int64 getEndByte() const
Convenient method to get the absolute byte position of the end byte.

◆ isWithinWindow()

bool ossim::BlockBufInfo::isWithinWindow ( ossim_int64  pos) const
inline

This just tests if the given abolute position is within a block window.

We will usually call

See also
isWithinValidWindow.
Parameters
posAbsolute position
Returns
true if we are inside the defined window and false otherwise.

Definition at line 54 of file BlockStreamBuffer.h.

54  {
55  return (m_blockLoaded&&
56  (pos>=m_startByte)&&
57  (pos<(m_startByte+m_blockSize)));
58  }
ossim_int64 m_blockSize
Is the size of the buffer.
ossim_int64 m_startByte
Is the starting absolute byte offset for the buffer.
bool m_blockLoaded
Variable used to invalidate a block or specify whether the block is loaded.

◆ setBuffer()

void ossim::BlockBufInfo::setBuffer ( char *  bufPtr,
ossim_uint32  blockSize 
)
inline

Will set the buffer and then reset the loaded flag to be false.

Parameters
bufPtris the starting address of the block buffer
blockSizeis the size of the buffer

Definition at line 127 of file BlockStreamBuffer.h.

128  {
129  m_blockBufferPtr = bufPtr;
130  m_blockSize = blockSize;
131  m_blockLoaded = false;
132  }
ossim_int64 m_blockSize
Is the size of the buffer.
bool m_blockLoaded
Variable used to invalidate a block or specify whether the block is loaded.
char * m_blockBufferPtr
Starting address of the block.

Member Data Documentation

◆ m_blockBufferPtr

char* ossim::BlockBufInfo::m_blockBufferPtr

Starting address of the block.

This is not managed by this class and will not be deleted.

Definition at line 155 of file BlockStreamBuffer.h.

Referenced by ossim::BlockStreamBuffer::BlockStreamBuffer().

◆ m_blockLoaded

bool ossim::BlockBufInfo::m_blockLoaded

Variable used to invalidate a block or specify whether the block is loaded.

Definition at line 160 of file BlockStreamBuffer.h.

◆ m_blockSize

ossim_int64 ossim::BlockBufInfo::m_blockSize

Is the size of the buffer.

Definition at line 142 of file BlockStreamBuffer.h.

Referenced by ossim::BlockStreamBuffer::BlockStreamBuffer().

◆ m_startByte

ossim_int64 ossim::BlockBufInfo::m_startByte

Is the starting absolute byte offset for the buffer.

Definition at line 137 of file BlockStreamBuffer.h.

◆ m_validSize

ossim_int64 ossim::BlockBufInfo::m_validSize

is the valid size of the buffer.

In most cases this is equal to the blockSize but if at the end of a stream you could have a partial buffer.

Definition at line 149 of file BlockStreamBuffer.h.


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