-
Notifications
You must be signed in to change notification settings - Fork 7
/
InputManager.h
77 lines (60 loc) · 2.27 KB
/
InputManager.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
// InputManager.h: Manages input
#ifndef INPUTMANAGER_H
#define INPUTMANAGER_H
#include "BasicDefinitions.h"
#include "PolymorphicIndividualsExtractor.h"
#include "Individuals.h"
#include <string>
using namespace std;
class InputManager
{
public:
// InputManager(): default constructor
// Precondition: None.
// Postcondition: User has been queried and memory for
// the appropriate PolymorphicIndividualsExtractor has
// been allocated..
InputManager();
~InputManager();
// getIndividuals(): extracts individuals using pie
// Precondition: None.
// Postcondition: inds contains the individuals from the
// input files that user supplies in the format
// corresponding to pie. .
void getIndividuals(string map, string ped);
string getOutput();
PolymorphicIndividualsExtractor* getPie();
bool getPhased();
private:
// normalPrompt(): issues prompt asking user which file format
// will be used for individuals
// Precondition: None.
// Postcondition: An appropriate prompt has been issued to stdout.
void normalPrompt();
// validChoice(): determines if a string is valid input for file format
// Precondition: None.
// Postcondition:If string is a valid entry for file format according
// to information from normalPrompt(), then returns true;
// otherwise returns false
bool validChoice(string choice);
// invalidChoiceMessage(): gives message saying choice is not valid
// Precondtion: None.
// Postcondition: Message saying choice is not valid has been printed to stdout
void invalidChoiceMessage();
// setFileFormat(): sets file format using information from normalPrompt()
// Precondition: None.
// Postcondition: If choice is a valid choice, then FileFormat has been set
// according to information from normalPrompt(); otherwise a warning message
// has been printed.
void setFileFormat(string choice);
// instantiatePie(): instantiates appropriate pie
// Precondition: format contains the correct file format.
// Postcondition: pie has been instantiated with the correct extractor.
void instantiatePie();
// type of file format
FileFormat format;
// extracts individuals from various file formats
PolymorphicIndividualsExtractor * pie;
};
#endif
// end InputManager.h