using System;
using Unity.Collections;
namespace UnityEngine.XR.ARKit
{
///
/// Represents the serialized form of an . Obtain with .
///
public struct SerializedARCollaborationData : IDisposable, IEquatable
{
///
/// Whether the has been created or not.
///
public bool created => m_NSData.created;
///
/// Get the raw bytes of the serialized as a NativeSlice.
/// No copies are made; the NativeSlice is a "view" into the raw data.
/// The NativeSlice is valid until this object is d.
///
/// Thrown if is false.
public unsafe NativeSlice bytes
{
get
{
if (!created)
throw new InvalidOperationException("The SerializedARCollaborationData has not been created.");
return m_NSData.ToNativeSlice();
}
}
///
/// Disposes the native resource associated with this .
///
public void Dispose() => m_NSData.Dispose();
///
/// Generates a hash code suitable for use in HashSet and Dictionary.
///
/// A hash of the .
public override int GetHashCode() => m_NSData.GetHashCode();
///
/// Compares for equality.
///
/// An object to compare against.
/// true if is an and
/// is also true. Otherwise, false.
public override bool Equals(object obj) => (obj is SerializedARCollaborationData) && Equals((SerializedARCollaborationData)obj);
///
/// Compares for equality.
///
/// The other to compare against.
/// true if the represents the same object.
public bool Equals(SerializedARCollaborationData other) => m_NSData.Equals(other.m_NSData);
///
/// Compares and for equality using .
///
/// The left-hand-side of the comparison.
/// The right-hand-side of the comparison.
/// true if compares equal to , false otherwise.
public static bool operator ==(SerializedARCollaborationData lhs, SerializedARCollaborationData rhs) => lhs.Equals(rhs);
///
/// Compares and for inequality using .
///
/// The left-hand-side of the comparison.
/// The right-hand-side of the comparison.
/// false if compares equal to , true otherwise.
public static bool operator !=(SerializedARCollaborationData lhs, SerializedARCollaborationData rhs) => !lhs.Equals(rhs);
internal SerializedARCollaborationData(NSData nsData)
{
m_NSData = nsData;
}
NSData m_NSData;
}
}