236{
237 using namespace std;
238 if (!ac.fpDefinitions) {
239 os << "G4AttCheck: ERROR: zero definitions pointer." << endl;
240 return os;
241 }
244 os << storeKey << ':' << endl;
245 }
246 if (!ac.fpValues) {
247
248 os << "G4AttCheck: zero values pointer." << endl;
249 return os;
250 }
251 vector<G4AttValue>::const_iterator iValue;
252 for (iValue = ac.fpValues->begin(); iValue != ac.fpValues->end(); ++iValue) {
253 const G4String& valueName = iValue->GetName();
254 const G4String& value = iValue->GetValue();
255 map<G4String,G4AttDef>::const_iterator iDef =
256 ac.fpDefinitions->find(valueName);
258 if (iDef == ac.fpDefinitions->end()) {
259 error = true;
260 os << "G4AttCheck: ERROR: No G4AttDef for G4AttValue \""
261 << valueName << "\": " << value << endl;
262 } else {
263 const G4String& category = iDef->second.GetCategory();
264 const G4String& extra = iDef->second.GetExtra();
265 const G4String& valueType = iDef->second.GetValueType();
266 if (ac.fCategories.find(category) == ac.fCategories.end()) {
267 error = true;
268 os <<
269 "G4AttCheck: ERROR: Illegal Category Field \"" << category
270 << "\" for G4AttValue \"" << valueName << "\": " << value <<
271 "\n Possible Categories:";
272 set<G4String>::iterator i;
273 for (i = ac.fCategories.begin(); i != ac.fCategories.end(); ++i) {
274 os << ' ' << *i;
275 }
276 os << endl;
277 }
278 if(category == "Physics" && ac.fUnits.find(extra) == ac.fUnits.end()) {
279 error = true;
280 os <<
281 "G4AttCheck: ERROR: Illegal Extra field \""<< extra
282 << "\" for G4AttValue \"" << valueName << "\": " << value <<
283 "\n Possible Extra fields if Category==\"Physics\":\n ";
284 set<G4String>::iterator i;
285 for (i = ac.fUnits.begin(); i != ac.fUnits.end(); ++i) {
286 os << ' ' << *i;
287 }
288 os << endl;
289 }
290 if (ac.fValueTypes.find(valueType) == ac.fValueTypes.end()) {
291 error = true;
292 os <<
293 "G4AttCheck: ERROR: Illegal Value Type field \"" << valueType
294 << "\" for G4AttValue \"" << valueName << "\": " << value <<
295 "\n Possible Value Types:";
296 set<G4String>::iterator i;
297 for (i = ac.fValueTypes.begin(); i != ac.fValueTypes.end(); ++i) {
298 os << ' ' << *i;
299 }
300 os << endl;
301 }
302 }
303 if (!error) {
304 os << iDef->second.GetDesc()
305 << " (" << valueName
306 << "): " << value;
307 if (iDef->second.GetCategory() == "Physics" &&
308 !iDef->second.GetExtra().empty()) {
309 os << " (" << iDef->second.GetExtra() << ")";
310 }
311 os << endl;
312 }
313 }
314 return os;
315}
G4bool GetStoreKey(const std::map< G4String, G4AttDef > *definitions, G4String &key)