/* 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 "vtkOpenGLVertexBufferObjectGroupWrap.h"
#include "vtkObjectBaseWrap.h"
#include "vtkWindowWrap.h"
#include "vtkDataArrayWrap.h"
#include "vtkViewportWrap.h"
#include "../../plus/plus.h"

using namespace v8;

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

VtkOpenGLVertexBufferObjectGroupWrap::VtkOpenGLVertexBufferObjectGroupWrap()
{ }

VtkOpenGLVertexBufferObjectGroupWrap::VtkOpenGLVertexBufferObjectGroupWrap(vtkSmartPointer<vtkOpenGLVertexBufferObjectGroup> _native)
{ native = _native; }

VtkOpenGLVertexBufferObjectGroupWrap::~VtkOpenGLVertexBufferObjectGroupWrap()
{ }

void VtkOpenGLVertexBufferObjectGroupWrap::Init(v8::Local<v8::Object> exports)
{
	Nan::SetAccessor(exports, Nan::New("vtkOpenGLVertexBufferObjectGroup").ToLocalChecked(), ConstructorGetter);
	Nan::SetAccessor(exports, Nan::New("OpenGLVertexBufferObjectGroup").ToLocalChecked(), ConstructorGetter);
}

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

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

	Nan::SetPrototypeMethod(tpl, "AppendDataArray", AppendDataArray);
	Nan::SetPrototypeMethod(tpl, "appendDataArray", AppendDataArray);

	Nan::SetPrototypeMethod(tpl, "BuildAllVBOs", BuildAllVBOs);
	Nan::SetPrototypeMethod(tpl, "buildAllVBOs", BuildAllVBOs);

	Nan::SetPrototypeMethod(tpl, "CacheDataArray", CacheDataArray);
	Nan::SetPrototypeMethod(tpl, "cacheDataArray", CacheDataArray);

	Nan::SetPrototypeMethod(tpl, "ClearAllDataArrays", ClearAllDataArrays);
	Nan::SetPrototypeMethod(tpl, "clearAllDataArrays", ClearAllDataArrays);

	Nan::SetPrototypeMethod(tpl, "ClearAllVBOs", ClearAllVBOs);
	Nan::SetPrototypeMethod(tpl, "clearAllVBOs", ClearAllVBOs);

	Nan::SetPrototypeMethod(tpl, "GetNumberOfComponents", GetNumberOfComponents);
	Nan::SetPrototypeMethod(tpl, "getNumberOfComponents", GetNumberOfComponents);

	Nan::SetPrototypeMethod(tpl, "GetNumberOfTuples", GetNumberOfTuples);
	Nan::SetPrototypeMethod(tpl, "getNumberOfTuples", GetNumberOfTuples);

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

	Nan::SetPrototypeMethod(tpl, "ReleaseGraphicsResources", ReleaseGraphicsResources);
	Nan::SetPrototypeMethod(tpl, "releaseGraphicsResources", ReleaseGraphicsResources);

	Nan::SetPrototypeMethod(tpl, "RemoveAttribute", RemoveAttribute);
	Nan::SetPrototypeMethod(tpl, "removeAttribute", RemoveAttribute);

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

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

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

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

void VtkOpenGLVertexBufferObjectGroupWrap::AppendDataArray(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkOpenGLVertexBufferObjectGroupWrap *wrapper = ObjectWrap::Unwrap<VtkOpenGLVertexBufferObjectGroupWrap>(info.Holder());
	vtkOpenGLVertexBufferObjectGroup *native = (vtkOpenGLVertexBufferObjectGroup *)wrapper->native.GetPointer();
	if(info.Length() > 0 && info[0]->IsString())
	{
		Nan::Utf8String a0(info[0]);
		if(info.Length() > 1 && info[1]->IsObject() && (Nan::New(VtkDataArrayWrap::ptpl))->HasInstance(info[1]))
		{
			VtkDataArrayWrap *a1 = ObjectWrap::Unwrap<VtkDataArrayWrap>(info[1]->ToObject());
			if(info.Length() > 2 && info[2]->IsInt32())
			{
								if(info.Length() != 3)
				{
					Nan::ThrowError("Too many parameters.");
					return;
				}
				native->AppendDataArray(
					*a0,
					(vtkDataArray *) a1->native.GetPointer(),
					info[2]->Int32Value()
				);
				return;
			}
		}
	}
	Nan::ThrowError("Parameter mismatch");
}

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

void VtkOpenGLVertexBufferObjectGroupWrap::CacheDataArray(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkOpenGLVertexBufferObjectGroupWrap *wrapper = ObjectWrap::Unwrap<VtkOpenGLVertexBufferObjectGroupWrap>(info.Holder());
	vtkOpenGLVertexBufferObjectGroup *native = (vtkOpenGLVertexBufferObjectGroup *)wrapper->native.GetPointer();
	if(info.Length() > 0 && info[0]->IsString())
	{
		Nan::Utf8String a0(info[0]);
		if(info.Length() > 1 && info[1]->IsObject() && (Nan::New(VtkDataArrayWrap::ptpl))->HasInstance(info[1]))
		{
			VtkDataArrayWrap *a1 = ObjectWrap::Unwrap<VtkDataArrayWrap>(info[1]->ToObject());
			if(info.Length() > 2 && info[2]->IsObject() && (Nan::New(VtkViewportWrap::ptpl))->HasInstance(info[2]))
			{
				VtkViewportWrap *a2 = ObjectWrap::Unwrap<VtkViewportWrap>(info[2]->ToObject());
				if(info.Length() > 3 && info[3]->IsInt32())
				{
										if(info.Length() != 4)
					{
						Nan::ThrowError("Too many parameters.");
						return;
					}
					native->CacheDataArray(
						*a0,
						(vtkDataArray *) a1->native.GetPointer(),
						(vtkViewport *) a2->native.GetPointer(),
						info[3]->Int32Value()
					);
					return;
				}
			}
		}
	}
	Nan::ThrowError("Parameter mismatch");
}

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

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

void VtkOpenGLVertexBufferObjectGroupWrap::GetNumberOfComponents(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkOpenGLVertexBufferObjectGroupWrap *wrapper = ObjectWrap::Unwrap<VtkOpenGLVertexBufferObjectGroupWrap>(info.Holder());
	vtkOpenGLVertexBufferObjectGroup *native = (vtkOpenGLVertexBufferObjectGroup *)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->GetNumberOfComponents(
			*a0
		);
		info.GetReturnValue().Set(Nan::New(r));
		return;
	}
	Nan::ThrowError("Parameter mismatch");
}

void VtkOpenGLVertexBufferObjectGroupWrap::GetNumberOfTuples(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkOpenGLVertexBufferObjectGroupWrap *wrapper = ObjectWrap::Unwrap<VtkOpenGLVertexBufferObjectGroupWrap>(info.Holder());
	vtkOpenGLVertexBufferObjectGroup *native = (vtkOpenGLVertexBufferObjectGroup *)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->GetNumberOfTuples(
			*a0
		);
		info.GetReturnValue().Set(Nan::New(r));
		return;
	}
	Nan::ThrowError("Parameter mismatch");
}

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

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

void VtkOpenGLVertexBufferObjectGroupWrap::RemoveAttribute(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkOpenGLVertexBufferObjectGroupWrap *wrapper = ObjectWrap::Unwrap<VtkOpenGLVertexBufferObjectGroupWrap>(info.Holder());
	vtkOpenGLVertexBufferObjectGroup *native = (vtkOpenGLVertexBufferObjectGroup *)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->RemoveAttribute(
			*a0
		);
		return;
	}
	Nan::ThrowError("Parameter mismatch");
}

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

