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 #ifndef BESDataHandlerInterface_h_
00034 #define BESDataHandlerInterface_h_ 1
00035
00036 #include <string>
00037 #include <list>
00038 #include <map>
00039 #include <iostream>
00040
00041 using std::string ;
00042 using std::list ;
00043 using std::map ;
00044 using std::ostream ;
00045
00046 class BESResponseHandler ;
00047 class BESInfo ;
00048
00049 #include "BESContainer.h"
00050 #include "BESInternalError.h"
00051
00058 typedef struct _BESDataHandlerInterface
00059 {
00060 private:
00061 ostream *output_stream ;
00062 public:
00063 _BESDataHandlerInterface()
00064 : output_stream( 0 ),
00065 response_handler( 0 ),
00066 container( 0 ),
00067 error_info( 0 ) {}
00068
00069
00070 void set_output_stream( ostream *strm )
00071 {
00072 if( output_stream )
00073 {
00074 string err = "output stream has already been set" ;
00075 throw BESInternalError( err, __FILE__, __LINE__ ) ;
00076 }
00077 output_stream = strm ;
00078 }
00079 ostream &get_output_stream()
00080 {
00081 if( !output_stream )
00082 throw BESInternalError( "output stream has not yet been set, cannot use", __FILE__, __LINE__ ) ;
00083 return *output_stream ;
00084 }
00085
00086 BESResponseHandler *response_handler ;
00087
00088 list<BESContainer *> containers ;
00089 list<BESContainer *>::iterator containers_iterator ;
00090
00093 BESContainer *container ;
00094
00097 void first_container()
00098 {
00099 containers_iterator = containers.begin();
00100 if( containers_iterator != containers.end() )
00101 container = (*containers_iterator) ;
00102 else
00103 container = NULL ;
00104 }
00105
00108 void next_container()
00109 {
00110 containers_iterator++ ;
00111 if( containers_iterator != containers.end() )
00112 container = (*containers_iterator) ;
00113 else
00114 container = NULL ;
00115 }
00116
00119 string action ;
00120 string action_name ;
00121
00124 string transmit_protocol ;
00125
00129 map<string, string> data ;
00130 const map<string, string> &data_c() const { return data ; }
00131 typedef map<string, string>::const_iterator data_citer ;
00132
00135 BESInfo *error_info ;
00136
00137 void dump( ostream &strm ) const ;
00138
00139 } BESDataHandlerInterface ;
00140
00159 inline ostream &
00160 operator<<( ostream &strm, const BESDataHandlerInterface &dhi )
00161 {
00162 dhi.dump( strm ) ;
00163 return strm ;
00164 }
00165
00166 #endif // BESDataHandlerInterface_h_
00167