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 BESResponseObject ;
00048 class BESInfo ;
00049
00050 #include "BESObj.h"
00051 #include "BESContainer.h"
00052 #include "BESInternalError.h"
00053
00060 class BESDataHandlerInterface : public BESObj
00061 {
00062 private:
00063 ostream *output_stream ;
00064
00065
00066
00067
00068 BESDataHandlerInterface( BESDataHandlerInterface &from);
00069
00070
00071
00072
00073
00074
00075
00076
00077 BESDataHandlerInterface & operator=(const BESDataHandlerInterface &rhs);
00078
00079
00080
00081
00082
00083 public:
00084 BESDataHandlerInterface()
00085 : output_stream( 0 ),
00086 response_handler( 0 ),
00087 container( 0 ),
00088 executed( false ),
00089 error_info( 0 ) {}
00090
00091 void make_copy( const BESDataHandlerInterface ©_from ) ;
00092 void clean() ;
00093
00094 void set_output_stream( ostream *strm )
00095 {
00096 if( output_stream )
00097 {
00098 string err = "output stream has already been set" ;
00099 throw BESInternalError( err, __FILE__, __LINE__ ) ;
00100 }
00101 output_stream = strm ;
00102 }
00103 ostream &get_output_stream()
00104 {
00105 if( !output_stream )
00106 throw BESInternalError( "output stream has not yet been set, cannot use", __FILE__, __LINE__ ) ;
00107 return *output_stream ;
00108 }
00109
00110 BESResponseHandler *response_handler ;
00111 BESResponseObject *get_response_object() ;
00112
00113 list<BESContainer *> containers ;
00114 list<BESContainer *>::iterator containers_iterator ;
00115
00118 BESContainer *container ;
00119
00122 void first_container()
00123 {
00124 containers_iterator = containers.begin();
00125 if( containers_iterator != containers.end() )
00126 container = (*containers_iterator) ;
00127 else
00128 container = NULL ;
00129 }
00130
00133 void next_container()
00134 {
00135 containers_iterator++ ;
00136 if( containers_iterator != containers.end() )
00137 container = (*containers_iterator) ;
00138 else
00139 container = NULL ;
00140 }
00141
00144 string action ;
00145 string action_name ;
00146 bool executed ;
00147
00150 string transmit_protocol ;
00151
00155 map<string, string> data ;
00156 const map<string, string> &data_c() const { return data ; }
00157 typedef map<string, string>::const_iterator data_citer ;
00158
00161 BESInfo *error_info ;
00162
00163 void dump( ostream &strm ) const ;
00164
00165 } ;
00166
00167 #endif // BESDataHandlerInterface_h_
00168