当前位置: 首页>>代码示例>>C++>>正文


C++ ia函数代码示例

本文整理汇总了C++中ia函数的典型用法代码示例。如果您正苦于以下问题:C++ ia函数的具体用法?C++ ia怎么用?C++ ia使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了ia函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: test_main

int test_main( int /* argc */, char* /* argv */[] )
{
    const char * testfile = boost::archive::tmpnam(NULL);
    
    BOOST_REQUIRE(NULL != testfile);

    const A *ta = new A();
    A *ta1 = NULL;

    {   
        test_ostream os(testfile, TEST_STREAM_FLAGS);
        test_oarchive oa(os, TEST_ARCHIVE_FLAGS);
        oa << boost::serialization::make_nvp("ta", ta);
    }
    {
        test_istream is(testfile, TEST_STREAM_FLAGS);
        test_iarchive ia(is, TEST_ARCHIVE_FLAGS);
        ia >> boost::serialization::make_nvp("ta", ta1);
    }
    BOOST_CHECK(ta != ta1);
    BOOST_CHECK(*ta == *ta1);
    std::remove(testfile);
    return EXIT_SUCCESS;
}
开发者ID:LancelotGHX,项目名称:Simula,代码行数:24,代码来源:test_simple_class_ptr.cpp

示例2: check

 void CheckPoint::load(DispatcherMessage *dispMsg, DispatcherNode *dispNode) {
     console.ConsoleOut("Восстановление из контрольной точки включено");
     std::fstream check("check.txt");
     std::size_t count = 0;
     if(check) {
         console.ConsoleOut("Начинаю восстановление из глобальной контрольной точки");
         console.ConsoleOut("Всего задач: " + std::to_string(dispMsg -> getReserveSizeQueueFinal()));
         while (!check.eof()) {
             Elem out;
             try {
                 boost::archive::text_iarchive ia(check);
                 ia >> out;
             }
             catch(...) {
                 break;
             }
             console.ConsoleOut("Восстанавливаю задачу: " + std::to_string(out.getNumberInVectorTask()));
             count++;
             dispMsg -> addFinalTask(out.getOutArgs());
             dispNode -> setTrues(out.getNumberInVectorTask());
         }
         console.ConsoleOut("Восстановлено из контрольной точки " + std::to_string(count) + "/" + std::to_string(dispMsg -> getReserveSizeQueueFinal()));
     }
     else {
开发者ID:Maksumys,项目名称:FTCL,代码行数:24,代码来源:checkpoint.cpp

示例3: test_vector

int test_vector(T)
{
    const char * testfile = boost::archive::tmpnam(NULL);
    BOOST_REQUIRE(NULL != testfile);

    // test array of objects
    std::vector<T> avector;
    avector.push_back(T());
    avector.push_back(T());
    {   
        test_ostream os(testfile, TEST_STREAM_FLAGS);
        test_oarchive oa(os, TEST_ARCHIVE_FLAGS);
        oa << boost::serialization::make_nvp("avector", avector);
    }
    std::vector<T> avector1;
    {
        test_istream is(testfile, TEST_STREAM_FLAGS);
        test_iarchive ia(is, TEST_ARCHIVE_FLAGS);
        ia >> boost::serialization::make_nvp("avector", avector1);
    }
    BOOST_CHECK(avector == avector1);
    std::remove(testfile);
    return EXIT_SUCCESS;
}
开发者ID:LancelotGHX,项目名称:Simula,代码行数:24,代码来源:performance_vector.cpp

示例4: test_map

void
test_map(){
    const char * testfile = boost::archive::tmpnam(NULL);
    BOOST_REQUIRE(NULL != testfile);

    BOOST_MESSAGE("map");
    // test map of objects
    std::map<random_key, A> amap;
    amap.insert(std::make_pair(random_key(), A()));
    amap.insert(std::make_pair(random_key(), A()));
    {   
        test_ostream os(testfile, TEST_STREAM_FLAGS);
        test_oarchive oa(os, TEST_ARCHIVE_FLAGS);
        oa << boost::serialization::make_nvp("amap", amap);
    }
    std::map<random_key, A> amap1;
    {
        test_istream is(testfile, TEST_STREAM_FLAGS);
        test_iarchive ia(is, TEST_ARCHIVE_FLAGS);
        ia >> boost::serialization::make_nvp("amap", amap1);
    }
    BOOST_CHECK(amap == amap1);
    std::remove(testfile);
}
开发者ID:Cabriter,项目名称:abelkhan,代码行数:24,代码来源:test_map.cpp

示例5: loadMat

void loadMat(cv::Mat& m, std::string filename) {
	std::ifstream ifs(filename.c_str());
	boost::archive::binary_iarchive ia(ifs);
	//boost::archive::text_iarchive ia(ifs);
	ia >> m;
}
开发者ID:Aharobot,项目名称:modern-occupancy-grid,代码行数:6,代码来源:cvmat_serialization.cpp

示例6: operator

CrsGraph_AMD::NewTypeRef
CrsGraph_AMD::
operator()( OriginalTypeRef orig )
{
  origObj_ = &orig;

  int n = orig.NumMyRows();
  int nnz = orig.NumMyNonzeros();

  //create std CRS format
  std::vector<int> ia(n+1,0);
  std::vector<int> ja(nnz);
  int cnt;
  for( int i = 0; i < n; ++i )
  {
    int * tmpP = &ja[ia[i]];
    orig.ExtractMyRowCopy( i, nnz-ia[i], cnt, tmpP );
    ia[i+1] = ia[i] + cnt;
  }

  //trim down to local only
  std::vector<int> iat(n+1);
  std::vector<int> jat(nnz);
  int loc = 0;
  for( int i = 0; i < n; ++i )
  {
    iat[i] = loc;
    for( int j = ia[i]; j < ia[i+1]; ++j )
    {
      if( ja[j] < n )
        jat[loc++] = ja[j];
      else
	break;
    }
  }
  iat[n] = loc;


  if( verbose_ )
  {
    std::cout << "Orig Graph\n";
    std::cout << orig << std::endl;
    std::cout << "-----------------------------------------\n";
    std::cout << "CRS Format Graph\n";
    std::cout << "-----------------------------------------\n";
    for( int i = 0; i < n; ++i )
    {
      std::cout << i << ": " << iat[i+1] << ": ";
      for( int j = iat[i]; j<iat[i+1]; ++j )
        std::cout << " " << jat[j];
      std::cout << std::endl;
    }
    std::cout << "-----------------------------------------\n";
  }

  std::vector<int> perm(n);
  std::vector<double> info(AMD_INFO);

  amd_order( n, &iat[0], &jat[0], &perm[0], NULL, &info[0] ); 

  if( info[AMD_STATUS] == AMD_INVALID )
    std::cout << "AMD ORDERING: Invalid!!!!\n";

  if( verbose_ )
  {
    std::cout << "-----------------------------------------\n";
    std::cout << "AMD Output\n";
    std::cout << "-----------------------------------------\n";
    std::cout << "STATUS: " << info[AMD_STATUS] << std::endl;
    std::cout << "SYMM: " << info[AMD_SYMMETRY] << std::endl;
    std::cout << "N: " << info[AMD_N] << std::endl;
    std::cout << "NZ: " << info[AMD_NZ] << std::endl;
    std::cout << "SYMM: " << info[AMD_SYMMETRY] << std::endl;
    std::cout << "NZDIAG: " << info[AMD_NZDIAG] << std::endl;
    std::cout << "NZ A+At: " << info[AMD_NZ_A_PLUS_AT] << std::endl;
    std::cout << "NDENSE: " << info[AMD_SYMMETRY] << std::endl;
    std::cout << "Perm\n";
    for( int i = 0; i<n; ++i )
      std::cout << perm[i] << std::endl;
    std::cout << "-----------------------------------------\n";
  }

  //Generate New Domain and Range Maps
  //for now, assume they start out as identical
  const Epetra_BlockMap & OldMap = orig.RowMap();
  int nG = orig.NumGlobalRows();

  std::vector<int> newElements( n );
  for( int i = 0; i < n; ++i )
    newElements[i] = OldMap.GID( perm[i] );

  NewMap_ = new Epetra_Map( nG, n, &newElements[0], OldMap.IndexBase(), OldMap.Comm() );

  if( verbose_ )
  {
    std::cout << "Old Map\n";
    std::cout << OldMap << std::endl;
    std::cout << "New Map\n";
    std::cout << *NewMap_ << std::endl;
  }
//.........这里部分代码省略.........
开发者ID:00liujj,项目名称:trilinos,代码行数:101,代码来源:EpetraExt_AMD_CrsGraph.cpp

示例7: main

int main(int argc, char *argv[]){

	srand(time(NULL));
	int mouse_x, mouse_y; 

	sf::RenderWindow window_game (sf::VideoMode(900, 700), "Gamemilans!",
	sf::Style::Resize|sf::Style::Close);
	
//	sf::RenderWindow window_game (sf::VideoMode::getDesktopMode(), "Gamemilans!",
//		sf::Style::Resize|sf::Style::Close);

	sf::Music music;
	if (!music.openFromFile("music/GameSong1.ogg")) std::cout << " no puc carregar la musica " << std::endl;
	music.play();
	music.setPitch(1);
	music.setLoop(true);

		sf::Clock clock;
		
	window_game.setVerticalSyncEnabled(true);

		window_game.display();
		Presentacio p(window_game);
		p.portada();
		window_game.display();

			p.portada(); 
			window_game.display();
		while (p.handler() != 0){
		}
		window_game.clear();

			p.inst(1); 
			window_game.display();
		while (p.handler() != 0){
		}
		window_game.clear();

			p.inst(2); 
			window_game.display();
		while (p.handler() != 0){
		}
		window_game.clear();

		p.prepareText();
		int n_murs = p.handler();
		int oldmurs = n_murs;
			p.murs(); 
			window_game.display();
		while (n_murs < 0){
			n_murs = p.handler();
			if(n_murs != oldmurs){
				p.murs(); 
				window_game.display();
				oldmurs = n_murs;
			}
		}
		window_game.clear();

	Board taulell(window_game);
	Logica logica(taulell);
 	Ia ia(0);
 	Ia ia2(1);

	taulell.draw();
	logica.print_me_the_players();
	for(int i = 0; i < n_murs; ++i)
		logica.print_me_random_wall();

	bool is_server = false;
	bool online = false;
	bool ia_playing = false;

	int port;
	if(argc >= 2){
		int n;
		if(argc >= 3) {
			if((*(argv[2])) == 'S') is_server = true;
			if((*(argv[2])) == 'I') ia_playing = true;
			if((*(argv[2])) != 'I') online = true;
		}
		if((*(argv[1]))-'0' >= 0) n = atoi((argv[1]));
		else n = 2; /*(?) think it have no sense*/
		for(int i = 0; i < n; ++i) logica.print_me_random_wall();	
	}
	taulell.draw();
	window_game.display(); 
	
	sf::TcpSocket socket;
	sf::TcpSocket client;
	sf::TcpListener listener;

	if( (argc >= 3) and online) { 	//Is online so you have to connect the socket
		port = 53000;
		if(not is_server){
			//Connect the socket
			sf::Socket::Status status = socket.connect("127.0.0.1", port);
			if (status != sf::Socket::Done)	{
				std::cout << "Not conected the socket okly" << std::endl;
			}
//.........这里部分代码省略.........
开发者ID:Dirbaio,项目名称:Gamemilans,代码行数:101,代码来源:main.cpp

示例8: IFPACK2_CHK_ERR

//==============================================================================
int Ifpack2_AMDReordering::Compute(const Ifpack2_Graph& Graph)
{
  IsComputed_ = false;
  NumMyRows_ = Graph.NumMyRows();
  int NumNz = Graph.NumMyNonzeros();
  
  if (NumMyRows_ == 0)
    IFPACK2_CHK_ERR(-1); // strange graph this one
  
  // Extract CRS format
  vector<int> ia(NumMyRows_+1,0);
  vector<int> ja(NumNz);
  int cnt;
  for( int i = 0; i < NumMyRows_; ++i )
  {
    int * tmpP = &ja[ia[i]];
    Graph.ExtractMyRowCopy( i, NumNz-ia[i], cnt, tmpP );
    ia[i+1] = ia[i] + cnt;
  }

  // Trim down to local only
  vector<int> iat(NumMyRows_+1);
  vector<int> jat(NumNz);
  int loc = 0;
  for( int i = 0; i < NumMyRows_; ++i )
  {
    iat[i] = loc;
    for( int j = ia[i]; j < ia[i+1]; ++j )
    {
      if( ja[j] < NumMyRows_ )
        jat[loc++] = ja[j];
      else
	break;
    }
  }
  iat[NumMyRows_] = loc;

  // Compute AMD permutation
  Reorder_.resize(NumMyRows_);
  vector<double> info(AMD_INFO);

  amesos_amd_order( NumMyRows_, &iat[0], &jat[0], &Reorder_[0], NULL, &info[0] );

  if( info[AMD_STATUS] == AMD_INVALID )
    cout << "AMD ORDERING: Invalid!!!!\n";

  // Build inverse reorder (will be used by ExtractMyRowCopy() 
  InvReorder_.resize(NumMyRows_);

  for (int i = 0 ; i < NumMyRows_ ; ++i)
    InvReorder_[i] = -1;

  for (int i = 0 ; i < NumMyRows_ ; ++i)
    InvReorder_[Reorder_[i]] = i;

  for (int i = 0 ; i < NumMyRows_ ; ++i) {
    if (InvReorder_[i] == -1)
      IFPACK2_CHK_ERR(-1);
  }

  IsComputed_ = true;
  return(0);
}
开发者ID:haripandey,项目名称:trilinos,代码行数:64,代码来源:Ifpack2_AMDReordering.cpp

示例9: put_flog

void DisplayGroupManager::calibrateTimestampOffset()
{
    // can't calibrate timestamps unless we have at least 2 processes
    if(g_mpiSize < 2)
    {
        put_flog(LOG_DEBUG, "cannot calibrate with g_mpiSize == %i", g_mpiSize);
        return;
    }

    // synchronize all processes
    MPI_Barrier(g_mpiRenderComm);

    // get current timestamp immediately after
    boost::posix_time::ptime timestamp(boost::posix_time::microsec_clock::universal_time());

    // rank 1: send timestamp to rank 0
    if(g_mpiRank == 1)
    {
        // serialize state
        std::ostringstream oss(std::ostringstream::binary);

        // brace this so destructor is called on archive before we use the stream
        {
            boost::archive::binary_oarchive oa(oss);
            oa << timestamp;
        }

        // serialized data to string
        std::string serializedString = oss.str();
        int size = serializedString.size();

        // send the header and the message
        MessageHeader mh;
        mh.size = size;

        MPI_Send((void *)&mh, sizeof(MessageHeader), MPI_BYTE, 0, 0, MPI_COMM_WORLD);
        MPI_Send((void *)serializedString.data(), size, MPI_BYTE, 0, 0, MPI_COMM_WORLD);
    }
    // rank 0: receive timestamp from rank 1
    else if(g_mpiRank == 0)
    {
        MessageHeader messageHeader;

        MPI_Status status;
        MPI_Recv((void *)&messageHeader, sizeof(MessageHeader), MPI_BYTE, 1, 0, MPI_COMM_WORLD, &status);

        // receive serialized data
        char * buf = new char[messageHeader.size];

        // read message into the buffer
        MPI_Recv((void *)buf, messageHeader.size, MPI_BYTE, 1, 0, MPI_COMM_WORLD, &status);

        // de-serialize...
        std::istringstream iss(std::istringstream::binary);

        if(iss.rdbuf()->pubsetbuf(buf, messageHeader.size) == NULL)
        {
            put_flog(LOG_FATAL, "rank %i: error setting stream buffer", g_mpiRank);
            exit(-1);
        }

        // read to a new timestamp
        boost::posix_time::ptime rank1Timestamp;

        boost::archive::binary_iarchive ia(iss);
        ia >> rank1Timestamp;

        // free mpi buffer
        delete [] buf;

        // now, calculate and store the timestamp offset
        timestampOffset_ = rank1Timestamp - timestamp;

        put_flog(LOG_DEBUG, "timestamp offset = %s", (boost::posix_time::to_simple_string(timestampOffset_)).c_str());
    }
开发者ID:bweyers,项目名称:DisplayCluster,代码行数:75,代码来源:DisplayGroupManager.cpp

示例10: in

void in(const char *testfile, A & a)
{
    test_istream is(testfile, TEST_STREAM_FLAGS);
    test_iarchive ia(is);
    ia >> BOOST_SERIALIZATION_NVP(a);
}
开发者ID:AndroidAppList,项目名称:Android-Supertux,代码行数:6,代码来源:test_object.cpp

示例11: test_main

int test_main( int /* argc */, char* /* argv */[] )
{
    const char * testfile = boost::archive::tmpnam(NULL);
    BOOST_REQUIRE(NULL != testfile);

    const A a;
    char s1[] = "a";
    char s2[] = "ab";
    char s3[] = "abc";
    char s4[] = "abcd";
    const int i = 12345;

    A a1;
    char s1_1[10];
    char s1_2[10];
    char s1_3[10];
    char s1_4[10];
    int i1 = 34790;

    std::memset(s1_1, '\0', sizeof(s1_1));
    std::memset(s1_2, '\0', sizeof(s1_2));
    std::memset(s1_3, '\0', sizeof(s1_3));
    std::memset(s1_4, '\0', sizeof(s1_4));
    {
        test_ostream os(testfile, TEST_STREAM_FLAGS);
        test_oarchive oa(os, TEST_ARCHIVE_FLAGS);
        oa << boost::serialization::make_nvp(
            "s1", 
            boost::serialization::make_binary_object(
                s1, 
                sizeof(s1)
            )
        );
        oa << boost::serialization::make_nvp(
            "s2", 
            boost::serialization::make_binary_object(
                s2, 
                sizeof(s2)
            )
        );
        oa << boost::serialization::make_nvp(
            "s3", 
            boost::serialization::make_binary_object(
                s3, 
                sizeof(s3)
            )
        );
        oa << boost::serialization::make_nvp(
            "s4", 
            boost::serialization::make_binary_object(
                s4, 
                sizeof(s4)
            )
        );
        oa << BOOST_SERIALIZATION_NVP(a);
        // note: add a little bit on the end of the archive to detect
        // failure of text mode binary.
        oa << BOOST_SERIALIZATION_NVP(i);
    }
    {
        test_istream is(testfile, TEST_STREAM_FLAGS);
        test_iarchive ia(is, TEST_ARCHIVE_FLAGS);
        ia >> boost::serialization::make_nvp(
            "s1", 
            boost::serialization::make_binary_object(
                s1_1, 
                sizeof(s1)
            )
        );
        ia >> boost::serialization::make_nvp(
            "s2", 
            boost::serialization::make_binary_object(
                s1_2, 
                sizeof(s2)
            )
        );
        ia >> boost::serialization::make_nvp(
            "s3", 
            boost::serialization::make_binary_object(
                s1_3, 
                sizeof(s3)
            )
        );
        ia >> boost::serialization::make_nvp(
            "s4", 
            boost::serialization::make_binary_object(
                s1_4, 
                sizeof(s4)
            )
        );
        ia >> BOOST_SERIALIZATION_NVP(a1);
        // note: add a little bit on the end of the archive to detect
        // failure of text mode binary.
        ia >> BOOST_SERIALIZATION_NVP(i1);
    }
    BOOST_CHECK(0 == std::strcmp(s1, s1_1));
    BOOST_CHECK(0 == std::strcmp(s2, s1_2));
    BOOST_CHECK(0 == std::strcmp(s3, s1_3));
    BOOST_CHECK(0 == std::strcmp(s4, s1_4));
    BOOST_CHECK(a == a1);
//.........这里部分代码省略.........
开发者ID:LancelotGHX,项目名称:Simula,代码行数:101,代码来源:test_binary.cpp

示例12: render_raster_marker

    void render_raster_marker(agg::trans_affine const& marker_tr,
                              double opacity)
    {
        using pixfmt_pre = agg::pixfmt_rgba32_pre;
        agg::scanline_u8 sl_;
        double width  = src_.width();
        double height = src_.height();
        if (std::fabs(1.0 - scale_factor_) < 0.001
            && (std::fabs(1.0 - marker_tr.sx) < agg::affine_epsilon)
            && (std::fabs(0.0 - marker_tr.shy) < agg::affine_epsilon)
            && (std::fabs(0.0 - marker_tr.shx) < agg::affine_epsilon)
            && (std::fabs(1.0 - marker_tr.sy) < agg::affine_epsilon))
        {
            agg::rendering_buffer src_buffer((unsigned char *)src_.getBytes(),src_.width(),src_.height(),src_.width() * 4);
            pixfmt_pre pixf_mask(src_buffer);
            if (snap_to_pixels_)
            {
                renb_.blend_from(pixf_mask,
                                 0,
                                 std::floor(marker_tr.tx + .5),
                                 std::floor(marker_tr.ty + .5),
                                 unsigned(255*opacity));
            }
            else
            {
                renb_.blend_from(pixf_mask,
                                 0,
                                 marker_tr.tx,
                                 marker_tr.ty,
                                 unsigned(255*opacity));
            }
        }
        else
        {
            using img_accessor_type = agg::image_accessor_clone<pixfmt_pre>;
            using interpolator_type = agg::span_interpolator_linear<>;
            //using span_gen_type = agg::span_image_filter_rgba_2x2<img_accessor_type,interpolator_type>;
            using span_gen_type = agg::span_image_resample_rgba_affine<img_accessor_type>;
            using renderer_type = agg::renderer_scanline_aa_alpha<renderer_base,
                                                                  agg::span_allocator<color_type>,
                                                                  span_gen_type>;

            double p[8];
            p[0] = 0;     p[1] = 0;
            p[2] = width; p[3] = 0;
            p[4] = width; p[5] = height;
            p[6] = 0;     p[7] = height;
            marker_tr.transform(&p[0], &p[1]);
            marker_tr.transform(&p[2], &p[3]);
            marker_tr.transform(&p[4], &p[5]);
            marker_tr.transform(&p[6], &p[7]);
            agg::span_allocator<color_type> sa;
            agg::image_filter_lut filter;
            filter.calculate(agg::image_filter_bilinear(), true);
            agg::rendering_buffer marker_buf((unsigned char *)src_.getBytes(),
                                             src_.width(),
                                             src_.height(),
                                             src_.width()*4);
            pixfmt_pre pixf(marker_buf);
            img_accessor_type ia(pixf);
            agg::trans_affine final_tr(p, 0, 0, width, height);
            if (snap_to_pixels_)
            {
                final_tr.tx = std::floor(final_tr.tx+.5);
                final_tr.ty = std::floor(final_tr.ty+.5);
            }
            interpolator_type interpolator(final_tr);
            span_gen_type sg(ia, interpolator, filter);
            renderer_type rp(renb_,sa, sg, unsigned(opacity*255));
            ras_.move_to_d(p[0],p[1]);
            ras_.line_to_d(p[2],p[3]);
            ras_.line_to_d(p[4],p[5]);
            ras_.line_to_d(p[6],p[7]);
            agg::render_scanlines(ras_, sl_, rp);
        }
    }
开发者ID:eponymous1968,项目名称:mapnik,代码行数:76,代码来源:marker_helpers.hpp

示例13: ia

void ScientificProcessor::loadAllCells(std::fstream &filestr)
{
    boost::archive::text_iarchive ia(filestr);
    ia >> allCells;
    filestr.close();
}
开发者ID:tmramalho,项目名称:bigCellBrotherGUI,代码行数:6,代码来源:ScientificProcessor.cpp

示例14: ia

inline void
irccon::parse (const string & what)
{
	//m_parser.enterMutex();
	ircargs ia (htmlspecialchars(what));
	/*
	  Insertme:
	  if (ia.command() == "NICK") {
	    yace->irc().insertUser(ia.arg(0), ia(arg4));
	    replace(yace->sql().getString("enters"),"%CNAME%",ia.arg(0));
	    return;
	  }
	*/
	if (ia.command () == "PRIVMSG")
	{
		  commandargs ca(ia.rest());
	  if (ia.arg(0) == "YaCEServ") {
		  if (ia.prefix() == "NickServ") {
			  yace->sql().insertRegistry(ca.arg(0),ca.arg(1),ca.arg(2));
		   	  //m_parser.leaveMutex();
			  return;
			}

			// YaCEServ needs OperServ access for some Features
			commandargs ca(ia.rest());
			typedef hash_map<string, commandfunc> commandmap;
			string command;
			commandargs argz("");
			commandfunc f;
			commandmap cmds;
      register_commands(cmds);
			
			bool iscmd = false;
			if (ca.arg(0) == "help") {
			  cout << "HELP REQUEST!" << endl;
			  iscmd = false;
			  yace->irc().send(":YaCEServ PRIVMSG " + ia.prefix() + ": YaCEServ Help:");
				yace->irc().send(":YaCEServ PRIVMSG " + ia.prefix() + ": Pic <url>: Inserts picture");
				yace->irc().send(":YaCEServ PRIVMSG " + ia.prefix() + ": YaCEServ Sound <url>: Inserts Sound");
			  yace->irc().send(":YaCEServ PRIVMSG " + ia.prefix() + ": YaCEServ Vipmsg <text>: Vipmsg with <text>");
			  yace->irc().send(":YaCEServ PRIVMSG " + ia.prefix() + ": YaCEServ Amsg <text>: Admin msg with <text>");
			}
			else if (ca.arg(0) == "Pic") {
			  iscmd = true;
				command = "p";
				argz = ca.rest(0);
			}
			if (iscmd) {
			  f = cmds[command];
			  f(ia.prefix(),argz);
			}
		}

	  user* u = yace->users().getUser(ia.prefix());
		u->incrProp("said");
		u->isetProp("silence",0);

		if (ia.arg (0)[0] == '#')
		{
			if (ia.rest ()[0] == (char) 1)
			{
				string s_me = ia.rest ().substr (0, ia.rest ().length () - 2);
				s_me = s_me.substr (s_me.find (" "), s_me.length () - s_me.find ("N"));
				i2y_me (ia.prefix (), s_me, ia.arg(0));
			    //m_parser.leaveMutex();
				return;
				} else {
				i2y_say (ia.prefix (), ia.rest (), ia.arg (0));
		        //m_parser.leaveMutex();
				return; 
				}
			} else {
			i2y_whisper (ia.prefix (), ia.rest (), ia.arg (0));
		//m_parser.leaveMutex();
		return;
		}
	} else	if (ia.command() == "PING")
	{
		string pong = "PONG " + name + " " + ia.arg (0);
		yace->irc ().send (pong);
		//m_parser.leaveMutex();
		return;
	}
	else if (ia.command() == "TOPIC") 
	{
	  string msg = yace->sql().getString("settopic");
		msg = replaceCommon(msg);
		msg = replaceUser(ia.prefix(), msg);
		msg = replace(msg, "%TEXT%", ia.rest().substr(0, ia.rest().length()-1));
		sendRoomU(ia.prefix(),msg);
	  setTopic(getRoom(ia.arg(0)),ia.rest());
	  //m_parser.leaveMutex();
		return;
	}
  else if (ia.command() == "NICK")
	{
	  if (ia.prefix() != "") {
			string tosend;
			tosend = yace->sql().getString("nick");
			tosend = replaceCommon(tosend);
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:yace3,代码行数:101,代码来源:irccon.cpp

示例15: main

int main(int argc, char** argv)
{	
	size_t nof_peptides = 10;
	if (argc < 4)
	{
		std::cout << "Usage: compute_distance <matrix> <trie> <input> [<nof_peptides>]" << std::endl;
		return -1;
	}
	//cout << argc << endl;
	if (argc > 4) // nof_peptides is optional
	{
		nof_peptides = atoi(argv[4]);
	}

	string matrix(argv[1]);
	string trie(argv[2]);
	string filename(argv[3]);
	//std::cout << matrix << ", " << trie << ", " << filename << ", " << outname << ", " << nof_peptides << std::endl;

	//std::cout << "Reading trie..." << std::endl;
	TrieArray ta;
	{
	std::ifstream ifs(trie.c_str()); //trie is a string containing the path and filename of the trie file.
	boost::archive::text_iarchive ia(ifs);
	ta.load(ia,1);
	}

	
	Matrix m(matrix);	 

	set<string> peptides;
	
	
	// Read petides! One peptide sequence per line
	
	{ 

		//std::cout << "Reading search peptides and additional information from file " <<   std::endl;
		
		ifstream is(filename.c_str());
		if (not is)
			throw "Cannot open info File!";
		string line;
		while (getline(is,line))
		{	
			string::size_type comment = line.find("#");
			if (comment == string::npos)
			{	
						peptides.insert(line);
					//	std::cout << line << std::endl;
			}
		}
		is.close();
	}
	
	
	//std::cout << "Computing distances..." << std::endl;
	
	//ofstream os( outname.c_str() );	
	for( set<string>::const_iterator iter = peptides.begin(); iter != peptides.end(); ++iter ) 
	{
    string s = *iter;
    //std::cout << s << std::endl; 
  	
		//std::cout << "." ;
		flush(cout);		
		Node n (0,0); //start at top of the trie
		Peptide p; //
		Peptide seq;
		//std::cout << s << std::endl;
		m.translate(s, seq); //translate peptide sequence to matrix indices. seq contains the translated peptide sequence. 
		
		multiset<pair<double,string> > dist_min;
		multiset<pair<double,string> > dt;
		double dist = 0.0;
		dist_min = DFS_BnB_x_pair(ta,n,dist,m,p,seq,dt,nof_peptides);	
//		os << s << "," << query_reactivity[s] << "," << query_affinity[s] << "," << query_virality[s] <<":";
		//os << s << ":";
		cout << s << ":";
		for (multiset<pair<double,string> >::iterator it=dist_min.begin() ; it != dist_min.end(); it++ )
							//{os << (*it).second <<"," << (*it).first << ";";}
							{cout << (*it).second <<"," << (*it).first << ";";}
					//cout << (*it).second << (*it).first << endl;}
			//{os << (*it).second <<"," << (*it).first << "," << affinities[(*it).second] << ";";}
		//os << std::endl;	
		cout << std::endl;
		

	}
	//std::cout << std::endl;
//	os.close();
	return 0;
	
	
	
}
开发者ID:FRED-2,项目名称:ImmunoNodes,代码行数:96,代码来源:compute_distances_ivac.C


注:本文中的ia函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。