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


C++ VPackBuilder::steal方法代码示例

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


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

示例1: operator

  void operator()(VPackSlice const& v, std::vector<VPackSlice>& resEdges,
                  std::vector<VPackSlice>& neighbors) {
    int res = TRI_ERROR_NO_ERROR;
    for (auto const& edgeCollection : _block->_collectionInfos) {
      VPackBuilder result;
      TRI_ASSERT(edgeCollection != nullptr);
      if (_isReverse) {
        res = edgeCollection->getReverseEdgesCoordinator(v, result);
      } else {
        res = edgeCollection->getEdgesCoordinator(v, result);
      }

      if (res != TRI_ERROR_NO_ERROR) {
        THROW_ARANGO_EXCEPTION(res);
      }

      VPackSlice edges = result.slice().get("edges");
      for (auto const& edge : VPackArrayIterator(edges)) {
        VPackSlice from = arangodb::Transaction::extractFromFromDocument(edge);
        if (from == v) {
          VPackSlice to = arangodb::Transaction::extractToFromDocument(edge);
          if (to != v) {
            resEdges.emplace_back(edge);
            neighbors.emplace_back(to);
          }
        } else {
          resEdges.emplace_back(edge);
          neighbors.emplace_back(from);
        }
      }
      // Make sure the data Slices are pointing to is not running out of scope.
      // This is not thread-safe!
      _block->_coordinatorCache.emplace_back(result.steal());
    }
  }
开发者ID:JiangKevin,项目名称:arangodb,代码行数:35,代码来源:ShortestPathBlock.cpp

示例2: prepareForNetwork

VPackMessageNoOwnBuffer VppResponse::prepareForNetwork() {
    // initalize builder with vpackbuffer. then we do not need to
    // steal the header and can avoid the shared pointer
    VPackBuilder builder;
    builder.openArray();
    builder.add(VPackValue(int(1)));
    builder.add(VPackValue(int(2)));  // 2 == response
    builder.add(
        VPackValue(static_cast<int>(meta::underlyingValue(_responseCode))));
    builder.close();
    _header = builder.steal();
    if (_vpackPayloads.empty()) {
        if (_generateBody) {
            LOG_TOPIC(INFO, Logger::REQUESTS)
                    << "Response should generate body but no Data available";
            _generateBody = false;  // no body availalbe
        }
        return VPackMessageNoOwnBuffer(VPackSlice(_header->data()),
                                       VPackSlice::noneSlice(), _messageId,
                                       _generateBody);
    } else {
        std::vector<VPackSlice> slices;
        for (auto const& buffer : _vpackPayloads) {
            slices.emplace_back(buffer.data());
        }
        return VPackMessageNoOwnBuffer(VPackSlice(_header->data()),
                                       std::move(slices), _messageId,
                                       _generateBody);
    }
}
开发者ID:triagens,项目名称:arangodb,代码行数:30,代码来源:VppResponse.cpp


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