BizHawk/BizHawk.Emulation.Common/Base Implementations/TraceBuffer.cs

40 lines
685 B
C#
Raw Normal View History

using System.Collections.Generic;
using System.Linq;
2014-12-05 00:17:34 +00:00
namespace BizHawk.Emulation.Common
{
public class TraceBuffer : ITraceable
2014-12-05 00:17:34 +00:00
{
private readonly List<TraceInfo> Buffer = new List<TraceInfo>();
2014-12-05 00:17:34 +00:00
public TraceBuffer()
{
Header = "Instructions";
}
public IEnumerable<TraceInfo> TakeContents()
2014-12-05 00:17:34 +00:00
{
var contents = Buffer.ToList();
Buffer.Clear();
return contents;
2014-12-05 00:17:34 +00:00
}
public IEnumerable<TraceInfo> Contents
2014-12-05 00:17:34 +00:00
{
get { return Buffer; }
2014-12-05 00:17:34 +00:00
}
public void Put(TraceInfo content)
2014-12-05 00:17:34 +00:00
{
if (Enabled)
{
Buffer.Add(content);
2014-12-05 00:17:34 +00:00
}
}
public bool Enabled { get; set; }
public string Header { get; set; }
}
}