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