| 151 | } |
| 152 | |
| 153 | void DataPositions::process_line(long long items_used, const char* name, |
| 154 | ifstream& file, bool print_verbose, double& total_cost, |
| 155 | bool& reading_field, string suffix) const |
| 156 | { |
| 157 | double cost_per_item = 0; |
| 158 | if (reading_field) |
| 159 | file >> cost_per_item; |
| 160 | if (cost_per_item < 0) |
| 161 | { |
| 162 | reading_field = false; |
| 163 | cost_per_item = 0; |
| 164 | } |
| 165 | double cost = items_used * cost_per_item; |
| 166 | total_cost += cost; |
| 167 | cerr.fill(' '); |
| 168 | if (items_used) |
| 169 | { |
| 170 | cerr << " "; |
| 171 | if (print_verbose) |
| 172 | cerr << setw(10) << cost << " = "; |
| 173 | cerr << setw(10) << items_used << " " << setw(14) |
| 174 | << name; |
| 175 | if (print_verbose) |
| 176 | cerr << " @ " << setw(11) << cost_per_item; |
| 177 | cerr << suffix << endl; |
| 178 | } |
| 179 | } |
| 180 | |
| 181 | bool DataPositions::empty() const |
| 182 | { |