31#ifndef G4ATTRIBUTEFILTERT_HH
32#define G4ATTRIBUTEFILTERT_HH
54 virtual bool Evaluate(
const T&)
const;
57 virtual void Print(std::ostream& ostr)
const;
71 typedef std::pair<G4String, Config>
Pair;
103 if (fAttName.empty())
return true;
106 if (fConfigVect.size() == 0)
return true;
117 static G4bool warnedUnableToExtract =
false;
118 if (!warnedUnableToExtract) {
120 ed <<
"Unable to extract attribute definition named "<<fAttName<<
' ';
122 (
"G4AttributeFilterT::Evaluate",
"modeling0102",
JustWarning, ed,
"Invalid attribute definition");
123 G4cerr <<
"Available attributes:\n"
124 << *
object.GetAttDefs();
125 warnedUnableToExtract =
true;
134 typename ConfigVect::const_iterator iter = fConfigVect.begin();
136 while (iter != fConfigVect.end()) {
148 static G4bool warnedUnableToExtract =
false;
149 if (!warnedUnableToExtract) {
151 ed <<
"Unable to extract attribute value named "<<fAttName<<
' ';
153 (
"G4AttributeFilterT::Evaluate",
"modeling0103",
JustWarning, ed,
"InvalidAttributeValue");
154 G4cerr <<
"Available attributes:\n"
155 << *
object.GetAttDefs();
156 warnedUnableToExtract =
true;
162 G4cout<<
"G4AttributeFilterT processing attribute named "<<fAttName;
167 return (filter->Accept(attVal));
175 if (0 != filter) filter->Reset();
182 ostr<<
"Printing data for G4Attribute filter named: "<<
G4VFilter<T>::Name()<<std::endl;
183 ostr<<
"Filtered attribute name: "<<fAttName<<std::endl;
184 ostr<<
"Printing sub filter data:"<<std::endl;
185 if (0 != filter) filter->PrintAll(ostr);
201 typename ConfigVect::iterator iter = std::find(fConfigVect.begin(), fConfigVect.end(), myPair);
203 if (iter != fConfigVect.end()) {
205 ed <<
"Interval "<< interval <<
" already exists";
207 (
"G4AttributeFilterT::AddInterval",
"modeling0104",
JustWarning, ed);
211 fConfigVect.push_back(myPair);
220 typename ConfigVect::iterator iter = std::find(fConfigVect.begin(), fConfigVect.end(), myPair);
222 if (iter != fConfigVect.end()) {
224 ed <<
"Single value "<< value <<
" already exists";
226 (
"G4AttributeFilterT::AddValue",
"modeling0105",
JustWarning, ed);
229 fConfigVect.push_back(myPair);
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
std::ostringstream G4ExceptionDescription
G4GLOB_DLL std::ostream G4cerr
G4GLOB_DLL std::ostream G4cout
const G4String & GetValue() const
G4VAttValueFilter * filter
virtual ~G4AttributeFilterT()
void AddValue(const G4String &)
void Set(const G4String &name)
std::pair< G4String, Config > Pair
G4AttributeFilterT(const G4String &name="Unspecified")
virtual bool Evaluate(const T &) const
std::vector< Pair > ConfigVect
void AddInterval(const G4String &)
virtual void Print(std::ostream &ostr) const
G4VAttValueFilter * GetNewFilter(const G4AttDef &def)
G4bool ExtractAttDef(const T &object, const G4String &name, G4AttDef &def)
G4bool ExtractAttValue(const T &object, const G4String &name, G4AttValue &attVal)
const char * name(G4int ptype)