//===========================================================================// // File: slot.hh // // Project: MUNGA Brick: Connection Library // // Contents: Interface specification for slot class // //---------------------------------------------------------------------------// // Date Who Modification // // -------- --- ---------------------------------------------------------- // // 10/20/94 ECH Initial coding. // // 10/28/94 JMA Made compatible with SGI CC // // 11/03/94 ECH Made compatible with BC4.0 // // 11/05/94 JMA Made compatible with GNU C++ // // 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 // //===========================================================================// #if !defined(SLOT_HPP) # define SLOT_HPP # if !defined(SOCKET_HPP) # include # endif # if !defined(MEMBLOCK_HPP) # include # endif class Slot; //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ SlotLink ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ #define SLOTLINK_MEMORYBLOCK_ALLOCATION (100) class SlotLink: public Link { friend class Slot; public: ~SlotLink(); Logical TestInstance() const; private: SlotLink( Slot *slot, Plug *plug ); private: static MemoryBlock AllocatedMemory; void* operator new(size_t) {return AllocatedMemory.New();} void operator delete(void *where) {AllocatedMemory.Delete(where);} }; //~~~~~~~~~~~~~~~~~~~~~~~~~~~ Slot ~~~~~~~~~~~~~~~~~~~~~~~~~~~ class Slot : public Socket { friend class SlotLink; public: // //-------------------------------------------------------------------- //-------------------------------------------------------------------- // Public interface //-------------------------------------------------------------------- //-------------------------------------------------------------------- // // //-------------------------------------------------------------------- // Constructor, Destructor and testing //-------------------------------------------------------------------- // Slot(Node *node); ~Slot(); Logical TestInstance() const; // //-------------------------------------------------------------------- // Remove - Remove the link //-------------------------------------------------------------------- // void Remove(); protected: // //-------------------------------------------------------------------- //-------------------------------------------------------------------- // Protected interface //-------------------------------------------------------------------- //-------------------------------------------------------------------- // void AddImplementation(Plug *plug); Plug* GetCurrentPlug() const; private: // //-------------------------------------------------------------------- // Private data //-------------------------------------------------------------------- // SlotLink *slotLink; }; //~~~~~~~~~~~~~~~~~~~~~~~~~~~ SlotOf ~~~~~~~~~~~~~~~~~~~~~~~~~~~ template class SlotOf: public Slot { public: // //-------------------------------------------------------------------- //-------------------------------------------------------------------- // Public interface //-------------------------------------------------------------------- //-------------------------------------------------------------------- // SlotOf(Node *node); ~SlotOf(); // //-------------------------------------------------------------------- // Socket methods (see Socket for full listing) //-------------------------------------------------------------------- // void Add(T plug) {AddImplementation(Cast_Object(Plug*,plug));} T GetCurrent() const {return (T)GetCurrentPlug();} }; //~~~~~~~~~~~~~~~~~~~~~~~~~~~ SlotOf templates ~~~~~~~~~~~~~~~~~~~~~~~~~~~ template SlotOf::SlotOf(Node *node): Slot(node) { } template SlotOf::~SlotOf() { } #endif