/* 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 "vtkImageDifferenceWrap.h"
#include "vtkObjectBaseWrap.h"
#include "vtkAlgorithmOutputWrap.h"
#include "vtkDataObjectWrap.h"
#include "vtkImageDataWrap.h"
#include "../../plus/plus.h"

using namespace v8;

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

VtkImageDifferenceWrap::VtkImageDifferenceWrap()
{ }

VtkImageDifferenceWrap::VtkImageDifferenceWrap(vtkSmartPointer<vtkImageDifference> _native)
{ native = _native; }

VtkImageDifferenceWrap::~VtkImageDifferenceWrap()
{ }

void VtkImageDifferenceWrap::Init(v8::Local<v8::Object> exports)
{
	Nan::SetAccessor(exports, Nan::New("vtkImageDifference").ToLocalChecked(), ConstructorGetter);
	Nan::SetAccessor(exports, Nan::New("ImageDifference").ToLocalChecked(), ConstructorGetter);
}

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

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

	Nan::SetPrototypeMethod(tpl, "AllowShiftOff", AllowShiftOff);
	Nan::SetPrototypeMethod(tpl, "allowShiftOff", AllowShiftOff);

	Nan::SetPrototypeMethod(tpl, "AllowShiftOn", AllowShiftOn);
	Nan::SetPrototypeMethod(tpl, "allowShiftOn", AllowShiftOn);

	Nan::SetPrototypeMethod(tpl, "AveragingOff", AveragingOff);
	Nan::SetPrototypeMethod(tpl, "averagingOff", AveragingOff);

	Nan::SetPrototypeMethod(tpl, "AveragingOn", AveragingOn);
	Nan::SetPrototypeMethod(tpl, "averagingOn", AveragingOn);

	Nan::SetPrototypeMethod(tpl, "GetAllowShift", GetAllowShift);
	Nan::SetPrototypeMethod(tpl, "getAllowShift", GetAllowShift);

	Nan::SetPrototypeMethod(tpl, "GetAveraging", GetAveraging);
	Nan::SetPrototypeMethod(tpl, "getAveraging", GetAveraging);

	Nan::SetPrototypeMethod(tpl, "GetError", GetError);
	Nan::SetPrototypeMethod(tpl, "getError", GetError);

	Nan::SetPrototypeMethod(tpl, "GetImage", GetImage);
	Nan::SetPrototypeMethod(tpl, "getImage", GetImage);

	Nan::SetPrototypeMethod(tpl, "GetThreshold", GetThreshold);
	Nan::SetPrototypeMethod(tpl, "getThreshold", GetThreshold);

	Nan::SetPrototypeMethod(tpl, "GetThresholdedError", GetThresholdedError);
	Nan::SetPrototypeMethod(tpl, "getThresholdedError", GetThresholdedError);

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

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

	Nan::SetPrototypeMethod(tpl, "SetAllowShift", SetAllowShift);
	Nan::SetPrototypeMethod(tpl, "setAllowShift", SetAllowShift);

	Nan::SetPrototypeMethod(tpl, "SetAveraging", SetAveraging);
	Nan::SetPrototypeMethod(tpl, "setAveraging", SetAveraging);

	Nan::SetPrototypeMethod(tpl, "SetImageConnection", SetImageConnection);
	Nan::SetPrototypeMethod(tpl, "setImageConnection", SetImageConnection);

	Nan::SetPrototypeMethod(tpl, "SetImageData", SetImageData);
	Nan::SetPrototypeMethod(tpl, "setImageData", SetImageData);

	Nan::SetPrototypeMethod(tpl, "SetThreshold", SetThreshold);
	Nan::SetPrototypeMethod(tpl, "setThreshold", SetThreshold);

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

void VtkImageDifferenceWrap::SetImageConnection(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkImageDifferenceWrap *wrapper = ObjectWrap::Unwrap<VtkImageDifferenceWrap>(info.Holder());
	vtkImageDifference *native = (vtkImageDifference *)wrapper->native.GetPointer();
	if(info.Length() > 0 && info[0]->IsObject() && (Nan::New(VtkAlgorithmOutputWrap::ptpl))->HasInstance(info[0]))
	{
		VtkAlgorithmOutputWrap *a0 = ObjectWrap::Unwrap<VtkAlgorithmOutputWrap>(info[0]->ToObject());
				if(info.Length() != 1)
		{
			Nan::ThrowError("Too many parameters.");
			return;
		}
		native->SetImageConnection(
			(vtkAlgorithmOutput *) a0->native.GetPointer()
		);
		return;
	}
	Nan::ThrowError("Parameter mismatch");
}

void VtkImageDifferenceWrap::SetImageData(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkImageDifferenceWrap *wrapper = ObjectWrap::Unwrap<VtkImageDifferenceWrap>(info.Holder());
	vtkImageDifference *native = (vtkImageDifference *)wrapper->native.GetPointer();
	if(info.Length() > 0 && info[0]->IsObject() && (Nan::New(VtkDataObjectWrap::ptpl))->HasInstance(info[0]))
	{
		VtkDataObjectWrap *a0 = ObjectWrap::Unwrap<VtkDataObjectWrap>(info[0]->ToObject());
				if(info.Length() != 1)
		{
			Nan::ThrowError("Too many parameters.");
			return;
		}
		native->SetImageData(
			(vtkDataObject *) a0->native.GetPointer()
		);
		return;
	}
	Nan::ThrowError("Parameter mismatch");
}

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

