/* 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 "vtkAlgorithmWrap.h"
#include "vtkEnsembleSourceWrap.h"
#include "vtkObjectBaseWrap.h"
#include "vtkTableWrap.h"
#include "vtkInformationDataObjectMetaDataKeyWrap.h"
#include "vtkInformationIntegerRequestKeyWrap.h"
#include "../../plus/plus.h"

using namespace v8;

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

VtkEnsembleSourceWrap::VtkEnsembleSourceWrap()
{ }

VtkEnsembleSourceWrap::VtkEnsembleSourceWrap(vtkSmartPointer<vtkEnsembleSource> _native)
{ native = _native; }

VtkEnsembleSourceWrap::~VtkEnsembleSourceWrap()
{ }

void VtkEnsembleSourceWrap::Init(v8::Local<v8::Object> exports)
{
	Nan::SetAccessor(exports, Nan::New("vtkEnsembleSource").ToLocalChecked(), ConstructorGetter);
	Nan::SetAccessor(exports, Nan::New("EnsembleSource").ToLocalChecked(), ConstructorGetter);
}

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

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

	Nan::SetPrototypeMethod(tpl, "AddMember", AddMember);
	Nan::SetPrototypeMethod(tpl, "addMember", AddMember);

	Nan::SetPrototypeMethod(tpl, "GetCurrentMember", GetCurrentMember);
	Nan::SetPrototypeMethod(tpl, "getCurrentMember", GetCurrentMember);

	Nan::SetPrototypeMethod(tpl, "GetNumberOfMembers", GetNumberOfMembers);
	Nan::SetPrototypeMethod(tpl, "getNumberOfMembers", GetNumberOfMembers);

	Nan::SetPrototypeMethod(tpl, "META_DATA", META_DATA);

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

	Nan::SetPrototypeMethod(tpl, "RemoveAllMembers", RemoveAllMembers);
	Nan::SetPrototypeMethod(tpl, "removeAllMembers", RemoveAllMembers);

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

	Nan::SetPrototypeMethod(tpl, "SetCurrentMember", SetCurrentMember);
	Nan::SetPrototypeMethod(tpl, "setCurrentMember", SetCurrentMember);

	Nan::SetPrototypeMethod(tpl, "SetMetaData", SetMetaData);
	Nan::SetPrototypeMethod(tpl, "setMetaData", SetMetaData);

	Nan::SetPrototypeMethod(tpl, "UPDATE_MEMBER", UPDATE_MEMBER);

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

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

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

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

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

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

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

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

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

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

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

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

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

