/* 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 "vtkDataObjectWrap.h"
#include "vtkPiecewiseFunctionWrap.h"
#include "vtkObjectBaseWrap.h"
#include "vtkInformationWrap.h"
#include "vtkInformationVectorWrap.h"
#include "../../plus/plus.h"

using namespace v8;

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

VtkPiecewiseFunctionWrap::VtkPiecewiseFunctionWrap()
{ }

VtkPiecewiseFunctionWrap::VtkPiecewiseFunctionWrap(vtkSmartPointer<vtkPiecewiseFunction> _native)
{ native = _native; }

VtkPiecewiseFunctionWrap::~VtkPiecewiseFunctionWrap()
{ }

void VtkPiecewiseFunctionWrap::Init(v8::Local<v8::Object> exports)
{
	Nan::SetAccessor(exports, Nan::New("vtkPiecewiseFunction").ToLocalChecked(), ConstructorGetter);
	Nan::SetAccessor(exports, Nan::New("PiecewiseFunction").ToLocalChecked(), ConstructorGetter);
}

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

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

	Nan::SetPrototypeMethod(tpl, "AddPoint", AddPoint);
	Nan::SetPrototypeMethod(tpl, "addPoint", AddPoint);

	Nan::SetPrototypeMethod(tpl, "AddSegment", AddSegment);
	Nan::SetPrototypeMethod(tpl, "addSegment", AddSegment);

	Nan::SetPrototypeMethod(tpl, "AdjustRange", AdjustRange);
	Nan::SetPrototypeMethod(tpl, "adjustRange", AdjustRange);

	Nan::SetPrototypeMethod(tpl, "AllowDuplicateScalarsOff", AllowDuplicateScalarsOff);
	Nan::SetPrototypeMethod(tpl, "allowDuplicateScalarsOff", AllowDuplicateScalarsOff);

	Nan::SetPrototypeMethod(tpl, "AllowDuplicateScalarsOn", AllowDuplicateScalarsOn);
	Nan::SetPrototypeMethod(tpl, "allowDuplicateScalarsOn", AllowDuplicateScalarsOn);

	Nan::SetPrototypeMethod(tpl, "ClampingOff", ClampingOff);
	Nan::SetPrototypeMethod(tpl, "clampingOff", ClampingOff);

	Nan::SetPrototypeMethod(tpl, "ClampingOn", ClampingOn);
	Nan::SetPrototypeMethod(tpl, "clampingOn", ClampingOn);

	Nan::SetPrototypeMethod(tpl, "DeepCopy", DeepCopy);
	Nan::SetPrototypeMethod(tpl, "deepCopy", DeepCopy);

	Nan::SetPrototypeMethod(tpl, "GetAllowDuplicateScalars", GetAllowDuplicateScalars);
	Nan::SetPrototypeMethod(tpl, "getAllowDuplicateScalars", GetAllowDuplicateScalars);

	Nan::SetPrototypeMethod(tpl, "GetClamping", GetClamping);
	Nan::SetPrototypeMethod(tpl, "getClamping", GetClamping);

	Nan::SetPrototypeMethod(tpl, "GetData", GetData);
	Nan::SetPrototypeMethod(tpl, "getData", GetData);

	Nan::SetPrototypeMethod(tpl, "GetDataObjectType", GetDataObjectType);
	Nan::SetPrototypeMethod(tpl, "getDataObjectType", GetDataObjectType);

	Nan::SetPrototypeMethod(tpl, "GetFirstNonZeroValue", GetFirstNonZeroValue);
	Nan::SetPrototypeMethod(tpl, "getFirstNonZeroValue", GetFirstNonZeroValue);

	Nan::SetPrototypeMethod(tpl, "GetNodeValue", GetNodeValue);
	Nan::SetPrototypeMethod(tpl, "getNodeValue", GetNodeValue);

	Nan::SetPrototypeMethod(tpl, "GetRange", GetRange);
	Nan::SetPrototypeMethod(tpl, "getRange", GetRange);

	Nan::SetPrototypeMethod(tpl, "GetSize", GetSize);
	Nan::SetPrototypeMethod(tpl, "getSize", GetSize);

	Nan::SetPrototypeMethod(tpl, "GetType", GetType);
	Nan::SetPrototypeMethod(tpl, "getType", GetType);

	Nan::SetPrototypeMethod(tpl, "GetUseLogScale", GetUseLogScale);
	Nan::SetPrototypeMethod(tpl, "getUseLogScale", GetUseLogScale);

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

	Nan::SetPrototypeMethod(tpl, "Initialize", Initialize);
	Nan::SetPrototypeMethod(tpl, "initialize", Initialize);

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

	Nan::SetPrototypeMethod(tpl, "RemoveAllPoints", RemoveAllPoints);
	Nan::SetPrototypeMethod(tpl, "removeAllPoints", RemoveAllPoints);

	Nan::SetPrototypeMethod(tpl, "RemovePoint", RemovePoint);
	Nan::SetPrototypeMethod(tpl, "removePoint", RemovePoint);

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

	Nan::SetPrototypeMethod(tpl, "SetAllowDuplicateScalars", SetAllowDuplicateScalars);
	Nan::SetPrototypeMethod(tpl, "setAllowDuplicateScalars", SetAllowDuplicateScalars);

	Nan::SetPrototypeMethod(tpl, "SetClamping", SetClamping);
	Nan::SetPrototypeMethod(tpl, "setClamping", SetClamping);

	Nan::SetPrototypeMethod(tpl, "SetNodeValue", SetNodeValue);
	Nan::SetPrototypeMethod(tpl, "setNodeValue", SetNodeValue);

	Nan::SetPrototypeMethod(tpl, "SetUseLogScale", SetUseLogScale);
	Nan::SetPrototypeMethod(tpl, "setUseLogScale", SetUseLogScale);

	Nan::SetPrototypeMethod(tpl, "ShallowCopy", ShallowCopy);
	Nan::SetPrototypeMethod(tpl, "shallowCopy", ShallowCopy);

	Nan::SetPrototypeMethod(tpl, "UseLogScaleOff", UseLogScaleOff);
	Nan::SetPrototypeMethod(tpl, "useLogScaleOff", UseLogScaleOff);

	Nan::SetPrototypeMethod(tpl, "UseLogScaleOn", UseLogScaleOn);
	Nan::SetPrototypeMethod(tpl, "useLogScaleOn", UseLogScaleOn);

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

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

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

void VtkPiecewiseFunctionWrap::AddPoint(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkPiecewiseFunctionWrap *wrapper = ObjectWrap::Unwrap<VtkPiecewiseFunctionWrap>(info.Holder());
	vtkPiecewiseFunction *native = (vtkPiecewiseFunction *)wrapper->native.GetPointer();
	if(info.Length() > 0 && info[0]->IsNumber())
	{
		if(info.Length() > 1 && info[1]->IsNumber())
		{
			if(info.Length() > 2 && info[2]->IsNumber())
			{
				if(info.Length() > 3 && info[3]->IsNumber())
				{
					int r;
					if(info.Length() != 4)
					{
						Nan::ThrowError("Too many parameters.");
						return;
					}
					r = native->AddPoint(
						info[0]->NumberValue(),
						info[1]->NumberValue(),
						info[2]->NumberValue(),
						info[3]->NumberValue()
					);
					info.GetReturnValue().Set(Nan::New(r));
					return;
				}
			}
			int r;
			if(info.Length() != 2)
			{
				Nan::ThrowError("Too many parameters.");
				return;
			}
			r = native->AddPoint(
				info[0]->NumberValue(),
				info[1]->NumberValue()
			);
			info.GetReturnValue().Set(Nan::New(r));
			return;
		}
	}
	Nan::ThrowError("Parameter mismatch");
}

void VtkPiecewiseFunctionWrap::AddSegment(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkPiecewiseFunctionWrap *wrapper = ObjectWrap::Unwrap<VtkPiecewiseFunctionWrap>(info.Holder());
	vtkPiecewiseFunction *native = (vtkPiecewiseFunction *)wrapper->native.GetPointer();
	if(info.Length() > 0 && info[0]->IsNumber())
	{
		if(info.Length() > 1 && info[1]->IsNumber())
		{
			if(info.Length() > 2 && info[2]->IsNumber())
			{
				if(info.Length() > 3 && info[3]->IsNumber())
				{
										if(info.Length() != 4)
					{
						Nan::ThrowError("Too many parameters.");
						return;
					}
					native->AddSegment(
						info[0]->NumberValue(),
						info[1]->NumberValue(),
						info[2]->NumberValue(),
						info[3]->NumberValue()
					);
					return;
				}
			}
		}
	}
	Nan::ThrowError("Parameter mismatch");
}

void VtkPiecewiseFunctionWrap::AdjustRange(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkPiecewiseFunctionWrap *wrapper = ObjectWrap::Unwrap<VtkPiecewiseFunctionWrap>(info.Holder());
	vtkPiecewiseFunction *native = (vtkPiecewiseFunction *)wrapper->native.GetPointer();
	size_t i;
	if(info.Length() > 0 && info[0]->IsFloat64Array())
	{
		v8::Local<v8::Float64Array>a0(v8::Local<v8::Float64Array>::Cast(info[0]->ToObject()));
		if( a0->Length() < 2 )
		{
			Nan::ThrowError("Array too short.");
			return;
		}

		int r;
		if(info.Length() != 1)
		{
			Nan::ThrowError("Too many parameters.");
			return;
		}
		r = native->AdjustRange(
			(double *)(a0->Buffer()->GetContents().Data())
		);
		info.GetReturnValue().Set(Nan::New(r));
		return;
	}
	else if(info.Length() > 0 && info[0]->IsArray())
	{
		v8::Local<v8::Array>a0(v8::Local<v8::Array>::Cast(info[0]->ToObject()));
		double b0[2];
		if( a0->Length() < 2 )
		{
			Nan::ThrowError("Array too short.");
			return;
		}

		for( i = 0; i < 2; i++ )
		{
			if( !a0->Get(i)->IsNumber() )
			{
				Nan::ThrowError("Array contents invalid.");
				return;
			}
			b0[i] = a0->Get(i)->NumberValue();
		}
		int r;
		if(info.Length() != 1)
		{
			Nan::ThrowError("Too many parameters.");
			return;
		}
		r = native->AdjustRange(
			b0
		);
		info.GetReturnValue().Set(Nan::New(r));
		return;
	}
	Nan::ThrowError("Parameter mismatch");
}

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

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

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

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

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

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

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

void VtkPiecewiseFunctionWrap::GetData(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkPiecewiseFunctionWrap *wrapper = ObjectWrap::Unwrap<VtkPiecewiseFunctionWrap>(info.Holder());
	vtkPiecewiseFunction *native = (vtkPiecewiseFunction *)wrapper->native.GetPointer();
	if(info.Length() > 0 && info[0]->IsObject() && (Nan::New(VtkInformationVectorWrap::ptpl))->HasInstance(info[0]))
	{
		VtkInformationVectorWrap *a0 = ObjectWrap::Unwrap<VtkInformationVectorWrap>(info[0]->ToObject());
		if(info.Length() > 1 && info[1]->IsInt32())
		{
			vtkPiecewiseFunction * r;
			if(info.Length() != 2)
			{
				Nan::ThrowError("Too many parameters.");
				return;
			}
			r = native->GetData(
				(vtkInformationVector *) a0->native.GetPointer(),
				info[1]->Int32Value()
			);
			VtkPiecewiseFunctionWrap::InitPtpl();
			v8::Local<v8::Value> argv[1] =
				{ Nan::New(vtkNodeJsNoWrap) };
			v8::Local<v8::Function> cons =
				Nan::New<v8::FunctionTemplate>(VtkPiecewiseFunctionWrap::ptpl)->GetFunction();
			v8::Local<v8::Object> wo = cons->NewInstance(1, argv);
			VtkPiecewiseFunctionWrap *w = new VtkPiecewiseFunctionWrap();
			w->native = r;
			w->Wrap(wo);
			info.GetReturnValue().Set(wo);
			return;
		}
	}
	else if(info.Length() > 0 && info[0]->IsObject() && (Nan::New(VtkInformationWrap::ptpl))->HasInstance(info[0]))
	{
		VtkInformationWrap *a0 = ObjectWrap::Unwrap<VtkInformationWrap>(info[0]->ToObject());
		vtkPiecewiseFunction * r;
		if(info.Length() != 1)
		{
			Nan::ThrowError("Too many parameters.");
			return;
		}
		r = native->GetData(
			(vtkInformation *) a0->native.GetPointer()
		);
		VtkPiecewiseFunctionWrap::InitPtpl();
		v8::Local<v8::Value> argv[1] =
			{ Nan::New(vtkNodeJsNoWrap) };
		v8::Local<v8::Function> cons =
			Nan::New<v8::FunctionTemplate>(VtkPiecewiseFunctionWrap::ptpl)->GetFunction();
		v8::Local<v8::Object> wo = cons->NewInstance(1, argv);
		VtkPiecewiseFunctionWrap *w = new VtkPiecewiseFunctionWrap();
		w->native = r;
		w->Wrap(wo);
		info.GetReturnValue().Set(wo);
		return;
	}
	Nan::ThrowError("Parameter mismatch");
}

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

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

void VtkPiecewiseFunctionWrap::GetNodeValue(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkPiecewiseFunctionWrap *wrapper = ObjectWrap::Unwrap<VtkPiecewiseFunctionWrap>(info.Holder());
	vtkPiecewiseFunction *native = (vtkPiecewiseFunction *)wrapper->native.GetPointer();
	size_t i;
	if(info.Length() > 0 && info[0]->IsInt32())
	{
		if(info.Length() > 1 && info[1]->IsFloat64Array())
		{
			v8::Local<v8::Float64Array>a1(v8::Local<v8::Float64Array>::Cast(info[1]->ToObject()));
			if( a1->Length() < 4 )
			{
				Nan::ThrowError("Array too short.");
				return;
			}

			int r;
			if(info.Length() != 2)
			{
				Nan::ThrowError("Too many parameters.");
				return;
			}
			r = native->GetNodeValue(
				info[0]->Int32Value(),
				(double *)(a1->Buffer()->GetContents().Data())
			);
			info.GetReturnValue().Set(Nan::New(r));
			return;
		}
		else if(info.Length() > 1 && info[1]->IsArray())
		{
			v8::Local<v8::Array>a1(v8::Local<v8::Array>::Cast(info[1]->ToObject()));
			double b1[4];
			if( a1->Length() < 4 )
			{
				Nan::ThrowError("Array too short.");
				return;
			}

			for( i = 0; i < 4; i++ )
			{
				if( !a1->Get(i)->IsNumber() )
				{
					Nan::ThrowError("Array contents invalid.");
					return;
				}
				b1[i] = a1->Get(i)->NumberValue();
			}
			int r;
			if(info.Length() != 2)
			{
				Nan::ThrowError("Too many parameters.");
				return;
			}
			r = native->GetNodeValue(
				info[0]->Int32Value(),
				b1
			);
			info.GetReturnValue().Set(Nan::New(r));
			return;
		}
	}
	Nan::ThrowError("Parameter mismatch");
}

void VtkPiecewiseFunctionWrap::GetRange(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkPiecewiseFunctionWrap *wrapper = ObjectWrap::Unwrap<VtkPiecewiseFunctionWrap>(info.Holder());
	vtkPiecewiseFunction *native = (vtkPiecewiseFunction *)wrapper->native.GetPointer();
	double const * r;
	if(info.Length() != 0)
	{
		Nan::ThrowError("Too many parameters.");
		return;
	}
	r = native->GetRange();
	Local<v8::ArrayBuffer> ab = v8::ArrayBuffer::New(v8::Isolate::GetCurrent(), 2 * sizeof(double));
	Local<v8::Float64Array> at = v8::Float64Array::New(ab, 0, 2);
	memcpy(ab->GetContents().Data(), r, 2 * sizeof(double));
	info.GetReturnValue().Set(at);
}

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

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

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

void VtkPiecewiseFunctionWrap::GetValue(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkPiecewiseFunctionWrap *wrapper = ObjectWrap::Unwrap<VtkPiecewiseFunctionWrap>(info.Holder());
	vtkPiecewiseFunction *native = (vtkPiecewiseFunction *)wrapper->native.GetPointer();
	if(info.Length() > 0 && info[0]->IsNumber())
	{
		double r;
		if(info.Length() != 1)
		{
			Nan::ThrowError("Too many parameters.");
			return;
		}
		r = native->GetValue(
			info[0]->NumberValue()
		);
		info.GetReturnValue().Set(Nan::New(r));
		return;
	}
	Nan::ThrowError("Parameter mismatch");
}

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

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

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

void VtkPiecewiseFunctionWrap::RemovePoint(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkPiecewiseFunctionWrap *wrapper = ObjectWrap::Unwrap<VtkPiecewiseFunctionWrap>(info.Holder());
	vtkPiecewiseFunction *native = (vtkPiecewiseFunction *)wrapper->native.GetPointer();
	if(info.Length() > 0 && info[0]->IsNumber())
	{
		int r;
		if(info.Length() != 1)
		{
			Nan::ThrowError("Too many parameters.");
			return;
		}
		r = native->RemovePoint(
			info[0]->NumberValue()
		);
		info.GetReturnValue().Set(Nan::New(r));
		return;
	}
	Nan::ThrowError("Parameter mismatch");
}

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

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

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

void VtkPiecewiseFunctionWrap::SetNodeValue(const Nan::FunctionCallbackInfo<v8::Value>& info)
{
	VtkPiecewiseFunctionWrap *wrapper = ObjectWrap::Unwrap<VtkPiecewiseFunctionWrap>(info.Holder());
	vtkPiecewiseFunction *native = (vtkPiecewiseFunction *)wrapper->native.GetPointer();
	size_t i;
	if(info.Length() > 0 && info[0]->IsInt32())
	{
		if(info.Length() > 1 && info[1]->IsFloat64Array())
		{
			v8::Local<v8::Float64Array>a1(v8::Local<v8::Float64Array>::Cast(info[1]->ToObject()));
			if( a1->Length() < 4 )
			{
				Nan::ThrowError("Array too short.");
				return;
			}

			int r;
			if(info.Length() != 2)
			{
				Nan::ThrowError("Too many parameters.");
				return;
			}
			r = native->SetNodeValue(
				info[0]->Int32Value(),
				(double *)(a1->Buffer()->GetContents().Data())
			);
			info.GetReturnValue().Set(Nan::New(r));
			return;
		}
		else if(info.Length() > 1 && info[1]->IsArray())
		{
			v8::Local<v8::Array>a1(v8::Local<v8::Array>::Cast(info[1]->ToObject()));
			double b1[4];
			if( a1->Length() < 4 )
			{
				Nan::ThrowError("Array too short.");
				return;
			}

			for( i = 0; i < 4; i++ )
			{
				if( !a1->Get(i)->IsNumber() )
				{
					Nan::ThrowError("Array contents invalid.");
					return;
				}
				b1[i] = a1->Get(i)->NumberValue();
			}
			int r;
			if(info.Length() != 2)
			{
				Nan::ThrowError("Too many parameters.");
				return;
			}
			r = native->SetNodeValue(
				info[0]->Int32Value(),
				b1
			);
			info.GetReturnValue().Set(Nan::New(r));
			return;
		}
	}
	Nan::ThrowError("Parameter mismatch");
}

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

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

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

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

