本文整理汇总了C++中DynArray::getLen方法的典型用法代码示例。如果您正苦于以下问题:C++ DynArray::getLen方法的具体用法?C++ DynArray::getLen怎么用?C++ DynArray::getLen使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DynArray
的用法示例。
在下文中一共展示了DynArray::getLen方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: boot_flash
void Boot::boot_flash(ulen off) const
{
DynArray<unsigned> boot;
buildBoot(boot);
const unsigned WS = sizeof (unsigned) ; // 4, unsigned == uint32
if( boot.getLen()>(MaxFlashLen-BootDataOff)/WS )
{
Printf(Exception,"CCore::Boot::boot_flash() : too large boot");
}
ulen len=boot.getLen()*WS+BootDataOff;
ulen block_count=(len+Flash::BlockSize-1)/Flash::BlockSize;
ulen block_index=off/Flash::BlockSize;
for(ulen ind=block_index,lim=ind+block_count; ind<lim ;ind++)
if( !Flash::Erase(ind) )
{
Flash::ReadMode();
Printf(Exception,"CCore::Boot::boot_flash() : flash erase failure");
}
else
{
Printf(Con,"Block #; erased\n",ind);
}
if( !Flash::Write(off+BootDataOff,Range_const(boot)) )
{
Flash::ReadMode();
Printf(Exception,"CCore::Boot::boot_flash() : flash write failure");
}
PtrLen<const uint32> boot_code=Range(&__std_bootflash_beg,&__std_bootflash_end);
if( !Flash::Write(off,boot_code) )
{
Flash::ReadMode();
Printf(Exception,"CCore::Boot::boot_flash() : flash write failure");
}
}
示例2: layout
virtual void layout(Point size_)
{
size=size_;
field=Pane(size.x/4,size.y/4,size.x/2,size.y/2);
for(ulen i=0,len=dots.getLen(); i<len ;i++) dots_based[i]=dots[i]-field.getBase();
}
示例3: boot_run
void Boot::boot_run() const
{
DynArray<unsigned> boot;
buildBoot(boot,Range(&__std_boot_beg,&__std_boot_end));
__std_boot(boot.getPtr(),boot.getPtr()+boot.getLen());
}
示例4: printList
void printList()
{
Printf(out_file,"name list #;\n\n",rec_list.getLen());
for(auto r=Range_const(rec_list); +r ;++r)
{
Printf(out_file,"#;\n",*r);
}
}
示例5: select
void select(Point point)
{
if( selected<dots.getLen() )
{
dots[selected]=point;
dots_based[selected]=point-field.getBase();
win->redraw();
}
}
示例6: take
BuilderSlot & take(ulen slot_id)
{
ulen len=bslots.getLen();
if( slot_id>=len )
{
bslots.extend_default(LenAdd(slot_id-len,1));
}
return bslots[slot_id];
}
示例7: clickLeft
virtual void clickLeft(Point point,MouseKey mkey)
{
if( mkey&MouseKey_Shift )
{
dots.reserve(1);
dots_based.reserve(1);
Insert(dots,selected,point);
Insert(dots_based,selected,point-field.getBase());
if( dots.getLen()>1 ) selected++;
win->redraw();
}
else
{
select(point);
}
}
示例8: key
virtual void key(VKey vkey,KeyMod kmod)
{
switch( vkey )
{
case VKey_F1 :
{
draw_type=DrawPath;
win->redraw();
}
break;
case VKey_F2 :
{
draw_type=DrawLoop;
win->redraw();
}
break;
case VKey_F3 :
{
draw_type=DrawCurvePath;
win->redraw();
}
break;
case VKey_F4 :
{
draw_type=DrawCurveLoop;
win->redraw();
}
break;
case VKey_F5 :
{
draw_type=DrawPathSmooth;
win->redraw();
}
break;
case VKey_F6 :
{
draw_type=DrawLoopSmooth;
win->redraw();
}
break;
case VKey_F7 :
{
draw_type=DrawCurvePathSmooth;
win->redraw();
}
break;
case VKey_F8 :
{
draw_type=DrawCurveLoopSmooth;
win->redraw();
}
break;
case VKey_F9 :
{
draw_type=DrawSolid;
win->redraw();
}
break;
case VKey_F10 :
{
draw_type=DrawCurveSolid;
win->redraw();
}
break;
case VKey_F11 :
{
solid_flag=(solid_flag?SolidOdd:SolidAll);
win->redraw();
}
break;
case VKey_Tab :
{
if( ulen len=dots.getLen() )
{
if( kmod&KeyMod_Shift )
{
if( selected ) selected--; else selected=len-1;
}
//.........这里部分代码省略.........
示例9: draw
virtual void draw(FrameBuf<DesktopColor> buf,bool) const
{
if( magnify )
{
CommonDrawArt art(buf);
art.grid(cfg.magnify);
switch( draw_type )
{
case DrawCurvePath : art.curvePath_micro(Range_const(dots),cfg.path,focus,cfg.magnify); break;
case DrawPathSmooth : art.path_smooth_micro(Range_const(dots),cfg.path,focus,cfg.magnify); break;
case DrawCurvePathSmooth : art.curvePath_smooth_micro(Range_const(dots),cfg.path,focus,cfg.magnify); break;
}
}
else
{
CommonDrawArt art(buf);
art.erase(cfg.back);
art.block(field,cfg.field);
if( draw_type<DrawSolid )
{
for(auto p : dots ) art.knob(p,cfg.knob_len,cfg.knob);
if( selected<dots.getLen() ) cross(art,dots[selected],cfg.cross);
}
CommonDrawArt field_art(buf.cut(field));
ClockTimer timer;
switch( draw_type )
{
case DrawPath : field_art.path(Range_const(dots_based),cfg.path); break;
case DrawLoop : field_art.loop(Range_const(dots_based),cfg.path); break;
case DrawCurvePath : field_art.curvePath(Range_const(dots_based),cfg.path); break;
case DrawCurveLoop : field_art.curveLoop(Range_const(dots_based),cfg.path); break;
case DrawPathSmooth : field_art.path_smooth(Range_const(dots_based),cfg.path); break;
case DrawLoopSmooth : field_art.loop_smooth(Range_const(dots_based),cfg.path); break;
case DrawCurvePathSmooth : field_art.curvePath_smooth(Range_const(dots_based),cfg.path); break;
case DrawCurveLoopSmooth : field_art.curveLoop_smooth(Range_const(dots_based),cfg.path); break;
case DrawSolid : field_art.solid(Range_const(dots_based),solid_flag,cfg.solid); break;
case DrawCurveSolid : field_art.curveSolid(Range_const(dots_based),solid_flag,cfg.solid); break;
}
auto time=timer.get();
Printf(out,"#;[#;] #;\n",GetTextDesc(draw_type),dots.getLen(),time);
if( draw_type>=DrawSolid )
{
if( selected<dots.getLen() ) cross(art,dots[selected],cfg.cross);
}
}
}
示例10: operator
void BuildImage::operator () ()
{
Sort(Range(table));
ulen max_name_len=8;
for(auto &obj : table ) Replace_max(max_name_len,obj.name.len);
StrPrintOpt name_opt;
name_opt.width=max_name_len;
Printf(Con,"#; -------- -------- -----\n",RepeatChar(max_name_len,'-'));
Printf(Con,"#; address size flags\n",BindOpt(name_opt,"name"));
Printf(Con,"#; -------- -------- -----\n",RepeatChar(max_name_len,'-'));
if( !table.getLen() )
{
Printf(Exception,"No sections");
}
load_base=table[0].sect.address;
for(auto r=Range(table); +r ;++r)
{
Printf(Con,"#; #8.16i; #8.16i; #;\n",BindOpt(name_opt,r->name),r->sect.address,r->sect.size,PrintFlags(r->sect.flags));
uint32 lim=Guard(r->sect.address,r->sect.size);
if( r.len>=2 )
{
auto &r1=r[1];
if( r1.sect.address<lim )
{
Printf(Exception,"Section overlapp");
}
if( r1.sect.address>lim )
{
Printf(Con,"#; #8.16i; #8.16i; #;\n",RepeatChar(max_name_len,' '),lim,(r1.sect.address-lim),"hole");
}
}
else
{
Printf(Con,"#; #8.16i;\n",RepeatChar(max_name_len,' '),lim);
load_lim=lim;
}
}
Printf(Con,"#; -------- -------- -----\n\n",RepeatChar(max_name_len,'-'));
Printf(Con,"load_base = #8.16i;\n\n",load_base);
Printf(Con,"load_lim = #8.16i;\n\n",load_lim);
Printf(Con,"entry_point = #8.16i;\n\n",entry_point);
if( entry_point<load_base || entry_point>=load_lim )
{
Printf(Exception,"Bad entry point");
}
#if 1
if( load_base!=0x81000000 )
{
Printf(Exception,"Bad load base");
}
if( entry_point!=load_base )
{
Printf(Exception,"Bad entry point");
}
#endif
}