int main() { decltype(auto) i = f(); same_type<decltype(i),int&>(); decltype(auto) i2 = i; same_type<decltype(i2),int&>(); decltype(auto) i3 = ::i; same_type<decltype(i3),int>(); decltype(auto) i4 = (::i); same_type<decltype(i4),int&>(); decltype(auto) i5 = a.i; same_type<decltype(i5),int>(); decltype(auto) i6 = (a.i); same_type<decltype(i6),int&>(); decltype(auto) i7 = true ? ::i : ::i; same_type<decltype(i7),int&>(); same_type<decltype(g()),int&>(); same_type<decltype(h1()),int>(); same_type<decltype(h2()),int&>(); same_type<decltype(h2a()),int&>(); same_type<decltype(h3()),int>(); same_type<decltype(h4()),int&>(); same_type<decltype(h5(a)),int>(); same_type<decltype(h6(a)),int&>(); }
int run_main (int, ACE_TCHAR *[]) { ACE_START_TEST (ACE_TEXT ("Sig_Handlers_Test")); ACE_Sig_Handlers multi_handlers; ACE_Select_Reactor reactor_impl (&multi_handlers); ACE_Reactor reactor (&reactor_impl); ACE_Reactor::instance (&reactor); // Create a bevy of handlers. Test_SIGINT_Handler h1 (ACE_Reactor::instance (), "h1"); Test_SIGINT_Handler h2 (ACE_Reactor::instance (), "h2"); Test_SIGINT_Handler h3 (ACE_Reactor::instance (), "h3"); Test_SIGINT_Handler h4 (ACE_Reactor::instance (), "h4"); Test_SIGINT_Handler h5 (ACE_Reactor::instance (), "h5"); Test_SIGINT_Handler h6 (ACE_Reactor::instance (), "h6"); Test_SIGINT_Handler h7 (ACE_Reactor::instance (), "h7"); Test_SIGINT_Handler h8 (ACE_Reactor::instance (), "h8"); Test_SIGINT_Shutdown_Handler h0 (ACE_Reactor::instance ()); // Wait for user to type SIGINT. while (!ACE_Reactor::instance ()->reactor_event_loop_done ()) { ACE_DEBUG ((LM_DEBUG,"\nwaiting for SIGINT\n")); if (ACE_Reactor::instance ()->handle_events () == -1) ACE_ERROR ((LM_ERROR,"%p\n","handle_events")); } ACE_END_TEST; return 0; }
void draw_grid(int i,int j,int k) //This draws the grid and changes the color the grid according to the player { beginFrame(); Line h1(0,0,600,0),h2(0,100,600,100), // "h" is the horizontal lines and "v" is the vertical lines h3(0,200,600,200),h4(0,300,600,300), h5(0,400,600,400),h6(0,500,600,500), h7(0,600,600,600),h8(0,700,600,700), h9(0,800,600,800); Line v1(0,0,0,800),v2(100,0,100,800), v3(200,0,200,800),v4(300,0,300,800), v5(400,0,400,800),v6(500,0,500,800), v7(600,0,600,800); h1.setColor(COLOR(255*i,255*j,255*k)),h2.setColor(COLOR(255*i,255*j,255*k)), h3.setColor(COLOR(255*i,255*j,255*k)),h4.setColor(COLOR(255*i,255*j,255*k)), h5.setColor(COLOR(255*i,255*j,255*k)),h6.setColor(COLOR(255*i,255*j,255*k)), h7.setColor(COLOR(255*i,255*j,255*k)),h8.setColor(COLOR(255*i,255*j,255*k)), h9.setColor(COLOR(255*i,255*j,255*k)); v1.setColor(COLOR(255*i,255*j,255*k)),v2.setColor(COLOR(255*i,255*j,255*k)), v3.setColor(COLOR(255*i,255*j,255*k)),v4.setColor(COLOR(255*i,255*j,255*k)), v5.setColor(COLOR(255*i,255*j,255*k)),v6.setColor(COLOR(255*i,255*j,255*k)), v7.setColor(COLOR(255*i,255*j,255*k)); h1.imprint(),h2.imprint(), h3.imprint(),h4.imprint(), h5.imprint(),h6.imprint(), h7.imprint(),h8.imprint(),h9.imprint(); v1.imprint(),v2.imprint(), v3.imprint(),v4.imprint(), v5.imprint(),v6.imprint(),v7.imprint(); endFrame(); }
void convertHFShowerLibrary() { TFile *nF=new TFile("david.root","RECREATE","hiThere",1); TTree *nT=new TTree("HFSimHits","HF simple tree"); std::vector<float> *parts=new std::vector<float>(); std::vector<float> *partsHad=new std::vector<float>(); nT->Branch("emParticles", &parts); nT->GetBranch("emParticles")->SetBasketSize(1); nT->Branch("hadParticles", &partsHad); nT->GetBranch("hadParticles")->SetBasketSize(1); TDirectory *target=gDirectory; TFile *oF=TFile::Open("HFShowerLibrary_npmt_noatt_eta4_16en_v3_orig.root"); TTree *t=(TTree*)oF->Get("HFSimHits"); TTreeReader fReader(t); TTreeReaderArray<Float_t> b1(fReader, "emParticles.position_.fCoordinates.fX"); TTreeReaderArray<Float_t> b2(fReader, "emParticles.position_.fCoordinates.fY"); TTreeReaderArray<Float_t> b3(fReader, "emParticles.position_.fCoordinates.fZ"); TTreeReaderArray<Float_t> b4(fReader, "emParticles.lambda_"); TTreeReaderArray<Float_t> b5(fReader, "emParticles.time_"); TTreeReaderArray<Float_t> h1(fReader, "hadParticles.position_.fCoordinates.fX"); TTreeReaderArray<Float_t> h2(fReader, "hadParticles.position_.fCoordinates.fY"); TTreeReaderArray<Float_t> h3(fReader, "hadParticles.position_.fCoordinates.fZ"); TTreeReaderArray<Float_t> h4(fReader, "hadParticles.lambda_"); TTreeReaderArray<Float_t> h5(fReader, "hadParticles.time_"); target->cd(); while ( fReader.Next() ) { parts->clear(); unsigned int s=b1.GetSize(); parts->resize(5*s); for ( unsigned int i=0; i<b1.GetSize(); i++) { (*parts)[i]=(b1[i]); (*parts)[i+1*s]=(b2[i]); (*parts)[i+2*s]=(b3[i]); (*parts)[i+3*s]=(b4[i]); (*parts)[i+4*s]=(b5[i]); } partsHad->clear(); s=h1.GetSize(); partsHad->resize(5*s); for ( unsigned int i=0; i<h1.GetSize(); i++) { (*partsHad)[i]=(h1[i]); (*partsHad)[i+1*s]=(h2[i]); (*partsHad)[i+2*s]=(h3[i]); (*partsHad)[i+3*s]=(h4[i]); (*partsHad)[i+4*s]=(h5[i]); } nT->Fill(); } nT->Write(); nF->Close(); }
qreal MyWidget::h() { { switch (variant) { case 5: return h5(); case 8: return h8(); } return 0; } }
void ReadMatlabSettings:: readSource(string file) { Hdf5Input h5(file); source_buffer_ = h5.tryread<Signal::pBuffer>("samples", Signal::pBuffer()); if (source_buffer_) source_buffer_->set_sample_rate ( h5.tryread<double>("samplerate", 1) ); else settings.argument_description( h5.tryread<string>("argument_description", settings.argument_description())); emit sourceRead(); }
int main() { Sac<int> s; Sac<Horloge> b1(4); s+= 4; s+= 6; s+= 9; s+= 8; IterateurSac<int> it(s); int somme; cout << "Itérateur de sac avec un sac de int" << endl; for(somme=0; !it; ++it){ somme += *it; cout << "Élément: " << *it << endl; } cout << "la somme de tous les éléments est: " << somme << endl << endl; Horloge h1(16,2,4,0); Horloge h2(5,22,56,0); Horloge h3(7,15,8,0); Horloge h4(19,7,14,0); Horloge h5(55,9,5,0); Horloge h6(1,21,22,0); b1+= h1; b1+= h2; b1+= h3; b1+= h4; b1+= h5; b1+= h6; cout << "Itérateur de sac avec un sac d'horloge" << endl; IterateurSac<Horloge> it2(b1); for(; !it2; ++it2){ cout << "Horloge: " << *it2 << endl; } system("PAUSE"); return 0; }
int main(int argc, char* argv[]) { TlGetopt opt(argc, argv, "h"); if (opt["h"] == "defined") { showHelp(opt[0]); return EXIT_SUCCESS; } std::string mat_path = opt[1]; std::string hdf5_path = opt[2]; TlDenseGeneralMatrix_Lapack mat; mat.load(mat_path); TlHdf5Utils h5(hdf5_path); return EXIT_SUCCESS; }
void ReadMatlabSettings:: readSettings(string file) { Hdf5Input h5(file); settings.arguments( h5.tryread<string>("arguments", settings.arguments()) ); settings.chunksize( h5.tryread<double>("chunk_size", settings.chunksize() )); settings.computeInOrder( 0.0 != h5.tryread<double>("compute_chunks_in_order", settings.computeInOrder())); settings.operation = 0; settings.overlap( h5.tryread<double>("overlapping", settings.overlap())); iconpath_ = h5.tryread<string>("icon", ""); settings.argument_description( h5.tryread<string>("argument_description", settings.argument_description())); bool is_source = 0.0 != h5.tryread<double>("is_source", 0.0); if (is_source) settings.setAsSource(); settings.print("ReadMatlabSettings settings"); emit settingsRead( settings ); }
void calcH(tNodeQueue *p, tNodeQueue *m, int heuristica) { m->elem->p = p->elem; switch (heuristica) { case 1: m->elem->h = h1(m->elem->matrix); break; case 2: m->elem->h = h2(m->elem->matrix); break; case 3: m->elem->h = h3(m->elem->matrix); break; case 4: m->elem->h = h4(m->elem->matrix, p1, p2, p3); break; case 5: m->elem->h = h5(m->elem->matrix); break; } m->elem->f = m->elem->h + m->elem->g; }
void test01() { { String on1; on1 = "//atp:77/root/cimv25:" "TennisPlayer.last=\"Rafter\",first=\"Patrick\""; String on2; on2 = "//atp:77/root/cimv25:" "TennisPlayer.first=\"Patrick\",last=\"Rafter\""; CIMObjectPath r = on1; PEGASUS_TEST_ASSERT(r.toString() != on1); PEGASUS_TEST_ASSERT(r.toString() == on2); CIMObjectPath r2 = r; CIMObjectPath r3 = CIMObjectPath ("//atp:77/root/cimv25:" "TennisPlayer.first=\"Chris\",last=\"Evert\""); if (verbose) { XmlWriter::printValueReferenceElement(r, false); cout << r.toString() << endl; } Buffer mofOut; MofWriter::appendValueReferenceElement(mofOut, r); r.clear(); } { CIMObjectPath r1 = CIMObjectPath ("MyClass.z=true,y=1234,x=\"Hello World\""); CIMObjectPath r2 = CIMObjectPath ("myclass.X=\"Hello World\",Z=true,Y=1234"); CIMObjectPath r3 = CIMObjectPath ("myclass.X=\"Hello\",Z=true,Y=1234"); // cout << r1.toString() << endl; // cout << r2.toString() << endl; PEGASUS_TEST_ASSERT(r1 == r2); PEGASUS_TEST_ASSERT(r1 != r3); } // Test case independence and order independence of parameters. { CIMObjectPath r1 = CIMObjectPath ("X.a=123,b=true"); CIMObjectPath r2 = CIMObjectPath ("x.B=TRUE,A=123"); PEGASUS_TEST_ASSERT(r1 == r2); PEGASUS_TEST_ASSERT(r1.makeHashCode() == r2.makeHashCode()); CIMObjectPath r3 = CIMObjectPath ("x.B=TRUE,A=123,c=FALSE"); PEGASUS_TEST_ASSERT(r1 != r3); String keyValue; Array<CIMKeyBinding> kbArray; { Boolean found = false; kbArray = r3.getKeyBindings(); for (Uint32 i = 0; i < kbArray.size(); i++) { if (verbose) { cout << "keyName= " << kbArray[i].getName().getString() << " Value= " << kbArray[i].getValue() << endl; } if ( kbArray[i].getName() == CIMName ("B") ) { keyValue = kbArray[i].getValue(); if(keyValue == "TRUE") found = true; } } if(!found) { cerr << "Key Binding Test error " << endl; exit(1); } //ATTN: KS 12 May 2002 P3 DEFER - keybinding manipulation. too // simplistic. // This code demonstrates that it is not easy to manipulate and // test keybindings. Needs better tool both in CIMObjectPath and // separate. } } // Test building from component parts of CIM Reference. { CIMObjectPath r1 ("atp:77", CIMNamespaceName ("root/cimv25"), CIMName ("TennisPlayer")); CIMObjectPath r2 ("//atp:77/root/cimv25:TennisPlayer."); //cout << "r1 " << r1.toString() << endl; //cout << "r2 " << r2.toString() << endl; PEGASUS_TEST_ASSERT(r1 == r2); PEGASUS_TEST_ASSERT(r1.toString() == r2.toString()); } { String hostName = "atp:77"; String nameSpace = "root/cimv2"; String className = "tennisplayer"; CIMObjectPath r1; r1.setHost(hostName); r1.setNameSpace(nameSpace); r1.setClassName(className); PEGASUS_TEST_ASSERT(r1.getClassName().equal(CIMName ("TENNISPLAYER"))); PEGASUS_TEST_ASSERT(!r1.getClassName().equal(CIMName ("blob"))); String newHostName = r1.getHost(); //cout << "HostName = " << newHostName << endl; CIMObjectPath r2 (hostName, nameSpace, className); PEGASUS_TEST_ASSERT(r1 == r2); } // Test cases for the Hostname. CIMObjectPaths allows the // host to include the domain. Eg. xyz.company.com // First, try a good hostname CIMObjectPath h0("//usoPen-9.ustA-1-a.org:77/root/cimv25:" "TennisPlayer.first=\"Chris\",last=\"Evert\""); CIMObjectPath h1("//usoPen-9:77/root/cimv25:" "TennisPlayer.first=\"Chris\",last=\"Evert\""); CIMObjectPath h2("//usoPen-9/root/cimv25:" "TennisPlayer.first=\"Chris\",last=\"Evert\""); CIMObjectPath h3("//usoPen-9.ustA-1-a.org:0/root/cimv25:" "TennisPlayer.first=\"Chris\",last=\"Evert\""); CIMObjectPath h4("//usoPen-9.ustA-1-a.org:9876/root/cimv25:" "TennisPlayer.first=\"Chris\",last=\"Evert\""); CIMObjectPath h5("//usoPen-9.ustA-1-a.org:65535/root/cimv25:" "TennisPlayer.first=\"Chris\",last=\"Evert\""); CIMObjectPath h6("//usopen-9.usta-1-a.1org:77/root/cimv25:" "TennisPlayer.first=\"Chris\",last=\"Evert\""); CIMObjectPath h7("//192.168.1.com:77/root/cimv25:" "TennisPlayer.first=\"Chris\",last=\"Evert\""); CIMObjectPath h8("//192.168.0.org/root/cimv25:" "TennisPlayer.first=\"Chris\",last=\"Evert\""); CIMObjectPath h9("//192.168.1.80.com:77/root/cimv25:" "TennisPlayer.first=\"Chris\",last=\"Evert\""); CIMObjectPath h10("//192.168.0.80.org/root/cimv25:" "TennisPlayer.first=\"Chris\",last=\"Evert\""); CIMObjectPath h11("//192.168.1.80.255.com:77/root/cimv25:" "TennisPlayer.first=\"Chris\",last=\"Evert\""); CIMObjectPath h12("//192.168.0.80.254.org/root/cimv25:" "TennisPlayer.first=\"Chris\",last=\"Evert\""); CIMObjectPath h13("//192.168.257.80.com:77/root/cimv25:" "TennisPlayer.first=\"Chris\",last=\"Evert\""); CIMObjectPath h14("//192.256.0.80.org/root/cimv25:" "TennisPlayer.first=\"Chris\",last=\"Evert\""); CIMObjectPath h15("//localhost/root/cimv25:" "TennisPlayer.first=\"Chris\",last=\"Evert\""); CIMObjectPath h16("//ou812/root/cimv25:" "TennisPlayer.first=\"Chris\",last=\"Evert\""); CIMObjectPath h17("//u812/root/cimv25:" "TennisPlayer.first=\"Chris\",last=\"Evert\""); // Hostname with '_' character support checks, see bug#2556. CIMObjectPath h18("//_atp:9999/_root/_cimv25:_TennisPlayer"); CIMObjectPath h19("//a_tp/_root/_cimv25:_TennisPlayer"); CIMObjectPath h20("//atp_:9999/_root/_cimv25:_TennisPlayer"); CIMObjectPath h21("//atp_-9:9999/_root/_cimv25:_TennisPlayer"); CIMObjectPath h22( "//_a_t_p_-9.ustA-1-a.org:9999/_root/_cimv25:_TennisPlayer"); CIMObjectPath h23("//_/root/cimv25:_TennisPlayer"); CIMObjectPath h24("//_______/root/cimv25:_TennisPlayer"); // try IPAddress as hostname which should be good CIMObjectPath h_ip0("//192.168.1.80:77/root/cimv25:" "TennisPlayer.first=\"Chris\",last=\"Evert\""); CIMObjectPath h_ip1("//192.168.0.255/root/cimv25:" "TennisPlayer.first=\"Chris\",last=\"Evert\""); // Try IPv6 Addresses. CIMObjectPath ip6_1("//[::1]:77/root/cimv25:" "TennisPlayer.first=\"Chris\",last=\"Evert\""); CIMObjectPath ip6_2("//[::ffff:192.1.2.3]:77/root/cimv25:" "TennisPlayer.first=\"Chris\",last=\"Evert\""); CIMObjectPath ip6_3("//[fffe:233:321:234d:e45:fad4:78:12]:77/root/cimv25:" "TennisPlayer.first=\"Chris\",last=\"Evert\""); CIMObjectPath ip6_4("//[fffe::]:77/root/cimv25:" "TennisPlayer.first=\"Chris\",last=\"Evert\""); Boolean errorDetected = false; // Invalid IPV6 Addresses try { // IPv6 addresses must be enclosed in brackets CIMObjectPath ip6_mb("//fffe::12ef:127/root/cimv25:" "TennisPlayer.first=\"Chris\",last=\"Evert\""); } catch (const Exception&) { errorDetected = true; } PEGASUS_TEST_ASSERT(errorDetected); errorDetected = false; try { // IPv6 address invalid CIMObjectPath ip6_invalid("//[fffe::sd:77]/root/cimv25:" "TennisPlayer.first=\"Chris\",last=\"Evert\""); } catch (const Exception&) { errorDetected = true; } PEGASUS_TEST_ASSERT(errorDetected); errorDetected = false; try { //Port number out of range. CIMObjectPath h_Port("//usoPen-9.ustA-1-a.org:9876543210/root/cimv25:" "TennisPlayer.first=\"Chris\",last=\"Evert\""); } catch (const Exception&) { errorDetected = true; } PEGASUS_TEST_ASSERT(errorDetected); errorDetected = false; try { //Port number out of range. CIMObjectPath h_Port("//usoPen-9.ustA-1-a.org:65536/root/cimv25:" "TennisPlayer.first=\"Chris\",last=\"Evert\""); } catch (const Exception&) { errorDetected = true; } PEGASUS_TEST_ASSERT(errorDetected); errorDetected = false; try { //Port number out of range. CIMObjectPath h_Port("//usoPen-9.ustA-1-a.org:100000/root/cimv25:" "TennisPlayer.first=\"Chris\",last=\"Evert\""); } catch (const Exception&) { errorDetected = true; } PEGASUS_TEST_ASSERT(errorDetected); errorDetected = false; try { //more than three digits in an octect CIMObjectPath h_ErrIp0("//192.1600008.1.80:77/root/cimv25:" "TennisPlayer.first=\"Chris\",last=\"Evert\""); } catch (const Exception&) { errorDetected = true; } PEGASUS_TEST_ASSERT(errorDetected); errorDetected = false; try { // Octet out of range CIMObjectPath op("//192.168.256.80:77/root/cimv25:" "TennisPlayer.first=\"Chris\",last=\"Evert\""); } catch (const Exception&) { errorDetected = true; } PEGASUS_TEST_ASSERT(errorDetected); errorDetected = false; try { // Missing port is okay, needs be ignored CIMObjectPath op("//192.168.1.80:/root/cimv25:" "TennisPlayer.first=\"Chris\",last=\"Evert\""); } catch (const Exception&) { errorDetected = true; } PEGASUS_TEST_ASSERT(!errorDetected); errorDetected = false; try { // Too many octets CIMObjectPath op("//192.168.1.80.12/root/cimv25:" "TennisPlayer.first=\"Chris\",last=\"Evert\""); } catch (const Exception&) { errorDetected = true; } PEGASUS_TEST_ASSERT(errorDetected); errorDetected = false; try { // Too few octets CIMObjectPath op("//192.168.80:77/root/cimv25:" "TennisPlayer.first=\"Chris\",last=\"Evert\""); } catch (const Exception&) { errorDetected = true; } PEGASUS_TEST_ASSERT(errorDetected); errorDetected = false; try { // Missing port is okay, needs be ignored CIMObjectPath op("//usopen-9.usta-1-a.org:/root/cimv25:" "TennisPlayer.first=\"Chris\",last=\"Evert\""); } catch (Exception&) { errorDetected = true; } PEGASUS_TEST_ASSERT(!errorDetected); errorDetected = false; try { // Hostname (IP) without trailing '/' (with port) CIMObjectPath op("//192.168.256.80:77"); } catch (const Exception&) { errorDetected = true; } PEGASUS_TEST_ASSERT(errorDetected); errorDetected = false; try { // Hostname (IP) without trailing '/' (without port) CIMObjectPath op("//192.168.256.80"); } catch (const Exception&) { errorDetected = true; } PEGASUS_TEST_ASSERT(errorDetected); errorDetected = false; try { // Hostname without trailing '/' (with port) CIMObjectPath op("//usopen-9.usta-1-a.org:77"); } catch (const Exception&) { errorDetected = true; } PEGASUS_TEST_ASSERT(errorDetected); errorDetected = false; try { // Hostname without trailing '/' (without port) CIMObjectPath op("//usopen-9.usta-1-a.org"); } catch (const Exception&) { errorDetected = true; } PEGASUS_TEST_ASSERT(errorDetected); errorDetected = false; try { // Invalid first character CIMObjectPath op("//+usopen-9.usta-1-a.1org:77/root/cimv25:" "TennisPlayer.first=\"Chris\",last=\"Evert\""); } catch (Exception&) { errorDetected = true; } PEGASUS_TEST_ASSERT(errorDetected); errorDetected = false; try { // Non-alphanum char (?) CIMObjectPath op("//usopen-9.usta?-1-a.org:77/root/cimv25:" "TennisPlayer.first=\"Chris\",last=\"Evert\""); } catch (Exception&) { errorDetected = true; } PEGASUS_TEST_ASSERT(errorDetected); errorDetected = false; try { // Leading dot CIMObjectPath op("//.usopen-9.usta-1-a.org:77/root/cimv25:" "TennisPlayer.first=\"Chris\",last=\"Evert\""); } catch (Exception&) { errorDetected = true; } PEGASUS_TEST_ASSERT(errorDetected); errorDetected = false; try { // Dot in the wrong spot (before a -) CIMObjectPath op("//usopen.-9.usta-1-a.org:77/root/cimv25:" "TennisPlayer.first=\"Chris\",last=\"Evert\""); } catch (Exception&) { errorDetected = true; } PEGASUS_TEST_ASSERT(errorDetected); errorDetected = false; try { // Two dots in a row CIMObjectPath op("//usopen-9.usta-1-a..org:77/root/cimv25:" "TennisPlayer.first=\"Chris\",last=\"Evert\""); } catch (Exception&) { errorDetected = true; } PEGASUS_TEST_ASSERT(errorDetected); errorDetected = false; try { // Trailing dot CIMObjectPath op("//usopen-9.usta-1-a.org.:77/root/cimv25:" "TennisPlayer.first=\"Chris\",last=\"Evert\""); } catch (Exception&) { errorDetected = true; } PEGASUS_TEST_ASSERT(errorDetected); }
int main(int argc, char **argv) { if (argc < 2) { ROS_ERROR_STREAM("Please provide the name of the reachability map. If you have not created it yet, Please create " "the map by running the create reachability map launch file in map_creator"); return 1; } else { ros::init(argc, argv, "workspace"); ros::NodeHandle n; // TODO: It can be published as a latched topic. So the whole message will be published just once and stay on the // topic ros::Publisher workspace_pub = n.advertise< map_creator::WorkSpace >("reachability_map", 1); // bool latchOn = 1; // ros::Publisher workspace_pub = n.advertise<map_creator::WorkSpace>("reachability_map", 1, latchOn); ros::Rate loop_rate(10); int count = 0; hdf5_dataset::Hdf5Dataset h5(argv[1]); h5.open(); MultiMapPtr pose_col_filter; MapVecDoublePtr sphere_col; float res; h5.loadMapsFromDataset(pose_col_filter, sphere_col, res); // Creating messages map_creator::WorkSpace ws; ws.header.stamp = ros::Time::now(); ws.header.frame_id = "/base_link"; ws.resolution = res; for (MapVecDoublePtr::iterator it = sphere_col.begin(); it != sphere_col.end(); ++it) { map_creator::WsSphere wss; wss.point.x = (*it->first)[0]; wss.point.y = (*it->first)[1]; wss.point.z = (*it->first)[2]; wss.ri = it->second; for (MultiMapPtr::iterator it1 = pose_col_filter.lower_bound(it->first); it1 != pose_col_filter.upper_bound(it->first); ++it1) { geometry_msgs::Pose pp; pp.position.x = it1->second->at(0); pp.position.y = it1->second->at(1); pp.position.z = it1->second->at(2); pp.orientation.x = it1->second->at(3); pp.orientation.y = it1->second->at(4); pp.orientation.z = it1->second->at(5); pp.orientation.w = it1->second->at(6); wss.poses.push_back(pp); } ws.WsSpheres.push_back(wss); } while (ros::ok()) { workspace_pub.publish(ws); ros::spinOnce(); sleep(5); ++count; } } return 0; }
/* --std=c90 -Wv */ void f1(void) { int i; struct tag { int x; } x; int *p; i(); x(); p(); } void f2(void) { void h2(int, double); void g2(); h2(0, 1); g2(0, 1); } /* prototype vs. non-prototype */ void f3(void) { struct tag { int x; } h3(void), x; int g3(void), y; x = h3(); y = g3(); } /* struct vs. non-struct */ void f4(void) { struct tag h4(void); h4(); } /* error - incomplete return */ void f5(void) { void h5(int, double); void g5(void); h5(0, 1); g5(); } /* argument vs. no argument */
MarkdownEdit::MarkdownEdit(LiteApi::IApplication *app, LiteApi::IEditor *editor, QObject *parent) : QObject(parent), m_liteApp(app) { m_editor = LiteApi::getTextEditor(editor); if (!m_editor) { return; } m_ed = LiteApi::getPlainTextEdit(editor); if (!m_ed) { return; } m_ed->setLineWrapMode(QPlainTextEdit::WidgetWidth); LiteApi::IActionContext *actionContext = m_liteApp->actionManager()->getActionContext(this,"Markdown"); QAction *h1 = new QAction(QIcon("icon:markdown/images/h1.png"),tr("Header (h1)"),this); actionContext->regAction(h1,"Header1","Ctrl+1"); QAction *h2 = new QAction(QIcon("icon:markdown/images/h2.png"),tr("Header (h2)"),this); actionContext->regAction(h2,"Header2","Ctrl+2"); QAction *h3 = new QAction(QIcon("icon:markdown/images/h3.png"),tr("Header (h3)"),this); actionContext->regAction(h3,"Header3","Ctrl+3"); QAction *h4 = new QAction(QIcon("icon:markdown/images/h4.png"),tr("Header (h4)"),this); actionContext->regAction(h4,"Header4","Ctrl+4"); QAction *h5 = new QAction(QIcon("icon:markdown/images/h5.png"),tr("Header (h5)"),this); actionContext->regAction(h5,"Header5","Ctrl+5"); QAction *h6 = new QAction(QIcon("icon:markdown/images/h6.png"),tr("Header (h6)"),this); actionContext->regAction(h6,"Header6","Ctrl+6"); QAction *bold = new QAction(QIcon("icon:markdown/images/bold.png"),tr("Bold"),this); actionContext->regAction(bold,"Bold",QKeySequence::Bold); QAction *italic = new QAction(QIcon("icon:markdown/images/italic.png"),tr("Italic"),this); actionContext->regAction(italic,"Italic",QKeySequence::Italic); QAction *code = new QAction(QIcon("icon:markdown/images/code.png"),tr("Inline Code"),this); actionContext->regAction(code,"InlineCode","Ctrl+K"); QAction *link = new QAction(QIcon("icon:markdown/images/link.png"),tr("Link"),this); actionContext->regAction(link,"Link","Ctrl+Shift+L"); QAction *image = new QAction(QIcon("icon:markdown/images/image.png"),tr("Image"),this); actionContext->regAction(image,"Image","Ctrl+Shift+I"); QAction *ul = new QAction(QIcon("icon:markdown/images/ul.png"),tr("Unordered List"),this); actionContext->regAction(ul,"UnorderedList","Ctrl+Shift+U"); QAction *ol = new QAction(QIcon("icon:markdown/images/ol.png"),tr("Ordered List"),this); actionContext->regAction(ol,"OrderedList","Ctrl+Shift+O"); QAction *bq = new QAction(QIcon("icon:markdown/images/quote.png"),tr("Blockquote"),this); actionContext->regAction(bq,"Blockquote","Ctrl+Shift+Q"); QAction *hr = new QAction(QIcon("icon:markdown/images/hr.png"),tr("Horizontal Rule"),this); actionContext->regAction(hr,"HorizontalRule","Ctrl+Shift+H"); QToolBar *toolBar = LiteApi::findExtensionObject<QToolBar*>(editor,"LiteApi.QToolBar"); QMenu *menu = LiteApi::getEditMenu(editor); if (menu) { menu->addSeparator(); QMenu *h = menu->addMenu(tr("Heading")); h->addAction(h1); h->addAction(h2); h->addAction(h3); h->addAction(h4); h->addAction(h5); h->addAction(h6); menu->addSeparator(); menu->addAction(link); menu->addAction(image); menu->addSeparator(); menu->addAction(bold); menu->addAction(italic); menu->addAction(code); menu->addSeparator(); menu->addAction(ul); menu->addAction(ol); menu->addSeparator(); menu->addAction(bq); menu->addAction(hr); } menu = LiteApi::getContextMenu(editor); if (menu) { menu->addSeparator(); menu->addAction(link); menu->addAction(image); menu->addSeparator(); menu->addAction(bold); menu->addAction(italic); menu->addAction(code); menu->addSeparator(); menu->addAction(ul); menu->addAction(ol); menu->addSeparator(); menu->addAction(bq); menu->addAction(hr); } if (toolBar) { toolBar->addSeparator(); toolBar->addAction(h1); toolBar->addAction(h2); toolBar->addAction(h3); toolBar->addSeparator(); toolBar->addAction(link); toolBar->addAction(image); toolBar->addSeparator(); toolBar->addAction(bold); toolBar->addAction(italic); toolBar->addAction(code); toolBar->addSeparator(); toolBar->addAction(ul); toolBar->addAction(ol); toolBar->addSeparator(); toolBar->addAction(bq); toolBar->addAction(hr); //updateToolTip(toolBar); } connect(editor,SIGNAL(destroyed()),this,SLOT(deleteLater())); connect(h1,SIGNAL(triggered()),this,SLOT(h1())); connect(h2,SIGNAL(triggered()),this,SLOT(h2())); connect(h3,SIGNAL(triggered()),this,SLOT(h3())); connect(h4,SIGNAL(triggered()),this,SLOT(h4())); connect(h5,SIGNAL(triggered()),this,SLOT(h5())); connect(h6,SIGNAL(triggered()),this,SLOT(h6())); connect(bold,SIGNAL(triggered()),this,SLOT(bold())); connect(italic,SIGNAL(triggered()),this,SLOT(italic())); connect(code,SIGNAL(triggered()),this,SLOT(code())); connect(link,SIGNAL(triggered()),this,SLOT(link())); connect(image,SIGNAL(triggered()),this,SLOT(image())); connect(ul,SIGNAL(triggered()),this,SLOT(ul())); connect(ol,SIGNAL(triggered()),this,SLOT(ol())); connect(bq,SIGNAL(triggered()),this,SLOT(bq())); connect(hr,SIGNAL(triggered()),this,SLOT(hr())); //m_ed->installEventFilter(this); }
void TestStelSphericalGeometry::testSphericalCap() { Vec3d p0(1.,0.,0.); Vec3d p1(-1.,0.,0.); Vec3d p2(1.,1.,1.); p2.normalize(); Vec3d p3(0.,1.,0.); SphericalCap h0(p0, 0.); SphericalCap h1(p0, 0.8); SphericalCap h2(p0, -0.5); SphericalCap h3(p1, 0.5); SphericalCap h4(p2, 0.8); SphericalCap h5(p2, 1.); SphericalCap h6(p1, 0.); QVERIFY2(h0.contains(p0), "SphericalCap contains point failure"); QVERIFY2(h1.contains(p0), "SphericalCap contains point failure"); QVERIFY2(h0.contains(p3), "SphericalCap contains point on the edge failure"); QVERIFY2(h6.contains(p3), "SphericalCap contains point on the edge failure"); QVERIFY(h0.intersects(h1)); QVERIFY(h0.intersects(h2)); QVERIFY(h1.intersects(h2)); QVERIFY(h4.intersects(h1)); QVERIFY(!h0.intersects(h3)); QVERIFY(!h1.intersects(h3)); QVERIFY(h2.intersects(h3)); QVERIFY(h0.intersects(h5)); QVERIFY(h0.intersects(h0)); QVERIFY(h1.intersects(h1)); QVERIFY(h2.intersects(h2)); QVERIFY(h3.intersects(h3)); QVERIFY(h4.intersects(h4)); QVERIFY(h5.intersects(h5)); QVERIFY(h6.intersects(h0)); QVERIFY(h0.intersects(h6)); QVERIFY(h0.contains(h1)); QVERIFY(!h1.contains(h0)); QVERIFY(h2.contains(h0)); QVERIFY(!h0.contains(h2)); QVERIFY(!h6.contains(h0)); QVERIFY(!h0.contains(h6)); QVERIFY(h2.contains(h1)); QVERIFY(!h1.contains(h2)); QVERIFY(!h0.contains(h3)); QVERIFY(!h1.contains(h3)); QVERIFY(h0.contains(h5)); QVERIFY(h2.contains(h5)); QVERIFY(!h5.contains(h0)); QVERIFY(!h5.contains(h1)); QVERIFY(!h5.contains(h2)); QVERIFY(!h5.contains(h3)); QVERIFY(!h5.contains(h4)); QVERIFY(h0.contains(h0)); QVERIFY(h1.contains(h1)); QVERIFY(h2.contains(h2)); QVERIFY(h3.contains(h3)); QVERIFY(h4.contains(h4)); QVERIFY(h5.contains(h5)); }