Geant4  10.03.p03
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4AttCheck.cc File Reference
#include "G4AttCheck.hh"
#include "globals.hh"
#include "G4AttDef.hh"
#include "G4AttDefStore.hh"
#include "G4AttValue.hh"
#include "G4UnitsTable.hh"
#include "G4UIcommand.hh"
Include dependency graph for G4AttCheck.cc:

Go to the source code of this file.

Functions

std::ostream & operator<< (std::ostream &os, const G4AttCheck &ac)
 

Function Documentation

std::ostream& operator<< ( std::ostream &  os,
const G4AttCheck ac 
)

Definition at line 249 of file G4AttCheck.cc.

250 {
251  using namespace std;
252  if (!ac.fpDefinitions) {
253  os << "G4AttCheck: ERROR: zero definitions pointer." << endl;
254  return os;
255  }
256  G4String storeKey;
257  if (G4AttDefStore::GetStoreKey(ac.fpDefinitions, storeKey)) {
258  os << storeKey << ':' << endl;
259  }
260  if (!ac.fpValues) {
261  // A null values vector is a valid situation.
262  os << "G4AttCheck: zero values pointer." << endl;
263  return os;
264  }
265  vector<G4AttValue>::const_iterator iValue;
266  for (iValue = ac.fpValues->begin(); iValue != ac.fpValues->end(); ++iValue) {
267  const G4String& valueName = iValue->GetName();
268  const G4String& value = iValue->GetValue();
269  map<G4String,G4AttDef>::const_iterator iDef =
270  ac.fpDefinitions->find(valueName);
271  G4bool error = false;
272  if (iDef == ac.fpDefinitions->end()) {
273  error = true;
274  os << "G4AttCheck: ERROR: No G4AttDef for G4AttValue \""
275  << valueName << "\": " << value << endl;
276  } else {
277  const G4String& category = iDef->second.GetCategory();
278  const G4String& extra = iDef->second.GetExtra();
279  const G4String& valueType = iDef->second.GetValueType();
280  if (ac.fCategories->find(category) == ac.fCategories->end()) {
281  error = true;
282  os <<
283  "G4AttCheck: ERROR: Illegal Category Field \"" << category
284  << "\" for G4AttValue \"" << valueName << "\": " << value <<
285  "\n Possible Categories:";
286  set<G4String>::iterator i;
287  for (i = ac.fCategories->begin(); i != ac.fCategories->end(); ++i) {
288  os << ' ' << *i;
289  }
290  os << endl;
291  }
292  if(category == "Physics" && ac.fUnits->find(extra) == ac.fUnits->end()) {
293  error = true;
294  os <<
295  "G4AttCheck: ERROR: Illegal Extra field \""<< extra
296  << "\" for G4AttValue \"" << valueName << "\": " << value <<
297  "\n Possible Extra fields if Category==\"Physics\":\n ";
298  set<G4String>::iterator i;
299  for (i = ac.fUnits->begin(); i != ac.fUnits->end(); ++i) {
300  os << ' ' << *i;
301  }
302  os << endl;
303  }
304  if (ac.fValueTypes->find(valueType) == ac.fValueTypes->end()) {
305  error = true;
306  os <<
307  "G4AttCheck: ERROR: Illegal Value Type field \"" << valueType
308  << "\" for G4AttValue \"" << valueName << "\": " << value <<
309  "\n Possible Value Types:";
310  set<G4String>::iterator i;
311  for (i = ac.fValueTypes->begin(); i != ac.fValueTypes->end(); ++i) {
312  os << ' ' << *i;
313  }
314  os << endl;
315  }
316  }
317  if (!error) {
318  os << iDef->second.GetDesc()
319  << " (" << valueName
320  << "): " << value;
321  if (iDef->second.GetCategory() == "Physics" &&
322  !iDef->second.GetExtra().empty()) {
323  os << " (" << iDef->second.GetExtra() << ")";
324  }
325  os << endl;
326  }
327  }
328  return os;
329 }
G4bool GetStoreKey(const std::map< G4String, G4AttDef > *definitions, G4String &key)
unsigned extra
Definition: inflate.h:104
const XML_Char int const XML_Char * value
Definition: expat.h:331
bool G4bool
Definition: G4Types.hh:79
static PROLOG_HANDLER error
Definition: xmlrole.cc:112

Here is the call graph for this function: