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 
00092 void
00093 BESDataHandlerInterface::dump( ostream &strm ) const
00094 {
00095     strm << BESIndent::LMarg << "BESDataHandlerInterface::dump" << endl ;
00096     BESIndent::Indent() ;
00097     if( response_handler )
00098     {
00099         strm << BESIndent::LMarg << "response handler:" << endl ;
00100         BESIndent::Indent() ;
00101         response_handler->dump( strm ) ;
00102         BESIndent::UnIndent() ;
00103     }
00104     else
00105     {
00106         strm << BESIndent::LMarg << "response handler: not set" << endl ;
00107     }
00108 
00109     if( container )
00110     {
00111         strm << BESIndent::LMarg << "current container:" << endl ;
00112         BESIndent::Indent() ;
00113         container->dump( strm ) ;
00114         BESIndent::UnIndent() ;
00115     }
00116     else
00117     {
00118         strm << BESIndent::LMarg << "current container: not set" << endl ;
00119     }
00120 
00121     if( containers.size() )
00122     {
00123         strm << BESIndent::LMarg << "container list:" << endl ;
00124         BESIndent::Indent() ;
00125         list<BESContainer *>::const_iterator i = containers.begin() ;
00126         list<BESContainer *>::const_iterator ie = containers.end() ;
00127         for( ; i != ie; i++ )
00128         {
00129             (*i)->dump( strm ) ;
00130         }
00131         BESIndent::UnIndent() ;
00132     }
00133     else
00134     {
00135         strm << BESIndent::LMarg << "container list: empty" << endl ;
00136     }
00137 
00138     strm << BESIndent::LMarg << "action: " << action << endl ;
00139     strm << BESIndent::LMarg << "action name: " << action_name << endl ;
00140     strm << BESIndent::LMarg << "transmit protocol: " << transmit_protocol << endl ;
00141     if( data.size() )
00142     {
00143         strm << BESIndent::LMarg << "data:" << endl ;
00144         BESIndent::Indent() ;
00145         data_citer i = data.begin() ;
00146         data_citer ie = data.end() ;
00147         for( ; i != ie; i++ )
00148         {
00149             strm << BESIndent::LMarg << (*i).first << ": "
00150                                      << (*i).second << endl ;
00151         }
00152         BESIndent::UnIndent() ;
00153     }
00154     else
00155     {
00156         strm << BESIndent::LMarg << "data: none" << endl ;
00157     }
00158 
00159     if( error_info )
00160     {
00161         strm << BESIndent::LMarg << "error info:" << endl ;
00162         BESIndent::Indent() ;
00163         error_info->dump( strm ) ;
00164         BESIndent::UnIndent() ;
00165     }
00166     else
00167     {
00168         strm << BESIndent::LMarg << "error info: null" << endl ;
00169     }
00170     BESIndent::UnIndent() ;
00171 }
00172 

Generated on 27 Oct 2009 for OPeNDAP Hyrax Back End Server (BES) by  doxygen 1.6.1