Celartem::Storage Class Reference

#include <cel_storage.h>

Inheritance diagram for Celartem::Storage:

Inheritance graph
[legend]

List of all members.

Public Member Functions

virtual uint64_t getSize () const =0
virtual uint64_t getPos () const =0
virtual void reserve (uint64_t inReservationSize)=0
virtual void setPos (uint64_t inPosition)=0
virtual void setPosRelative (int64_t inPosition)=0
virtual void setPosFromEnd (int64_t inPosition)=0
virtual void setEof ()=0
virtual String getStorageId () const =0
virtual AutoPtr< Storageduplicate () const =0
virtual Time getLastUpdateTime () const =0

Static Public Member Functions

static AutoPtr< Storagecreate (const String &inUriOrFileName, bool inLateBinding=false, ResourceBroker *inBroker=NULL)


Detailed Description

This class provides the definition of Storage interface.
For the storage class factory functions, see Storage Class Factory Functions.
See also:
Storage Class Factory Functions

Definition at line 25 of file cel_storage.h.


Member Function Documentation

virtual uint64_t Celartem::Storage::getSize (  )  const [pure virtual]

This method obtains the current storage size in bytes.

Returns:
The current storage size.

virtual uint64_t Celartem::Storage::getPos (  )  const [pure virtual]

This method obtains the current storage pointer position in byte offset from the beginning of the storage.

Returns:
The current storage pointer position.

virtual void Celartem::Storage::reserve ( uint64_t  inReservationSize  )  [pure virtual]

This method reserves the storage size. Since to resize the storage is not so simple work and it may takes so much time, you should reserve the size of storage in the first time. With this method, you don't have to care of the runtime costs of the resizing storage.
Please note that there are storages that is not implement the method. In any case, it never throws any exception but it may do nothing.

Parameters:
inReservationSize Size to reserve.

virtual void Celartem::Storage::setPos ( uint64_t  inPosition  )  [pure virtual]

This method moves the storage pointer to the specified position. Please note that it is not an error to set the storage pointer to a position beyond the EOF. The size of the file does not increase until you call the writeBytes function. A write operation increases the size of the storage to the storage pointer position plus the size of the buffer written, leaving the intervening bytes uninitialized.

Parameters:
inPosition Position in byte offset from the beginning of the storage.
See also:
setPosRelative, setPosFromEnd

Referenced by Celartem::DjVu::MemoryData::create().

virtual void Celartem::Storage::setPosRelative ( int64_t  inPosition  )  [pure virtual]

This method moves the storage pointer to the specified position. Please note that it is not an error to set the storage pointer to a position beyond the EOF. The size of the file does not increase until you call the writeBytes function. A write operation increases the size of the storage to the storage pointer position plus the size of the buffer written, leaving the intervening bytes uninitialized.

Parameters:
inPosition Position in byte offset from the current storage pointer position.
See also:
setPos, setPosFromEnd

virtual void Celartem::Storage::setPosFromEnd ( int64_t  inPosition  )  [pure virtual]

This method moves the storage pointer to the specified position. Please note that it is not an error to set the storage pointer to a position beyond the EOF. The size of the file does not increase until you call the writeBytes function. A write operation increases the size of the storage to the storage pointer position plus the size of the buffer written, leaving the intervening bytes uninitialized.

Parameters:
inPosition Position in byte offset from the current EOF.
See also:
setPos, setPosRelative

virtual void Celartem::Storage::setEof (  )  [pure virtual]

This method set the end mark to the current storage position. The following code sets the storage size:

                void setStorageSize(Storage *inStorage, size_t inSize)
                {
                    // firstly, preserves the current position
                    StorageRewinder sr(inStorage);

                    // set size
                    inStorage->setPos(inSize);
                    inStorage->setEof();
                }

virtual String Celartem::Storage::getStorageId (  )  const [pure virtual]

This method returns the identifier of the storage.
It usually returns a filename or an URL that specifies the storage location. In cases with volatile storage, this function returns some string that is automatically generated by the storage class.

virtual AutoPtr<Storage> Celartem::Storage::duplicate (  )  const [pure virtual]

This method duplicates the storage instance, it is not to duplicate the reference count of the storage instance.

Returns:
Pointer to the newly created copy of the Storage.

virtual Time Celartem::Storage::getLastUpdateTime (  )  const [pure virtual]

This method returns the last update time of the file.

Returns:
The last update time.

static AutoPtr<Storage> Celartem::Storage::create ( const String inUriOrFileName,
bool  inLateBinding = false,
ResourceBroker inBroker = NULL 
) [static]

This method locates the resource and returns a pointer to read-only Storage instance.

Parameters:
inUriOrFileName URI or local file name of the resource. The default implementation can deal with URIs starts from http or file or local file names.
inLateBinding If this parameter is true, this method actually never establish a connection to the resource but the first time when any of the methods of this instance is called, it tries to connect to the resource.
Otherwise, if this parameter is false, this method immediately connects to the resource within this method.
inBroker A ResourceBroker instance which locates the file.
If NULL is specified, this method uses the default broker.
Returns:
Pointer to the Storage instance of the specified resource. This method internally uses the shared instance of ResourceBroker class.
See also:
ResourceBroker::create


The documentation for this class was generated from the following file:
This document is automatically generated using doxygen 1.5.4 at Fri Jun 27 18:23:20 2008.