-
Notifications
You must be signed in to change notification settings - Fork 0
/
Assignment.h
165 lines (130 loc) · 3.51 KB
/
Assignment.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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
/**
* Assignment.h : Data storage for assignment information
*
* @author Nikko Schaff
*
*/
#include "stdafx.h"
#ifndef ASSIGNMENT_H_
#define ASSIGNMENT_H_
// Local header includes
//#include "DataInterface.h"
#include "sqlite3.h"
// System header includes
#include <string>
#include <map>
#include <vector>
class Assignment {
public:
/**
* Constructor for the assignment
*
* @param name Name of the assignment
*
*/
Assignment( std::map< std::string, std::string > data, int numQ, int id = -1 );
/**
* Destructor for the assignment
*/
~Assignment();
// Declaration of the DataInterface method dbRead
void dbRead( int id );
// Declaration of the DataInterface method dbWrite
void dbWrite( int id );
// Declaration of the DataInterface method dbIdInside
bool dbIdInside( int id );
// Declaration of the DataInterface method putFieldValue
void putFieldValue( std::string key, std::string value );
// Declaration of the DataInterface method getFieldValue
std::string getFieldValue( std::string key );
/**
* Getter for the assignment ID
*
* @return int AssignmentID
*
*/
int getID();
/**
* Setter for the number of questions on the assignment
*
* @param numQ Integer number of questions for the assignment
*
*/
void setNumQuestions( int numQ );
/**
* Getter for the number of questions on the assignment
*
* @return int Number of questions on an exam
*
*/
int getNumQuestions();
/**
* Puts a filename of an assignment image in the map, keyed to the studentID
*
* @param studentID student's ID
* @param filename Filename of the assignment image on disk
*/
void putFilename( int studentID, std::string filename );
/**
* Gets the assignment filename of the given student on this assignment
*
* @param studentID Student's ID
* @return string Image filename
*/
std::string getFilename( int studentID );
/**
* Puts a student's answer in their answers vector
*
* @param studentID Student's ID number
* @param index Index of the answer
* @param answer String of the student's answer
*
*/
void setStudentAnswer( int studentID, int index, std::string answer );
/**
* Sets the student's answer array all at once
*
* @param studentID Student's ID number
* @param vector<string> Vector containing all of the student's answers
*
*/
void setStudentAnswerArray( int studentID, std::vector< std::string >
answers );
/**
* Gets a student's answer in their answers vector
*
* @param studentID Student's ID number
* @param index Index of the answer
*
* @return string String of the student's answer
*
*/
std::string getStudentAnswer( int studentID, int index );
/**
* Gets the full array of student's answers for this assignment
*
* @param studentID Student's ID number
*
* @return vector<string> Vector containing student's answers
*
*/
std::vector< std::string > getStudentAnswerArray( int studentID );
/**
* Gets the full map of student answers
*
* @return map<int, vector<string> > studentAnswerMap
*/
std::map< int, std::vector< std::string > > getStudentAnswerMap();
private:
// ID - For internal use only
int ID;
// Map of data fields
std::map< std::string, std::string > dataFields;
// Number of questions on the assignment
int numQuestions;
// Map of student IDs to image filenames, not necessary in all implementations
std::map< int, std::string > imageFilenameMap;
// Map of the student IDs to the list of their answers
std::map< int, std::vector< std::string > > studentAnswerMap;
};
#endif