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


C++ buffer::put方法代码示例

本文整理汇总了C++中buffer::put方法的典型用法代码示例。如果您正苦于以下问题:C++ buffer::put方法的具体用法?C++ buffer::put怎么用?C++ buffer::put使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在buffer的用法示例。


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

示例1: betti_display

void ResolutionComputation::betti_display(buffer &o, M2_arrayint ar)
{
  int *a = ar->array;
  int total_sum = 0;
  int lo = a[0];
  int hi = a[1];
  int len = a[2] + 1;
  o << "total  ";
  for (int lev = 0; lev < len; lev++)
    {
      int sum = 0;
      for (int d = lo; d <= hi; d++) sum += a[len * (d - lo) + lev + 3];
      total_sum += sum;
      o.put(sum, 6);
      o << ' ';
    }
  o << " [" << total_sum << "]" << newline;
  for (int d = lo; d <= hi; d++)
    {
      o.put(d, 5);
      o << ": ";
      for (int lev = 0; lev < len; lev++)
        {
          int c = a[len * (d - lo) + lev + 3];
          if (c != 0)
            o.put(c, 6);
          else
            o << "     -";
          o << " ";
        }
      o << newline;
    }
}
开发者ID:DanGrayson,项目名称:M2,代码行数:33,代码来源:comp-res.cpp

示例2: elem_text_out

  void ARingCC::elem_text_out(buffer &o,
                              const ElementType &ap,
                              bool p_one,
                              bool p_plus,
                              bool p_parens) const
  {
    ElementType& ap1 = const_cast<ElementType&>(ap);
    gmp_CC_struct g;
    g.re = getmemstructtype(gmp_RR);
    g.im = getmemstructtype(gmp_RR);
    mpfr_init2(g.re,53);
    mpfr_init2(g.im,53);
    mpfr_set_d(g.re, ap1.re, GMP_RNDN);
    mpfr_set_d(g.im, ap1.im, GMP_RNDN);
    M2_string s = p_parens ? 
      (*gmp_tonetCCparenpointer)(&g) : (*gmp_tonetCCpointer)(&g);
    mpfr_clear(g.im);
    mpfr_clear(g.re);
    delete g.re;
    delete g.im;

    bool prepend_plus = p_plus && (s->array[0] != '-');
    bool strip_last = !p_one && (
				 (s->len == 1 && s->array[0] == '1')
				 || (s->len == 2 && s->array[1] == '1' && s->array[0] == '-'));
    
    if (prepend_plus)
      o << "+";
    if (strip_last)
      o.put(s->array, s->len-1);
    else
      o.put(s->array, s->len);
    
  }
开发者ID:AlessandroOneto,项目名称:M2,代码行数:34,代码来源:aring-CC.cpp

示例3: cdrOut

io_status pstring::cdrOut(buffer& buf)
{
   primitive::cdrOut(buf);
   buf.put(v_str_ptr.loc);
   buf.put(v_sz);
   return done;
}
开发者ID:,项目名称:,代码行数:7,代码来源:

示例4: out

inline void device_buf::out(byte p)
{
	// TODO: If out_buf was resized so that it would be full at the next flush moment,
	// we only need to do one check here.
	out_buf.put(p);
	if(out_buf.size() > out_buffer_size)
		flush(); // Time to flush
}
开发者ID:coyun,项目名称:gvl,代码行数:8,代码来源:device_buf.hpp

示例5: cdrOut

io_status dl_list::cdrOut(buffer& buf)
{
   composite::cdrOut(buf);
   v_dl_list_head.cdrOut(buf);
   v_dl_list_tail.cdrOut(buf);
   buf.put(v_num_indices);
   return done;
}
开发者ID:juddy,项目名称:edcde,代码行数:8,代码来源:dl_list.C

示例6: cdrOut

io_status compressed_pstring::cdrOut(buffer& buf)
{
//MESSAGE(cerr, "compressed_pstring: cdrOut()");
//debug(cerr, compress_agent_id);

   pstring::cdrOut(buf);
   buf.put(v_uncompressed_sz);
   return compress_agent_id.cdrOut(buf);
}
开发者ID:juddy,项目名称:edcde,代码行数:9,代码来源:compressed_pstring.C

示例7: if

stream::state_t
socks5_proxy::send( buffer &in_buf, buffer &out_buf )
{
	if ( m_state == stream::state_t::handshaking )
	{
		if ( !m_sent_greeting )
		{
			if ( proxy::manager::shared().authorization().size() > 0 )
			{
				out_buf.size( 4 );
			
				out_buf.put( 0, 0x05 );
				out_buf.put( 1, 0x02 );
				out_buf.put( 2, 0x00 );
				out_buf.put( 3, 0x02 );
			}
			else
			{
				out_buf.size( 3 );
				
				out_buf.put( 0, 0x05 );
				out_buf.put( 1, 0x01 );
				out_buf.put( 2, 0x00 );
			}
			
			m_sent_greeting = true;
		}
		
		m_send_queue.append( in_buf );
		
		m_state5 = waiting_for_opening_response;
		m_state = stream::state_t::connected;
	}
	else if ( m_state5 != connected )
	{
		m_send_queue.append( in_buf );
	}
	else
	{
		out_buf = std::move( in_buf );
	}
	
	return m_state;
}
开发者ID:porchdog,项目名称:nodeoze,代码行数:44,代码来源:proxy.cpp

示例8: elem_text_out

void ARingRRR::elem_text_out(buffer &o,
                             const ElementType &ap,
                             bool p_one,
                             bool p_plus,
                             bool p_parens) const
{
  mpfr_ptr a = &const_cast<ElementType &>(ap);
  M2_string s = (*gmp_tostringRRpointer)(a);
  bool prepend_plus = p_plus && (s->array[0] != '-');
  bool strip_last =
      !p_one && ((s->len == 1 && s->array[0] == '1') ||
                 (s->len == 2 && s->array[1] == '1' && s->array[0] == '-'));

  if (prepend_plus) o << "+";
  if (strip_last)
    o.put(s->array, s->len - 1);
  else
    o.put(s->array, s->len);
}
开发者ID:BertiniM2,项目名称:M2,代码行数:19,代码来源:aring-RRR.cpp

示例9: writer

void writer()
{
    for (int n = 0; n < ITERS; ++n)
    {
        {
            boost::mutex::scoped_lock lock(io_mutex);
            std::cout << "sending: "
                      << n << std::endl;
        }
        buf.put(n);
    }
}
开发者ID:Karsten1987,项目名称:cmake_dummy,代码行数:12,代码来源:main_boost_thread.cpp


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