CS-PROJECTS / c08_gis_system / FIDIndex.h
FIDIndex.h
Raw
#ifndef FIDINDEX_H
#define FIDINDEX_H
#include <stdio.h>
#include <stdlib.h>
#include <inttypes.h>
#include <string.h>

/**
 * A struct that holds the file ID and the offset at which
 * that file ID occurs. 
 * 
 * A sorted list of these structs will be created in cmdReader
 * in order to satisfy the requirements of this assigment
 */
struct _FIDIndex {
    char* FID;               // filed ID number
    uint32_t occuranceOffset;   // The offset on which this file ID is found
};
typedef struct _FIDIndex FIDIndex;

/**
 * Creates a new FIDIndex such that:
 *  
 *      - FID equals the ID parameter
 *      - occuranceOffset equals the offset parameter
 */
FIDIndex* FIDIndex_create(char* ID, uint32_t offset);

/**
 *  Allows two FIDIndex structs to be compared  
 *  in order to be sorted within the arrayList implimentation
 * 
 *  left and right are void pointers
 */
int compareFIDIndex(const void* left, const void* right);

/**
 * Frees the specified FIDIndex
 */
void cleanFID(void* const idx);

#endif