OPeNDAP Hyrax Back End Server (BES)  Updated for version 3.8.3
BESDataHandlerInterface.cc
Go to the documentation of this file.
1 // BESDataHandlerInterface.cc
2 
3 // This file is part of bes, A C++ back-end server implementation framework
4 // for the OPeNDAP Data Access Protocol.
5 
6 // Copyright (c) 2004-2009 University Corporation for Atmospheric Research
7 // Author: Patrick West <pwest@ucar.edu> and Jose Garcia <jgarcia@ucar.edu>
8 //
9 // This library is free software; you can redistribute it and/or
10 // modify it under the terms of the GNU Lesser General Public
11 // License as published by the Free Software Foundation; either
12 // version 2.1 of the License, or (at your option) any later version.
13 //
14 // This library is distributed in the hope that it will be useful,
15 // but WITHOUT ANY WARRANTY; without even the implied warranty of
16 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 // Lesser General Public License for more details.
18 //
19 // You should have received a copy of the GNU Lesser General Public
20 // License along with this library; if not, write to the Free Software
21 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 //
23 // You can contact University Corporation for Atmospheric Research at
24 // 3080 Center Green Drive, Boulder, CO 80301
25 
26 // (c) COPYRIGHT University Corporation for Atmospheric Research 2004-2005
27 // Please read the full copyright statement in the file COPYRIGHT_UCAR.
28 //
29 // Authors:
30 // pwest Patrick West <pwest@ucar.edu>
31 // jgarcia Jose Garcia <jgarcia@ucar.edu>
32 
34 #include "BESContainer.h"
35 #include "BESResponseHandler.h"
36 #include "BESInfo.h"
37 #include "BESIndent.h"
38 
48 void
50 {
51  this->data = copy_from.data ;
52  this->output_stream = copy_from.output_stream ;
53  this->transmit_protocol = copy_from.transmit_protocol ;
54 }
55 
63 void
65 {
66  if( response_handler )
67  {
68  delete response_handler ;
69  }
70  response_handler = 0 ;
71 }
72 
82 {
83  BESResponseObject *response = 0 ;
84 
85  if( response_handler )
86  {
88  }
89  return response ;
90 }
91 
99 void
100 BESDataHandlerInterface::dump( ostream &strm ) const
101 {
102  strm << BESIndent::LMarg << "BESDataHandlerInterface::dump" << endl ;
104  if( response_handler )
105  {
106  strm << BESIndent::LMarg << "response handler:" << endl ;
108  response_handler->dump( strm ) ;
110  }
111  else
112  {
113  strm << BESIndent::LMarg << "response handler: not set" << endl ;
114  }
115 
116  if( container )
117  {
118  strm << BESIndent::LMarg << "current container:" << endl ;
120  container->dump( strm ) ;
122  }
123  else
124  {
125  strm << BESIndent::LMarg << "current container: not set" << endl ;
126  }
127 
128  if( containers.size() )
129  {
130  strm << BESIndent::LMarg << "container list:" << endl ;
132  list<BESContainer *>::const_iterator i = containers.begin() ;
133  list<BESContainer *>::const_iterator ie = containers.end() ;
134  for( ; i != ie; i++ )
135  {
136  (*i)->dump( strm ) ;
137  }
139  }
140  else
141  {
142  strm << BESIndent::LMarg << "container list: empty" << endl ;
143  }
144 
145  strm << BESIndent::LMarg << "action: " << action << endl ;
146  strm << BESIndent::LMarg << "action name: " << action_name << endl ;
147  strm << BESIndent::LMarg << "transmit protocol: " << transmit_protocol << endl ;
148  if( data.size() )
149  {
150  strm << BESIndent::LMarg << "data:" << endl ;
152  data_citer i = data.begin() ;
153  data_citer ie = data.end() ;
154  for( ; i != ie; i++ )
155  {
156  strm << BESIndent::LMarg << (*i).first << ": "
157  << (*i).second << endl ;
158  }
160  }
161  else
162  {
163  strm << BESIndent::LMarg << "data: none" << endl ;
164  }
165 
166  if( error_info )
167  {
168  strm << BESIndent::LMarg << "error info:" << endl ;
170  error_info->dump( strm ) ;
172  }
173  else
174  {
175  strm << BESIndent::LMarg << "error info: null" << endl ;
176  }
178 }
179 
void clean()
clean up any information created within this data handler interface
virtual void dump(ostream &strm) const
Displays debug information about this object.
Definition: BESInfo.cc:299
map< string, string >::const_iterator data_citer
list< BESContainer * > containers
virtual void dump(ostream &strm) const
dumps information about this object
Definition: BESContainer.cc:71
static void Indent()
Definition: BESIndent.cc:38
void make_copy(const BESDataHandlerInterface &copy_from)
make a copy of only some data from specified object
virtual BESResponseObject * get_response_object()
return the current response object
BESResponseHandler * response_handler
static ostream & LMarg(ostream &strm)
Definition: BESIndent.cc:73
BESResponseObject * get_response_object()
returns the response object using the response handler
string transmit_protocol
request protocol, such as HTTP
void dump(ostream &strm) const
dumps information about this object
Structure storing information used by the BES to handle the request.
map< string, string > data
the map of string data that will be required for the current request.
virtual void dump(ostream &strm) const
dumps information about this object
BESInfo * error_info
error information object
static void UnIndent()
Definition: BESIndent.cc:44
Abstract base class representing a specific set of information in response to a request to the BES...
string action
the response object requested, e.g.
BESContainer * container
pointer to current container in this interface