• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ ia函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: readFeatureRecord_raw

SmafeAbstractFeatureVector* SmafeStoreDB::readFeatureVector(long fvt_id,
		long track_id, bool load_fvt_info, long file_id, long segmentnr, bool onErrorSilent, bool load_file_id) {
	SmafeAbstractFeatureVector *safv;

	char* s11nbuf = NULL;
	size_t buf_len;
	std::string class_id;
	long file_id_db; // the file_id from the fv record in the db
	std::string s11nbuf_decrypted;

	try {

		// get feature vector as serialized  (raw)
		readFeatureRecord_raw(track_id, segmentnr, fvt_id, s11nbuf, buf_len, class_id,
				file_id_db, load_file_id);

		// check for NULL
		if (s11nbuf != NULL) {

			// decrypt if necessary
			try {
				s11nbuf_decrypted = decryptString(s11nbuf);
			} catch (CryptoPP::Exception& e) {
				if (onErrorSilent) {
					return NULL;
				} else {
					throw "Error decrypting feature vector: " + e.GetWhat();
				}
			}

			/*
			 // check the save operation
			 std::stringstream ssq (std::stringstream::in | std::stringstream::out);
			 {
			 const SmafeNumericFeatureVector rp(10);
			 // xml
			 //boost::archive::xml_oarchive xoa(ssq);
			 //xoa << BOOST_SERIALIZATION_NVP(rp);
			 //text
			 boost::archive::text_oarchive toa(ssq);
			 toa << BOOST_SERIALIZATION_NVP(rp);
			 }
			 */

			{

				// test
				//			strcpy(s11nbuf, "22 serialization::archive 4 0 25 SmafeNumericFeatureVector 1 0   0 0 0 0");
				//			strcpy(s11nbuf, "22 serialization::archive 4 0 25 SmafeNumericFeatureVector 1 0   0 0 60 15.750428559896203 15.835513677740561 14.431150283495295 9.1691797843426137 12.811824920752358 13.586624597153685 11.002659647379955 11.064217292864679 7.9797139825054986 9.9235703018379375 9.2886428424895762 8.0324006306601525 15.276850905877762 6.9980024541539478 6.5534074804978939 8.2741463327244738 5.5196410597310415 7.0535993338265381 12.179729021310999 7.614244901519533 8.2170004314708081 7.2385293826428949 7.670518295296743 7.4098476138708218 9.1962051599756762 22.083150886531712 7.1937839234320631 5.3740144890307757 9.4028271947731152 4.9368000302025195 5.54337365004546 12.558513608835014 5.0464122111050171 5.2942967940821957 5.1293983657093012 4.0150540410477955 4.1744641937907305 4.4020548029323763 6.5890940735936869 4.9097187529569455 3.4772659337619394 5.18100803316465 3.9710662965692674 3.4761336596970747 6.1217972638432858 2.9740695367326637 3.4272158068985425 5.1425586241272487 4.0814512317989635 5.4559700678194245 10.940316799899946 10.544862969781059 4.6729446737166676 3.1199454721889417 4.0808752427976582 3.2306116954569353 2.6467356438540484 4.4918005045229616 2.4698196267397305 2.414333588255281");
				//strcpy(s11nbuf, "22 serialization::archive 4 0 25 SmafeNumericFeatureVector 1 0\0120 0 0 60 15.750428559896203 15.835513677740561 14.431150283495295 9.1691797843426137 12.811824920752358 13.586624597153685 11.002659647379955 11.064217292864679 7.9797139825054986 9.9235703018379375 9.2886428424895762 8.0324006306601525 15.276850905877762 6.9980024541539478 6.5534074804978939 8.2741463327244738 5.5196410597310415 7.0535993338265381 12.179729021310999 7.614244901519533 8.2170004314708081 7.2385293826428949 7.670518295296743 7.4098476138708218 9.1962051599756762 22.083150886531712 7.1937839234320631 5.3740144890307757 9.4028271947731152 4.9368000302025195 5.54337365004546 12.558513608835014 5.0464122111050171 5.2942967940821957 5.1293983657093012 4.0150540410477955 4.1744641937907305 4.4020548029323763 6.5890940735936869 4.9097187529569455 3.4772659337619394 5.18100803316465 3.9710662965692674 3.4761336596970747 6.1217972638432858 2.9740695367326637 3.4272158068985425 5.1425586241272487 4.0814512317989635 5.4559700678194245 10.940316799899946 10.544862969781059 4.6729446737166676 3.1199454721889417 4.0808752427976582 3.2306116954569353 2.6467356438540484 4.4918005045229616 2.4698196267397305 2.414333588255281\012");


				std::stringstream ss(std::stringstream::in
						| std::stringstream::out);
				//				ss << boost_s11n_workaround_135(s11nbuf_decrypted) << std::endl;
				ss << s11nbuf_decrypted << std::endl;

				SMAFELOG_FUNC(SMAFELOG_DEBUG3, std::string(s11nbuf));

				//ss << stringvalues << endl;

				boost::archive::text_iarchive ia(ss);

				// restore  from the archive
				ia >> BOOST_SERIALIZATION_NVP(safv);
			}

			// get info about featurevectortype if desired
			if (load_fvt_info)
				getFeatureVectorMetaInfo(*safv, fvt_id, track_id, file_id);

			// store foreign keys;
			safv->track_id = track_id;
			// if a specific file_id is given, store this one
			// otherweise store the one that comes from the db
			if (file_id < 0)
				safv->file_id = file_id_db;
			else
				safv->file_id = file_id;

		} else { //if (s11nbuf != NULL)
			if (onErrorSilent) {
				return NULL;
			} else {
				throw std::string("Feature vector not found for track_id = "
						+ stringify(track_id) + ", featurevectortype_id = "
						+ stringify(fvt_id));
			}
		}//if (s11nbuf != NULL)

	} // try block
开发者ID:EQ4,项目名称:smafe,代码行数:91,代码来源:smafestoredb.cpp


示例17: main

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

    vector<object_trj_t> good_trlet_list;
    {
	std::string name = ds.workspace+"good_trlet_list.xml";
	std::ifstream fin(name.c_str());
	boost::archive::xml_iarchive ia(fin);
	ia >> BOOST_SERIALIZATION_NVP(good_trlet_list);
    }

    matrix<int> Tff;
    {
	std::string name = ds.workspace+"Tff.txt";
	std::ifstream fin(name.c_str());
	fin>>Tff;
	fin.close();
    }

    matrix<float> Aff;
    {
	std::string name = ds.workspace+"Aff.txt";
	std::ifstream fin(name.c_str());
	fin>>Aff;
	fin.close();
    }

    matrix<float> Ocff;
    {
	std::string name = ds.workspace+"Ocff.txt";
	std::ifstream fin(name.c_str());
	fin>>Ocff;
	fin.close();
    }

    matrix<object_trj_t> gap_trlet_list;
    {
	std::string name = ds.workspace+"gap_trlet_list.xml";
	std::ifstream fin(name.c_str());
	boost::archive::xml_iarchive ia(fin);
	ia >> BOOST_SERIALIZATION_NVP(gap_trlet_list);
    }


//////////////////////////////////////////////////////////////////////////
    vector<std::vector<std::string> > seq(2);
    read_sequence_list(ds.prefix, seq);
    int T = seq[0].size();
    int Ncam = 2;

    array<std::size_t, 2> img_size = {768, 1024};
    geometric_info_t gi;
    gi.load(ds, img_size);

    parameter_t P;

    //load_part_model(model, P.head_wid_ratio, P.head_hi_ratio, P.torso_hi_ratio);


    real_timer_t timer2;

    matrix<int> LMat;
    matrix<int> links;

    matrix<float> Aff2(Aff+Ocff*0.2);
    solve_linprog(Tff, Aff2, LMat, links);

    std::cout<<"LP time: "<<timer2.elapsed()/1000.0f<<std::endl;

    std::cout<<"Lv="<<links<<std::endl;

    vector<object_trj_t> final_trj_list;
    vector<vector<int> > final_trj_index;
    matrix<int> final_state_list;

    finalize_trajectory(Ncam, T, 
			links, good_trlet_list, gap_trlet_list,
			final_trj_list, final_trj_index, final_state_list);


    {
	std::string name = ds.workspace+"final_trj_list.xml";
	std::ofstream fout(name.c_str());
	boost::archive::xml_oarchive oa(fout);
	oa << BOOST_SERIALIZATION_NVP(final_trj_list);
    }

    {
	std::string name = ds.workspace+"final_state_list.txt";
	std::ofstream fout(name.c_str());
	fout<<final_state_list;
	fout.close();
    }

    {
	std::string name = ds.workspace+"final_trj_index.txt";
	std::ofstream fout(name.c_str());
	fout << final_trj_index;
	fout.close();
//.........这里部分代码省略.........
开发者ID:hfgong,项目名称:trpl,代码行数:101,代码来源:linprog_plan_test.cpp


示例18: reproject_and_scale_raster

void reproject_and_scale_raster(raster & target, raster const& source,
                      proj_transform const& prj_trans,
                      double offset_x, double offset_y,
                      unsigned mesh_size,
                      double filter_radius,
                      scaling_method_e scaling_method)
{
    CoordTransform ts(source.data_.width(), source.data_.height(),
                      source.ext_);
    CoordTransform tt(target.data_.width(), target.data_.height(),
                      target.ext_, offset_x, offset_y);
    unsigned i, j;
    unsigned mesh_nx = ceil(source.data_.width()/double(mesh_size)+1);
    unsigned mesh_ny = ceil(source.data_.height()/double(mesh_size)+1);

    ImageData<double> xs(mesh_nx, mesh_ny);
    ImageData<double> ys(mesh_nx, mesh_ny);

    // Precalculate reprojected mesh
    for(j=0; j<mesh_ny; j++) {
        for (i=0; i<mesh_nx; i++) {
            xs(i,j) = i*mesh_size;
            ys(i,j) = j*mesh_size;
            ts.backward(&xs(i,j), &ys(i,j));
        }
    }
    prj_trans.backward(xs.getData(), ys.getData(), NULL, mesh_nx*mesh_ny);

    // Initialize AGG objects
    typedef agg::pixfmt_rgba32 pixfmt;
    typedef pixfmt::color_type color_type;
    typedef agg::renderer_base<pixfmt> renderer_base;
    typedef agg::pixfmt_rgba32_pre pixfmt_pre;
    typedef agg::renderer_base<pixfmt_pre> renderer_base_pre;

    agg::rasterizer_scanline_aa<> rasterizer;
    agg::scanline_u8  scanline;
    agg::rendering_buffer buf((unsigned char*)target.data_.getData(),
                              target.data_.width(),
                              target.data_.height(),
                              target.data_.width()*4);
    pixfmt_pre pixf_pre(buf);
    renderer_base_pre rb_pre(pixf_pre);
    rasterizer.clip_box(0, 0, target.data_.width(), target.data_.height());
    agg::rendering_buffer buf_tile(
        (unsigned char*)source.data_.getData(),
        source.data_.width(),
        source.data_.height(),
        source.data_.width() * 4);

    pixfmt pixf_tile(buf_tile);

    typedef agg::image_accessor_clone<pixfmt> img_accessor_type;
    img_accessor_type ia(pixf_tile);

    agg::span_allocator<color_type> sa;

    // Initialize filter
    agg::image_filter_lut filter;
    switch(scaling_method)
    {
    case SCALING_NEAR: break;
    case SCALING_BILINEAR8: // TODO - impl this or remove?
    case SCALING_BILINEAR:
        filter.calculate(agg::image_filter_bilinear(), true); break;
    case SCALING_BICUBIC:
        filter.calculate(agg::image_filter_bicubic(), true); break;
    case SCALING_SPLINE16:
        filter.calculate(agg::image_filter_spline16(), true); break;
    case SCALING_SPLINE36:
        filter.calculate(agg::image_filter_spline36(), true); break;
    case SCALING_HANNING:
        filter.calculate(agg::image_filter_hanning(), true); break;
    case SCALING_HAMMING:
        filter.calculate(agg::image_filter_hamming(), true); break;
    case SCALING_HERMITE:
        filter.calculate(agg::image_filter_hermite(), true); break;
    case SCALING_KAISER:
        filter.calculate(agg::image_filter_kaiser(), true); break;
    case SCALING_QUADRIC:
        filter.calculate(agg::image_filter_quadric(), true); break;
    case SCALING_CATROM:
        filter.calculate(agg::image_filter_catrom(), true); break;
    case SCALING_GAUSSIAN:
        filter.calculate(agg::image_filter_gaussian(), true); break;
    case SCALING_BESSEL:
        filter.calculate(agg::image_filter_bessel(), true); break;
    case SCALING_MITCHELL:
        filter.calculate(agg::image_filter_mitchell(), true); break;
    case SCALING_SINC:
        filter.calculate(agg::image_filter_sinc(filter_radius), true); break;
    case SCALING_LANCZOS:
        filter.calculate(agg::image_filter_lanczos(filter_radius), true); break;
    case SCALING_BLACKMAN:
        filter.calculate(agg::image_filter_blackman(filter_radius), true); break;
    }

    // Project mesh cells into target interpolating raster inside each one
    for(j=0; j<mesh_ny-1; j++) {
        for (i=0; i<mesh_nx-1; i++) {
//.........这里部分代码省略.........
<

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ ia64_platform_is函数代码示例发布时间:2022-05-30
下一篇:
C++ i_unreached函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap