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

using namespace v8;

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

VtkImageButterworthLowPassWrap::VtkImageButterworthLowPassWrap()
{ }

VtkImageButterworthLowPassWrap::VtkImageButterworthLowPassWrap(vtkSmartPointer<vtkImageButterworthLowPass> _native)
{ native = _native; }

VtkImageButterworthLowPassWrap::~VtkImageButterworthLowPassWrap()
{ }

void VtkImageButterworthLowPassWrap::Init(v8::Local<v8::Object> exports)
{
	Nan::SetAccessor(exports, Nan::New("vtkImageButterworthLowPass").ToLocalChecked(), ConstructorGetter);
	Nan::SetAccessor(exports, Nan::New("ImageButterworthLowPass").ToLocalChecked(), ConstructorGetter);
}

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

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

	Nan::SetPrototypeMethod(tpl, "GetCutOff", GetCutOff);
	Nan::SetPrototypeMethod(tpl, "getCutOff", GetCutOff);

	Nan::SetPrototypeMethod(tpl, "GetOrder", GetOrder);
	Nan::SetPrototypeMethod(tpl, "getOrder", GetOrder);

	Nan::SetPrototypeMethod(tpl, "GetXCutOff", GetXCutOff);
	Nan::SetPrototypeMethod(tpl, "getXCutOff", GetXCutOff);

	Nan::SetPrototypeMethod(tpl, "GetYCutOff", GetYCutOff);
	Nan::SetPrototypeMethod(tpl, "getYCutOff", GetYCutOff);

	Nan::SetPrototypeMethod(tpl, "GetZCutOff", GetZCutOff);
	Nan::SetPrototypeMethod(tpl, "getZCutOff", GetZCutOff);

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

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

	Nan::SetPrototypeMethod(tpl, "SetCutOff", SetCutOff);
	Nan::SetPrototypeMethod(tpl, "setCutOff", SetCutOff);

	Nan::SetPrototypeMethod(tpl, "SetOrder", SetOrder);
	Nan::SetPrototypeMethod(tpl, "setOrder", SetOrder);

	Nan::SetPrototypeMethod(tpl, "SetXCutOff", SetXCutOff);
	Nan::SetPrototypeMethod(tpl, "setXCutOff", SetXCutOff);

	Nan::SetPrototypeMethod(tpl, "SetYCutOff", SetYCutOff);
	Nan::SetPrototypeMethod(tpl, "setYCutOff", SetYCutOff);

	Nan::SetPrototypeMethod(tpl, "SetZCutOff", SetZCutOff);
	Nan::SetPrototypeMethod(tpl, "setZCutOff", SetZCutOff);

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

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

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

void VtkImageButterworthLowPassWrap::GetCutOff(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkImageButterworthLowPassWrap *wrapper = ObjectWrap::Unwrap<VtkImageButterworthLowPassWrap>(info.Holder());
	vtkImageButterworthLowPass *native = (vtkImageButterworthLowPass *)wrapper->native.GetPointer();
	double const * r;
	if(info.Length() != 0)
	{
		Nan::ThrowError("Too many parameters.");
		return;
	}
	r = native->GetCutOff();
	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 VtkImageButterworthLowPassWrap::GetOrder(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkImageButterworthLowPassWrap *wrapper = ObjectWrap::Unwrap<VtkImageButterworthLowPassWrap>(info.Holder());
	vtkImageButterworthLowPass *native = (vtkImageButterworthLowPass *)wrapper->native.GetPointer();
	int r;
	if(info.Length() != 0)
	{
		Nan::ThrowError("Too many parameters.");
		return;
	}
	r = native->GetOrder();
	info.GetReturnValue().Set(Nan::New(r));
}

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

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

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

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

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

void VtkImageButterworthLowPassWrap::SetCutOff(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkImageButterworthLowPassWrap *wrapper = ObjectWrap::Unwrap<VtkImageButterworthLowPassWrap>(info.Holder());
	vtkImageButterworthLowPass *native = (vtkImageButterworthLowPass *)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;
		}

				if(info.Length() != 1)
		{
			Nan::ThrowError("Too many parameters.");
			return;
		}
		native->SetCutOff(
			(double *)(a0->Buffer()->GetContents().Data())
		);
		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();
		}
				if(info.Length() != 1)
		{
			Nan::ThrowError("Too many parameters.");
			return;
		}
		native->SetCutOff(
			b0
		);
		return;
	}
	else if(info.Length() > 0 && info[0]->IsNumber())
	{
		if(info.Length() > 1 && info[1]->IsNumber())
		{
			if(info.Length() > 2 && info[2]->IsNumber())
			{
								if(info.Length() != 3)
				{
					Nan::ThrowError("Too many parameters.");
					return;
				}
				native->SetCutOff(
					info[0]->NumberValue(),
					info[1]->NumberValue(),
					info[2]->NumberValue()
				);
				return;
			}
		}
				if(info.Length() != 1)
		{
			Nan::ThrowError("Too many parameters.");
			return;
		}
		native->SetCutOff(
			info[0]->NumberValue()
		);
		return;
	}
	Nan::ThrowError("Parameter mismatch");
}

void VtkImageButterworthLowPassWrap::SetOrder(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkImageButterworthLowPassWrap *wrapper = ObjectWrap::Unwrap<VtkImageButterworthLowPassWrap>(info.Holder());
	vtkImageButterworthLowPass *native = (vtkImageButterworthLowPass *)wrapper->native.GetPointer();
	if(info.Length() > 0 && info[0]->IsInt32())
	{
				if(info.Length() != 1)
		{
			Nan::ThrowError("Too many parameters.");
			return;
		}
		native->SetOrder(
			info[0]->Int32Value()
		);
		return;
	}
	Nan::ThrowError("Parameter mismatch");
}

void VtkImageButterworthLowPassWrap::SetXCutOff(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkImageButterworthLowPassWrap *wrapper = ObjectWrap::Unwrap<VtkImageButterworthLowPassWrap>(info.Holder());
	vtkImageButterworthLowPass *native = (vtkImageButterworthLowPass *)wrapper->native.GetPointer();
	if(info.Length() > 0 && info[0]->IsNumber())
	{
				if(info.Length() != 1)
		{
			Nan::ThrowError("Too many parameters.");
			return;
		}
		native->SetXCutOff(
			info[0]->NumberValue()
		);
		return;
	}
	Nan::ThrowError("Parameter mismatch");
}

void VtkImageButterworthLowPassWrap::SetYCutOff(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkImageButterworthLowPassWrap *wrapper = ObjectWrap::Unwrap<VtkImageButterworthLowPassWrap>(info.Holder());
	vtkImageButterworthLowPass *native = (vtkImageButterworthLowPass *)wrapper->native.GetPointer();
	if(info.Length() > 0 && info[0]->IsNumber())
	{
				if(info.Length() != 1)
		{
			Nan::ThrowError("Too many parameters.");
			return;
		}
		native->SetYCutOff(
			info[0]->NumberValue()
		);
		return;
	}
	Nan::ThrowError("Parameter mismatch");
}

void VtkImageButterworthLowPassWrap::SetZCutOff(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkImageButterworthLowPassWrap *wrapper = ObjectWrap::Unwrap<VtkImageButterworthLowPassWrap>(info.Holder());
	vtkImageButterworthLowPass *native = (vtkImageButterworthLowPass *)wrapper->native.GetPointer();
	if(info.Length() > 0 && info[0]->IsNumber())
	{
				if(info.Length() != 1)
		{
			Nan::ThrowError("Too many parameters.");
			return;
		}
		native->SetZCutOff(
			info[0]->NumberValue()
		);
		return;
	}
	Nan::ThrowError("Parameter mismatch");
}

