当前位置: 首页>>代码示例>>C++>>正文


C++ AnyOption::setOption方法代码示例

本文整理汇总了C++中AnyOption::setOption方法的典型用法代码示例。如果您正苦于以下问题:C++ AnyOption::setOption方法的具体用法?C++ AnyOption::setOption怎么用?C++ AnyOption::setOption使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在AnyOption的用法示例。


在下文中一共展示了AnyOption::setOption方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: main

/**
* @brief Read in files with arrays and join them into a single file
* @param argc
* @param argv[]
* @return
*/
int main (int argc, char *argv[]) {

        AnyOption opt;
        opt.setFlag ("help", 'h'); /* a flag (takes no argument), supporting long and short form */
        opt.setOption ("verbose", 'v');
        opt.setOption ("random", 'r');

        opt.addUsage ("OA: unittest: Perform some checks on the code");
        opt.addUsage ("Usage: unittest [OPTIONS]");
        opt.addUsage ("");
        opt.addUsage (" -v  --verbose  			Print documentation");
        opt.addUsage (" -r  --random  			Seed for random number generator");

        opt.processCommandArgs (argc, argv);
        int verbose = opt.getIntValue ('v', 1);
        int random = opt.getIntValue ('r', 0);

        if (opt.getFlag ("help") || opt.getFlag ('h')) {
                opt.printUsage ();
                exit (0);
        }

        if (verbose) {
                print_copyright ();
        }
        if (verbose >= 2) {
                print_options (std::cout);
        }

        oaunittest (verbose, 1, random);

        return 0;
}
开发者ID:eendebakpt,项目名称:oapackage,代码行数:39,代码来源:oaunittest.cpp

示例2: readoption

void readoption(int argc, char *argv[], bool *convertDir,
                QString *filename, QString *dir, QString *path)
{
    /* 1. CREATE AN OBJECT */
    AnyOption *opt = new AnyOption();

    /* 2. SET PREFERENCES  */
    //opt->noPOSIX(); /* do not check for POSIX style character options */
    //opt->setVerbose(); /* print warnings about unknown options */
    //opt->autoUsagePrint(true); /* print usage for bad options */

    /* 3. SET THE USAGE/HELP   */
    opt->addUsage( "" );
    opt->addUsage( "Usage: " );
    opt->addUsage( "" );
    opt->addUsage( " -h  --help               Prints this help " );
    opt->addUsage( " -f  --filename FILENAME  Filename to be converted " );
    opt->addUsage( " -d  --dir DIRECTORY      File dir to be converted " );
    opt->addUsage( " -p  --path PATH          Path where converted file saves " );
    opt->addUsage( "" );

    /* 4. SET THE OPTION STRINGS/CHARACTERS */

    /* by default all  options  will be checked on the command line and from option/resource file */
    opt->setFlag(  "help", 'h' );   /* a flag (takes no argument), supporting long and short form */
    opt->setOption(  "filename", 'f' ); /* an option (takes an argument), supporting long and short form */
    opt->setOption(  "dir", 'd' ); /* an option (takes an argument), supporting long and short form */
    opt->setOption(  "path", 'p' ); /* an option (takes an argument), supporting long and short form */

    /* 5. PROCESS THE COMMANDLINE AND RESOURCE FILE */

    /* go through the command line and get the options  */
    opt->processCommandArgs( argc, argv );

    if( ! opt->hasOptions()) { /* print usage if no options */
        opt->printUsage();
        delete opt;
        return;
    }

    /* 6. GET THE VALUES */
    if( opt->getFlag( "help" ) || opt->getFlag( 'h' ) )
        opt->printUsage();
    if( opt->getValue( 'f' ) != NULL  || opt->getValue( "filename" ) != NULL  ) {
        *convertDir = false;
        filename->append(QString(opt->getValue( 'f' )));
    }
    if( opt->getValue( 'd' ) != NULL  || opt->getValue( "dir" ) != NULL  ) {
        *convertDir = true;
        dir->append(QString(opt->getValue( 'd' )));
    }
    if( opt->getValue( 'p' ) != NULL  || opt->getValue( "path" ) != NULL  ) {
        path->append(QString(opt->getValue( 'p' )));
    }

    /* 8. DONE */
    delete opt;
}
开发者ID:quxiaofeng,项目名称:ImageNameParser,代码行数:58,代码来源:main.cpp

示例3: parse

void UpdaterOptions::parse(int argc, char** argv)
{
	AnyOption parser;
	parser.setOption("install-dir");
	parser.setOption("package-dir");
	parser.setOption("script");
	parser.setOption("wait");
	parser.setOption("mode");
	parser.setFlag("version");
	parser.setFlag("force-elevated");
	parser.setFlag("auto-close");

	parser.processCommandArgs(argc,argv);

	if (parser.getValue("mode"))
	{
		mode = stringToMode(parser.getValue("mode"));
	}
	if (parser.getValue("install-dir"))
	{
		installDir = parser.getValue("install-dir");
	}
	if (parser.getValue("package-dir"))
	{
		packageDir = parser.getValue("package-dir");
	}
	if (parser.getValue("script"))
	{
		scriptPath = parser.getValue("script");
	}
	if (parser.getValue("wait"))
	{
		waitPid = static_cast<PLATFORM_PID>(atoll(parser.getValue("wait")));
	}

	showVersion = parser.getFlag("version");
	forceElevated = parser.getFlag("force-elevated");
	autoClose = parser.getFlag("auto-close");
		
	if (installDir.empty())
	{
		// if no --install-dir argument is present, try parsing
		// the command-line arguments in the old format (which uses
		// a list of 'Key=Value' args)
		parseOldFormatArgs(argc,argv);
	}
}
开发者ID:emandino,项目名称:Update-Installer,代码行数:47,代码来源:UpdaterOptions.cpp

示例4: main

/**
 * @brief Read in files with arrays and join them into a single file
 * @param argc
 * @param argv[]
 * @return
 */
int main (int argc, char *argv[]) {
        AnyOption opt;

        /* parse command line options */
        opt.setFlag ("help", 'h'); /* a flag (takes no argument), supporting long and short form */
        opt.setOption ("output", 'o');
        opt.setOption ("format", 'f');
        opt.setOption ("verbose", 'v');

        opt.addUsage ("Orthonal Array Convert: convert array file into a different format");
        opt.addUsage ("Usage: oaconvert [OPTIONS] [INPUTFILE] [OUTPUTFILE]");
        opt.addUsage ("");
        opt.addUsage (" -h --help  			Prints this help ");
        opt.addUsage (" -f [FORMAT]					Output format (default: TEXT, or BINARY) ");
        opt.processCommandArgs (argc, argv);

        int verbose = opt.getIntValue ("verbose", 2);

        if (verbose > 0)
                print_copyright ();

        /* parse options */
        if (opt.getFlag ("help") || opt.getFlag ('h') || opt.getArgc () == 0) {
                opt.printUsage ();
                exit (0);
        }

        const std::string outputprefix = opt.getStringValue ('o', "");
        std::string format = opt.getStringValue ('f', "BINARY");

        arrayfile::arrayfilemode_t mode = arrayfile_t::parseModeString (format);

        if (opt.getArgc () != 2) {
                opt.printUsage ();
                exit (0);
        }

        std::string infile = opt.getArgv (0);
        std::string outfile = opt.getArgv (1);

		convert_array_file(infile, outfile, mode, verbose);

        return 0;
}
开发者ID:eendebakpt,项目名称:oapackage,代码行数:50,代码来源:oaconvert.cpp

示例5: 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;

}
开发者ID:Aliandrana,项目名称:snesdev,代码行数:39,代码来源:demo.cpp

示例6: main

int main(int argc, char* argv[])
{
    AnyOption opt;

    // Usage
    opt.addUsage( "Example: " );
    opt.addUsage( "  cppbitmessage -p 8444" );
    opt.addUsage( " " );
    opt.addUsage( "Usage: " );
    opt.addUsage( "" );
    opt.addUsage( "  -p --port                 Port to listen on");
    opt.addUsage( "  -V --version              Show version number");
    opt.addUsage( "     --help                 Show help");
    opt.addUsage( "" );

    opt.setOption(  "port", 'p' );
    opt.setFlag(  "version", 'V' );
    opt.setFlag(  "help" );

    opt.processCommandArgs(argc, argv);

    if ((!opt.hasOptions()) || (opt.getFlag( "help" )))
    {
		// print usage if no options
        opt.printUsage();
        return 0;
	}

    if ((opt.getFlag("version")) || (opt.getFlag('V')))
    {
        std::cout << "Version " << VERSION << std::endl;
        return 0;
	}

	int port = 8444;
    if ((opt.getValue("port") != NULL) || (opt.getValue('p')))
    {
        std::stringstream ss;
        ss << opt.getValue("port");
        ss >> port;
	}	
开发者ID:bashrc,项目名称:cppbitmessage,代码行数:41,代码来源:main.cpp

示例7: main

/**
 * @brief Read in a list of array and check for each of the arrays whether they are in LMC form or not
 * @param argc
 * @param argv[]
 * @return
 */
int main (int argc, char *argv[]) {
        char *fname;
        int correct = 0, wrong = 0;

        /* parse command line options */
        AnyOption opt;
        opt.setFlag ("help", 'h'); /* a flag (takes no argument), supporting long and short form */
        opt.setOption ("loglevel", 'l');
        opt.setOption ("oaconfig", 'c');
        opt.setOption ("check");
        opt.setOption ("strength", 's');
        opt.setOption ("prune", 'p');
        opt.setOption ("output", 'o');
        opt.setOption ("mode", 'm');

        opt.addUsage ("oacheck: Check arrays for LMC form or reduce to LMC form");
        opt.addUsage ("Usage: oacheck [OPTIONS] [ARRAYFILE]");
        opt.addUsage ("");
        opt.addUsage (" -h  --help  			Prints this help");
        opt.addUsage (" -l [LEVEL]  --loglevel [LEVEL]	Set loglevel to number");
        opt.addUsage (" -s [STRENGTH]  --strength [STRENGTH] Set strength to use in checking");
        std::string ss = " --check [MODE]			Select mode: ";
        ss +=
            printfstring ("%d (default: check ), %d (reduce to LMC form), %d (apply random transformation and reduce)",
                          MODE_CHECK, MODE_REDUCE, MODE_REDUCERANDOM); //
        for (int i = 3; i < ncheckopts; ++i)
                ss += printfstring (", %d (%s)", static_cast< checkmode_t > (i), modeString ((checkmode_t)i).c_str ());
        opt.addUsage (ss.c_str ());
        opt.addUsage (" -o [OUTPUTFILE] Output file for LMC reduction");

        opt.processCommandArgs (argc, argv);

        algorithm_t algmethod = (algorithm_t)opt.getIntValue ("mode", MODE_AUTOSELECT);

        int loglevel = NORMAL;
        if (opt.getValue ("loglevel") != NULL || opt.getValue ('l') != NULL)
                loglevel = atoi (opt.getValue ('l')); // set custom loglevel
        setloglevel (loglevel);

        if (checkloglevel (QUIET)) {
                print_copyright ();
        }

        if (opt.getFlag ("help") || opt.getFlag ('h') || opt.getArgc () == 0) {
                opt.printUsage ();
                return 0;
        }

        checkmode_t mode = MODE_CHECK;
        if (opt.getValue ("check") != NULL)
                mode = (checkmode_t)atoi (opt.getValue ("check")); // set custom loglevel
        if (mode >= ncheckopts)
                mode = MODE_CHECK;

        logstream (QUIET) << "#time start: " << currenttime () << std::endl;

        double t = get_time_ms ();
        t = 1e3 * (t - floor (t));
        srand (t);

        int prune = opt.getIntValue ('p', 0);

        fname = opt.getArgv (0);
        setloglevel (loglevel);

        int strength = opt.getIntValue ('s', 2);
        if (strength < 1 || strength > 10) {
                printf ("Strength specfied (t=%d) is invalid\n", strength);
                exit (1);
        } else {
                log_print (NORMAL, "Using strength %d to increase speed of checking arrays\n", strength);
        }

        arraylist_t outputlist;
        char *outputfile = 0;
        bool writeoutput = false;
        if (opt.getValue ("output") != NULL) {
                writeoutput = true;
                outputfile = opt.getValue ('o');
        }

        arrayfile_t *afile = new arrayfile_t (fname);
        if (!afile->isopen ()) {
                printf ("Problem opening %s\n", fname);
                exit (1);
        }

        logstream (NORMAL) << "Check mode: " << mode << " (" << modeString (mode) << ")" << endl;

        /* start checking */
        double Tstart = get_time_ms (), dt;

        int index;
        array_link al (afile->nrows, afile->ncols, -1);
//.........这里部分代码省略.........
开发者ID:eendebakpt,项目名称:oapackage,代码行数:101,代码来源:oacheck.cpp

示例8: pfs

//+----------------------------------------------------------------------------+
//| main()                                                                     |
//-----------------------------------------------------------------------------+
int
main(int argc, char** argv)
{
  common::PathFileString pfs(argv[0]);
  //////////////////////////////////////////////////////////////////////////////
  // User command line parser
  AnyOption *opt = new AnyOption();
  opt->autoUsagePrint(true);

  opt->addUsage( "" );
  opt->addUsage( "Usage: " );
  char buff[256];
  sprintf(buff, "       Example: %s -r example1_noisy.cfg", pfs.getFileName().c_str());
  opt->addUsage( buff );
  opt->addUsage( " -h  --help                 Prints this help" );
  opt->addUsage( " -r  --readfile <filename>  Reads the polyhedra description file" );
  opt->addUsage( " -t  --gltopic <topic name> (opt) ROS Topic to send OpenGL commands " );
  opt->addUsage( "" );

  opt->setFlag(  "help", 'h' );
  opt->setOption(  "readfile", 'r' );

  opt->processCommandArgs( argc, argv );

  if( opt->getFlag( "help" ) || opt->getFlag( 'h' ) ) {opt->printUsage(); delete opt; return(1);}

  std::string gltopic("OpenGLRosComTopic");
  if( opt->getValue( 't' ) != NULL  || opt->getValue( "gltopic" ) != NULL  ) gltopic = opt->getValue( 't' );
	std::cerr << "[OpenGL communication topic is set to : \"" << gltopic << "\"]\n";

  std::string readfile;
	if( opt->getValue( 'r' ) != NULL  || opt->getValue( "readfile" ) != NULL  )
	{
    readfile = opt->getValue( 'r' );
    std::cerr << "[ World description is read from \"" << readfile << "\"]\n";
	}
	else{opt->printUsage(); delete opt; return(-1);}

  delete opt;
  //
  //////////////////////////////////////////////////////////////////////////////

  //////////////////////////////////////////////////////////////////////////////
  // Initialize ROS and OpenGLRosCom node (visualization)
  std::cerr << "["<<pfs.getFileName()<<"]:" << "[Initializing ROS]"<< std::endl;
  ros::init(argc, argv, pfs.getFileName().c_str());
  if(ros::isInitialized())
    std::cerr << "["<<pfs.getFileName()<<"]:" << "[Initializing ROS]:[OK]\n"<< std::endl;
  else{
    std::cerr << "["<<pfs.getFileName()<<"]:" << "[Initializing ROS]:[FAILED]\n"<< std::endl;
    return(1);
  }
  COpenGLRosCom glNode;
  glNode.CreateNode(gltopic);
  //
  //////////////////////////////////////////////////////////////////////////////

  //////////////////////////////////////////////////////////////////////////////
  // Reading the input file
  std::cerr << "Reading the input file..." << std::endl;
  ShapeVector shapes;
  PoseVector  poses;
  IDVector    ID;
  if(ReadPolyhedraConfigFile(readfile, shapes, poses, ID)==false)
  {
    std::cerr << "["<<pfs.getFileName()<<"]:" << "Error reading file \"" << readfile << "\"\n";
    return(-1);
  }
  std::cerr << "Read " << poses.size() << " poses of " << shapes.size() << " shapes with " << ID.size() << " IDs.\n";
  //
  //////////////////////////////////////////////////////////////////////////////

  //////////////////////////////////////////////////////////////////////////////
  // Visualizing the configuration of objects
  std::cerr << "Visualizing the configuration of objects..." << std::endl;
  for(unsigned int i=0; i<shapes.size(); i++)
  {
    for(size_t j=0; j<shapes[i].F.size(); j++)
    {
      glNode.LineWidth(1.0f);
      glNode.AddColor3(0.3f, 0.6f, 0.5f);
      glNode.AddBegin("LINE_LOOP");
      for(size_t k=0; k<shapes[i].F[j].Idx.size(); k++)
      {
        int idx = shapes[i].F[j].Idx[k];
        Eigen::Matrix<Real,3,1> Vt = poses[i]*shapes[i].V[ idx ];
        glNode.AddVertex(Vt.x(), Vt.y(), Vt.z());
      }
      glNode.AddEnd();
    }
  }
  glNode.SendCMDbuffer();
  ros::spinOnce();
  common::PressEnterToContinue();
  //
  //////////////////////////////////////////////////////////////////////////////

//.........这里部分代码省略.........
开发者ID:Rasoul77,项目名称:promts,代码行数:101,代码来源:DemoPROMTSDLS.cpp

示例9: main

int main (int argc, char *argv[]) {
        AnyOption opt;
        /* parse command line options */
        opt.setFlag ("help", 'h'); /* a flag (takes no argument), supporting long and short form */
        opt.setOption ("output", 'o');
        opt.setOption ("input", 'I');
        opt.setOption ("rand", 'r');
        opt.setOption ("verbose", 'v');
        opt.setOption ("ii", 'i');
        opt.setOption ("jj");
        opt.setOption ("xx", 'x');
        opt.setOption ("dverbose", 'd');
        opt.setOption ("rows");
        opt.setOption ("cols");
        opt.setOption ("nrestarts");
        opt.setOption ("niter");
        opt.setOption ("mdebug", 'm');
        opt.setOption ("oaconfig", 'c'); /* file that specifies the design */

        opt.addUsage ("Orthonal Array: oatest: testing platform");
        opt.addUsage ("Usage: oatest [OPTIONS] [FILE]");
        opt.addUsage ("");
        opt.addUsage (" -h --help  			Prints this help ");
        opt.processCommandArgs (argc, argv);

        double t0 = get_time_ms (), dt = 0;
        int randvalseed = opt.getIntValue ('r', 1);
        int ix = opt.getIntValue ('i', 1);
        int r = opt.getIntValue ('r', 1);
        int jj = opt.getIntValue ("jj", 5);

        int xx = opt.getIntValue ('x', 0);
        int niter = opt.getIntValue ("niter", 10);
        int verbose = opt.getIntValue ("verbose", 1);

        const char *input = opt.getValue ('I');
        if (input == 0)
                input = "test.oa";

        srand (randvalseed);
        if (randvalseed == -1) {
                randvalseed = time (NULL);
                printf ("random seed %d\n", randvalseed);
                srand (randvalseed);
        }



		array_link array = exampleArray(0);
		lmc_t lmc_type = LMCcheck(array);


		array = array.randomperm();
		array.showarray();
		array_link reduced_array = reduceLMCform(array);
		reduced_array.showarray();
		exit(0);

		try {
			array_link al = exampleArray(r);
			al.show();
			al.showarray();

			std::vector<int> sizes = array2modelmatrix_sizes(al);
			display_vector(sizes); myprintf("\n");
			MatrixFloat modelmatrix = array2modelmatrix(al, "i", 1);
			array_link modelmatrixx = modelmatrix;
			modelmatrixx.show();
			modelmatrixx.showarray();

			modelmatrix = array2modelmatrix(al, "main", 1);
			modelmatrixx = modelmatrix;
			modelmatrixx.show();
			modelmatrixx.showarray();

			exit(0);

		}
		catch (const std::exception &e) {
			std::cerr << e.what() << std::endl;
			throw;
		}

        {
                array_link al = exampleArray (r);

                array_transformation_t tt = reduceOAnauty (al);
                array_link alx = tt.apply (al);
                exit (0);
        }



        return 0;
}
开发者ID:eendebakpt,项目名称:oapackage,代码行数:95,代码来源:oatest.cpp

示例10: main

/**
 * @brief Filter arrays in a file and write filtered arrays to output file
 * @param argc Number of command line arguments
 * @param argv Command line arguments
 * @return
 */
int main (int argc, char *argv[]) {
        AnyOption opt;

        /* parse command line options */
        opt.setFlag ("help", 'h'); /* a flag (takes no argument), supporting long and short form */
        opt.setOption ("output", 'o');
        opt.setOption ("verbose", 'v');
        opt.setOption ("na", 'a');
        opt.setOption ("index", 'i');
        opt.setOption ("format", 'f');

        opt.addUsage ("Orthonal Array Filter: filter arrays");
        opt.addUsage ("Usage: oaanalyse [OPTIONS] [INPUTFILE] [VALUESFILE] [THRESHOLD] [OUTPUTFILE]");
        opt.addUsage ("  The VALUESFILE is a binary file with k*N double values. Here N is the number of arrays");
        opt.addUsage ("  and k the number of analysis values.");

        opt.addUsage ("");
        opt.addUsage (" -h --help  			Prints this help ");
        opt.addUsage (" -v --verbose  			Verbose level (default: 1) ");
        opt.addUsage (" -a 		 			Number of values in analysis file (default: 1) ");
        opt.addUsage (" --index 		 		Index of value to compare (default: 0) ");
        opt.addUsage (" -f [FORMAT]					Output format (default: TEXT, or BINARY; B) ");
        opt.processCommandArgs (argc, argv);

        print_copyright ();

        /* parse options */
        if (opt.getFlag ("help") || opt.getFlag ('h') || opt.getArgc () < 4) {
                opt.printUsage ();
                exit (0);
        }
        int verbose = opt.getIntValue ('v', 1);
        int na = opt.getIntValue ('a', 1);
        int index = opt.getIntValue ("index", 0);

        std::string format = opt.getStringValue ('f', "BINARY");
        arrayfile::arrayfilemode_t mode = arrayfile_t::parseModeString (format);

        /* read in the arrays */
        std::string infile = opt.getArgv (0);
        std::string anafile = opt.getArgv (1);
        double threshold = atof (opt.getArgv (2));
        std::string outfile = opt.getArgv (3);

        if (verbose)
                printf ("oafilter: input %s, threshold %f (analysisfile %d values, index %d)\n", infile.c_str (),
                        threshold, na, index);

        arraylist_t *arraylist = new arraylist_t;
        int n = readarrayfile (opt.getArgv (0), arraylist);

        if (verbose)
                printf ("oafilter: filtering %d arrays\n", n);

        // read analysis file
        FILE *afid = fopen (anafile.c_str (), "rb");
        if (afid == 0) {
                printf ("   could not read analysisfile %s\n", anafile.c_str ());
                exit (0);
        }

        double *a = new double[n * na];
        fread (a, sizeof (double), n * na, afid);
        fclose (afid);

        std::vector< int > gidx;
        ;
        for (int jj = 0; jj < n; jj++) {
                double val = a[jj * na + index];
                if (val >= threshold)
                        gidx.push_back (jj);
                if (verbose >= 2)
                        printf ("jj %d: val %f, threshold %f\n", val >= threshold, val, threshold);
        }

        // filter
        arraylist_t *filtered = new arraylist_t;
        selectArrays (*arraylist, gidx, *filtered);

        /* write arrays to file */
        if (verbose)
                cout << "Writing " << filtered->size () << " arrays (input " << arraylist->size () << ") to file "
                     << outfile << endl;
        writearrayfile (outfile.c_str (), *filtered, mode);

        /* free allocated structures */
        delete[] a;
        delete arraylist;
        delete filtered;

        return 0;
}
开发者ID:eendebakpt,项目名称:oapackage,代码行数:98,代码来源:oafilter.cpp

示例11: 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;
}
开发者ID:chetzer-ncpa,项目名称:ncpaprop,代码行数:101,代码来源:ModBB_main.cpp

示例12: 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;
}
开发者ID:chetzer-ncpa,项目名称:ncpaprop,代码行数:101,代码来源:ModessRDCM_main.cpp

示例13: main

int main(int argc, char** argv)
{
    QApplication app(argc, argv);

    AnyOption options;
    options.addUsage(QString("Usage: %1 --help | --console | [--output path --prefix prefixName --suffix suffixName --type typeName").arg(argv[0]).toAscii());
    options.addUsage("");
    options.addUsage("--help                Displays this message.");
    options.addUsage("--console             Run the gui version.");
    options.addUsage("--output [path]       Output directory for the plugin skeleton.");
    options.addUsage("--prefix [prefixName] Prefix to use for the plugin.");
    options.addUsage("--suffix [suffixName] Suffix to use for the plugin.");
    options.addUsage("--type [typeName]     Type to use for the plugin.");
    options.addUsage("--quiet               Process quietly (non gui generation only).");

    options.setFlag("help");
    options.setFlag("console");

    options.setOption("output");
    options.setOption("prefix");
    options.setOption("suffix");
    options.setOption("type");
    options.setOption("quiet");

    options.processCommandArgs(argc, argv);

    if(options.getFlag("help")) {
        options.printUsage();
        return 0;
    }

    if(options.getFlag("console")) {

        bool paramsOk = options.getValue("output") && options.getValue("prefix") && options.getValue("type") && options.getValue("suffix");

        if( !paramsOk ) {
            options.printUsage();
            return 1;
        }

        if(!options.getFlag("quiet")) {
            qDebug() << "output = " << options.getValue("output");
            qDebug() << "prefix = " << options.getValue("prefix");
            qDebug() << "suffix = " << options.getValue("suffix");
            qDebug() << "type = " << options.getValue("type");
        }

        dtkPluginGenerator generator;
        generator.setOutputDirectory(options.getValue("output"));
        generator.setPrefix(options.getValue("prefix"));
        generator.setSuffix(options.getValue("suffix"));
        generator.setType(options.getValue("type"));

        bool resultGenerator = generator.run();

        if(!options.getFlag("quiet")) {
            if(resultGenerator)
                qDebug() << "Generation succeeded.";
            else
                qDebug() << "Plugin generation: Generation failed.";
        }

    } else {

        dtkPluginGeneratorMainWindow generator;
        generator.show();
	generator.raise();
        return app.exec();
        
    }
}
开发者ID:papadop,项目名称:dtk,代码行数:71,代码来源:main.cpp

示例14: main

int main(int argc, char** argv)
#endif
/*
#else
int WinMain(
    HINSTANCE hInstance,
    HINSTANCE hPrevInstance,
    LPSTR lpCmdLine,
    int nCmdShow)
#endif
*/
{
	string datapath;

	AnyOption *opt = new AnyOption();
	
    opt->addUsage( "" );
    opt->addUsage( "Usage: " );
    opt->addUsage( "" );
    opt->addUsage( " -h  --help  				Prints this help " );
    opt->addUsage( " -d  --data-path /dir		Data files path " );
    opt->addUsage( "" );

	opt->setFlag(  "help", 'h' );
	opt->setOption(  "data-path", 'd' );

	opt->processCommandArgs( argc, argv );

    if( opt->getFlag( "help" ) || opt->getFlag( 'h' ) ) 
	{
    	GWDBG_OUTPUT("Usage")
        opt->printUsage();
		delete opt;
		return 0;
	}
	if( opt->getValue( 'd' ) != NULL  || opt->getValue( "data-size" ) != NULL  )
		datapath = opt->getValue('d');

	delete opt;

    try
    {
#ifdef GP2X
        GW_PlatformGP2X platform;
#elif defined(GW_PLAT_PANDORA)
        GW_PlatformPandora platform;
#elif defined(GW_PLAT_S60)
        GW_PlatformS60 platform;
#elif defined(GW_PLAT_WIZ)
        GW_PlatformWIZ platform;
#elif defined(GW_PLAT_ANDROID)
        GW_PlatformAndroid platform;
#elif defined(GW_PLAT_IOS)
        GW_PlatformIOS platform;
#else
        GW_PlatformSDL platform(640, 480);
#endif
		if (!datapath.empty())
			platform.datapath_set(datapath);

        platform.initialize();

        GW_GameList gamelist(&platform);

        GW_Menu menu(&platform, &gamelist);
        menu.Run();

        platform.finalize();
    } catch (GW_Exception &e) {
    	GWDBG_OUTPUT(e.what().c_str())
        fprintf(stderr, "%s\n", e.what().c_str());
        return 1;
    }

    return 0;
}
开发者ID:RangelReale,项目名称:gameandwatch,代码行数:76,代码来源:gamewatch.cpp

示例15: process_option

int process_option(int argc, char* argv[]){
	AnyOption *opt = new AnyOption();
	opt->setVerbose();
	opt->addUsage( "" );
	opt->addUsage( "Usage: " );
	opt->addUsage( "" );
	opt->addUsage( "--S0" );
	opt->addUsage( "--G0" );
	opt->addUsage( "--RhoGEF0" );
	opt->addUsage( "--RhoA0" );
	opt->addUsage( "--Inhibitor0" );
	opt->addUsage( "--kg1" );
	opt->addUsage( "--kg2" );
	opt->addUsage( "--kf1" );
	opt->addUsage( "--kfd" );
	opt->addUsage( "--kg3" );
	opt->addUsage( "--kgd" );
	opt->addUsage( "--kf2" );
	opt->addUsage( "--ka1" );
	opt->addUsage( "--ka2" );
	opt->addUsage( "--ki1" );
	opt->addUsage( "--kid" );
	opt->addUsage( "" );

	opt->setOption( "S0" );
	opt->setOption( "G0" );
	opt->setOption( "RhoGEF0" );
	opt->setOption( "RhoA0" );
	opt->setOption( "Inhibitor0" );
	opt->setOption( "kg1" );
	opt->setOption( "kg2" );
	opt->setOption( "kf1" );
	opt->setOption( "kfd" );
	opt->setOption( "kg3" );
	opt->setOption( "kgd" );
	opt->setOption( "kf2" );
	opt->setOption( "ka1" );
	opt->setOption( "ka2" );
	opt->setOption( "ki1" );
	opt->setOption( "kid" );
	

	opt->processCommandArgs( argc, argv );
	if( opt->getValue( "S0" ) != NULL  ){
		S0 = atof(opt->getValue( "S0" ));
	}
	if( opt->getValue( "G0" ) != NULL  ){
		G0 = atof(opt->getValue( "G0" ));
	}
	if( opt->getValue( "RhoGEF0" ) != NULL  ){
		RhoGEF0 = atof(opt->getValue( "RhoGEF0" ));
	}
	if( opt->getValue( "RhoA0" ) != NULL  ){
		RhoA0 = atof(opt->getValue( "RhoA0" ));
	}
	if( opt->getValue( "Inhibitor0" ) != NULL  ){
		Inhibitor0 = atof(opt->getValue( "Inhibitor0" ));
	}
	if( opt->getValue( "kg1" ) != NULL  ){
		kg1 = atof(opt->getValue( "kg1" ));
	}
	if( opt->getValue( "kg2" ) != NULL  ){
		kg2 = atof(opt->getValue( "kg2" ));
	}
	if( opt->getValue( "kf1" ) != NULL  ){
		kf1 = atof(opt->getValue( "kf1" ));
	}
	if( opt->getValue( "kfd" ) != NULL  ){
		kfd = atof(opt->getValue( "kfd" ));
	}
	if( opt->getValue( "kg3" ) != NULL  ){
		kg3 = atof(opt->getValue( "kg3" ));
	}
	if( opt->getValue( "kgd" ) != NULL  ){
		kgd = atof(opt->getValue( "kgd" ));
	}
	if( opt->getValue( "kf2" ) != NULL  ){
		kf2 = atof(opt->getValue( "kf2" ));
	}
	if( opt->getValue( "ka1" ) != NULL  ){
		ka1 = atof(opt->getValue( "ka1" ));
	}
	if( opt->getValue( "ka2" ) != NULL  ){
		ka2 = atof(opt->getValue( "ka2" ));
	}
	if( opt->getValue( "ki1" ) != NULL  ){
		ki1 = atof(opt->getValue( "ki1" ));
	}
	if( opt->getValue( "kid" ) != NULL  ){
		kid = atof(opt->getValue( "kid" ));
	}
	return 0;
}
开发者ID:jksr,项目名称:xu,代码行数:93,代码来源:main.cpp


注:本文中的AnyOption::setOption方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。