Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

unzipstreamer.cpp

Go to the documentation of this file.
00001 //============================================================================= 
00002 //
00003 // XDFLengine library
00004 //
00005 //-----------------------------------------------------------------------------
00006 //  FSGETSTREAMER.CPP
00007 //-----------------------------------------------------------------------------
00013 //=============================================================================
00014 
00015 #   include "unzipstreamer.hpp"
00016 #   include "flow/buffers/filebuffer.hpp"
00017 #   include "processor/xmlprocessor.hpp"
00018 #   include "processor/xmlflowcontext.hpp"
00019 
00020 BEGIN_XDFLENGINE_NS
00021 
00022 //=============================================================================
00023 //  CLASS UnzipStreamer
00024 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
00025 
00026 // CONSTRUCTOR & DESTRUCTOR
00027 
00028     //_____________________________________________________________________
00029     //  UnzipStreamer
00030     //---------------------------------------------------------------------
00031     UnzipStreamer::UnzipStreamer( const XMLStreamerFactory* p_pParent, StreamerParams* p_pParameters, XMLFlowContext* p_pContext, XMLStreamConsumer* p_pOutput)
00032     :XMLStreamer( p_pParent, p_pParameters, p_pContext, p_pOutput)
00033     {
00034         DEBUG_CREATE(UnzipStreamer)
00035     }
00036     
00037     //_____________________________________________________________________
00038     //  ~UnzipStreamer
00039     //---------------------------------------------------------------------     
00040     UnzipStreamer::~UnzipStreamer()
00041     {   
00042         DEBUG_DEL(UnzipStreamer)
00043     }
00044     
00045 // STREAM   
00046 
00047     //_____________________________________________________________________
00048     //  INITSTREAM
00049     //---------------------------------------------------------------------
00050     bool UnzipStreamer::initStream()
00051     {
00052         DEBUG_FUNC(UnzipStreamer::initStream)
00053         return true;
00054     }
00055 
00056     //_____________________________________________________________________
00057     //  WRITEDATA
00058     //---------------------------------------------------------------------
00059     void UnzipStreamer::writeData( const char*  p_pszData, unsigned int p_uiDataLen)
00060     {
00061         DEBUG_FUNC(UnzipStreamer::initStream)
00062     }
00063 
00064     //_____________________________________________________________________
00065     //  COMMITSTREAM
00066     //---------------------------------------------------------------------
00067     bool UnzipStreamer::commitStream(bool p_fFinal)
00068     {
00069         //---------------------------------------------------------------------
00070         XMLStreamBuffer*        l_pBufIn=0;
00071         const char*             l_pszFilePath;
00072         unsigned int            l_uiCopyBufferSize;
00073         //---------------------------------------------------------------------
00074 
00075         DEBUG_IN(UnzipStreamer::commitStream)
00076 
00077         PREP_CATCH_XML_FLOW_ERROR;
00078 
00079         WATCH_XML_FLOW_ERROR
00080         {
00081             if(p_fFinal)
00082             {
00083                 // Get File Name
00084                 l_pszFilePath =  getParamValue( m_pParameters, UNZIPSTREAMER_TARGET);
00085                 l_uiCopyBufferSize = atoi( getParamValue(m_pParameters, UNZIPSTREAMER_STREAMDATA,"0"));
00086                 l_pBufIn=new ZipBuffer(l_pszFilePath, true, l_uiCopyBufferSize);
00087                 (*l_pBufIn) >> (*m_pOutput);
00088             }
00089         }
00090         CATCH_XML_FLOW_ERROR_RELEASE_AND_RETURN
00091         catch(...)
00092         {
00093             // Unknown error handling
00094             MAKE_XMLFLOW_EXCEPTION( ERRCODE_LOC_FSGETHANDLER + ERRCODE_CAUSE_FILE , "Error while reading file." , l_pszFilePath, "UnzipHandler::processXML","", false);         
00095         }
00096     RELEASE_AND_RETURN: 
00097 
00098         // Release
00099         delete l_pBufIn;
00100 
00101         DEBUG_OUT(UnzipStreamer::commitStream)
00102         ON_XML_FLOW_ERROR_THROW;
00103 
00104         return true;
00105 
00106         
00107             
00108     }
00109 
00110 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
00111 //=============================================================================
00112 
00113 
00114 //=============================================================================
00115 //  CLASS UnzipStreamerFactory
00116 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
00117     UnzipStreamerFactory::UnzipStreamerFactory()
00118     {
00119         logout.display_version( "ZLIB", "'zlib' general purpose compression library", ZLIB_VERSION, "Copyright (C) 1995-2002 Jean-loup Gailly and Mark Adler"); 
00120     }
00121 
00122     XMLStreamer* UnzipStreamerFactory::getStreamer(
00123         StreamerParams*         p_pParameters, 
00124         XMLFlowContext* p_pStreamContext, 
00125         XMLStreamConsumer*      p_pStreamConsumer) const
00126     {
00127         DEBUG_FUNC(UnzipStreamer::getStreamer)
00128         return (XMLStreamer*) new UnzipStreamer( this, p_pParameters, p_pStreamContext, p_pStreamConsumer);
00129     }
00130 
00131 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
00132 //=============================================================================
00133 
00134 
00135 END_XDFLENGINE_NS
00136 
00137 

Generated on Sat Oct 4 13:20:02 2003 for XDFLengine by doxygen1.3-rc2