bes  Updated for version 3.20.5
BESAsciiModule.cc
1 // BESAsciiModule.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) 2004,2005 University Corporation for Atmospheric Research
7 // Author: Patrick West <pwest@ucar.edu>
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 University Corporation for Atmospheric Research at
24 // 3080 Center Green Drive, Boulder, CO 80301
25 
26 // (c) COPYRIGHT University Corporation for Atmospheric Research 2004-2005
27 // Please read the full copyright statement in the file COPYRIGHT_UCAR.
28 //
29 // Authors:
30 // pwest Patrick West <pwest@ucar.edu>
31 
32 #include <iostream>
33 
34 using std::endl;
35 
36 #include "BESAsciiModule.h"
37 #include "BESDebug.h"
38 
39 //#include "BESAsciiNames.h"
40 #include "BESDapNames.h"
41 #include "BESResponseNames.h"
42 #include "BESResponseHandlerList.h"
43 #include "BESTransmitter.h"
44 #include "BESReturnManager.h"
45 #include "BESTransmitterNames.h"
46 
47 //#include "BESAsciiResponseHandler.h"
48 
49 #include "BESAsciiRequestHandler.h"
50 #include "BESRequestHandlerList.h"
51 
52 #include "BESDapService.h"
53 
54 #include "BESAsciiTransmit.h"
55 
56 #if 0
57 #define ASCII_RESPONSE "get.ascii"
58 #define ASCII_SERVICE "ascii"
59 #define ASCII_RESPONSE_STR "getAscii"
60 #endif
61 
62 void BESAsciiModule::initialize(const string &modname)
63 {
64  BESDEBUG("ascii", "Initializing module " << modname << endl);
65 
66  BESRequestHandler *handler = new BESAsciiRequestHandler(modname);
67  BESRequestHandlerList::TheList()->add_handler(modname, handler);
68 
69  BESReturnManager::TheManager()->add_transmitter(ASCII_TRANSMITTER, new BESAsciiTransmit());
70  BESReturnManager::TheManager()->add_transmitter(DAP4_CSV_TRANSMITTER, new BESAsciiTransmit());
71 
72  BESDebug::Register("ascii");
73 
74  BESDEBUG("ascii", "Done Initializing module " << modname << endl);
75 }
76 
77 void BESAsciiModule::terminate(const string &modname)
78 {
79  BESDEBUG("ascii", "Cleaning module " << modname << endl);
80 
81  BESReturnManager::TheManager()->del_transmitter(ASCII_TRANSMITTER);
82  BESReturnManager::TheManager()->del_transmitter(DAP4_CSV_TRANSMITTER);
83 
84  BESRequestHandler *rh = BESRequestHandlerList::TheList()->remove_handler(modname);
85  if (rh)
86  delete rh;
87 
88  BESDEBUG("ascii", "Done Cleaning module " << modname << endl);
89 }
90 
97 void BESAsciiModule::dump(ostream &strm) const
98 {
99  strm << BESIndent::LMarg << "BESAsciiModule::dump - (" << (void *) this << ")" << endl;
100 }
101 
102 extern "C" {
103 BESAbstractModule *maker()
104 {
105  return new BESAsciiModule;
106 }
107 }
108 
BESRequestHandler
Represents a specific data type request handler.
Definition: BESRequestHandler.h:77
BESRequestHandlerList::remove_handler
virtual BESRequestHandler * remove_handler(const std::string &handler_name)
remove and return the specified request handler
Definition: BESRequestHandlerList.cc:72
BESAsciiTransmit
Definition: BESAsciiTransmit.h:44
BESAbstractModule
Definition: BESAbstractModule.h:42
BESAsciiModule::dump
virtual void dump(ostream &strm) const
dumps information about this object
Definition: BESAsciiModule.cc:97
BESAsciiRequestHandler
Definition: BESAsciiRequestHandler.h:39
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:50
BESDebug::Register
static void Register(const std::string &flagName)
register the specified debug flag
Definition: BESDebug.h:138
BESAsciiModule
Definition: BESAsciiModule.h:37