-
Notifications
You must be signed in to change notification settings - Fork 0
/
Track.cpp
60 lines (53 loc) · 1.17 KB
/
Track.cpp
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
/*
* File: Track.cpp
* Author: Kapil Thakkar
*
*/
#include <stdlib.h>
#include "Track.h"
Track::Track(int sessionsInTrack)
{
this->sessionsInTrack = sessionsInTrack;
sessions = (Session *)malloc(sizeof(Session) * sessionsInTrack);
}
void Track::setPaper(int sessionIndex, int paperIndex, int paperId)
{
if (sessionIndex < this->sessionsInTrack)
{
Session curSession = sessions[sessionIndex];
curSession.setPaper(paperIndex, paperId);
}
else
{
cout << "Index out of bound - Track::setPaper" << endl;
exit(0);
}
}
int Track::getNumberOfSessions()
{
return this->sessionsInTrack;
}
Session Track::getSession(int index)
{
if (index < this->sessionsInTrack)
{
return sessions[index];
}
else
{
cout << "Index out of bound - Track::getSession" << endl;
exit(0);
}
}
void Track::setSession(int index, Session session)
{
if (index < this->sessionsInTrack)
{
sessions[index] = session;
}
else
{
cout << "Index out of bound - Track::setSession" << endl;
exit(0);
}
}