bes  Updated for version 3.20.8
UgridFunctions.cc
1 // UgridFunctions.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 using std::endl;
30 
31 #include "UgridFunctions.h"
32 #include "ServerFunctionsList.h"
33 #include "BESDebug.h"
34 #include "ugrid_restrict.h"
35 
36 static string getFunctionNames()
37 {
38  vector<string> names;
39  libdap::ServerFunctionsList::TheList()->getFunctionNames(&names);
40 
41  string msg;
42  for (std::vector<string>::iterator it = names.begin(); it != names.end(); ++it) {
43  if (!msg.empty()) msg += ", ";
44 
45  msg += *it;
46  }
47 
48  return msg;
49 }
50 
51 void UgridFunctions::initialize(const string &/*modname*/)
52 {
53  BESDEBUG("UgridFunctions", "initialize() - BEGIN" << endl);
54  BESDEBUG("UgridFunctions", "initialize() - function names: " << getFunctionNames() << endl);
55 
56  ugrid::UGNR *ugnr = new ugrid::UGNR();
57  libdap::ServerFunctionsList::TheList()->add_function(ugnr);
58 
59  BESDEBUG("UgridFunctions", "initialize() - function names: " << getFunctionNames() << endl);
60 
61  ugrid::UGER *uger = new ugrid::UGER();
62  libdap::ServerFunctionsList::TheList()->add_function(uger);
63 
64  BESDEBUG("UgridFunctions", "initialize() - function names: " << getFunctionNames() << endl);
65 
66  ugrid::UGFR *ugfr = new ugrid::UGFR();
67  libdap::ServerFunctionsList::TheList()->add_function(ugfr);
68 
69  BESDEBUG("UgridFunctions", "initialize() - function names: " << getFunctionNames() << endl);
70 
71  BESDEBUG("UgridFunctions", "initialize() - END" << endl);
72 }
73 
74 void UgridFunctions::terminate(const string &/*modname*/)
75 {
76  BESDEBUG("UgridFunctions", "Removing UgridFunctions Modules (this does nothing)." << endl);
77 }
78 
85 void UgridFunctions::dump(ostream &strm) const
86 {
87  strm << BESIndent::LMarg << "UgridFunctions::dump - (" << (void *) this << ")" << endl;
88 }
89 
90 extern "C" {
91 BESAbstractModule *maker()
92 {
93  return new UgridFunctions;
94 }
95 }
virtual void dump(std::ostream &strm) const
dumps information about this object