/* 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 "vtkGaussianRandomSequenceWrap.h"
#include "vtkBoxMuellerRandomSequenceWrap.h"
#include "vtkObjectBaseWrap.h"
#include "vtkRandomSequenceWrap.h"
#include "../../plus/plus.h"

using namespace v8;

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

VtkBoxMuellerRandomSequenceWrap::VtkBoxMuellerRandomSequenceWrap()
{ }

VtkBoxMuellerRandomSequenceWrap::VtkBoxMuellerRandomSequenceWrap(vtkSmartPointer<vtkBoxMuellerRandomSequence> _native)
{ native = _native; }

VtkBoxMuellerRandomSequenceWrap::~VtkBoxMuellerRandomSequenceWrap()
{ }

void VtkBoxMuellerRandomSequenceWrap::Init(v8::Local<v8::Object> exports)
{
	Nan::SetAccessor(exports, Nan::New("vtkBoxMuellerRandomSequence").ToLocalChecked(), ConstructorGetter);
	Nan::SetAccessor(exports, Nan::New("BoxMuellerRandomSequence").ToLocalChecked(), ConstructorGetter);
}

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

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

	Nan::SetPrototypeMethod(tpl, "GetUniformSequence", GetUniformSequence);
	Nan::SetPrototypeMethod(tpl, "getUniformSequence", GetUniformSequence);

	Nan::SetPrototypeMethod(tpl, "GetValue", GetValue);
	Nan::SetPrototypeMethod(tpl, "getValue", GetValue);

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

	Nan::SetPrototypeMethod(tpl, "Next", Next);
	Nan::SetPrototypeMethod(tpl, "next", Next);

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

	Nan::SetPrototypeMethod(tpl, "SetUniformSequence", SetUniformSequence);
	Nan::SetPrototypeMethod(tpl, "setUniformSequence", SetUniformSequence);

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

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

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

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

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

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

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

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

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

