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


C++ OutputStream::EndCommand方法代码示例

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


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

示例1: Write


//.........这里部分代码省略.........
        layout_desc = Impl::LayoutDescPtr ();

        Impl::LayoutMap::iterator layout_iter = impl->layouts.find (layout.Id ());

        if (layout_iter != impl->layouts.end ())
          layout_desc = layout_iter->second;
      }
    }
    else
    {
      Impl::LayoutMap::iterator layout_iter = impl->layouts.find (layout.Id ());

      if (layout_iter != impl->layouts.end ())
        layout_desc = layout_iter->second;
    }

      //синхронизация идентификатора карты

    PropertyMapHeader header = {static_cast<object_id_t> (properties.Id ()), false, false};

    if (!layout_desc || layout_desc->hash != layout.Hash ())
    {
      header.has_layout = true;
    }
    else //we always send layout id so reader will have possibility to restore layout after exception
    {
      header.has_layout_id = true;
    }

    stream.BeginCommand (CommandId_UpdatePropertyMap);

    stream.Write (header);

      //синхронизация лэйаута

    if (header.has_layout)
    {
      impl->WriteLayout (stream, layout, layout_desc);
    }
    
    if (header.has_layout_id)
    {
      write (stream, static_cast<object_id_t> (layout.Id ()));
    }

      //создание объекта слежения за картой свойств

    bool need_add_new_map = !map_desc;

    if (!map_desc)
    {
      map_desc         = Impl::MapDescPtr (new Impl::MapDesc, false);
      map_desc->layout = layout_desc;
    }

      //синхронизация буфера карты свойств

    write (stream, static_cast<uint32> (properties.BufferSize ()));

    stream.WriteData (properties.BufferData (), properties.BufferSize ());

      //синхронизация строк

    for (IndexArray::iterator iter=layout_desc->string_indices.begin (), end=layout_desc->string_indices.end (); iter!=end; ++iter)
      write (stream, properties.GetString (*iter));

      //обновление полей и карт

    if (need_add_new_map)
    {
      properties.Trackable ().connect_tracker (xtl::bind (&Impl::RemovePropertyMap, impl.get (), properties.Id ()), *impl);

      impl->property_maps.insert_pair (properties.Id (), map_desc);
    }

    if (map_desc->layout != layout_desc)
      map_desc->layout = layout_desc;

      //обновление хэша

    map_desc->hash = properties.Hash ();

      //закрытие команды

    stream.EndCommand ();
  }
  catch (xtl::exception& e)
  {
    stream.SetPosition (saved_position);

    e.touch ("render::scene::interchange::PropertyMapWriter::Write");

    throw;
  }
  catch (...)
  {
    stream.SetPosition (saved_position);
    throw;
  }
}
开发者ID:untgames,项目名称:funner,代码行数:101,代码来源:render_interchange_property_synchronizer.cpp


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