//===========================================================================//
// File:	entity2.cc                                                          //
// Project: MUNGA           Brick: Entity Manager                            //
// Contents: Implementation details of the entity class                      //
//---------------------------------------------------------------------------//
//   Date    Who  Modification                                               //
// --------  ---  ---------------------------------------------------------- //
// 11/29/94  JMA  Initial coding.                                            //
//---------------------------------------------------------------------------//
// Copyright (C) 1994-1995, Virtual World Entertainment, Inc.                //
// All Rights reserved worldwide                                             //
// This unpublished sourcecode is PROPRIETARY and CONFIDENTIAL               //
//===========================================================================//

#include <munga.hpp>
#pragma hdrstop

#if !defined(HOSTMGR_HPP)
#	include <hostmgr.hpp>
#endif

#if !defined(REGISTRY_HPP)
#	include <registry.hpp>
#endif

#if !defined(APP_HPP)
	#include <app.hpp>
#endif

#if !defined(NAMELIST_HPP)
	#include <namelist.hpp>
#endif

#if !defined(NOTATION_HPP)
	#include <notation.hpp>
#endif

#if !defined(ENTITY_HPP)
	#include <entity.hpp>
#endif

//##########################################################################
//#############    Entity::StaticVideoSocketIterator    ####################
//##########################################################################

Entity__StaticVideoSocketIterator::Entity__StaticVideoSocketIterator(
	Entity *entity
):
	SChainIteratorOf<Component*>(&entity->staticVideoSocket)
{
}

Entity__StaticVideoSocketIterator::Entity__StaticVideoSocketIterator(
	const Entity__StaticVideoSocketIterator &iterator
):
	SChainIteratorOf<Component*>(iterator)
{
}

Entity__StaticVideoSocketIterator::~Entity__StaticVideoSocketIterator()
{
}

//##########################################################################
//#############    Entity::DynamicVideoSocketIterator    ###################
//##########################################################################

Entity__DynamicVideoSocketIterator::Entity__DynamicVideoSocketIterator(
	Entity *entity
):
	SChainIteratorOf<Component*>(&entity->dynamicVideoSocket)
{
}

Entity__DynamicVideoSocketIterator::Entity__DynamicVideoSocketIterator(
	const Entity__DynamicVideoSocketIterator &iterator
):
	SChainIteratorOf<Component*>(iterator)
{
}

Entity__DynamicVideoSocketIterator::~Entity__DynamicVideoSocketIterator()
{
}

//##########################################################################
//################    Entity::AudioSocketIterator    #######################
//##########################################################################

Entity__AudioSocketIterator::Entity__AudioSocketIterator(Entity *entity):
	SChainIteratorOf<Component*>(&entity->audioSocket)
{
}

Entity__AudioSocketIterator::~Entity__AudioSocketIterator()
{
}

int
	Find_Subsystem_Index(
		NotationFile *file,
		const char* name
	)
{
	Check(file);
	Check_Pointer(name);

	NameList *namelist = file->MakePageList();
	Register_Object(namelist);
	NameList::Entry *entry = namelist->GetFirstEntry();

	int count = 0;
	while (entry)
	{
		if (!strcmp(name, entry->GetName()))
		{
			Unregister_Object(namelist);
			delete namelist;
			return count;
		}
		++count;
		entry = entry->GetNextEntry();
	}

	Unregister_Object(namelist);
	delete namelist;
	return (!strcmp(name, "None")) ? count : -1;
}

