FDO API Reference | Feature Data Objects |
00001 #ifndef FDO_ISTREAMREADERTMPL_H 00002 #define FDO_ISTREAMREADERTMPL_H 00003 // 00004 00005 // 00006 // Copyright (C) 2004-2006 Autodesk, Inc. 00007 // 00008 // This library is free software; you can redistribute it and/or 00009 // modify it under the terms of version 2.1 of the GNU Lesser 00010 // General Public License as published by the Free Software Foundation. 00011 // 00012 // This library is distributed in the hope that it will be useful, 00013 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00015 // Lesser General Public License for more details. 00016 // 00017 // You should have received a copy of the GNU Lesser General Public 00018 // License along with this library; if not, write to the Free Software 00019 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00020 // 00021 00022 #include <Common/Array.h> 00023 #include <Common/IStreamReader.h> 00024 00025 /// \brief 00026 /// FdoIStreamReaderTmpl reads items from a stream of [T]. 00027 template <typename T> class FdoIStreamReaderTmpl : public FdoIStreamReader 00028 { 00029 public: 00030 00031 /// \brief 00032 /// Get the size of a stream. 00033 /// 00034 /// \return 00035 /// Returns the size of the data source in number of items 00036 /// 00037 FDO_API_COMMON virtual FdoInt64 GetLength() = 0; 00038 00039 /// \brief 00040 /// Skips a number of items 00041 /// 00042 /// \param offset 00043 /// Number of items to skip. Must be a positive number 00044 /// 00045 /// \return 00046 /// Returns nothing 00047 /// 00048 FDO_API_COMMON virtual void Skip(const FdoInt32 offset) = 0; 00049 00050 /// \brief 00051 /// Get the current index in the stream 00052 /// 00053 /// \return 00054 /// Returns the current index in the stream in number of items 00055 /// 00056 FDO_API_COMMON virtual FdoInt64 GetIndex() = 0; 00057 00058 /// \brief 00059 /// Reset the current index in the stream. Allows re-reading 00060 /// 00061 /// \return 00062 /// Returns nothing 00063 /// 00064 FDO_API_COMMON virtual void Reset() = 0; 00065 00066 /// \brief 00067 /// Reads in the next block of items. Use ReadNext( buffer) to read in 00068 /// the entire stream. 00069 /// 00070 /// \param buffer 00071 /// Buffer holding data read in 00072 /// \param offset 00073 /// Index in the buffer indicating the beginning of the output buffer. 00074 /// The caller is responsable for allocating a buffer of a proper size. 00075 /// \param count 00076 /// Number of items to be read in. If -1 read the entire stream. 00077 /// Throws "invalid parameter" exception if not a positive value or -1. 00078 /// 00079 /// \return 00080 /// Returns the number of items actually read in. When 0 (zero) then the 00081 /// end-of-stream was reached. 00082 /// 00083 00084 FDO_API_COMMON virtual FdoInt32 ReadNext( T* buffer, 00085 const FdoInt32 offset = 0, 00086 const FdoInt32 count = -1) = 0; 00087 00088 /// \brief 00089 /// Reads in the next block of items. Use ReadNext( buffer) to read in 00090 /// the entire stream. The caller is responsible to create/dispose the FdoArray. 00091 /// 00092 /// \param buffer 00093 /// FdoArray object holding data read in. Cannot be NULL 00094 /// \param offset 00095 /// Index in the array indicating the beginning of the output buffer. 00096 /// If the end of the buffer, then read in appending mode (store at the end). 00097 /// Otherwise, overwrite the buffer. Throws "invalid parameter" exception if not in this range. 00098 /// \param count 00099 /// Number of items to be read in. If -1 read the entire stream. 00100 /// Throws "invalid parameter" exception if not a positive value or -1. 00101 /// 00102 /// \return 00103 /// Returns number of items read. 00104 /// 00105 FDO_API_COMMON virtual FdoInt32 ReadNext( FdoArray<T> * &buffer, 00106 const FdoInt32 offset = 0, 00107 const FdoInt32 count = -1 ) = 0; 00108 }; 00109 00110 #endif 00111 00112
Comments or suggestions? Send us feedback. |