using System.Collections.Generic;
namespace Hast.Layer;
///
/// Configuration for IHastlayer.GenerateProxyAsync.
///
public interface IProxyGenerationConfiguration
{
///
/// Gets a dictionary that can contain settings for non-default configuration options.
///
IDictionary CustomConfiguration { get; }
///
/// Gets the communication channel used for communicating with the FPGA (eg. Ethernet).
///
string CommunicationChannelName { get; }
///
/// Gets a value indicating whether the results coming from the hardware implementation should be checked against a
/// software execution. If set to then both a hardware and software invocation will happen
/// and the result of the two compared. If there is a mismatch then an exception will be thrown.
///
bool VerifyHardwareResults { get; }
}
public static class ProxyGenerationConfigurationExtensions
{
///
/// Gets the custom configuration if it exists or creates and adds it if it doesn't.
///
/// Type of the configuration object.
///
/// Key where the custom configuration object is stored in the instance.
///
/// The existing or newly created configuration object.
public static T GetOrAddCustomConfiguration(this IProxyGenerationConfiguration proxyGenerationConfiguration, string key)
where T : new() =>
proxyGenerationConfiguration.CustomConfiguration.GetOrAddCustomConfiguration(key);
}