/* 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 "vtkTableAlgorithmWrap.h"
#include "vtkThresholdTableWrap.h"
#include "vtkObjectWrap.h"
#include "../../plus/plus.h"

using namespace v8;

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

VtkThresholdTableWrap::VtkThresholdTableWrap()
{ }

VtkThresholdTableWrap::VtkThresholdTableWrap(vtkSmartPointer<vtkThresholdTable> _native)
{ native = _native; }

VtkThresholdTableWrap::~VtkThresholdTableWrap()
{ }

void VtkThresholdTableWrap::Init(v8::Local<v8::Object> exports)
{
	Nan::SetAccessor(exports, Nan::New("vtkThresholdTable").ToLocalChecked(), ConstructorGetter);
	Nan::SetAccessor(exports, Nan::New("ThresholdTable").ToLocalChecked(), ConstructorGetter);
}

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

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

	Nan::SetPrototypeMethod(tpl, "GetClassName", GetClassName);
	Nan::SetPrototypeMethod(tpl, "getClassName", GetClassName);

	Nan::SetPrototypeMethod(tpl, "GetMode", GetMode);
	Nan::SetPrototypeMethod(tpl, "getMode", GetMode);

	Nan::SetPrototypeMethod(tpl, "GetModeMaxValue", GetModeMaxValue);
	Nan::SetPrototypeMethod(tpl, "getModeMaxValue", GetModeMaxValue);

	Nan::SetPrototypeMethod(tpl, "GetModeMinValue", GetModeMinValue);
	Nan::SetPrototypeMethod(tpl, "getModeMinValue", GetModeMinValue);

	Nan::SetPrototypeMethod(tpl, "IsA", IsA);
	Nan::SetPrototypeMethod(tpl, "isA", IsA);

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

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

	Nan::SetPrototypeMethod(tpl, "SetMaxValue", SetMaxValue);
	Nan::SetPrototypeMethod(tpl, "setMaxValue", SetMaxValue);

	Nan::SetPrototypeMethod(tpl, "SetMinValue", SetMinValue);
	Nan::SetPrototypeMethod(tpl, "setMinValue", SetMinValue);

	Nan::SetPrototypeMethod(tpl, "SetMode", SetMode);
	Nan::SetPrototypeMethod(tpl, "setMode", SetMode);

	Nan::SetPrototypeMethod(tpl, "ThresholdBetween", ThresholdBetween);
	Nan::SetPrototypeMethod(tpl, "thresholdBetween", ThresholdBetween);

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

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

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

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

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

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

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

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

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

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

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

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

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

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

