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

using namespace v8;

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

VtkInitialValueProblemSolverWrap::VtkInitialValueProblemSolverWrap()
{ }

VtkInitialValueProblemSolverWrap::VtkInitialValueProblemSolverWrap(vtkSmartPointer<vtkInitialValueProblemSolver> _native)
{ native = _native; }

VtkInitialValueProblemSolverWrap::~VtkInitialValueProblemSolverWrap()
{ }

void VtkInitialValueProblemSolverWrap::Init(v8::Local<v8::Object> exports)
{
	Nan::SetAccessor(exports, Nan::New("vtkInitialValueProblemSolver").ToLocalChecked(), ConstructorGetter);
	Nan::SetAccessor(exports, Nan::New("InitialValueProblemSolver").ToLocalChecked(), ConstructorGetter);
}

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

void VtkInitialValueProblemSolverWrap::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("VtkInitialValueProblemSolverWrap").ToLocalChecked());
	tpl->InstanceTemplate()->SetInternalFieldCount(1);

	Nan::SetPrototypeMethod(tpl, "GetFunctionSet", GetFunctionSet);
	Nan::SetPrototypeMethod(tpl, "getFunctionSet", GetFunctionSet);

	Nan::SetPrototypeMethod(tpl, "IsAdaptive", IsAdaptive);
	Nan::SetPrototypeMethod(tpl, "isAdaptive", IsAdaptive);

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

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

	Nan::SetPrototypeMethod(tpl, "SetFunctionSet", SetFunctionSet);
	Nan::SetPrototypeMethod(tpl, "setFunctionSet", SetFunctionSet);

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

void VtkInitialValueProblemSolverWrap::New(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	if(!info.IsConstructCall())
	{
		Nan::ThrowError("Constructor not called in a construct call.");
		return;
	}

	if(info.Length() == 0)
	{
		Nan::ThrowError("Cannot create instance of abstract class.");
		return;
	}
	else
	{
		if(info[0]->ToObject() != vtkNodeJsNoWrap )
		{
			Nan::ThrowError("Parameter Error");
			return;
		}
	}

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

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

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

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

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

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

