//------------------------------------------------------------------------------ // copyData() -- copy member data //------------------------------------------------------------------------------ void Display::copyData(const Display& org, const bool cc) { BaseClass::copyData(org); if (cc) initData(); if (org.ioHandler != nullptr) { Basic::IoHandler* copy = org.ioHandler->clone(); setSlotIoHandler(copy); copy->unref(); } else setSlotIoHandler(nullptr); // Item/Channel mapping for (unsigned int i = 0; i < TBL_SIZE; i++) { types[i] = org.types[i]; channels[i] = org.channels[i]; labelFlags[i] = org.labelFlags[i]; lcStrcpy(labels[i], sizeof(labels[i]), org.labels[i]); lcStrcpy(labelBuffs[i], sizeof(labelBuffs[i]), org.labelBuffs[i]); } item = org.item; // Display buffers for (unsigned int i = 0; i < TBL_SIZE; i++) { table_typeRo[i] = org.table_typeRo[i]; table_Label[i] = labelBuffs[i]; table_ai[i] = org.table_ai[i]; } }
//------------------------------------------------------------------------------ // 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(); }
//------------------------------------------------------------------------------ // deleteData() -- delete member data //------------------------------------------------------------------------------ void Station::deleteData() { // Terminate any old threads setTcThread(0); setNetThread(0); setBgThread(0); // Clear our pointers setOwnshipPlayer(0); setSlotOutTheWindow((Basic::PairStream*)0); setSlotNetworks(0); setSlotIoHandler((Basic::PairStream*)0); setSlotSimulation(0); setSlotStartupResetTime(0); }
//------------------------------------------------------------------------------ // deleteData() -- delete this object's data //------------------------------------------------------------------------------ void Display::deleteData() { setSlotIoHandler(nullptr); }
//------------------------------------------------------------------------------ // copyData() -- copy member data //------------------------------------------------------------------------------ void Station::copyData(const Station& org, const bool cc) { BaseClass::copyData(org); if (cc) initData(); // Terminate any old threads setTcThread(0); setNetThread(0); setBgThread(0); // Set the simulation exec if (org.sim != 0) { Simulation* copy = (Simulation*) org.sim->clone(); setSlotSimulation( copy ); copy->unref(); } else { setSlotSimulation(0); } // Copy the OTW handlers if (org.otw != 0) { Basic::PairStream* copy = (Basic::PairStream*) org.otw->clone(); setSlotOutTheWindow( copy ); copy->unref(); } else { setSlotOutTheWindow((Basic::PairStream*)0); } // Copy the networks if (org.networks != 0) { Basic::PairStream* copy = (Basic::PairStream*) org.networks->clone(); setSlotNetworks( copy ); copy->unref(); } else { setSlotNetworks((Basic::PairStream*)0); } // Copy the I/O handlers if (org.ioHandlers != 0) { Basic::PairStream* copy = (Basic::PairStream*) org.ioHandlers->clone(); setSlotIoHandler( copy ); copy->unref(); } else { setSlotIoHandler((Basic::PairStream*)0); } tcRate = org.tcRate; tcPri = org.tcPri; fastForwardRate = org.fastForwardRate; netRate = org.netRate; netPri = org.netPri; bgRate = org.bgRate; bgPri = org.bgPri; tmrUpdateEnbl = org.tmrUpdateEnbl; if (org.startupResetTimer0!= 0) { Basic::Time* copy = (Basic::Time*) org.startupResetTimer0->clone(); setSlotStartupResetTime( copy ); copy->unref(); } else { setSlotStartupResetTime(0); } startupResetTimer = org.startupResetTimer; // Unref our old stuff (if any) if (ownshipName != 0) { ownshipName->unref(); ownshipName = 0; } if (ownship != 0) { ownship->unref(); ownship = 0; } // Copy own ownship name if (org.ownshipName != 0) { ownshipName = dynamic_cast<Basic::String*> (org.ownshipName->clone() ); } // Attach our ownship setOwnshipByName( *ownshipName ); }
//----------------------------------------------------------------------------- // setSlotIoHandler() -- Sets a list of I/O handlers //----------------------------------------------------------------------------- bool Station::setSlotIoHandler(Basic::IoHandler* const p) { Basic::PairStream* list = new Basic::PairStream(); list->put( new Basic::Pair("1",p) ); return setSlotIoHandler(list); }