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


C++ Sequence::Append方法代码示例

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


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

示例1:

// Flatten sections into one sequence
void Tree::Node::Flatten(Sequence& seq) const
{
	for(vector<Sequence>::const_iterator cit = m_vSections.begin();
		cit != m_vSections.end(); ++cit)
		seq.Append(*cit);
}
开发者ID:kdmurray91,项目名称:dawg,代码行数:7,代码来源:tree.cpp

示例2: Resample

bool WaveClip::Resample(int rate, ProgressDialog *progress)
{
   if (rate == mRate)
      return true; // Nothing to do

   double factor = (double)rate / (double)mRate;
   ::Resample* resample = new ::Resample(true, factor, factor);
   
   int bufsize = 65536;
   float* inBuffer = new float[bufsize];
   float* outBuffer = new float[bufsize];
   sampleCount pos = 0;
   bool error = false;
   int outGenerated = 0;
   sampleCount numSamples = mSequence->GetNumSamples();

   Sequence* newSequence =
      new Sequence(mSequence->GetDirManager(), mSequence->GetSampleFormat());
   
   /**
    * We want to keep going as long as we have something to feed the resampler
    * with OR as long as the resampler spews out samples (which could continue
    * for a few iterations after we stop feeding it)
    */
   while (pos < numSamples || outGenerated > 0)
   {
      int inLen = numSamples - pos;
      if (inLen > bufsize)
         inLen = bufsize;
         
      bool isLast = ((pos + inLen) == numSamples);
      
      if (!mSequence->Get((samplePtr)inBuffer, floatSample, pos, inLen))
      {
         error = true;
         break;
      }
      
      int inBufferUsed = 0;
      outGenerated = resample->Process(factor, inBuffer, inLen, isLast,
                                           &inBufferUsed, outBuffer, bufsize);
                                           
      pos += inBufferUsed;
      
      if (outGenerated < 0)
      {
         error = true;
         break;
      }

      if (!newSequence->Append((samplePtr)outBuffer, floatSample,
                               outGenerated))
      {
         error = true;
         break;
      }

      if (progress)
      {
         int updateResult = progress->Update(pos, numSamples);
         error = (updateResult != eProgressSuccess);
         if (error)
         {
            break;
         }
      }
   }
   
   delete[] inBuffer;
   delete[] outBuffer;
   delete resample;
   
   if (error)
   {
      delete newSequence;
   } else
   {
      delete mSequence;
      mSequence = newSequence;
      mRate = rate;

      // Invalidate wave display cache
      if (mWaveCache)
      {
         delete mWaveCache;
         mWaveCache = NULL;
      }
      mWaveCache = new WaveCache(1);
      // Invalidate the spectrum display cache
      if (mSpecCache)
         delete mSpecCache;
      mSpecCache = new SpecCache(1, 1, false);
   }

   return !error;
}
开发者ID:tuanmasterit,项目名称:audacity,代码行数:96,代码来源:WaveClip.cpp

示例3: main


//.........这里部分代码省略.........
        {
            if (flags[i][j] == 0)
            {
                if (flags[i][last])
                {
                    lengths.push_back(j - last);
                    last = j;
                }
            }
            else
            {
                if (flags[i][last] == 0)
                    last = j;
            }
        }
    }
    sort(lengths.begin(), lengths.end());
    reverse(lengths.begin(), lengths.end());

    deque<Sequence> gaps;
    deque<bool> is_no_long_gaps(refs.size());
    for (unsigned i = 0; i < refs.size(); ++i)
    {
        deque<int> tmp;
        Sequence gap;

        if (flags[i][0])
            tmp.push_back(0);

        for (unsigned j = 0; j < refs[i].size(); ++j)
        {
            if (flags[i][j] == false)
            {
                gap.Append(refs[i][j]);
            }
            else
            {
                if (gap.size() > 0)
                {
                    gaps.push_back(gap);
                    tmp.push_back(gap.size());
                }
                gap.resize(0);
            }
        }

        if (gap.size() > 0)
        {
            gaps.push_back(gap);
            tmp.push_back(gap.size());
        }
        else
            tmp.push_back(0);

        is_no_long_gaps[i] = true;
        for (unsigned j = 1; j+1 < tmp.size(); ++j)
        {
            if (tmp[j] > 50)
                is_no_long_gaps[i] = false;
        }
    }
    WriteSequence(FormatString("%s.gap.fa", argv[2]), gaps, "gap");

    FastaWriter ref_writer(argv[1] + string(".found.fa"));
    FILE *ffcound_list = OpenFile(argv[1] + string(".found.fa.list"), "wb");
    int found = 0;
开发者ID:binma,项目名称:idba,代码行数:67,代码来源:validate_reads_blat.cpp


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