#include <BESRequestHandler.h>
Public Types | |
typedef map< string, p_request_handler > ::const_iterator | Handler_citer |
typedef map< string, p_request_handler >::iterator | Handler_iter |
Public Member Functions | |
BESRequestHandler (const string &name) | |
virtual | ~BESRequestHandler (void) |
virtual const string & | get_name () const |
virtual bool | add_handler (const string &handler_name, p_request_handler handler_method) |
add a handler method to the request handler that knows how to fill in a specific response object | |
virtual bool | remove_handler (const string &handler_name) |
remove the specified handler method from this request handler | |
virtual p_request_handler | find_handler (const string &handler_name) |
find the method that can handle the specified response object type | |
virtual string | get_handler_names () |
return a comma separated list of response object types handled by this request handler | |
virtual void | dump (ostream &strm) const |
dumps information about this object |
A request handler is an object that represents a specific data type. The specific data type knows how to fill in a response object, such as a DAS, DDS, help, version, etc... response object.
The response handlers know how to build the specified response object, and the request handler knows how to fill them in.
Each container in the BESDataHandlerInterface has an associated data type for that data continer, such as Cedar, NetCDF, CDF, HDF, etc... Usually, in a given request, only one data type is requested. In other words, at least currently, it is rare to see a request asking for information from more than one type of data.
Each data request handler is registered with the server. When a request comes in, the request handler is looked up for each of those data types and is passed the information it needs to fill in the specified response object.
Each request handler can handle different types of response objects. Methods are registered within the request handler for the responses that the request handler can fill in. This method is looked up and is passed the information to fill in the response object.
typedef map< string, p_request_handler >::const_iterator BESRequestHandler::Handler_citer |
typedef map< string, p_request_handler >::iterator BESRequestHandler::Handler_iter |
BESRequestHandler::BESRequestHandler | ( | const string & | name | ) | [inline] |
virtual BESRequestHandler::~BESRequestHandler | ( | void | ) | [inline, virtual] |
virtual const string& BESRequestHandler::get_name | ( | ) | const [inline, virtual] |
bool BESRequestHandler::add_handler | ( | const string & | handler_name, | |
p_request_handler | handler_method | |||
) | [virtual] |
add a handler method to the request handler that knows how to fill in a specific response object
Add a handler method for a specific response object to the request handler. The handler method takes a reference to a BESDataHandlerInterface and returns bool, true if the response object is filled in successfully by the method, false otherwise.
handler_name | name of the response object this method can fill in | |
handler_method | a function pointer to the method that can fill in the specified response object |
BESResponseNames
References find_handler().
Referenced by BESDapRequestHandler::BESDapRequestHandler().
bool BESRequestHandler::remove_handler | ( | const string & | handler_name | ) | [virtual] |
remove the specified handler method from this request handler
handler_name | name of the method to be removed, same as the name of the response object |
p_request_handler BESRequestHandler::find_handler | ( | const string & | handler_name | ) | [virtual] |
find the method that can handle the specified response object type
Find the method that can handle the specified response object type. The response object type is the same as the handler name.
handler_name | name of the method that can fill in the response object type |
BESResponseNames
Referenced by add_handler(), BESRequestHandlerList::execute_all(), and BESRequestHandlerList::execute_current().
string BESRequestHandler::get_handler_names | ( | ) | [virtual] |
return a comma separated list of response object types handled by this request handler
BESResponseNames
void BESRequestHandler::dump | ( | ostream & | strm | ) | const [virtual] |
dumps information about this object
Displays the pointer value of this instance, the name of the request handler, and the names of all registered handler functions
strm | C++ i/o stream to dump the information to |
Implements BESObj.
Reimplemented in BESDapRequestHandler.
References BESIndent::Indent(), BESIndent::LMarg(), and BESIndent::UnIndent().
Referenced by BESRequestHandlerList::dump(), and BESDapRequestHandler::dump().