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


C++ DynArray::getLen方法代码示例

本文整理汇总了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");
    }
 }
开发者ID:SergeyStrukov,项目名称:CCore,代码行数:47,代码来源:Boot.cpp

示例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();
  }
开发者ID:SergeyStrukov,项目名称:CCore,代码行数:8,代码来源:test4.cpp

示例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());
 }
开发者ID:SergeyStrukov,项目名称:CCore,代码行数:8,代码来源:Boot.cpp

示例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);
       }
    }
开发者ID:SergeyStrukov,项目名称:CCore-2-99,代码行数:9,代码来源:test4020.NamesCrc.cpp

示例5: select

 void select(Point point)
  {
   if( selected<dots.getLen() )
     {
      dots[selected]=point;
      dots_based[selected]=point-field.getBase();
      
      win->redraw();
     }
  }
开发者ID:SergeyStrukov,项目名称:CCore,代码行数:10,代码来源:test4.cpp

示例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];
    }
开发者ID:SergeyStrukov,项目名称:CCore-2-99,代码行数:11,代码来源:PerTask.cpp

示例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);
     }
  }
开发者ID:SergeyStrukov,项目名称:CCore,代码行数:19,代码来源:test4.cpp

示例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;
             }
//.........这里部分代码省略.........
开发者ID:SergeyStrukov,项目名称:CCore,代码行数:101,代码来源:test4.cpp

示例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);
        }
     }
  }
开发者ID:SergeyStrukov,项目名称:CCore,代码行数:61,代码来源:test4.cpp

示例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  
 }
开发者ID:SergeyStrukov,项目名称:CCore,代码行数:78,代码来源:main.cpp


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