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

using namespace v8;

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

VtkExtractBlockWrap::VtkExtractBlockWrap()
{ }

VtkExtractBlockWrap::VtkExtractBlockWrap(vtkSmartPointer<vtkExtractBlock> _native)
{ native = _native; }

VtkExtractBlockWrap::~VtkExtractBlockWrap()
{ }

void VtkExtractBlockWrap::Init(v8::Local<v8::Object> exports)
{
	Nan::SetAccessor(exports, Nan::New("vtkExtractBlock").ToLocalChecked(), ConstructorGetter);
	Nan::SetAccessor(exports, Nan::New("ExtractBlock").ToLocalChecked(), ConstructorGetter);
}

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

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

	Nan::SetPrototypeMethod(tpl, "AddIndex", AddIndex);
	Nan::SetPrototypeMethod(tpl, "addIndex", AddIndex);

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

	Nan::SetPrototypeMethod(tpl, "GetMaintainStructure", GetMaintainStructure);
	Nan::SetPrototypeMethod(tpl, "getMaintainStructure", GetMaintainStructure);

	Nan::SetPrototypeMethod(tpl, "GetPruneOutput", GetPruneOutput);
	Nan::SetPrototypeMethod(tpl, "getPruneOutput", GetPruneOutput);

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

	Nan::SetPrototypeMethod(tpl, "MaintainStructureOff", MaintainStructureOff);
	Nan::SetPrototypeMethod(tpl, "maintainStructureOff", MaintainStructureOff);

	Nan::SetPrototypeMethod(tpl, "MaintainStructureOn", MaintainStructureOn);
	Nan::SetPrototypeMethod(tpl, "maintainStructureOn", MaintainStructureOn);

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

	Nan::SetPrototypeMethod(tpl, "PruneOutputOff", PruneOutputOff);
	Nan::SetPrototypeMethod(tpl, "pruneOutputOff", PruneOutputOff);

	Nan::SetPrototypeMethod(tpl, "PruneOutputOn", PruneOutputOn);
	Nan::SetPrototypeMethod(tpl, "pruneOutputOn", PruneOutputOn);

	Nan::SetPrototypeMethod(tpl, "RemoveAllIndices", RemoveAllIndices);
	Nan::SetPrototypeMethod(tpl, "removeAllIndices", RemoveAllIndices);

	Nan::SetPrototypeMethod(tpl, "RemoveIndex", RemoveIndex);
	Nan::SetPrototypeMethod(tpl, "removeIndex", RemoveIndex);

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

	Nan::SetPrototypeMethod(tpl, "SetMaintainStructure", SetMaintainStructure);
	Nan::SetPrototypeMethod(tpl, "setMaintainStructure", SetMaintainStructure);

	Nan::SetPrototypeMethod(tpl, "SetPruneOutput", SetPruneOutput);
	Nan::SetPrototypeMethod(tpl, "setPruneOutput", SetPruneOutput);

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

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

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

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

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

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

void VtkExtractBlockWrap::IsA(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkExtractBlockWrap *wrapper = ObjectWrap::Unwrap<VtkExtractBlockWrap>(info.Holder());
	vtkExtractBlock *native = (vtkExtractBlock *)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 VtkExtractBlockWrap::MaintainStructureOff(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkExtractBlockWrap *wrapper = ObjectWrap::Unwrap<VtkExtractBlockWrap>(info.Holder());
	vtkExtractBlock *native = (vtkExtractBlock *)wrapper->native.GetPointer();
		if(info.Length() != 0)
	{
		Nan::ThrowError("Too many parameters.");
		return;
	}
	native->MaintainStructureOff();
}

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

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

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

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

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

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

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

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

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

