Struct ARCollaborationDataBuilder
Use this to construct an ARCollaborationData incrementally from serialized bytes.
Inherited Members
Namespace: UnityEngine.XR.ARKit
Assembly: Unity.XR.ARKit.dll
Syntax
public struct ARCollaborationDataBuilder : IDisposable, IEquatable<ARCollaborationDataBuilder>
Remarks
This struct can be useful if you receive data through a stream. If you already have all the bytes, use a ARCollaborationData constructor instead. This struct represents a native resource and must be explicitly disposed when no longer needed. While this struct is not thread safe, you can construct, Dispose, and Append from any thread.
Properties
hasData
Whether the ARCollaborationDataBuilder has allocated any data. If true
,
this struct must be disposed to avoid leaking native resources. If false
, this struct
either never allocated memory
(with Append(byte[], int, int) or Append(NativeSlice<byte>))
or it has already been Dispose()d.
Declaration
public bool hasData { get; }
Property Value
Type | Description |
---|---|
bool |
length
The number of bytes owned by this struct.
Declaration
public int length { get; }
Property Value
Type | Description |
---|---|
int |
See Also
Methods
Append(byte[])
Appends all bytes of the array buffer
to an existing array of bytes.
Declaration
public void Append(byte[] buffer)
Parameters
Type | Name | Description |
---|---|---|
byte[] | buffer | A buffer containing bytes to append. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown if |
Append(byte[], int, int)
Appends size
bytes of the array buffer
to an existing array of bytes.
Declaration
public void Append(byte[] buffer, int offset, int size)
Parameters
Type | Name | Description |
---|---|---|
byte[] | buffer | A buffer containing bytes to append. |
int | offset | The offset within |
int | size | The number of bytes from |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown if |
ArgumentOutOfRangeException | Thrown if |
ArgumentOutOfRangeException | Thrown if |
InvalidOperationException | Thrown if |
Append(NativeSlice<byte>)
Appends bytes
to an existing array of bytes.
Declaration
public void Append(NativeSlice<byte> bytes)
Parameters
Type | Name | Description |
---|---|---|
NativeSlice<byte> | bytes | An array of bytes to append to the existing data. |
Exceptions
Type | Condition |
---|---|
ArgumentException | Thrown if |
Dispose()
Releases the native resource.
Declaration
public void Dispose()
Equals(object)
Compares for equality.
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
object | obj | The object to compare for equality. |
Returns
Type | Description |
---|---|
bool | true if |
Overrides
Equals(ARCollaborationDataBuilder)
Compares for equality.
Declaration
public bool Equals(ARCollaborationDataBuilder other)
Parameters
Type | Name | Description |
---|---|---|
ARCollaborationDataBuilder | other | The ARCollaborationDataBuilder to compare against. |
Returns
Type | Description |
---|---|
bool | true if all fields of this instance compare equal to |
GetHashCode()
Computes a hash code suitable for use in a Dictionary
or HashSet
.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
int | The hash code for this instance. |
Overrides
ToCollaborationData()
Converts the bytes accumulated through calls to Append(byte[], int, int) to an ARCollaborationData. The caller is responsible for disposing the returned ARCollaborationData.
Declaration
public ARCollaborationData ToCollaborationData()
Returns
Type | Description |
---|---|
ARCollaborationData | A new ARCollaborationData constructed from the bytes added to this ARCollaborationDataBuilder. |
Exceptions
Type | Condition |
---|---|
NotSupportedException | Thrown if ARCollaborationData is not supported. Check for support with supportsCollaboration. |
InvalidOperationException | Thrown if hasData is false. |
Operators
operator ==(ARCollaborationDataBuilder, ARCollaborationDataBuilder)
Compares for equality. Equivalent to Equals(ARCollaborationDataBuilder).
Declaration
public static bool operator ==(ARCollaborationDataBuilder lhs, ARCollaborationDataBuilder rhs)
Parameters
Type | Name | Description |
---|---|---|
ARCollaborationDataBuilder | lhs | The left-hand side of the comparison. |
ARCollaborationDataBuilder | rhs | The right-hand side of the comparison. |
Returns
Type | Description |
---|---|
bool | true if all fields of the instances are equal. Otherwise, returns false. |
operator !=(ARCollaborationDataBuilder, ARCollaborationDataBuilder)
Compares for inequality. Equivalent to !
Equals(ARCollaborationDataBuilder).
Declaration
public static bool operator !=(ARCollaborationDataBuilder lhs, ARCollaborationDataBuilder rhs)
Parameters
Type | Name | Description |
---|---|---|
ARCollaborationDataBuilder | lhs | The left-hand side of the comparison. |
ARCollaborationDataBuilder | rhs | The right-hand side of the comparison. |
Returns
Type | Description |
---|---|
bool | true if any of the fields of the instances are not equal. Otherwise, returns false. |