bes  Updated for version 3.20.6
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 using std::ostream;
36 using std::string;
37 
38 #include "BESAsciiModule.h"
39 #include "BESDebug.h"
40 
41 //#include "BESAsciiNames.h"
42 #include "BESDapNames.h"
43 #include "BESResponseNames.h"
44 #include "BESResponseHandlerList.h"
45 #include "BESTransmitter.h"
46 #include "BESReturnManager.h"
47 #include "BESTransmitterNames.h"
48 
49 //#include "BESAsciiResponseHandler.h"
50 
51 #include "BESAsciiRequestHandler.h"
52 #include "BESRequestHandlerList.h"
53 
54 #include "BESDapService.h"
55 
56 #include "BESAsciiTransmit.h"
57 
58 #if 0
59 #define ASCII_RESPONSE "get.ascii"
60 #define ASCII_SERVICE "ascii"
61 #define ASCII_RESPONSE_STR "getAscii"
62 #endif
63 
64 void BESAsciiModule::initialize(const string &modname)
65 {
66  BESDEBUG("ascii", "Initializing module " << modname << endl);
67 
68  BESRequestHandler *handler = new BESAsciiRequestHandler(modname);
69  BESRequestHandlerList::TheList()->add_handler(modname, handler);
70 
71  BESReturnManager::TheManager()->add_transmitter(ASCII_TRANSMITTER, new BESAsciiTransmit());
72  BESReturnManager::TheManager()->add_transmitter(DAP4_CSV_TRANSMITTER, new BESAsciiTransmit());
73 
74  BESDebug::Register("ascii");
75 
76  BESDEBUG("ascii", "Done Initializing module " << modname << endl);
77 }
78 
79 void BESAsciiModule::terminate(const string &modname)
80 {
81  BESDEBUG("ascii", "Cleaning module " << modname << endl);
82 
83  BESReturnManager::TheManager()->del_transmitter(ASCII_TRANSMITTER);
84  BESReturnManager::TheManager()->del_transmitter(DAP4_CSV_TRANSMITTER);
85 
86  BESRequestHandler *rh = BESRequestHandlerList::TheList()->remove_handler(modname);
87  if (rh)
88  delete rh;
89 
90  BESDEBUG("ascii", "Done Cleaning module " << modname << endl);
91 }
92 
99 void BESAsciiModule::dump(ostream &strm) const
100 {
101  strm << BESIndent::LMarg << "BESAsciiModule::dump - (" << (void *) this << ")" << endl;
102 }
103 
104 extern "C" {
105 BESAbstractModule *maker()
106 {
107  return new BESAsciiModule;
108 }
109 }
110 
BESRequestHandler
Represents a specific data type request handler.
Definition: BESRequestHandler.h:74
BESRequestHandlerList::remove_handler
virtual BESRequestHandler * remove_handler(const std::string &handler_name)
remove and return the specified request handler
Definition: BESRequestHandlerList.cc:76
BESAsciiTransmit
Definition: BESAsciiTransmit.h:44
BESAbstractModule
Definition: BESAbstractModule.h:40
BESAsciiModule::dump
virtual void dump(std::ostream &strm) const
dumps information about this object
Definition: BESAsciiModule.cc:99
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:54
BESDebug::Register
static void Register(const std::string &flagName)
register the specified debug flag
Definition: BESDebug.h:138
BESAsciiModule
Definition: BESAsciiModule.h:37