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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 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  // I tried adding a complete 'clone the dhi' method to see if that
65  // would address the problem we're seeing on OSX 10.9. It didn't but
66  // we're not done yet, so maybe this will be useful still. jhrg 4/16/14
67  void clone(const BESDataHandlerInterface &copy_from);
68 
69 public:
71  output_stream(0), response_handler(0), container(0), executed(false), error_info(0)
72  {
73  }
74 
75  // These were causing multiple compiler warnings, so I removed the implementations since
76  // it's clear they are private to be disallowed from auto generation for now
77  // and this just not declaring an impl solves it. (mpj 2/26/10)
78  //
79  // I implemented these - and made clone() private, since that's a more common pattern.
80  // jhrg 4/18/14
83 
85  void make_copy(const BESDataHandlerInterface &copy_from);
86 
87  void clean();
88 
89  void set_output_stream(ostream *strm)
90  {
91  if (output_stream) {
92  string err = "output stream has already been set";
93  throw BESInternalError(err, __FILE__, __LINE__);
94  }
95  output_stream = strm;
96  }
97 
98  ostream &get_output_stream()
99  {
100  if (!output_stream)
101  throw BESInternalError("output stream has not yet been set, cannot use", __FILE__, __LINE__);
102  return *output_stream;
103  }
104 
107 
108  list<BESContainer *> containers;
109  list<BESContainer *>::iterator containers_iterator;
110 
114 
118  {
120  if (containers_iterator != containers.end())
122  else
123  container = NULL;
124  }
125 
129  {
131  if (containers_iterator != containers.end())
133  else
134  container = NULL;
135  }
136 
139  string action;
140  string action_name;
141  bool executed;
142 
146 
150  map<string, string> data;
151  const map<string, string> &data_c() const
152  {
153  return data;
154  }
155 
156  typedef map<string, string>::const_iterator data_citer;
157 
161 
162  void dump(ostream &strm) const;
163 
164 };
165 
166 #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)
deprecated
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
BESDataHandlerInterface & operator=(const BESDataHandlerInterface &rhs)
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