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


C++ Signal::Sum方法代码示例

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


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

示例1: filterOnlineSpectral

void filterOnlineSpectral( 
  std::vector< PacketPtr >& packets_in,
  std::vector< PacketPtr >& packets_out,
  std::vector< PacketPtr >& /* packets_out_reverse */,
  void ** /* client data */,
  UNUSED PacketPtr& params,
  const TopologyLocalInfo& top_info)
{
  int tag = packets_in[0]->get_Tag();

  /* Bypass the implicit filter in the back-ends, there's nothing to merge at this level! */
  if (BOTTOM_FILTER(top_info))
  {
    for (unsigned int i=0; i<packets_in.size(); i++)
    {
      packets_out.push_back(packets_in[i]);
    }
    return;
  }

  /* Process the packets crossing the filter */
  switch(tag)
  {
    case REDUCE_SIGNAL:
    {
      /* Load N signals up to a maximum chunk size and add them, until all signals are processed */
      unsigned int nextSignal = 0;
      Signal *SumSignal = new Signal();

      while (nextSignal < packets_in.size())
      {
        vector<Signal *> ChildrenSignals;
        int ChunkSize = SumSignal->GetSize();
        do
        {
          /* Unpack next child's signal */
          PACKET_PTR cur_packet = packets_in[nextSignal];
          Signal *child_Signal = new Signal( cur_packet );

          /* Save the signal in a list */
          ChildrenSignals.push_back( child_Signal );
          
          ChunkSize  += child_Signal->GetSize();
          nextSignal ++;
        } while ((ChunkSize < MAX_SIGNAL_CHUNK_SIZE) && (nextSignal < packets_in.size()));
 
        /* Sum the signals unpacked so far */
        SumSignal->Sum(ChildrenSignals);
      }

      /* Send the summed signal to the upper level of the network */
      packets_out.push_back( SumSignal->Serialize( packets_in[0]->get_StreamId() ) );

      break;
    }
    default:
    {
      /* Bypass all other messages to the parent node */
      for (unsigned int i=0; i<packets_in.size(); i++)
      {
        packets_out.push_back( packets_in[i] );
      }
      break;
    }
  }
}
开发者ID:gllort,项目名称:extrae-online,代码行数:66,代码来源:SpectralFilter.cpp


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