:mod:`dip.io.storage`
=====================
.. module:: dip.io.storage

The :mod:`dip.io.storage` module implements support for specific
:term:`storage` types.


:class:`QIODeviceStorage`
-------------------------
.. class:: QIODeviceStorage

    Base class: :class:`~dip.io.BaseStorage`

    The QIODeviceStorage class is an abstract base class for storage that
    is accessed via a :class:`~PyQt4.QtCore.QIODevice`.

    .. attribute:: read_buffer_size = Int(16384)

        The number of bytes to read at a time.

    .. method:: QIODeviceStorage.implicit_location(model)

        Return the implicit storage location for a model.
        
        :param model:
            is the model.
        :return:
            ``None`` as devices typically have explicit locations.

    .. method:: QIODeviceStorage.qiodevice(location)

        A storage location is converted to a
        :class:`~PyQt4.QtCore.QIODevice` instance.  This must be reimplemented
        by a sub-class.
        
        :param location:
            is the storage location.
        :return:
            the :class:`~PyQt4.QtCore.QIODevice`.

    .. method:: QIODeviceStorage.read(model, location)

        Read a model from a filesystem location.
        
        :param model:
            is the model.
        :param location:
            is the filesystem location where the model is read from.
        :return:
            the read model.  This may be the original model populated
            from the filesystem location, or it may be a different model (of an
            appropriate type) created from the filesystem location.  If
            ``None`` is returned then it is assumed that the read was abandoned
            and the user informed appropriately.

    .. method:: QIODeviceStorage.write(model, location)

        Write a model to a filesystem location.
        
        :param model:
            is the model.
        :param location:
            is the filesystem location where the model is written to.
