OPeNDAP Hyrax Back End Server (BES)  Updated for version 3.8.3
BESDataHandlerInterface.h
Go to the documentation of this file.
1 // BESDataHandlerInterface.h
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 
33 #ifndef BESDataHandlerInterface_h_
34 #define BESDataHandlerInterface_h_ 1
35 
36 #include <string>
37 #include <list>
38 #include <map>
39 #include <iostream>
40 
41 using std::string;
42 using std::list;
43 using std::map;
44 using std::ostream;
45 
46 class BESResponseHandler;
47 class BESResponseObject;
48 class BESInfo;
49 
50 #include "BESObj.h"
51 #include "BESContainer.h"
52 #include "BESInternalError.h"
53 
61 private:
62  ostream *output_stream;
63 
64  // These were causing multiple compiler warnings, so I removed the implementations since
65  // it's clear they are private to be disallowed from auto generation for now
66  // and this just not declaring an impl solves it. (mpj 2/26/10)
68 
69  BESDataHandlerInterface & operator=(const BESDataHandlerInterface &rhs);
70 
71 public:
73  output_stream(0), response_handler(0), container(0), executed(false), error_info(0)
74  {
75  }
76 
77  void make_copy(const BESDataHandlerInterface &copy_from);
78  void clean();
79 
80  void set_output_stream(ostream *strm)
81  {
82  if (output_stream) {
83  string err = "output stream has already been set";
84  throw BESInternalError(err, __FILE__, __LINE__);
85  }
86  output_stream = strm;
87  }
88 
89  ostream &get_output_stream()
90  {
91  if (!output_stream)
92  throw BESInternalError("output stream has not yet been set, cannot use", __FILE__, __LINE__);
93  return *output_stream;
94  }
95 
98 
99  list<BESContainer *> containers;
100  list<BESContainer *>::iterator containers_iterator;
101 
105 
109  {
111  if (containers_iterator != containers.end())
113  else
114  container = NULL;
115  }
116 
120  {
122  if (containers_iterator != containers.end())
124  else
125  container = NULL;
126  }
127 
130  string action;
131  string action_name;
132  bool executed;
133 
137 
141  map<string, string> data;
142  const map<string, string> &data_c() const
143  {
144  return data;
145  }
146 
147  typedef map<string, string>::const_iterator data_citer;
148 
152 
153  void dump(ostream &strm) const;
154 
155 };
156 
157 #endif // BESDataHandlerInterface_h_
void clean()
clean up any information created within this data handler interface
void dump(ostream &strm) const
dumps information about this object
exception thrown if inernal error encountered
void set_output_stream(ostream *strm)
map< string, string >::const_iterator data_citer
void next_container()
set the container pointer to the next * container in the list, null if at the end or no containers in...
list< BESContainer * > containers
void make_copy(const BESDataHandlerInterface &copy_from)
make a copy of only some data from specified object
Base object for bes objects.
Definition: BESObj.h:52
handler object that knows how to create a specific response object
informational response object
Definition: BESInfo.h:68
BESResponseHandler * response_handler
BESResponseObject * get_response_object()
returns the response object using the response handler
string transmit_protocol
request protocol, such as HTTP
list< BESContainer * >::iterator containers_iterator
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.
void first_container()
set the container pointer to the first container in the containers list
BESInfo * error_info
error information object
A container is something that holds data.
Definition: BESContainer.h:60
const map< string, string > & data_c() const
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