Esempio n. 1
0
File: cmd.cpp Progetto: ATNoG/ODiMM
void cmd::proxy_binding_update(proxy_binding_info& pbinfo, chrono& delay)
{
	if (pbinfo.status != ip::mproto::pba::status_ok)
		return; //error

	pbu_process(pbinfo);

	pba_sender_ptr pbas(new pba_sender(pbinfo));

	pbas->async_send(_mp_sock, boost::bind(&cmd::mp_send_handler, this, _1));

	delay.stop();
	_log(0, "PBU ", !pbinfo.lifetime ? "de-" : "", "register processing delay ", delay.get());
}
Esempio n. 2
0
bool auto_ptr_test( )
{
  bool rc = true;

  // Basic tests
  // -----------

  std::auto_ptr< int > p1( new int( -2 ) );
  if( *p1 != -2 ) FAIL

  std::auto_ptr< int > p2( p1 );
  if(  p1.get( ) !=  0 ) FAIL
  if( *p2        != -2 ) FAIL

  std::auto_ptr< int > p3;
  p3 = p2;
  if(  p2.get( ) !=  0 ) FAIL
  if( *p3        != -2 ) FAIL

  // Check base/derived conversions
  // ------------------------------

  std::auto_ptr< Derived > pder( new Derived );
  pder->b_member = -2;

  std::auto_ptr< Base > pbas( pder );
  if( pder.get( )    !=  0 ) FAIL
  if( pbas->b_member != -2 ) FAIL

  pder.reset( new Derived );
  pder->b_member = -3;
  pbas = pder;
  if( pder.get( )    !=  0 ) FAIL
  if( pbas->b_member != -3 ) FAIL

  // Check auto_ptr as function argument type or return type
  // -------------------------------------------------------

  std::auto_ptr< int > arg1( new int( 24 ) );
  f( arg1 );
  if( arg1.get( ) != 0 ) FAIL

  const std::auto_ptr< int > arg2( new int( 24 ) );
  g( arg2 );
  if( *arg2 != 42 ) FAIL

  return( rc );
}