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


C++ StaticArray::size方法代码示例

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


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

示例1: Average

  /**
   * Calculate average from samples
   *
   * @return Average value in buffer
   */
  gcc_pure
  fixed Average() const {
    assert(!x.empty());

    fixed y = fixed_zero;
    for (unsigned i = 0; i < x.size(); i++)
      y += x[i];

    return y / x.size();
  }
开发者ID:damianob,项目名称:xcsoar,代码行数:15,代码来源:AvFilter.hpp

示例2: EndFan

  virtual void
  EndFan()
  {
    if (fans.full())
      return;

    // remove unnecessary inclusion of origin if next and last points are identical
    unsigned start = 0;
    const size_t gsize = g.size();
    if (gsize > 2 && g[gsize - 1] == g[1])
      start = 1;

    if (gsize < start + 3)
      return;

    // Perform clipping on the GeoPointVector (Result: clipped)
    unsigned size = clip.ClipPolygon(clipped, g.raw() + start, gsize - start);
    // With less than three points we can't draw a polygon
    if (size < 3)
      return;

    // Work directly on the RasterPoints in the fans vector
    fans.Append(size);

    // Convert GeoPoints to RasterPoints
    for (unsigned i = 0; i < size; ++i)
      fans.Append(proj.GeoToScreen(clipped[i]));
  }
开发者ID:Adrien81,项目名称:XCSoar,代码行数:28,代码来源:MapWindowGlideRange.cpp

示例3: if

static void
NextPage(int Step)
{
    assert(waypoint);

    int last_page = 2 + images.size();
    do {
        page += Step;
        if (page < 0)
            page = last_page;
        else if (page > last_page)
            page = 0;
        // skip wDetails frame, if there are no details
    } while (page == 1 &&
#ifdef ANDROID
             waypoint->files_external.empty() &&
#endif
             waypoint->details.empty());

    wInfo->SetVisible(page == 0);
    wDetails->SetVisible(page == 1);
    wCommand->SetVisible(page == 2);
    wImage->SetVisible(page >= 3);
    zoom = 0;
    wMagnify->SetVisible(page >= 3);
    wMagnify->SetEnabled(true);
    wShrink->SetVisible(page >= 3);
    wShrink->SetEnabled(false);
}
开发者ID:damianob,项目名称:xcsoar_mess,代码行数:29,代码来源:dlgWaypointDetails.cpp

示例4:

  /**
   * Looks up an item in the traffic list.
   *
   * @param name the name or call sign
   * @return the FLARM_TRAFFIC pointer, NULL if not found
   */
  const FLARM_TRAFFIC *FindTraffic(const TCHAR *name) const {
    for (unsigned i = 0; i < traffic.size(); i++)
      if (traffic[i].name.equals(name))
        return &traffic[i];

    return NULL;
  }
开发者ID:macsux,项目名称:XCSoar,代码行数:13,代码来源:State.hpp

示例5:

 StaticArray<T>::StaticArray(const StaticArray& sa)
 {
     m_Size = sa.size();
     m_MasPoint = new T[m_Size];
     for (uint32_t i = 0; i < m_Size; i++)
         m_MasPoint[i] = sa[i];
 }
开发者ID:E-LLP,项目名称:NN_clustering,代码行数:7,代码来源:StaticArray.hpp

示例6:

static TaskPointFactoryType
GetRandomType(const LegalPointSet &l)
{
    StaticArray<TaskPointFactoryType, LegalPointSet::N> types;
    l.CopyTo(std::back_inserter(types));
    return types[(rand() % types.size())];
}
开发者ID:j-konopka,项目名称:XCSoar-TE,代码行数:7,代码来源:harness_task.cpp

示例7: EnableCursorSelection

    /**
     * On devices without a touch screen, enable button selection with
     * KEY_LEFT / KEY_RIGHT.  That allows navigating a ListControl while
     * allowing the user to select an action on a list item.
     */
    void EnableCursorSelection(unsigned _index=0) {
        assert(selected_index < 0);
        assert(_index < buttons.size());

        selected_index = _index;
        buttons[selected_index]->SetSelected(true);
    }
开发者ID:ThomasXBMC,项目名称:XCSoar,代码行数:12,代码来源:ButtonPanel.hpp

示例8:

int
FlarmDetails::LookupSecondaryIndex(FlarmId id)
{
  for (unsigned i = 0; i < FLARM_Names.size(); i++)
    if (FLARM_Names[i].ID == id)
      return i;

  return -1;
}
开发者ID:joachimwieland,项目名称:xcsoar-jwieland,代码行数:9,代码来源:FlarmDetails.cpp

示例9: main

int main()
{
  // print my name and this assignment's title
  cout << "Lab 3b, The \"Write A Static Array Class Template\" Program \n";
  cout << "Programmer: Licong Wang\n";
  cout << "Editor(s) used: Visual studio 2013\n";
  cout << "Compiler(s) used:  Microsoft c++ complier\n";
  cout << "File: " << __FILE__ << endl;
  cout << "Complied: " << __DATE__ << " at " << __TIME__ << endl << endl;

  StaticArray<int, 100> a;
  string buf;
  int key;
  int value;

    while (true)
    {
      cout << "Input an index and a value [Q to quit]: ";
    
      cin >> buf;
      if (buf == "Q" || buf == "q")
        break;
      key = atoi(buf.c_str());

      cin >> buf;
      value = atoi(buf.c_str());
      a[key] = value;
    }

  cout << "\nI stored this many values : " << a.size() << endl;
  cout << "These values are:" << endl;

  vector<int> keys = a.keys();
  for (int i = 0; i < keys.size(); i++)
    cout << keys[i] << " " << a[keys[i]] << endl;

  while (true)
  {
    cout << "Input an index for me to look up [Q to quit]: ";
    cin >> buf;

    if (buf == "Q" || buf == "q")
      break;
    else
    {
      key = atoi(buf.c_str());
      if (a.containsKey(key))
        cout << "Found it -- the value stored at " << key << " is " << a[key] << endl;
      else
        cout << "I didn't find it" << endl;
    }
  }
  
  cout << "\nPress ENTER to continue.\n";
  cin.ignore();  // prevent cin.get() from getting a new line from previous cin
  cin.get();
}
开发者ID:simida1234321,项目名称:TestOnly,代码行数:57,代码来源:MyStaticArray.cpp

示例10:

void
QuickMenu::UpdateCaption()
{
  StaticString<32> buffer;
  unsigned pageSize = grid_view.GetNumColumns() * grid_view.GetNumRows();
  unsigned lastPage = buttons.size() / pageSize;
  buffer.Format(_T("Quick Menu  %d/%d"),
                grid_view.GetCurrentPage() + 1, lastPage + 1);
  dialog.SetCaption(buffer);
}
开发者ID:Exadios,项目名称:xcsoar-exp,代码行数:10,代码来源:dlgQuickMenu.cpp

示例11: assignArray

    void assignArray(const StaticArray<T>& array) {
      _size = 0;

      if (_data) {
        delete[] _data;
        _data = 0;
      }

      initWithData(array.cArray(), array.size());
    }
开发者ID:jeffreyhunter77,项目名称:cpp-objects,代码行数:10,代码来源:StaticArray.hpp

示例12: Refresh

  void Refresh(fixed Time) {
    available.Expire(Time, fixed(10));
    if (!available)
      traffic.clear();

    for (unsigned i = traffic.size(); i-- > 0;)
      if (!traffic[i].Refresh(Time))
        traffic.quick_remove(i);

    NewTraffic = false;
  }
开发者ID:macsux,项目名称:XCSoar,代码行数:11,代码来源:State.hpp

示例13: Show

  void Show(const PixelRect &rc) override {
    const Layout layout(rc, geometry);

    RowFormWidget::Show(layout.form);

    copy_button.MoveAndShow(layout.copy_button);
    paste_button.MoveAndShow(layout.paste_button);
    close_button.MoveAndShow(layout.close_button);

    for (unsigned i = 0; i < previews.size(); ++i)
      previews[i].MoveAndShow(layout.info_boxes.positions[i]);
  }
开发者ID:ThomasXBMC,项目名称:XCSoar,代码行数:12,代码来源:dlgConfigInfoboxes.cpp

示例14: writeRegister

uint8_t writeRegister(Spi& pSpi, FiveByteRegister pRegister, StaticArray<uint8_t,5> pValue)
{
    uint8_t cmd = CMD_W_REGISTER | (pRegister & MASK_REGISTER_CMD);

    pSpi.chipSelect(true);
    uint8_t status = pSpi.transfer(cmd);
    for (size_t i = 0 ; i < pValue.size() ; ++i) {
        pSpi.transfer(pValue[i]);
    }
    pSpi.chipSelect(false);
    return status;
}
开发者ID:abymmathew,项目名称:BtMqttSn,代码行数:12,代码来源:Bt_Rf24Device.cpp

示例15: readRegister

StaticArray<uint8_t,5> readRegister(Spi& pSpi, FiveByteRegister pRegister)
{
    StaticArray<uint8_t,5> value;
    uint8_t cmd = CMD_R_REGISTER | (pRegister & MASK_REGISTER_CMD);

    pSpi.chipSelect(true);
    pSpi.transfer(cmd);
    for (size_t i = 0 ; i < value.size()  ; ++i) {
        value[i] = pSpi.transfer(CMD_NOP);
    }
    pSpi.chipSelect(false);

    return value;
}
开发者ID:abymmathew,项目名称:BtMqttSn,代码行数:14,代码来源:Bt_Rf24Device.cpp


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