Пример #1
0
	Token::Token() :
	  id( TOK_TERM ),
	  type( TYP_TERMINATOR ),
	  dval( 0.0 ),
	  precedence( -1 ),
	  dbg_filenum( 0 ),
	  dbg_linenum( 0 ),
	  lval( 0 ),
	  userfunc( NULL ),
	  deprecated( false ),
      ownsStr( false ),
	  module( Mod_Basic ),
	  token( NULL )
	{
	  register_instance();
	}
Пример #2
0
::DDS::ReturnCode_t
 FooDataWriterImpl::get_or_create_instance_handle(
                DDS::InstanceHandle_t& handle,
                Foo instance_data,
                int& is_new,
                ACE_Message_Block*& marshalled, // only if is_new==1
                const ::DDS::Time_t & source_timestamp)
{
  handle = ::OpenDDS::DCPS::HANDLE_NIL;
  FooMap::const_iterator it = instance_map_.find(instance_data);

  if (it == instance_map_.end())
  {
    is_new = 1;
    // don't use fast allocator for registration.
    marshalled = this->marshal(instance_data, 0); //NOT_FOR_WRITE

    // tell DataWriterLocal and Publisher about the instance.
    ::DDS::ReturnCode_t ret
      = register_instance(handle, marshalled, source_timestamp);
    if (ret == ::DDS::RETCODE_OK)
    {
      std::pair<FooMap::iterator, bool> pair
          = instance_map_.insert(FooMap::value_type(instance_data, handle));
      if (pair.second == false)
        {
          ACE_ERROR_RETURN ((LM_ERROR,
                              ACE_TEXT("(%P|%t) "
                              "FooDataWriterImpl::get_or_create_instance_handle, ")
                              ACE_TEXT("insert Foo(key=%d) failed. \n"),
                              instance_data.key),
                              ::DDS::RETCODE_ERROR);
        }
    }
    else
    {
      marshalled->release ();
      return ret;
    }
  }
  else {
    is_new = 0;
    handle = it->second;
  }
  return ::DDS::RETCODE_OK;
}
Пример #3
0
	Token::Token( BTokenId i_id,
				  BTokenType i_type ) :
				  id( i_id ),
				  type( i_type ),
				  dval( 0.0 ),
				  precedence( -1 ),
				  dbg_filenum( 0 ),
				  dbg_linenum( 0 ),
				  lval( 0 ),
				  userfunc( NULL ),
				  deprecated( false ),
                  ownsStr( false ),
				  module( Mod_Basic ),
				  token( NULL )
	{
	  register_instance();
	}
Пример #4
0
	Token::Token( ModuleID i_module,
				  BTokenId i_id,
				  BTokenType i_type ) :
				  id( i_id ),
				  type( i_type ),
				  dval( 0.0 ),
				  precedence( -1 ),
				  dbg_filenum( 0 ),
				  dbg_linenum( 0 ),
				  lval( 0 ),
				  userfunc( NULL ),
				  deprecated( false ),
                  ownsStr( false ),
				  module( static_cast<unsigned char>( i_module ) ),
				  token( NULL )
	{
	  register_instance();
	}
Пример #5
0
	Token::Token( const Token& tok ) :
	  id( tok.id ),
	  type( tok.type ),
	  dval( tok.dval ),
	  precedence( tok.precedence ),
	  dbg_filenum( tok.dbg_filenum ),
	  dbg_linenum( tok.dbg_linenum ),
	  lval( tok.lval ),
	  userfunc( tok.userfunc ),
	  deprecated( tok.deprecated ),
      ownsStr( false ),
	  module( tok.module ),
	  token( NULL )
	{
	  register_instance();
	  if ( tok.token )
	  {
		if ( !tok.ownsStr )
		  setStr( tok.token );
		else
		  copyStr( tok.token );
	  }
	}