/* this file has been autogenerated by vtkNodeJsWrap */
/* editing this might proof futile */

#define VTK_WRAPPING_CXX
#define VTK_STREAMS_FWD_ONLY
#include <nan.h>

#include "vtkFunctionSetWrap.h"
#include "vtkCachingInterpolatedVelocityFieldWrap.h"
#include "vtkObjectBaseWrap.h"
#include "vtkDataSetWrap.h"
#include "vtkAbstractCellLocatorWrap.h"
#include "../../plus/plus.h"

using namespace v8;

extern Nan::Persistent<v8::Object> vtkNodeJsNoWrap;
Nan::Persistent<v8::FunctionTemplate> VtkCachingInterpolatedVelocityFieldWrap::ptpl;

VtkCachingInterpolatedVelocityFieldWrap::VtkCachingInterpolatedVelocityFieldWrap()
{ }

VtkCachingInterpolatedVelocityFieldWrap::VtkCachingInterpolatedVelocityFieldWrap(vtkSmartPointer<vtkCachingInterpolatedVelocityField> _native)
{ native = _native; }

VtkCachingInterpolatedVelocityFieldWrap::~VtkCachingInterpolatedVelocityFieldWrap()
{ }

void VtkCachingInterpolatedVelocityFieldWrap::Init(v8::Local<v8::Object> exports)
{
	Nan::SetAccessor(exports, Nan::New("vtkCachingInterpolatedVelocityField").ToLocalChecked(), ConstructorGetter);
	Nan::SetAccessor(exports, Nan::New("CachingInterpolatedVelocityField").ToLocalChecked(), ConstructorGetter);
}

void VtkCachingInterpolatedVelocityFieldWrap::ConstructorGetter(
	v8::Local<v8::String> property,
	const Nan::PropertyCallbackInfo<v8::Value>& info)
{
	InitPtpl();
	info.GetReturnValue().Set(Nan::New(ptpl)->GetFunction());
}

void VtkCachingInterpolatedVelocityFieldWrap::InitPtpl()
{
	if (!ptpl.IsEmpty()) return;
	v8::Local<v8::FunctionTemplate> tpl = Nan::New<v8::FunctionTemplate>(New);
	VtkFunctionSetWrap::InitPtpl( );
	tpl->Inherit(Nan::New<FunctionTemplate>(VtkFunctionSetWrap::ptpl));
	tpl->SetClassName(Nan::New("VtkCachingInterpolatedVelocityFieldWrap").ToLocalChecked());
	tpl->InstanceTemplate()->SetInternalFieldCount(1);

	Nan::SetPrototypeMethod(tpl, "ClearLastCellInfo", ClearLastCellInfo);
	Nan::SetPrototypeMethod(tpl, "clearLastCellInfo", ClearLastCellInfo);

	Nan::SetPrototypeMethod(tpl, "GetCacheMiss", GetCacheMiss);
	Nan::SetPrototypeMethod(tpl, "getCacheMiss", GetCacheMiss);

	Nan::SetPrototypeMethod(tpl, "GetCellCacheHit", GetCellCacheHit);
	Nan::SetPrototypeMethod(tpl, "getCellCacheHit", GetCellCacheHit);

	Nan::SetPrototypeMethod(tpl, "GetDataSetCacheHit", GetDataSetCacheHit);
	Nan::SetPrototypeMethod(tpl, "getDataSetCacheHit", GetDataSetCacheHit);

	Nan::SetPrototypeMethod(tpl, "GetLastLocalCoordinates", GetLastLocalCoordinates);
	Nan::SetPrototypeMethod(tpl, "getLastLocalCoordinates", GetLastLocalCoordinates);

	Nan::SetPrototypeMethod(tpl, "GetVectorsSelection", GetVectorsSelection);
	Nan::SetPrototypeMethod(tpl, "getVectorsSelection", GetVectorsSelection);

	Nan::SetPrototypeMethod(tpl, "NewInstance", NewInstance);
	Nan::SetPrototypeMethod(tpl, "newInstance", NewInstance);

	Nan::SetPrototypeMethod(tpl, "SafeDownCast", SafeDownCast);
	Nan::SetPrototypeMethod(tpl, "safeDownCast", SafeDownCast);

	Nan::SetPrototypeMethod(tpl, "SelectVectors", SelectVectors);
	Nan::SetPrototypeMethod(tpl, "selectVectors", SelectVectors);

	Nan::SetPrototypeMethod(tpl, "SetDataSet", SetDataSet);
	Nan::SetPrototypeMethod(tpl, "setDataSet", SetDataSet);

#ifdef VTK_NODE_PLUS_VTKCACHINGINTERPOLATEDVELOCITYFIELDWRAP_INITPTPL
	VTK_NODE_PLUS_VTKCACHINGINTERPOLATEDVELOCITYFIELDWRAP_INITPTPL
#endif
	ptpl.Reset( tpl );
}

void VtkCachingInterpolatedVelocityFieldWrap::New(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	if(!info.IsConstructCall())
	{
		Nan::ThrowError("Constructor not called in a construct call.");
		return;
	}

	if(info.Length() == 0)
	{
		vtkSmartPointer<vtkCachingInterpolatedVelocityField> native = vtkSmartPointer<vtkCachingInterpolatedVelocityField>::New();
		VtkCachingInterpolatedVelocityFieldWrap* obj = new VtkCachingInterpolatedVelocityFieldWrap(native);
		obj->Wrap(info.This());
	}
	else
	{
		if(info[0]->ToObject() != vtkNodeJsNoWrap )
		{
			Nan::ThrowError("Parameter Error");
			return;
		}
	}

	info.GetReturnValue().Set(info.This());
}

void VtkCachingInterpolatedVelocityFieldWrap::ClearLastCellInfo(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkCachingInterpolatedVelocityFieldWrap *wrapper = ObjectWrap::Unwrap<VtkCachingInterpolatedVelocityFieldWrap>(info.Holder());
	vtkCachingInterpolatedVelocityField *native = (vtkCachingInterpolatedVelocityField *)wrapper->native.GetPointer();
		if(info.Length() != 0)
	{
		Nan::ThrowError("Too many parameters.");
		return;
	}
	native->ClearLastCellInfo();
}

void VtkCachingInterpolatedVelocityFieldWrap::GetCacheMiss(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkCachingInterpolatedVelocityFieldWrap *wrapper = ObjectWrap::Unwrap<VtkCachingInterpolatedVelocityFieldWrap>(info.Holder());
	vtkCachingInterpolatedVelocityField *native = (vtkCachingInterpolatedVelocityField *)wrapper->native.GetPointer();
	int r;
	if(info.Length() != 0)
	{
		Nan::ThrowError("Too many parameters.");
		return;
	}
	r = native->GetCacheMiss();
	info.GetReturnValue().Set(Nan::New(r));
}

void VtkCachingInterpolatedVelocityFieldWrap::GetCellCacheHit(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkCachingInterpolatedVelocityFieldWrap *wrapper = ObjectWrap::Unwrap<VtkCachingInterpolatedVelocityFieldWrap>(info.Holder());
	vtkCachingInterpolatedVelocityField *native = (vtkCachingInterpolatedVelocityField *)wrapper->native.GetPointer();
	int r;
	if(info.Length() != 0)
	{
		Nan::ThrowError("Too many parameters.");
		return;
	}
	r = native->GetCellCacheHit();
	info.GetReturnValue().Set(Nan::New(r));
}

void VtkCachingInterpolatedVelocityFieldWrap::GetDataSetCacheHit(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkCachingInterpolatedVelocityFieldWrap *wrapper = ObjectWrap::Unwrap<VtkCachingInterpolatedVelocityFieldWrap>(info.Holder());
	vtkCachingInterpolatedVelocityField *native = (vtkCachingInterpolatedVelocityField *)wrapper->native.GetPointer();
	int r;
	if(info.Length() != 0)
	{
		Nan::ThrowError("Too many parameters.");
		return;
	}
	r = native->GetDataSetCacheHit();
	info.GetReturnValue().Set(Nan::New(r));
}

void VtkCachingInterpolatedVelocityFieldWrap::GetLastLocalCoordinates(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkCachingInterpolatedVelocityFieldWrap *wrapper = ObjectWrap::Unwrap<VtkCachingInterpolatedVelocityFieldWrap>(info.Holder());
	vtkCachingInterpolatedVelocityField *native = (vtkCachingInterpolatedVelocityField *)wrapper->native.GetPointer();
	size_t i;
	if(info.Length() > 0 && info[0]->IsFloat64Array())
	{
		v8::Local<v8::Float64Array>a0(v8::Local<v8::Float64Array>::Cast(info[0]->ToObject()));
		if( a0->Length() < 3 )
		{
			Nan::ThrowError("Array too short.");
			return;
		}

		int r;
		if(info.Length() != 1)
		{
			Nan::ThrowError("Too many parameters.");
			return;
		}
		r = native->GetLastLocalCoordinates(
			(double *)(a0->Buffer()->GetContents().Data())
		);
		info.GetReturnValue().Set(Nan::New(r));
		return;
	}
	else if(info.Length() > 0 && info[0]->IsArray())
	{
		v8::Local<v8::Array>a0(v8::Local<v8::Array>::Cast(info[0]->ToObject()));
		double b0[3];
		if( a0->Length() < 3 )
		{
			Nan::ThrowError("Array too short.");
			return;
		}

		for( i = 0; i < 3; i++ )
		{
			if( !a0->Get(i)->IsNumber() )
			{
				Nan::ThrowError("Array contents invalid.");
				return;
			}
			b0[i] = a0->Get(i)->NumberValue();
		}
		int r;
		if(info.Length() != 1)
		{
			Nan::ThrowError("Too many parameters.");
			return;
		}
		r = native->GetLastLocalCoordinates(
			b0
		);
		info.GetReturnValue().Set(Nan::New(r));
		return;
	}
	Nan::ThrowError("Parameter mismatch");
}

void VtkCachingInterpolatedVelocityFieldWrap::GetVectorsSelection(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkCachingInterpolatedVelocityFieldWrap *wrapper = ObjectWrap::Unwrap<VtkCachingInterpolatedVelocityFieldWrap>(info.Holder());
	vtkCachingInterpolatedVelocityField *native = (vtkCachingInterpolatedVelocityField *)wrapper->native.GetPointer();
	char const * r;
	if(info.Length() != 0)
	{
		Nan::ThrowError("Too many parameters.");
		return;
	}
	r = native->GetVectorsSelection();
	info.GetReturnValue().Set(Nan::New(r).ToLocalChecked());
}

void VtkCachingInterpolatedVelocityFieldWrap::NewInstance(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkCachingInterpolatedVelocityFieldWrap *wrapper = ObjectWrap::Unwrap<VtkCachingInterpolatedVelocityFieldWrap>(info.Holder());
	vtkCachingInterpolatedVelocityField *native = (vtkCachingInterpolatedVelocityField *)wrapper->native.GetPointer();
	vtkCachingInterpolatedVelocityField * r;
	if(info.Length() != 0)
	{
		Nan::ThrowError("Too many parameters.");
		return;
	}
	r = native->NewInstance();
	VtkCachingInterpolatedVelocityFieldWrap::InitPtpl();
	v8::Local<v8::Value> argv[1] =
		{ Nan::New(vtkNodeJsNoWrap) };
	v8::Local<v8::Function> cons =
		Nan::New<v8::FunctionTemplate>(VtkCachingInterpolatedVelocityFieldWrap::ptpl)->GetFunction();
	v8::Local<v8::Object> wo = cons->NewInstance(1, argv);
	VtkCachingInterpolatedVelocityFieldWrap *w = new VtkCachingInterpolatedVelocityFieldWrap();
	w->native = r;
	w->Wrap(wo);
	info.GetReturnValue().Set(wo);
}

void VtkCachingInterpolatedVelocityFieldWrap::SafeDownCast(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkCachingInterpolatedVelocityFieldWrap *wrapper = ObjectWrap::Unwrap<VtkCachingInterpolatedVelocityFieldWrap>(info.Holder());
	vtkCachingInterpolatedVelocityField *native = (vtkCachingInterpolatedVelocityField *)wrapper->native.GetPointer();
	if(info.Length() > 0 && info[0]->IsObject() && (Nan::New(VtkObjectBaseWrap::ptpl))->HasInstance(info[0]))
	{
		VtkObjectBaseWrap *a0 = ObjectWrap::Unwrap<VtkObjectBaseWrap>(info[0]->ToObject());
		vtkCachingInterpolatedVelocityField * r;
		if(info.Length() != 1)
		{
			Nan::ThrowError("Too many parameters.");
			return;
		}
		r = native->SafeDownCast(
			(vtkObjectBase *) a0->native.GetPointer()
		);
		VtkCachingInterpolatedVelocityFieldWrap::InitPtpl();
		v8::Local<v8::Value> argv[1] =
			{ Nan::New(vtkNodeJsNoWrap) };
		v8::Local<v8::Function> cons =
			Nan::New<v8::FunctionTemplate>(VtkCachingInterpolatedVelocityFieldWrap::ptpl)->GetFunction();
		v8::Local<v8::Object> wo = cons->NewInstance(1, argv);
		VtkCachingInterpolatedVelocityFieldWrap *w = new VtkCachingInterpolatedVelocityFieldWrap();
		w->native = r;
		w->Wrap(wo);
		info.GetReturnValue().Set(wo);
		return;
	}
	Nan::ThrowError("Parameter mismatch");
}

void VtkCachingInterpolatedVelocityFieldWrap::SelectVectors(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkCachingInterpolatedVelocityFieldWrap *wrapper = ObjectWrap::Unwrap<VtkCachingInterpolatedVelocityFieldWrap>(info.Holder());
	vtkCachingInterpolatedVelocityField *native = (vtkCachingInterpolatedVelocityField *)wrapper->native.GetPointer();
	if(info.Length() > 0 && info[0]->IsString())
	{
		Nan::Utf8String a0(info[0]);
				if(info.Length() != 1)
		{
			Nan::ThrowError("Too many parameters.");
			return;
		}
		native->SelectVectors(
			*a0
		);
		return;
	}
	Nan::ThrowError("Parameter mismatch");
}

void VtkCachingInterpolatedVelocityFieldWrap::SetDataSet(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkCachingInterpolatedVelocityFieldWrap *wrapper = ObjectWrap::Unwrap<VtkCachingInterpolatedVelocityFieldWrap>(info.Holder());
	vtkCachingInterpolatedVelocityField *native = (vtkCachingInterpolatedVelocityField *)wrapper->native.GetPointer();
	if(info.Length() > 0 && info[0]->IsInt32())
	{
		if(info.Length() > 1 && info[1]->IsObject() && (Nan::New(VtkDataSetWrap::ptpl))->HasInstance(info[1]))
		{
			VtkDataSetWrap *a1 = ObjectWrap::Unwrap<VtkDataSetWrap>(info[1]->ToObject());
			if(info.Length() > 2 && info[2]->IsBoolean())
			{
				if(info.Length() > 3 && info[3]->IsObject() && (Nan::New(VtkAbstractCellLocatorWrap::ptpl))->HasInstance(info[3]))
				{
					VtkAbstractCellLocatorWrap *a3 = ObjectWrap::Unwrap<VtkAbstractCellLocatorWrap>(info[3]->ToObject());
										if(info.Length() != 4)
					{
						Nan::ThrowError("Too many parameters.");
						return;
					}
					native->SetDataSet(
						info[0]->Int32Value(),
						(vtkDataSet *) a1->native.GetPointer(),
						info[2]->BooleanValue(),
						(vtkAbstractCellLocator *) a3->native.GetPointer()
					);
					return;
				}
			}
		}
	}
	Nan::ThrowError("Parameter mismatch");
}

