/*
   File:        dcubes.c
   Author(s):   Moore
   Created:     Thu Oct 23 12:53:15 EDT 2003
   Description: Array of Dcubes
   Copyright (c) Carnegie Mellon University
*/

#include "dcubes.h"

/************ Begin dcubes *************/

void void_free_dcube(void *data)
{
  free_dcube((dcube *)data);
}

void *void_mk_copy_dcube(void *data)
{
  return (void *) mk_copy_dcube((dcube *)data);
}

void void_fprintf_dcube(FILE *s,char *m1,void *data,char *m2)
{
  fprintf_dcube(s,m1,(dcube *) data,m2);
}

dcubes *mk_empty_dcubes()
{
  dcubes *array = AM_MALLOC(dcubes);
  array -> genarr = mk_empty_generic_array(void_free_dcube,
					   void_mk_copy_dcube,
					   void_fprintf_dcube);

  return array;
}

void add_to_dcubes(dcubes *array,dcube *element)
{
  add_to_generic_array(array->genarr,(void *)element);
}

void add_pointer_to_dcubes(dcubes *array,dcube *element)
{
  add_pointer_to_generic_array(array->genarr,(void *)element);
}

int dcubes_size(dcubes *array)
{
  return(generic_array_size(array->genarr));
}

dcube *dcubes_ref(dcubes *array,int index)
{
  return (dcube *) generic_array_ref(array->genarr,index);
}

void dcubes_set(dcubes *array,int index,dcube *item)
{
  generic_array_set(array->genarr,index,(void *) item);
}

void fprintf_dcubes(FILE *s,char *m1,dcubes *array,char *m2)
{
  fprintf_generic_array(s,m1,array->genarr,m2);
}

void pdcubes(dcubes *array)
{
  fprintf_dcubes(stdout,"dcubes",array,"\n");
}

void free_dcubes(dcubes *array)
{
  free_generic_array(array->genarr);
  AM_FREE(array,dcubes);
}

dcubes *mk_copy_dcubes(dcubes *array)
{
  dcubes *new_dcubes = AM_MALLOC(dcubes);
  new_dcubes -> genarr = mk_copy_generic_array(array->genarr);
  return new_dcubes;
}

/************** End dcubes ******************/
