#include <BESInfo.h>
Inheritance diagram for BESInfo:
Public Member Functions | |
BESInfo () | |
constructs a BESInfo object | |
BESInfo (const string &buffered_key) | |
constructs a BESInfo object | |
virtual | ~BESInfo () |
virtual void | begin_response (const string &response_name) |
virtual void | end_response () |
virtual void | add_tag (const string &tag_name, const string &tag_data, map< string, string > *attrs=0)=0 |
virtual void | begin_tag (const string &tag_name, map< string, string > *attrs=0) |
virtual void | end_tag (const string &tag_name) |
virtual void | add_data (const string &s) |
add data to this informational object. If buffering is not set then the information is output directly to the output stream. | |
virtual void | add_space (unsigned long num_spaces)=0 |
virtual void | add_break (unsigned long num_breaks)=0 |
virtual void | add_data_from_file (const string &key, const string &name) |
add data from a file to the informational object. | |
virtual void | add_exception (BESException &e) |
add exception information to this informational object | |
virtual void | transmit (BESTransmitter *transmitter, BESDataHandlerInterface &dhi)=0 |
transmit the informational object | |
virtual void | print (FILE *out) |
print the information from this informational object to the specified FILE descriptor | |
virtual bool | set_buffered (bool buffered) |
return whether the information is to be buffered or not. | |
virtual bool | is_buffered () |
return whether the information is to be buffered or not. | |
virtual void | dump (ostream &strm) const |
Displays debug information about this object. | |
Protected Attributes | |
ostream * | _strm |
bool | _buffered |
bool | _response_started |
stack< string > | _tags |
string | _response_name |
This class provides a means to store informational responses, such as help information and version information. The retrieval of this information can be buffered until all information is retrieved, or can be directly output thereby not using memory resources.
Information is added to this response object through the add_data method and then output using the print method. If the information is not buffered then the information is output during the add_data processing, otherwise the print method performs the output.
This class is can not be directly created but simply provides a base class implementation of BESResponseObject for simple informational responses.
Definition at line 68 of file BESInfo.h.
BESInfo::BESInfo | ( | ) |
constructs a BESInfo object
By default, informational responses are buffered, so the output stream is created
Definition at line 51 of file BESInfo.cc.
References _strm.
BESInfo::BESInfo | ( | const string & | key | ) |
constructs a BESInfo object
If the passed key is set to true, True, TRUE, yes, Yes, or YES then the information will be buffered, otherwise it will not be buffered.
If the information is not to be buffered then the output stream is set to standard output.
Definition at line 66 of file BESInfo.cc.
References _buffered, _strm, BESKeys::get_key(), and TheBESKeys::TheKeys().
Here is the call graph for this function:
BESInfo::~BESInfo | ( | ) | [virtual] |
void BESInfo::begin_response | ( | const string & | response_name | ) | [virtual] |
Reimplemented in BESHTMLInfo, BESSilentInfo, BESTextInfo, BESVersionInfo, and BESXMLInfo.
Definition at line 90 of file BESInfo.cc.
References _response_name, and _response_started.
Referenced by BESXMLInfo::begin_response(), BESVersionInfo::begin_response(), BESTextInfo::begin_response(), BESSilentInfo::begin_response(), BESHTMLInfo::begin_response(), BESStatusResponseHandler::execute(), BESShowDefsResponseHandler::execute(), BESShowContextResponseHandler::execute(), BESShowContainersResponseHandler::execute(), BESProcIdResponseHandler::execute(), BESKeysResponseHandler::execute(), BESHelpResponseHandler::execute(), BESCatalogResponseHandler::execute(), and BESExceptionManager::handle_exception().
void BESInfo::end_response | ( | ) | [virtual] |
Reimplemented in BESHTMLInfo, BESVersionInfo, and BESXMLInfo.
Definition at line 97 of file BESInfo.cc.
References _response_started, and _tags.
Referenced by BESXMLInfo::end_response(), BESVersionInfo::end_response(), BESStatusResponseHandler::execute(), BESShowDefsResponseHandler::execute(), BESShowContextResponseHandler::execute(), BESShowContainersResponseHandler::execute(), BESProcIdResponseHandler::execute(), BESKeysResponseHandler::execute(), BESHelpResponseHandler::execute(), BESCatalogResponseHandler::execute(), BESExceptionManager::handle_exception(), TestException::handleException(), and infoT::run().
virtual void BESInfo::add_tag | ( | const string & | tag_name, | |
const string & | tag_data, | |||
map< string, string > * | attrs = 0 | |||
) | [pure virtual] |
Implemented in BESHTMLInfo, BESSilentInfo, BESTextInfo, BESVersionInfo, and BESXMLInfo.
Referenced by add_exception(), BESVersionInfo::add_tag(), BESVersionInfo::addBESVersion(), BESVersionInfo::addHandlerVersion(), BESStatusResponseHandler::execute(), BESProcIdResponseHandler::execute(), BESKeysResponseHandler::execute(), BESExceptionManager::handle_exception(), BESContextManager::list_context(), OPENDAP_CLASSRequestHandler::OPENDAP_TYPE_build_help(), BESCatalogDirectory::show_catalog(), BESContainerStorageVolatile::show_containers(), BESContainerStorageFile::show_containers(), and BESDefinitionStorageVolatile::show_definitions().
void BESInfo::begin_tag | ( | const string & | tag_name, | |
map< string, string > * | attrs = 0 | |||
) | [virtual] |
Reimplemented in BESHTMLInfo, BESSilentInfo, BESTextInfo, BESVersionInfo, and BESXMLInfo.
Definition at line 108 of file BESInfo.cc.
References _tags.
Referenced by add_exception(), BESVersionInfo::addBESVersion(), BESVersionInfo::addHandlerVersion(), BESXMLInfo::begin_tag(), BESVersionInfo::begin_tag(), BESTextInfo::begin_tag(), BESSilentInfo::begin_tag(), BESHTMLInfo::begin_tag(), BESVersionInfo::beginBESVersion(), BESVersionInfo::beginHandlerVersion(), BESDapRequestHandler::dap_build_help(), BESKeysResponseHandler::execute(), BESHelpResponseHandler::execute(), BESContextManager::list_context(), OPENDAP_CLASSRequestHandler::OPENDAP_TYPE_build_help(), BESCatalogDirectory::show_catalog(), BESContainerStorageVolatile::show_containers(), BESContainerStorageList::show_containers(), BESContainerStorageFile::show_containers(), BESDefinitionStorageVolatile::show_definitions(), and BESDefinitionStorageList::show_definitions().
void BESInfo::end_tag | ( | const string & | tag_name | ) | [virtual] |
Reimplemented in BESHTMLInfo, BESSilentInfo, BESTextInfo, BESVersionInfo, and BESXMLInfo.
Definition at line 115 of file BESInfo.cc.
References _tags.
Referenced by add_exception(), BESVersionInfo::addBESVersion(), BESVersionInfo::addHandlerVersion(), BESDapRequestHandler::dap_build_help(), BESXMLInfo::end_tag(), BESVersionInfo::end_tag(), BESTextInfo::end_tag(), BESSilentInfo::end_tag(), BESHTMLInfo::end_tag(), BESVersionInfo::endBESVersion(), BESVersionInfo::endHandlerVersion(), BESKeysResponseHandler::execute(), BESHelpResponseHandler::execute(), BESContextManager::list_context(), OPENDAP_CLASSRequestHandler::OPENDAP_TYPE_build_help(), BESCatalogDirectory::show_catalog(), BESContainerStorageVolatile::show_containers(), BESContainerStorageList::show_containers(), BESContainerStorageFile::show_containers(), BESDefinitionStorageVolatile::show_definitions(), and BESDefinitionStorageList::show_definitions().
void BESInfo::add_data | ( | const string & | s | ) | [virtual] |
add data to this informational object. If buffering is not set then the information is output directly to the output stream.
s | information to be added to this informational response object |
Reimplemented in BESHTMLInfo, BESSilentInfo, BESTextInfo, BESVersionInfo, and BESXMLInfo.
Definition at line 135 of file BESInfo.cc.
References _buffered.
Referenced by BESXMLInfo::add_data(), BESVersionInfo::add_data(), BESTextInfo::add_data(), BESHTMLInfo::add_data(), add_data_from_file(), BESHTMLInfo::add_tag(), and BESHTMLInfo::begin_tag().
virtual void BESInfo::add_space | ( | unsigned long | num_spaces | ) | [pure virtual] |
Implemented in BESHTMLInfo, BESSilentInfo, BESTextInfo, BESVersionInfo, and BESXMLInfo.
Referenced by BESVersionInfo::add_space().
virtual void BESInfo::add_break | ( | unsigned long | num_breaks | ) | [pure virtual] |
Implemented in BESHTMLInfo, BESSilentInfo, BESTextInfo, BESVersionInfo, and BESXMLInfo.
Referenced by BESVersionInfo::add_break(), BESHelpResponseHandler::execute(), and BESDefinitionStorageList::show_definitions().
void BESInfo::add_data_from_file | ( | const string & | key, | |
const string & | name | |||
) | [virtual] |
add data from a file to the informational object.
Adds data from a file to the informational object using the file specified by the passed key string. The key is found from the bes configuration file.
If the key does not exist in the initialization file then this information is added to the informational object, no excetion is thrown.
If the file does not exist then this information is added to the informational object, no exception is thrown.
key | Key from the initialization file specifying the file to be | |
name | A description of what is the information being loaded |
Reimplemented in BESHTMLInfo, BESSilentInfo, BESTextInfo, BESVersionInfo, and BESXMLInfo.
Definition at line 163 of file BESInfo.cc.
References add_data(), BES_INFO_FILE_BUFFER_SIZE, BESKeys::get_key(), and TheBESKeys::TheKeys().
Referenced by BESXMLInfo::add_data_from_file(), BESVersionInfo::add_data_from_file(), BESTextInfo::add_data_from_file(), BESHTMLInfo::add_data_from_file(), TestRequestHandler::cdf_build_help(), BESDapRequestHandler::dap_build_help(), BESHelpResponseHandler::execute(), and OPENDAP_CLASSRequestHandler::OPENDAP_TYPE_build_help().
Here is the call graph for this function:
void BESInfo::add_exception | ( | BESException & | e | ) | [virtual] |
add exception information to this informational object
Exception information is added differently to different informational objects, such as html, xml, plain text. But, using the other methods of this class we can take care of exceptions here.
type | The type of exception being thrown | |
e | The exception to add to the informational response object |
Reimplemented in BESSilentInfo, and BESVersionInfo.
Definition at line 205 of file BESInfo.cc.
References add_tag(), begin_tag(), end_tag(), BESException::get_context(), BESException::get_file(), BESException::get_line(), and BESException::get_message().
Referenced by BESVersionInfo::add_exception(), BESExceptionManager::handle_exception(), and TestException::handleException().
Here is the call graph for this function:
virtual void BESInfo::transmit | ( | BESTransmitter * | transmitter, | |
BESDataHandlerInterface & | dhi | |||
) | [pure virtual] |
transmit the informational object
The derived informational object knows how it needs to be transmitted. Does it need to be sent as html? As text? As something else?
transmitter | The type of transmitter to use to transmit the info | |
dhi | information to help with the transmission |
Implemented in BESHTMLInfo, BESSilentInfo, BESTextInfo, BESVersionInfo, and BESXMLInfo.
Referenced by OPENDAP_RESPONSEResponseHandler::transmit(), BESVersionInfo::transmit(), BESStatusResponseHandler::transmit(), BESShowDefsResponseHandler::transmit(), BESShowContextResponseHandler::transmit(), BESShowContainersResponseHandler::transmit(), BESSetContextResponseHandler::transmit(), BESSetContainerResponseHandler::transmit(), BESProcIdResponseHandler::transmit(), BESKeysResponseHandler::transmit(), BESHelpResponseHandler::transmit(), BESDelDefsResponseHandler::transmit(), BESDelDefResponseHandler::transmit(), BESDelContainersResponseHandler::transmit(), BESDelContainerResponseHandler::transmit(), BESDefineResponseHandler::transmit(), BESCatalogResponseHandler::transmit(), and BESInterface::transmit_data().
void BESInfo::print | ( | FILE * | out | ) | [virtual] |
print the information from this informational object to the specified FILE descriptor
If the information was not buffered then this method does nothing, otherwise the information is output to the specified FILE descriptor.
out | output to this file descriptor if information buffered. |
Reimplemented in BESSilentInfo, BESVersionInfo, and BESXMLInfo.
Definition at line 228 of file BESInfo.cc.
References _buffered, and _strm.
Referenced by BESInterface::execute_request(), BESXMLInfo::print(), BESVersionInfo::print(), pvolT::run(), plistT::run(), pfileT::run(), infoT::run(), defT::run(), BESFilterTransmitter::send_html(), BESBasicTransmitter::send_html(), BESFilterTransmitter::send_text(), BESBasicTransmitter::send_text(), and BESInterface::transmit_data().
virtual bool BESInfo::set_buffered | ( | bool | buffered | ) | [inline, virtual] |
virtual bool BESInfo::is_buffered | ( | ) | [inline, virtual] |
return whether the information is to be buffered or not.
Definition at line 130 of file BESInfo.h.
References _buffered.
Referenced by BESFilterTransmitter::send_html(), BESBasicHttpTransmitter::send_html(), BESFilterTransmitter::send_text(), and BESBasicHttpTransmitter::send_text().
void BESInfo::dump | ( | ostream & | strm | ) | const [virtual] |
Displays debug information about this object.
strm | output stream to use to dump the contents of this object |
Implements BESResponseObject.
Reimplemented in BESHTMLInfo, BESSilentInfo, BESTextInfo, BESVersionInfo, and BESXMLInfo.
Definition at line 244 of file BESInfo.cc.
References _buffered, _response_name, _response_started, _tags, BESIndent::Indent(), BESIndent::LMarg(), and BESIndent::UnIndent().
Referenced by BESXMLInfo::dump(), BESVersionInfo::dump(), BESTextInfo::dump(), BESSilentInfo::dump(), BESInfoList::dump(), BESHTMLInfo::dump(), and _BESDataHandlerInterface::dump().
Here is the call graph for this function:
ostream* BESInfo::_strm [protected] |
bool BESInfo::_buffered [protected] |
Definition at line 72 of file BESInfo.h.
Referenced by BESTextInfo::add_data(), add_data(), BESHTMLInfo::add_data(), BESInfo(), dump(), is_buffered(), print(), set_buffered(), and ~BESInfo().
bool BESInfo::_response_started [protected] |
Definition at line 73 of file BESInfo.h.
Referenced by begin_response(), dump(), and end_response().
stack<string> BESInfo::_tags [protected] |
Definition at line 75 of file BESInfo.h.
Referenced by begin_tag(), dump(), end_response(), and end_tag().
string BESInfo::_response_name [protected] |
Definition at line 76 of file BESInfo.h.
Referenced by BESXMLInfo::begin_response(), begin_response(), dump(), and BESXMLInfo::end_response().