Emulation.Common - Separate some attributes to their own file, and better document some attributes and interfaces

This commit is contained in:
adelikat 2016-12-12 09:00:58 -06:00
parent dbdac5e3f2
commit d78671a7e4
3 changed files with 42 additions and 31 deletions

View File

@ -1,6 +1,5 @@
namespace BizHawk.Emulation.Common
{
public interface IController
{
ControllerDefinition Type { get; }

View File

@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
namespace BizHawk.Emulation.Common
namespace BizHawk.Emulation.Common
{
/// <summary>
/// This interface specifies that an interface or implementation is a emulator core service, such as IDebuggable,
@ -14,34 +10,12 @@ namespace BizHawk.Emulation.Common
}
/// <summary>
/// Should be added to any field of an ICoreService that is not implemented. By Convention it should also throw a NotImplementedException
/// Any feature that does not have this attribute is assumed to be implemented
/// </summary>
public class FeatureNotImplemented : Attribute { }
/// <summary>
/// This represents a service that would not apply to every core, instead it is a specialized service specific to a core or group of cores
/// This represents a service that would not apply to every core,
/// instead it is a specialized service specific to a core or group of cores
/// This service is merely intended to define semantics and expectations of a service
/// Services of this type are not assumed to be "missing" from cores that fail to implement them
/// </summary>
public interface ISpecializedEmulatorService : IEmulatorService
{
}
[AttributeUsage(AttributeTargets.Class)]
public class ServiceNotApplicable : Attribute
{
public ServiceNotApplicable(params Type[] types)
{
if (types != null)
{
NotApplicableTypes = types.ToList();
}
else
{
NotApplicableTypes = new List<Type>();
}
}
public IEnumerable<Type> NotApplicableTypes { get; private set; }
}
}

View File

@ -0,0 +1,38 @@
using System;
using System.Collections.Generic;
using System.Linq;
namespace BizHawk.Emulation.Common
{
/// <summary>
/// Should be added to any field of an IEmulatorService that is not implemented.
/// By Convention it should also throw a NotImplementedException
/// Any feature that does not have this attribute is assumed to be implemented
/// </summary>
public class FeatureNotImplemented : Attribute { }
/// <summary>
/// Should be added to any implementation of IEmulator to document any
/// IEmulatorService (that is not an ISpecializedEmulatorService) that
/// by design, will not be implemented by the core
/// Any service that is unimplemented and not marked with this attribute is
/// assumed to be a "TODO" that needs to be done but hasn't been done yet
/// </summary>
[AttributeUsage(AttributeTargets.Class)]
public class ServiceNotApplicable : Attribute
{
public ServiceNotApplicable(params Type[] types)
{
if (types != null)
{
NotApplicableTypes = types.ToList();
}
else
{
NotApplicableTypes = new List<Type>();
}
}
public IEnumerable<Type> NotApplicableTypes { get; private set; }
}
}