From 6ff784158f61a082fe6d4332c743a066ef007674 Mon Sep 17 00:00:00 2001 From: RossTheRoss Date: Thu, 22 Oct 2020 07:50:12 -0500 Subject: Add Project 2 Files --- P2/include/mapper.h | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 P2/include/mapper.h (limited to 'P2/include/mapper.h') diff --git a/P2/include/mapper.h b/P2/include/mapper.h new file mode 100644 index 0000000..c67eb08 --- /dev/null +++ b/P2/include/mapper.h @@ -0,0 +1,48 @@ +#ifndef MAPPER_H +#define MAPPER_H + +#include "utils.h" + +// ###### DO NOT REMOVE ###### +#define MAXKEYSZ 100 +#define MAXVALUESZ 100 + +// ###### DO NOT REMOVE ###### +char *mapOutDir; +int mapperID; + + +// You are free to change the intermediate data structure as it suits you +// If you do so, ensure the provided utility functions are also changed +// 1 1 1... +typedef struct valueList { + // MAXVALUESZ can be reduced to a small value as you are only storing "1" + char value[MAXVALUESZ]; + struct valueList *next; +}valueList; + +// word 1 1 1... +typedef struct intermediateDS{ + char key[MAXKEYSZ]; + valueList *value; + struct intermediateDS *next; +}intermediateDS; + +intermediateDS *interDS = NULL; + +// ###### DO NOT REMOVE ###### +valueList *createNewValueListNode(char *value); +valueList *insertNewValueToList(valueList *root, char *count); +void freeValueList(valueList *root); + +// ###### DO NOT REMOVE ###### +intermediateDS *createNewInterDSNode(char *word, char *count); +intermediateDS *insertPairToInterDS(intermediateDS *root, char *word, char *count); +void freeInterDS(intermediateDS *root); + +// ###### DO NOT REMOVE ###### +void emit(char *key, char *value); +void map(char *chunkData); +void writeIntermediateDS(); + +#endif \ No newline at end of file -- cgit v1.2.3