FDO .NET API Reference Feature Data Objects

mgIoStream.h

Go to the documentation of this file.
00001 /*
00002 * Copyright (C) 2004-2006  Autodesk, Inc.
00003 * 
00004 * This library is free software; you can redistribute it and/or
00005 * modify it under the terms of version 2.1 of the GNU Lesser
00006 * General Public License as published by the Free Software Foundation.
00007 * 
00008 * This library is distributed in the hope that it will be useful,
00009 * but WITHOUT ANY WARRANTY; without even the implied warranty of
00010 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00011 * Lesser General Public License for more details.
00012 * 
00013 * You should have received a copy of the GNU Lesser General Public
00014 * License along with this library; if not, write to the Free Software
00015 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00016 *
00017 */
00018 
00019 #pragma once
00020 
00021 #include "Runtime\Disposable.h"
00022 
00023 class VirtualFdoIoStream;
00024 class FdoIoStream;
00025 
00026 BEGIN_NAMESPACE_OSGEO_COMMON_IO
00027 
00028 /// \ingroup (OSGeoFDOCommonIo)
00029 /// \brief
00030 ///    IoStream defines the interface for all FDO streams. Streamed I/O support
00031 ///    for various locations, such as files, memory, etc. can be provided by classes
00032 ///    that implement this interface.
00033 public __gc class IoStream : public NAMESPACE_OSGEO_RUNTIME::Disposable
00034 {
00035 public:
00036     /// \brief
00037     ///     reads the number of bytes indicated by count into the given buffer, 
00038     ///     or the number of bytes after the current stream position, whichever is less. 
00039     ///     The stream’s current position is moved ahead by the number of bytes read.
00040     /// 
00041     /// \param buffer 
00042     ///     Output read into this buffer
00043     ///
00044     /// \param count 
00045     ///     Input read this number of bytes into the buffer.
00046     ///     The caller is responsible for allocating a buffer that is large enough to hold the bytes.
00047     /// 
00048     /// \return
00049     ///     Returns the number of bytes that were read. 0 if already at the
00050     ///     end of the stream.
00051     /// 
00052     virtual System::UInt32 Read(System::Byte buffer[], System::UInt32 count);
00053 
00054     /// \brief
00055     ///     writes the number of bytes indicated by count, from the given buffer, 
00056     ///     to the stream. The current position is moved ahead by the number of bytes 
00057     ///     written.
00058     /// 
00059     /// \param buffer 
00060     ///     Intput write from this buffer
00061     ///
00062     /// \param count 
00063     ///     Input number of bytes to write
00064     /// 
00065     /// \remarks
00066     ///     Note: Write will overwrite some of the contents of the stream 
00067     ///     if the current position is not at the end of the stream.
00068     /// 
00069     virtual System::Void Write(System::Byte buffer[], System::UInt32 count);
00070 
00071     /// \brief
00072     ///     reads the number of bytes from the given stream, and writes them 
00073     ///     to this stream. 
00074     /// 
00075     /// \param stream 
00076     ///     Input write from this buffer
00077     ///
00078     virtual System::Void Write(NAMESPACE_OSGEO_COMMON_IO::IoStream* stream);
00079 
00080     /// \brief
00081     ///     reads the number of bytes from the given stream, and writes them 
00082     ///     to this stream. 
00083     /// 
00084     /// \param stream 
00085     ///     Input write from this buffer
00086     ///
00087     /// \param count 
00088     ///     Input the maximum number of bytes to read and write.
00089     ///     When 0, all remaining bytes are read from the given stream.
00090     /// 
00091     virtual System::Void Write(NAMESPACE_OSGEO_COMMON_IO::IoStream* stream, System::UInt32 count);
00092 
00093     /// \brief
00094     ///     sets the position to the start of the stream.
00095     /// 
00096     virtual System::Void Reset();
00097 
00098     /// \brief
00099     ///     skips over part of the stream.
00100     /// 
00101     /// \param count 
00102     ///     The number of bytes to skip. if positive then 
00103     ///     the current position is moved forward. If negative, the position is
00104     ///     moved backward. The position will remain between the start and end 
00105     ///     of the stream. The position is set to the end of the stream if the 
00106     ///     given offset would put it past the end. Similarily, if the position is 
00107     ///     set to the start if the offset would put it before the start.
00108     /// 
00109     virtual System::Void Skip(System::Int64 count);
00110 
00111     /// \brief
00112     ///     truncates the stream to the indicated length.
00113     /// 
00114     /// \param length 
00115     ///     Input the new length (in bytes) for the stream. If this is 
00116     ///     longer than the current stream length then the stream's length
00117     ///     is not changed.
00118     /// 
00119     __property virtual System::Void set_Length(System::Int64 length);
00120 
00121     /// \brief
00122     ///     gets the current length of the stream.
00123     /// 
00124     /// \return
00125     ///     Returns the length in bytes. Returns -1 if the length is unknown
00126     ///     or undefined.
00127     /// 
00128     __property virtual System::Int64 get_Length();
00129 
00130     /// \brief
00131     ///     gets the current position for the stream.
00132     /// 
00133     /// \return
00134     ///     Returns the position in bytes from the start. When 0, the 
00135     ///     the position is at the start of the stream. When Index() ==
00136     ///     Length() the position is at the end of the stream.
00137     /// 
00138     __property virtual System::Int64 get_Index();
00139 
00140     /// \brief
00141     ///     Gets the reading capability of the stream.
00142     /// 
00143     /// \return
00144     ///     Returns true if the stream can be read.
00145     /// 
00146     __property virtual System::Boolean get_CanRead();
00147 
00148     /// \brief
00149     ///     Gets the writing capability of the stream.
00150     /// 
00151     /// \return
00152     ///     Returns true if the stream can be written to.
00153     /// 
00154     __property virtual System::Boolean get_CanWrite();
00155 
00156     /// \brief
00157     ///     returns whether the stream has any positional context.
00158     ///     Streams without context can only be read and written in a forward-only
00159     ///     manner. These streams do not allow position and length changes.
00160     /// 
00161     /// \return
00162     ///    Returns true if the stream has context. Returns false if it does 
00163     ///    not. When a stream does not have context, the SetLength(), Skip() and 
00164     ///    Reset() functions are not supported.
00165     /// 
00166     ///  
00167     __property virtual System::Boolean get_HasContext();
00168 
00169     /// \brief
00170     ///     Constructs a stream based on an unmanaged instance of the object
00171     /// 
00172     /// \param unmanaged 
00173     ///     Input A Pointer to the unmanaged stream.
00174     /// 
00175     /// \param autoDelete 
00176     ///     Input Indicates if the constructed object should be automatically deleted 
00177     ///     once it no longer referenced.
00178     /// 
00179     IoStream(System::IntPtr unmanaged, System::Boolean autoDelete);
00180 
00181     /// \brief
00182     ///     Closes the current stream and releases any resources (such as sockets and file handles) associated with the current stream. 
00183     /// 
00184     /// \remarks
00185     ///     Note: A call to Close is required for proper operation of a stream. 
00186     ///     Following a call to Close, other operations on the stream could throw exceptions. 
00187     ///     If the stream is already closed, a call to Close throws no exceptions.
00188     /// 
00189     System::Void Close();
00190 
00191 /// \cond DOXYGEN-IGNORE
00192 protected:
00193     IoStream();
00194 
00195     System::Void ReleaseUnmanagedObject();
00196 
00197 public private:
00198     inline FdoIoStream* GetImpObj();
00199 /// \endcond
00200 };
00201 
00202 END_NAMESPACE_OSGEO_COMMON_IO
00203 
00204 

Comments or suggestions? Send us feedback.