void MainWindow::OpenImage(const QString &fileName)
{
	QScrollArea* area = new QScrollArea();
	ImageWidget* img = new ImageWidget();

	// Nur les- und schreibbare Bildformate werden unterstützt
	if (img->OpenImage(fileName)) {
		QString shortFileName = ParseFileName(fileName);
		shortFileName = shortFileName.mid(0, shortFileName.lastIndexOf('.'));

		// Bild in die ScrollArea laden
		area->setWidget(img);
		area->setStyleSheet("background: qlineargradient(x1: 0, y0: 1, x2:1, y2: 0, stop: 0.96 #383838, stop: 0.99 #2e2e2e);");

		// neuen Tab hinzufügen
		int index = ui->imagetab->addTab(area, shortFileName);
		ui->imagetab->setTabToolTip(index, shortFileName);
		ui->imagetab->setCurrentIndex(index);

		// schließlich Signalhandler setzen
		connect(this, SIGNAL(Arguments(QHash<QString,QString>)), img, SLOT(Arguments(QHash<QString,QString>)));
		connect(this, SIGNAL(Operation(IOperation*,QHash<QString,QString>)), img, SLOT(Operation(IOperation*,QHash<QString,QString>)));
		connect(this, SIGNAL(Operation(IOperation*,QHash<QString,QString>,OperationType)), img, SLOT(Operation(IOperation*,QHash<QString,QString>,OperationType)));
		emit Operation(mOperation, GetArgs());
	}
Beispiel #2
0
/* 
   Extract the exit code out of a PP_FINISH packet (used in SysMan)
*/
int
getExitCode(int nbytes, GlobalTaskId *sender_idp) {
  int exitCode=0;

  if (nbytes==4) {               // Notification from a task doing pvm_exit
    GetArgs(sender_idp,1);       // Presumably this must be MainPE Id
    exitCode = -1;
  } else if (nbytes==8) {        // Doing a controlled shutdown
    GetArgs(&exitCode,1);        // HACK: controlled shutdown == 2 values
    GetArgs(&exitCode,1);
  } else {
    exitCode = -2;               // everything else
  }
  return exitCode;
}
Beispiel #3
0
bool CTestCacheApp::TestApp_Init(void)
{
    NcbiCout << NcbiEndl
             << "Testing cache with "
             << NStr::IntToString(s_NumThreads)
             << " threads..."
             << NcbiEndl;

    const CArgs& args = GetArgs();
    m_CacheSize = args["cache_size"].AsInt8();
    m_ElementDataSize = args["element_size"].AsInt8();
    if (args["size_type"].AsString() == "ubyte") {
        m_UCharCache.reset(new TUCharCache((unsigned char)(m_CacheSize)));
    }
    else if (args["size_type"].AsString() == "uint") {
        m_UIntCache.reset(new TUIntCache((unsigned int)(m_CacheSize)));
    }
    else if (args["size_type"].AsString() == "uint8") {
        m_UInt8Cache.reset(new TUInt8Cache(m_CacheSize));
    }
    else if (args["size_type"].AsString() == "byte") {
        m_IntCache.reset(new TIntCache((signed char)(m_CacheSize)));
    }
    return true;
}
Beispiel #4
0
void
CSeqDBPerfApp::x_InitApplicationData()
{
    CStopWatch sw;
    sw.Start();
    const CArgs& args = GetArgs();
    const CSeqDB::ESeqType kSeqType = ParseMoleculeTypeString(args["dbtype"].AsString());
    const string& kDbName(args["db"].AsString());
    m_BlastDb.Reset(new CSeqDBExpert(kDbName, kSeqType));
    m_DbIsProtein = static_cast<bool>(m_BlastDb->GetSequenceType() == CSeqDB::eProtein);

    int kNumThreads = 1;
#if (defined(_OPENMP) && defined(NCBI_THREADS))
    kNumThreads = args["num_threads"].AsInteger();
#endif
    m_DbHandles.reserve(kNumThreads);
    m_DbHandles.push_back(m_BlastDb);
    if (kNumThreads > 1) {
        for (int i = 1; i < kNumThreads; i++) {
            m_BlastDb.Reset(new CSeqDBExpert(kDbName, kSeqType));
            m_DbHandles.push_back(m_BlastDb);
        }
    }
    m_MemoryUsage.assign(kNumThreads, SMemUsage());

    sw.Stop();
    cout << "Initialization time: " << sw.AsSmartString() << endl;
}
Beispiel #5
0
bool CGridCgiSampleApplication::CollectParams(CGridCgiContext&)
{
    // You can catch CArgException& here to process argument errors,
    // or you can handle it in OnException()
    const CArgs& args = GetArgs();

    // "args" now contains both command line arguments and the arguments 
    // extracted from the HTTP request

    if ( args["message"] ) {
        // get the first "message" argument only...
        const string& m = args["message"].AsString();
        vector<string> sdoubles;
        NStr::Tokenize(m, " ", sdoubles);
        for (size_t i = 0; i < sdoubles.size(); ++i) {
            try {
                double d = NStr::StringToDouble(sdoubles[i],
                                                NStr::fAllowTrailingSymbols);
                m_Doubles.push_back(d);
            }
            catch(...) {}
        }
    } else {
        // no "message" argument is present
    }
    return m_Doubles.size() > 1;
}
Beispiel #6
0
int CTestDateApp::Run(void)
{
    const CArgs& args = GetArgs();
    CDate      date;
    CDate_std& std  = date.SetStd();
    std.SetYear(args["Y"].AsInteger());
    if (args["M"]) {
        std.SetMonth(args["M"].AsInteger());
    }
    if (args["D"]) {
        std.SetDay(args["D"].AsInteger());
    }
    if (args["S"]) {
        std.SetSeason(args["S"].AsString());
    }
    // ...

    string s;
    date.GetDate(&s);
    NcbiCout << '\"' << s << '\"' << NcbiEndl;
    s.erase();
    date.GetDate(&s, args["f"].AsString());
    NcbiCout << '\"' << s << '\"' << NcbiEndl;
    s.erase();
    date.GetDate(&s, "%Y-%M-%D");
    NcbiCout << '\"' << s << '\"' << NcbiEndl;

    return 0;
}
void SubExpressionTap::Optimize(Block *block){
	blocks.push(block);
	SubExpressionBlock *exprList = block->GetExprBlock();
	const int size = block->body.size();
	for(int i = 0; i < size; i++){
		Node *expr = block->body[i + temp_counter];
		if(expr->isCycle())
			continue;
		if(Block* b = dynamic_cast<Block*>(expr)){
			Optimize(b);
			continue;
		}
		if(FuncCallNode *cNode = dynamic_cast<FuncCallNode*>(expr)){
			for(Node *arg : cNode->args)
				GetArgs(*exprList, arg);
			continue;			
		}
		if(IfStatement *$if = dynamic_cast<IfStatement*>(expr)){
			Optimize(dynamic_cast<Block*>($if->if_branch));
			if($if->else_branch)
				Optimize(dynamic_cast<Block*>($if->else_branch));
			continue;
		}
		if(ReturnStatement *retNode = dynamic_cast<ReturnStatement*>(expr))
			expr = retNode->value;
		if(!expr->isExpression())
			continue;
		Node *t = OptimizeExpression(expr);
		if(t != expr){
			block->body[i + temp_counter] = t;		
		}
	}
	ReplaceFirstOccur();
	blocks.pop();
}
Beispiel #8
0
Int2 Main (void)

{
    Char buf[256] = { '\0' };  /* Used below for name and version. */
    Int2 status = 0;    /* return value of function. */

    StringCpy(buf, "bl2seq ");
    StringNCat(buf, BlastGetVersionNumber(), sizeof(buf)-StringLen(buf)-1);
    if (! GetArgs (buf, NUMARG, myargs)) {
        return (1);
    }

    UseLocalAsnloadDataAndErrMsg ();

    if (! SeqEntryLoad())
                return 1;

    ErrSetMessageLevel(SEV_WARNING);

    if (myargs[ARG_FORCE_OLD].intvalue != 0)
        status = Main_old();
    else
        status = Main_new();

    FreeArgs(NUMARG, myargs);

    return status;
}
Beispiel #9
0
Int2 Nlm_Main(void) {
    Boolean use_new_engine=FALSE;
    char buf[256] = { '\0' };

    StringCpy(buf, "mgblast ");
    StringNCat(buf, BlastGetVersionNumber(), sizeof(buf)-StringLen(buf)-1);
    if (! GetArgs (buf, NUMARG, myargs))
       return (1);

    UseLocalAsnloadDataAndErrMsg ();

    if (! SeqEntryLoad())
        return 1;

    ErrSetMessageLevel(SEV_WARNING);
    /*
    if (myargs[ARG_FORCE_OLD].intvalue == 0 &&
                  myargs[ARG_OUTTYPE].intvalue > 1 &&
                      myargs[ARG_GILIST].strvalue == NULL)
          use_new_engine = readdb_use_new_blast(myargs[ARG_DB].strvalue);
    if (myargs[ARG_MASKEDQUERY].strvalue)
        use_new_engine = FALSE;
    */
    
    /*if (use_new_engine)
        return Main_new();
    else */
        return Main_old();
}
Beispiel #10
0
void dlgFunction::OnChangeArg(wxCommandEvent &ev)
{
	if (GetSelectedDirection() == wxT("VARIADIC") &&
	        !cbDatatype->GetValue().EndsWith(wxT("[]")))
	{
		wxLogError(_("Only array types can be VARIADIC."));
		return;
	}

	int row = lstArguments->GetSelection();

	if (row >= 0)
	{
		lstArguments->SetItem(row, 0, cbDatatype->GetValue());
		lstArguments->SetItem(row, 1, GetSelectedDirection());
		lstArguments->SetItem(row, 2, txtArgName->GetValue());
		if (isBackendMinVer84)
			lstArguments->SetItem(row, 3, txtArgDefVal->GetValue());

		if (!function)
			argOids.Item(row) = typOids.Item(cbDatatype->GetGuessedSelection());
		txtArguments->SetValue(GetArgs());
	}
	OnChangeArgName(ev);
	CheckChange();
}
void CTest::RunInternalTest(void)
{
    const CArgs& args = GetArgs();
    string test = args["fmt"].AsString();

    // Set a random starting point
    unsigned int seed = (unsigned int)time(0);
    //LOG_POST("Random seed = " << seed);
    srand(seed);

    // Preparing test data
    m_BufLen = 10*100*1024;  // 10MB
    AutoArray<char> src_buf_arr(m_BufLen);
    m_Buf = src_buf_arr.get();
    assert(m_Buf);
    for (size_t i=0; i<m_BufLen; i++) {
        m_Buf[i] = (char)(rand() % 255);
    }
    // Prepare source tree
    CreateSourceTree();

    // Run tests
    if (test == "all"  ||  test == "zip") {
        _TRACE("-------------- Zip ---------------\n");
        RunInternalTestFormat(CArchive::eZip);
    }

    // Cleanup
    CDir(GetDir("test_archive_in")).Remove();
    CDir(GetDir("test_archive_out")).Remove();

}
Beispiel #12
0
int CTestRangeMap::Run(void)
{
    const CArgs& args = GetArgs();

    m_Count = args["c"].AsInteger();
    m_Silent = args["s"];
    m_PrintSize = args["ps"];
    m_PrintTotalScannedNumber = args["psn"];
    m_RangeNumber = args["n"].AsInteger();
    m_Length = args["l"].AsInteger();
    m_RangeLength = args["il"].AsInteger();
    m_ScanCount = args["sc"].AsInteger();
    m_ScanStep = args["ss"].AsInteger();
    m_ScanLength = args["sl"].AsInteger();
    
    bool intervalTree =
        args["t"].AsString() == "CIntervalTree" ||
        args["t"].AsString() == "i";

    for ( int count = 0; count < m_Count; ++count ) {
        if ( intervalTree )
            TestIntervalTree();
        else
            TestRangeMap();
    }

    return 0;
}
Beispiel #13
0
int CBAMTestApp::Run(void)
{
#ifdef CALL
    return LowLevelTest();
#endif

    // Get arguments
    const CArgs& args = GetArgs();

    string path;

    vector<string> dirs;
    if ( args["dir"] ) {
        dirs.push_back(args["dir"].AsString());
    }
    else {
        vector<string> reps;
        reps.push_back(string(NCBI_GetTestDataPath())+"/traces02");
        reps.push_back(string(NCBI_GetTestDataPath())+"/traces04");
        ITERATE ( vector<string>, it, reps ) {
            dirs.push_back(CFile::MakePath(*it, BAM_DIR1));
            dirs.push_back(CFile::MakePath(*it, BAM_DIR2));
            dirs.push_back(CFile::MakePath(*it, BAM_DIR3));
            dirs.push_back(CFile::MakePath(*it, BAM_DIR4));
            dirs.push_back(CFile::MakePath(*it, BAM_DIR5));
        }
    }
Beispiel #14
0
int CServerTestApp::Run(void)
{
    SetDiagPostLevel(eDiag_Info);
    SetDiagPostAllFlags(eDPF_Severity | eDPF_OmitInfoSev | eDPF_ErrorID);

#if defined(NCBI_OS_MSWIN)  ||  defined(NCBI_OS_CYGWIN)
    CRequestRateControl rate_control(6);
#else
    CRequestRateControl rate_control(CRequestRateControl::kNoLimit);
#endif
    CFastMutex rate_mutex;

    const CArgs& args = GetArgs();

    unsigned short port = 4096;

    {
        CListeningSocket listener;

        while (++port & 0xFFFF) {
            if (listener.Listen(port, 5, fSOCK_BindAny | fSOCK_LogOff)
                == eIO_Success)
                break;
        }
        if (port == 0) {
            ERR_POST("CServer test: unable to find a free port to listen on");
            return 2;
        }
    }

    SServer_Parameters params;
    params.init_threads = args["srvthreads"].AsInteger();
    params.max_threads = args["maxsrvthreads"].AsInteger();
    params.accept_timeout = &kAcceptTimeout;

    int max_number_of_clients = args["requests"].AsInteger();

    CTestServer server(max_number_of_clients, args["maxdelay"].AsInteger());
    server.SetParameters(params);

    server.AddListener(new CTestConnectionFactory(&server), port);
    server.StartListening();

    CStdPoolOfThreads pool(args["maxclthreads"].AsInteger(),
                           max_number_of_clients);

    pool.Spawn(args["clthreads"].AsInteger());

    for (int i = max_number_of_clients;  i > 0;  i--) {
        pool.AcceptRequest(CRef<ncbi::CStdRequest>
            (new CConnectionRequest(port, rate_control, rate_mutex)));
    }

    server.Run();

    pool.KillAllThreads(true);

    return 0;
}
Beispiel #15
0
int CTestApplication::Run(void)
{
    //export CONN_DEBUG_PRINTOUT=data
    //CORE_SetLOG(LOG_cxx2c());
    //SetDiagTrace(eDT_Enable);
    //SetDiagPostLevel(eDiag_Info);
    //SetDiagPostFlag(eDPF_All);

    //test_id1_calls();

    const CArgs& args = GetArgs();
    int count = args["count"].AsInteger();
    Int8 gi_from = args["gi_from"].AsInt8();
    Int8 gi_to = args["gi_to"].AsInt8();

    CRef<CObjectManager> om = CObjectManager::GetInstance();
    for ( int i = 0; i < 100; ++i ) {
        CGBDataLoader::RegisterInObjectManager(*om, new CId1Reader);
    }
    for ( int pass = 0; pass < count; ++pass ) {
        CRef<CReadDispatcher> dispatcher(new CReadDispatcher);
        CRef<CReader> reader(new CId1Reader);
        dispatcher->InsertReader(0, reader);
        for ( Int8 gi = gi_from; gi <= gi_to; gi++ ) {
            NcbiCout << "gi: " << gi << ": " << NcbiEndl;
            CSeq_id_Handle seq_id = CSeq_id_Handle::GetGiHandle(gi);
            CStandaloneRequestResult request(seq_id);
            dispatcher->LoadSeq_idSeq_ids(request, seq_id);
            CLoadLockSeqIds seq_ids(request, seq_id);
            NcbiCout << "  ids:";
            CFixedSeq_ids ids2 = seq_ids.GetSeq_ids();
            ITERATE ( CFixedSeq_ids, i, ids2 ) {
                NcbiCout << " " << i->AsString();
            }
            NcbiCout << NcbiEndl;
            
            CLoadLockBlobIds blob_ids(request, seq_id, 0);
            dispatcher->LoadSeq_idBlob_ids(request, seq_id, 0);
            CFixedBlob_ids ids = blob_ids.GetBlob_ids();
            ITERATE ( CFixedBlob_ids, i, ids ) {
                const CBlob_Info& blob_info = *i;
                CConstRef<CBlob_id> blob_id = blob_info.GetBlob_id();
                NcbiCout << "  " << blob_id->ToString() << NcbiEndl;

                if ( !blob_id->IsMainBlob() ) {
                    continue;
                }
                CLoadLockBlob blob(request, *blob_id);
                dispatcher->LoadBlob(request, *blob_id);
                if ( !blob.IsLoadedBlob() ) {
                    NcbiCout << "blob is not available" << NcbiEndl;
                    continue;
                }
                NcbiCout << "    loaded" << NcbiEndl;
            }
        }
    }
    return 0;
}
Beispiel #16
0
int main(int Argc, char ** Argv)

{  

   GetArgs(Argc,Argv);
   ProcessData();
   PrintResults();
}
Beispiel #17
0
bool CGridCgiSampleApplication::JobStopRequested(void) const
{
    const CArgs& args = GetArgs();

    // Check if job cancellation has been requested.
    if ( args["Cancel"] )
        return true;
    return false;
}
Beispiel #18
0
void dlgFunction::OnRemoveArg(wxCommandEvent &ev)
{
	unsigned int sel = lstArguments->GetSelection();
	argOids.RemoveAt(sel);
	lstArguments->DeleteItem(sel);
	btnRemove->Disable();
	txtArguments->SetValue(GetArgs());
	OnChangeArgName(ev);
}
Beispiel #19
0
TStrV TEnv::GetIfArgPrefixStrV(
    const TStr& PrefixStr, TStrV& DfValV, const TStr& DNm) const {
    TStrV ArgValV;
    if (Env.GetArgs()<=MnArgs) {
        // 'usage' argument message
        if (!SilentP) {
            printf("   %s%s (default:", PrefixStr.CStr(), DNm.CStr());
            for (int DfValN=0; DfValN<DfValV.Len(); DfValN++) {
                if (DfValN>0) {
                    printf(", ");
                }
                printf("'%s'", DfValV[DfValN].CStr());
            }
            printf(")\n");
        }
        return ArgValV;
    } else {
        // argument & value message
        TStr ArgValVChA;
        for (int ArgN=0; ArgN<GetArgs(); ArgN++) {
            // get argument string
            TStr ArgStr=GetArg(ArgN);
            if (ArgStr.StartsWith(PrefixStr)) {
                // extract & add argument value
                ArgStr.DelStr(PrefixStr);
                ArgValV.Add(ArgStr);
                // add to message string
                if (ArgValV.Len()>1) {
                    ArgValVChA+=", ";
                }
                ArgValVChA+=ArgValV.Last();
            }
        }
        if (ArgValV.Empty()) {
            ArgValV=DfValV;
        }
        // output argument values
        TChA MsgChA;
        MsgChA+="  "+DNm;
        MsgChA+=" (";
        MsgChA+=PrefixStr;
        MsgChA+=")=";
        for (int ArgValN=0; ArgValN<ArgValV.Len(); ArgValN++) {
            if (ArgValN>0) {
                MsgChA+=", ";
            }
            MsgChA+="'";
            MsgChA+=ArgValV[ArgValN];
            MsgChA+="'";
        }
        if (!SilentP) {
            TNotify::OnStatus(Notify, MsgChA);
        }
        return ArgValV;
    }
}
Beispiel #20
0
int TEnv::GetPrefixArgN(const TStr& PrefixStr) const {
    int ArgN=0;
    while (ArgN < GetArgs()) {
        if (GetArg(ArgN).StartsWith(PrefixStr)) {
            return ArgN;
        }
        ArgN++;
    }
    return -1;
}
Beispiel #21
0
TStr TEnv::GetCmLn(const int& FromArgN) const {
    TChA CmLnChA;
    for (int ArgN=FromArgN; ArgN<GetArgs(); ArgN++) {
        if (ArgN>FromArgN) {
            CmLnChA+=' ';
        }
        CmLnChA+=GetArg(ArgN);
    }
    return CmLnChA;
}
Beispiel #22
0
bool TEnv::IsArgStr(const TStr& ArgStr) {
    int ArgN=0;
    while (ArgN<GetArgs()) {
        if (GetArg(ArgN)==ArgStr) {
            return true;
        }
        ArgN++;
    }
    return false;
}
bool SubExpressionTap::GetArgs(SubExpressionBlock &expBlock, Node *node) {
	if(!node)
		return false;
	Values value = node->value();
	if(BinaryOpNode *bNode = dynamic_cast<BinaryOpNode*>(node)){
		if(IdentifierNode *l_id = dynamic_cast<IdentifierNode*>(bNode->left))
				l_id->assignCounter = IsChangedValue(value) ? ++l_id->var->assignCounter : l_id->var->assignCounter;			
		if(IdentifierNode *r_id = dynamic_cast<IdentifierNode*>(bNode->right)){
			r_id->assignCounter = r_id->var->assignCounter;
		}

		if(!((bNode->left->isIdent() || bNode->left->isSimple()) &&	(bNode->right->isIdent() || bNode->right->isSimple()))){
			if(!IsModified(bNode->left) || !IsModified(bNode->right))
				return false;
				
			bool ok1 = GetArgs(expBlock, bNode->left),
				ok2 = GetArgs(expBlock, bNode->right);
			if(!ok1 || !ok2 || !IsModified(node))
				return false;
			expBlock.Add(node);
		} else {
			expBlock.Add(node);
		if(!IsModified(node))
			return false;
		}
	} else
		if(UnaryOpNode *uNode = dynamic_cast<UnaryOpNode*>(node)){
			if(IdentifierNode *id = dynamic_cast<IdentifierNode*>(uNode->operand)){
				if(IsChangedValue(value))
					id->assignCounter = ++id->var->assignCounter;
				else 
					id->assignCounter = id->var->assignCounter;
			}
			if(!(uNode->operand->isSimple() || uNode->operand->isIdent())){
				if(!GetArgs(expBlock, uNode->operand) || !IsModified(node))
					return false;
				expBlock.Add(node);
			}
			else
				expBlock.Add(uNode->value(), uNode->operand);
		}
	return true;
}
Beispiel #24
0
//  --------------------------------------------------------------------------
bool CAsn2FastaApp::HandleSeqEntry(CSeq_entry_Handle& seh)
//  --------------------------------------------------------------------------
{
    CFilteringFastaOstream fasta_os( *m_Os, x_GetFilterIncludes(GetArgs()));
    fasta_os.SetAllFlags(
        CFastaOstream::fNoDupCheck |
        CFastaOstream::fKeepGTSigns |
        CFastaOstream::fNoExpensiveOps);
    if( GetArgs()["show-mods"] ) {
        fasta_os.SetFlag(CFastaOstream::fShowModifiers);
    }
    if (m_DeflineOnly) {
        for (CBioseq_CI bioseq_it(seh);  bioseq_it;  ++bioseq_it) {
            fasta_os.WriteTitle(*bioseq_it);
        }
    } else {
        fasta_os.Write(seh);
    }
    return true;
}
int CTest::Run(void)
{
    string cmd(GetArgs().GetCommand());
    if (cmd == "test") {
        RunInternalTest();
        _TRACE("\nTEST execution completed successfully!\n");
        return 0;
    }
    _TROUBLE;
    return 0;
}
Beispiel #26
0
TStr THtmlLx::GetFullBTagStr() const {
  IAssert(Sym==hsyBTag);
  TChA BTagChA;
  BTagChA+=ChA; BTagChA.Pop();
  for (int ArgN=0; ArgN<GetArgs(); ArgN++){
    BTagChA+=' '; BTagChA+=GetArgNm(ArgN);
    BTagChA+='='; BTagChA+='"'; BTagChA+=GetArgVal(ArgN); BTagChA+='"';
  }
  BTagChA+='>';
  return BTagChA;
}
Beispiel #27
0
int TEnv::GetPrefixArgN(const TStr& PrefixStr) const {
    int ArgN = 0;
    while (ArgN < GetArgs()) {
        if (GetArg(ArgN).GetSubStr(0, PrefixStr.Len() - 1) ==
            PrefixStr) {
            return ArgN;
        }
        ArgN++;
    }
    return -1;
}
	virtual void OnClientLogin() {
		CString sFile = GetArgs();
		CString sBuffer;
		CFile cFile(sFile);
		if (!cFile.Open(O_RDONLY)) {
			m_pClient->PutStatusNotice("Could not open MOTD file");
			return;
		}
		while (cFile.ReadLine(sBuffer))
			m_pClient->PutStatusNotice(sBuffer);
		cFile.Close();
	}
Beispiel #29
0
EXPORT BOOL_T ReadLayers( char * line )
{
	char * name;
	int inx, visible, frozen, color, onMap;
	long rgb;

	/* older files didn't support layers */

	if (paramVersion < 7)
		return TRUE;

	/* set the current layer */

	if ( strncmp( line, "CURRENT", 7 ) == 0 ) {
		curLayer = atoi( line+7 );
		if ( curLayer < 0 )
			curLayer = 0;

		if (layerL)
			wListSetIndex( layerL, curLayer );
		if (setLayerL)
			wListSetIndex( setLayerL, curLayer );
			
		return TRUE;
	}

	/* get the properties for a layer from the file and update the layer accordingly */

	if (!GetArgs( line, "ddddl0000q", &inx, &visible, &frozen, &onMap, &rgb, &name ))
		return FALSE;
	if (paramVersion < 9) {
		if ( rgb >= 0 && (int)rgb < sizeof oldColorMap/sizeof oldColorMap[0] )
			rgb = wRGB( oldColorMap[(int)rgb][0], oldColorMap[(int)rgb][1], oldColorMap[(int)rgb][2] );
		else
			rgb = 0;
	}
	if (inx < 0 || inx >= NUM_LAYERS)
		return FALSE;
	color = wDrawFindColor(rgb);
	SetLayerColor( inx, color );
	strncpy( layers[inx].name, name, sizeof layers[inx].name );
	layers[inx].visible = visible;
	layers[inx].frozen = frozen;
	layers[inx].onMap = onMap;
	layers[inx].color = color;
	if (inx<NUM_BUTTONS) {
		if (strlen(name) > 0) {
			wControlSetBalloonText( (wControl_p)layer_btns[(int)inx], layers[inx].name );
		}
		wButtonSetBusy( layer_btns[(int)inx], visible );
	}
	return TRUE;
}
Beispiel #30
0
int
CSeqDBPerfApp::x_ScanDatabase()
{
    CStopWatch sw;
    sw.Start();
    Uint8 num_letters = m_BlastDb->GetTotalLength();
    const bool kScanUncompressed = GetArgs()["scan_uncompressed"];
    vector<int> oids2iterate;
    for (int oid = 0; m_DbHandles.front()->CheckOrFindOID(oid); oid++) {
        oids2iterate.push_back(oid);
    }
    LOG_POST(Info << "Will go over " << oids2iterate.size() << " sequences");

    #pragma omp parallel default(none) num_threads(m_DbHandles.size()) \
                         shared(oids2iterate) if(m_DbHandles.size() > 1)
    { 
        int thread_id = 0;
#ifdef _OPENMP
        thread_id = omp_get_thread_num();
#endif
        #pragma omp for schedule(static, (oids2iterate.size()/m_DbHandles.size())) nowait
        for (size_t i = 0; i < oids2iterate.size(); i++) {
            int oid = oids2iterate[i];
            const char* buffer = NULL;
            int seqlen = 0;
            if (m_DbIsProtein || kScanUncompressed) {
                int encoding = m_DbIsProtein ? 0 : kSeqDBNuclBlastNA8;
                m_DbHandles[thread_id]->GetAmbigSeq(oid, &buffer, encoding);
                seqlen = m_DbHandles[thread_id]->GetSeqLength(oid);
            } else {
                m_DbHandles[thread_id]->GetSequence(oid, &buffer);
                seqlen = m_DbHandles[thread_id]->GetSeqLength(oid) / 4;
            }
            for (int i = 0; i < seqlen; i++) {
                char base = buffer[i];
                base = base;    // dummy statement
            }
            if (m_DbIsProtein || kScanUncompressed) {
                m_DbHandles[thread_id]->RetAmbigSeq(&buffer);
            } else {
                m_DbHandles[thread_id]->RetSequence(&buffer);
            }
        }
        x_UpdateMemoryUsage(thread_id);
    } // end of omp parallel

    sw.Stop();
    Uint8 bases = static_cast<Uint8>(num_letters / sw.Elapsed());
    cout << "Scanning rate: " 
         << NStr::NumericToString(bases, NStr::fWithCommas) 
         << " bases/second" << endl;
    return 0;
}