// ------------------------------------------------------------------------------------
// irr::core::array<s32> wrappers
// NOTES:
// did not wrap the const version of getLast()
// ------------------------------------------------------------------------------------

extern "C" array<s32>* IrrCore_Array_s32_new()
{
	return new array<s32>();
}

extern "C" array<s32>* IrrCore_Array_s32_newWithSize(u32 start_count)
{
	return new array<s32>(start_count);
}

extern "C" array<s32>* IrrCore_Array_s32_newFromOther(array<s32>* other)
{
	return new array<s32>(*other);
}

extern "C" void IrrCore_Array_s32_del(array<s32>* arr)
{
	if (arr)
		delete arr;
		
	arr=0;
}

extern "C" u32 IrrCore_Array_s32_allocated_size(array<s32>* arr)
{
	if (arr)
		return arr->allocated_size();
	else
		return 0;
}

extern "C" void IrrCore_Array_s32_clear(array<s32>* arr)
{
	if (arr)
		arr->clear();
}

extern "C" const s32* IrrCore_Array_s32_const_pointer(array<s32>* arr)
{
	if (arr)
		arr->const_pointer();
}

extern "C" s32* IrrCore_Array_s32_pointer(array<s32>* arr)
{
	if (arr)
		arr->pointer();
}

extern "C" bool IrrCore_Array_s32_empty(array<s32>* arr)
{
	if (arr)
		return arr->empty();
	else
		return true;
}

extern "C" void IrrCore_Array_s32_eraseWithCount(array<s32>* arr,u32 idx,s32 count)
{
	if (arr)
		arr->erase(idx,count);
}

extern "C" void IrrCore_Array_s32_erase(array<s32>* arr,u32 idx)
{
	if (arr)
		arr->erase(idx);
}

// do not delete this pointer
extern "C" s32* IrrCore_Array_s32_getLast(array<s32>* arr)
{
	if (arr)
		return &arr->getLast();
	else
		return 0;
}

// do not delete this pointer
extern "C" s32* IrrCore_Array_s32_elementAt(array<s32>* arr,u32 idx)
{
	if (arr)
		return &(*arr)[idx];
	else
		return 0;
}

extern "C" void IrrCore_Array_s32_insert(array<s32>* arr,s32* element,u32 idx=0)
{
	if (arr)
		arr->insert(*element,idx);
}

extern "C" void IrrCore_Array_s32_Eq(array<s32>* arr,array<s32>* other)
{
	if (arr)
		*arr=*other;
}

extern "C" void IrrCore_Array_s32_push_back(array<s32>* arr,s32* element)
{
	if (arr)
		arr->push_back(*element);
}

extern "C" void IrrCore_Array_s32_push_front(array<s32>* arr,s32* element)
{
	if (arr)
		arr->push_front(*element);
}

extern "C" void IrrCore_Array_s32_reallocate(array<s32>* arr,u32 new_size)
{
	if (arr)
		arr->reallocate(new_size);
}

extern "C" void IrrCore_Array_s32_set_free_when_destroyed(array<s32>* arr,bool f)
{
	if (arr)
		arr->set_free_when_destroyed(f);
}

extern "C" void IrrCore_Array_s32_set_pointer(array<s32>* arr,s32 newPointer[],u32 size)
{
	if (arr)
		arr->set_pointer(newPointer,size);
}

extern "C" void IrrCore_Array_s32_set_sorted(array<s32>* arr,bool bVal)
{
	if (arr)
		arr->set_sorted(bVal);
}

extern "C" void IrrCore_Array_s32_set_used(array<s32>* arr,bool bVal)
{
	if (arr)
		arr->set_used(bVal);
}

extern "C" u32 IrrCore_Array_s32_size(array<s32>* arr)
{
	if (arr)
		return arr->size();
	else
		return 0;
}

extern "C" s32 IrrCore_Array_s32_linear_reverse_search(array<s32>* arr,s32* find)
{
	if (arr)
		return arr->linear_reverse_search(*find);
	else
		return -1;
}

extern "C" s32 IrrCore_Array_s32_linear_search(array<s32>* arr,s32* find)
{
	if (arr)
		return arr->linear_search(*find);
	else
		return -1;
}

extern "C" s32 IrrCore_Array_s32_binary_search(array<s32>* arr,s32* find)
{
	if (arr)
		return arr->binary_search(*find);
	else
		return -1;
}

extern "C" s32 IrrCore_Array_s32_binary_searchWithBounds(array<s32>* arr,s32* find,s32 left,s32 right)
{
	if (arr)
		return arr->binary_search(*find,left,right);
	else
		return -1;
}

extern "C" void IrrCore_Array_s32_sort(array<s32>* arr)
{
	if (arr)
		arr->sort();
}


