/* 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 "vtkTemporalInterpolatedVelocityFieldWrap.h"
#include "vtkObjectBaseWrap.h"
#include "vtkDataSetWrap.h"
#include "../../plus/plus.h"

using namespace v8;

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

VtkTemporalInterpolatedVelocityFieldWrap::VtkTemporalInterpolatedVelocityFieldWrap()
{ }

VtkTemporalInterpolatedVelocityFieldWrap::VtkTemporalInterpolatedVelocityFieldWrap(vtkSmartPointer<vtkTemporalInterpolatedVelocityField> _native)
{ native = _native; }

VtkTemporalInterpolatedVelocityFieldWrap::~VtkTemporalInterpolatedVelocityFieldWrap()
{ }

void VtkTemporalInterpolatedVelocityFieldWrap::Init(v8::Local<v8::Object> exports)
{
	Nan::SetAccessor(exports, Nan::New("vtkTemporalInterpolatedVelocityField").ToLocalChecked(), ConstructorGetter);
	Nan::SetAccessor(exports, Nan::New("TemporalInterpolatedVelocityField").ToLocalChecked(), ConstructorGetter);
}

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

void VtkTemporalInterpolatedVelocityFieldWrap::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("VtkTemporalInterpolatedVelocityFieldWrap").ToLocalChecked());
	tpl->InstanceTemplate()->SetInternalFieldCount(1);

	Nan::SetPrototypeMethod(tpl, "AdvanceOneTimeStep", AdvanceOneTimeStep);
	Nan::SetPrototypeMethod(tpl, "advanceOneTimeStep", AdvanceOneTimeStep);

	Nan::SetPrototypeMethod(tpl, "ClearCache", ClearCache);
	Nan::SetPrototypeMethod(tpl, "clearCache", ClearCache);

	Nan::SetPrototypeMethod(tpl, "GetCurrentWeight", GetCurrentWeight);
	Nan::SetPrototypeMethod(tpl, "getCurrentWeight", GetCurrentWeight);

	Nan::SetPrototypeMethod(tpl, "GetLastGoodVelocity", GetLastGoodVelocity);
	Nan::SetPrototypeMethod(tpl, "getLastGoodVelocity", GetLastGoodVelocity);

	Nan::SetPrototypeMethod(tpl, "IsStatic", IsStatic);
	Nan::SetPrototypeMethod(tpl, "isStatic", IsStatic);

	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, "SetDataSetAtTime", SetDataSetAtTime);
	Nan::SetPrototypeMethod(tpl, "setDataSetAtTime", SetDataSetAtTime);

	Nan::SetPrototypeMethod(tpl, "ShowCacheResults", ShowCacheResults);
	Nan::SetPrototypeMethod(tpl, "showCacheResults", ShowCacheResults);

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

void VtkTemporalInterpolatedVelocityFieldWrap::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<vtkTemporalInterpolatedVelocityField> native = vtkSmartPointer<vtkTemporalInterpolatedVelocityField>::New();
		VtkTemporalInterpolatedVelocityFieldWrap* obj = new VtkTemporalInterpolatedVelocityFieldWrap(native);
		obj->Wrap(info.This());
	}
	else
	{
		if(info[0]->ToObject() != vtkNodeJsNoWrap )
		{
			Nan::ThrowError("Parameter Error");
			return;
		}
	}

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

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

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

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

void VtkTemporalInterpolatedVelocityFieldWrap::GetLastGoodVelocity(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkTemporalInterpolatedVelocityFieldWrap *wrapper = ObjectWrap::Unwrap<VtkTemporalInterpolatedVelocityFieldWrap>(info.Holder());
	vtkTemporalInterpolatedVelocityField *native = (vtkTemporalInterpolatedVelocityField *)wrapper->native.GetPointer();
	double const * r;
	if(info.Length() != 0)
	{
		Nan::ThrowError("Too many parameters.");
		return;
	}
	r = native->GetLastGoodVelocity();
	Local<v8::ArrayBuffer> ab = v8::ArrayBuffer::New(v8::Isolate::GetCurrent(), 3 * sizeof(double));
	Local<v8::Float64Array> at = v8::Float64Array::New(ab, 0, 3);
	memcpy(ab->GetContents().Data(), r, 3 * sizeof(double));
	info.GetReturnValue().Set(at);
}

void VtkTemporalInterpolatedVelocityFieldWrap::IsStatic(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkTemporalInterpolatedVelocityFieldWrap *wrapper = ObjectWrap::Unwrap<VtkTemporalInterpolatedVelocityFieldWrap>(info.Holder());
	vtkTemporalInterpolatedVelocityField *native = (vtkTemporalInterpolatedVelocityField *)wrapper->native.GetPointer();
	if(info.Length() > 0 && info[0]->IsInt32())
	{
		bool r;
		if(info.Length() != 1)
		{
			Nan::ThrowError("Too many parameters.");
			return;
		}
		r = native->IsStatic(
			info[0]->Int32Value()
		);
		info.GetReturnValue().Set(Nan::New(r));
		return;
	}
	Nan::ThrowError("Parameter mismatch");
}

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

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

void VtkTemporalInterpolatedVelocityFieldWrap::SelectVectors(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkTemporalInterpolatedVelocityFieldWrap *wrapper = ObjectWrap::Unwrap<VtkTemporalInterpolatedVelocityFieldWrap>(info.Holder());
	vtkTemporalInterpolatedVelocityField *native = (vtkTemporalInterpolatedVelocityField *)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 VtkTemporalInterpolatedVelocityFieldWrap::SetDataSetAtTime(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkTemporalInterpolatedVelocityFieldWrap *wrapper = ObjectWrap::Unwrap<VtkTemporalInterpolatedVelocityFieldWrap>(info.Holder());
	vtkTemporalInterpolatedVelocityField *native = (vtkTemporalInterpolatedVelocityField *)wrapper->native.GetPointer();
	if(info.Length() > 0 && info[0]->IsInt32())
	{
		if(info.Length() > 1 && info[1]->IsInt32())
		{
			if(info.Length() > 2 && info[2]->IsNumber())
			{
				if(info.Length() > 3 && info[3]->IsObject() && (Nan::New(VtkDataSetWrap::ptpl))->HasInstance(info[3]))
				{
					VtkDataSetWrap *a3 = ObjectWrap::Unwrap<VtkDataSetWrap>(info[3]->ToObject());
					if(info.Length() > 4 && info[4]->IsBoolean())
					{
												if(info.Length() != 5)
						{
							Nan::ThrowError("Too many parameters.");
							return;
						}
						native->SetDataSetAtTime(
							info[0]->Int32Value(),
							info[1]->Int32Value(),
							info[2]->NumberValue(),
							(vtkDataSet *) a3->native.GetPointer(),
							info[4]->BooleanValue()
						);
						return;
					}
				}
			}
		}
	}
	Nan::ThrowError("Parameter mismatch");
}

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

