本文整理汇总了C++中AnyOption::processFile方法的典型用法代码示例。如果您正苦于以下问题:C++ AnyOption::processFile方法的具体用法?C++ AnyOption::processFile怎么用?C++ AnyOption::processFile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AnyOption
的用法示例。
在下文中一共展示了AnyOption::processFile方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AnyOption
void
simple( int argc, char* argv[] )
{
AnyOption *opt = new AnyOption();
opt->noPOSIX(); /* use simpler option type */
opt->setOption( "width" );
opt->setOption( "height" );
opt->setFlag( "convert");
opt->setCommandOption( "name" );
opt->setFileOption( "title" );
if ( ! opt->processFile( "sample.txt" ) )
cout << "Failed processing the resource file" << endl ;
opt->processCommandArgs( argc, argv );
cout << "THE OPTIONS : " << endl << endl ;
if( opt->getValue( "width" ) != NULL )
cout << "width : " << opt->getValue( "width" ) << endl ;
if( opt->getValue( "height" ) != NULL )
cout << "height : " << opt->getValue( "height" ) << endl ;
if( opt->getValue( "name" ) != NULL )
cout << "name : " << opt->getValue( "name" ) << endl ;
if( opt->getValue( "title" ) != NULL )
cout << "title : " << opt->getValue( "title" ) << endl ;
if( opt->getFlag( "convert" ) )
cout << "convert : set " << endl ;
cout << endl ;
cout << "THE ARGUMENTS : " << endl << endl ;
for( int i = 0 ; i < opt->getArgc() ; i++ ){
cout << opt->getArgv( i ) << endl ;
}
cout << endl;
delete opt;
}
示例2: AnyOption
//.........这里部分代码省略.........
opt->addUsage( " --stepsize Ray length step size for computation, km [0.01]" );
opt->addUsage( " --skips Maximum number of skips to allow. Use 0 for no limits. [0]" );
opt->addUsage( " --wind_units Specify 'kmpersec' if the winds are given in km/s [mpersec]" );
opt->addUsage( "FLAGS (no value required):" );
opt->addUsage( " --partial Report the final, incomplete raypath as well as the complete bounces." );
opt->addUsage( "" );
/*
opt->addUsage( "To use a set of ASCII files that form a 2-D slice of the atmosphere the following options apply:" );
opt->addUsage( "REQUIRED (no default values):" );
opt->addUsage( " --slicefile <filename> The name of the summary file describing the path (see documentation)" );
opt->addUsage( " --elev Value in range (-90,90)" );
opt->addUsage( " --maxraylength Maximum ray length to calculate (km) [none]" );
opt->addUsage( "OPTIONAL [defaults]:" );
opt->addUsage( " --maxelev Maximum elevation angle to calculate [--elev value]" );
opt->addUsage( " --delev Elevation angle step [1]" );
opt->addUsage( " --maxazimuth Maximum azimuth to calculate [--azimuth value]" );
opt->addUsage( " --dazimuth Azimuth angle step [1]" );
opt->addUsage( " --sourceheight Height at which to begin raytrace [ground level]" );
opt->addUsage( " --maxheight Height at which to cut off calculation [150 km]" );
opt->addUsage( " --maxrange Maximum distance from origin to calculate (km) [no maximum]" );
opt->addUsage( " --stepsize Ray length step size for computation, km [0.01]" );
opt->addUsage( " --skips Maximum number of skips to allow. Use 0 for no limits. [0]" );
opt->addUsage( "FLAGS (no value required):" );
opt->addUsage( " --partial Report the final, incomplete raypath as well as the complete bounces." );
opt->addUsage( "" );
opt->addUsage( "To use an analytic profile with Gaussian wind jets the following options apply:" );
opt->addUsage( "REQUIRED (no default values):" );
opt->addUsage( " --jetfile <filename> The parameter file for the profile" );
opt->addUsage( " --elev Value in range (-90,90)" );
opt->addUsage( " --azimuth Value in range [0,360), clockwise from north (optional for --envfile)" );
opt->addUsage( " --maxraylength Maximum ray length to calculate (km) [none]" );
opt->addUsage( "OPTIONAL [defaults]:" );
opt->addUsage( " --maxelev Maximum elevation angle to calculate [--elev value]" );
opt->addUsage( " --delev Elevation angle step [1]" );
opt->addUsage( " --maxazimuth Maximum azimuth to calculate [--azimuth value]" );
opt->addUsage( " --dazimuth Azimuth angle step [1]" );
opt->addUsage( " --sourceheight Height at which to begin raytrace [ground level]" );
opt->addUsage( " --maxheight Height at which to cut off calculation [150 km]" );
opt->addUsage( " --maxrange Maximum distance from origin to calculate (km) [no maximum]" );
opt->addUsage( " --stepsize Ray length step size for computation, km [0.1]" );
opt->addUsage( " --skips Maximum number of skips to allow. Use 0 for no limits. [0]" );
opt->addUsage( "FLAGS (no value required):" );
opt->addUsage( " --partial Report the final, incomplete raypath as well as the complete bounces." );
*/
opt->addUsage( "" );
opt->addUsage( "Examples (run from 'samples' directory):" );
opt->addUsage( "../bin/raytrace.2d --azimuth 90 --elev 1 --delev 1 --maxelev 45 --skips 1 --atmosfile NCPA_canonical_profile_zuvwtdp.dat --atmosfileorder zuvwtdp --maxraylength 800 --maxheight 140" );
opt->addUsage( "cat raypath_az090* > raypaths.2d.dat" );
opt->addUsage( "rm raypath_az090*" );
// Set up the actual flags and stuff
opt->setFlag( "help", 'h' );
opt->setFlag( "norange" );
opt->setFlag( "atmosout" );
opt->setFlag( "partial" );
opt->setOption( "slicefile" );
opt->setOption( "atmosfile" );
opt->setOption( "jetfile" );
opt->setOption( "elev" );
opt->setOption( "azimuth" );
opt->setOption( "maxraylength" );
opt->setOption( "lat" );
opt->setOption( "lon" );
opt->setOption( "maxrange" );
opt->setOption( "maxelev" );
opt->setOption( "delev" );
opt->setOption( "maxazimuth" );
opt->setOption( "dazimuth" );
opt->setOption( "sourceheight" );
opt->setOption( "maxheight" );
opt->setOption( "stepsize" );
opt->setOption( "dZ" );
opt->setOption( "dR" );
opt->setOption( "atmosfileorder" );
opt->setOption( "skiplines" );
opt->setOption( "skips" );
opt->setOption( "wind_units" );
// Process the command-line arguments
opt->processFile( "./raytrace.2d.options" );
opt->processCommandArgs( argc, argv );
if( ! opt->hasOptions()) { // print usage if no options
opt->printUsage();
delete opt;
exit( 1 );
}
// Check to see if help text was requested
if ( opt->getFlag( "help" ) || opt->getFlag( 'h' ) ) {
opt->printUsage();
exit( 1 );
}
return opt;
}
示例3: AnyOption
//.........这里部分代码省略.........
opt->addUsage( " requested in the propagation. Note that underscores" );
opt->addUsage( " are necessary to separate the numbers." );
opt->addUsage( " Note also that these are requested ranges;" );
opt->addUsage( " however the left-closest profile available" );
opt->addUsage( " in the .env file will actually be used; " );
opt->addUsage( " for instance we request the profile at 300 km " );
opt->addUsage( " but in the .env file the left-closest profile" );
opt->addUsage( " may be available at 290 km and it is the one used." );
opt->addUsage( " Example: >> ../bin/ModessRD2WCM --atmosfile g2sgcp2011012606L.jordan.env ");
opt->addUsage( " --atmosfileorder zuvwtdp --azimuth 90 --freq 0.01 ");
opt->addUsage( " --use_profiles_ranges_km 100_200_250 --maxrange_km 500 ");
opt->addUsage( "" );
opt->addUsage( " --use_profiles_at_steps_km" );
opt->addUsage( " e.g. --use_profiles_at_steps_km 100" );
opt->addUsage( " The profiles are requested at equidistant intervals " );
opt->addUsage( " specified by this option [1000]" );
opt->addUsage( "" );
opt->addUsage( " --use_1D_profiles_from_dir" );
opt->addUsage( " e.g. --use_1D_profiles_from_dir myprofiles" );
opt->addUsage( " This option allows to use the ascii profiles stored in" );
opt->addUsage( " the specified directory. The profiles must have names" );
opt->addUsage( " 'profiles0001', 'profiles0002', etc. and will be" );
opt->addUsage( " used in alphabetical order at the provided ranges" );
opt->addUsage( " e.g. in conjunction with either" );
opt->addUsage( " option '--use_profile_ranges_km' " );
opt->addUsage( " or option '--use_profiles_at_steps_km'" );
opt->addUsage( " If there are more requested ranges than existing" );
opt->addUsage( " profiles then the last profile is used repeatedly" );
opt->addUsage( " as necessary." );
opt->addUsage( " Example: >> ../bin/ModessRD2WCM --atmosfileorder zuvwtdp --skiplines 1" );
opt->addUsage( " --azimuth 90 --freq 0.1 --use_1D_profiles_from_dir myprofiles" );
opt->addUsage( " --use_profile_ranges_km 0_100_300_500 " );
opt->addUsage( "" );
opt->addUsage( "FLAGS (no value required):" );
opt->addUsage( " --write_2D_TLoss Outputs the 2D transmission loss to" );
opt->addUsage( " default file: tloss_rd2wcm_2d.nm" );
opt->addUsage( "" );
opt->addUsage( "" );
opt->addUsage( " The format of the output files are as follows (column order):" );
opt->addUsage( " tloss_rd2wcm_1d.nm: r, 4*PI*Re(P), 4*PI*Im(P), (incoherent TL)" );
opt->addUsage( " tloss_rd2wcm_1d.lossless.nm:" );
opt->addUsage( " tloss_rd2wcm_2d.nm: r, z, 4*PI*Re(P), 4*PI*Im(P)" );
opt->addUsage( "" );
opt->addUsage( " Examples to run (in the 'samples' directory):" );
opt->addUsage( "" );
opt->addUsage( " ../bin/ModessRD2WCM --use_1D_profiles_from_dir profiles --atmosfileorder zuvwtdp --skiplines 1 --azimuth 90 --freq 0.1 --use_profile_ranges_km 0_100_200_300 --maxrange_km 500" );
opt->addUsage( "" );
opt->addUsage( " ../bin/ModessRD2WCM --g2senvfile g2sgcp2011012606L.jordan.env --atmosfileorder zuvwtdp --skiplines 1 --azimuth 90 --freq 0.1 --use_profile_ranges_km 0_100_200_250 --maxrange_km 500" );
opt->addUsage( "" );
opt->addUsage( " ../bin/ModessRD2WCM --use_1D_profiles_from_dir profiles --atmosfileorder zuvwtdp --skiplines 1 --azimuth 90 --freq 0.1 --maxrange_km 500" );
opt->addUsage( "" );
opt->addUsage( " Note: if options --use_profile_ranges_km/--use_profiles_at_steps_km are not used then we fall back on the range-independent case using the first available atm. profile." );
opt->addUsage( "" );
// Set up the actual flags, etc.
opt->setFlag( "help", 'h' );
opt->setFlag( "write_2D_TLoss" );
opt->setFlag( "plot" );
opt->setOption( "atmosfile" );
opt->setOption( "atmosfileorder" );
opt->setOption( "g2senvfile" );
opt->setOption( "wind_units" );
opt->setOption( "use_1D_profiles_from_dir" );
opt->setOption( "slicefile" );
opt->setOption( "skiplines" );
opt->setOption( "azimuth" );
opt->setOption( "freq" );
opt->setOption( "maxrange_km" );
opt->setOption( "sourceheight_km" );
opt->setOption( "receiverheight_km" );
opt->setOption( "maxheight_km" );
opt->setOption( "zground_km" );
opt->setOption( "stepsize" );
opt->setOption( "Nz_grid" );
opt->setOption( "Nrng_steps" );
opt->setOption( "ground_impedance_model" );
opt->setOption( "Lamb_wave_BC" );
opt->setOption( "use_profile_ranges_km" );
opt->setOption( "use_profiles_at_steps_km" );
opt->setOption( "use_attn_file" );
// Process the command-line arguments
opt->processFile( "./ModessRD2WCM.options" );
opt->processCommandArgs( argc, argv );
if( ! opt->hasOptions()) { // print usage if no options
opt->printUsage();
delete opt;
exit( 1 );
}
// Check to see if help text was requested
if ( opt->getFlag( "help" ) || opt->getFlag( 'h' ) ) {
opt->printUsage();
exit( 1 );
}
return opt;
}
示例4: AnyOption
//.........这里部分代码省略.........
opt->addUsage( " R_start_km" );
opt->addUsage( "" );
opt->addUsage(" Additional parameters:" );
opt->addUsage( " --R_start_km The grid (viewing window) starts at R_start_km" );
opt->addUsage( " --width_km Grid width" );
opt->addUsage( " --max_celerity Reference speed [m/s]; in conjunction with R_start_km");
opt->addUsage( " it is determining where inside the grid the field is at");
opt->addUsage( " a time step; a value smaller than the speed of sound");
opt->addUsage( " at the ground is suggested." );
opt->addUsage( " --tmstep 2D pressure field is calculated at this specified time step." );
opt->addUsage( " --ntsteps Number of times the 2D pressure field is calculated");
opt->addUsage( " 'tmstep' seconds apart." );
opt->addUsage( "" );
opt->addUsage( " OPTIONAL [defaults]:" );
opt->addUsage( " --height_km The height of the 2D grid. [maximum height]" );
opt->addUsage( " --frame_file_stub Each 2D grid is saved into a file with the name");
opt->addUsage( " frame_file_stub_<time_of_start>; Default:[Pressure2D]." );
opt->addUsage( "" );
opt->addUsage( " Example: >> ../bin/ModBB --pulse_prop_grid mydispersionFolder --R_start_km 220 --width_km 50 --height_km 25 --max_celerity 300 --tmstep 30 --ntsteps 5 --frame_file_stub myPressure --use_builtin_pulse" );
opt->addUsage( "" );
*/
// Set up the actual flags, etc.
opt->setFlag( "help", 'h' );
opt->setFlag( "use_modess" );
opt->setFlag( "use_wmod" );
opt->setFlag( "get_impulse_resp" );
opt->setFlag( "use_builtin_pulse1" );
opt->setFlag( "use_builtin_pulse2" );
opt->setFlag( "turnoff_WKB");
opt->setFlag( "plot");
opt->setFlag( "use_zero_attn");
opt->setFlag( "wvnum_filter");
opt->setOption( "atmosfile" );
opt->setOption( "atmosfileorder" );
opt->setOption( "wind_units" );
opt->setOption( "skiplines" );
opt->setOption( "azimuth" );
opt->setOption( "maxrange_km" );
opt->setOption( "sourceheight_km" );
opt->setOption( "receiverheight_km" );
opt->setOption( "maxheight_km" );
opt->setOption( "zground_km" );
opt->setOption( "stepsize" );
opt->setOption( "Nz_grid" );
opt->setOption( "Nrng_steps" );
opt->setOption( "out_TL_2D" );
opt->setOption( "ground_impedance_model" );
opt->setOption( "Lamb_wave_BC" );
opt->setOption( "f_min" );
opt->setOption( "f_step" );
opt->setOption( "f_max" );
opt->setOption( "f_center" );
opt->setOption( "pulse_prop_grid" );
opt->setOption( "pulse_prop_src2rcv" );
opt->setOption( "pulse_prop_src2rcv_grid" );
opt->setOption( "R_start_km" );
opt->setOption( "R_end_km" );
opt->setOption( "DR_km" );
opt->setOption( "max_celerity" );
opt->setOption( "range_R_km" );
opt->setOption( "out_dispersion_files" );
opt->setOption( "out_disp_src2rcv_file" );
opt->setOption( "waveform_out_file" );
opt->setOption( "width_km" );
opt->setOption( "height_km" );
opt->setOption( "tmstep" );
opt->setOption( "ntsteps" );
opt->setOption( "frame_file_stub" );
opt->setOption( "disp_dirname" );
opt->setOption( "src_spectrum_file" );
opt->setOption( "src_waveform_file" );
opt->setOption( "nfft" );
opt->setOption( "use_attn_file" );
opt->setOption( "c_min" );
opt->setOption( "c_max" );
// Process the command-line arguments
opt->processFile( "./ModBB.options" );
opt->processCommandArgs( argc, argv );
if( ! opt->hasOptions()) { // print usage if no options
opt->printUsage();
delete opt;
exit( 1 );
}
// Check to see if help text was requested
if ( opt->getFlag( "help" ) || opt->getFlag( 'h' ) ) {
opt->printUsage();
exit( 1 );
}
return opt;
}