• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ list::Item类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中basic::list::Item的典型用法代码示例。如果您正苦于以下问题:C++ Item类的具体用法?C++ Item怎么用?C++ Item使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: getSpecificBomb

// Get the next free bomb of type 'bombType'
Bomb* SimpleStoresMgr::getSpecificBomb(const Basic::String* const bombType)
{
   Bomb* bomb = 0;
   if (bombType != 0)  {

      Basic::PairStream* list = getWeapons();
      if (list != 0)  {

         // Find the first free (inactive) bomb
         Basic::List::Item* item = list->getFirstItem();
         while (item != 0 && bomb == 0) {
            Basic::Pair* pair = (Basic::Pair*)(item->getValue());
            Bomb* p = dynamic_cast<Bomb*>( pair->object() );
            if (p != 0 && p->isInactive()) {
               // Ok, we have a bomb, but is it the type we want?
               if (*p->getType() == *bombType) {
                  p->ref();
                  bomb = p;
               }
            }
            item = item->getNext();
         }

         list->unref();
      }

   }
   return bomb;
}
开发者ID:azcbuell,项目名称:OpenEaagles,代码行数:30,代码来源:StoresMgr.cpp


示例2: putOpen

// Puts a state on to the 'open' list
void Puzzle::putOpen(State* const s)
{
   if (openStates == nullptr) {
      // create the list (as needed)
      openStates = new Basic::List();
   }

   if (s != nullptr) {
      // Create a new list item for this state and get the state's f() value
      Basic::List::Item* newItem = new Basic::List::Item();
      newItem->value = s;
      s->ref();
      int f = s->f();

      // Find where in the list to insert this new state (based on their f() values)
      Basic::List::Item* item = openStates->getFirstItem();
      Basic::List::Item* refItem = nullptr;
      while (item != nullptr && refItem == nullptr) {
         const State* p = static_cast<const State*>( item->getValue() );
         if (f < p->f()) {
            refItem = item;
         }
         item = item->getNext();
      }

      // Insert our new state
      openStates->insert(newItem, refItem);
   }
}
开发者ID:krhohio,项目名称:OpenEaaglesExamples,代码行数:30,代码来源:Puzzle.cpp


示例3: computeSteerpointData

//------------------------------------------------------------------------------
// Compute nav steering data for each steerpoint.
//------------------------------------------------------------------------------
void Route::computeSteerpointData(const LCreal, const Navigation* const nav)
{
   if (nav != nullptr) {
      Basic::PairStream* steerpoints = getComponents();
      if (steerpoints != nullptr) {

         // Until we pass the 'to' steerpoint, the 'from' pointer will be
         // null(0) and the steerpoint's compute() function will compute
         // direct-to the steerpoint.  After the 'to' steerpoint, the 'from'
         // pointer will help compute each from-to leg of the route.
         Steerpoint* from = nullptr;

         Basic::List::Item* item = steerpoints->getFirstItem();
         while (item != nullptr) {
            Basic::Pair* pair = static_cast<Basic::Pair*>(item->getValue());
            Steerpoint* stpt = static_cast<Steerpoint*>(pair->object());
            stpt->compute(nav,from);
            if (pair == to || from != nullptr) from = stpt;
            item = item->getNext();
         }

         steerpoints->unref();
         steerpoints = nullptr;
      }
   }
}
开发者ID:derekworth,项目名称:afit-swarm-simulation,代码行数:29,代码来源:Route.cpp


示例4: getSpecificWeapon

// Get the next free weapon of this 'type'
Weapon* SimpleStoresMgr::getSpecificWeapon(const std::type_info& type)
{
   Weapon* wpn = 0;
   if (&type != 0) {

      Basic::PairStream* list = getWeapons();
      if (list != 0) {

         // Find the first free (inactive) bomb
         Basic::List::Item* item = list->getFirstItem();
         while (item != 0 && wpn == 0) {
            Basic::Pair* pair = (Basic::Pair*)(item->getValue());
            Weapon* p = dynamic_cast<Weapon*>( pair->object() );
            if (p != 0 && p->isInactive() && p->isClassType(type)) {
               p->ref();
               wpn = p;
            }
            item = item->getNext();
         }

         list->unref();
      }

   }
   return wpn;
}
开发者ID:azcbuell,项目名称:OpenEaagles,代码行数:27,代码来源:StoresMgr.cpp


示例5: getSteerpoints

//------------------------------------------------------------------------------
// getSteerpoints() -- Get the route we're flying to (starting at 'to')
//------------------------------------------------------------------------------
unsigned int Route::getSteerpoints(Basic::safe_ptr<Steerpoint>* const stptList, const unsigned int max)
{
    unsigned int i = 0;
    Basic::PairStream* steerpoints = getComponents();
    if (stptList != nullptr && max > 0 && steerpoints != nullptr) {

        // Find our 'to' steerpoint
        bool found = false;
        Basic::List::Item* item = steerpoints->getFirstItem();
        while (item != nullptr && !found) {
            Basic::Pair* pair = static_cast<Basic::Pair*>(item->getValue());
            found = (pair == to);
            if (!found) {
                item = item->getNext();
            }
        }

        // Get the route we're flying 'to'
        while (item != nullptr && i < max) {
            Basic::Pair* pair = static_cast<Basic::Pair*>(item->getValue());
            Steerpoint* p = dynamic_cast<Steerpoint*>(pair->object());
            if (p != nullptr) {
                stptList[i++] = p;
            }
            item = item->getNext();
        }
    }

    if (steerpoints != nullptr) {
       steerpoints->unref();
       steerpoints = nullptr;
    }

    return i;
}
开发者ID:derekworth,项目名称:afit-swarm-simulation,代码行数:38,代码来源:Route.cpp


示例6: createWindow

//-----------------------------------------------------------------------------
// createWindow() -- create the main window
//-----------------------------------------------------------------------------
int GlutDisplay::createWindow()
{
   winId = -1;

#ifdef __FREEGLUT_EXT_H__     /* freeglut only */
      glutSetOption(GLUT_ACTION_ON_WINDOW_CLOSE, GLUT_ACTION_GLUTMAINLOOP_RETURNS);
#endif

   unsigned int wmode = GLUT_DOUBLE | GLUT_RGB | GLUT_ALPHA;
   if (getClearDepth() >= 0.0f) { wmode = wmode | GLUT_DEPTH; }
   if (accumBuff) { wmode = wmode | GLUT_ACCUM; }
   if (stencilBuff) { wmode = wmode | GLUT_STENCIL; }
   glutInitDisplayMode( wmode );

   GLint  vpX(0), vpY(0);                   // our initial viewport position
   GLsizei vpWidth(0), vpHeight(0);    // our initial viewport size
   getViewport(&vpX, &vpY, &vpWidth, &vpHeight);
   glutInitWindowPosition(vpX, vpY);
   glutInitWindowSize(vpWidth, vpHeight);
   winId = glutCreateWindow(getName());
   if (winId > 0) {
      if (isMessageEnabled(MSG_INFO)) {
         std::cout << "GlutDisplay::createWindow() name = " << getName() << ", winId = " << winId << std::endl;
      }

      // Configure the new window
      if (fullScreenFlg) glutFullScreen();
      glutDisplayFunc(drawFuncCB);
      glutReshapeFunc(reshapeItCB);
      glutIdleFunc(idleCB);
      glutPassiveMotionFunc(passiveMotionFuncCB);
      glutMotionFunc(motionFuncCB);
      glutKeyboardFunc(keyboardFuncCB);
      glutSpecialFunc(specialFuncCB);
      glutMouseFunc(mouseFuncCB);
      glutEntryFunc(entryFuncCB);
      registerGlutDisplay(winId, this);
      glutSetWindow(winId);
      configure();
      loadTextures();

      // Create sub windows (if any)
      if (subDisplays() != nullptr) {
         Basic::List::Item* item = subDisplays()->getFirstItem();
         while (item != nullptr) {
            Basic::Pair* pair = dynamic_cast<Basic::Pair*>(item->getValue());
            if (pair != nullptr) {
               GlutDisplay* dobj = dynamic_cast<GlutDisplay*>( pair->object() );
               if (dobj != nullptr) dobj->createSubWindow(winId);
            }
            item = item->getNext();
         }
      }

      // Select this window
      select();
   }

   return winId;
}
开发者ID:derekworth,项目名称:afit-swarm-simulation,代码行数:63,代码来源:GlutDisplay.cpp


示例7: getSpecificMissile

// Get the next free missile of type 'missileType'
Missile* SimpleStoresMgr::getSpecificMissile(const Basic::String* const missileType)
{
   Missile* msl = 0;
   if (missileType != 0) {

      Basic::PairStream* list = getWeapons();
      if (list != 0) {

         // Find the first free (inactive) missile of type weaponType
         Basic::List::Item* item = list->getFirstItem();
         while (item != 0 && msl == 0) {
            Basic::Pair* pair = (Basic::Pair*)(item->getValue());
            Missile* p = dynamic_cast<Missile*>( pair->object() );
            if (p != 0 && p->isInactive()) {
               // Ok, we have a missile, but is it the type we want?
               if (*p->getType() == *missileType) {
                  p->ref();
                  msl = p;
               }
            }
            item = item->getNext();
         }

         list->unref();
      }

   }
   return msl;
}
开发者ID:azcbuell,项目名称:OpenEaagles,代码行数:30,代码来源:StoresMgr.cpp


示例8: reshapeIt

//-----------------------------------------------------------------------------
// reshape it function, for reshaping our subdisplays
//-----------------------------------------------------------------------------
void GlutDisplay::reshapeIt(int w, int h)
{
   //std::cout << "reshapeIt() winID = " << winId;
   //std::cout << "; size(" << w << ", " << h << ")";
   //std::cout << std::endl;
   // make sure we have a min height and width or our displays will get destroyed
   if (w > 10 && h > 10) {
      BaseClass::reshapeIt(w, h);

      if (subDisplays() != nullptr && okToResize) {

         // go through and put our new numbers in
         Basic::List::Item* item = subDisplays()->getFirstItem();
         while (item != nullptr) {
            Basic::Pair* pair = static_cast<Basic::Pair*>(item->getValue());
            if (pair != nullptr) {
               GlutDisplay* gd = dynamic_cast<GlutDisplay*>(pair->object());
               if (gd != nullptr) gd->reshapeSubWindow();
            }
            item = item->getNext();
         }

         // Restore our window ID
         glutSetWindow(this->getWindowId());
      }
   }
}
开发者ID:derekworth,项目名称:afit-swarm-simulation,代码行数:30,代码来源:GlutDisplay.cpp


示例9: setSlotStores

//------------------------------------------------------------------------------
// Set slot functions
//------------------------------------------------------------------------------
bool StoresMgr::setSlotStores(const Basic::PairStream* const msg)
{
   // First let our base class do everything that it needs to.
   BaseClass::setSlotStores(msg);

   // ---
   // Clear all previous stores and assigned weapons
   // ---
   weaponsList = 0;
   externalList = 0;
   fuelList = 0;
   gunPtr = 0;

   // ---
   // Use the stores list that the Stores class just processed.
   Basic::PairStream* stores = getStores();
   if (stores != 0){

      // Create the new weapons list that contains all weapons
      {
         Basic::PairStream* newWeapons = new Basic::PairStream();
         searchAndAdd(stores, typeid(Weapon), newWeapons);
         if (newWeapons->entries() > 0) weaponsList = newWeapons;
         newWeapons->unref();
      }

      // Create the new external stores list that contains all
      // non-weapon, external stores (e.g., fuel tanks, pods, guns)
      {
         Basic::PairStream* newExternal = new Basic::PairStream();
         searchAndAdd(stores, typeid(ExternalStore), newExternal);
         if (newExternal->entries() > 0) externalList = newExternal;
         newExternal->unref();
      }

      // Create the new fuel tank list that contains all fuel tanks
      {
         Basic::PairStream* newFuel = new Basic::PairStream();
         searchAndAdd(stores, typeid(FuelTank), newFuel);
         if (newFuel->entries() > 0) fuelList = newFuel;
         newFuel->unref();
      }

      // Find the primary gun; i.e., the first gun found on our stores
      Basic::List::Item* item = stores->getFirstItem();
      while (item != 0 && gunPtr == 0) {
         Basic::Pair* pair = (Basic::Pair*)(item->getValue());

         Gun* p = dynamic_cast<Gun*>( pair->object() );
         if (p != 0) gunPtr = p;

         item = item->getNext();
      }

      stores->unref();
      stores = 0;
   }

   return true;
}
开发者ID:azcbuell,项目名称:OpenEaagles,代码行数:63,代码来源:StoresMgr.cpp


示例10: stepOwnshipPlayer

//------------------------------------------------------------------------------
// stepOwnshipPlayer() -- Step to the next local player
//------------------------------------------------------------------------------
void SimStation::stepOwnshipPlayer()
{
   Basic::PairStream* pl = getSimulation()->getPlayers();
   if (pl != nullptr) {

      Simulation::Player* f = nullptr;
      Simulation::Player* n = nullptr;
      bool found = false;

      // Find the next player
      Basic::List::Item* item = pl->getFirstItem();
      while (item != nullptr) {
         Basic::Pair* pair = static_cast<Basic::Pair*>(item->getValue());
         if (pair != nullptr) {
            Simulation::Player* ip = static_cast<Simulation::Player*>(pair->object());
            if ( ip->isMode(Simulation::Player::ACTIVE) &&
               ip->isLocalPlayer() &&
               ip->isClassType(typeid(Simulation::AirVehicle))
               ) {
                  if (f == nullptr) { f = ip; }  // Remember the first
                  if (found)        { n = ip; ; break; }
                  if (ip == getOwnship()) found = true;
            }
         }
         item = item->getNext();
      }
      if (found && n == nullptr) n = f;
      if (n != nullptr) setOwnshipPlayer(n);

      pl->unref();
    }
}
开发者ID:jaegerbomb,项目名称:OpenEaaglesExamples,代码行数:35,代码来源:SimStation.cpp


示例11: onJettisonEvent

// Default weapon jettison event handler
bool Stores::onJettisonEvent(Weapon* const wpn)
{
   bool ok = false;
   if (wpn != nullptr) {

      Basic::PairStream* list = getStores();
      if (list != nullptr) {

         // First, make sure it's one of ours!
         bool found = false;
         Basic::List::Item* item = list->getFirstItem();
         while (item != nullptr && !found) {
            Basic::Pair* pair = static_cast<Basic::Pair*>(item->getValue());
            found = (wpn == pair->object());  // is it a match?
            item = item->getNext();
         }

         if (found) {
            // Send a jettison event to the weapon
            ok = wpn->event(JETTISON_EVENT);
         }

         list->unref();
         list = nullptr;
      }
   }
   return ok;
}
开发者ID:derekworth,项目名称:afit-swarm-simulation,代码行数:29,代码来源:Stores.cpp


示例12: onJettisonEvent

// Default external equipment jettison event handler
bool Stores::onJettisonEvent(ExternalStore* const sys)
{
   bool ok = false;
   if (sys != 0) {

      Basic::PairStream* list = getStores();
      if (list != 0) {

         // First, make sure it's one of ours!
         bool found = false;
         Basic::List::Item* item = list->getFirstItem();
         while (item != 0 && !found) {
            Basic::Pair* pair = static_cast<Basic::Pair*>(item->getValue());
            found = (sys == pair->object());  // is it a match?
            item = item->getNext();
         }

         if (found) {
            // Send a jettison event to the system
            ok = sys->event(JETTISON_EVENT);
         }

         list->unref();
         list = 0;
      }
   }
   return ok;
}
开发者ID:AFIT-Hodson,项目名称:OpenEaagles,代码行数:29,代码来源:Stores.cpp


示例13: updateData

//------------------------------------------------------------------------------
// updateData()
//------------------------------------------------------------------------------
void Instrument::updateData(const LCreal dt)
{
   // update our base class
   BaseClass::updateData(dt);

   // check for a color rotary, just in case we need one
   BasicGL::ColorRotary* cr = dynamic_cast<BasicGL::ColorRotary*>(getColor());
   if (cr != 0) cr->determineColor(preScaleInstVal);

   // only tell the rest of our instruments our value if we want them to know it
   if (allowPassing) {
      // sort out the instruments from our components
      Basic::PairStream* ps = getComponents();
      if (ps != 0) {
         Basic::List::Item* item = ps->getFirstItem();
         while(item != 0) {
            Basic::Pair* pair = (Basic::Pair*) item->getValue();
            if (pair != 0) {
               // send the value down to all of our instrument components
               Instrument* myInst = dynamic_cast<Instrument*>(pair->object());
               Basic::Number n = preScaleInstVal;
               if (myInst != 0) myInst->event(UPDATE_INSTRUMENTS, &n);
            }
            item = item->getNext();
         }
         ps->unref();
         ps = 0;
      }
   }
}
开发者ID:jmc734,项目名称:OpenEaagles,代码行数:33,代码来源:Instrument.cpp


示例14: resetStores

//------------------------------------------------------------------------------
// resetStores() -- Reset all stores
//------------------------------------------------------------------------------
void Stores::resetStores(Basic::PairStream* const list)
{
   // Reset the external stores
   if (list != 0) {
      Basic::List::Item* item = list->getFirstItem();
      while (item != 0) {
         Basic::Pair* pair = static_cast<Basic::Pair*>(item->getValue());
         Basic::Component* p = static_cast<Basic::Component*>( pair->object() );
         p->event(RESET_EVENT);
         item = item->getNext();
      }
   }
}
开发者ID:AFIT-Hodson,项目名称:OpenEaagles,代码行数:16,代码来源:Stores.cpp


示例15: onDatalinkMessageEvent

// DATALINK_MESSAGE event handler
bool Datalink::onDatalinkMessageEvent(Basic::Object* const msg)
{
   // Just pass it down to all of our subcomponents
   Basic::PairStream* subcomponents = getComponents();
   if (subcomponents != 0) {
      for (Basic::List::Item* item = subcomponents->getFirstItem(); item != 0; item = item->getNext()) {
         Basic::Pair* pair = static_cast<Basic::Pair*>(item->getValue());
         Basic::Component* sc = static_cast<Basic::Component*>(pair->object());
         sc->event(DATALINK_MESSAGE, msg);
      }
      subcomponents->unref();
      subcomponents = 0;
   }
   return true;
}
开发者ID:Stupefy,项目名称:OpenEaagles,代码行数:16,代码来源:Datalink.cpp


示例16: jettisonAll

//------------------------------------------------------------------------------
// Default function to jettison all jettisonable stores
//------------------------------------------------------------------------------
bool Stores::jettisonAll()
{
   // Notify the external stores that we're shutting down
   Basic::PairStream* list = getStores();
   if (list != 0) {
      Basic::List::Item* item = list->getFirstItem();
      while (item != 0) {
         Basic::Pair* pair = static_cast<Basic::Pair*>(item->getValue());
         Basic::Component* p = static_cast<Basic::Component*>( pair->object() );
         p->event(JETTISON_EVENT);
         item = item->getNext();
      }
      list->unref();
      list = 0;
   }
   return true;
}
开发者ID:AFIT-Hodson,项目名称:OpenEaagles,代码行数:20,代码来源:Stores.cpp


示例17: setSlotColumns

bool Table::setSlotColumns(Basic::PairStream* const msg)
{
   if (columns != 0) { columns->unref(); columns = 0; }
   if (msg != 0) {
      // Make a copy of the list and Make sure we have only Field objexts
      Basic::PairStream* newColumns = new Basic::PairStream();
      Basic::List::Item* item = msg->getFirstItem();
      while (item != 0) {
          Basic::Pair* pair = static_cast<Basic::Pair*>(item->getValue());
          BasicGL::Field* g = dynamic_cast<BasicGL::Field*>(pair->object());
          if (g != 0) {
              // We have a Field object, so add it to the new columns list
              newColumns->put(pair);
          }
          item = item->getNext();
      }
      columns = newColumns;
   }
   build();
   return true;
}
开发者ID:dfileccia,项目名称:OpenEaaglesExamples,代码行数:21,代码来源:Table.cpp


示例18: shutdownNotification

//------------------------------------------------------------------------------
// shutdownNotification() -- We're shutting down
//------------------------------------------------------------------------------
bool StoresMgr::shutdownNotification()
{
   // Notify the external stores that we're shutting down
   Basic::PairStream* list = getStores();
   if (list != 0) {
      Basic::List::Item* item = list->getFirstItem();
      while (item != 0) {
         Basic::Pair* pair = (Basic::Pair*)(item->getValue());
         Basic::Component* p = (Basic::Component*)( pair->object() );
         p->event(SHUTDOWN_EVENT);
         item = item->getNext();
      }
      list->unref();
      list = 0;
   }

   // Clear our stores
   setSlotStores(0);

   return BaseClass::shutdownNotification();
}
开发者ID:azcbuell,项目名称:OpenEaagles,代码行数:24,代码来源:StoresMgr.cpp


示例19: updateData

//------------------------------------------------------------------------------
// updateData() -- update non-time critical stuff here
//------------------------------------------------------------------------------
void Stores::updateData(const LCreal dt)
{
   // Update our non-weapon, external stores, which need to act as
   // active systems attached to our ownship player.
   {
      Basic::PairStream* list = getStores();
      if (list != 0) {
         Basic::List::Item* item = list->getFirstItem();
         while (item != 0) {
            Basic::Pair* pair = static_cast<Basic::Pair*>(item->getValue());
            ExternalStore* p = dynamic_cast<ExternalStore*>( pair->object() );
            if (p != 0) p->updateData(dt);
            item = item->getNext();
         }
         list->unref();
         list = 0;
      }
   }

   BaseClass::updateData(dt);
}
开发者ID:AFIT-Hodson,项目名称:OpenEaagles,代码行数:24,代码来源:Stores.cpp


示例20: setSlotBehaviors

bool Arbiter::setSlotBehaviors(Basic::PairStream* const x)
{
   bool ok = true;

   // First, make sure they are all behaviors
   {
      Basic::List::Item* item = x->getFirstItem();
      while (item != nullptr && ok) {
         Basic::Pair* pair = static_cast<Basic::Pair*>(item->getValue());
         item = item->getNext();
         Behavior* b = dynamic_cast<Behavior*>( pair->object() );
         if (b == nullptr) {
            // Item is NOT a behavior
            std::cerr << "setSlotBehaviors: slot: " << *pair->slot() << " is NOT of a Behavior type!" << std::endl;
            ok = false;
         }
      }
   }

   // next, add behaviors to our list
   if (ok) {
      Basic::List::Item* item = x->getFirstItem();
      while (item != nullptr) {
         Basic::Pair* pair = static_cast<Basic::Pair*>(item->getValue());
         item = item->getNext();
         Behavior* b = static_cast<Behavior*>(pair->object());
         addBehavior(b);
      }
   }

   return ok;
}
开发者ID:derekworth,项目名称:afit-swarm-simulation,代码行数:32,代码来源:Arbiter.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ basicblock::InstListType类代码示例发布时间:2022-05-31
下一篇:
C++ basic::PairStream类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap