//===========================================================================// // File: socket.hh // // Project: MUNGA Brick: Connection Library // // Contents: Interface specifications for base socket and its iterator // //---------------------------------------------------------------------------// // Date Who Modification // // -------- --- ---------------------------------------------------------- // // 10/19/94 ECH Initial coding. // // 10/20/94 JMA Fixed style stuff, merged with SKTITR.HPP // // 10/23/94 ECH Added greater deletion safety // // 10/28/94 JMA Made compatible with SGI CC // // 11/03/94 ECH Made compatible with BC4.0 // // 11/03/94 ECH Fixed InsertImplementation warning // // 11/05/94 JMA Made compatible with GNU C++ // // 12/12/94 ECH Changed release mechanism // // 02/16/95 ECH Removed plug commands, added node command // //---------------------------------------------------------------------------// // Copyright (C) 1994-1995, Virtual World Entertainment, Inc. // // All Rights reserved worldwide // // This unpublished sourcecode is PROPRIETARY and CONFIDENTIAL // //===========================================================================// #if !defined(SOCKET_HPP) # define SOCKET_HPP # if !defined(PLUG_HPP) # include # endif class Node; //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Socket ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ class Socket SIGNATURED { public: // //-------------------------------------------------------------------- //-------------------------------------------------------------------- // Public interface // // NOTE: All unsafe, untyped public methods are named XXXPlug or // XXXIterator. The safe, typed public methods are named XXX and are // declared in the template sub-classes. //-------------------------------------------------------------------- //-------------------------------------------------------------------- // // //-------------------------------------------------------------------- // Destructor and instance testing //-------------------------------------------------------------------- // virtual ~Socket(); Logical TestInstance() const; // //-------------------------------------------------------------------- // AddPlug - Add a plug to this socket, untyped access //-------------------------------------------------------------------- // void AddPlug(Plug *plug) {AddImplementation(plug);} // //-------------------------------------------------------------------- //-------------------------------------------------------------------- // Node* GetReleaseNode() {return socketsNode;} void SetReleaseNode(Node *release_node) {socketsNode = release_node;} protected: // //-------------------------------------------------------------------- //-------------------------------------------------------------------- // Protected interface //-------------------------------------------------------------------- //-------------------------------------------------------------------- // Socket(Node *node); // //-------------------------------------------------------------------- // Protected untyped implementations //-------------------------------------------------------------------- // virtual void AddImplementation(Plug *plug); // //-------------------------------------------------------------------- //-------------------------------------------------------------------- // Node *socketsNode; }; //~~~~~~~~~~~~~~~~~~~~~~~~~~~ SocketIterator ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Considering removal #if 0 typedef int (*IteratorFunction)( Plug *plug, void *info ); const int IteratorFunctionNullReturn = 0; #endif class SocketIterator: public Iterator { public: // //-------------------------------------------------------------------- //-------------------------------------------------------------------- // Public interface // // NOTE: All unsafe, untyped public methods are named XXXPlug. The // safe, typed public methods are named XXX and are declared in the // template sub-classes. //-------------------------------------------------------------------- //-------------------------------------------------------------------- // // //-------------------------------------------------------------------- // Destructor and testing //-------------------------------------------------------------------- // ~SocketIterator(); Logical TestInstance() const; // //-------------------------------------------------------------------- // Iterator methods (see Iterator for full listing) //-------------------------------------------------------------------- // Plug* ReadAndNextPlug() {return (Plug*)ReadAndNextImplementation();} Plug* ReadAndPreviousPlug() {return (Plug*)ReadAndPreviousImplementation();} Plug* GetCurrentPlug() {return (Plug*)GetCurrentImplementation();} Plug* GetNthPlug(CollectionSize index) {return (Plug*)GetNthImplementation(index);} // //-------------------------------------------------------------------- // InsertPlug - Inserts plug at current location //-------------------------------------------------------------------- // void InsertPlug(Plug *plug) {InsertImplementation(plug);} // //-------------------------------------------------------------------- // Remove - Removes the link at the current location, // does not remove the plug //-------------------------------------------------------------------- // virtual void Remove(); // //-------------------------------------------------------------------- // IsPlugMember - Determines if the plug is a member of the // sockets collection. //-------------------------------------------------------------------- // Logical IsPlugMember( Plug *plug ); // //-------------------------------------------------------------------- // RemovePlug - If the plug is a member of the sockets // collection then the link to that plug will be // removed //-------------------------------------------------------------------- // void RemovePlug( Plug *plug ); // //-------------------------------------------------------------------- // DeletePlugs - Unregisters and class delete for connected plugs. //-------------------------------------------------------------------- // void DeletePlugs(Logical defeat_release_node = True); // //-------------------------------------------------------------------- // SendPlugCommand - Send a command and related info to all plugs, // returns when all plugs receive command or until // receive method returns non-zero. If the receive // returns non-zero, then the iterator will remain // at that plug. //-------------------------------------------------------------------- // // Considering removal #if 0 int SendPlugCommand( Plug::CommandID plugCommand, void *info ); #endif protected: // //-------------------------------------------------------------------- //-------------------------------------------------------------------- // Protected interface //-------------------------------------------------------------------- //-------------------------------------------------------------------- // SocketIterator(Socket *socket); // Considering removal #if 0 int RunIteratorFunction( IteratorFunction iteratorFunction, void *info ); #endif virtual void InsertImplementation(Plug*); Socket *socket; }; #endif