コード例 #1
0
ファイル: main.cpp プロジェクト: edholland/sipcmd
void TestProcess::Main()
{
    std::cout << "Starting sipcmd" << std::endl;
    debug << "in debug mode" << std::endl;
    PArgList &args = GetArguments();

    initSignalHandling();
    manager = new Manager();
    if (manager->Init(args))
        manager->Main(args);

    std::cout << "Exiting..." << std::endl;
    delete manager;

}
コード例 #2
0
ファイル: seqdb_perf.cpp プロジェクト: swuecho/igblast
void CSeqDBPerfApp::Init()
{
    HideStdArgs(fHideConffile | fHideFullVersion | fHideXmlHelp | fHideDryRun);

    auto_ptr<CArgDescriptions> arg_desc(new CArgDescriptions);

    // Specify USAGE context
    arg_desc->SetUsageContext(GetArguments().GetProgramBasename(), 
                  "CSeqDB performance testing client");

    arg_desc->SetCurrentGroup("BLAST database options");
    arg_desc->AddDefaultKey("db", "dbname", "BLAST database name", 
                            CArgDescriptions::eString, "nr");

    arg_desc->AddDefaultKey("dbtype", "molecule_type",
                            "Molecule type stored in BLAST database",
                            CArgDescriptions::eString, "guess");
    arg_desc->SetConstraint("dbtype", &(*new CArgAllow_Strings,
                                        "nucl", "prot", "guess"));

    arg_desc->SetCurrentGroup("Retrieval options");
    arg_desc->AddFlag("scan_uncompressed", 
                      "Do a full database scan of uncompressed sequence data", true);
    arg_desc->AddFlag("scan_compressed", 
                      "Do a full database scan of compressed sequence data", true);
    arg_desc->AddFlag("get_metadata", 
                      "Retrieve BLAST database metadata", true);
    
    arg_desc->SetDependency("scan_compressed", CArgDescriptions::eExcludes, 
                            "scan_uncompressed");
    arg_desc->SetDependency("scan_compressed", CArgDescriptions::eExcludes, 
                            "get_metadata");
    arg_desc->SetDependency("scan_uncompressed", CArgDescriptions::eExcludes, 
                            "get_metadata"); 

    arg_desc->AddDefaultKey("num_threads", "number", 
                            "Number of threads to use (requires OpenMP)",
                            CArgDescriptions::eInteger, "1");
    arg_desc->SetConstraint("num_threads", new CArgAllow_Integers(0, kMax_Int));
    //arg_desc->AddFlag("one_db_handle", "Build only 1 CSeqDB object?", true);
    //arg_desc->SetDependency("one_db_handle", CArgDescriptions::eRequires, "num_threads");

    arg_desc->SetCurrentGroup("Output configuration options");
    arg_desc->AddDefaultKey("out", "output_file", "Output file name", 
                            CArgDescriptions::eOutputFile, "-");

    SetupArgDescriptions(arg_desc.release());
}
コード例 #3
0
void CImageTestApp::Init(void)
{
    // Create command-line argument descriptions class
    auto_ptr<CArgDescriptions> arg_desc(new CArgDescriptions);

    // Specify USAGE context
    arg_desc->SetUsageContext(GetArguments().GetProgramBasename(),
                              "Image read/write test application");

    arg_desc->AddDefaultKey("base", "ImageBase",
                            "Base of image name",
                            CArgDescriptions::eString, "test");

    // Setup arg.descriptions for this application
    SetupArgDescriptions(arg_desc.release());
}
コード例 #4
0
ファイル: test_compress.cpp プロジェクト: svn2github/ncbi_tk
void CTest::Init(void)
{
    SetDiagPostLevel(eDiag_Error);
    // To see all output, uncomment next line:
    //SetDiagPostLevel(eDiag_Trace);

    // Create command-line argument descriptions
    unique_ptr<CArgDescriptions> arg_desc(new CArgDescriptions);
    arg_desc->SetUsageContext(GetArguments().GetProgramBasename(),
                              "Test compression library");
    arg_desc->AddDefaultPositional
        ("lib", "Compression library to test", CArgDescriptions::eString, "all");
    arg_desc->SetConstraint
        ("lib", &(*new CArgAllow_Strings, "all", "z", "bz2", "lzo"));
    SetupArgDescriptions(arg_desc.release());
}
コード例 #5
0
void CTestApplication::Init(void)
{
    auto_ptr<CArgDescriptions> arg_desc(new CArgDescriptions);
    arg_desc->SetUsageContext(GetArguments().GetProgramBasename(),
                              "LDS test program");

    arg_desc->AddOptionalKey("mklds", "mklds", "Index LDS directory",
                             CArgDescriptions::eString);

    arg_desc->AddOptionalKey("ldsdir", "ldsdir", "Existing LDS directory to use",
                             CArgDescriptions::eString);

    arg_desc->AddExtra(0, kMax_UInt, "IDs to check", CArgDescriptions::eString);

    SetupArgDescriptions(arg_desc.release());
}
コード例 #6
0
void CTest::Init(void)
{
    unique_ptr<CArgDescriptions> arg_desc(new CArgDescriptions);
    arg_desc->SetUsageContext(GetArguments().GetProgramBasename(),
                              "Test program for the C Logging API");
    // Setup arg.descriptions for this application
    SetupArgDescriptions(arg_desc.release());

    // Reset environment variables that can affect test output
    putenv((char*)"SERVER_PORT=");
    putenv((char*)"HTTP_NCBI_SID=");
    putenv((char*)"HTTP_NCBI_PHID=");
    putenv((char*)"NCBI_LOG_SESSION_ID=");
    putenv((char*)"NCBI_LOG_HIT_ID=");
    putenv((char*)"NCBI_CONFIG__LOG__FILE=");
}
コード例 #7
0
ファイル: nowin_main.cpp プロジェクト: DmitrySigaev/ncbi
void Cn3DNoWin::Init(void)
{
    // turn off some Mesa-related env vars, irrelevant to off-screen rendering and not platform-indepdendent
    setenv("MESA_NO_3DNOW", "true", 1);
    setenv("MESA_NO_SSE", "true", 1);
    
    // setup the diagnostic stream
    SetDiagHandler(DisplayDiagnostic, NULL, NULL);
    SetDiagPostLevel(eDiag_Info);   // report all messages
    SetDiagTrace(eDT_Default);      // trace messages only when DIAG_TRACE env. var. is set
    UnsetDiagTraceFlag(eDPF_Location);
#ifdef _DEBUG
    SetDiagPostFlag(eDPF_File);
    SetDiagPostFlag(eDPF_Line);
#else
    UnsetDiagTraceFlag(eDPF_File);
    UnsetDiagTraceFlag(eDPF_Line);
#endif

    // C++ object verification
    CSerialObject::SetVerifyDataGlobal(eSerialVerifyData_Always);
    CObjectIStream::SetVerifyDataGlobal(eSerialVerifyData_Always);
    CObjectOStream::SetVerifyDataGlobal(eSerialVerifyData_Always);

    // set up argument processing
    CArgDescriptions *argDescr = new CArgDescriptions(false);
    argDescr->SetUsageContext(GetArguments().GetProgramName(), "No-Window Cn3D");
    
    // get data from file or network
    argDescr->AddOptionalKey("f", "file", "Ncbi-mime-asn1, Biostruc, or Cdd ASN.1 data file", argDescr->eString);
    argDescr->AddOptionalKey("d", "id", "MMDB or PDB ID", argDescr->eString);
    
    // model, for network or Biostruc load
    argDescr->AddOptionalKey("o", "model", "Model type to use for coordinates", argDescr->eString);
    argDescr->SetConstraint("o", (new CArgAllow_Strings)->Allow("alpha")->Allow("single")->Allow("PDB"));
    
    // controls for output
    argDescr->AddKey("p", "pngfile", "Output PNG file name", argDescr->eString);
    argDescr->AddKey("w", "width", "Output width in pixels", argDescr->eInteger);
    argDescr->AddKey("h", "height", "Output height in pixels", argDescr->eInteger);
    argDescr->AddFlag("i", "Create interlaced PNG");
    
    // use favorite style
    argDescr->AddOptionalKey("s", "style", "Favorite style", argDescr->eString);
    
    SetupArgDescriptions(argDescr);
}
コード例 #8
0
ファイル: pgTrigger.cpp プロジェクト: zr40/pgadmin3-light
void pgTrigger::ShowTreeDetail(ctlTree *browser, frmMain *form, ctlListView *properties, ctlSQLBox *sqlPane)
{
	if (!expandedKids && GetLanguage() != wxT("edbspl"))
	{
		ReadColumnDetails();

		if (browser)
		{
			// if no browser present, function will not be appended to tree
			expandedKids = true;
		}
		if (triggerFunction)
			delete triggerFunction;

		// append function here
		triggerFunction = functionFactory.AppendFunctions(this, GetSchema(), browser, wxT(
		                      "WHERE pr.oid=") + NumToStr(functionOid) + wxT("::oid\n"));
		if (triggerFunction)
		{
			iSetFunction(triggerFunction->GetQuotedFullIdentifier());
		}
	}

	if (properties)
	{
		CreateListColumns(properties);

		properties->AppendItem(_("Name"), GetName());
		properties->AppendItem(_("OID"), GetOid());
		if (GetConnection()->BackendMinimumVersion(8, 2))
			properties->AppendYesNoItem(_("Constraint?"), GetIsConstraint());
		properties->AppendItem(_("Fires"), GetFireWhen());
		properties->AppendItem(_("Event"), GetEvent());
		if (!GetQuotedColumns().IsEmpty())
		{
			properties->AppendItem(_("Columns"), GetColumns());
		}
		properties->AppendItem(_("For each"), GetForEach());
		if (GetLanguage() != wxT("edbspl"))
			properties->AppendItem(_("Function"), GetFunction() + wxT("(") + GetArguments() + wxT(")"));
		if (GetConnection()->BackendMinimumVersion(8, 5))
			properties->AppendItem(_("When?"), GetWhen());
		properties->AppendYesNoItem(_("Enabled?"), GetEnabled());
		properties->AppendYesNoItem(_("System trigger?"), GetSystemObject());
		properties->AppendItem(_("Comment"), firstLineOnly(GetComment()));
	}
}
コード例 #9
0
ファイル: math.cpp プロジェクト: fabdelhamid/waveforms
/*
  Determine if a the value of a string is constantly known
  (symbolic or numeric)
  */
bool ValueKnown  (const string& o_formula)
{
	bool result = true;
	
	string formula        = StripParens (o_formula);
	list<string> operands = SeparateOperands (formula);
    
    // one operand only 
    if (operands.size() == 1)  
    {
		    	
        ///////////////////////////// Literal
        if (IsNumber (operands.front()))
          return true;
        
        ///////////////////////////// Literal
        if (IsSymbol (operands.front()))
          return true;

        ///////////////////////////// Value Request

        
        ///////////////////////////// Function Call
        if (IsFunctionCall (operands.front()))
          return ValueKnown (SeparateArguments (GetArguments  (operands.front())));
        
        
        return false;
    } /* if */
    
    // multiple operands  
    else
    {
    	operands = OperandsOnly (operands);
    
        for (list<string>::iterator o = operands.begin(); o != operands.end(); o++)	
        { 
        
          if (!ValueKnown (*o))
             return false;          
          
        } /* for */
    return true;
    } /* else */

} /* circuit_t::ValueKnown */
コード例 #10
0
ファイル: test_date.cpp プロジェクト: svn2github/ncbi_tk
void CTestDateApp::Init(void)
{
    auto_ptr<CArgDescriptions> arg_desc(new CArgDescriptions);
    arg_desc->SetUsageContext(GetArguments().GetProgramBasename(),
                              "test of CDate_std::GetDate()");
    
    arg_desc->AddKey("f", "format", "date format", CArgDescriptions::eString);
    arg_desc->AddKey("Y", "year",   "year number", CArgDescriptions::eInteger);
    arg_desc->AddOptionalKey("M", "month", "month number",
                             CArgDescriptions::eInteger);
    arg_desc->AddOptionalKey("D", "day", "day number",
                             CArgDescriptions::eInteger);
    arg_desc->AddOptionalKey("S", "season", "season name",
                             CArgDescriptions::eString);
    // hour, minute, second?
    SetupArgDescriptions(arg_desc.release());
}
コード例 #11
0
ファイル: irixbasic.c プロジェクト: AndrewHazelden/IRIXBASIC
int main (int argc, char *argv[])
{
	int inc=0;
	
	start_time = time(NULL);
	
	GetArguments(argc, argv); /* Get the script filename */
	PrintVersion();  /* Print info */
	InitGFX();       /* Setup SDL  */	
	DisplayTitle();  /* Show the irixbasic titles */
	DisplayReady();  /* Display the ready text */
	
	LoadScript(); 
	
	SDL_Flip(screen);
	ubasic_init(program); /* Setup uBasic  */	
	
	
	/* Start the program when the user is ready */
	PrintTextLine("Click to Run.");
	SDL_Delay(200);
	do
	{
		GetInput();   /* Read the inputs */
	}while (!GetMouseButton());
	
	
	do
	{
		GetInput();   /* Read the inputs */
		ubasic_run(); /* Process a line of code*/
	}while (!ubasic_finished() && !done);
	
	PrintTextLine("");
	PrintTextLine("Click or Press ESC to quit.");
	SDL_Flip(screen);
	
	while(!done && !GetMouseButton()){
		GetInput();
	}
	
	TTF_CloseFont( fntc64 );
	
	return 0;
}
コード例 #12
0
void CBamGraphTestApp::Init(void)
{
    // Create command-line argument descriptions class
    auto_ptr<CArgDescriptions> arg_desc(new CArgDescriptions);

    // Specify USAGE context
    arg_desc->SetUsageContext(GetArguments().GetProgramBasename(),
                              "CArgDescriptions demo program");

    arg_desc->AddOptionalKey("dir", "Dir",
                             "BAM files files directory",
                             CArgDescriptions::eString);
    arg_desc->AddDefaultKey("file", "File",
                            "BAM file name",
                            CArgDescriptions::eString,
                            BAM_FILE);

    arg_desc->AddOptionalKey("ref_label", "RefLabel",
                             "RefSeq id in BAM file",
                             CArgDescriptions::eString);
    arg_desc->AddOptionalKey("seq_id", "SeqId",
                             "RefSeq Seq-id",
                             CArgDescriptions::eString);
    arg_desc->AddFlag("log", "Generate logarithmic graph");
    arg_desc->AddFlag("int", "Generate graph with int values");
    arg_desc->AddOptionalKey("outlier_max", "OutlierMax",
                             "Factor over average to treat as outlier",
                             CArgDescriptions::eDouble);

    arg_desc->AddOptionalKey("bin_size", "BinSize",
                             "Seq-graph bin size",
                             CArgDescriptions::eInteger);
    arg_desc->AddOptionalKey("title", "Title",
                             "Title of generated Seq-graph",
                             CArgDescriptions::eString);

    arg_desc->AddDefaultKey("o", "OutputFile",
                            "Output file of ASN.1",
                            CArgDescriptions::eOutputFile,
                            "-");
    arg_desc->AddFlag("bin", "Write binary ASN.1");

    // Setup arg.descriptions for this application
    SetupArgDescriptions(arg_desc.release());
}
コード例 #13
0
void CServerTestApp::Init(void)
{
    CORE_SetLOCK(MT_LOCK_cxx2c());
    CORE_SetLOG(LOG_cxx2c());

    auto_ptr<CArgDescriptions> arg_desc(new CArgDescriptions);

    arg_desc->SetUsageContext(GetArguments().GetProgramBasename(),
                              "CServer test application");

    arg_desc->AddDefaultKey("srvthreads", "N",
                            "Initial number of server threads",
                            CArgDescriptions::eInteger, "5");

    arg_desc->AddDefaultKey("maxsrvthreads", "N",
                            "Maximum number of server threads",
                            CArgDescriptions::eInteger, "10");

    arg_desc->AddDefaultKey("clthreads", "N",
                            "Initial number of client threads",
                            CArgDescriptions::eInteger, "5");

    arg_desc->AddDefaultKey("maxclthreads", "N",
                            "Maximum number of client threads",
                            CArgDescriptions::eInteger, "10");

    arg_desc->AddDefaultKey("requests", "N",
                            "Number of requests to make",
                            CArgDescriptions::eInteger, "100");

    CArgAllow* constraint = new CArgAllow_Integers(1, 999);

    arg_desc->SetConstraint("srvthreads", constraint);
    arg_desc->SetConstraint("maxsrvthreads", constraint);

    arg_desc->SetConstraint("clthreads", constraint);
    arg_desc->SetConstraint("maxclthreads", constraint);
    arg_desc->SetConstraint("requests", constraint);

    arg_desc->AddDefaultKey("maxdelay", "N",
                            "Maximum delay in milliseconds",
                            CArgDescriptions::eInteger, "1000");

    SetupArgDescriptions(arg_desc.release());
}
コード例 #14
0
    void Eval(CTreeNode<CBDB_QueryNode>& tr)
    {
        GetArguments(tr);

        CBDB_QueryNode& qnode = tr.GetValue();

        const string* arg0 = GetArg(0);
        const string* arg1 = GetArg(1);

        const CBDB_Field* fld0 = GetArgField(0);
        const CBDB_Field* fld1 = GetArgField(1);

        // here we check two cases:
        //   field = "value"
        //   "value" == field

        if (fld0 != 0 && fld1 == 0) {
            CBoyerMooreMatcher* matcher = GetMatcher(*arg1, 0);
            int pos = matcher->Search(*arg0);
            if (pos == -1) { // not found
                qnode.SetValue("0");
            } else {
                qnode.SetValue("1");
            }
            return;
        }

        if (fld0 == 0 && fld1 != 0) {
            CBoyerMooreMatcher* matcher = GetMatcher(*arg0, 0);
            int pos = matcher->Search(*arg1);
            if (pos == -1) { // not found
                qnode.SetValue("0");
            } else {
                qnode.SetValue("1");
            }
            return;
        }

        // Plain equal

        bool res = (*arg0 == *arg1);
        if (IsNot())
            res = !res;
        SetResult(qnode, res);
    }
コード例 #15
0
void CTestMultipartCgiApplication::Init()
{
    CCgiApplication::Init();

    SetRequestFlags(CCgiRequest::fCaseInsensitiveArgs);

    unique_ptr<CArgDescriptions> arg_desc(new CArgDescriptions);
    arg_desc->SetUsageContext(GetArguments().GetProgramBasename(),
                              "Test of multipart CGI response implementation");
        
    arg_desc->AddDefaultKey("mode", "mode", "Multipart mode",
                            CArgDescriptions::eString, "none");
    arg_desc->SetConstraint
        ("mode",
         &(*new CArgAllow_Strings, "none", "mixed", "related", "replace"));

    SetupArgDescriptions(arg_desc.release());
}
コード例 #16
0
    void Eval(CTreeNode<CBDB_QueryNode>& tr)
    {
        GetArguments(tr, eCheckAll);

        CBDB_QueryNode& qnode = tr.GetValue();

        unsigned int size = m_ArgVector.size();
        _ASSERT(size);

        for (unsigned int i = 0; i < size; ++i) {
            const string* arg = GetArg(i);
            if (*arg == "0") {
                qnode.SetValue("0");
                return;
            }
        }
        qnode.SetValue("1");
    }
コード例 #17
0
void CTitleTester::Init(void)
{
    auto_ptr<CArgDescriptions> arg_desc(new CArgDescriptions);
    arg_desc->SetUsageContext(GetArguments().GetProgramBasename(),
                              "Show a sequence's title", false);

    arg_desc->AddKey("gi", "SeqEntryID", "GI id of the Seq-Entry to examine",
                     CArgDescriptions::eInteger);
    arg_desc->AddKey("in", "GIList", "File listing GIs to look up",
                     CArgDescriptions::eInputFile);
    arg_desc->SetDependency("gi", CArgDescriptions::eExcludes, "in");
    arg_desc->AddFlag("reconstruct", "Reconstruct title");
    arg_desc->AddFlag("allproteins", "Name all proteins, not just the first");
    arg_desc->AddFlag("localannots",
                      "Never use related sequences' annotations");

    SetupArgDescriptions(arg_desc.release());
}
コード例 #18
0
void CTestNetScheduleClient::Init(void)
{
    InitOutputBuffer();

    CONNECT_Init();
    SetDiagPostFlag(eDPF_Trace);
    SetDiagPostLevel(eDiag_Info);

    // Setup command line arguments and parameters

    // Create command-line argument descriptions class
    auto_ptr<CArgDescriptions> arg_desc(new CArgDescriptions);

    // Specify USAGE context
    arg_desc->SetUsageContext(GetArguments().GetProgramBasename(),
                              "NetSchedule client");

    arg_desc->AddKey("service", "ServiceName",
        "NetSchedule service name (format: host:port or servcie_name)",
        CArgDescriptions::eString);

    arg_desc->AddKey("queue", "QueueName",
        "NetSchedule queue name",
        CArgDescriptions::eString);

    arg_desc->AddOptionalKey("ilen", "InputLength", "Average input length",
                             CArgDescriptions::eInteger);

    arg_desc->AddOptionalKey("maxruntime", "MaxRunTime",
            "Maximum run time of this test", CArgDescriptions::eInteger);

    arg_desc->AddOptionalKey("input", "InputString", "Input string",
                             CArgDescriptions::eString);

    arg_desc->AddOptionalKey("jobs", "jobs", "Number of jobs to submit",
                             CArgDescriptions::eInteger);

    arg_desc->AddOptionalKey("naff", "AffinityTokens",
        "Number of different affinities", CArgDescriptions::eInteger);


    // Setup arg.descriptions for this application
    SetupArgDescriptions(arg_desc.release());
}
コード例 #19
0
ファイル: fmm.C プロジェクト: elau/graphite_pep
int
main (int argc, char *argv[])
{
   long c;
   extern char *optarg;

   CLOCK(starttime);

   while ((c = getopt(argc, argv, "osh")) != -1) {
     switch(c) {
       case 'o': do_output = 1; break;
       case 's': do_stats = 1; break;
       case 'h': Help(); break;
     }
   }

   MAIN_INITENV(,40000000);

   GetArguments();

   printf("Number of processors: %d\n", Number_Of_Processors);

   THREAD_INIT(Number_Of_Processors);

   InitGlobalMemory();
   InitExpTables();
   CreateDistribution(Cluster, Model);

/*   for (i = 1; i < Number_Of_Processors; i++) {
      CREATE(ParallelExecute);
   }
   ParallelExecute();
   WAIT_FOR_END(Number_Of_Processors - 1);*/
   CREATE(ParallelExecute, Number_Of_Processors);
   WAIT_FOR_END(Number_Of_Processors);

   printf("Finished FMM\n");
   PrintTimes();
   if (do_output) {
     PrintAllParticles();
   }
   MAIN_END;
}
コード例 #20
0
ファイル: cav_main.cpp プロジェクト: svn2github/ncbi_tk
BEGIN_NCBI_SCOPE

void CAVApp::Init(void)
{
    // create command-line argument descriptions
    CArgDescriptions *argDescr = new CArgDescriptions();

    // usage
    argDescr->SetUsageContext(GetArguments().GetProgramName(), "CDD Alignment Viewer");

    // output type (required)
    argDescr->AddKey("type", "type", "one of: 'text' (unformatted), 'HTML', or 'FASTA'", argDescr->eString);
    argDescr->SetConstraint("type", (new CArgAllow_Strings())->Allow("text")->Allow("HTML")->Allow("FASTA"));

    // lowercase flag for FASTA
    argDescr->AddFlag("fasta_lc", "whether to show unaligned residues in lowercase in FASTA output");

    // paragraph width (optional, default 60)
    argDescr->AddDefaultKey("width", "integer", "paragraph width", argDescr->eInteger, "60");
    argDescr->SetConstraint("width", new CArgAllow_Integers(1, kMax_Int));

    // conservation threshhold (optional, default 2.0)
    argDescr->AddDefaultKey("cons", "bits", "conservation threshhold (bit score)", argDescr->eDouble, "2.0");
    argDescr->AddFlag("identity", "show identity, ignoring bit score");

    // whether to output left/right tails
    argDescr->AddFlag("lefttails", "whether to show left tails");
    argDescr->AddFlag("righttails", "whether to show right tails");

    // whether to do condensed display
    argDescr->AddFlag("condensed", "condensed incompletely aligned columns (text/HTML only)");

    // don't use colored backgrounds
    argDescr->AddFlag("no_color_bg", "don't use colored backgrounds for alignment paragraphs (HTML only)");

    // ignore bad pairwise alignments
    argDescr->AddFlag("ignore_bad_aln", "ignore invalid pairwise alignments in input data");

    // input file name (required)
    argDescr->AddPositional("in", "name of input file", argDescr->eString);

    SetupArgDescriptions(argDescr);
}
コード例 #21
0
ファイル: formatguess.cpp プロジェクト: svn2github/ncbi_tk
//  ============================================================================
void CFormatGuessApp::Init(void)
//  ============================================================================
{
    auto_ptr<CArgDescriptions> arg_desc(new CArgDescriptions);

    arg_desc->SetUsageContext
        (GetArguments().GetProgramBasename(),
         "CFormatGuess front end: Guess various file formats");

    //
    //  shared flags and parameters:
    //        
    arg_desc->AddDefaultKey
        ("i", "InputFile",
         "Input File Name or '-' for stdin.",
         CArgDescriptions::eInputFile,
         "-");
         
    arg_desc->AddFlag(
        "canonical-name",
        "Use the canonical name which is the name of the format as "
        "given by the underlying C++ format guesser.");
        
    arg_desc->AddFlag(
        "show-object-type",
        "Make output include the type of the object.   If it cannot be "
        "determined or does not make sense for the given format then it "
        "considers it 'unknown'"
    );
    
    arg_desc->AddDefaultKey(
        "output-format", "OutputFormat",
        "How this program should send the results of its guesses.",
        CArgDescriptions::eString,
        "text"
    );
    arg_desc->SetConstraint("output-format", &(*new CArgAllow_Strings,
                                               "text", "XML"));
    

    SetupArgDescriptions(arg_desc.release());
}
コード例 #22
0
void AtomicTool::Setup()
{
    const Vector<String>& arguments = GetArguments();

    for (unsigned i = 0; i < arguments.Size(); ++i)
    {
        if (arguments[i].Length() > 1)
        {
            String argument = arguments[i].ToLower();
            String value = i + 1 < arguments.Size() ? arguments[i + 1] : String::EMPTY;

            if (argument == "--cli-data-path")
            {
                if (!value.Length())
                    ErrorExit("Unable to parse --cli-data-path");

                cliDataPath_ = AddTrailingSlash(value);
            }
            else if (argument == "--activate")
            {
                if (!value.Length())
                    ErrorExit("Unable to parse --activation product key");

                activationKey_ = value;
            }
            else if (argument == "--deactivate")
            {
                deactivate_ = true;
            }

        }

    }

    engineParameters_["Headless"] = true;
    engineParameters_["LogLevel"] = LOG_INFO;

    // no default resources, AtomicTool may be run outside of source tree
    engineParameters_["ResourcePaths"] = "";
}
コード例 #23
0
void CTestApplication::Init(void)
{
    // Set error posting and tracing on maximum
    SetDiagTrace(eDT_Enable);
    SetDiagPostFlag(eDPF_All);
    SetDiagPostLevel(eDiag_Info);

    // Create command-line argument descriptions class
    auto_ptr<CArgDescriptions> arg_desc(new CArgDescriptions);
    
    // Specify USAGE context
    arg_desc->SetUsageContext(GetArguments().GetProgramBasename(), "Test inter-process locks");
    
    // Specific to multi-process configuration test
    arg_desc->AddDefaultKey("test", "number", "test case number (internal use only)",
                            CArgDescriptions::eInteger, "0");
    arg_desc->AddDefaultKey("lock", "name", "parent's lock (internal use only)",
                            CArgDescriptions::eString, kEmptyStr);
    
    // Setup arg.descriptions for this application
    SetupArgDescriptions(arg_desc.release());
}
コード例 #24
0
ファイル: WmpDecApp.c プロジェクト: AmesianX/pilot
//================================================================
// Windows CE App entry
//================================================================
int WINAPI WinMain(HINSTANCE    hInstance,
                   HINSTANCE    hPrevInstance,
                   LPTSTR       lpCmdLine,
                   int          nCmdShow)
{
    int argc = 0;
    char** argv = NULL;

    //================================
    // redirect stdou and stderr
    fclose(stdout);
    fopen(DEFDIR "stdout.txt", "wb");

    fclose(stderr);
    fopen(DEFDIR "stderr.txt", "wb");

    //================================
    GetArguments(&argc, &argv);

    //================================
    return main(argc, argv);
}
コード例 #25
0
    int Run(void)
    {
        CONNECT_Init(&CNcbiApplication::Instance()->GetConfig());
        
        const CNcbiArguments& app_args = GetArguments();
        m_Seed = app_args.Size() > 1 ?
                (unsigned int)atoi(app_args[1].c_str()) : (unsigned int)time(0);
        // Set error posting and tracing on maximum
        SetDiagTrace(eDT_Enable);
        SetDiagPostLevel(eDiag_Info);
        SetDiagPostAllFlags(SetDiagPostAllFlags(eDPF_Default)
            | eDPF_All | eDPF_OmitInfoSev);
        UnsetDiagPostFlag(eDPF_Line);
        UnsetDiagPostFlag(eDPF_File);
        UnsetDiagPostFlag(eDPF_Location);
        UnsetDiagPostFlag(eDPF_LongFilename);
        SetDiagTraceAllFlags(SetDiagPostAllFlags(eDPF_Default));

        string host = "www.ncbi.nlm.nih.gov";
        string path = "/Service/bounce.cgi";
        string args = kEmptyStr;
        string uhdr = kEmptyStr;

        ERR_POST(Info << "Seed = " << m_Seed);
        srand(m_Seed);

        ERR_POST(Info << "Creating HTTP connection to "
            "http://" + host + path + &"?"[args.empty() ? 1 : 0] + args);
        CConn_HttpStream ios(host, path, args, uhdr);

        int n = TEST_StreamPushback(ios, false/*no rewind*/);

        // Manual CONNECT_UnInit (for implicit CONNECT_Init() by HTTP stream ctor)
        CORE_SetREG(0);
        CORE_SetLOG(0);
        CORE_SetLOCK(0);

        return n;
    }
コード例 #26
0
void CTestCompartApplication::Init(void)
{
    // Create command-line argument descriptions class
    auto_ptr<CArgDescriptions> arg_desc(new CArgDescriptions);

    // Specify USAGE context
    arg_desc->SetUsageContext(GetArguments().GetProgramBasename(),
                              "CArgDescriptions demo program");

    arg_desc->AddDefaultKey("i", "InputFile",
                            "File of ASN text Seq-aligns",
                            CArgDescriptions::eInputFile,
                            "-");

    arg_desc->AddDefaultKey("o", "OutputFile",
                            "File of results",
                            CArgDescriptions::eOutputFile,
                            "-");

    arg_desc->AddFlag("allow-intersect",
                      "Permit compartments to contain intersecting alignments "
                      "provided the alignments are consistent");

    arg_desc->AddFlag("allow-intersect-query",
                      "Permit compartments to contain intersecting alignments "
                      "for the query only");

    arg_desc->AddFlag("allow-intersect-subject",
                      "Permit compartments to contain intersecting alignments "
                      "for the subject only");

    arg_desc->AddFlag("allow-intersect-both",
                      "Permit compartments to contain intersecting alignments "
                      "only if both query and subject intersect");

    // Setup arg.descriptions for this application
    SetupArgDescriptions(arg_desc.release());
}
コード例 #27
0
void CVecScreenApp::Init()
{
    HideStdArgs(fHideLogfile | fHideConffile | fHideFullVersion | fHideXmlHelp | fHideDryRun);
    auto_ptr<CArgDescriptions> arg_desc(new CArgDescriptions);

    arg_desc->SetUsageContext(GetArguments().GetProgramBasename(),
                              "Vector screening tool, version " +
                              CVecScreenVersion().Print());
    arg_desc->SetCurrentGroup("Input query options");
    arg_desc->AddDefaultKey(kArgQuery, "input_file", 
                     "Input file name",
                     CArgDescriptions::eInputFile, kDfltArgQuery);

    arg_desc->SetCurrentGroup("BLAST database options");
    arg_desc->AddDefaultKey(kArgDb, "dbname", "BLAST database name", 
                            CArgDescriptions::eString, kDefaultVectorDb);

    arg_desc->SetCurrentGroup("Output configuration options");
    arg_desc->AddDefaultKey(kArgOutput, "output_file", "Output file name", 
                            CArgDescriptions::eOutputFile, "-");

    //arg_desc->AddDefaultKey("outfmt", "format",
    arg_desc->AddDefaultKey(kArgOutputFormat, "format",
            "VecScreen results options:\n"
            "  0 = Show alignments pairwise,\n"
            "  1 = Do not show alignments, just contaminated range offsets\n",
            CArgDescriptions::eInteger, 
            NStr::IntToString(kDfltArgOutputFormat));
    arg_desc->SetConstraint(kArgOutputFormat, 
       new CArgAllowValuesBetween(0, CVecscreenRun::CFormatter::eEndValue-1, true));
    // Produce Text output?
    arg_desc->AddFlag("text_output", "Produce text output?", true);

    arg_desc->SetCurrentGroup("");
    SetupArgDescriptions(arg_desc.release());
}
コード例 #28
0
ファイル: lds2_sample.cpp プロジェクト: svn2github/ncbi_tk
void CSampleLds2Application::Init(void)
{
    // Prepare command line descriptions
    //

    // Create
    auto_ptr<CArgDescriptions> arg_desc(new CArgDescriptions);

    arg_desc->AddOptionalKey("data_dir", "DataDir",
        "Directory with the data files.", CArgDescriptions::eString);

    arg_desc->AddKey("db", "DbFile", "LDS2 database file name.",
        CArgDescriptions::eString);

    // GI to fetch
    arg_desc->AddKey("id", "SeqEntryID", "ID of the Seq-Entry to fetch",
        CArgDescriptions::eString);

    arg_desc->AddFlag("print_entry", "Print seq-entry");
    arg_desc->AddFlag("print_feats", "Print features");
    arg_desc->AddFlag("print_aligns", "Print alignments");

    arg_desc->AddOptionalKey("group_aligns", "group_size",
        "Group standalone seq-aligns into blobs",
        CArgDescriptions::eInteger);

    // Program description
    string prog_description = "Example of the LDS2 usage\n";
    arg_desc->SetUsageContext(GetArguments().GetProgramBasename(),
                              prog_description, false);

    // Pass argument descriptions to the application
    //

    SetupArgDescriptions(arg_desc.release());
}
コード例 #29
0
ファイル: ngalign_test.cpp プロジェクト: DmitrySigaev/ncbi
void CNgAlignTest::Init()
{
    auto_ptr<CArgDescriptions> arg_descr(new CArgDescriptions);
    arg_descr->SetUsageContext(GetArguments().GetProgramName(),
                               "Demo application testing "
                               "xuberalign library");

    arg_descr->AddDefaultKey("blast_params", "parameter_string",
                             "Similar to what would be given to "
                             "command-line blast (single quotes respected)",
                             CArgDescriptions::eString, " -evalue 1e-5");

/*    arg_descr->AddDefaultKey("bandwidth", "bandwidth",
                             "list of bandwidths to try in banded alignment",
                             CArgDescriptions::eString, "401");
    arg_descr->AddDefaultKey("min_frac_ident", "fraction",
                             "minumum acceptable fraction identity",
                             CArgDescriptions::eDouble, "0.985");
    arg_descr->AddDefaultKey("max_end_slop", "base_pairs",
                             "maximum allowable unaligned bases at ends",
                             CArgDescriptions::eInteger, "10");
*/
    SetupArgDescriptions(arg_descr.release());
}
コード例 #30
0
ファイル: compartp.cpp プロジェクト: jackgopack4/pico-blast
void CCompartApplication::Init(void)
{
    // Create command-line argument descriptions class
    auto_ptr<CArgDescriptions> arg_desc(new CArgDescriptions);

    // Specify USAGE context
    arg_desc->SetUsageContext(GetArguments().GetProgramBasename(),
                              "makes compartments from protein BLAST m8");

    CCompartOptions::SetupArgDescriptions(arg_desc.get());

    arg_desc->AddDefaultKey("ifmt", "InputFormat",
                            "Format for input",
                            CArgDescriptions::eString,
                            "");
    arg_desc->SetConstraint("ifmt",
                            &(*new CArgAllow_Strings,
                              "tabular", "seq-align", "seq-align-set", "seq-annot"));

    arg_desc->AddFlag("hits",
                      "print hits");
    // Setup arg.descriptions for this application
    SetupArgDescriptions(arg_desc.release());
}