#include "boolbuffer.hpp"


Boolbuffer::Boolbuffer()
{
}


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

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

void Boolbuffer::add(bool v)
{
    BoolContainer *c = new BoolContainer();
    c->value = v;
    this->list->add(c);
}

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

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



