Files
Cyd 2b8ca921cb Initial full mirror of c:\VWE (source + assets + toolchain + outputs) via Git LFS
Complete disaster-recovery snapshot: engine/game source, game data assets,
VC6 toolchain + DX SDKs, build outputs, deployed game, and _UNUSED archive.
Large binaries in Git LFS; text preserved byte-for-byte (core.autocrlf=false,
no eol attributes). See RECOVERY.md for the one-clone rebuild procedure.
2026-06-24 21:28:16 -05:00

222 lines
7.3 KiB
C++

//===========================================================================//
// 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 InsertItem 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 //
// 06/07/96 ECH Implemented socket based remove functionality //
//---------------------------------------------------------------------------//
// Copyright (C) 1994-1995, Virtual World Entertainment, Inc. //
// All Rights reserved worldwide //
// This unpublished sourcecode is PROPRIETARY and CONFIDENTIAL //
//===========================================================================//
#pragma once
#include "Stuff.hpp"
#include "Plug.hpp"
namespace Stuff {
//##########################################################################
//########################### Socket #################################
//##########################################################################
//
//--------------------------------------------------------------------------
// 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.
//--------------------------------------------------------------------------
//
class _declspec(novtable) Socket
#if defined(_ARMOR)
: public Stuff::Signature
#endif
{
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Destructor, testing
//
public:
virtual
~Socket()
{}
void
TestInstance()
{}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Socket methods
//
public:
//
//-----------------------------------------------------------------------
// DeletePlugs - For each plug in the socket, the routine unregisters it
// and then deletes it.
//-----------------------------------------------------------------------
//
virtual void
AddPlug(Plug *plug)=0;
//
//-----------------------------------------------------------------------
// RemovePlug - Remove a plug from this socket, untyped access.
//-----------------------------------------------------------------------
//
virtual void
DeletePlugs()=0;
void
RemovePlug(Plug *plug);
//
//-----------------------------------------------------------------------
// IsPlugMember - Determine if the plug is a member of this socket.
//-----------------------------------------------------------------------
//
virtual void*
GetNthItem(unsigned index)=0;
bool
IsPlugMember(Plug *plug);
//
//-----------------------------------------------------------------------
// IsEmpty - Returns true if the socket contains no plugs.
//-----------------------------------------------------------------------
//
virtual unsigned
GetSize()=0;
virtual bool
IsEmpty()=0;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Protected methods
//
protected:
explicit Socket(void *node=NULL)
{}
};
//##########################################################################
//######################## SocketIterator ############################
//##########################################################################
//
//--------------------------------------------------------------------------
// 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.
//--------------------------------------------------------------------------
//
class _declspec(novtable) SocketIterator:
public Iterator
{
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Destructor and testing
//
public:
~SocketIterator()
{}
Iterator*
MakeClone() = 0;
void
TestInstance() const
{}
//
//--------------------------------------------------------------------
// First - Moves to next item
// Last - Moves to last item
//--------------------------------------------------------------------
//
Iterator&
First();
Iterator&
Last();
//
//--------------------------------------------------------------------
// 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;
unsigned
GetSize();
virtual void*
GetNthItem(unsigned index)=0;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Iterator methods (see Iterator for full listing)
//
public:
Plug*
ReadAndNextPlug()
{return static_cast<Plug*>(ReadAndNextItem());}
Plug*
GetCurrentPlug()
{return static_cast<Plug*>(GetCurrentItem());}
void
DeletePlugs()
{Check_Object(m_socket); m_socket->DeletePlugs();}
//
//-----------------------------------------------------------------------
// Remove - Removes the link at the current location, does not remove
// the plug.
//-----------------------------------------------------------------------
//
virtual void
Remove()=0;
//
//-----------------------------------------------------------------------
// InsertPlug - Inserts a plug at the current ahead of the current
// location
//-----------------------------------------------------------------------
//
virtual void
InsertPlug(Plug*)=0;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Protected interface
//
protected:
explicit SocketIterator(Socket *socket)
{m_socket = socket;}
Socket
*m_socket;
};
}