BESInfo Class Reference

informational response object More...

#include <BESInfo.h>

Inheritance diagram for BESInfo:

Inheritance graph
[legend]
Collaboration diagram for BESInfo:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 BESInfo ()
 constructs a BESInfo object
 BESInfo (const string &buffered_key, ostream *strm, bool strm_owned)
 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 (BESError &e, const string &admin)
 add exception information to this informational object
virtual void transmit (BESTransmitter *transmitter, BESDataHandlerInterface &dhi)=0
 transmit the informational object
virtual void print (ostream &strm)
 print the information from this informational object to the specified stream
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 _strm_owned
bool _buffered
bool _response_started
stack< string > _tags
string _response_name


Detailed Description

informational response object

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.

See also:
BESResponseObject

Constructor & Destructor Documentation

BESInfo::BESInfo (  ) 

constructs a BESInfo object

By default, informational responses are buffered, so the output stream is created

References _strm, and _strm_owned.

BESInfo::BESInfo ( const string &  key,
ostream *  strm,
bool  strm_owned 
)

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.

Parameters:
key parameter from BES configuration file
strm if not buffered then use the passed stream to output information
strm_owned if stream was created (not cout or cerr for example) then either take ownership or not

References _buffered, _strm, _strm_owned, BESKeys::get_key(), and TheBESKeys::TheKeys().

Here is the call graph for this function:

BESInfo::~BESInfo (  )  [virtual]

References _strm, and _strm_owned.


Member Function Documentation

void BESInfo::begin_response ( const string &  response_name  )  [virtual]

void BESInfo::end_response (  )  [virtual]

virtual void BESInfo::add_tag ( const string &  tag_name,
const string &  tag_data,
map< string, string > *  attrs = 0 
) [pure virtual]

void BESInfo::begin_tag ( const string &  tag_name,
map< string, string > *  attrs = 0 
) [virtual]

void BESInfo::end_tag ( const string &  tag_name  )  [virtual]

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.

Parameters:
s information to be added to this informational response object

Reimplemented in BESDapErrorInfo, BESHTMLInfo, BESSilentInfo, BESTextInfo, BESVersionInfo, and BESXMLInfo.

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]

virtual void BESInfo::add_break ( unsigned long  num_breaks  )  [pure virtual]

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.

Parameters:
key Key from the initialization file specifying the file to be
name A description of what is the information being loaded

Reimplemented in BESDapErrorInfo, BESHTMLInfo, BESSilentInfo, BESTextInfo, BESVersionInfo, and BESXMLInfo.

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(), BESDapRequestHandler::dap_build_help(), and BESHelpResponseHandler::execute().

Here is the call graph for this function:

void BESInfo::add_exception ( BESError e,
const string &  administrator 
) [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.

Parameters:
e The exception to add to the informational response object

Reimplemented in BESDapErrorInfo, BESSilentInfo, and BESVersionInfo.

References add_tag(), begin_tag(), end_tag(), BESError::get_error_type(), BESError::get_file(), BESError::get_line(), and BESError::get_message().

Referenced by BESVersionInfo::add_exception(), and BESExceptionManager::handle_exception().

Here is the call graph for this function:

virtual void BESInfo::transmit ( BESTransmitter transmitter,
BESDataHandlerInterface dhi 
) [pure virtual]

void BESInfo::print ( ostream &  strm  )  [virtual]

print the information from this informational object to the specified stream

If the information was not buffered then this method does nothing, otherwise the information is output to the specified ostream.

Parameters:
strm output to this file descriptor if information buffered.

Reimplemented in BESDapErrorInfo, BESSilentInfo, BESVersionInfo, and BESXMLInfo.

References _buffered, and _strm.

Referenced by BESInterface::finish(), BESXMLInfo::print(), BESVersionInfo::print(), BESFilterTransmitter::send_html(), BESBasicTransmitter::send_html(), BESFilterTransmitter::send_text(), BESBasicTransmitter::send_text(), and BESInterface::transmit_data().

virtual bool BESInfo::is_buffered (  )  [inline, virtual]

return whether the information is to be buffered or not.

Returns:
true if information is buffered, false if not

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.

dumps information about this object

Parameters:
strm output stream to use to dump the contents of this object
Displays the pointer value of this instance along with values of data members.

Parameters:
strm C++ i/o stream to dump the information to

Implements BESResponseObject.

Reimplemented in BESDapErrorInfo, BESHTMLInfo, BESSilentInfo, BESTextInfo, BESVersionInfo, and BESXMLInfo.

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(), _BESDataHandlerInterface::dump(), and BESDapErrorInfo::dump().

Here is the call graph for this function:


Member Data Documentation

ostream* BESInfo::_strm [protected]

bool BESInfo::_strm_owned [protected]

Referenced by BESInfo(), and ~BESInfo().

bool BESInfo::_buffered [protected]

bool BESInfo::_response_started [protected]

Referenced by begin_response(), dump(), and end_response().

stack<string> BESInfo::_tags [protected]

Referenced by begin_tag(), dump(), end_response(), and end_tag().

string BESInfo::_response_name [protected]


The documentation for this class was generated from the following files:

Generated on Thu Sep 11 07:57:25 2008 for OPeNDAP Back End Server (BES) by  doxygen 1.5.6