/*
Copyright (C) 2014-2019 de4dot@gmail.com
This file is part of dnSpy
dnSpy is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
dnSpy is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with dnSpy. If not, see .
*/
using System;
using dnSpy.Contracts.Debugger.Engine.Evaluation;
namespace dnSpy.Contracts.Debugger.DotNet.Evaluation.Engine {
///
/// A .NET .
/// Use to export an instance.
///
public abstract class DbgDotNetEngineObjectIdFactory : DbgEngineObjectIdFactory {
readonly DbgEngineObjectIdFactory dbgEngineObjectIdFactory;
///
/// Constructor
///
/// Runtime guid, see
/// .NET language service instance
protected DbgDotNetEngineObjectIdFactory(Guid runtimeGuid, DbgDotNetLanguageService dbgDotNetLanguageService) {
if (dbgDotNetLanguageService is null)
throw new ArgumentNullException(nameof(dbgDotNetLanguageService));
dbgEngineObjectIdFactory = dbgDotNetLanguageService.GetEngineObjectIdFactory(runtimeGuid);
}
///
/// Returns true if it's possible to create an object id
///
/// Value created by this runtime
///
public sealed override bool CanCreateObjectId(DbgEngineValue value) => dbgEngineObjectIdFactory.CanCreateObjectId(value);
///
/// Creates an object id or returns null
///
/// Value created by this runtime
/// Unique id
///
public sealed override DbgEngineObjectId? CreateObjectId(DbgEngineValue value, uint id) => dbgEngineObjectIdFactory.CreateObjectId(value, id);
///
/// Checks if an object id and a value refer to the same data
///
/// Object id created by this class
/// Value created by this runtime
///
public sealed override bool Equals(DbgEngineObjectId objectId, DbgEngineValue value) => dbgEngineObjectIdFactory.Equals(objectId, value);
///
/// Gets the hash code of an object id
///
/// Object id created by this class
///
public sealed override int GetHashCode(DbgEngineObjectId objectId) => dbgEngineObjectIdFactory.GetHashCode(objectId);
///
/// Gets the hash code of a value created by this runtime
///
/// Value created by this runtime
///
public sealed override int GetHashCode(DbgEngineValue value) => dbgEngineObjectIdFactory.GetHashCode(value);
}
}