bes Updated for version 3.21.1
The Backend Server (BES) is the lower two tiers of the Hyrax data server
BESInfo Class Referenceabstract

informational response object More...

#include <BESInfo.h>

Inheritance diagram for BESInfo:
Inheritance graph
Collaboration diagram for BESInfo:
Collaboration graph

Public Member Functions

virtual void add_break (unsigned long num_breaks)=0
 
virtual void add_data (const std::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_data_from_file (const std::string &key, const std::string &name)
 add data from a file to the informational object.
 
virtual void add_exception (const BESError &e, const std::string &admin)
 add exception information to this informational object
 
virtual void add_space (unsigned long num_spaces)=0
 
virtual void add_tag (const std::string &tag_name, const std::string &tag_data, std::map< std::string, std::string, std::less<> > *attrs=nullptr)=0
 
virtual void begin_response (const std::string &response_name, BESDataHandlerInterface &dhi)
 begin the informational response
 
virtual void begin_response (const std::string &response_name, std::map< std::string, std::string, std::less<> > *attrs, BESDataHandlerInterface &dhi)
 begin the informational response
 
virtual void begin_tag (const std::string &tag_name, std::map< std::string, std::string, std::less<> > *attrs=nullptr)
 
 BESInfo ()
 constructs a BESInfo object
 
 BESInfo (const std::string &buffered_key, std::ostream *strm, bool strm_owned)
 constructs a BESInfo object
 
virtual void dump (std::ostream &strm) const
 Displays debug information about this object.
 
virtual void end_response ()
 
virtual void end_tag (const std::string &tag_name)
 
virtual bool is_buffered ()
 return whether the information is to be buffered or not.
 
virtual void print (std::ostream &strm)
 print the information from this informational object to the specified stream
 
virtual void transmit (BESTransmitter *transmitter, BESDataHandlerInterface &dhi)=0
 transmit the informational object
 

Protected Attributes

bool _buffered
 
std::string _response_name
 
bool _response_started
 
std::ostream * _strm
 
bool _strm_owned
 
std::stack< std::string > _tags
 

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 cannot be directly created but simply provides a base class implementation of BESResponseObject for simple informational responses.

See also
BESResponseObject

Definition at line 63 of file BESInfo.h.

Constructor & Destructor Documentation

◆ BESInfo() [1/2]

BESInfo::BESInfo ( )

constructs a BESInfo object

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

Definition at line 52 of file BESInfo.cc.

◆ BESInfo() [2/2]

BESInfo::BESInfo ( const std::string & buffered_key,
std::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
keyparameter from BES configuration file
strmif not buffered then use the passed stream to output information
strm_ownedif stream was created (not cout or cerr for example) then either take ownership or not

Definition at line 71 of file BESInfo.cc.

◆ ~BESInfo()

BESInfo::~BESInfo ( )
virtual

Definition at line 93 of file BESInfo.cc.

Member Function Documentation

◆ add_break()

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

Implemented in BESHTMLInfo, BESTextInfo, and BESXMLInfo.

◆ add_data()

void BESInfo::add_data ( const std::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
sinformation to be added to this informational response object

Reimplemented in BESHTMLInfo, BESTextInfo, BESVersionInfo, and BESXMLInfo.

Definition at line 151 of file BESInfo.cc.

◆ add_data_from_file()

void BESInfo::add_data_from_file ( const std::string & key,
const std::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
keyKey from the initialization file specifying the file to be
nameA description of what is the information being loaded

Reimplemented in BESHTMLInfo, BESTextInfo, BESVersionInfo, and BESXMLInfo.

Definition at line 172 of file BESInfo.cc.

◆ add_exception()

void BESInfo::add_exception ( const BESError & error,
const std::string & admin )
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
eThe exception to add to the informational response object
adminThe contact information for the person responsible for this error

Reimplemented in BESVersionInfo.

Definition at line 221 of file BESInfo.cc.

◆ add_space()

virtual void BESInfo::add_space ( unsigned long num_spaces)
pure virtual

Implemented in BESHTMLInfo, BESTextInfo, and BESXMLInfo.

◆ add_tag()

virtual void BESInfo::add_tag ( const std::string & tag_name,
const std::string & tag_data,
std::map< std::string, std::string, std::less<> > * attrs = nullptr )
pure virtual

Implemented in BESHTMLInfo, BESTextInfo, and BESXMLInfo.

◆ begin_response() [1/2]

void BESInfo::begin_response ( const std::string & response_name,
BESDataHandlerInterface & dhi )
virtual

begin the informational response

basic setup of the response from abstract class

Parameters
response_namename of the response this information represents
dhiinformation about the request and response

Reimplemented in BESHTMLInfo, BESTextInfo, BESVersionInfo, and BESXMLInfo.

Definition at line 120 of file BESInfo.cc.

◆ begin_response() [2/2]

void BESInfo::begin_response ( const std::string & response_name,
std::map< std::string, std::string, std::less<> > * attrs,
BESDataHandlerInterface & dhi )
virtual

begin the informational response

basic setup of the response from abstract class

Parameters
response_namename of the response this information represents
dhiinformation about the request and response

Reimplemented in BESXMLInfo.

Definition at line 108 of file BESInfo.cc.

◆ begin_tag()

void BESInfo::begin_tag ( const std::string & tag_name,
std::map< std::string, std::string, std::less<> > * attrs = nullptr )
virtual

Reimplemented in BESHTMLInfo, BESTextInfo, and BESXMLInfo.

Definition at line 133 of file BESInfo.cc.

◆ dump()

void BESInfo::dump ( std::ostream & strm) const
virtual

Displays debug information about this object.

dumps information about this object

Parameters
strmoutput stream to use to dump the contents of this object

Displays the pointer value of this instance along with values of data members.

Parameters
strmC++ i/o stream to dump the information to

Implements BESResponseObject.

Reimplemented in BESHTMLInfo, BESTextInfo, BESVersionInfo, and BESXMLInfo.

Definition at line 262 of file BESInfo.cc.

◆ end_response()

void BESInfo::end_response ( )
virtual

Reimplemented in BESHTMLInfo, and BESXMLInfo.

Definition at line 125 of file BESInfo.cc.

◆ end_tag()

void BESInfo::end_tag ( const std::string & tag_name)
virtual

Reimplemented in BESHTMLInfo, BESTextInfo, and BESXMLInfo.

Definition at line 137 of file BESInfo.cc.

◆ is_buffered()

virtual bool BESInfo::is_buffered ( )
inlinevirtual

return whether the information is to be buffered or not.

Returns
true if information is buffered, false if not

Definition at line 116 of file BESInfo.h.

◆ print()

void BESInfo::print ( std::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
strmoutput to this file descriptor if information buffered.

Reimplemented in BESVersionInfo, and BESXMLInfo.

Definition at line 249 of file BESInfo.cc.

◆ transmit()

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?

Parameters
transmitterThe type of transmitter to use to transmit the info
dhiinformation to help with the transmission

Implemented in BESHTMLInfo, BESTextInfo, BESVersionInfo, and BESXMLInfo.

Member Data Documentation

◆ _buffered

bool BESInfo::_buffered
protected

Definition at line 67 of file BESInfo.h.

◆ _response_name

std::string BESInfo::_response_name
protected

Definition at line 71 of file BESInfo.h.

◆ _response_started

bool BESInfo::_response_started
protected

Definition at line 68 of file BESInfo.h.

◆ _strm

std::ostream* BESInfo::_strm
protected

Definition at line 65 of file BESInfo.h.

◆ _strm_owned

bool BESInfo::_strm_owned
protected

Definition at line 66 of file BESInfo.h.

◆ _tags

std::stack<std::string> BESInfo::_tags
protected

Definition at line 70 of file BESInfo.h.


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