/// <summary>Remove all objects</summary>
        /// <param name="array">The array</param>
        /// <returns>`true` if successful</returns>
        /// <remarks>Will not zero out object pointers removed</remarks>
        public static bool ATBaseArrayRemoveAllObjects(Foundation.ATBaseArrayUnsafe array)
        {
            var _arg0 = ReferenceEquals(array, null) ? IntPtr.Zero : array._Instance;
            var _ret  = _Internal.ATBaseArrayRemoveAllObjects(_arg0);

            return(_ret);
        }
        /// <summary>Resize an array</summary>
        /// <param name="array">The array</param>
        /// <param name="newCapacity">The new object capacity</param>
        /// <returns>`true` if successful</returns>
        public static bool ATBaseArrayResize(Foundation.ATBaseArrayUnsafe array, ulong newCapacity)
        {
            var _arg0 = ReferenceEquals(array, null) ? IntPtr.Zero : array._Instance;
            var _ret  = _Internal.ATBaseArrayResize(_arg0, newCapacity);

            return(_ret);
        }
        /// <summary>Insert an object into the array at a given index</summary>
        /// <param name="array">The array</param>
        /// <param name="objectToInsert">The object to insert</param>
        /// <param name="index">The index to insert the object at</param>
        /// <returns>`true` if successful</returns>
        public static bool ATBaseArrayInsertObject(Foundation.ATBaseArrayUnsafe array, IntPtr objectToInsert, ulong index)
        {
            var _arg0 = ReferenceEquals(array, null) ? IntPtr.Zero : array._Instance;
            var _ret  = _Internal.ATBaseArrayInsertObject(_arg0, objectToInsert, index);

            return(_ret);
        }
        /// <summary>Append an object to the array</summary>
        /// <param name="array">The array</param>
        /// <param name="objectToAppend">A pointer to the item to append</param>
        /// <returns>`true` if successful</returns>
        public static bool ATBaseArrayAppendObject(Foundation.ATBaseArrayUnsafe array, IntPtr objectToAppend)
        {
            var _arg0 = ReferenceEquals(array, null) ? IntPtr.Zero : array._Instance;
            var _ret  = _Internal.ATBaseArrayAppendObject(_arg0, objectToAppend);

            return(_ret);
        }
        /// <summary>Get a pointer to an object in the array</summary>
        /// <param name="array">The array</param>
        /// <param name="index">The index of the object to retrieve</param>
        /// <returns>A pointer to the object</returns>
        public static IntPtr ATBaseArrayGetObjectAtIndex(Foundation.ATBaseArrayUnsafe array, ulong index)
        {
            var _arg0 = ReferenceEquals(array, null) ? IntPtr.Zero : array._Instance;
            var _ret  = _Internal.ATBaseArrayGetObjectAtIndex(_arg0, index);

            return(_ret);
        }
 public ATBaseArrayUnsafe(Foundation.ATBaseArrayUnsafe _0)
 {
     _Instance                     = Marshal.AllocHGlobal(sizeof(Foundation.ATBaseArrayUnsafe._Internal));
     _ownsNativeInstance           = true;
     NativeToManagedMap[_Instance] = this;
     *((Foundation.ATBaseArrayUnsafe._Internal *)_Instance) = *((Foundation.ATBaseArrayUnsafe._Internal *)_0._Instance);
 }
        /// <summary>Determine if two arrays are equal</summary>
        /// <param name="array1">The first array</param>
        /// <param name="array2">The second array</param>
        /// <returns>`true` if the arrays are equal (the pointers in the array are equal)</returns>
        public static bool ATBaseArrayIsEqual(Foundation.ATBaseArrayUnsafe array1, Foundation.ATBaseArrayUnsafe array2)
        {
            var _arg0 = ReferenceEquals(array1, null) ? IntPtr.Zero : array1._Instance;
            var _arg1 = ReferenceEquals(array2, null) ? IntPtr.Zero : array2._Instance;
            var _ret  = _Internal.ATBaseArrayIsEqual(_arg0, _arg1);

            return(_ret);
        }
        /// <summary>Copy an array, retaining all objects for the destination array</summary>
        /// <param name="destination">The destination array</param>
        /// <param name="source">The source array</param>
        /// <returns>`true` if successful</returns>
        public static bool ATBaseArrayCopy(Foundation.ATBaseArrayUnsafe destination, Foundation.ATBaseArrayUnsafe source)
        {
            var _arg0 = ReferenceEquals(destination, null) ? IntPtr.Zero : destination._Instance;
            var _arg1 = ReferenceEquals(source, null) ? IntPtr.Zero : source._Instance;
            var _ret  = _Internal.ATBaseArrayCopy(_arg0, _arg1);

            return(_ret);
        }
        /// <summary>Create a new base array object, for use in subclasses.</summary>
        /// <param name="optionalStorage">Optionally, a pointer to a struct or memory where the object can be stored</param>
        /// <param name="type">The type of object we are creating</param>
        /// <returns>A new object subclassing `ATData` of the type and size specified.</returns>
        public static Foundation.ATBaseArrayUnsafe ATBaseArraySubclassNew(Foundation.ATBaseArrayUnsafe optionalStorage, Foundation.ATObjectType type)
        {
            var _arg0 = ReferenceEquals(optionalStorage, null) ? IntPtr.Zero : optionalStorage._Instance;
            var _ret  = _Internal.ATBaseArraySubclassNew(_arg0, type);

            Foundation.ATBaseArrayUnsafe _result0;
            if (_ret == IntPtr.Zero)
            {
                _result0 = null;
            }
            else if (Foundation.ATBaseArrayUnsafe.NativeToManagedMap.ContainsKey(_ret))
            {
                _result0 = (Foundation.ATBaseArrayUnsafe)Foundation.ATBaseArrayUnsafe.NativeToManagedMap[_ret];
            }
            else
            {
                _result0 = Foundation.ATBaseArrayUnsafe._CreateInstance(_ret);
            }
            return(_result0);
        }
        /// <summary>Initialize a new base array object with existing objects using the original buffer without copying</summary>
        /// <param name="array">The object to initialize. Can be `NULL` so the result from `ATBaseArrayNew` can be passed directly, in which case it will simply return `NULL`</param>
        /// <param name="existingObjects">A pointer to a buffer of existing object references</param>
        /// <param name="length">The length of the buffer (number of object references)</param>
        /// <param name="capacity">The capacity of the buffer (number of object references)</param>
        /// <param name="weak">If `true`, creates a weak array and does not retain objects</param>
        /// <param name="weakElementRemovedCallback">Only if weak is `true`, the callback to be called when an object is removed from the array because it was deallocated</param>
        /// <returns>The initialized object or `NULL` if initialization failed</returns>
        public static Foundation.ATBaseArrayUnsafe ATBaseArrayInitWithObjectsNoCopy(Foundation.ATBaseArrayUnsafe array, void **existingObjects, ulong length, ulong capacity, bool weak, Foundation.Delegates.Action_IntPtr_ulong weakElementRemovedCallback)
        {
            var _arg0 = ReferenceEquals(array, null) ? IntPtr.Zero : array._Instance;
            var _arg5 = weakElementRemovedCallback == null ? IntPtr.Zero : Marshal.GetFunctionPointerForDelegate(weakElementRemovedCallback);
            var _ret  = _Internal.ATBaseArrayInitWithObjectsNoCopy(_arg0, existingObjects, length, capacity, weak, _arg5);

            Foundation.ATBaseArrayUnsafe _result0;
            if (_ret == IntPtr.Zero)
            {
                _result0 = null;
            }
            else if (Foundation.ATBaseArrayUnsafe.NativeToManagedMap.ContainsKey(_ret))
            {
                _result0 = (Foundation.ATBaseArrayUnsafe)Foundation.ATBaseArrayUnsafe.NativeToManagedMap[_ret];
            }
            else
            {
                _result0 = Foundation.ATBaseArrayUnsafe._CreateInstance(_ret);
            }
            return(_result0);
        }