-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDataParser.h
42 lines (37 loc) · 1.29 KB
/
DataParser.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
//===========================================================
// DataParser.h
// Purpose: Interface file for the DataParser utility class.
// Author: Dr. Rick Coleman
//===========================================================
#ifndef DATAPARSER_H
#define DATAPARSER_H
#include <iostream>
#include <fstream>
using namespace std;
class DataParser
{
private:
ifstream* inFile; // DOCO world definition file
int m_iWorldWidth; // Number of cells wide for the DOCO grid world
int m_iWorldHeight; // Number of cells high for the DOCO grid world
int m_iNumDOCOs; // Number of DOCOs in the world
int m_iNextDOCOIndex;// Index of next DOCO to read
char m_sFileName[64]; // Data file
int m_iFoodCount; // Number of initial food pellets
int m_iObstacleCount;// Number of obstacles
int m_iNextObsIndex; // Index of next obstacle to read
DataParser(); // Private constructor for singleton
public:
~DataParser();
void initParser(const char* fileName);
static DataParser* getInstance(const char* fileName);
int getDOCOWorldWidth();
int getDOCOWorldHeight();
int getDOCOCount();
bool getDOCOData(char* movement, int* xpos, int* ypos);
int getFoodCount();
int getObstacleCount();
bool getObstacleData(int* xpos, int* ypos);
bool getNextLine(char* buffer, int n);
};
#endif