本文整理汇总了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();
}
示例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]));
}
示例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);
}
示例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;
}
示例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];
}
示例6:
static TaskPointFactoryType
GetRandomType(const LegalPointSet &l)
{
StaticArray<TaskPointFactoryType, LegalPointSet::N> types;
l.CopyTo(std::back_inserter(types));
return types[(rand() % types.size())];
}
示例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);
}
示例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;
}
示例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();
}
示例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);
}
示例11: assignArray
void assignArray(const StaticArray<T>& array) {
_size = 0;
if (_data) {
delete[] _data;
_data = 0;
}
initWithData(array.cArray(), array.size());
}
示例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;
}
示例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]);
}
示例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;
}
示例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;
}