BESShowContextResponseHandler.cc
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033 #include "BESShowContextResponseHandler.h"
00034 #include "BESInfoList.h"
00035 #include "BESInfo.h"
00036 #include "BESContextManager.h"
00037 #include "BESResponseNames.h"
00038
00039 BESShowContextResponseHandler::BESShowContextResponseHandler( const string &name )
00040 : BESResponseHandler( name )
00041 {
00042 }
00043
00044 BESShowContextResponseHandler::~BESShowContextResponseHandler( )
00045 {
00046 }
00047
00062 void
00063 BESShowContextResponseHandler::execute( BESDataHandlerInterface &dhi )
00064 {
00065 dhi.action_name = SET_CONTEXT_STR ;
00066 BESInfo *info = BESInfoList::TheList()->build_info() ;
00067 _response = info ;
00068
00069 info->begin_response( SHOW_CONTEXT_STR, dhi ) ;
00070 BESContextManager::TheManager()->list_context( *info ) ;
00071 info->end_response() ;
00072 }
00073
00086 void
00087 BESShowContextResponseHandler::transmit( BESTransmitter *transmitter,
00088 BESDataHandlerInterface &dhi )
00089 {
00090 if( _response )
00091 {
00092 BESInfo *info = dynamic_cast<BESInfo *>(_response) ;
00093 if( !info )
00094 throw BESInternalError( "cast error", __FILE__, __LINE__ ) ;
00095 info->transmit( transmitter, dhi ) ;
00096 }
00097 }
00098
00105 void
00106 BESShowContextResponseHandler::dump( ostream &strm ) const
00107 {
00108 strm << BESIndent::LMarg << "BESShowContextResponseHandler::dump - ("
00109 << (void *)this << ")" << endl ;
00110 BESIndent::Indent() ;
00111 BESResponseHandler::dump( strm ) ;
00112 BESIndent::UnIndent() ;
00113 }
00114
00115 BESResponseHandler *
00116 BESShowContextResponseHandler::ShowContextResponseBuilder( const string &name )
00117 {
00118 return new BESShowContextResponseHandler( name ) ;
00119 }
00120