/** @SYMTestCaseID SYSLIB-DBMS-CT-1316 @SYMTestCaseDesc Tests for dropping an index @SYMTestPriority Medium @SYMTestActions Drop an integer and text index from the table. Test for damage of database @SYMTestExpectedResults Test must not fail @SYMREQ REQ0000 */ LOCAL_C void DropIndexes() { test.Next(_L(" @SYMTestCaseID:SYSLIB-DBMS-CT-1316 ")); #ifndef __TOOLS2__ TheTimer.Start(_L("drop Int[32]")); #endif test(TheDatabase.DropIndex(KIndexInt,KTableName)==KErrNone); #ifndef __TOOLS2__ TheTimer.Stop(); TheTimer.Start(_L("drop Text[200]")); #endif test(TheDatabase.DropIndex(KIndexText,KTableName)==KErrNone); #ifndef __TOOLS2__ TheTimer.Stop(); #endif test(!TheDatabase.IsDamaged()); }
TSocket* Cat::GetSocket(const char* ip, int port){ // printf("inside GetSocket alarm start %s:%d\n" , ip, port ); qalarm->Start(3000, kTRUE); // printf("inside GetSocket %s:%d\n" , ip, port ); TSocket *socks=new TSocket( ip, port); // unfortunately it makes STDERR print // printf("outside GetSocket %s:%d\n" , ip, port ); return socks; }
/** @SYMTestCaseID SYSLIB-DBMS-CT-1315 @SYMTestCaseDesc Database recovery test @SYMTestPriority Medium @SYMTestActions Calls up RDbStoreDatabase::Recover() function @SYMTestExpectedResults Test must not fail @SYMREQ REQ0000 */ LOCAL_C void Recover() { test.Next(_L(" @SYMTestCaseID:SYSLIB-DBMS-CT-1315 ")); #ifndef __TOOLS2__ TheTimer.Start(_L("recover")); #endif test(TheDatabase.Recover()==KErrNone); #ifndef __TOOLS2__ TheTimer.Stop(); #endif test(!TheDatabase.IsDamaged()); }
/** @SYMTestCaseID SYSLIB-DBMS-CT-0580 @SYMTestCaseDesc Tests the database definition and enquiry functions @SYMTestPriority Medium @SYMTestActions Tests by setting an active index for the table. @SYMTestExpectedResults Test must not fail @SYMREQ REQ0000 */ LOCAL_C void TestIndex(const TDesC& aName,const CDbKey& aKey) { test.Next(_L(" @SYMTestCaseID:SYSLIB-DBMS-CT-0580 ")); #ifndef __TOOLS2__ TheTimer.Start(_L("build")); #endif test(TheDatabase.CreateIndex(aName,KTableName,aKey)==KErrNone); #ifndef __TOOLS2__ TheTimer.Stop(); #endif test(TheTable.Open(TheDatabase,KTableName)==KErrNone); test(TheTable.SetIndex(aName)==KErrNone); IterateL(TheTable.ENext); TheTable.Close(); }
/** @SYMTestCaseID SYSLIB-DBMS-CT-0579 @SYMTestCaseDesc Tests the database definition and enquiry functions @SYMTestPriority Medium @SYMTestActions Executes the index and bookmark tests @SYMTestExpectedResults Test must not fail @SYMREQ REQ0000 */ LOCAL_C void BigTestL() { test.Start(_L(" @SYMTestCaseID:SYSLIB-DBMS-CT-0579 Table ")); CreateDatabaseL(); BuildTable(KRecords); test(TheTable.Open(TheDatabase,KTableName)==KErrNone); TheTable.EndL(); IterateL(TheTable.EPrevious); TheTable.BeginningL(); IterateL(TheTable.ENext); TheTable.EndL(); IterateL(TheTable.EPrevious); TheTable.Close(); test.Next(_L("Int32 Index")); CDbKey *key=CDbKey::NewLC(); key->AddL(KColumnInt); key->MakeUnique(); TestIndex(KIndexInt,*key); test.Next(_L("Text[200] Index")); key->Clear(); key->AddL(KColumnText); key->MakeUnique(); TestIndex(KIndexText,*key); test.Next(_L("Bookmarks")); TestBookmark(); test.Next(_L("Int32 Index")); #ifndef __TOOLS2__ TheTimer.Start(_L("drop")); #endif test(TheDatabase.DropIndex(KIndexInt,KTableName)==KErrNone); #ifndef __TOOLS2__ TheTimer.Stop(); #endif key->Clear(); key->AddL(KColumnInt); key->MakeUnique(); TestIndex(KIndexInt,*key); CleanupStack::PopAndDestroy(); test.Next(_L("Break & Recover")); BreakIndex(); Recover(); test.Next(_L("Drop Indexes")); DropIndexes(); test.Next(_L("Delete all records")); DeleteTable(); CloseDatabaseL(); test.End(); }
/** @SYMTestCaseID SYSLIB-DBMS-CT-1312 @SYMTestCaseDesc Create a table in database @SYMTestPriority Medium @SYMTestActions Build a table and write records into the table.Test for commiting the transactions. @SYMTestExpectedResults Test must not fail @SYMREQ REQ0000 */ LOCAL_C void BuildTable(TInt aCount) { test.Next(_L(" @SYMTestCaseID:SYSLIB-DBMS-CT-1312 ")); #ifndef __TOOLS2__ TheTimer.Start(_L("build")); #endif CreateTable(); TheDatabase.Begin(); test(TheTable.Open(TheDatabase,KTableName)==KErrNone); WriteRecords(aCount); test(TheDatabase.Commit()==KErrNone); TheTable.Close(); #ifndef __TOOLS2__ TheTimer.Stop(); #endif }
/** @SYMTestCaseID SYSLIB-DBMS-CT-1314 @SYMTestCaseDesc Discarding indexes belonging to the table on database @SYMTestPriority Medium @SYMTestActions Tests for RDbIncremental::DropTable(),RDbIncremental::Next() function. @SYMTestExpectedResults Test must not fail @SYMREQ REQ0000 */ LOCAL_C void BreakIndex() { test.Next(_L(" @SYMTestCaseID:SYSLIB-DBMS-CT-1314 ")); #ifndef __TOOLS2__ TheTimer.Start(_L("break")); #endif TInt step; RDbIncremental drop; test(drop.DropTable(TheDatabase,KTableName,step)==KErrNone); test(drop.Next(step)==KErrNone); test(step>0); drop.Close(); // abort the drop test(TheDatabase.IsDamaged()); #ifndef __TOOLS2__ TheTimer.Stop(); #endif }
/** @SYMTestCaseID SYSLIB-DBMS-CT-1313 @SYMTestCaseDesc Tests for total rows in the rowset @SYMTestPriority Medium @SYMTestActions Iterate through the table.Test for the total numbers of rows available @SYMTestExpectedResults Test must not fail @SYMREQ REQ0000 */ LOCAL_C void IterateL(RDbTable::TPosition aDirection) { test.Next(_L(" @SYMTestCaseID:SYSLIB-DBMS-CT-1313 ")); #ifndef __TOOLS2__ TheTimer.Start(_L("iterate")); #endif TInt cc=0; while (TheTable.GotoL(aDirection)) { ++cc; TheTable.GetL(); } #ifndef __TOOLS2__ TheTimer.Stop(); #endif test(cc=TheTable.CountL()); }
void analyze( Char_t *szFin, Int_t first=2, Int_t lastt=0) { ReadFile(szFin); InitAll(); SetThreshold( 3000, 3000 ); // set the thresholds event_first = first; event_lastt=h2D[0]->GetNbinsY()-1; if( lastt>1 && lastt<event_lastt ) event_lastt = lastt; event = event_first; ftimer.Start(); return; }
int process(jack_nframes_t nframes, void* arg) { TimerProcess.Start(); static uint64_t frametime = 0; TJackSynth* synth = static_cast<TJackSynth*>(arg); /* Process MIDI input */ void* inbuf = jack_port_get_buffer(MidiIn, nframes); jack_nframes_t event_count = jack_midi_get_event_count(inbuf); for (jack_nframes_t i = 0; i < event_count; i++) { jack_midi_event_t event; jack_midi_event_get(&event, inbuf, i); std::vector<uint8_t> data(event.buffer, event.buffer + event.size); synth->HandleMidi(data, frametime + event.time); } /* Send MIDI */ void* outbuf = jack_port_get_buffer(MidiOut, nframes); jack_midi_clear_buffer(outbuf); while (!MidiOutQueue.empty()) { const std::vector<uint8_t>& data = MidiOutQueue.front(); int ret = jack_midi_event_write(outbuf, 0, data.data(), data.size()); MidiOutQueue.pop(); if (ret != 0) { fprintf(stderr, "MIDI send error\n"); } } synth->Process(nframes); frametime += nframes; TimerProcess.Stop(); return 0; }
MyMainFrame::MyMainFrame(const TGWindow *p, UInt_t w, UInt_t h, TH1F* histogram[10], TH1F* histogram_store[10], TH2F* map[10], TGraphErrors* graph_fit[10], TGraphErrors* graph_threshold[10], TGraphErrors* graph_detected[10], TGraphErrors* graph_neutrons[10], TFile* file) { for (int i = 0; i < 10; i++) { fHistogram[i] = histogram[i]; fHistogram_store[i] = histogram_store[i]; fMap[i] = map[i]; fGraph_fit[i] = graph_fit[i]; fGraph_threshold[i] = graph_threshold[i]; fGraph_detected[i] = graph_detected[i]; fGraph_neutrons[i] = graph_neutrons[i]; fFile = file; fGraph_fit[i]->SetPoint(0, 0, 0); fGraph_fit[i]->SetPointError(0, 0, 0); fGraph_threshold[i]->SetPoint(0, 0, 0); fGraph_threshold[i]->SetPointError(0, 0, 0); fGraph_detected[i]->SetPoint(0, 0, 0); fGraph_detected[i]->SetPointError(0, 0, 0); fGraph_neutrons[i]->SetPoint(0, 0, 0); fGraph_neutrons[i]->SetPointError(0, 0, 0); fGraph_fit[i]->SetMarkerColor(kRed); fGraph_fit[i]->SetMarkerStyle(20); fGraph_fit[i]->SetLineColor(kRed); fGraph_fit[i]->SetLineWidth(1); fGraph_threshold[i]->SetMarkerColor(kBlack); fGraph_threshold[i]->SetMarkerStyle(20); fGraph_threshold[i]->SetLineColor(kRed); fGraph_threshold[i]->SetLineWidth(1); fGraph_detected[i]->SetMarkerColor(kRed); fGraph_detected[i]->SetMarkerStyle(20); fGraph_detected[i]->SetLineColor(kRed); fGraph_detected[i]->SetLineWidth(1); fGraph_neutrons[i]->SetMarkerColor(kBlue); fGraph_neutrons[i]->SetMarkerStyle(20); fGraph_neutrons[i]->SetLineColor(kRed); fGraph_neutrons[i]->SetLineWidth(1); fHistogram_store[i]->SetLineColor(kYellow); fHistogram_store[i]->SetFillColor(kYellow); fHistogram[i]->SetAxisRange(0, 5000, "Y"); fHistogram_store[i]->SetAxisRange(0, 5000, "Y"); } ///////////////////////////////////////////////////////////////////////////// // Create the main frame fMain = new TGMainFrame(p, w, h); ///////////////////////////////////////////////////////////////////////////// // Create a frame for combo box 1 TGHorizontalFrame *frame1 = new TGHorizontalFrame(fMain, 1000, 20); // Create combo box 1 TGComboBox *selectionCombo1 = new TGComboBox(frame1, 98); Int_t initialSelection1 = 0; Int_t firstEntry = 0; Int_t lastEntry = 9; for (int i = firstEntry; i <= lastEntry; i++) { char tmp[20]; sprintf(tmp, "Channel %i", i); selectionCombo1->AddEntry(tmp, i); } selectionCombo1->Connect("Selected(Int_t)", "MyMainFrame", this, "do_selection1(Int_t)"); selectionCombo1->Resize(100, 20); frame1->AddFrame(selectionCombo1, new TGLayoutHints(kLHintsLeft, 5, 5, 3, 4)); // Add the frame for combo box 1 to the main frame fMain->AddFrame(frame1, new TGLayoutHints(kLHintsLeft, 2, 2, 2, 2)); // Create embedded canvas 1 and add it to the main frame fEcanvas1 = new TRootEmbeddedCanvas("Ecanvas1", fMain, 1000, 220); fMain->AddFrame(fEcanvas1, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 10, 10, 10, 1)); ///////////////////////////////////////////////////////////////////////////// // Create a frame for combo box 2 TGHorizontalFrame *frame2 = new TGHorizontalFrame(fMain, 1000, 20); // Create combo box 2 TGComboBox *selectionCombo2 = new TGComboBox(frame2, 99); Int_t initialSelection2 = 1; for (int i = firstEntry; i <= lastEntry; i++) { char tmp[20]; sprintf(tmp, "Channel %i", i); selectionCombo2->AddEntry(tmp, i); } selectionCombo2->Connect("Selected(Int_t)", "MyMainFrame", this, "do_selection2(Int_t)"); selectionCombo2->Resize(100, 20); frame2->AddFrame(selectionCombo2, new TGLayoutHints(kLHintsCenterX, 5, 5, 3, 4)); // Add the frame for combo box 2 to the main frame fMain->AddFrame(frame2, new TGLayoutHints(kLHintsLeft, 2, 2, 2, 2)); // Create embedded canvas 2 and add it to the main frame fEcanvas2 = new TRootEmbeddedCanvas("Ecanvas2", fMain, 1000, 220); fMain->AddFrame(fEcanvas2, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 10, 10, 10, 1)); ///////////////////////////////////////////////////////////////////////////// // Frame for Draw and Exit buttons TGHorizontalFrame *frame3 = new TGHorizontalFrame(fMain, 1000, 20); // Create a draw button TGTextButton *drawButton = new TGTextButton(frame3, "&Draw"); drawButton->Connect("Clicked()", "MyMainFrame", this, "do_drawing()"); frame3->AddFrame(drawButton, new TGLayoutHints(kLHintsCenterX, 5, 5, 3, 4)); // Create an exit button TGTextButton *exitButton = new TGTextButton(frame3, "&Exit"); exitButton->Connect("Clicked()", "MyMainFrame", this, "do_exiting()"); frame3->AddFrame(exitButton, new TGLayoutHints(kLHintsCenterX, 5, 5, 3, 4)); fMain->AddFrame(frame3, new TGLayoutHints(kLHintsCenterX, 2, 2, 2, 2)); ///////////////////////////////////////////////////////////////////////////// // Refresh Timer TTimer *timer = new TTimer(); timer->Connect("Timeout()", "MyMainFrame", this, "do_drawing()"); // Set a name to the main frame fMain->SetWindowName("GRAPH VIEWER"); // Map all subwindows of main frame fMain->MapSubwindows(); // Initialize the layout algorithm via Resize() fMain->Resize(fMain->GetDefaultSize()); // Map main frame fMain->MapWindow(); // Display setting for the first canvas fEcanvas1->GetCanvas()->cd(); pad1[0] = new TPad("Pad10", "Pad10", 0.000, 0.0, 0.333, 1.0); pad1[1] = new TPad("Pad11", "Pad11", 0.333, 0.0, 0.666, 1.0); pad1[2] = new TPad("Pad12", "Pad12", 0.666, 0.0, 0.999, 1.0); for (int i = 0; i < 3; i++) { pad1[i]->SetGrid(); pad1[i]->Draw(); } for (int i = 0; i < 10; i++) { string name; ostringstream number; number << i; name = "Frame" + number.str(); //dummyHistogram[i] = new TH1F(name.c_str(), "Number of Neutrons;Time[msec];Rate[Hz]", 100, 0, 100000); //dummyHistogram[i]->SetAxisRange(0, 6000, "Y"); } pad1[0]->cd(); fMap[initialSelection1]->Draw("Color"); fGraph_fit[initialSelection1]->Draw("P"); fGraph_threshold[initialSelection1]->Draw("P"); pad1[1]->cd(); pad1[1]->SetFillColor(0); pad1[1]->SetGrid(); //dummyHistogram[initialSelection1]->Draw(); fGraph_detected[initialSelection1]->Draw("ALP"); fGraph_neutrons[initialSelection1]->Draw("ALP"); pad1[2]->cd(); fHistogram_store[initialSelection1]->Draw(); fHistogram[initialSelection1]->Draw("same"); selectionCombo1->Select(initialSelection1); currentSelection1 = initialSelection1; // Display setting for the second canvas fEcanvas2->GetCanvas()->cd(); pad2[0] = new TPad("Pad20", "Pad20", 0.000, 0.0, 0.333, 1.0); pad2[1] = new TPad("Pad21", "Pad21", 0.333, 0.0, 0.666, 1.0); pad2[2] = new TPad("Pad22", "Pad22", 0.666, 0.0, 0.999, 1.0); for (int i = 0; i < 3; i++) { pad2[i]->SetGrid(); pad2[i]->Draw(); } pad2[0]->cd(); fMap[initialSelection2]->Draw("Color"); fGraph_fit[initialSelection2]->Draw("P"); fGraph_threshold[initialSelection2]->Draw("P"); pad2[1]->cd(); //dummyHistogram[initialSelection2]->Draw(); fGraph_detected[initialSelection2]->Draw("ALP"); fGraph_neutrons[initialSelection2]->Draw("ALP"); pad2[2]->cd(); fHistogram_store[initialSelection2]->Draw(); fHistogram[initialSelection2]->Draw("same"); selectionCombo2->Select(initialSelection2); currentSelection2 = initialSelection2; timer->Start(100, kFALSE); }
/** @SYMTestCaseID SYSLIB-DBMS-CT-1317 @SYMTestCaseDesc Deleting a table from the database @SYMTestPriority Medium @SYMTestActions Delete the rows from the rowset.Check for empty rows in the rowset. @SYMTestExpectedResults Test must not fail @SYMREQ REQ0000 */ LOCAL_C void DeleteTable() { test.Next(_L(" @SYMTestCaseID:SYSLIB-DBMS-CT-1317 ")); const TInt KTenthRecords=KRecords/10; test (TheTable.Open(TheDatabase,KTableName)==KErrNone); TheDatabase.Begin(); TInt ii; for (ii=0;ii<15;++ii) { TheTable.NextL(); TheTable.DeleteL(); } TheTable.NextL(); TDbBookmark mark=TheTable.Bookmark(); TheTable.Close(); TheDatabase.Commit(); CloseDatabaseL(); OpenDatabaseL(); #ifndef __TOOLS2__ TheTimer.Start(_L("delete table")); #endif test (TheTable.Open(TheDatabase,KTableName)==KErrNone); TheDatabase.Begin(); TheTable.GotoL(mark); TheTable.DeleteL(); for (ii=0;ii<KTenthRecords*2-16;++ii) { TheTable.NextL(); TheTable.DeleteL(); } TheTable.EndL(); for (ii=0;ii<KTenthRecords*2;++ii) { TheTable.PreviousL(); TheTable.DeleteL(); } TheTable.BeginningL(); for (ii=0;ii<KTenthRecords*3;++ii) TheTable.NextL(); for (ii=0;ii<KTenthRecords*2;++ii) { TheTable.NextL(); TheTable.DeleteL(); } for (ii=0;ii<KTenthRecords*2;++ii) { TheTable.PreviousL(); TheTable.DeleteL(); } for (ii=0;ii<KTenthRecords;++ii) { TheTable.NextL(); TheTable.DeleteL(); } for (ii=0;ii<KTenthRecords;++ii) { TheTable.PreviousL(); TheTable.DeleteL(); } test (TheTable.CountL()==0); test (!TheTable.NextL()); test (!TheTable.PreviousL()); test (TheDatabase.Commit()==KErrNone); TheTable.Close(); #ifndef __TOOLS2__ TheTimer.Stop(); #endif }