
namespace clucene.net {

using System;

	internal class _CL_p_uint8_tArray : IDisposable 
	{
		private IntPtr swigCPtr;
		protected bool swigCMemOwn;

		internal _CL_p_uint8_tArray(IntPtr cPtr, bool cMemoryOwn) 
		{
			swigCMemOwn = cMemoryOwn;
			swigCPtr = cPtr;
		}

		internal static IntPtr getCPtr(_CL_p_uint8_tArray obj) 
		{
			return (obj == null) ? IntPtr.Zero : obj.swigCPtr;
		}

		~_CL_p_uint8_tArray() 
		{
			Dispose();
		}

		public virtual void Dispose() 
		{
			if(swigCPtr != IntPtr.Zero && swigCMemOwn) 
			{
				swigCMemOwn = false;
				libCLcsharpPINVOKE.delete__CL_p_uint8_tArray(swigCPtr);
			}
			swigCPtr = IntPtr.Zero;
			GC.SuppressFinalize(this);
		}
		
		public int length() 
		{
			return libCLcsharpPINVOKE._CL_p_uint8_tArray_length(swigCPtr);
		}

		public void init(int len) 
		{
			libCLcsharpPINVOKE._CL_p_uint8_tArray_init(swigCPtr, len);
		}

		public byte get(int idx) 
		{
			return libCLcsharpPINVOKE._CL_p_uint8_tArray_get(swigCPtr, idx);
		}

		public void set(byte a, int i) 
		{
			libCLcsharpPINVOKE._CL_p_uint8_tArray_set(swigCPtr, a, i);
		}

		public _CL_p_uint8_tArray(byte[] val) : this(libCLcsharpPINVOKE.new__CL_p_uint8_tArray(), true) 
		{
			int size=val.Length;
			this.init(size);
			for ( int i=0;i<size;i++ )
				this.set(val[i],i);
		}

		public byte[] toArray()
		{
			int len = this.length();
			byte[] ret = new byte[len];
			for ( int i=0;i<len;i++ )
				ret[i]=get(i);
			return ret;
		}

	}
}
