
#import "StoreData.h"

@implementation StoreData

- init:(int)val:(int)count:(float *)farray:(float *)args
{
	int i, j;
	float *gpt;
	
	self = [super init];
	type = val;
	npoints = count;
	fpt = (float *)calloc(npoints, sizeof(float));
	argv = (float *)calloc(6, sizeof(float));
	displayed = (float **)calloc(3, sizeof(float *));
	gpt = fpt;
	for(i=0;i<npoints/3;i++)
		for(j=0;j<3;j++)	{
			gpt[i+count/3*j] = *farray++;
		}
	displayed[0] = &fpt[0];
	displayed[1] = &fpt[npoints/3];
	displayed[2] = &fpt[2*(npoints/3)];
	gpt = argv;
	for(i=0;i<6;i++)
		*gpt++ = *args++;	
	return self;
}

- free
{

	free(fpt);
	free(argv);
	free(displayed);
	return [super free];
}

- (int)dataType
{
	return type;
}

- (int)howMany
{
	return npoints;
}

- (float *)array
{
	return fpt;
}

- (float *)args
{
	return argv;
}

- (float **)displayed
{
	return displayed;
}

@end