#include "floatbuffer.hpp"


Floatbuffer::Floatbuffer()
{
}


Floatbuffer::~Floatbuffer()
{
    if (values)
        delete [] values;
}

void Floatbuffer::start()
{
    this->list = new Lista2();
    this->count = 0;
}

void Floatbuffer::add(float v)
{
    FloatContainer *c = new FloatContainer();
    c->value = v;
    this->list->add(c);
}

void Floatbuffer::finalize()
{
    int i;
    list->goToStart();
    this->count = list->getNodeCount();

    this->values = new float[this->count];
    for (i=0;i<count;i++)
    {
        FloatContainer *c = (FloatContainer *)this->list->getCurrent();
        this->values[i] = c->value;
        list->goForward();
    }
    delete this->list;
}



