//===========================================================================// // File: link.cc // // Project: MUNGA Brick: Connection Library // // Contents: Implementation details of base Link // //---------------------------------------------------------------------------// // Date Who Modification // // -------- --- ---------------------------------------------------------- // // 09/28/94 ECH Initial coding. // // 10/20/94 JMA Fixed style stuff. // // 10/28/94 JMA Made compatible with SGI CC // // 11/03/94 ECH Made compatible with BC4.0 // // 12/12/94 ECH Changed release handling // //---------------------------------------------------------------------------// // Copyright (C) 1994-1995, Virtual World Entertainment, Inc. // // All Rights reserved worldwide // // This unpublished sourcecode is PROPRIETARY and CONFIDENTIAL // //===========================================================================// #include "StuffHeaders.hpp" //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Link ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // //############################################################################# // ~Link //############################################################################# // Link::~Link() { Check_Signature(this); // //----------------------------------------------------- // Remove this link from the plugs current set of links //----------------------------------------------------- // Verify(!m_nextPlugLink); Check_Object(m_plug); Verify(m_plug->m_linkHead != this); } // //############################################################################# // TestInstance //############################################################################# // void Link::TestInstance() { Check_Signature(m_socket); Check_Signature(m_plug); } // //############################################################################# // Remove //############################################################################# // void Link::Remove(Plug *plug) { Check_Object(this); delete this; } // //############################################################################# // ReleaseFromPlug //############################################################################# // void Link::ReleaseFromPlug() { Check_Object(this); // //----------------------------------------------------- // Remove this link from the plugs current set of links //----------------------------------------------------- // Check_Object(m_plug); Link *link = m_plug->m_linkHead; Check_Object(link); if (link == this) { if (m_nextPlugLink != this) m_plug->m_linkHead = m_nextPlugLink; else { m_nextPlugLink = m_plug->m_linkHead = NULL; return; } } while (link->m_nextPlugLink != this) { Check_Object(this); link = link->m_nextPlugLink; } link->m_nextPlugLink = m_nextPlugLink; m_nextPlugLink = NULL; } // //############################################################################# // AddToPlug //############################################################################# // void Link::AddToPlug(Plug *plug) { Check_Object(this); Check_Object(plug); if (!plug->m_linkHead) m_nextPlugLink = this; else { m_nextPlugLink = plug->m_linkHead->m_nextPlugLink; plug->m_linkHead->m_nextPlugLink = this; } plug->m_linkHead = this; }