using System;
using System.Runtime.InteropServices;
using NvAPIWrapper.Native.Attributes;
using NvAPIWrapper.Native.General.Structures;
using NvAPIWrapper.Native.Helpers;
using NvAPIWrapper.Native.Interfaces;
namespace NvAPIWrapper.Native.Mosaic.Structures
{
///
/// Holds brief information about a topology
///
[StructLayout(LayoutKind.Sequential, Pack = 8)]
[StructureVersion(1)]
public struct TopologyBrief : IInitializable, IEquatable
{
internal StructureVersion _Version;
internal readonly Topology _Topology;
internal readonly uint _IsEnable;
internal readonly uint _IsPossible;
///
/// Creates a new TopologyBrief
///
/// The topology
public TopologyBrief(Topology topology)
{
this = typeof(TopologyBrief).Instantiate();
_Topology = topology;
}
///
public bool Equals(TopologyBrief other)
{
return _Topology == other._Topology;
}
///
public override bool Equals(object obj)
{
if (ReferenceEquals(null, obj))
{
return false;
}
return obj is TopologyBrief brief && Equals(brief);
}
///
public override int GetHashCode()
{
return (int) _Topology;
}
///
/// 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 ==(TopologyBrief left, TopologyBrief 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 !=(TopologyBrief left, TopologyBrief right)
{
return !left.Equals(right);
}
///
/// The topology
///
public Topology Topology
{
get => _Topology;
}
///
/// Indicates if the topology is enable
///
public bool IsEnable
{
get => _IsEnable > 0;
}
///
/// Indicates if the topology is possible
///
public bool IsPossible
{
get => _IsPossible > 0;
}
}
}