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

using namespace v8;

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

VtkReebGraphSimplificationMetricWrap::VtkReebGraphSimplificationMetricWrap()
{ }

VtkReebGraphSimplificationMetricWrap::VtkReebGraphSimplificationMetricWrap(vtkSmartPointer<vtkReebGraphSimplificationMetric> _native)
{ native = _native; }

VtkReebGraphSimplificationMetricWrap::~VtkReebGraphSimplificationMetricWrap()
{ }

void VtkReebGraphSimplificationMetricWrap::Init(v8::Local<v8::Object> exports)
{
	Nan::SetAccessor(exports, Nan::New("vtkReebGraphSimplificationMetric").ToLocalChecked(), ConstructorGetter);
	Nan::SetAccessor(exports, Nan::New("ReebGraphSimplificationMetric").ToLocalChecked(), ConstructorGetter);
}

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

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

	Nan::SetPrototypeMethod(tpl, "GetLowerBound", GetLowerBound);
	Nan::SetPrototypeMethod(tpl, "getLowerBound", GetLowerBound);

	Nan::SetPrototypeMethod(tpl, "GetUpperBound", GetUpperBound);
	Nan::SetPrototypeMethod(tpl, "getUpperBound", GetUpperBound);

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

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

	Nan::SetPrototypeMethod(tpl, "SetLowerBound", SetLowerBound);
	Nan::SetPrototypeMethod(tpl, "setLowerBound", SetLowerBound);

	Nan::SetPrototypeMethod(tpl, "SetUpperBound", SetUpperBound);
	Nan::SetPrototypeMethod(tpl, "setUpperBound", SetUpperBound);

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

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

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

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

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

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

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

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

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

