void init_socket_example(int port, uint8_t *ip) { sample1(); /* int i = 0; int socket = socket_open(TCP_STREAM); struct sock_addr addr; addr.port = port; addr.ip = 0; for(i=0; i<4; i++) { addr.ip |= ip[i] << i*8; } // printf("ip is %x\n", addr.ip); #if 1 socket_bind(socket, &addr); socket_listen(socket, 5); struct sock_addr client; // printf("Waiting for accept\n"); logger(LOG_SOCKET, NORMAL, "waiting on accept\n"); pthread_t thread_id = 0; while(1) { int *socket_child = malloc(sizeof(int)); *socket_child = socket_accept(socket, &client); pthread_create(&thread_id, NULL, DoWork, socket_child); } #endif // printf("accepted the connection\n"); */ }
// Implement the TestVariable action. Triggers a TestEvent event on the result. void MHOctetStrVar::TestVariable(int nOp, const MHUnion &parm, MHEngine *engine) { parm.CheckType(MHUnion::U_String); int nRes = m_Value.Compare(parm.m_StrVal); bool fRes = false; switch (nOp) { case TC_Equal: fRes = nRes == 0; break; case TC_NotEqual: fRes = nRes != 0; break; /* case TC_Less: fRes = nRes < 0; break; case TC_LessOrEqual: fRes = nRes <= 0; break; case TC_Greater: fRes = nRes > 0; break; case TC_GreaterOrEqual: fRes = nRes >= 0; break;*/ default: MHERROR("Invalid comparison for string"); // Shouldn't ever happen } MHOctetString sample1(m_Value, 0, 10); MHOctetString sample2(parm.m_StrVal, 0, 10); MHLOG(MHLogDetail, QString("Comparison %1 %2 and %3 => %4").arg(TestToText(nOp)) .arg(sample1.Printable()).arg(sample2.Printable()).arg(fRes ? "true" : "false")); engine->EventTriggered(this, EventTestEvent, fRes); }
int main(int argc, char *argv[]) { struct data Rmat_data, Pmat_data, Afine_data, Acoarse_data; int processor_info[2], i; double *sol, *rhs; int Nfine, Ncoarse; Nfine = 15; /* must be an odd number */ #ifdef ML_MPI MPI_Init(&argc,&argv); MPI_Comm_size(MPI_COMM_WORLD, &(processor_info[NUM_PROCS]) ); MPI_Comm_rank(MPI_COMM_WORLD, &(processor_info[PROC_ID ]) ); #else processor_info[PROC_ID ] = 0; processor_info[NUM_PROCS] = 1; #endif /* partition across processors */ if (processor_info[NUM_PROCS] == 2) Nfine = Nfine/2 + processor_info[PROC_ID]; Ncoarse = Nfine/2; /* initial guess and righthand side */ sol = (double *) malloc(Nfine*sizeof(double)); rhs = (double *) malloc(Nfine*sizeof(double)); for (i = 0; i < Nfine; i++) rhs[i] = 0.0; for (i = 0; i < Nfine; i++) sol[i] = (double) i; if (processor_info[PROC_ID] == 1) for (i = 0; i < Nfine; i++) sol[i] += (double) (Nfine - 1); Afine_data.to_size = Nfine; Afine_data.from_size = Nfine; Afine_data.processor_info = processor_info; Acoarse_data.to_size = Ncoarse; Acoarse_data.from_size = Ncoarse; Acoarse_data.processor_info = processor_info; Rmat_data.from_size = Nfine; Rmat_data.to_size = Ncoarse; Rmat_data.processor_info = processor_info; Pmat_data.from_size = Ncoarse; Pmat_data.to_size = Nfine; Pmat_data.processor_info = processor_info; sample1(&Afine_data, &Acoarse_data, &Rmat_data, &Pmat_data, sol, rhs); free(sol); free(rhs); #ifdef ML_MPI MPI_Finalize(); #endif return 0; }
void RVolume::loadData(const std::vector<GLubyte>& inbuffer, size_t width, size_t height, size_t depth) { std::vector<GLubyte> voldata(4 * width * height * depth); std::vector<float>& histogram = _transferFunction->getHistogram(); histogram = std::vector<float>(256, 0); for (int z(0); z < int(depth); ++z) for (int y(0); y < int(height); ++y) for (int x(0); x < int(width); ++x) { Vector sample1(inbuffer[coordCalc(x - 1, y, z, width, height, depth)], inbuffer[coordCalc(x, y - 1, z, width, height, depth)], inbuffer[coordCalc(x, y, z - 1, width, height, depth)]); Vector sample2(inbuffer[coordCalc(x + 1, y, z, width, height, depth)], inbuffer[coordCalc(x, y + 1, z, width, height, depth)], inbuffer[coordCalc(x, y, z + 1, width, height, depth)]); //Note, we store the negative gradient (we point down //the slope) Vector grad = sample1 - sample2; float nrm = grad.nrm(); if (nrm > 0) grad /= nrm; size_t coord = x + width * (y + height * z); voldata[4 * coord + 0] = uint8_t((grad[0] * 0.5 + 0.5) * 255); voldata[4 * coord + 1] = uint8_t((grad[1] * 0.5 + 0.5) * 255); voldata[4 * coord + 2] = uint8_t((grad[2] * 0.5 + 0.5) * 255); GLubyte val = inbuffer[coordCalc(x, y, z, width, height, depth)]; voldata[4 * coord + 3] = val; histogram[val] += 1; } { float logMaxVal = std::log(*std::max_element(histogram.begin(), histogram.end())); float logMinVal = std::log(std::max(*std::min_element(histogram.begin(), histogram.end()), 1.0f)); float normalization = 1.0 / (logMaxVal - logMinVal); for (std::vector<float>::iterator iPtr = histogram.begin(); iPtr != histogram.end(); ++iPtr) { if (*iPtr == 0) *iPtr = 1.0; *iPtr = (std::log(*iPtr) - logMinVal) * normalization; } } _data.init(width, height, depth); _data.subImage(voldata, GL_RGBA); }
VETTOREi *_sample_p(VETTOREi *ris, const VETTOREi *x, int k, int replace, VETTOREd *p, const char *chi) #endif { #ifndef DET int i; #else char buf[MAX_RIGA], nome_mod[256], tmp[256]; FILE *fp; #endif _Intestazione("\n*** sample_p ***\n"); assert(x != NULL && p != NULL); #ifdef FDEBUG _StampaVett_i(x); fprintf(fp_fdbg, "k = %d, replace = %d\n", k, replace); _StampaVett_d(p); #endif CREAv_i(ris, k); #ifndef DET g_y = sample1(g_y, x->dim, k, replace, p->dati); for (i = 1; i <= k; i++) { ASSEGNAv_i(ris, i, ACCEDIv_i(x, ACCEDIv_i(g_y, i) + 1)); } #else id++; snprintf(nome_mod, 256, "sample_%d.txt", id); fp = fopen(nome_mod, "r"); if (!fp) { snprintf(nome_mod, 256, "sample_%d-vuoto.txt", id); fp = fopen(nome_mod, "r"); if (!fp) { snprintf(tmp, 256, "Non riesco a leggere il file '%s'", nome_mod); error(tmp); } fprintf(fp_det, "+++Vettore nullo per '%s' da '%s'\n", chi, nome_mod); CREAv_i(ris, 0); // imposto a zero la lunghezza } fgets(buf, MAX_RIGA, fp); ris = leggi_seq_i(ris, buf, k); fprintf(fp_det, "+++Letti %d valore/i per '%s' da '%s'\n", LENGTHv_i(ris), chi, nome_mod); fclose(fp); #endif #ifdef FDEBUG fprintf(fp_fdbg, "\n\n"); _StampaVett_i(ris); fprintf(fp_fdbg, "*****************************************\n\n"); #endif StrBilanciam(); return ris; }
int samples() { int status = 0; status = sample1(); if (status != 0) return status; status = sample2(); if (status != 0) return status; return 0; }
int main() { // 🐨 has unicode codepoint U+1F428 (http://emojipedia.org/koala/) // according to UTF-8, we have to store 1 11110100 00101000: // [1111]0000 [10]011111 [10]010000 [10]101000 // 4 bytes for koala! String sample1("🐨 коала emoji"); // 13 user-perceived characters (http://utf8everywhere.org/) String sample2(sample1); // copy constructor std::string sample3(sample1.str); std::cout << sample1.size << " " << sample3.length() << '\n'; // 21 21 size_t len = 0; char *s = sample1.str; while (*s) len += (*s++ & 0xc0) != 0x80; // UTF-8 — count all bytes that do not match 10xxxxxx std::cout << len << '\n'; // 13 return 0; }
static int sample_subset(const double *probs, size_t n, dsfmt_t * dsfmt, size_t maxntry, size_t *out, size_t nout) { size_t itry; size_t i; for (itry = 0; itry < maxntry; itry++) { for (i = 0; i < nout; i++) { out[i] = sample1(probs, n, dsfmt); } if (unique(out, nout)) return 1; } return 0; }
int main (int argc, char ** argv) { FILE * file; if (argc > 1) { file = fopen (argv[1], "rb"); if (!file) { fprintf (stderr, "Could not open file %s\n", argv[1]); exit (1); } } else file = stdin; sample1 (file); return 0; }
int main(int argc, char** argv) { Poco::MongoDB::Connection connection("localhost", 27017); sample1(connection); sample2(connection); sample3(connection); sample4(connection); sample5(connection); sample6(connection); sample7(connection); sample8(connection); sample9(connection); sample10(connection); sample11(connection); sample12(connection); sample13(connection); return 0; }
//------------------------------------------------------------------------------ TEST_F(Test_Vector4, Basic) { Vector4 sample1(1, 2, 3, 4); // コンストラクタ { Vector4 v1; Vector4 v2(1, 2, 3, 4); Vector4 v3(Vector2(1, 2), 3, 4); Vector4 v4(Vector3(1, 2, 3), 4); ASSERT_VEC4_NEAR(0, 0, 0, 0, v1); ASSERT_VEC4_NEAR(1, 2, 3, 4, v2); ASSERT_VEC4_NEAR(1, 2, 3, 4, v3); ASSERT_VEC4_NEAR(1, 2, 3, 4, v4); } // this->Set { Vector4 v1; v1.set(1, 2, 3, 4); ASSERT_VEC4_NEAR(1, 2, 3, 4, v1); } // this->xy { Vector2 v = sample1.xy(); ASSERT_VEC2_NEAR(1, 2, v); } // this->xyz { Vector3 v = sample1.xyz(); ASSERT_VEC3_NEAR(1, 2, 3, v); } // this->GetLength / lengthSquared { ASSERT_NEAR(5.477226, sample1.length(), LN_FLOAT_THRESHOLD); ASSERT_NEAR(30.000000, sample1.lengthSquared(), LN_FLOAT_THRESHOLD); } // this->Clamp { Vector4 v1(1, 2, 3, 4); v1.clamp(Vector4(0, 4, 2, 3), Vector4(0.5, 5, 3, 8)); ASSERT_VEC4_NEAR(0.5, 4, 3, 4, v1); Vector4 v2(1, 2, 3, 4); v2.clamp(2, 3); ASSERT_VEC4_NEAR(2, 2, 3, 3, v2); } // this->IsNaNOrInf { Vector4 v(1, 2, 3, 4); ASSERT_FALSE(v.isNaNOrInf()); volatile float d = 0.0f; v.x /= d; ASSERT_TRUE(v.isNaNOrInf()); } // Vector4::normalize { Vector4 v1 = Vector4::normalize(sample1); ASSERT_VEC4_NEAR(0.182574, 0.365148, 0.547723, 0.730297, v1); } // Vector4::dot { Vector4 v1(5, 6, 7, 8); float d = Vector4::dot(sample1, v1); ASSERT_FLOAT_EQ(70.000000, d); } // Vector4::min / max { Vector4 v1 = Vector4::min(Vector4(1, 3, 5, 7), Vector4(4, 2, 6, 8)); ASSERT_VEC4_NEAR(1, 2, 5, 7, v1); Vector4 v2 = Vector4::max(Vector4(1, 3, 5, 7), Vector4(4, 2, 6, 8)); ASSERT_VEC4_NEAR(4, 3, 6, 8, v2); } // Vector4::transform { Matrix m = Matrix::makeRotationYawPitchRoll(1, 2, 3); Vector4 v1 = Vector4::transform(sample1, m); ASSERT_VEC4_NEAR(-3.144919, -1.962654, -0.507415, 4.000000, v1); } // Vector4::Lerp() { Vector4 v1 = Vector4::lerp( Vector4(1, 2, 3, 4), Vector4(3, 4, 7, 8), 0.75); ASSERT_VEC4_NEAR(2.500000, 3.500000, 6.000000, 7.000000, v1); } // Vector4::Hermite() { Vector4 v1 = Vector4::hermite( Vector4(1, 2, 3, 4), Vector4(3, 4, 7, 8), Vector4(0.3f, 0.4f, -0.5f, -0.7f), Vector4(0.03f, 0.04f, -1.5f, 2.5f), 0.75); ASSERT_VEC4_NEAR(0.545781, 0.831875, 0.585938, 0.057813, v1); } // Vector4::CatmullRom() { Vector4 v1 = Vector4::catmullRom( Vector4(1, 2, 3, 4), Vector4(3, 4, 7, 8), Vector4(0.3f, 0.4f, -0.5f, -0.7f), Vector4(0.03f, 0.04f, -1.5f, 2.5f), 0.75); ASSERT_VEC4_NEAR(0.914297, 1.203437, 1.187500, 0.935937, v1); } // assign operator { Vector4 v1; v1.set(1, 2, 3, 4); v1 += Vector4(1, 2, 3, 4); ASSERT_VEC4_NEAR(2, 4, 6, 8, v1); v1.set(1, 2, 3, 4); v1 += 5; ASSERT_VEC4_NEAR(6, 7, 8, 9, v1); v1.set(1, 2, 3, 4); v1 -= Vector4(1, 2, 3, 4); ASSERT_VEC4_NEAR(0, 0, 0, 0, v1); v1.set(1, 2, 3, 4); v1 -= 5; ASSERT_VEC4_NEAR(-4, -3, -2, -1, v1); v1.set(1, 2, 3, 4); v1 *= Vector4(5, 6, 7, 8); ASSERT_VEC4_NEAR(5, 12, 21, 32, v1); v1.set(1, 2, 3, 4); v1 *= 5; ASSERT_VEC4_NEAR(5, 10, 15, 20, v1); v1.set(1, 2, 3, 4); v1 /= Vector4(1, 2, 3, 4); ASSERT_VEC4_NEAR(1, 1, 1, 1, v1); v1.set(10, 20, 30, 40); v1 /= 5; ASSERT_VEC4_NEAR(2, 4, 6, 8, v1); } // binary operator { Vector4 v1; v1 = Vector4(1, 2, 3, 4) + Vector4(1, 2, 3, 4); ASSERT_VEC4_NEAR(2, 4, 6, 8, v1); v1 = Vector4(1, 2, 3, 4) + 5; ASSERT_VEC4_NEAR(6, 7, 8, 9, v1); v1 = 6 + Vector4(1, 2, 3, 4); ASSERT_VEC4_NEAR(7, 8, 9, 10, v1); v1 = Vector4(1, 2, 3, 4) - Vector4(1, 2, 3, 4); ASSERT_VEC4_NEAR(0, 0, 0, 0, v1); v1 = Vector4(1, 2, 3, 4) - 5; ASSERT_VEC4_NEAR(-4, -3, -2, -1, v1); v1 = 6 - Vector4(1, 2, 3, 4); ASSERT_VEC4_NEAR(5, 4, 3, 2, v1); v1 = Vector4(1, 2, 3, 4) * Vector4(5, 6, 7, 8); ASSERT_VEC4_NEAR(5, 12, 21, 32, v1); v1 = Vector4(1, 2, 3, 4) * 5; ASSERT_VEC4_NEAR(5, 10, 15, 20, v1); v1 = 6 * Vector4(1, 2, 3, 4); ASSERT_VEC4_NEAR(6, 12, 18, 24, v1); v1 = Vector4(10, 20, 30, 40) / Vector4(10, 20, 30, 40); ASSERT_VEC4_NEAR(1, 1, 1, 1, v1); v1 = Vector4(10, 20, 30, 40) / 5; ASSERT_VEC4_NEAR(2, 4, 6, 8, v1); v1 = 20 / Vector4(1, 2, 4, 5); ASSERT_VEC4_NEAR(20, 10, 5, 4, v1); v1.set(2, 4, 6, 8); ASSERT_TRUE(v1 == Vector4(2, 4, 6, 8)); ASSERT_FALSE(v1 != Vector4(2, 4, 6, 8)); } // unary operator { Vector4 v1(1, 2, 3, 4); v1 = -v1; ASSERT_VEC4_NEAR(-1, -2, -3, -4, v1); } #ifdef D3DX9_TEST D3DXVECTOR4 dxsample1(1, 2, 3, 4); // D3DXVec4Length { //dumpFLOAT("D3DXVec4Length", D3DXVec4Length(&dxsample1)); //dumpFLOAT("D3DXVec4LengthSq", D3DXVec4LengthSq(&dxsample1)); } // D3DXVec4Normalize { D3DXVECTOR4 v1; D3DXVec4Normalize(&v1, &dxsample1); //dumpD3DXVECTOR4("D3DXVec4Normalize", v1); } // D3DXVec4Dot { D3DXVECTOR4 v1(5, 6, 7, 8); //dumpFLOAT("D3DXVec4Dot", D3DXVec4Dot(&dxsample1, &v1)); } // D3DXVec4Transform { D3DXMATRIX m1; D3DXMatrixRotationYawPitchRoll(&m1, 1, 2, 3); D3DXVECTOR4 v1; D3DXVec4Transform(&v1, &dxsample1, &m1); } // D3DXVec4Lerp { D3DXVECTOR4 dxv; D3DXVECTOR4 dxv1(1, 2, 3, 4); D3DXVECTOR4 dxv2(3, 4, 7, 8); D3DXVec4Lerp(&dxv, &dxv1, &dxv2, 0.75); //dumpD3DXVECTOR4("D3DXVec4Lerp", dxv); } // D3DXVec4Hermite { D3DXVECTOR4 dxv; D3DXVECTOR4 dxv1(1, 2, 3, 4); D3DXVECTOR4 dxv2(3, 4, 7, 8); D3DXVECTOR4 dxv3(0.3f, 0.4f, -0.5f, -0.7f); D3DXVECTOR4 dxv4(0.03f, 0.04f, -1.5f, 2.5f); D3DXVec4Hermite(&dxv, &dxv1, &dxv2, &dxv3, &dxv4, 0.75); //dumpD3DXVECTOR4("D3DXVec4Hermite", dxv); } // D3DXVec4CatmullRom { D3DXVECTOR4 dxv; D3DXVECTOR4 dxv1(1, 2, 3, 4); D3DXVECTOR4 dxv2(3, 4, 7, 8); D3DXVECTOR4 dxv3(0.3f, 0.4f, -0.5f, -0.7f); D3DXVECTOR4 dxv4(0.03f, 0.04f, -1.5f, 2.5f); D3DXVec4CatmullRom(&dxv, &dxv1, &dxv2, &dxv3, &dxv4, 0.75); //dumpD3DXVECTOR4("D3DXVec4CatmullRom", dxv); } #endif }
void CTTSprite::PointerCursorVisibleL() { if (!TestBase()->ConfigurationSupportsPointerEventTesting()) { INFO_PRINTF1(_L("Test skipped because config does not support pointer event testing")); return; } // The pointer events need time to have an affect on the wserv static const TInt eventPropagationDelay = 100 * 1000; // 100 ms TInt screenNumber = TheClient->iScreen->GetScreenNumber(); if(screenNumber != 0) // pointer events only supported on emulator screen 0 { LOG_MESSAGE(_L("Pointer Cursor Visible only runs on screen 0")); return; } // set up objects used in test // 50x50 red rectangle colour 24 CFbsBitmap bitmap; User::LeaveIfError(bitmap.Load(TEST_BITMAP_NAME, 8)); TSize bmSize = bitmap.SizeInPixels(); TPoint bmSample = TPoint(bmSize.iWidth / 2, bmSize.iHeight / 2); TRgb bmColour; bitmap.GetPixel(bmColour, bmSample); TEST(bmColour == KRgbRed); // single window, size of screen RWindow win(TheClient->iWs); User::LeaveIfError(win.Construct(*TheClient->iGroup->GroupWin(),1)); win.Activate(); // setup cursor mode TheClient->iWs.SetPointerCursorMode(EPointerCursorWindow); // setup cursor to contain single 50x50 red bitmap RWsPointerCursor iCursor1 = RWsPointerCursor(TheClient->iWs); TSpriteMember member; SetUpMember(member); member.iBitmap=&bitmap; User::LeaveIfError(iCursor1.Construct(0)); User::LeaveIfError(iCursor1.AppendMember(member)); User::LeaveIfError(iCursor1.Activate()); win.SetCustomPointerCursor(iCursor1); iCursor1.UpdateMember(0); // draw a green rect, size of screen as defined background and wait till it is rendered win.BeginRedraw(); TheGc->Activate(win); TheGc->SetBrushStyle(CGraphicsContext::ESolidBrush); TheGc->SetBrushColor(KRgbGreen); TSize wSize = win.Size(); TheGc->DrawRect(TRect(TPoint(0,0), wSize)); TheGc->Deactivate(); win.EndRedraw(); TheClient->iWs.Finish(); // #### do test #### // define locations of simulated pointer events and sample positions of where we expect to see the cursor // The cursor will be moved and a check will be made to see if this has actually happened TPoint pos1(wSize.iWidth / 2, wSize.iHeight / 2); // top left of cursor at centre screen TPoint sample1(pos1 + bmSample); // centre of sprite at pos1 TPoint pos2 = pos1 - bmSize; // bottom right of cursor at centre screen TPoint sample2 = pos2 + bmSample; // centre of sprite at pos2 TRgb pixel; // check initial state of screen at both sample positions TheClient->iScreen->GetPixel(pixel, sample1); TEST(pixel == KRgbGreen); TheClient->iScreen->GetPixel(pixel, sample2); TEST(pixel == KRgbGreen); TRawEvent e; // to simulate pointer events // simulate button 1 down event at pos1 e.Set(TRawEvent::EButton1Down, pos1.iX, pos1.iY); e.SetDeviceNumber(screenNumber); UserSvr::AddEvent(e); User::After(eventPropagationDelay); // check red cursor visible on top of background TheClient->iScreen->GetPixel(pixel, sample1); TEST(pixel == KRgbRed); // simulate button 1 up event e.Set(TRawEvent::EButton1Up, pos1.iX, pos1.iY); UserSvr::AddEvent(e); User::After(eventPropagationDelay); // Move cursor away to pos2 e.Set(TRawEvent::EButton1Down, pos2.iX, pos2.iY); e.SetDeviceNumber(screenNumber); UserSvr::AddEvent(e); User::After(eventPropagationDelay); // check cursor has left this position ... TheClient->iScreen->GetPixel(pixel, sample1); TEST(pixel == KRgbGreen); // and arrived at the correct place TheClient->iScreen->GetPixel(pixel, sample2); TEST(pixel == KRgbRed); // simulate button 1 up event e.Set(TRawEvent::EButton1Up, pos2.iX, pos2.iY); UserSvr::AddEvent(e); User::After(eventPropagationDelay); // remove the cursor win.ClearPointerCursor(); User::After(eventPropagationDelay); // check it has gone TheClient->iScreen->GetPixel(pixel, sample2); TEST(pixel == KRgbGreen); // #### clean up #### iCursor1.Close(); win.Close(); }
PWIZ_API_DECL void addMIAPEExampleMetadata(MSData& msd) { msd.id = "urn:lsid:psidev.info:mzML.instanceDocuments.small_miape.pwiz"; msd.cvs = defaultCVList(); // TODO: move this to Reader_Thermo FileContent& fc = msd.fileDescription.fileContent; fc.userParams.push_back(UserParam("ProteoWizard", "Thermo RAW data converted to mzML, with additional MIAPE parameters added for illustration")); // fileDescription SourceFilePtr sfp_parameters(new SourceFile("sf_parameters", "parameters.par", "file:///C:/example/")); sfp_parameters->set(MS_parameter_file); sfp_parameters->set(MS_SHA_1, "unknown"); sfp_parameters->set(MS_no_nativeID_format); msd.fileDescription.sourceFilePtrs.push_back(sfp_parameters); Contact contact; contact.set(MS_contact_name, "William Pennington"); contact.set(MS_contact_affiliation, "Higglesworth University"); contact.set(MS_contact_address, "12 Higglesworth Avenue, 12045, HI, USA"); contact.set(MS_contact_URL, "http://www.higglesworth.edu/"); contact.set(MS_contact_email, "*****@*****.**"); msd.fileDescription.contacts.push_back(contact); // paramGroupList ParamGroupPtr pgInstrumentCustomization(new ParamGroup); pgInstrumentCustomization->id = "InstrumentCustomization"; pgInstrumentCustomization->set(MS_customization ,"none"); msd.paramGroupPtrs.push_back(pgInstrumentCustomization); ParamGroupPtr pgActivation(new ParamGroup); pgActivation->id = "CommonActivationParams"; pgActivation->set(MS_collision_induced_dissociation); pgActivation->set(MS_collision_energy, 35.00, UO_electronvolt); pgActivation->set(MS_collision_gas, "nitrogen"); msd.paramGroupPtrs.push_back(pgActivation); // sampleList SamplePtr sample1(new Sample); sample1->id = "sample1"; sample1->name = "Sample 1"; msd.samplePtrs.push_back(sample1); SamplePtr sample2(new Sample); sample2->id = "sample2"; sample2->name = "Sample 2"; msd.samplePtrs.push_back(sample2); // instrumentConfigurationList for (vector<InstrumentConfigurationPtr>::const_iterator it=msd.instrumentConfigurationPtrs.begin(), end=msd.instrumentConfigurationPtrs.end(); it!=end; ++it) { for (size_t i=0; i < (*it)->componentList.size(); ++i) { Component& c = (*it)->componentList[i]; if (c.type == ComponentType_Source) c.set(MS_source_potential, "4.20", UO_volt); } } // dataProcesingList ProcessingMethod procMIAPE; procMIAPE.order = 1; procMIAPE.softwarePtr = msd.softwarePtrs.back(); procMIAPE.set(MS_deisotoping); procMIAPE.set(MS_charge_deconvolution); procMIAPE.set(MS_peak_picking); procMIAPE.set(MS_smoothing); procMIAPE.set(MS_baseline_reduction); procMIAPE.userParams.push_back(UserParam("signal-to-noise estimation", "none")); procMIAPE.userParams.push_back(UserParam("centroiding algorithm", "none")); procMIAPE.userParams.push_back(UserParam("charge states calculated", "none")); DataProcessingPtr dpMIAPE(new DataProcessing); msd.dataProcessingPtrs.push_back(dpMIAPE); dpMIAPE->id = "MIAPE example"; dpMIAPE->processingMethods.push_back(procMIAPE); // acquisition settings ScanSettingsPtr as1(new ScanSettings("acquisition settings MIAPE example")); as1->sourceFilePtrs.push_back(sfp_parameters); Target t1; t1.userParams.push_back(UserParam("precursorMz", "123.456")); t1.userParams.push_back(UserParam("fragmentMz", "456.789")); t1.userParams.push_back(UserParam("dwell time", "1", "seconds")); t1.userParams.push_back(UserParam("active time", "0.5", "seconds")); Target t2; t2.userParams.push_back(UserParam("precursorMz", "231.673")); t2.userParams.push_back(UserParam("fragmentMz", "566.328")); t2.userParams.push_back(UserParam("dwell time", "1", "seconds")); t2.userParams.push_back(UserParam("active time", "0.5", "seconds")); as1->targets.push_back(t1); as1->targets.push_back(t2); msd.scanSettingsPtrs.push_back(as1); // run msd.run.samplePtr = sample1; } // addMIAPEExampleMetadata()