bes  Updated for version 3.17.4
DapFunctions.cc
1 // DapFunctions.cc
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) 2013 OPeNDAP, Inc.
7 // Author: James Gallagher <jgallagher@opendap.org>
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 OPeNDAP, Inc. at PO Box 112, Saunderstown, RI. 02874-0112.
24 
25 #include "config.h"
26 
27 #include <iostream>
28 
29 #include <ServerFunctionsList.h>
30 
31 #include <BESRequestHandlerList.h>
32 
33 #include <BESDebug.h>
34 
35 #include "GeoGridFunction.h"
36 #include "GridFunction.h"
37 #include "LinearScaleFunction.h"
38 #include "VersionFunction.h"
39 #include "MakeArrayFunction.h"
40 #include "MakeMaskFunction.h"
41 #include "BindNameFunction.h"
42 #include "BindShapeFunction.h"
43 #include "TabularFunction.h"
44 #include "BBoxFunction.h"
45 #include "RoiFunction.h"
46 #include "BBoxUnionFunction.h"
47 #include "MaskArrayFunction.h"
48 #include "DilateArrayFunction.h"
49 
50 #include "DapFunctionsRequestHandler.h"
51 
52 #include "DapFunctions.h"
53 
54 namespace functions {
55 
56 void DapFunctions::initialize(const string &modname)
57 {
58  BESDEBUG( "dap_functions", "Initializing DAP Functions:" << endl );
59 
60  // Add this module to the Request Handler List so that it can respond
61  // to version and help requests. Note the matching code to remove the
62  // handler from the list in the terminate() method.
63  BESRequestHandlerList::TheList()->add_handler(modname, new DapFunctionsRequestHandler(modname));
64 
65  libdap::ServerFunctionsList::TheList()->add_function(new GridFunction());
66  libdap::ServerFunctionsList::TheList()->add_function(new GeoGridFunction());
67  libdap::ServerFunctionsList::TheList()->add_function(new LinearScaleFunction());
68 
69  libdap::ServerFunctionsList::TheList()->add_function(new MakeArrayFunction());
70  libdap::ServerFunctionsList::TheList()->add_function(new MakeMaskFunction());
71  libdap::ServerFunctionsList::TheList()->add_function(new BindNameFunction());
72  libdap::ServerFunctionsList::TheList()->add_function(new BindShapeFunction());
73 
74  libdap::ServerFunctionsList::TheList()->add_function(new VersionFunction());
75 
76  libdap::ServerFunctionsList::TheList()->add_function(new TabularFunction());
77  libdap::ServerFunctionsList::TheList()->add_function(new BBoxFunction());
78  libdap::ServerFunctionsList::TheList()->add_function(new RoiFunction());
79  libdap::ServerFunctionsList::TheList()->add_function(new BBoxUnionFunction());
80 
81  libdap::ServerFunctionsList::TheList()->add_function(new MaskArrayFunction());
82  libdap::ServerFunctionsList::TheList()->add_function(new DilateArrayFunction());
83 
84  BESDEBUG( "dap_functions", "Done initializing DAP Functions" << endl );
85 }
86 
87 void DapFunctions::terminate(const string &modname)
88 {
89  BESDEBUG( "dap_functions", "Removing DAP Functions." << endl );
90 
91  BESRequestHandler *rh = BESRequestHandlerList::TheList()->remove_handler(modname);
92  if (rh) delete rh;
93 
94 }
95 
102 void DapFunctions::dump(ostream &strm) const
103 {
104  strm << BESIndent::LMarg << "DapFunctions::dump - (" << (void *) this << ")" << endl;
105 }
106 
107 extern "C" {
108 BESAbstractModule *maker()
109 {
110  return new DapFunctions;
111 }
112 }
113 
114 }
virtual bool add_handler(const string &handler_name, BESRequestHandler *handler)
add a request handler to the list of registered handlers for this server
Represents a specific data type request handler.
A Request Handler for the DAP Functions module.
virtual void dump(std::ostream &strm) const
dumps information about this object
virtual BESRequestHandler * remove_handler(const string &handler_name)
remove and return the specified request handler