bes  Updated for version 3.20.6
FONcModule.cc
1 // FONcModule.cc
2 
3 // This file is part of BES filout NetCDF Module.
4 
5 // Copyright (c) 2004,2005 University Corporation for Atmospheric Research
6 // Author: Patrick West <pwest@ucar.edu> and Jose Garcia <jgarcia@ucar.edu>
7 //
8 // This library is free software; you can redistribute it and/or
9 // modify it under the terms of the GNU Lesser General Public
10 // License as published by the Free Software Foundation; either
11 // version 2.1 of the License, or (at your option) any later version.
12 //
13 // This library is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 // Lesser General Public License for more details.
17 //
18 // You should have received a copy of the GNU Lesser General Public
19 // License along with this library; if not, write to the Free Software
20 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 //
22 // You can contact University Corporation for Atmospheric Research at
23 // 3080 Center Green Drive, Boulder, CO 80301
24 
25 // (c) COPYRIGHT University Corporation for Atmospheric Research 2004-2005
26 // Please read the full copyright statement in the file COPYRIGHT_UCAR.
27 //
28 // Authors:
29 // pwest Patrick West <pwest@ucar.edu>
30 // jgarcia Jose Garcia <jgarcia@ucar.edu>
31 
32 #include "config.h"
33 
34 #include <iostream>
35 
36 using std::endl;
37 
38 #include "FONcBaseType.h"
39 #include "FONcModule.h"
40 #include "FONcTransmitter.h"
41 #include "FONcRequestHandler.h"
42 #include "BESRequestHandlerList.h"
43 
44 #include <BESReturnManager.h>
45 
46 #include <BESServiceRegistry.h>
47 #include <BESDapNames.h>
48 
49 #include <TheBESKeys.h>
50 #include <BESDebug.h>
51 
62 void FONcModule::initialize(const string &modname)
63 {
64  BESDEBUG("fonc", "Initializing module " << modname << endl);
65 
66  BESRequestHandler *handler = new FONcRequestHandler(modname);
67  BESRequestHandlerList::TheList()->add_handler(modname, handler);
68 
69  BESReturnManager::TheManager()->add_transmitter( RETURNAS_NETCDF, new FONcTransmitter());
70 
71  BESServiceRegistry::TheRegistry()->add_format( OPENDAP_SERVICE, DATA_SERVICE, RETURNAS_NETCDF);
72 
73  BESReturnManager::TheManager()->add_transmitter( RETURNAS_NETCDF4, new FONcTransmitter());
74 
75  BESServiceRegistry::TheRegistry()->add_format( OPENDAP_SERVICE, DATA_SERVICE, RETURNAS_NETCDF4);
76 
77  BESDebug::Register("fonc");
78 
79  BESDEBUG("fonc", "Done Initializing module " << modname << endl);
80 }
81 
90 void FONcModule::terminate(const string &modname)
91 {
92  BESDEBUG("fonc", "Cleaning module " << modname << endl);
93 
94  BESReturnManager::TheManager()->del_transmitter( RETURNAS_NETCDF);
95 
96  BESReturnManager::TheManager()->del_transmitter( RETURNAS_NETCDF4);
97 
98  BESRequestHandler *rh = BESRequestHandlerList::TheList()->remove_handler(modname);
99  delete rh;
100 
101  BESDEBUG("fonc", "Done Cleaning module " << modname << endl);
102 }
103 
110 void FONcModule::dump(ostream &strm) const
111 {
112  strm << BESIndent::LMarg << "FONcModule::dump - (" << (void *) this << ")" << endl;
113 }
114 
118 extern "C"
119 BESAbstractModule *maker()
120 {
121  return new FONcModule;
122 }
123 
BESRequestHandler
Represents a specific data type request handler.
Definition: BESRequestHandler.h:74
BESRequestHandlerList::remove_handler
virtual BESRequestHandler * remove_handler(const std::string &handler_name)
remove and return the specified request handler
Definition: BESRequestHandlerList.cc:76
BESAbstractModule
Definition: BESAbstractModule.h:40
BESServiceRegistry::add_format
virtual void add_format(const std::string &service, const std::string &cmd, const std::string &format)
add a format response to a command of a service
Definition: BESServiceRegistry.cc:130
FONcTransmitter
BESTransmitter class named "netcdf" that transmits an OPeNDAP data object as a netcdf file.
Definition: FONcTransmitter.h:53
FONcRequestHandler
A Request Handler for the Fileout NetCDF request.
Definition: FONcRequestHandler.h:45
FONcModule
Module that allows for OPeNDAP Data objects to be returned as netcdf files.
Definition: FONcModule.h:52
BESRequestHandlerList::add_handler
virtual bool add_handler(const std::string &handler_name, BESRequestHandler *handler)
add a request handler to the list of registered handlers for this server
Definition: BESRequestHandlerList.cc:54
BESDebug::Register
static void Register(const std::string &flagName)
register the specified debug flag
Definition: BESDebug.h:138
FONcModule::dump
virtual void dump(std::ostream &strm) const
dumps information about this object for debugging purposes
Definition: FONcModule.cc:110
FONcModule::terminate
virtual void terminate(const std::string &modname)
removes any registered callbacks or objects from the framework
Definition: FONcModule.cc:90
FONcModule::initialize
virtual void initialize(const std::string &modname)
initialize the module by adding callbacks and registering objects with the framework
Definition: FONcModule.cc:62