コード例 #1
0
//------------------------------------------------------------------------------
// shutdownNotification() -- We're shutting down
//------------------------------------------------------------------------------
bool Station::shutdownNotification()
{
   // Tell the interoperability networks that we're shutting down
   if (networks != 0) {
      Basic::List::Item* item = networks->getFirstItem();
      while (item != 0) {
         Basic::Pair* pair = (Basic::Pair*)(item->getValue());
         Basic::Component* p = dynamic_cast<Basic::Component*>(pair->object());
         p->event(SHUTDOWN_EVENT);
         item = item->getNext();
      }
   }
   setSlotNetworks(0);

   // Tell the I/O devices that we're shutting down
   if (ioHandlers != 0) {
      Basic::List::Item* item = ioHandlers->getFirstItem();
      while (item != 0) {
         Basic::Pair* pair = (Basic::Pair*)(item->getValue());
         Basic::Component* p = dynamic_cast<Basic::Component*>(pair->object());
         p->event(SHUTDOWN_EVENT);
         item = item->getNext();
      }
   }
   setSlotIoHandler((Basic::PairStream*)0);

   // Tell our simulation to shut down
   Simulation* s = getSimulation();
   if (s != 0) {
      s->event(SHUTDOWN_EVENT);
   }
   setOwnshipPlayer(0);

   // Inform our OTW interfaces
   if (otw != 0) {
      Basic::List::Item* item = otw ->getFirstItem();
      while (item != 0) {
         Basic::Pair* pair = (Basic::Pair*)(item->getValue());
         Basic::Component* p = dynamic_cast<Basic::Component*>(pair->object());
         p->event(SHUTDOWN_EVENT);
         item = item->getNext();
      }
   }
   setSlotOutTheWindow((Basic::PairStream*)0);

   // Zero (unref) our thread objects (of any).  The thread's functions have ref()'d
   // these objects, so they won't be deleted until the threads terminate, which they
   // will based on our BaseClass::isShutdown() function.  But at least we won't
   // mistakenly think that they're still around.
   tcThread = 0;
   netThread = 0;
   bgThread = 0;

   // remove the reset timer
   setSlotStartupResetTime(0);

   return BaseClass::shutdownNotification();
}
コード例 #2
0
ファイル: Stores.cpp プロジェクト: AFIT-Hodson/OpenEaagles
//------------------------------------------------------------------------------
// 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();
      }
   }
}
コード例 #3
0
ファイル: Datalink.cpp プロジェクト: Stupefy/OpenEaagles
// 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;
}
コード例 #4
0
//------------------------------------------------------------------------------
// killedNotification() -- Default killed notification handler
//------------------------------------------------------------------------------
bool System::killedNotification(Player* const p)
{
   // Just let all of our subcomponents know that we were just killed
   Basic::PairStream* subcomponents = getComponents();
   if(subcomponents != 0) {
      for (Basic::List::Item* item = subcomponents->getFirstItem(); item != 0; item = item->getNext()) {
         Basic::Pair* pair = (Basic::Pair*)(item->getValue());
         Basic::Component* sc = (Basic::Component*) pair->object();
         sc->event(KILL_EVENT, p);
      }
      subcomponents->unref();
      subcomponents = 0;
   }
   return true;
}
コード例 #5
0
ファイル: Stores.cpp プロジェクト: AFIT-Hodson/OpenEaagles
//------------------------------------------------------------------------------
// 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;
}
コード例 #6
0
ファイル: StoresMgr.cpp プロジェクト: azcbuell/OpenEaagles
//------------------------------------------------------------------------------
// 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();
}