QXRD  0.11.16
Public Slots | Public Member Functions | Private Attributes | List of all members
QxrdCalibrantLibrary Class Reference

#include <qxrdcalibrantlibrary.h>

Inheritance diagram for QxrdCalibrantLibrary:
Inheritance graph
[legend]
Collaboration diagram for QxrdCalibrantLibrary:
Collaboration graph
[legend]

Public Slots

int count ()
 
QString calibrantName (int n)
 
QxrdCalibrantWPtr calibrant (int n)
 
- Public Slots inherited from QcepObject
virtual void printLine (QString line)
 
virtual void printMessage (QString msg, QDateTime dt=QDateTime::currentDateTime()) const
 
virtual void criticalMessage (QString msg, QDateTime ts=QDateTime::currentDateTime()) const
 
virtual void statusMessage (QString msg, QDateTime ts=QDateTime::currentDateTime()) const
 
virtual QString settingsScript ()
 
QString scriptValueLiteral (QVariant v)
 

Public Member Functions

 QxrdCalibrantLibrary (QcepSettingsSaverWPtr saver, QxrdExperimentWPtr exp)
 
virtual ~QxrdCalibrantLibrary ()
 
void readSettings (QSettings *settings, QString section)
 
void writeSettings (QSettings *settings, QString section)
 
void removeCalibrant ()
 
void appendCalibrant (QxrdCalibrantPtr cal=QxrdCalibrantPtr())
 
int numberStandardCalibrants ()
 
QxrdCalibrantPtr standardCalibrant (int n)
 
- Public Member Functions inherited from QcepObject
 QcepObject (QString name, QcepObject *parent)
 
virtual ~QcepObject ()
 
QString get_Name () const
 
void set_Name (QString name)
 

Private Attributes

QMutex m_Mutex
 
QcepSettingsSaverWPtr m_Saver
 
QxrdExperimentWPtr m_Experiment
 
QVector< QxrdCalibrantPtrm_Calibrants
 

Additional Inherited Members

- Static Public Member Functions inherited from QcepObject
static int allocatedObjects ()
 
static int deletedObjects ()
 
static QSet< QcepObject * > allocatedObjectsSet ()
 
static QString addSlashes (QString str)
 
- Properties inherited from QcepObject
QString name
 

Detailed Description

Definition at line 12 of file qxrdcalibrantlibrary.h.

Constructor & Destructor Documentation

QxrdCalibrantLibrary::QxrdCalibrantLibrary ( QcepSettingsSaverWPtr  saver,
QxrdExperimentWPtr  exp 
)

Definition at line 6 of file qxrdcalibrantlibrary.cpp.

References appendCalibrant(), numberStandardCalibrants(), and standardCalibrant().

7  : QcepObject("calibrantLibrary", NULL),
8  m_Saver(saver),
9  m_Experiment(exp)
10 {
11  int nCals = numberStandardCalibrants();
12 
13  for (int i=0; i<nCals; i++) {
15  }
16 }
void appendCalibrant(QxrdCalibrantPtr cal=QxrdCalibrantPtr())
QxrdExperimentWPtr m_Experiment
QcepSettingsSaverWPtr m_Saver
QcepObject(QString name, QcepObject *parent)
Definition: qcepobject.cpp:16
QxrdCalibrantPtr standardCalibrant(int n)

Here is the call graph for this function:

QxrdCalibrantLibrary::~QxrdCalibrantLibrary ( )
virtual

Definition at line 18 of file qxrdcalibrantlibrary.cpp.

19 {
20 #ifndef QT_NO_DEBUG
21  printf("Deleting calibrant library\n");
22 #endif
23 }

Member Function Documentation

void QxrdCalibrantLibrary::appendCalibrant ( QxrdCalibrantPtr  cal = QxrdCalibrantPtr())

Definition at line 98 of file qxrdcalibrantlibrary.cpp.

References m_Calibrants, and standardCalibrant().

Referenced by QxrdCalibrantLibrary(), and readSettings().

99 {
100  if (cal) {
101  m_Calibrants.append(cal);
102  } else {
103  m_Calibrants.append(standardCalibrant(0));
104  }
105 }
QxrdCalibrantPtr standardCalibrant(int n)
QVector< QxrdCalibrantPtr > m_Calibrants

Here is the call graph for this function:

Here is the caller graph for this function:

QxrdCalibrantWPtr QxrdCalibrantLibrary::calibrant ( int  n)
slot

Definition at line 258 of file qxrdcalibrantlibrary.cpp.

References m_Calibrants.

259 {
260  return m_Calibrants.value(n);
261 }
QVector< QxrdCalibrantPtr > m_Calibrants
QString QxrdCalibrantLibrary::calibrantName ( int  n)
slot

Definition at line 247 of file qxrdcalibrantlibrary.cpp.

References m_Calibrants.

248 {
249  QxrdCalibrantPtr p(m_Calibrants.value(n));
250 
251  if (p) {
252  return p->get_Name();
253  } else {
254  return "";
255  }
256 }
QSharedPointer< QxrdCalibrant > QxrdCalibrantPtr
QVector< QxrdCalibrantPtr > m_Calibrants
int QxrdCalibrantLibrary::count ( )
slot

Definition at line 242 of file qxrdcalibrantlibrary.cpp.

References m_Calibrants.

243 {
244  return m_Calibrants.count();
245 }
QVector< QxrdCalibrantPtr > m_Calibrants
int QxrdCalibrantLibrary::numberStandardCalibrants ( )

Definition at line 107 of file qxrdcalibrantlibrary.cpp.

Referenced by QxrdCalibrantLibrary(), readSettings(), and writeSettings().

108 {
109  return 8;
110 }

Here is the caller graph for this function:

void QxrdCalibrantLibrary::readSettings ( QSettings *  settings,
QString  section 
)
virtual

Reimplemented from QcepObject.

Definition at line 25 of file qxrdcalibrantlibrary.cpp.

References appendCalibrant(), m_Calibrants, m_Mutex, numberStandardCalibrants(), QcepObject::readSettings(), and removeCalibrant().

26 {
27  QcepMutexLocker lock(__FILE__, __LINE__, &m_Mutex);
28 
29  QcepObject::readSettings(settings, section);
30 
31  int nstd = numberStandardCalibrants();
32 
33  int ns = settings->beginReadArray(section+"/stdcalibrants");
34 
35  for (int i=0; i<ns; i++) {
36  settings->setArrayIndex(i);
37 
38  int isUsed = settings->value("isUsed").toInt();
39 
40  m_Calibrants[i]->set_IsUsed(isUsed);
41  }
42 
43  settings->endArray();
44 
45  int nc = settings->beginReadArray(section+"/calibrants");
46 
47  while (m_Calibrants.count() > (nc + nstd)) {
49  }
50 
51  while (m_Calibrants.count() < (nc + nstd)) {
53  }
54 
55  for (int i=0; i<nc; i++) {
56  settings->setArrayIndex(i);
57 
58  m_Calibrants[i+nstd]->readSettings(settings, "");
59  }
60 
61  settings->endArray();
62 }
void appendCalibrant(QxrdCalibrantPtr cal=QxrdCalibrantPtr())
virtual void readSettings(QSettings *set, QString section)
Definition: qcepobject.cpp:119
QVector< QxrdCalibrantPtr > m_Calibrants

Here is the call graph for this function:

void QxrdCalibrantLibrary::removeCalibrant ( )

Definition at line 93 of file qxrdcalibrantlibrary.cpp.

References m_Calibrants.

Referenced by readSettings().

94 {
95  m_Calibrants.removeLast();
96 }
QVector< QxrdCalibrantPtr > m_Calibrants

Here is the caller graph for this function:

QxrdCalibrantPtr QxrdCalibrantLibrary::standardCalibrant ( int  n)

Definition at line 112 of file qxrdcalibrantlibrary.cpp.

References QxrdCalibrant::BodyCenteredCubic, QxrdCalibrant::DiamondCubic, QxrdCalibrant::FaceCenteredCubic, m_Experiment, m_Saver, QxrdCalibrant::RHexagonal, and QxrdCalibrant::SimpleCubic.

Referenced by appendCalibrant(), and QxrdCalibrantLibrary().

113 {
114  QxrdCalibrantPtr res;
115 
116  switch (n) {
117  case 0: // Silicon Powder
118  {
119  res = QxrdCalibrantPtr(new QxrdCalibrant(m_Saver, m_Experiment, sharedFromThis(), n));
120  res->set_Name("Si");
121  res->set_Description("Silicon Powder");
122  res->set_Symmetry(QxrdCalibrant::DiamondCubic);
123  res->set_A(5.43123);
124  res->set_B(5.43123);
125  res->set_C(5.43123);
126  res->set_Alpha(90);
127  res->set_Beta(90);
128  res->set_Gamma(90);
129  }
130  break;
131 
132  case 1: // Alumina
133  {
134  res = QxrdCalibrantPtr(new QxrdCalibrant(m_Saver, m_Experiment, sharedFromThis(), n));
135  res->set_Name("Al2O3");
136  res->set_Description("Alumina Powder");
137  res->set_Symmetry(QxrdCalibrant::RHexagonal);
138  res->set_A(4.7590914);
139  res->set_B(4.7590914);
140  res->set_C(12.991779);
141  res->set_Alpha(90);
142  res->set_Beta(90);
143  res->set_Gamma(120);
144  }
145  break;
146 
147  case 2: // NAC
148  {
149  res = QxrdCalibrantPtr(new QxrdCalibrant(m_Saver, m_Experiment, sharedFromThis(), n));
150  res->set_Name("NAC");
151  res->set_Description("NAC Powder");
152  res->set_Symmetry(QxrdCalibrant::BodyCenteredCubic);
153  res->set_A(10.251437);
154  res->set_B(10.251437);
155  res->set_C(10.251437);
156  res->set_Alpha(90);
157  res->set_Beta(90);
158  res->set_Gamma(90);
159  }
160  break;
161 
162  case 3: // LaB6
163  {
164  res = QxrdCalibrantPtr(new QxrdCalibrant(m_Saver, m_Experiment, sharedFromThis(), n));
165  res->set_Name("LaB6");
166  res->set_Description("NIST SRM LaB6 660a");
167  res->set_Symmetry(QxrdCalibrant::SimpleCubic);
168  res->set_A(4.15692);
169  res->set_B(4.15692);
170  res->set_C(4.15692);
171  res->set_Alpha(90);
172  res->set_Beta(90);
173  res->set_Gamma(90);
174  }
175  break;
176 
177  case 4: // ZnO
178  {
179  res = QxrdCalibrantPtr(new QxrdCalibrant(m_Saver, m_Experiment, sharedFromThis(), n));
180  res->set_Name("ZnO");
181  res->set_Description("Zinc oxide");
182  res->set_Symmetry(QxrdCalibrant::RHexagonal);
183  res->set_A(3.24989);
184  res->set_B(3.24989);
185  res->set_C(5.20653);
186  res->set_Alpha(90);
187  res->set_Beta(90);
188  res->set_Gamma(120);
189  }
190  break;
191 
192  case 5: // CeO2
193  {
194  res = QxrdCalibrantPtr(new QxrdCalibrant(m_Saver, m_Experiment, sharedFromThis(), n));
195  res->set_Name("CeO2");
196  res->set_Description("Cerium(IV) dioxide");
197  res->set_Symmetry(QxrdCalibrant::FaceCenteredCubic);
198  res->set_A(5.41165);
199  res->set_B(5.41165);
200  res->set_C(5.41165);
201  res->set_Alpha(90);
202  res->set_Beta(90);
203  res->set_Gamma(90);
204  }
205  break;
206 
207  case 6: // Cr2O3
208  {
209  res = QxrdCalibrantPtr(new QxrdCalibrant(m_Saver, m_Experiment, sharedFromThis(), n));
210  res->set_Name("Cr2O3");
211  res->set_Description("Chromium oxide");
212  res->set_Symmetry(QxrdCalibrant::RHexagonal);
213  res->set_A(4.95898);
214  res->set_B(4.95898);
215  res->set_C(13.5959);
216  res->set_Alpha(90);
217  res->set_Beta(90);
218  res->set_Gamma(120);
219  }
220  break;
221 
222  case 7: // Germanium Powder
223  {
224  res = QxrdCalibrantPtr(new QxrdCalibrant(m_Saver, m_Experiment, sharedFromThis(), n));
225  res->set_Name("Ge");
226  res->set_Description("Germanium Powder");
227  res->set_Symmetry(QxrdCalibrant::DiamondCubic);
228  res->set_A(5.65754);
229  res->set_B(5.65754);
230  res->set_C(5.65754);
231  res->set_Alpha(90);
232  res->set_Beta(90);
233  res->set_Gamma(90);
234  }
235  break;
236 
237  }
238 
239  return res;
240 }
QxrdExperimentWPtr m_Experiment
QSharedPointer< QxrdCalibrant > QxrdCalibrantPtr
QcepSettingsSaverWPtr m_Saver

Here is the caller graph for this function:

void QxrdCalibrantLibrary::writeSettings ( QSettings *  settings,
QString  section 
)
virtual

Reimplemented from QcepObject.

Definition at line 64 of file qxrdcalibrantlibrary.cpp.

References m_Calibrants, m_Mutex, numberStandardCalibrants(), and QcepObject::writeSettings().

65 {
66  QcepMutexLocker lock(__FILE__, __LINE__, &m_Mutex);
67 
68  QcepObject::writeSettings(settings, section);
69 
70  int nstd = numberStandardCalibrants();
71 
72  settings->beginWriteArray(section+"/stdcalibrants");
73 
74  for (int i=0; i<nstd; i++) {
75  settings->setArrayIndex(i);
76  settings->setValue("isUsed", m_Calibrants[i]->get_IsUsed());
77  }
78 
79  settings->endArray();
80 
81  int n = m_Calibrants.count() - nstd;
82 
83  settings->beginWriteArray(section+"/calibrants");
84 
85  for (int i=0; i<n; i++) {
86  settings->setArrayIndex(i);
87  m_Calibrants[i+nstd]->writeSettings(settings, "");
88  }
89 
90  settings->endArray();
91 }
virtual void writeSettings(QSettings *set, QString section)
Definition: qcepobject.cpp:114
QVector< QxrdCalibrantPtr > m_Calibrants

Here is the call graph for this function:

Member Data Documentation

QVector<QxrdCalibrantPtr> QxrdCalibrantLibrary::m_Calibrants
private
QxrdExperimentWPtr QxrdCalibrantLibrary::m_Experiment
private

Definition at line 39 of file qxrdcalibrantlibrary.h.

Referenced by standardCalibrant().

QMutex QxrdCalibrantLibrary::m_Mutex
mutableprivate

Definition at line 37 of file qxrdcalibrantlibrary.h.

Referenced by readSettings(), and writeSettings().

QcepSettingsSaverWPtr QxrdCalibrantLibrary::m_Saver
private

Definition at line 38 of file qxrdcalibrantlibrary.h.

Referenced by standardCalibrant().


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