/*
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 System.ComponentModel.Composition;
namespace dnSpy.Contracts.Debugger.Engine.Evaluation {
///
/// Creates s.
/// Use to export an instance.
///
public abstract class DbgEngineObjectIdFactory {
///
/// Returns true if it's possible to create an object id
///
/// Value created by this runtime
///
public abstract bool CanCreateObjectId(DbgEngineValue value);
///
/// Creates an object id or returns null
///
/// Value created by this runtime
/// Unique id
///
public abstract DbgEngineObjectId? CreateObjectId(DbgEngineValue value, uint 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 abstract bool Equals(DbgEngineObjectId objectId, DbgEngineValue value);
///
/// Gets the hash code of an object id
///
/// Object id created by this class
///
public abstract int GetHashCode(DbgEngineObjectId objectId);
///
/// Gets the hash code of a value created by this runtime
///
/// Value created by this runtime
///
public abstract int GetHashCode(DbgEngineValue value);
}
/// Metadata
public interface IDbgEngineObjectIdFactoryMetadata {
/// See
string RuntimeGuid { get; }
/// See
double Order { get; }
}
///
/// Exports a instance
///
[MetadataAttribute, AttributeUsage(AttributeTargets.Class, AllowMultiple = false)]
public sealed class ExportDbgEngineObjectIdFactoryAttribute : ExportAttribute, IDbgEngineObjectIdFactoryMetadata {
///
/// Constructor
///
/// Runtime GUID, see
/// Order
public ExportDbgEngineObjectIdFactoryAttribute(string runtimeGuid, double order = double.MaxValue)
: base(typeof(DbgEngineObjectIdFactory)) {
RuntimeGuid = runtimeGuid ?? throw new ArgumentNullException(nameof(runtimeGuid));
Order = order;
}
///
/// Runtime GUID, see
///
public string RuntimeGuid { get; }
///
/// Order
///
public double Order { get; }
}
}