BESDataHandlerInterface.h
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 #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 BESDataHandlerInterface( BESDataHandlerInterface &from )
00066 : output_stream( 0 ),
00067 response_handler( 0 ),
00068 container( 0 ),
00069 executed( false ),
00070 error_info( 0 ) {}
00071 BESDataHandlerInterface & operator=(const BESDataHandlerInterface &rhs) {}
00072
00073 public:
00074 BESDataHandlerInterface()
00075 : output_stream( 0 ),
00076 response_handler( 0 ),
00077 container( 0 ),
00078 executed( false ),
00079 error_info( 0 ) {}
00080
00081 void make_copy( const BESDataHandlerInterface ©_from ) ;
00082 void clean() ;
00083
00084 void set_output_stream( ostream *strm )
00085 {
00086 if( output_stream )
00087 {
00088 string err = "output stream has already been set" ;
00089 throw BESInternalError( err, __FILE__, __LINE__ ) ;
00090 }
00091 output_stream = strm ;
00092 }
00093 ostream &get_output_stream()
00094 {
00095 if( !output_stream )
00096 throw BESInternalError( "output stream has not yet been set, cannot use", __FILE__, __LINE__ ) ;
00097 return *output_stream ;
00098 }
00099
00100 BESResponseHandler *response_handler ;
00101 BESResponseObject *get_response_object() ;
00102
00103 list<BESContainer *> containers ;
00104 list<BESContainer *>::iterator containers_iterator ;
00105
00108 BESContainer *container ;
00109
00112 void first_container()
00113 {
00114 containers_iterator = containers.begin();
00115 if( containers_iterator != containers.end() )
00116 container = (*containers_iterator) ;
00117 else
00118 container = NULL ;
00119 }
00120
00123 void next_container()
00124 {
00125 containers_iterator++ ;
00126 if( containers_iterator != containers.end() )
00127 container = (*containers_iterator) ;
00128 else
00129 container = NULL ;
00130 }
00131
00134 string action ;
00135 string action_name ;
00136 bool executed ;
00137
00140 string transmit_protocol ;
00141
00145 map<string, string> data ;
00146 const map<string, string> &data_c() const { return data ; }
00147 typedef map<string, string>::const_iterator data_citer ;
00148
00151 BESInfo *error_info ;
00152
00153 void dump( ostream &strm ) const ;
00154
00155 } ;
00156
00157 #endif // BESDataHandlerInterface_h_
00158