MonitoredInputStream.h

Go to the documentation of this file.
00001 //
00002 //  Copyright (c) 2003-2006 by Autodesk, Inc.
00003 //
00004 //  By using this code, you are agreeing to the terms and conditions of
00005 //  the License Agreement included in the documentation for this code.
00006 //
00007 //  AUTODESK MAKES NO WARRANTIES, EXPRESS OR IMPLIED,
00008 //  AS TO THE CORRECTNESS OF THIS CODE OR ANY DERIVATIVE
00009 //  WORKS WHICH INCORPORATE IT.
00010 //
00011 //  AUTODESK PROVIDES THE CODE ON AN "AS-IS" BASIS
00012 //  AND EXPLICITLY DISCLAIMS ANY LIABILITY, INCLUDING
00013 //  CONSEQUENTIAL AND INCIDENTAL DAMAGES FOR ERRORS,
00014 //  OMISSIONS, AND OTHER PROBLEMS IN THE CODE.
00015 //
00016 //  Use, duplication, or disclosure by the U.S. Government is subject to
00017 //  restrictions set forth in FAR 52.227-19 (Commercial Computer Software
00018 //  Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) (Rights in Technical
00019 //  Data and Computer Software), as applicable.
00020 //
00021 
00022 
00023 #ifndef _DWFCORE_MONITORED_INPUT_STREAM_H
00024 #define _DWFCORE_MONITORED_INPUT_STREAM_H
00025 
00026 
00031 
00032 
00033 #include "dwfcore/InputStream.h"
00034 #include "dwfcore/OutputStream.h"
00035 
00036 
00037 namespace DWFCore
00038 {
00039 
00100 class DWFMonitoredInputStream : virtual public DWFCoreMemory
00101                               , public DWFInputStream
00102 {
00103 
00104 public:
00105 
00112     class Monitor
00113     {
00114 
00115     public:
00116 
00122         _DWFCORE_API
00123         virtual ~Monitor()
00124             throw()
00125         {;}
00126 
00136         _DWFCORE_API 
00137         virtual void notify( const void* const pBuffer,
00138                              size_t            nBytesRequested,
00139                              size_t            nBytesRead )
00140              throw( DWFException ) = 0;
00141 
00142     protected:
00143 
00149         _DWFCORE_API
00150         Monitor()
00151             throw()
00152         {;}
00153 
00154     };
00155 
00156 public:
00157 
00168     _DWFCORE_API
00169     DWFMonitoredInputStream( DWFInputStream* pStream,
00170                              bool            bOwnStream )
00171         throw();
00172 
00178     _DWFCORE_API 
00179     virtual ~DWFMonitoredInputStream()
00180         throw();
00181 
00196     _DWFCORE_API 
00197     void attach( Monitor* pMonitor, bool bOwnMonitor )
00198         throw( DWFException );
00199 
00214     _DWFCORE_API 
00215     void attach( DWFOutputStream* pMonitor, bool bOwnMonitor )
00216         throw( DWFException );
00217 
00224     _DWFCORE_API 
00225     void detach()
00226         throw( DWFException );
00227 
00231     _DWFCORE_API 
00232     size_t available() const
00233         throw( DWFException );
00234 
00238     _DWFCORE_API 
00239     size_t read( void*  pBuffer,
00240                  size_t nBytesToRead )
00241         throw( DWFException );
00242 
00246     _DWFCORE_API 
00247     off_t seek( int    eOrigin,
00248                 off_t  nOffset )
00249         throw( DWFException );
00250 
00251 
00252 private:
00253 
00254     DWFInputStream*     _pStream;
00255 
00256     Monitor*            _pMonitor;
00257     DWFOutputStream*    _pMonitorStream;
00258 
00259     bool                _bOwnStream;
00260     bool                _bOwnMonitor;
00261     bool                _bOwnMonitorStream;
00262 
00263 private:
00264 
00265     //
00266     // Unimplemented methods
00267     //
00268 
00269     DWFMonitoredInputStream( const DWFMonitoredInputStream& );
00270     DWFMonitoredInputStream& operator=( const DWFMonitoredInputStream& );
00271 };
00272 
00273 }
00274 
00275 
00276 
00277 #endif

Generated on Tue Jan 6 22:39:29 2009 for Autodesk DWF Core Library by  doxygen 1.4.5