//------------------------------------------------------------------------------ // clearQueues() -- clear all queues //------------------------------------------------------------------------------ void Datalink::clearQueues() { Basic::Object* msg = inQueue->get(); while (msg != 0) { msg->unref(); msg = inQueue->get(); } msg = outQueue->get(); while (msg != 0) { msg->unref(); msg = outQueue->get(); } }
//------------------------------------------------------------------------------ // queueIncomingMessage() -- Queue up an incoming message //------------------------------------------------------------------------------ bool Datalink::queueIncomingMessage(Basic::Object* const msg) { // Only queue message if Ownship is local. IPlayer messages are processed on their local systems if ((getOwnship() == 0) || !(getOwnship()->isLocalPlayer())) { return true; } //if (isMessageEnabled(MSG_INFO)) { //std::cout << getOwnship()->getID() << "\tincomming QQueue Size: " << inQueue->entries() << std::endl; //} if(inQueue->isFull()) { if (isMessageEnabled(MSG_WARNING)) { std::cerr << "dumping 10 oldest messages in Datalink::inQueue" << std::endl; } for(int i = 0; i < 10; i++) { Basic::Object* obj = inQueue->get(); obj->unref(); } //clear out 10 oldest messages } if (msg != 0) { msg->ref(); inQueue->put(msg); } return true; }
//------------------------------------------------------------------------------ // queueOutgoingMessage() -- Queue up an out going message -- //------------------------------------------------------------------------------ bool Datalink::queueOutgoingMessage(Basic::Object* const msg) { //if (isMessageEnabled(MSG_INFO)) { //std::cout << getOwnship()->getID() << "\tOutgoing QQueue Size: " << outQueue->entries() << std::endl; //} if(outQueue->isFull()) { if (isMessageEnabled(MSG_WARNING)) { std::cerr << "dumping 10 oldest messages in Datalink::outQueue" << std::endl; } for(int i = 0; i < 10; i++) { Basic::Object* obj = outQueue->get(); if (obj != 0) obj->unref(); } //clear out 10 oldest messages } if (msg != 0) { msg->ref(); outQueue->put(msg); } return true; }
//------------------------------------------------------------------------------ // copyData() -- copy member data //------------------------------------------------------------------------------ void SlSymbol::copyData(const SlSymbol& org, const bool cc) { BaseClass::copyData(org); if (cc) initData(); visibility = org.visibility; llFlg = org.llFlg; acFlg = org.acFlg; scrnFlg = org.scrnFlg; type = org.type; lcStrcpy(id, sizeof(id), org.id); xPos = org.xPos; yPos = org.yPos; xScreenPos = org.xScreenPos; yScreenPos = org.yScreenPos; hdg = org.hdg; hdgValid = org.hdgValid; setHdgGraphics(0); setHdgAngleObj(0); { Basic::Object* copy = 0; if (org.value != 0) copy = org.value->clone(); setValue(copy); if (copy != 0) copy->unref(); } { Basic::Pair* copy = 0; if (org.pntr != 0) copy = org.pntr->clone(); setSymbolPair(copy); if (copy != 0) copy->unref(); } }