using System;
using System.Runtime.InteropServices;
using NvAPIWrapper.Native.Interfaces;
namespace NvAPIWrapper.Native.Stereo.Structures
{
///
/// Holds a handle representing a Device Stereo Session
///
[StructLayout(LayoutKind.Sequential)]
public struct StereoHandle : IHandle, IEquatable
{
internal readonly IntPtr _MemoryAddress;
///
public bool Equals(StereoHandle other)
{
return _MemoryAddress.Equals(other._MemoryAddress);
}
///
public override bool Equals(object obj)
{
if (ReferenceEquals(null, obj))
{
return false;
}
return obj is StereoHandle handle && Equals(handle);
}
///
public override int GetHashCode()
{
return _MemoryAddress.GetHashCode();
}
///
public override string ToString()
{
return $"StereoHandle #{MemoryAddress.ToInt64()}";
}
///
public IntPtr MemoryAddress
{
get => _MemoryAddress;
}
///
public bool IsNull
{
get => _MemoryAddress == IntPtr.Zero;
}
///
/// Checks for equality between two objects of same type
///
/// The first object
/// The second object
/// true, if both objects are equal, otherwise false
public static bool operator ==(StereoHandle left, StereoHandle right)
{
return left.Equals(right);
}
///
/// Checks for inequality between two objects of same type
///
/// The first object
/// The second object
/// true, if both objects are not equal, otherwise false
public static bool operator !=(StereoHandle left, StereoHandle right)
{
return !left.Equals(right);
}
///
/// Gets default StereoHandle with a null pointer
///
public static StereoHandle DefaultHandle
{
get => default(StereoHandle);
}
}
}