QseAveragerRole Class Reference

#include <qseaveragerrole.h>

Inheritance diagram for QseAveragerRole:

Inheritance graph
[legend]
Collaboration diagram for QseAveragerRole:

Collaboration graph
[legend]

List of all members.

Public Slots

void setScanPattern (const QString &pattern)
void setEnergyPattern (const QString &pattern)
void setDetectorPattern (const QString &pattern)
void setNormalizationPattern (const QString &pattern)
void setSecondsPattern (const QString &pattern)
void setMinScanRowCount (const QString &ct)
void setMaxScanRowCount (const QString &ct)
void setInputEnergyUnits (int n)
void setOutputEnergyUnits (int n)
void setScanRegexp (bool)
void setEnergyRegexp (bool)
void setDetectorRegexp (bool)
void setNormalizationRegexp (bool)
void setSecondsRegexp (bool)

Signals

void changed ()

Public Member Functions

 QseAveragerRole (QObject *parent=NULL)
 ~QseAveragerRole ()
int matchesScan (const QseScan *s)
int matchesEnergyColumn (const QseColumn *c)
int matchesDetectorColumn (const QseColumn *c)
int matchesNormalizationColumn (const QseColumn *c)
int matchesSecondsColumn (const QseColumn *c)
QString scanPattern ()
QString energyPattern ()
QString detectorPattern ()
QString normalizationPattern ()
QString secondsPattern ()
QString minScanRowCount ()
QString maxScanRowCount ()
int inputEnergyUnits ()
int outputEnergyUnits ()
bool scanRegexp ()
bool energyRegexp ()
bool detectorRegexp ()
bool normalizationRegexp ()
bool secondsRegexp ()
ColoredTableItemstyledScanItem (QseScan *scan)
ColoredTableItemstyledColumnItem (QseColumn *col)
double energyScalingRatio ()

Private Attributes

QseAveragerm_Averager
QRegExp m_ScanPattern
QRegExp m_EnergyPattern
QRegExp m_DetectorPattern
QRegExp m_NormalizationPattern
QRegExp m_SecondsPattern
QString m_MinScanRowCount
QString m_MaxScanRowCount
int m_InputEnergyUnits
int m_OutputEnergyUnits


Detailed Description

Definition at line 12 of file qseaveragerrole.h.


Constructor & Destructor Documentation

QseAveragerRole::QseAveragerRole ( QObject parent = NULL  ) 

Definition at line 9 of file qseaveragerrole.cpp.

00010   : QObject(parent),
00011     m_Averager(NULL),
00012     m_ScanPattern("*exafsscan*", Qt::CaseInsensitive, QRegExp::Wildcard),
00013     m_EnergyPattern("energy", Qt::CaseInsensitive, QRegExp::Wildcard),
00014     m_DetectorPattern("", Qt::CaseInsensitive, QRegExp::Wildcard),
00015     m_NormalizationPattern("", Qt::CaseInsensitive, QRegExp::Wildcard),
00016     m_SecondsPattern("", Qt::CaseInsensitive, QRegExp::Wildcard),
00017     m_MinScanRowCount(""),
00018     m_MaxScanRowCount(""),
00019     m_InputEnergyUnits(1),
00020     m_OutputEnergyUnits(1)
00021 {}

QseAveragerRole::~QseAveragerRole (  ) 

Definition at line 23 of file qseaveragerrole.cpp.

00024 {}


Member Function Documentation

int QseAveragerRole::matchesScan ( const QseScan s  ) 

Definition at line 26 of file qseaveragerrole.cpp.

References m_ScanPattern, QseScan::maxRowCount(), maxScanRowCount(), minScanRowCount(), QseScan::scanCommand(), QseScan::scanRole(), QseScan::UnspecifiedRole, and QseScan::UsedRole.

Referenced by QseController::isValidScan(), and styledScanItem().

00027 {
00028     if (s) {
00029         QseScan::QseScanRole r = s->scanRole();
00030 
00031   bool ok1, ok2;
00032 
00033   double minVal = minScanRowCount().toDouble(&ok1);
00034   double maxVal = maxScanRowCount().toDouble(&ok2);
00035   
00036   if (ok1 || ok2) {
00037     int nrows = s->maxRowCount();
00038 
00039     if (ok1 && (nrows < minVal)) {
00040       return FALSE;
00041     }
00042 
00043     if (ok2 && (nrows > maxVal)) {
00044       return FALSE;
00045     }
00046   }
00047 
00048         if (r == QseScan::UnspecifiedRole) {
00049             return m_ScanPattern.exactMatch(s->scanCommand() );
00050         } else {
00051             return r == QseScan::UsedRole;
00052         }
00053     } else {
00054         return FALSE;
00055     }
00056 }

Here is the call graph for this function:

int QseAveragerRole::matchesEnergyColumn ( const QseColumn c  ) 

Definition at line 58 of file qseaveragerrole.cpp.

References QseColumn::columnRole(), QseColumn::EnergyRole, m_EnergyPattern, QseColumn::name(), and QseColumn::UnspecifiedRole.

Referenced by styledColumnItem(), and SimpleGraphController::updateGraph().

00059 {
00060     if (c) {
00061         QseColumn::QseColumnRole r = c->columnRole();
00062 
00063         if (r == QseColumn::UnspecifiedRole) {
00064             return m_EnergyPattern.exactMatch(c->name());
00065         } else {
00066             return r == QseColumn::EnergyRole;
00067         }
00068     } else {
00069         return FALSE;
00070     }
00071 }

Here is the call graph for this function:

int QseAveragerRole::matchesDetectorColumn ( const QseColumn c  ) 

Definition at line 73 of file qseaveragerrole.cpp.

References QseColumn::columnRole(), QseColumn::DetectorRole, m_DetectorPattern, QseColumn::name(), and QseColumn::UnspecifiedRole.

Referenced by styledColumnItem(), and SimpleGraphController::updateGraph().

00074 {
00075     if (c) {
00076         QseColumn::QseColumnRole r = c->columnRole();
00077 
00078         if (r == QseColumn::UnspecifiedRole) {
00079             return m_DetectorPattern.exactMatch(c->name());
00080         } else {
00081             return r == QseColumn::DetectorRole;
00082         }
00083     } else {
00084         return FALSE;
00085     }
00086 }

Here is the call graph for this function:

int QseAveragerRole::matchesNormalizationColumn ( const QseColumn c  ) 

Definition at line 88 of file qseaveragerrole.cpp.

References QseColumn::columnRole(), m_NormalizationPattern, QseColumn::name(), QseColumn::NormalizationRole, and QseColumn::UnspecifiedRole.

Referenced by styledColumnItem().

00089 {
00090     if (c) {
00091         QseColumn::QseColumnRole r = c->columnRole();
00092 
00093         if (r == QseColumn::UnspecifiedRole) {
00094             return m_NormalizationPattern.exactMatch(c->name());
00095         } else {
00096             return r == QseColumn::NormalizationRole;
00097         }
00098     } else {
00099         return FALSE;
00100     }
00101 }

Here is the call graph for this function:

int QseAveragerRole::matchesSecondsColumn ( const QseColumn c  ) 

Definition at line 103 of file qseaveragerrole.cpp.

References QseColumn::columnRole(), m_SecondsPattern, QseColumn::name(), QseColumn::SecondsRole, and QseColumn::UnspecifiedRole.

Referenced by styledColumnItem().

00104 {
00105     if (c) {
00106         QseColumn::QseColumnRole r = c->columnRole();
00107 
00108         if (r == QseColumn::UnspecifiedRole) {
00109             return m_SecondsPattern.exactMatch(c->name());
00110         } else {
00111             return r == QseColumn::SecondsRole;
00112         }
00113     } else {
00114         return FALSE;
00115     }
00116 }

Here is the call graph for this function:

QString QseAveragerRole::scanPattern (  ) 

Definition at line 118 of file qseaveragerrole.cpp.

References m_ScanPattern.

Referenced by QseController::writeSettings().

00119 {
00120     return m_ScanPattern.pattern();
00121 }

QString QseAveragerRole::energyPattern (  ) 

Definition at line 132 of file qseaveragerrole.cpp.

References m_EnergyPattern.

Referenced by QseController::writeSettings().

00133 {
00134     return m_EnergyPattern.pattern();
00135 }

QString QseAveragerRole::detectorPattern (  ) 

Definition at line 146 of file qseaveragerrole.cpp.

References m_DetectorPattern.

Referenced by QseController::writeSettings().

00147 {
00148     return m_DetectorPattern.pattern();
00149 }

QString QseAveragerRole::normalizationPattern (  ) 

Definition at line 160 of file qseaveragerrole.cpp.

References m_NormalizationPattern.

Referenced by QseController::writeSettings().

00161 {
00162     return m_NormalizationPattern.pattern();
00163 }

QString QseAveragerRole::secondsPattern (  ) 

Definition at line 174 of file qseaveragerrole.cpp.

References m_SecondsPattern.

Referenced by QseController::writeSettings().

00175 {
00176     return m_SecondsPattern.pattern();
00177 }

QString QseAveragerRole::minScanRowCount (  ) 

Definition at line 188 of file qseaveragerrole.cpp.

References m_MinScanRowCount.

Referenced by matchesScan(), and QseController::writeSettings().

00189 {
00190     return m_MinScanRowCount;
00191 }

QString QseAveragerRole::maxScanRowCount (  ) 

Definition at line 202 of file qseaveragerrole.cpp.

References m_MaxScanRowCount.

Referenced by matchesScan(), and QseController::writeSettings().

00203 {
00204     return m_MaxScanRowCount;
00205 }

int QseAveragerRole::inputEnergyUnits (  ) 

Definition at line 216 of file qseaveragerrole.cpp.

References m_InputEnergyUnits.

Referenced by QseController::writeSettings().

00217 {
00218   return m_InputEnergyUnits;
00219 }

int QseAveragerRole::outputEnergyUnits (  ) 

Definition at line 230 of file qseaveragerrole.cpp.

References m_OutputEnergyUnits.

Referenced by QseController::writeSettings().

00231 {
00232   return m_OutputEnergyUnits;
00233 }

bool QseAveragerRole::scanRegexp (  ) 

Definition at line 257 of file qseaveragerrole.cpp.

References m_ScanPattern.

Referenced by QseController::writeSettings().

00258 {
00259   return m_ScanPattern.patternSyntax() == QRegExp::RegExp;
00260 }

bool QseAveragerRole::energyRegexp (  ) 

Definition at line 262 of file qseaveragerrole.cpp.

References m_EnergyPattern.

Referenced by QseController::writeSettings().

00263 {
00264     return m_EnergyPattern.patternSyntax() == QRegExp::RegExp;
00265 }

bool QseAveragerRole::detectorRegexp (  ) 

Definition at line 267 of file qseaveragerrole.cpp.

References m_DetectorPattern.

Referenced by QseController::writeSettings().

00268 {
00269     return m_DetectorPattern.patternSyntax() == QRegExp::RegExp;
00270 }

bool QseAveragerRole::normalizationRegexp (  ) 

Definition at line 272 of file qseaveragerrole.cpp.

References m_NormalizationPattern.

Referenced by QseController::writeSettings().

00273 {
00274     return m_NormalizationPattern.patternSyntax() == QRegExp::RegExp;
00275 }

bool QseAveragerRole::secondsRegexp (  ) 

Definition at line 277 of file qseaveragerrole.cpp.

References m_SecondsPattern.

Referenced by QseController::writeSettings().

00278 {
00279     return m_SecondsPattern.patternSyntax() == QRegExp::RegExp;
00280 }

ColoredTableItem * QseAveragerRole::styledScanItem ( QseScan scan  ) 

Definition at line 332 of file qseaveragerrole.cpp.

References matchesScan(), QseScan::scanCommand(), and QseScan::UnspecifiedRole.

Referenced by SummaryTableController::updateSummaryTableScanInfo().

00333 {
00334   bool override = false;
00335 
00336   if (scan -> scanRole() != QseScan::UnspecifiedRole) {
00337     override = true;
00338   }
00339 
00340   if (this -> matchesScan(scan)) {
00341     return new ColoredTableItem(Qt::darkGreen, override, scan->scanCommand());
00342   } else {
00343     return new ColoredTableItem(Qt::gray, override, scan->scanCommand());
00344   }
00345 }

Here is the call graph for this function:

ColoredTableItem * QseAveragerRole::styledColumnItem ( QseColumn col  ) 

Definition at line 347 of file qseaveragerrole.cpp.

References matchesDetectorColumn(), matchesEnergyColumn(), matchesNormalizationColumn(), matchesSecondsColumn(), QseColumn::name(), and QseColumn::UnspecifiedRole.

Referenced by SummaryTableController::updateSummaryTableColumnInfo().

00348 {
00349   bool override = false;
00350 
00351   if (col -> columnRole() != QseColumn::UnspecifiedRole) {
00352     override = true;
00353   }
00354 
00355   if (this -> matchesDetectorColumn(col)) {
00356     return new ColoredTableItem(Qt::darkGreen, override, col->name());
00357   } else if (this -> matchesNormalizationColumn(col)) {
00358     return new ColoredTableItem(Qt::darkCyan, override, col->name());
00359   } else if (this -> matchesEnergyColumn(col)) {
00360     return new ColoredTableItem(Qt::darkRed, override, col->name());
00361   } else if (this -> matchesSecondsColumn(col)) {
00362     return new ColoredTableItem(Qt::darkMagenta, override, col->name());
00363   } else {
00364     return new ColoredTableItem(Qt::gray, override, col->name());
00365   }
00366 }

Here is the call graph for this function:

double QseAveragerRole::energyScalingRatio (  ) 

Definition at line 244 of file qseaveragerrole.cpp.

References m_InputEnergyUnits, and m_OutputEnergyUnits.

Referenced by QseAverager::normalizeScan().

00245 {
00246   if (m_InputEnergyUnits == m_OutputEnergyUnits) {
00247     return 1.0;
00248   } else if (m_InputEnergyUnits == 0 && m_OutputEnergyUnits == 1) {
00249     return 0.001;
00250   } else if (m_InputEnergyUnits == 1 && m_OutputEnergyUnits == 0) {
00251     return 1000.0;
00252   } else {
00253     return 1;
00254   }
00255 }

void QseAveragerRole::setScanPattern ( const QString &  pattern  )  [slot]

Definition at line 123 of file qseaveragerrole.cpp.

References changed(), and m_ScanPattern.

Referenced by QseController::readSettings().

00124 {
00125     if (m_ScanPattern.pattern() != pattern) {
00126         m_ScanPattern.setPattern(pattern);
00127 
00128         emit changed();
00129     }
00130 }

void QseAveragerRole::setEnergyPattern ( const QString &  pattern  )  [slot]

Definition at line 137 of file qseaveragerrole.cpp.

References changed(), and m_EnergyPattern.

Referenced by QseController::readSettings().

00138 {
00139     if (m_EnergyPattern.pattern() != pattern) {
00140         m_EnergyPattern.setPattern(pattern);
00141 
00142         emit changed();
00143     }
00144 }

void QseAveragerRole::setDetectorPattern ( const QString &  pattern  )  [slot]

Definition at line 151 of file qseaveragerrole.cpp.

References changed(), and m_DetectorPattern.

Referenced by QseController::readSettings().

00152 {
00153     if (m_DetectorPattern.pattern() != pattern) {
00154         m_DetectorPattern.setPattern(pattern);
00155 
00156         emit changed();
00157     }
00158 }

void QseAveragerRole::setNormalizationPattern ( const QString &  pattern  )  [slot]

Definition at line 165 of file qseaveragerrole.cpp.

References changed(), and m_NormalizationPattern.

Referenced by QseController::readSettings().

00166 {
00167     if (m_NormalizationPattern.pattern() != pattern) {
00168         m_NormalizationPattern.setPattern(pattern);
00169 
00170         emit changed();
00171     }
00172 }

void QseAveragerRole::setSecondsPattern ( const QString &  pattern  )  [slot]

Definition at line 179 of file qseaveragerrole.cpp.

References changed(), and m_SecondsPattern.

Referenced by QseController::readSettings().

00180 {
00181     if (m_SecondsPattern.pattern() != pattern) {
00182         m_SecondsPattern.setPattern(pattern);
00183 
00184         emit changed();
00185     }
00186 }

void QseAveragerRole::setMinScanRowCount ( const QString &  ct  )  [slot]

Definition at line 193 of file qseaveragerrole.cpp.

References changed(), and m_MinScanRowCount.

Referenced by QseController::readSettings().

00194 {
00195     if (m_MinScanRowCount != ct) {
00196         m_MinScanRowCount = ct;
00197 
00198         emit changed();
00199     }
00200 }

void QseAveragerRole::setMaxScanRowCount ( const QString &  ct  )  [slot]

Definition at line 207 of file qseaveragerrole.cpp.

References changed(), and m_MaxScanRowCount.

Referenced by QseController::readSettings().

00208 {
00209     if (m_MaxScanRowCount != ct) {
00210         m_MaxScanRowCount = ct;
00211 
00212         emit changed();
00213     }
00214 }

void QseAveragerRole::setInputEnergyUnits ( int  n  )  [slot]

Definition at line 221 of file qseaveragerrole.cpp.

References changed(), and m_InputEnergyUnits.

Referenced by QseController::readSettings().

00222 {
00223   if (m_InputEnergyUnits != n) {
00224     m_InputEnergyUnits = n;
00225 
00226     emit changed();
00227   }
00228 }

void QseAveragerRole::setOutputEnergyUnits ( int  n  )  [slot]

Definition at line 235 of file qseaveragerrole.cpp.

References changed(), and m_OutputEnergyUnits.

Referenced by QseController::readSettings().

00236 {
00237   if (m_OutputEnergyUnits != n) {
00238     m_OutputEnergyUnits = n;
00239 
00240     emit changed();
00241   }
00242 }

void QseAveragerRole::setScanRegexp ( bool  re  )  [slot]

Definition at line 282 of file qseaveragerrole.cpp.

References changed(), and m_ScanPattern.

Referenced by QseController::readSettings().

00283 {
00284   QRegExp::PatternSyntax n = (re ?  QRegExp::RegExp : QRegExp::Wildcard);
00285   
00286     if (m_ScanPattern.patternSyntax() != n) {
00287         m_ScanPattern.setPatternSyntax(n);
00288         emit changed();
00289     }
00290 }

void QseAveragerRole::setEnergyRegexp ( bool  re  )  [slot]

Definition at line 292 of file qseaveragerrole.cpp.

References changed(), and m_EnergyPattern.

Referenced by QseController::readSettings().

00293 {
00294   QRegExp::PatternSyntax n = (re ?  QRegExp::RegExp : QRegExp::Wildcard);
00295   
00296     if (m_EnergyPattern.patternSyntax() != n) {
00297         m_EnergyPattern.setPatternSyntax(n);
00298         emit changed();
00299     }
00300 }

void QseAveragerRole::setDetectorRegexp ( bool  re  )  [slot]

Definition at line 302 of file qseaveragerrole.cpp.

References changed(), and m_DetectorPattern.

Referenced by QseController::readSettings().

00303 {
00304   QRegExp::PatternSyntax n = (re ?  QRegExp::RegExp : QRegExp::Wildcard);
00305   
00306     if (m_DetectorPattern.patternSyntax() != n) {
00307         m_DetectorPattern.setPatternSyntax(n);
00308         emit changed();
00309     }
00310 }

void QseAveragerRole::setNormalizationRegexp ( bool  re  )  [slot]

Definition at line 312 of file qseaveragerrole.cpp.

References changed(), and m_NormalizationPattern.

Referenced by QseController::readSettings().

00313 {
00314   QRegExp::PatternSyntax n = (re ?  QRegExp::RegExp : QRegExp::Wildcard);
00315   
00316     if (m_NormalizationPattern.patternSyntax() != n) {
00317         m_NormalizationPattern.setPatternSyntax(n);
00318         emit changed();
00319     }
00320 }

void QseAveragerRole::setSecondsRegexp ( bool  re  )  [slot]

Definition at line 322 of file qseaveragerrole.cpp.

References changed(), and m_SecondsPattern.

Referenced by QseController::readSettings().

00323 {
00324   QRegExp::PatternSyntax n = (re ?  QRegExp::RegExp : QRegExp::Wildcard);
00325   
00326     if (m_SecondsPattern.patternSyntax() != n) {
00327         m_SecondsPattern.setPatternSyntax(n);
00328         emit changed();
00329     }
00330 }

void QseAveragerRole::changed (  )  [signal]


Member Data Documentation

Definition at line 68 of file qseaveragerrole.h.

QRegExp QseAveragerRole::m_ScanPattern [private]

Definition at line 69 of file qseaveragerrole.h.

Referenced by matchesScan(), scanPattern(), scanRegexp(), setScanPattern(), and setScanRegexp().

Definition at line 75 of file qseaveragerrole.h.

Referenced by minScanRowCount(), and setMinScanRowCount().

Definition at line 76 of file qseaveragerrole.h.

Referenced by maxScanRowCount(), and setMaxScanRowCount().

Definition at line 78 of file qseaveragerrole.h.

Referenced by energyScalingRatio(), inputEnergyUnits(), and setInputEnergyUnits().

Definition at line 79 of file qseaveragerrole.h.

Referenced by energyScalingRatio(), outputEnergyUnits(), and setOutputEnergyUnits().


The documentation for this class was generated from the following files:

Generated on Fri May 2 16:26:41 2008 for QSE by  doxygen 1.5.5