/* 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 "vtkWriterWrap.h"
#include "vtkEnSightWriterWrap.h"
#include "vtkObjectBaseWrap.h"
#include "vtkUnstructuredGridWrap.h"
#include "../../plus/plus.h"

using namespace v8;

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

VtkEnSightWriterWrap::VtkEnSightWriterWrap()
{ }

VtkEnSightWriterWrap::VtkEnSightWriterWrap(vtkSmartPointer<vtkEnSightWriter> _native)
{ native = _native; }

VtkEnSightWriterWrap::~VtkEnSightWriterWrap()
{ }

void VtkEnSightWriterWrap::Init(v8::Local<v8::Object> exports)
{
	Nan::SetAccessor(exports, Nan::New("vtkEnSightWriter").ToLocalChecked(), ConstructorGetter);
	Nan::SetAccessor(exports, Nan::New("EnSightWriter").ToLocalChecked(), ConstructorGetter);
}

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

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

	Nan::SetPrototypeMethod(tpl, "GetBaseName", GetBaseName);
	Nan::SetPrototypeMethod(tpl, "getBaseName", GetBaseName);

	Nan::SetPrototypeMethod(tpl, "GetFileName", GetFileName);
	Nan::SetPrototypeMethod(tpl, "getFileName", GetFileName);

	Nan::SetPrototypeMethod(tpl, "GetGhostLevel", GetGhostLevel);
	Nan::SetPrototypeMethod(tpl, "getGhostLevel", GetGhostLevel);

	Nan::SetPrototypeMethod(tpl, "GetInput", GetInput);
	Nan::SetPrototypeMethod(tpl, "getInput", GetInput);

	Nan::SetPrototypeMethod(tpl, "GetNumberOfBlocks", GetNumberOfBlocks);
	Nan::SetPrototypeMethod(tpl, "getNumberOfBlocks", GetNumberOfBlocks);

	Nan::SetPrototypeMethod(tpl, "GetPath", GetPath);
	Nan::SetPrototypeMethod(tpl, "getPath", GetPath);

	Nan::SetPrototypeMethod(tpl, "GetProcessNumber", GetProcessNumber);
	Nan::SetPrototypeMethod(tpl, "getProcessNumber", GetProcessNumber);

	Nan::SetPrototypeMethod(tpl, "GetTimeStep", GetTimeStep);
	Nan::SetPrototypeMethod(tpl, "getTimeStep", GetTimeStep);

	Nan::SetPrototypeMethod(tpl, "GetTransientGeometry", GetTransientGeometry);
	Nan::SetPrototypeMethod(tpl, "getTransientGeometry", GetTransientGeometry);

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

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

	Nan::SetPrototypeMethod(tpl, "SetBaseName", SetBaseName);
	Nan::SetPrototypeMethod(tpl, "setBaseName", SetBaseName);

	Nan::SetPrototypeMethod(tpl, "SetFileName", SetFileName);
	Nan::SetPrototypeMethod(tpl, "setFileName", SetFileName);

	Nan::SetPrototypeMethod(tpl, "SetGhostLevel", SetGhostLevel);
	Nan::SetPrototypeMethod(tpl, "setGhostLevel", SetGhostLevel);

	Nan::SetPrototypeMethod(tpl, "SetInputData", SetInputData);
	Nan::SetPrototypeMethod(tpl, "setInputData", SetInputData);

	Nan::SetPrototypeMethod(tpl, "SetNumberOfBlocks", SetNumberOfBlocks);
	Nan::SetPrototypeMethod(tpl, "setNumberOfBlocks", SetNumberOfBlocks);

	Nan::SetPrototypeMethod(tpl, "SetPath", SetPath);
	Nan::SetPrototypeMethod(tpl, "setPath", SetPath);

	Nan::SetPrototypeMethod(tpl, "SetProcessNumber", SetProcessNumber);
	Nan::SetPrototypeMethod(tpl, "setProcessNumber", SetProcessNumber);

	Nan::SetPrototypeMethod(tpl, "SetTimeStep", SetTimeStep);
	Nan::SetPrototypeMethod(tpl, "setTimeStep", SetTimeStep);

	Nan::SetPrototypeMethod(tpl, "SetTransientGeometry", SetTransientGeometry);
	Nan::SetPrototypeMethod(tpl, "setTransientGeometry", SetTransientGeometry);

	Nan::SetPrototypeMethod(tpl, "WriteCaseFile", WriteCaseFile);
	Nan::SetPrototypeMethod(tpl, "writeCaseFile", WriteCaseFile);

	Nan::SetPrototypeMethod(tpl, "WriteSOSCaseFile", WriteSOSCaseFile);
	Nan::SetPrototypeMethod(tpl, "writeSOSCaseFile", WriteSOSCaseFile);

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

