diff --git a/ExternalProfilerDriver/VTuneInvoker.cs b/ExternalProfilerDriver/VTuneInvoker.cs index 59591a2..ca42218 100644 --- a/ExternalProfilerDriver/VTuneInvoker.cs +++ b/ExternalProfilerDriver/VTuneInvoker.cs @@ -25,6 +25,25 @@ namespace ExternalProfilerDriver { + public struct Maybe + { + public readonly static Maybe None = new Maybe(); + public T Value; + public bool HasValue; + + public Maybe(T value) { + Value = value; + HasValue = true; + } + + public override string ToString() + { + if (!HasValue) { + return ""; + } + return Value.ToString(); + } + } public class VTuneInvoker { diff --git a/ExternalProfilerDriverTest/MaybeTests.cs b/ExternalProfilerDriverTest/MaybeTests.cs new file mode 100644 index 0000000..254af5d --- /dev/null +++ b/ExternalProfilerDriverTest/MaybeTests.cs @@ -0,0 +1,17 @@ +using Microsoft.VisualStudio.TestTools.UnitTesting; +using ExternalProfilerDriver; + +namespace ExternalProfilerDriverTest +{ + [TestClass] + public class MaybeTest + { + [TestMethod] + public void TestMaybeNone() + { + Maybe testNothing = Maybe.None; + + Assert.IsFalse(testNothing.HasValue); + } + } +}