///////////////////////////////////////////////////////////////////////////////
// SetFCOData
///////////////////////////////////////////////////////////////////////////////
void cDbDataSourceIter::SetFCOData( const iFCO* pFCO ) //throw (eError)
{
	ASSERT( ! Done() );
	if( Done() )
	{
		throw eHierDatabase( _T("Attempt to set FCO data when the iterator is done.") );
	}
	// TODO -- assert and throw if the fco's type is not the same as our creation function
	//		There is no way to do this through the serializable interface, but when there is,
	//		we should do the above assertion.
	//
	// if data already exists here, we first remove it; 
	//
	if( mDbIter.HasData() )
	{
		mDbIter.RemoveData();
	}
	//
	// write the fco's property set to a memory archive...
	//
	// TODO -- does this need to be static?
	static cMemoryArchive arch;
	arch.Seek			( 0, cBidirArchive::BEGINNING );
	cSerializerImpl ser	(arch, cSerializerImpl::S_WRITE);
	ser.Init();
	ser.WriteObject		( pFCO->GetPropSet() );
	ser.Finit();
	//
	// write this to the archive...
	//
	mDbIter.SetData( arch.GetMemory(), arch.CurrentPos() );
}
///////////////////////////////////////////////////////////////////////////////
// util_WriteObject -- this will write the given object to the database, returning
//      the address that it was written to, and throwing eArchive on error.
///////////////////////////////////////////////////////////////////////////////
static cHierAddr util_WriteObject( cHierDatabase* pDb, cHierNode* pNode )
{
    static cMemoryArchive arch;
    arch.Seek( 0, cBidirArchive::BEGINNING );
    pNode->Write( arch );

    cBlockRecordFile::tAddr addr = pDb->AddItem( arch.GetMemory(), arch.CurrentPos() );
    return cHierAddr( addr.mBlockNum, addr.mIndex );
}