OPeNDAP Hyrax Back End Server (BES)  Updated for version 3.8.3
BESInterface.h
Go to the documentation of this file.
1 // BESInterface.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 BESInterface_h_
34 #define BESInterface_h_ 1
35 
36 #include <list>
37 
38 using std::list ;
39 
41 
42 #include "BESObj.h"
43 
44 class BESError ;
45 class BESTransmitter ;
46 
47 typedef bool (*p_bes_init)( BESDataHandlerInterface &dhi ) ;
48 typedef void (*p_bes_end)( BESDataHandlerInterface &dhi ) ;
49 
123 class BESInterface : public BESObj
124 {
125 private:
126  typedef list< p_bes_init >::const_iterator init_citer ;
127  typedef list< p_bes_init >::iterator init_iter ;
128  static list< p_bes_init > _init_list ;
129 
130  typedef list< p_bes_end >::const_iterator end_citer ;
131  typedef list< p_bes_end >::iterator end_iter ;
132  static list< p_bes_end > _end_list ;
133 
134  ostream *_strm ;
135 protected:
138 
139  virtual int exception_manager( BESError &e ) ;
140  virtual void initialize() ;
141  virtual void validate_data_request() ;
142 
151  virtual void build_data_request_plan() = 0 ;
152 
153  virtual void execute_data_request_plan() ;
154  virtual void invoke_aggregation() ;
155 
156  virtual int finish( int status ) ;
157  virtual void transmit_data() ;
158  virtual void log_status() ;
159  virtual void report_request() ;
160  virtual void end_request() ;
161  virtual void clean() ;
162 
163  BESInterface( ostream *strm ) ;
164  virtual ~BESInterface() ;
165 public:
166  virtual int execute_request( const string &from ) ;
167  virtual int finish_with_error( int status ) ;
168 
169  virtual void dump( ostream &strm ) const ;
170 
171  static void add_init_callback( p_bes_init init ) ;
172  static void add_end_callback( p_bes_end end ) ;
173 } ;
174 
175 #endif // BESInterface_h_
176