//===========================================================================// // File: sfeskt.hh // // Project: MUNGA Brick: Connection Engine // // Contents: Interface definition for safe socket class // //---------------------------------------------------------------------------// // Date Who Modification // // -------- --- ---------------------------------------------------------- // // 09/29/94 ECH Initial coding. // // 10/28/94 JMA Made compatible with SGI CC and merged with iterator // // 11/03/94 ECH Made compatible with BC4.0 // // 12/12/94 ECH Changed release mechanism // //---------------------------------------------------------------------------// // Copyright (C) 1994-1995, Virtual World Entertainment, Inc. // // PROPRIETARY AND CONFIDENTIAL // //===========================================================================// #pragma once #include "Stuff.hpp" #include "Socket.hpp" namespace Stuff { class SafeIterator; typedef int IteratorMemo; enum { PlugAdded = 0, PlugRemoved, NextSafeSocketMemo }; //~~~~~~~~~~~~~~~~~~~~~~~~~~~ SafeSocket ~~~~~~~~~~~~~~~~~~~~~~~~~~~ class _declspec(novtable) SafeSocket: public Socket { friend class SafeIterator; public: ~SafeSocket(); void TestInstance(); // //----------------------------------------------------------------------- // DeletePlugs - For each plug in the socket, the routine unregisters it // and then deletes it. //----------------------------------------------------------------------- // void AddPlug(Plug *plug)=0; // //----------------------------------------------------------------------- // RemovePlug - Remove a plug from this socket, untyped access. //----------------------------------------------------------------------- // void DeletePlugs()=0; // //----------------------------------------------------------------------- // IsPlugMember - Determine if the plug is a member of this socket. //----------------------------------------------------------------------- // void* GetNthItem(unsigned index)=0; // //----------------------------------------------------------------------- // IsEmpty - Returns true if the socket contains no plugs. //----------------------------------------------------------------------- // unsigned GetSize()=0; bool IsEmpty()=0; protected: explicit SafeSocket(void *node=NULL); void SendIteratorMemo( IteratorMemo memo, void *content ); private: SafeIterator *m_iteratorHead; }; //~~~~~~~~~~~~~~~~~~~~~~~~~~~ SafeIterator ~~~~~~~~~~~~~~~~~~~~~~~~~~~ class _declspec(novtable) SafeIterator: public SocketIterator { friend class SafeSocket; public: ~SafeIterator(); Iterator* MakeClone() = 0; void TestInstance() const; // //-------------------------------------------------------------------- // First - Moves to next item // Last - Moves to last item //-------------------------------------------------------------------- // Iterator& First()=0; Iterator& Last()=0; // //-------------------------------------------------------------------- // Next - Moves to next item // Previous - Moves to previous item //-------------------------------------------------------------------- // Iterator& Next()=0; Iterator& Previous()=0; // //-------------------------------------------------------------------- // ReadAndNextItem - Returns current item and moves to next item // ReadAndPreviousItem - Returns current item and moves to prev item // GetCurrentItem - Returns current item //-------------------------------------------------------------------- // void* GetCurrentItem()=0; void* ReadAndNextItem()=0; void* ReadAndPreviousItem()=0; void Remove()=0; void InsertPlug(Plug*)=0; protected: explicit SafeIterator(SafeSocket *safeSocket); virtual void ReceiveMemo( IteratorMemo memo, void *content ); SafeIterator *m_nextIterator; SafeIterator *m_prevIterator; }; }