/* dynVector.c */
/* DIESE ZEILE BITTE MIT IHRER E-MAIL ADRESSE ERSETZEN */
/* DIESE ZEILE MIT OS UND COMPILER ERSETZEN, Z.B.:Win2000, cygwin/gcc */

// Hier allenfalls #includes
#include <stdio.h>


/* Allocate memory for a dynamical vector whose totalSize is 0.
 * params:
 *   int slotSize         amount of bytes which makes up a slot
 *   int slotIncr         amount of slots dynamically added if we
 *                         have run out storage
 * returns:
 *   DynVector *          pointer to created vector
 */
DynVector *createDynVector(int slotSize, int slotIncr) {
  // Aufgabe a)
  return NULL;
}



/* Add an element to the vector.
 * params:
 *   DynVector *dv        pointer to vector of interest
 *   void *element        pointer to element of interest
 * returns:
 *   void *               NULL if adding not successful: the old
 *                         situation is preserved; not NULL if
 *                         successful
 */
void *addElDynVector(DynVector *dv, void *element) {
  if (!dv) {
    onNullPointer();
    return NULL;
  }
  // Aufgabe c)
}



/* Get pointer to element at the specified index.
 * params:
 *   DynVector *dv        pointer to vector of interest
 *   int slotIndex        slot index or element index
 * returns:
 *   void *               NULL if out of range or if NULL slot;
 *                         pointer to element otherwise
 */
void *getElPtrDynVector(DynVector *dv, int slotIndex) {
  if (!dv) {
    onNullPointer();
    return NULL;
  }
  // Aufgabe d)
}


/* Get number of elements in vector.
 * params:
 *   DynVector *dv        pointer to vector of interest
 * returns:
 *   int                  number of elements
 */
int getSizeDynVector(DynVector *dv) {
  // Aufgabe d)
  return 0;
}


/* Free all memory in possession of the vector.
 * params:
 *   DynVector *dv        pointer to vector of interest
 * returns:
 *   void                 --
 */
void deleteDynVector(DynVector *dv) {
  // Aufgabe e)
}



/* Print the vector
 * params:
 *   DynVector *dv        pointer to vector of interest
 *   void (*fp)()         pointer to function printing
 *                         the element.
 * returns:
 *   void                 --
 */
void printDynVector(DynVector *dv, int slotIndex, void (*fp)()) {
  if (!dv) {
    onNullPointer();
    return;
  }
  printf("DynVector:\n");
  printf("  slotSize: %d\n", dv->slotSize);
  printf("  totalSize: %d\n", dv->totalSize);
  printf("  nextSlot: %d\n", dv->nextSlot);
  printf("  storage: %d\n", dv->storage);
  printf("  slotIncr: %d\n", dv->slotIncr);

  if (fp) {
    // Aufgabe b)
    // HIER DIE FUNKTION AUSFUEHREN, UM DIE MEMBER EINES ELEMENTS
    // AM COUT DARZUSTELLEN.
    puts("");
  }
}
