bes Updated for version 3.20.10
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
36using 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
62void 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(RETURN_AS_NETCDF, new FONcTransmitter());
70
71 BESServiceRegistry::TheRegistry()->add_format(OPENDAP_SERVICE, DATA_SERVICE, RETURN_AS_NETCDF);
72
73 BESReturnManager::TheManager()->add_transmitter(RETURN_AS_NETCDF4, new FONcTransmitter());
74
75 BESServiceRegistry::TheRegistry()->add_format(OPENDAP_SERVICE, DATA_SERVICE, RETURN_AS_NETCDF4);
76
77 //BESReturnManager::TheManager()->add_transmitter( RETURNAS_NETCDF4, new FONcTransmitter());
78
79 BESServiceRegistry::TheRegistry()->add_format(OPENDAP_SERVICE, DAP4DATA_SERVICE, RETURN_AS_NETCDF4);
80
81
82 BESDebug::Register("fonc");
83
84 BESDEBUG("fonc", "Done Initializing module " << modname << endl);
85}
86
95void FONcModule::terminate(const string &modname)
96{
97 BESDEBUG("fonc", "Cleaning module " << modname << endl);
98
99 BESReturnManager::TheManager()->del_transmitter(RETURN_AS_NETCDF);
100
101 BESReturnManager::TheManager()->del_transmitter(RETURN_AS_NETCDF4);
102
103 BESRequestHandler *rh = BESRequestHandlerList::TheList()->remove_handler(modname);
104 delete rh;
105
106 BESDEBUG("fonc", "Done Cleaning module " << modname << endl);
107}
108
115void FONcModule::dump(ostream &strm) const
116{
117 strm << BESIndent::LMarg << "FONcModule::dump - (" << (void *) this << ")" << endl;
118}
119
123extern "C"
124BESAbstractModule *maker()
125{
126 return new FONcModule;
127}
128
static void Register(const std::string &flagName)
register the specified debug flag
Definition: BESDebug.h:149
virtual bool add_handler(const std::string &handler_name, BESRequestHandler *handler)
add a request handler to the list of registered handlers for this server
virtual BESRequestHandler * remove_handler(const std::string &handler_name)
remove and return the specified request handler
Represents a specific data type request handler.
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
Module that allows for OPeNDAP Data objects to be returned as netcdf files.
Definition: FONcModule.h:52
virtual void dump(std::ostream &strm) const
dumps information about this object for debugging purposes
Definition: FONcModule.cc:115
virtual void initialize(const std::string &modname)
initialize the module by adding callbacks and registering objects with the framework
Definition: FONcModule.cc:62
virtual void terminate(const std::string &modname)
removes any registered callbacks or objects from the framework
Definition: FONcModule.cc:95
A Request Handler for the Fileout NetCDF request.
BESTransmitter class named "netcdf" that transmits an OPeNDAP data object as a netcdf file.