![]() |
Exiv2
|
Provides remote binary file IO by implementing the BasicIo interface. This is an abstract class. The logics for remote access are implemented in HttpIo, CurlIo, SshIo which are the derived classes of RemoteIo. More...
#include <basicio.hpp>
Classes | |
class | Impl |
Internal Pimpl abstract structure of class RemoteIo. More... | |
Public Member Functions | |
virtual | ~RemoteIo () |
Destructor. Releases all managed memory. | |
Manipulators | |
virtual int | open () |
Connect to the remote server, get the size of the remote file and allocate the array of blocksMap. More... | |
virtual int | close () |
Reset the IO position to the start. It does not release the data. More... | |
virtual long | write (const byte *data, long wcount) |
Not support this method. More... | |
virtual long | write (BasicIo &src) |
Write data that is read from another BasicIo instance to the remote file. More... | |
virtual int | putb (byte data) |
Not support. More... | |
virtual DataBuf | read (long rcount) |
Read data from the memory blocks. Reading starts at the current IO position and the position is advanced by the number of bytes read. If the memory blocks are not populated (False), it will connect to server and populate the data to memory blocks. More... | |
virtual long | read (byte *buf, long rcount) |
Read data from the the memory blocks. Reading starts at the current IO position and the position is advanced by the number of bytes read. If the memory blocks are not populated (!= bMemory), it will connect to server and populate the data to memory blocks. More... | |
virtual int | getb () |
Read one byte from the memory blocks. The IO position is advanced by one byte. If the memory block is not populated (!= bMemory), it will connect to server and populate the data to the memory block. More... | |
virtual void | transfer (BasicIo &src) |
Remove the contents of the file and then transfer data from the src BasicIo object into the empty file. More... | |
virtual int | seek (long offset, Position pos) |
Move the current IO position. More... | |
virtual byte * | mmap (bool=false) |
Not support. More... | |
virtual int | munmap () |
Not support. More... | |
Accessors | |
virtual long | tell () const |
Get the current IO position. More... | |
virtual size_t | size () const |
Get the current memory buffer size in bytes. More... | |
virtual bool | isopen () const |
Returns true if the memory area is allocated. | |
virtual int | error () const |
Always returns 0. | |
virtual bool | eof () const |
Returns true if the IO position has reached the end, otherwise false. | |
virtual std::string | path () const |
Returns the URL of the file. | |
virtual void | populateFakeData () |
Mark all the bNone blocks to bKnow. This avoids allocating memory for parts of the file that contain image-date (non-metadata/pixel data) More... | |
![]() | |
virtual | ~BasicIo () |
Destructor. | |
Protected Member Functions | |
Creators | |
RemoteIo () | |
Default Constructor. | |
![]() | |
BasicIo () | |
Default Constructor. | |
Protected Attributes | |
Impl * | p_ |
Pointer to implementation. | |
Additional Inherited Members | |
![]() | |
enum | Position { beg, cur, end } |
Seek starting positions. | |
typedef std::auto_ptr< BasicIo > | AutoPtr |
BasicIo auto_ptr type. | |
![]() | |
byte * | bigBlock_ |
this is allocated and populated by mmap() | |
Provides remote binary file IO by implementing the BasicIo interface. This is an abstract class. The logics for remote access are implemented in HttpIo, CurlIo, SshIo which are the derived classes of RemoteIo.
|
virtual |
Reset the IO position to the start. It does not release the data.
Implements Exiv2::BasicIo.
References Exiv2::BasicIo::bigBlock_, Exiv2::RemoteIo::Impl::eof_, Exiv2::RemoteIo::Impl::idx_, Exiv2::RemoteIo::Impl::isMalloced_, p_, and Exiv2::RemoteIo::Impl::totalRead_.
Referenced by open(), and ~RemoteIo().
|
virtual |
Read one byte from the memory blocks. The IO position is advanced by one byte. If the memory block is not populated (!= bMemory), it will connect to server and populate the data to the memory block.
Implements Exiv2::BasicIo.
References Exiv2::RemoteIo::Impl::blockSize_, Exiv2::RemoteIo::Impl::blocksMap_, Exiv2::RemoteIo::Impl::eof_, Exiv2::RemoteIo::Impl::idx_, Exiv2::RemoteIo::Impl::isMalloced_, p_, Exiv2::RemoteIo::Impl::populateBlocks(), and Exiv2::RemoteIo::Impl::size_.
|
virtual |
Not support.
Implements Exiv2::BasicIo.
References Exiv2::BasicIo::bigBlock_, Exiv2::RemoteIo::Impl::blockSize_, Exiv2::RemoteIo::Impl::blocksMap_, p_, and Exiv2::RemoteIo::Impl::size_.
|
virtual |
|
virtual |
Connect to the remote server, get the size of the remote file and allocate the array of blocksMap.
If the blocksMap is already allocated (this method has been called before), it just reset IO position to the start and does not flush the old data.
Implements Exiv2::BasicIo.
References Exiv2::BasicIo::bigBlock_, Exiv2::RemoteIo::Impl::blockSize_, Exiv2::RemoteIo::Impl::blocksMap_, close(), EXV_MIN, Exiv2::RemoteIo::Impl::getDataByRange(), Exiv2::RemoteIo::Impl::getFileLength(), Exiv2::RemoteIo::Impl::isMalloced_, p_, Exiv2::BlockMap::populate(), Exiv2::RemoteIo::Impl::size_, and Exiv2::string.
|
virtual |
Mark all the bNone blocks to bKnow. This avoids allocating memory for parts of the file that contain image-date (non-metadata/pixel data)
Reimplemented from Exiv2::BasicIo.
References Exiv2::RemoteIo::Impl::blockSize_, Exiv2::RemoteIo::Impl::blocksMap_, Exiv2::RemoteIo::Impl::isMalloced_, Exiv2::BlockMap::markKnown(), p_, and Exiv2::RemoteIo::Impl::size_.
|
virtual |
|
virtual |
Read data from the memory blocks. Reading starts at the current IO position and the position is advanced by the number of bytes read. If the memory blocks are not populated (False), it will connect to server and populate the data to memory blocks.
rcount | Maximum number of bytes to read. Fewer bytes may be read if rcount bytes are not available. |
Implements Exiv2::BasicIo.
References Exiv2::DataBuf::pData_, and Exiv2::DataBuf::size_.
|
virtual |
Read data from the the memory blocks. Reading starts at the current IO position and the position is advanced by the number of bytes read. If the memory blocks are not populated (!= bMemory), it will connect to server and populate the data to memory blocks.
buf | Pointer to a block of memory into which the read data is stored. The memory block must be at least rcount bytes long. |
rcount | Maximum number of bytes to read. Fewer bytes may be read if rcount bytes are not available. |
Implements Exiv2::BasicIo.
References Exiv2::RemoteIo::Impl::blockSize_, Exiv2::RemoteIo::Impl::blocksMap_, Exiv2::RemoteIo::Impl::eof_, EXV_MIN, Exiv2::RemoteIo::Impl::idx_, Exiv2::RemoteIo::Impl::isMalloced_, p_, Exiv2::RemoteIo::Impl::populateBlocks(), Exiv2::RemoteIo::Impl::size_, and Exiv2::RemoteIo::Impl::totalRead_.
|
virtual |
Move the current IO position.
offset | Number of bytes to move the IO position relative to the starting position specified by pos |
pos | Position from which the seek should start |
Implements Exiv2::BasicIo.
References Exiv2::RemoteIo::Impl::eof_, Exiv2::RemoteIo::Impl::idx_, Exiv2::RemoteIo::Impl::isMalloced_, p_, and Exiv2::RemoteIo::Impl::size_.
|
virtual |
Get the current memory buffer size in bytes.
Implements Exiv2::BasicIo.
References p_, and Exiv2::RemoteIo::Impl::size_.
Referenced by Exiv2::HttpIo::HttpImpl::writeRemote().
|
virtual |
Get the current IO position.
Implements Exiv2::BasicIo.
References Exiv2::RemoteIo::Impl::idx_, and p_.
|
virtual |
Remove the contents of the file and then transfer data from the src BasicIo object into the empty file.
The write access is done in an efficient way. It only sends the range of different bytes between the current data and BasicIo instance to the remote machine.
src | Reference to another BasicIo instance. The entire contents of src are transferred to this object. The src object is invalidated by the method. |
Error | In case of failure |
Implements Exiv2::BasicIo.
References Exiv2::BasicIo::close(), Exiv2::BasicIo::open(), and write().
|
virtual |
Not support this method.
Implements Exiv2::BasicIo.
Referenced by transfer().
|
virtual |
Write data that is read from another BasicIo instance to the remote file.
The write access is done in an efficient way. It only sends the range of different bytes between the current data and BasicIo instance to the remote machine.
src | Reference to another BasicIo instance. Reading start at the source's current IO position |
Error | In case of failure |
Implements Exiv2::BasicIo.
References Exiv2::RemoteIo::Impl::blockSize_, Exiv2::RemoteIo::Impl::blocksMap_, Exiv2::BasicIo::eof(), Exiv2::RemoteIo::Impl::isMalloced_, Exiv2::BasicIo::isopen(), p_, Exiv2::BasicIo::read(), Exiv2::BasicIo::seek(), Exiv2::BasicIo::size(), Exiv2::RemoteIo::Impl::size_, and Exiv2::RemoteIo::Impl::writeRemote().