BESDataHandlerInterface.cc

Go to the documentation of this file.
00001 // BESDataHandlerInterface.cc
00002 
00003 // This file is part of bes, A C++ back-end server implementation framework
00004 // for the OPeNDAP Data Access Protocol.
00005 
00006 // Copyright (c) 2004-2009 University Corporation for Atmospheric Research
00007 // Author: Patrick West <pwest@ucar.edu> and Jose Garcia <jgarcia@ucar.edu>
00008 //
00009 // This library is free software; you can redistribute it and/or
00010 // modify it under the terms of the GNU Lesser General Public
00011 // License as published by the Free Software Foundation; either
00012 // version 2.1 of the License, or (at your option) any later version.
00013 // 
00014 // This library is distributed in the hope that it will be useful,
00015 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00016 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00017 // Lesser General Public License for more details.
00018 // 
00019 // You should have received a copy of the GNU Lesser General Public
00020 // License along with this library; if not, write to the Free Software
00021 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00022 //
00023 // You can contact University Corporation for Atmospheric Research at
00024 // 3080 Center Green Drive, Boulder, CO 80301
00025  
00026 // (c) COPYRIGHT University Corporation for Atmospheric Research 2004-2005
00027 // Please read the full copyright statement in the file COPYRIGHT_UCAR.
00028 //
00029 // Authors:
00030 //      pwest       Patrick West <pwest@ucar.edu>
00031 //      jgarcia     Jose Garcia <jgarcia@ucar.edu>
00032 
00033 #include "BESDataHandlerInterface.h"
00034 #include "BESContainer.h"
00035 #include "BESResponseHandler.h"
00036 #include "BESInfo.h"
00037 #include "BESIndent.h"
00038 
00048 void
00049 BESDataHandlerInterface::make_copy( const BESDataHandlerInterface &copy_from )
00050 {
00051     this->data = copy_from.data ;
00052     this->output_stream = copy_from.output_stream ;
00053     this->transmit_protocol = copy_from.transmit_protocol ;
00054 }
00055 
00063 void
00064 BESDataHandlerInterface::clean()
00065 {
00066     if( response_handler )
00067     {
00068         delete response_handler ;
00069     }
00070     response_handler = 0 ;
00071 }
00072 
00080 BESResponseObject *
00081 BESDataHandlerInterface::get_response_object()
00082 {
00083     BESResponseObject *response = 0 ;
00084 
00085     if( response_handler )
00086     {
00087         response = response_handler->get_response_object() ;
00088     }
00089     return response ;
00090 }
00091 
00099 void
00100 BESDataHandlerInterface::dump( ostream &strm ) const
00101 {
00102     strm << BESIndent::LMarg << "BESDataHandlerInterface::dump" << endl ;
00103     BESIndent::Indent() ;
00104     if( response_handler )
00105     {
00106         strm << BESIndent::LMarg << "response handler:" << endl ;
00107         BESIndent::Indent() ;
00108         response_handler->dump( strm ) ;
00109         BESIndent::UnIndent() ;
00110     }
00111     else
00112     {
00113         strm << BESIndent::LMarg << "response handler: not set" << endl ;
00114     }
00115 
00116     if( container )
00117     {
00118         strm << BESIndent::LMarg << "current container:" << endl ;
00119         BESIndent::Indent() ;
00120         container->dump( strm ) ;
00121         BESIndent::UnIndent() ;
00122     }
00123     else
00124     {
00125         strm << BESIndent::LMarg << "current container: not set" << endl ;
00126     }
00127 
00128     if( containers.size() )
00129     {
00130         strm << BESIndent::LMarg << "container list:" << endl ;
00131         BESIndent::Indent() ;
00132         list<BESContainer *>::const_iterator i = containers.begin() ;
00133         list<BESContainer *>::const_iterator ie = containers.end() ;
00134         for( ; i != ie; i++ )
00135         {
00136             (*i)->dump( strm ) ;
00137         }
00138         BESIndent::UnIndent() ;
00139     }
00140     else
00141     {
00142         strm << BESIndent::LMarg << "container list: empty" << endl ;
00143     }
00144 
00145     strm << BESIndent::LMarg << "action: " << action << endl ;
00146     strm << BESIndent::LMarg << "action name: " << action_name << endl ;
00147     strm << BESIndent::LMarg << "transmit protocol: " << transmit_protocol << endl ;
00148     if( data.size() )
00149     {
00150         strm << BESIndent::LMarg << "data:" << endl ;
00151         BESIndent::Indent() ;
00152         data_citer i = data.begin() ;
00153         data_citer ie = data.end() ;
00154         for( ; i != ie; i++ )
00155         {
00156             strm << BESIndent::LMarg << (*i).first << ": "
00157                                      << (*i).second << endl ;
00158         }
00159         BESIndent::UnIndent() ;
00160     }
00161     else
00162     {
00163         strm << BESIndent::LMarg << "data: none" << endl ;
00164     }
00165 
00166     if( error_info )
00167     {
00168         strm << BESIndent::LMarg << "error info:" << endl ;
00169         BESIndent::Indent() ;
00170         error_info->dump( strm ) ;
00171         BESIndent::UnIndent() ;
00172     }
00173     else
00174     {
00175         strm << BESIndent::LMarg << "error info: null" << endl ;
00176     }
00177     BESIndent::UnIndent() ;
00178 }
00179 

Generated on Thu Sep 16 15:20:29 2010 for OPeNDAP Hyrax Back End Server (BES) by  doxygen 1.4.7