コード例 #1
0
void CGridCgiSampleApplication::x_SetupArgs()
{
    // Disregard the case of CGI arguments
    SetRequestFlags(CCgiRequest::fCaseInsensitiveArgs);

    // Create CGI argument descriptions class
    //  (For CGI applications only keys can be used)
    auto_ptr<CArgDescriptions> arg_desc(new CArgDescriptions);

    // Specify USAGE context
    arg_desc->SetUsageContext(GetArguments().GetProgramBasename(),
                              "CGI sample application");
        
    // Describe possible cmd-line and HTTP entries
    // (optional)
    arg_desc->AddOptionalKey("message",
                             "message",
                             "Message passed to CGI application",
                             CArgDescriptions::eString,
                             CArgDescriptions::fAllowMultiple);

    arg_desc->AddOptionalKey("Cancel",
                             "Cancel",
                             "Cancel the job",
                             CArgDescriptions::eString);
    
    // Setup arg.descriptions for this application
    SetupArgDescriptions(arg_desc.release());
}
コード例 #2
0
void
CDbapiDriverSampleApp::Init()
{
    // Create command-line argument descriptions class
    auto_ptr<CArgDescriptions> arg_desc(new CArgDescriptions);

    // Specify USAGE context
    arg_desc->SetUsageContext(GetArguments().GetProgramBasename(),
                              "DBAPI Sample Application");

    // Describe the expected command-line arguments
    arg_desc->AddDefaultKey("S", "server",
                            "Name of the SQL server to connect to",
                            CArgDescriptions::eString,
                            m_DefaultServerName);

    arg_desc->AddDefaultKey("U", "username",
                            "User name",
                            CArgDescriptions::eString,
                            "DBAPI_test");

    arg_desc->AddDefaultKey("P", "password",
                            "Password",
                            CArgDescriptions::eString,
                            "allowed");

    arg_desc->AddDefaultKey("v", "version",
                            "TDS protocol version",
                            CArgDescriptions::eInteger,
                            NStr::IntToString(m_DefaultTDSVersion));

    // Setup arg.descriptions for this application
    SetupArgDescriptions(arg_desc.release());
}
コード例 #3
0
ファイル: mysql_lang.cpp プロジェクト: svn2github/ncbi_tk
void
CDemoApp::Init()
{
    // Create command-line argument descriptions class
    unique_ptr<CArgDescriptions> arg_desc(new CArgDescriptions);

    // Specify USAGE context
    arg_desc->SetUsageContext(GetArguments().GetProgramBasename(),
                              "MySQL Sample Application");

    // Describe the expected command-line arguments
    arg_desc->AddKey("S", "server",
                            "Name of the SQL server to connect to",
                            CArgDescriptions::eString);

    arg_desc->AddDefaultKey("U", "username",
                            "User name",
                            CArgDescriptions::eString,
                            "anyone");

    arg_desc->AddDefaultKey("P", "password",
                            "Password",
                            CArgDescriptions::eString,
                            "allowed");

    arg_desc->AddKey("D", "database",
                            "Name of a database",
                            CArgDescriptions::eString);

    // Setup arg.descriptions for this application
    SetupArgDescriptions(arg_desc.release());
}
コード例 #4
0
ファイル: test_nsstorage.cpp プロジェクト: DmitrySigaev/ncbi
void CTestNSStorage::Init(void)
{
    // 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 storage");

    arg_desc->AddPositional("service",
                            "NetCache service name.", CArgDescriptions::eString);

    arg_desc->AddOptionalKey("protocol",
                             "protocol",
                             "NetCache client protocl",
                             CArgDescriptions::eString);
    arg_desc->SetConstraint("protocol",
                            &(*new CArgAllow_Strings(NStr::eNocase),
                              "simple", "persistent")
                            );

    // Setup arg.descriptions for this application
    SetupArgDescriptions(arg_desc.release());

//    CONNECT_Init(&GetConfig());

//    SetDiagPostLevel(eDiag_Info);
//    SetDiagTrace(eDT_Enable);
}
コード例 #5
0
void CLocalFinderApp::Init(void)
{
    // Prepare command line descriptions
    auto_ptr<CArgDescriptions> arg_desc(new CArgDescriptions);

    arg_desc->AddKey("input", "FastaFile",
                     "File containing FASTA-format sequence",
                     CArgDescriptions::eInputFile);

    arg_desc->AddDefaultKey("from", "From",
                            "From",
                            CArgDescriptions::eInteger,
                            "0");

    arg_desc->AddDefaultKey("to", "To",
                            "To",
                            CArgDescriptions::eInteger,
                            "1000000000");

    arg_desc->AddKey("model", "ModelData",
                     "Model Data",
                     CArgDescriptions::eInputFile);

    arg_desc->AddOptionalKey("align", "Alignments",
                            "Alignments",
                            CArgDescriptions::eInputFile);

    arg_desc->AddFlag("rep", "Repeats");


    // Pass argument descriptions to the application
    //

    SetupArgDescriptions(arg_desc.release());
}
コード例 #6
0
void CTest::Init(void)
{
    const size_t kUsageWidth = 90;

    SetDiagPostLevel(eDiag_Error);
    // To see all output, uncomment next line:
    //SetDiagPostLevel(eDiag_Trace);
    DisableArgDescriptions(fDisableStdArgs);
    
    // Create command-line arguments
    unique_ptr<CCommandArgDescriptions> cmd(new 
        CCommandArgDescriptions(true, 0, CCommandArgDescriptions::eCommandMandatory | 
                                         CCommandArgDescriptions::eNoSortCommands));
    cmd->SetUsageContext(GetArguments().GetProgramBasename(),
        "Test compression library (CArchive class)");
    // test
    {{
        unique_ptr<CArgDescriptions> arg(new CArgDescriptions(false));
        arg->SetUsageContext(kEmptyStr, "Run standard internal test.", false, kUsageWidth);
        arg->AddDefaultPositional("fmt", "Compression format to test", CArgDescriptions::eString, "all");
        arg->SetConstraint("fmt", &(*new CArgAllow_Strings, "all", "zip"));
        cmd->AddCommand("test", arg.release());
    }}
    SetupArgDescriptions(cmd.release());

    // Set base directory for file tests
    m_TestDir = CDir::GetCwd();
}
コード例 #7
0
ファイル: test_ncbidll.cpp プロジェクト: svn2github/ncbi_tk
void CTest::Init(void)
{
    SetDiagPostLevel(eDiag_Warning);
    unique_ptr<CArgDescriptions> d(new CArgDescriptions);
    d->SetUsageContext("test_dll", "DLL accessory class");
    SetupArgDescriptions(d.release());
}
コード例 #8
0
ファイル: omssamerge.cpp プロジェクト: jackgopack4/pico-blast
void COMSSAMerge::Init()
{

    auto_ptr<CArgDescriptions> argDesc(new CArgDescriptions);

    argDesc->AddDefaultKey("i", "infiles", 
                "file containing list of input files on separate lines",
                CArgDescriptions::eString,
                "");

    argDesc->AddFlag("sw", "output search results without spectra");

    argDesc->AddFlag("it", "input as text asn.1 formatted search results");
    argDesc->AddFlag("ib", "input as binary asn.1 formatted search results");
    argDesc->AddFlag("ix", "input as xml formatted search results");
    argDesc->AddFlag("ibz2", "input as xml formatted search results compressed by bzip2");

    argDesc->AddPositional("o", "output file name", CArgDescriptions::eString);


    argDesc->AddFlag("ot", "output as text asn.1 formatted search results");
    argDesc->AddFlag("ob", "output as binary asn.1 formatted search results");
    argDesc->AddFlag("ox", "output as xml formatted search results");
    argDesc->AddFlag("obz2", "output as xml formatted search results compressed by bzip2");

    argDesc->AddExtra(0,10000, "input file names", CArgDescriptions::eString);


    SetupArgDescriptions(argDesc.release());

    // allow info posts to be seen
    SetDiagPostLevel(eDiag_Info);
}
コード例 #9
0
void CThreadedServerApp::Init(void)
{
    CORE_SetLOG(LOG_cxx2c());
    CORE_SetLOCK(MT_LOCK_cxx2c());

    auto_ptr<CArgDescriptions> arg_desc(new CArgDescriptions);
    arg_desc->SetUsageContext(GetArguments().GetProgramBasename(),
                             "sample server using thread pools");

    arg_desc->AddKey("port", "N", "TCP port number on which to listen",
                     CArgDescriptions::eInteger);
    arg_desc->SetConstraint("port", new CArgAllow_Integers(0, 0xFFFF));

    arg_desc->AddDefaultKey("threads", "N", "Number of initial threads",
                            CArgDescriptions::eInteger, "5");
    
    arg_desc->AddDefaultKey("maxThreads", "N",
                            "Maximum number of simultaneous threads",
                            CArgDescriptions::eInteger, "10");
    
    arg_desc->AddDefaultKey("queue", "N", "Maximum size of request queue",
                            CArgDescriptions::eInteger, "20");

    {{
        CArgAllow* constraint = new CArgAllow_Integers(1, 999);
        arg_desc->SetConstraint("threads",    constraint);
        arg_desc->SetConstraint("maxThreads", constraint);
        arg_desc->SetConstraint("queue",      constraint);        
    }}

    SetupArgDescriptions(arg_desc.release());
}
コード例 #10
0
void CBDB_TestThreads::Init(void)
{
    SetDiagTrace(eDT_Enable);

    SetDiagPostLevel(eDiag_Warning);
    SetDiagPostFlag(eDPF_File);
    SetDiagPostFlag(eDPF_Line);
    SetDiagPostFlag(eDPF_Trace);


    auto_ptr<CArgDescriptions> arg_desc(new CArgDescriptions);
    arg_desc->SetUsageContext("test_bdb_threads",
                              "test BDB library with threads");

    arg_desc->AddOptionalKey("recs",
                             "recs",
                             "Number of records to load per thread",
                             CArgDescriptions::eInteger);

    arg_desc->AddOptionalKey("threads",
                             "threads",
                             "Number of concurrent threads",
                             CArgDescriptions::eInteger);

    SetupArgDescriptions(arg_desc.release());
}
コード例 #11
0
ファイル: asn2fasta.cpp プロジェクト: jackgopack4/pico-blast
//  --------------------------------------------------------------------------
void CAsn2FastaApp::Init(void)
//  --------------------------------------------------------------------------
{
    auto_ptr<CArgDescriptions> arg_desc(new CArgDescriptions);
    arg_desc->SetUsageContext(
        GetArguments().GetProgramBasename(),
        "Convert an ASN.1 Seq-entry into a FASTA report",
        false);

    // input
    {{
        // name
        arg_desc->AddOptionalKey("i", "InputFile",
            "Input file name", CArgDescriptions::eInputFile);

        // input file serial format (AsnText\AsnBinary\XML, default: AsnText)
        arg_desc->AddOptionalKey("serial", "SerialFormat", "Input file format",
            CArgDescriptions::eString);
        arg_desc->SetConstraint("serial", &(*new CArgAllow_Strings,
            "text", "binary", "XML"));
        // id
        arg_desc->AddOptionalKey("id", "ID",
            "Specific ID to display", CArgDescriptions::eString);

        // input type:
        arg_desc->AddDefaultKey( "type", "AsnType", "ASN.1 object type",
            CArgDescriptions::eString, "any" );
        arg_desc->SetConstraint( "type",
            &( *new CArgAllow_Strings, "any", "seq-entry", "bioseq", "bioseq-set" ) );

        // filtering options:
        arg_desc->AddFlag("nucs-only", "Only emit nucleotide sequences");
        arg_desc->AddFlag("prots-only", "Only emit protein sequences");
    }}


    // batch processing
    {{
        arg_desc->AddFlag("batch", "Process NCBI release file");
        // compression
        arg_desc->AddFlag("c", "Compressed file");
        // propogate top descriptors
        arg_desc->AddFlag("p", "Propogate top descriptors");

        arg_desc->AddFlag("defline-only",
                          "Only output the defline");
    }}

    // output
    {{
        arg_desc->AddFlag("show-mods", "Show FASTA header mods (e.g. [strain=abc])");

        // name
        arg_desc->AddOptionalKey("o", "OutputFile",
            "Output file name", CArgDescriptions::eOutputFile);
    }}

    SetupArgDescriptions(arg_desc.release());
}
コード例 #12
0
void CTestTransmission::Init(void)
{
    SetDiagPostLevel(eDiag_Warning);
    unique_ptr<CArgDescriptions> d(new CArgDescriptions);
    d->SetUsageContext("test_transmissionrw",
                       "test transmission reader/writer");
    SetupArgDescriptions(d.release());
}
コード例 #13
0
void CDBAPI_CacheTest::Init(void)
{
    SetDiagPostLevel(eDiag_Warning);
    SetDiagPostFlag(eDPF_File);
    SetDiagPostFlag(eDPF_Line);
    auto_ptr<CArgDescriptions> d(new CArgDescriptions);
    d->SetUsageContext("test_bdb", "test BDB library");
    SetupArgDescriptions(d.release());
}
コード例 #14
0
void CTestTable::Init(void)
{
    SetDiagPostLevel(eDiag_Warning);
    auto_ptr<CArgDescriptions> d(new CArgDescriptions);

    d->SetUsageContext("test_table",
                       "test NCBI table");
    SetupArgDescriptions(d.release());
}
コード例 #15
0
void CBDBEnvKeeperApp::Init(void)
{
    auto_ptr<CArgDescriptions> arg_desc(new CArgDescriptions);

    arg_desc->SetUsageContext(GetArguments().GetProgramBasename(),
        "BDB Environment Keeper");

    SetupArgDescriptions(arg_desc.release());
}
コード例 #16
0
ファイル: test_id_mux.cpp プロジェクト: svn2github/ncbi_tk
void CTestIdMux::Init(void)
{
    SetDiagPostLevel(eDiag_Warning);

    unique_ptr<CArgDescriptions> d(new CArgDescriptions);

    d->SetUsageContext("test_id_mux",
                       "test id mux-demux");
    SetupArgDescriptions(d.release());
}
コード例 #17
0
ファイル: demo1.cpp プロジェクト: DmitrySigaev/ncbi
void CBDB_PhoneBookDemo1::Init(void)
{
    SetDiagPostLevel(eDiag_Warning);
    SetDiagPostFlag(eDPF_File);
    SetDiagPostFlag(eDPF_Line);
    auto_ptr<CArgDescriptions> d(new CArgDescriptions);
    d->SetUsageContext("bdb demo1",
                       "Demo1 application for BDB library");
    SetupArgDescriptions(d.release());
}
コード例 #18
0
ファイル: win_mask_app.cpp プロジェクト: DmitrySigaev/ncbi
//-------------------------------------------------------------------------
void CWinMaskApplication::Init(void)
{
    HideStdArgs(fHideLogfile | fHideConffile | fHideVersion | fHideDryRun);
    auto_ptr< CArgDescriptions > arg_desc( new CArgDescriptions );

    // Set the program description
    arg_desc->SetUsageContext( GetArguments().GetProgramBasename(),
                               USAGE_LINE );

    CWinMaskConfig::AddWinMaskArgs(*arg_desc);

    // Parse the arguments according to descriptions.
    SetupArgDescriptions(arg_desc.release());
}
コード例 #19
0
void CTestRangeMap::Init(void)
{
    SetDiagPostLevel(eDiag_Warning);

    auto_ptr<CArgDescriptions> d(new CArgDescriptions);

    d->SetUsageContext("testrangemap",
                       "test different interval search classes");

    d->AddDefaultKey("t", "type",
                     "type of container to use",
                     CArgDescriptions::eString, "CIntervalTree");
    d->SetConstraint("t", (new CArgAllow_Strings)->
                     Allow("CIntervalTree")->Allow("i")->
                     Allow("CRangeMap")->Allow("r"));

    d->AddDefaultKey("c", "count",
                     "how may times to run whole test",
                     CArgDescriptions::eInteger, "1");

    d->AddFlag("s",
               "silent operation - do not print log");
    d->AddFlag("ps",
               "print total number of intervals");
    d->AddFlag("psn",
               "print total number of scanned intervals");

    d->AddDefaultKey("n", "rangeNumber",
                     "number of intervals to use",
                     CArgDescriptions::eInteger, "10000");
    d->AddDefaultKey("l", "length",
                     "length of whole region",
                     CArgDescriptions::eInteger, "1000");
    d->AddDefaultKey("il", "intervalLength",
                     "max length of intervals to use",
                     CArgDescriptions::eInteger, "20")
;
    d->AddDefaultKey("ss", "scanStep",
                     "step of scan intervals",
                     CArgDescriptions::eInteger, "10");
    d->AddDefaultKey("sl", "scanLength",
                     "length of scan intervals",
                     CArgDescriptions::eInteger, "20");
    d->AddDefaultKey("sc", "scanCount",
                     "how may times to run scan test",
                     CArgDescriptions::eInteger, "1");

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

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

    arg_desc->AddKey
        ("program", "ProgramName",
         "One of blastn, megablast, disc_megablast, blastp, blastx, tblastn, tblastx, rpsblast",
         CArgDescriptions::eString);

    arg_desc->SetConstraint
        ("program", &(*new CArgAllow_Strings,
                "blastn", "megablast", "disc_megablast", "blastp", "blastx", "tblastn", "tblastx", "rpsblast"));

    arg_desc->AddDefaultKey
        ("db", "DataBase",
         "This is the name of the database",
         CArgDescriptions::eString, "nr");

    arg_desc->AddDefaultKey("in", "Queryfile",
                        "A FASTA file with the query", CArgDescriptions::eInputFile, "stdin");

    arg_desc->AddDefaultKey("parse", "parse", "Parse FASTA defline",
                            CArgDescriptions::eBoolean, "f");

    arg_desc->AddDefaultKey("out", "Outputfile",
                        "The output file", CArgDescriptions::eOutputFile, "stdout");

    arg_desc->AddDefaultKey("evalue", "evalue",
                        "E-value threshold for saving hits", CArgDescriptions::eDouble, "0");

    arg_desc->AddDefaultKey("penalty", "penalty", "Penalty score for a mismatch",
                            CArgDescriptions::eInteger, "0");

    arg_desc->AddDefaultKey("reward", "reward", "Reward score for a match",
                            CArgDescriptions::eInteger, "0");

    arg_desc->AddDefaultKey("matrix", "matrix", "Scoring matrix name",
                            CArgDescriptions::eString, "BLOSUM62");

    arg_desc->AddDefaultKey("hitsize", "hitsize", "Hitlist size",
                            CArgDescriptions::eInteger, "100");

    // Setup arg.descriptions for this application
    SetupArgDescriptions(arg_desc.release());
}
コード例 #21
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());
}
コード例 #22
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());
}
コード例 #23
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());
}
コード例 #24
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=");
}
コード例 #25
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());
}
コード例 #26
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);
}
コード例 #27
0
void CTestApp::Init(void)
{
    SetDiagPostLevel(eDiag_Warning);
    SetDiagPostFlag(eDPF_All);
    
    auto_ptr<CArgDescriptions> d(new CArgDescriptions);
    d->SetUsageContext("test_strdbl",
                       "test string <-> double conversion");
    d->AddFlag("speed",
               "Run conversion speed benchmark");
    d->AddOptionalKey("precision", "precision",
                      "Run conversion precision benchmark",
                      CArgDescriptions::eString);
    d->SetConstraint("precision",
                     &(*new CArgAllow_Strings,
                       "Posix", "PosixOld", "strtod"));
    d->AddDefaultKey("count", "count",
                     "Number of test iterations to run",
                     CArgDescriptions::eInteger, "1000000");
    d->AddOptionalKey("test_strings", "test_strings",
                      "List of test strings to run",
                      CArgDescriptions::eString);
    d->AddDefaultKey("verbose", "verbose",
                     "Verbose level",
                     CArgDescriptions::eInteger, "0");
    d->AddDefaultKey("threshold", "threshold",
                     "Close match threshold",
                     CArgDescriptions::eDouble, "0.01");

    d->AddFlag("randomize",
               "Randomize test data (for precision and double-to-string tests)");
    d->AddOptionalKey("seed", "Randomization",
                             "Randomization seed value",
                             CArgDescriptions::eInt8);
    d->AddDefaultKey("digits", "significantDigits",
                     "The number of significant digits in double-to-string conversion",
                     CArgDescriptions::eInteger, NStr::NumericToString(DBL_DIG));
    d->SetConstraint("digits", new CArgAllow_Integers(1, DBL_DIG));

    d->AddDefaultKey("mode", "testmode",
                     "Test string-to-doube, or double-to-string",
                     CArgDescriptions::eString, "both");
    d->SetConstraint( "mode", &(*new CArgAllow_Strings,
            "str2dbl", "dbl2str", "both"));

    SetupArgDescriptions(d.release());
}
コード例 #28
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());
}
コード例 #29
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());
}
コード例 #30
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());
}