-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInputParser.cpp
More file actions
76 lines (49 loc) · 1.72 KB
/
InputParser.cpp
File metadata and controls
76 lines (49 loc) · 1.72 KB
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
//
// InputParser.cpp
// lipid-test2
//
// Created by saman on 11/10/11.
// Copyright 2011 __MyCompanyName__. All rights reserved.
//
#include <iostream>
#include "InputParser.h"
#define DEBUG_MODE 0
InputParser::InputParser( char* fileDestination ){
ifstream inFile( fileDestination, fstream::in );
if( !inFile.is_open() ){
cout << "cannot open the file with name: " << fileDestination << endl;
return;
}
size = 0;
if( DEBUG_MODE )
cout << "it is open" << endl;
while( !inFile.eof() ){
string moleculeDestination;
inFile >> moleculeDestination;
if( moleculeDestination == "*" ) break;
int upPercent;
inFile >> upPercent;
int downPercent;
inFile >> downPercent;
string moleculeName;
inFile >> moleculeName;
if( moleculeDestination == "" || moleculeName == "" )
break;
moleculeDestinations.push_back(moleculeDestination);
upPercents.push_back(upPercent);
downPercents.push_back(downPercent);
moleculeNames.push_back(moleculeName);
size++;
if( DEBUG_MODE ){
cout << moleculeDestination << " " << upPercent << " " << downPercent << " " << moleculeName << endl;
}
}
inFile >> gridWidth >> gridHeight >> moleculeWidth >> moleculeHeight >> layersDistance;
}
void InputParser::printResult(){
for( int i = 0; i < size; i++ ){
cout << moleculeDestinations.at(i) << " " << upPercents.at(i) << " " << downPercents.at(i) << " " << moleculeNames.at(i) << endl;
}
}
InputParser::~InputParser(){
}