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

using namespace v8;

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

VtkSimpleScalarTreeWrap::VtkSimpleScalarTreeWrap()
{ }

VtkSimpleScalarTreeWrap::VtkSimpleScalarTreeWrap(vtkSmartPointer<vtkSimpleScalarTree> _native)
{ native = _native; }

VtkSimpleScalarTreeWrap::~VtkSimpleScalarTreeWrap()
{ }

void VtkSimpleScalarTreeWrap::Init(v8::Local<v8::Object> exports)
{
	Nan::SetAccessor(exports, Nan::New("vtkSimpleScalarTree").ToLocalChecked(), ConstructorGetter);
	Nan::SetAccessor(exports, Nan::New("SimpleScalarTree").ToLocalChecked(), ConstructorGetter);
}

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

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

	Nan::SetPrototypeMethod(tpl, "BuildTree", BuildTree);
	Nan::SetPrototypeMethod(tpl, "buildTree", BuildTree);

	Nan::SetPrototypeMethod(tpl, "GetBranchingFactor", GetBranchingFactor);
	Nan::SetPrototypeMethod(tpl, "getBranchingFactor", GetBranchingFactor);

	Nan::SetPrototypeMethod(tpl, "GetBranchingFactorMaxValue", GetBranchingFactorMaxValue);
	Nan::SetPrototypeMethod(tpl, "getBranchingFactorMaxValue", GetBranchingFactorMaxValue);

	Nan::SetPrototypeMethod(tpl, "GetBranchingFactorMinValue", GetBranchingFactorMinValue);
	Nan::SetPrototypeMethod(tpl, "getBranchingFactorMinValue", GetBranchingFactorMinValue);

	Nan::SetPrototypeMethod(tpl, "GetLevel", GetLevel);
	Nan::SetPrototypeMethod(tpl, "getLevel", GetLevel);

	Nan::SetPrototypeMethod(tpl, "GetMaxLevel", GetMaxLevel);
	Nan::SetPrototypeMethod(tpl, "getMaxLevel", GetMaxLevel);

	Nan::SetPrototypeMethod(tpl, "GetMaxLevelMaxValue", GetMaxLevelMaxValue);
	Nan::SetPrototypeMethod(tpl, "getMaxLevelMaxValue", GetMaxLevelMaxValue);

	Nan::SetPrototypeMethod(tpl, "GetMaxLevelMinValue", GetMaxLevelMinValue);
	Nan::SetPrototypeMethod(tpl, "getMaxLevelMinValue", GetMaxLevelMinValue);

	Nan::SetPrototypeMethod(tpl, "InitTraversal", InitTraversal);
	Nan::SetPrototypeMethod(tpl, "initTraversal", InitTraversal);

	Nan::SetPrototypeMethod(tpl, "Initialize", Initialize);
	Nan::SetPrototypeMethod(tpl, "initialize", Initialize);

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

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

	Nan::SetPrototypeMethod(tpl, "SetBranchingFactor", SetBranchingFactor);
	Nan::SetPrototypeMethod(tpl, "setBranchingFactor", SetBranchingFactor);

	Nan::SetPrototypeMethod(tpl, "SetMaxLevel", SetMaxLevel);
	Nan::SetPrototypeMethod(tpl, "setMaxLevel", SetMaxLevel);

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

