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


C++ Subscription::begin方法代码示例

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


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

示例1: pushBackVal

std::vector<unsigned char> aggregator_solver::makeSubscribeReqMsg(Subscription& rules) {
  //The total length starts out at one for the message type field.
  //Each rule will add additional length.
  uint32_t total_length = 1;

  std::vector<unsigned char> buff;

  buff.push_back(0);
  buff.push_back(0);
  buff.push_back(0);
  buff.push_back(0);
  buff.push_back((unsigned char)subscription_request);

  //Push back the rules
  {
    //First push the number of rules onto the buffer
    uint32_t num_rules = rules.size();
    total_length += pushBackVal(num_rules, buff);

    //For each rule push back the physical layer, the number of
    //tx rules and the tx rules, the number of boxes and the boxes,
    //and the number of FSM/TR rules and the FSM/TR rules.
    for (auto rule = rules.begin(); rule != rules.end(); ++rule) {
      //Push the physical layer
      total_length += pushBackVal(rule->physical_layer, buff);

      //Push the transmitter information
      uint32_t num_txers = rule->txers.size();
      total_length += pushBackVal(num_txers, buff);
      //Each transmitter is made of an ID and a MASK
      for (auto txer = rule->txers.begin(); txer != rule->txers.end(); ++txer) {
        total_length += pushBackVal(txer->base_id, buff);
        total_length += pushBackVal(txer->mask, buff);
      }

      //Finish the rule with the update interval
      total_length += pushBackVal(rule->update_interval, buff);
    }
  }

  //Store the message length in the first four bytes
  pushBackVal<uint32_t>(total_length, buff, 0);

  return buff;
}
开发者ID:OwlPlatform,项目名称:cpp-owl-common,代码行数:45,代码来源:aggregator_solver_protocol.cpp


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