/usr/include/ossim/base/ossimBlockIStream.h is in libossim-dev 2.2.2-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 | #ifndef ossimBlockStream_HEADER
#define ossimBlockStream_HEADER 1
#include <ossim/base/ossimBlockStreamBuffer.h>
namespace ossim {
/**
*
* @brief Allows one to adapt any input stream to be block aligned
* for any read it will internally read overlapping blocks filling
* the request.
*
* Example:
* @code
*
* ossim_uint64 blockSize = 4096
* std::shared_ptr<ossim::BlockReader> reader = std::make_shared<ossim::BlockReader>(streamToAdapt, blockSize)
*
* reader->seekg(10);
* reader->read(buf, 100);
* @endcode
*
* This will read a block of data from 0-4095 and then fill the buffer
* with 100 bytes of data.
*
* if another call to: reader->read(buf, 10)
* it will not reload the block but instead read from memory
*
*/
class BlockIStream : public ossim::istream
{
public:
/**
* Constructor must be initialized with an inputstream.
*
* @param adaptStream Currenlty a required parameter and is initialized on construction.
Takes an input istream to force block aligned
* requests
* @param blockSize Specify the block size to use
*/
BlockIStream(std::shared_ptr<ossim::istream> adaptStream,
ossim_uint64 blockSize=4096):
ossim::istream(&m_blockStreamBuffer),
m_adaptStream(adaptStream),
m_blockStreamBuffer(adaptStream.get(), blockSize)
{
}
/**
* @brief Destructor will set any shared pointer to 0
*/
virtual ~BlockIStream(){
m_adaptStream = 0;
}
/**
* Maintain a shared pointer to the stream we are adapting
* to be block aligned.
*/
std::shared_ptr<ossim::istream> m_adaptStream;
/**
*
* The buffer where all the block align implementation resides
*
*/
BlockStreamBuffer m_blockStreamBuffer;
};
}
#endif
|