00001
00002
00003
00004
00005
00006
00007 #ifndef MCFTPREQUEST_H
00008 #define MCFTPREQUEST_H
00009
00010 #ifdef USE_STD
00011 #include <iostream>
00012 #include <string>
00013 using namespace std;
00014 #else
00015 #include <iostream.h>
00016 #include <string.h>
00017 #endif
00018
00019 #include "BufferBase.h"
00020 #include "MRAmspec.h"
00021 #include "MRAcspec.h"
00022 #include "MRAsbBase.h"
00023
00024 #ifndef MRA_MAXDIM
00025 #define MRA_MAXDIM 4
00026 #endif
00027
00028 class MCFTPquote;
00029
00030 class MCFTPrequest
00031 {
00032 public:
00033
00034 MCFTPrequest();
00035 MCFTPrequest( int grid_dim, int array_dim = 0 );
00036 MCFTPrequest( const MCFTPquote& rhs );
00037 MCFTPrequest( const MCFTPrequest& rhs );
00038
00039 MCFTPrequest& operator () ();
00040 MCFTPrequest& operator () ( int grid_dim, int array_dim = 0 );
00041 MCFTPrequest& operator () ( const MCFTPquote& );
00042 MCFTPrequest& operator () ( const MCFTPrequest& );
00043
00044 MCFTPrequest& copy( const MCFTPrequest& );
00045 MCFTPrequest& copy( const MCFTPquote& );
00046 MCFTPrequest& operator = ( const MCFTPrequest& rhs );
00047 MCFTPrequest& operator = ( const MCFTPquote& rhs );
00048
00049 bool is_equal( const MCFTPrequest& );
00050 bool is_equal( const MCFTPquote& );
00051 bool operator == ( const MCFTPrequest& rhs );
00052 bool operator == ( const MCFTPquote& rhs );
00053 bool operator != ( const MCFTPrequest& rhs );
00054 bool operator != ( const MCFTPquote& rhs );
00055
00056 MCFTPrequest operator + ( const MCFTPrequest& rhs );
00057 MCFTPrequest operator + ( const MCFTPquote& rhs );
00058 MCFTPrequest& operator += ( const MCFTPrequest& rhs );
00059 MCFTPrequest& operator += ( const MCFTPquote& rhs );
00060
00061 MCFTPrequest operator - ( const MCFTPrequest& rhs );
00062 MCFTPrequest operator - ( const MCFTPquote& rhs );
00063 MCFTPrequest& operator -= ( const MCFTPrequest& rhs );
00064 MCFTPrequest& operator -= ( const MCFTPquote& rhs );
00065
00066 void write( BufferBase& );
00067 MCFTPrequest& operator << ( BufferBase& );
00068 void read( BufferBase& );
00069 MCFTPrequest& operator >> ( BufferBase& );
00070
00071 void write( istream& );
00072 MCFTPrequest& operator << ( istream& );
00073 void read( ostream& );
00074 MCFTPrequest& operator >> ( ostream& );
00075
00076 void set_name( string );
00077
00078 void set_sbn();
00079 void set_sbn( const MRAsbn& );
00080
00081 void set_mspec();
00082 void set_mspec( const MRAmspec& );
00083 void set_mspec(
00084 const MRAmrange& mthis,
00085 const MRAmrange& mexist,
00086 const MRAmrange& mtheory
00087 );
00088
00089 void set_cspec();
00090 void set_cspec( const MRAcspec& );
00091 void set_cspec(
00092 const MRAcrange& cthis,
00093 const MRAcrange& cexist,
00094 const MRAcrange& ctheory
00095 );
00096
00097 int grid_dim();
00098 int array_dim();
00099
00100 string name();
00101
00102 MRAsbn& sbn();
00103 MRAmspec& mspec();
00104 MRAcspec& cspec();
00105
00106 int sizeb();
00107
00108 void report( ostream& = cout );
00109
00110 protected:
00111
00112 int _grid_dim;
00113 int _array_dim;
00114
00115 string _name;
00116
00117 MRAsbn _sbn;
00118 MRAmspec _mspec;
00119 MRAcspec _cspec;
00120
00121 friend class MCFTPquote;
00122
00123 friend BufferBase& operator >> ( BufferBase&, MCFTPrequest& );
00124 friend BufferBase& operator << ( BufferBase&, MCFTPrequest& );
00125
00126 friend istream& operator >> ( istream&, MCFTPrequest& );
00127 friend ostream& operator << ( ostream&, MCFTPrequest& );
00128
00129 };
00130
00131 #include "MCFTPquote.h"
00132
00133 inline
00134 MCFTPrequest::MCFTPrequest() : _grid_dim(0), _array_dim(0), _name("") {}
00135
00136 inline
00137 MCFTPrequest& MCFTPrequest::operator = ( const MCFTPrequest& rhs )
00138 {
00139 return copy(rhs);
00140 }
00141
00142 inline
00143 MCFTPrequest& MCFTPrequest::operator = ( const MCFTPquote& rhs )
00144 {
00145 return copy(rhs);
00146 }
00147
00148 inline
00149 bool MCFTPrequest::operator == ( const MCFTPrequest& rhs )
00150 {
00151 return is_equal(rhs);
00152 }
00153
00154 inline
00155 bool MCFTPrequest::operator == ( const MCFTPquote& rhs )
00156 {
00157 return is_equal(rhs);
00158 }
00159
00160 inline
00161 bool MCFTPrequest::operator != ( const MCFTPrequest& rhs )
00162 {
00163 return !is_equal(rhs);
00164 }
00165
00166 inline
00167 bool MCFTPrequest::operator != ( const MCFTPquote& rhs )
00168 {
00169 return !is_equal(rhs);
00170 }
00171
00172 inline
00173 MCFTPrequest MCFTPrequest::operator + ( const MCFTPrequest& rhs )
00174 {
00175 MCFTPrequest request(*this);
00176 request._mspec.mthis += rhs._mspec.mthis;
00177 return request;
00178 }
00179
00180 inline
00181 MCFTPrequest MCFTPrequest::operator + ( const MCFTPquote& rhs )
00182 {
00183 MCFTPrequest request(*this);
00184 request._mspec.mthis += rhs._mspec.mthis;
00185 return request;
00186 }
00187
00188 inline
00189 MCFTPrequest& MCFTPrequest::operator += ( const MCFTPrequest& rhs )
00190 {
00191 _mspec.mthis += rhs._mspec.mthis;
00192 return *this;
00193 }
00194
00195 inline
00196 MCFTPrequest& MCFTPrequest::operator += ( const MCFTPquote& rhs )
00197 {
00198 _mspec.mthis += rhs._mspec.mthis;
00199 return *this;
00200 }
00201
00202 inline
00203 MCFTPrequest MCFTPrequest::operator - ( const MCFTPrequest& rhs )
00204 {
00205 MCFTPrequest request(*this);
00206 request._mspec.mthis -= rhs._mspec.mthis;
00207 return request;
00208 }
00209
00210 inline
00211 MCFTPrequest MCFTPrequest::operator - ( const MCFTPquote& rhs )
00212 {
00213 MCFTPrequest request(*this);
00214 request._mspec.mthis -= rhs._mspec.mthis;
00215 return request;
00216 }
00217
00218 inline
00219 MCFTPrequest& MCFTPrequest::operator -= ( const MCFTPrequest& rhs )
00220 {
00221 _mspec.mthis -= rhs._mspec.mthis;
00222 return *this;
00223 }
00224
00225 inline
00226 MCFTPrequest& MCFTPrequest::operator -= ( const MCFTPquote& rhs )
00227 {
00228 _mspec.mthis -= rhs._mspec.mthis;
00229 return *this;
00230 }
00231
00232 inline
00233 MCFTPrequest& MCFTPrequest::operator << ( BufferBase& buffer )
00234 {
00235 write(buffer);
00236 return *this;
00237 }
00238
00239 inline
00240 MCFTPrequest& MCFTPrequest::operator >> ( BufferBase& buffer )
00241 {
00242 read(buffer);
00243 return *this;
00244 }
00245
00246 inline
00247 MCFTPrequest& MCFTPrequest::operator << ( istream& is )
00248 {
00249 write(is);
00250 return *this;
00251 }
00252
00253 inline
00254 MCFTPrequest& MCFTPrequest::operator >> ( ostream& os )
00255 {
00256 read(os);
00257 return *this;
00258 }
00259
00260 inline
00261 void MCFTPrequest::set_name( string name ) { _name = name; }
00262
00263 inline
00264 void MCFTPrequest::set_sbn()
00265 {
00266 _sbn =0;
00267 }
00268
00269 inline
00270 void MCFTPrequest::set_sbn( const MRAsbn& sbn ) { _sbn = sbn; }
00271
00272 inline
00273 void MCFTPrequest::set_mspec()
00274 {
00275 _mspec.mthis.mmin = MRAmlevel::mmin_limit;
00276 _mspec.mthis.mmax = MRAmlevel::mmax_limit;
00277
00278 _mspec.mexist.mmin = MRAmlevel::mmin_limit;
00279 _mspec.mexist.mmax = MRAmlevel::mmax_limit;
00280
00281 _mspec.mtheory.mmin = MRAmlevel::mmin_limit;
00282 _mspec.mtheory.mmax = MRAmlevel::mmax_limit;
00283 }
00284
00285 inline
00286 void MCFTPrequest::set_mspec( const MRAmspec& mspec ) { _mspec = mspec; }
00287
00288 inline
00289 void MCFTPrequest::set_mspec(
00290 const MRAmrange& mthis, const MRAmrange& mexist, const MRAmrange& mtheory
00291 )
00292 {
00293 _mspec.mthis = mthis;
00294 _mspec.mexist = mexist;
00295 _mspec.mtheory = mtheory;
00296 }
00297
00298 inline
00299 void MCFTPrequest::set_cspec()
00300 {
00301 _cspec.cthis.cmin = MRAclevel::cmin_limit;
00302 _cspec.cthis.cmax = MRAclevel::cmax_limit;
00303
00304 _cspec.cexist.cmin = MRAclevel::cmin_limit;
00305 _cspec.cexist.cmax = MRAclevel::cmax_limit;
00306
00307 _cspec.ctheory.cmin = MRAclevel::cmin_limit;
00308 _cspec.ctheory.cmax = MRAclevel::cmax_limit;
00309 }
00310
00311 inline
00312 void MCFTPrequest::set_cspec( const MRAcspec& cspec ) { _cspec = cspec; }
00313
00314 inline
00315 void MCFTPrequest::set_cspec(
00316 const MRAcrange& cthis, const MRAcrange& cexist, const MRAcrange& ctheory
00317 )
00318 {
00319 _cspec.cthis = cthis;
00320 _cspec.cexist = cexist;
00321 _cspec.ctheory = ctheory;
00322 }
00323
00324 inline
00325 int MCFTPrequest::grid_dim() { return _grid_dim; }
00326
00327 inline
00328 int MCFTPrequest::array_dim() { return _array_dim; }
00329
00330 inline
00331 string MCFTPrequest::name() { return _name; }
00332
00333 inline
00334 MRAsbn& MCFTPrequest::sbn() { return _sbn; }
00335
00336 inline
00337 MRAmspec& MCFTPrequest::mspec() { return _mspec; }
00338
00339 inline
00340 MRAcspec& MCFTPrequest::cspec() { return _cspec; }
00341
00342 #endif
00343