00001
00002
00003
00004
00005
00006
00007 #ifndef MCFTPQUOTE_H
00008 #define MCFTPQUOTE_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 MCFTPrequest;
00029
00030 class MCFTPquote
00031 {
00032 public:
00033
00034 MCFTPquote();
00035 MCFTPquote( int grid_dim, int array_dim = 0 );
00036 MCFTPquote( const MCFTPrequest& rhs );
00037 MCFTPquote( const MCFTPquote& rhs );
00038
00039 MCFTPquote& operator () ();
00040 MCFTPquote& operator () ( int grid_dim, int array_dim = 0 );
00041 MCFTPquote& operator () ( const MCFTPrequest& );
00042 MCFTPquote& operator () ( const MCFTPquote& );
00043
00044 MCFTPquote& copy( const MCFTPquote& rhs );
00045 MCFTPquote& copy( const MCFTPrequest& rhs );
00046 MCFTPquote& operator = ( const MCFTPquote& rhs );
00047 MCFTPquote& operator = ( const MCFTPrequest& rhs );
00048
00049 bool is_equal( const MCFTPquote& rhs );
00050 bool is_equal( const MCFTPrequest& rhs );
00051 bool operator == ( const MCFTPquote& rhs );
00052 bool operator == ( const MCFTPrequest& rhs );
00053 bool operator != ( const MCFTPquote& rhs );
00054 bool operator != ( const MCFTPrequest& rhs );
00055
00056 MCFTPquote operator + ( const MCFTPquote& rhs );
00057 MCFTPquote operator + ( const MCFTPrequest& rhs );
00058 MCFTPquote& operator += ( const MCFTPquote& rhs );
00059 MCFTPquote& operator += ( const MCFTPrequest& rhs );
00060
00061 MCFTPquote operator - ( const MCFTPquote& rhs );
00062 MCFTPquote operator - ( const MCFTPrequest& rhs );
00063 MCFTPquote& operator -= ( const MCFTPquote& rhs );
00064 MCFTPquote& operator -= ( const MCFTPrequest& rhs );
00065
00066 void write( BufferBase& );
00067 MCFTPquote& operator << ( BufferBase& );
00068 void read( BufferBase& );
00069 MCFTPquote& operator >> ( BufferBase& );
00070
00071 void write( istream& );
00072 MCFTPquote& operator << ( istream& );
00073 void read( ostream& );
00074 MCFTPquote& 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 MCFTPrequest;
00122
00123 friend BufferBase& operator >> ( BufferBase&, MCFTPquote& );
00124 friend BufferBase& operator << ( BufferBase&, MCFTPquote& );
00125
00126 friend istream& operator >> ( istream&, MCFTPquote& );
00127 friend ostream& operator << ( ostream&, MCFTPquote& );
00128
00129 };
00130
00131 #include "MCFTPrequest.h"
00132
00133 inline
00134 MCFTPquote::MCFTPquote() : _grid_dim(0), _array_dim(0), _name("") {}
00135
00136 inline
00137 MCFTPquote& MCFTPquote::operator = ( const MCFTPquote& rhs )
00138 {
00139 return copy(rhs);
00140 }
00141
00142 inline
00143 MCFTPquote& MCFTPquote::operator = ( const MCFTPrequest& rhs )
00144 {
00145 return copy(rhs);
00146 }
00147
00148 inline
00149 bool MCFTPquote::operator == ( const MCFTPquote& rhs )
00150 {
00151 return is_equal(rhs);
00152 }
00153
00154 inline
00155 bool MCFTPquote::operator == ( const MCFTPrequest& rhs )
00156 {
00157 return is_equal(rhs);
00158 }
00159
00160 inline
00161 bool MCFTPquote::operator != ( const MCFTPquote& rhs )
00162 {
00163 return !is_equal(rhs);
00164 }
00165
00166 inline
00167 bool MCFTPquote::operator != ( const MCFTPrequest& rhs )
00168 {
00169 return !is_equal(rhs);
00170 }
00171
00172 inline
00173 MCFTPquote MCFTPquote::operator + ( const MCFTPquote& rhs )
00174 {
00175 MCFTPquote quote(*this);
00176 quote._mspec.mthis += rhs._mspec.mthis;
00177 return quote;
00178 }
00179
00180 inline
00181 MCFTPquote MCFTPquote::operator + ( const MCFTPrequest& rhs )
00182 {
00183 MCFTPquote quote(*this);
00184 quote._mspec.mthis += rhs._mspec.mthis;
00185 return quote;
00186 }
00187
00188 inline
00189 MCFTPquote& MCFTPquote::operator += ( const MCFTPquote& rhs )
00190 {
00191 _mspec.mthis += rhs._mspec.mthis;
00192 return *this;
00193 }
00194
00195 inline
00196 MCFTPquote& MCFTPquote::operator += ( const MCFTPrequest& rhs )
00197 {
00198 _mspec.mthis += rhs._mspec.mthis;
00199 return *this;
00200 }
00201
00202 inline
00203 MCFTPquote MCFTPquote::operator - ( const MCFTPquote& rhs )
00204 {
00205 MCFTPquote quote(*this);
00206 quote._mspec.mthis -= rhs._mspec.mthis;
00207 return quote;
00208 }
00209
00210 inline
00211 MCFTPquote MCFTPquote::operator - ( const MCFTPrequest& rhs )
00212 {
00213 MCFTPquote quote(*this);
00214 quote._mspec.mthis -= rhs._mspec.mthis;
00215 return quote;
00216 }
00217
00218 inline
00219 MCFTPquote& MCFTPquote::operator -= ( const MCFTPquote& rhs )
00220 {
00221 _mspec.mthis -= rhs._mspec.mthis;
00222 return *this;
00223 }
00224
00225 inline
00226 MCFTPquote& MCFTPquote::operator -= ( const MCFTPrequest& rhs )
00227 {
00228 _mspec.mthis -= rhs._mspec.mthis;
00229 return *this;
00230 }
00231
00232 inline
00233 MCFTPquote& MCFTPquote::operator << ( BufferBase& buffer )
00234 {
00235 write(buffer);
00236 return *this;
00237 }
00238
00239 inline
00240 MCFTPquote& MCFTPquote::operator >> ( BufferBase& buffer )
00241 {
00242 read(buffer);
00243 return *this;
00244 }
00245
00246 inline
00247 MCFTPquote& MCFTPquote::operator << ( istream& is )
00248 {
00249 write(is);
00250 return *this;
00251 }
00252
00253 inline
00254 MCFTPquote& MCFTPquote::operator >> ( ostream& os )
00255 {
00256 read(os);
00257 return *this;
00258 }
00259
00260 inline
00261 void MCFTPquote::set_name( string name ) { _name = name; }
00262
00263 inline
00264 void MCFTPquote::set_sbn() { _sbn = 0; }
00265
00266 inline
00267 void MCFTPquote::set_sbn( const MRAsbn& sbn ) { _sbn = sbn; }
00268
00269 inline
00270 void MCFTPquote::set_mspec()
00271 {
00272 _mspec.mthis.mmin = MRAmlevel::mmin_limit;
00273 _mspec.mthis.mmax = MRAmlevel::mmax_limit;
00274
00275 _mspec.mexist.mmin = MRAmlevel::mmin_limit;
00276 _mspec.mexist.mmax = MRAmlevel::mmax_limit;
00277
00278 _mspec.mtheory.mmin = MRAmlevel::mmin_limit;
00279 _mspec.mtheory.mmax = MRAmlevel::mmax_limit;
00280 }
00281
00282 inline
00283 void MCFTPquote::set_mspec( const MRAmspec& mspec ) { _mspec = mspec; }
00284
00285 inline
00286 void MCFTPquote::set_mspec(
00287 const MRAmrange& mthis, const MRAmrange& mexist, const MRAmrange& mtheory
00288 )
00289 {
00290 _mspec.mthis = mthis;
00291 _mspec.mexist = mexist;
00292 _mspec.mtheory = mtheory;
00293 }
00294
00295 inline
00296 void MCFTPquote::set_cspec()
00297 {
00298 _cspec.cthis.cmin = MRAclevel::cmin_limit;
00299 _cspec.cthis.cmax = MRAclevel::cmax_limit;
00300
00301 _cspec.cexist.cmin = MRAclevel::cmin_limit;
00302 _cspec.cexist.cmax = MRAclevel::cmax_limit;
00303
00304 _cspec.ctheory.cmin = MRAclevel::cmin_limit;
00305 _cspec.ctheory.cmax = MRAclevel::cmax_limit;
00306 }
00307
00308 inline
00309 void MCFTPquote::set_cspec( const MRAcspec& cspec ) { _cspec = cspec; }
00310
00311 inline
00312 void MCFTPquote::set_cspec(
00313 const MRAcrange& cthis, const MRAcrange& cexist, const MRAcrange& ctheory
00314 )
00315 {
00316 _cspec.cthis = cthis;
00317 _cspec.cexist = cexist;
00318 _cspec.ctheory = ctheory;
00319 }
00320
00321 inline
00322 int MCFTPquote::grid_dim() { return _grid_dim; }
00323
00324 inline
00325 int MCFTPquote::array_dim() { return _array_dim; }
00326
00327 inline
00328 string MCFTPquote::name() { return _name; }
00329
00330 inline
00331 MRAsbn& MCFTPquote::sbn() { return _sbn; }
00332
00333 inline
00334 MRAmspec& MCFTPquote::mspec() { return _mspec; }
00335
00336 inline
00337 MRAcspec& MCFTPquote::cspec() { return _cspec; }
00338
00339 #endif
00340