//---------------------------------------------------------------------------
#include "tboolfnct.h"
#include "boom.h"
#include "bufferstruct.h"
#include "buffers.h"
//---------------------------------------------------------------------------
TBuffers::TBuffers( TBoolFnct * _source, MinimizeOptions * _mo) : minf( 0 ), ess( 0 ), e_buffer( 0 ), r_buffer( 0 )
{
  this->source = _source;
  this->mo = _mo;
  if ( mo->IC_type == 1 )
  {
    this->offtree = new TermTree * [source->outvars];
    for ( int i = 0; i < source->outvars; i++ ) this->offtree[i] = new TermTree( source );
  }
  if ( mo->IE_type > 0 )
  {
    this->i_buffer = new TermTree * [source->outvars];
    for ( int i = 0; i < source->outvars; i++ ) this->i_buffer[i] = new TermTree( source );
  }
  this->e_buffer = CreateHistory( source );
  this->primes_ie = new TermTree( source );
  this->imp_test = new TermTree * [source->outvars];
  for ( int i = 0; i < source->outvars; i++ ) this->imp_test[i] = new TermTree( source );
};
//---------------------------------------------------------------------------
TBuffers::~TBuffers()
{
  delete this->r_buffer;
  if ( mo->IE_type > 0 )
  {
    for (int i = 0; i < source->outvars; i++ ) delete this->i_buffer[i];
    delete this->i_buffer;
  }
  delete this->primes_ie;
  for (int i = 0; i < source->outvars; i++ )
  {
    delete this->imp_test[i];

  }
  delete this->imp_test;
  if ( mo->IC_type == 1 )
  {
    for (int i = 0; i < source->outvars; i++ ) delete this->offtree[i];
    delete this->offtree;
  }
  delete this->e_buffer;
}
//---------------------------------------------------------------------------
