QXRD  0.11.16
Public Slots | Public Member Functions | Static Public Member Functions | Properties | Private Attributes | List of all members
QcepObject Class Reference

#include <qcepobject.h>

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

Public Slots

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

 QcepObject (QString name, QcepObject *parent)
 
virtual ~QcepObject ()
 
virtual void writeSettings (QSettings *set, QString section)
 
virtual void readSettings (QSettings *set, QString section)
 
QString get_Name () const
 
void set_Name (QString name)
 

Static Public Member Functions

static int allocatedObjects ()
 
static int deletedObjects ()
 
static QSet< QcepObject * > allocatedObjectsSet ()
 
static QString addSlashes (QString str)
 

Properties

QString name
 

Private Attributes

QcepObjectm_Parent
 
QcepObjectNamer m_ObjectNamer
 

Detailed Description

Definition at line 10 of file qcepobject.h.

Constructor & Destructor Documentation

QcepObject::QcepObject ( QString  name,
QcepObject parent 
)
explicit

Definition at line 16 of file qcepobject.cpp.

References s_Allocated, and s_ObjectAllocateCount().

16  :
17  QObject(NULL),
18  m_Parent(parent),
19  m_ObjectNamer(this, name)/*,
20  m_Name(QcepSettingsSaverWPtr(), this, "name", name, "Object Name")*/
21 {
22  s_ObjectAllocateCount.fetchAndAddOrdered(1);
23 
24 #ifndef QT_NO_DEBUG
25  s_Allocated.insert(this);
26 #endif
27 }
QcepObject * m_Parent
Definition: qcepobject.h:45
QcepObjectNamer m_ObjectNamer
Definition: qcepobject.h:46
static QAtomicInt s_ObjectAllocateCount(0)
static QSet< QcepObject * > s_Allocated
Definition: qcepobject.cpp:13
QString name
Definition: qcepobject.h:49

Here is the call graph for this function:

QcepObject::~QcepObject ( )
virtual

Definition at line 29 of file qcepobject.cpp.

References s_Allocated, and s_ObjectDeleteCount().

30 {
31 //#ifndef QT_NO_DEBUG
32 // QThread *currTh = QThread::currentThread();
33 // QThread *objTh = thread();
34 
35 // if (objTh && currTh != objTh) {
36 // printf("Deleting object from different thread %s (%s, %s)\n",
37 // qPrintable(objectName()),
38 // qPrintable(currTh ? currTh->objectName() : "null"),
39 // qPrintable(objTh ? objTh->objectName() : "null"));
40 // }
41 //#endif
42 
43  s_ObjectDeleteCount.fetchAndAddOrdered(1);
44 
45 #ifndef QT_NO_DEBUG
46  s_Allocated.remove(this);
47 #endif
48 }
static QAtomicInt s_ObjectDeleteCount(0)
static QSet< QcepObject * > s_Allocated
Definition: qcepobject.cpp:13

Here is the call graph for this function:

Member Function Documentation

QString QcepObject::addSlashes ( QString  str)
static

Definition at line 124 of file qcepobject.cpp.

Referenced by scriptValueLiteral().

125 {
126  QString newStr;
127 
128  for(int i=0;i<str.length();i++) {
129  if(str[i] == '\0') {
130  newStr.append('\\');
131  newStr.append('0');
132  } else if(str[i] == '\'') {
133  newStr.append('\\');
134  newStr.append('\'');
135  } else if(str[i] == '\"') {
136  newStr.append('\\');
137  newStr.append('\"');
138  } else if(str[i] == '\\') {
139  newStr.append('\\');
140  newStr.append('\\');
141  } else {
142  newStr.append(str[i]);
143  }
144  }
145 
146  return newStr;
147 }
#define str(s)

Here is the caller graph for this function:

int QcepObject::allocatedObjects ( )
static

Definition at line 50 of file qcepobject.cpp.

References s_ObjectAllocateCount().

Referenced by main().

51 {
52  return s_ObjectAllocateCount.load();
53 }
static QAtomicInt s_ObjectAllocateCount(0)

Here is the call graph for this function:

Here is the caller graph for this function:

QSet< QcepObject * > QcepObject::allocatedObjectsSet ( )
static

Definition at line 61 of file qcepobject.cpp.

References s_Allocated.

Referenced by main().

62 {
63  return s_Allocated;
64 }
static QSet< QcepObject * > s_Allocated
Definition: qcepobject.cpp:13

Here is the caller graph for this function:

void QcepObject::criticalMessage ( QString  msg,
QDateTime  ts = QDateTime::currentDateTime() 
) const
virtualslot

Reimplemented in QxrdDetector, and QxrdAcquisitionExtraInputs.

Definition at line 94 of file qcepobject.cpp.

References criticalMessage(), and m_Parent.

Referenced by criticalMessage().

95 {
96  if (m_Parent) {
97  m_Parent->criticalMessage(msg, dt);
98  } else {
99  printf("MESSAGE: %s %s\n",
100  qPrintable(dt.toString("hh:mm:ss")), qPrintable(msg));
101  }
102 }
QcepObject * m_Parent
Definition: qcepobject.h:45
virtual void criticalMessage(QString msg, QDateTime ts=QDateTime::currentDateTime()) const
Definition: qcepobject.cpp:94

Here is the call graph for this function:

Here is the caller graph for this function:

int QcepObject::deletedObjects ( )
static

Definition at line 55 of file qcepobject.cpp.

References s_ObjectDeleteCount().

Referenced by main().

56 {
57  return s_ObjectDeleteCount.load();
58 }
static QAtomicInt s_ObjectDeleteCount(0)

Here is the call graph for this function:

Here is the caller graph for this function:

QString QcepObject::get_Name ( ) const

Definition at line 72 of file qcepobject.cpp.

Referenced by QcepDataObject::columnData(), QcepDatasetBrowserDialog::deleteData(), QcepDatasetModel::indexDescription(), QcepDataObject::pathName(), and settingsScript().

73 {
74  return objectName();
75 }

Here is the caller graph for this function:

void QcepObject::printLine ( QString  line)
virtualslot

Definition at line 77 of file qcepobject.cpp.

References m_Parent, and printLine().

Referenced by printLine().

78 {
79  if (m_Parent) {
80  m_Parent->printLine(line);
81  }
82 }
QcepObject * m_Parent
Definition: qcepobject.h:45
virtual void printLine(QString line)
Definition: qcepobject.cpp:77

Here is the call graph for this function:

Here is the caller graph for this function:

void QcepObject::printMessage ( QString  msg,
QDateTime  dt = QDateTime::currentDateTime() 
) const
virtualslot

Reimplemented in QxrdDetector, and QxrdAcquisitionExtraInputs.

Definition at line 84 of file qcepobject.cpp.

References m_Parent, and printMessage().

Referenced by QxrdIntegrator::appendIntegration(), QxrdDetectorPilatusRemote::connectToRemote(), QcepDataGroup::createGroup(), QxrdDetectorProcessor::doBadPixels(), QxrdDetectorProcessor::doCalculateROICounts(), QxrdDetectorProcessor::doDarkSubtraction(), QxrdDetectorProcessor::doGainCorrection(), QxrdCalibrant::dSpacingsCubic(), QxrdDetectorPilatusRemote::executeRemote(), QxrdDetectorPilatusRemote::interpretLine(), QxrdDetectorProcessor::onBadPixelsPathChanged(), QxrdDetectorProcessor::onDarkImagePathChanged(), QxrdDetectorProcessor::onGainMapPathChanged(), QxrdDetectorProcessor::onMaskPathChanged(), QxrdDetectorPilatusRemote::onReadyRead(), printMessage(), QxrdDetectorProcessor::processAcquiredImage(), QxrdDetectorProcessor::processDarkImage(), QxrdDetectorProcessor::processIdleImage(), QcepDataObject::QcepDataObject(), QxrdDetectorPilatusRemote::QxrdDetectorPilatusRemote(), QxrdAcquisitionExecution::~QxrdAcquisitionExecution(), and QxrdFileBrowserModelUpdater::~QxrdFileBrowserModelUpdater().

85 {
86  if (m_Parent) {
87  m_Parent->printMessage(msg, dt);
88  } else {
89  printf("MESSAGE: %s %s\n",
90  qPrintable(dt.toString("hh:mm:ss")), qPrintable(msg));
91  }
92 }
QcepObject * m_Parent
Definition: qcepobject.h:45
virtual void printMessage(QString msg, QDateTime dt=QDateTime::currentDateTime()) const
Definition: qcepobject.cpp:84

Here is the call graph for this function:

Here is the caller graph for this function:

void QcepObject::readSettings ( QSettings *  set,
QString  section 
)
virtual
QString QcepObject::scriptValueLiteral ( QVariant  v)
slot

Definition at line 149 of file qcepobject.cpp.

References addSlashes().

Referenced by settingsScript().

150 {
151  if (v.type() == QMetaType::QString) {
152  return "\"" + addSlashes(v.toString()) + "\"";
153  } else {
154  return v.toString();
155  }
156 }
static QString addSlashes(QString str)
Definition: qcepobject.cpp:124

Here is the call graph for this function:

Here is the caller graph for this function:

void QcepObject::set_Name ( QString  name)

Definition at line 67 of file qcepobject.cpp.

68 {
69  setObjectName(name);
70 }
QString name
Definition: qcepobject.h:49
QString QcepObject::settingsScript ( )
virtualslot

Definition at line 158 of file qcepobject.cpp.

References get_Name(), and scriptValueLiteral().

159 {
160  QString res = "";
161  const QMetaObject* metaObject = this->metaObject();
162 
163  for (int i=1; i < metaObject->propertyCount(); i++) {
164  QMetaProperty prop = metaObject->property(i);
165 
166  if (prop.isStored()) {
167  res += tr("%1.%2 = %3;\n").arg(this->get_Name())
168  .arg(prop.name())
169  .arg(scriptValueLiteral(this->property(prop.name())));
170  }
171  }
172 
173  return res;
174 }
QString get_Name() const
Definition: qcepobject.cpp:72
QString scriptValueLiteral(QVariant v)
Definition: qcepobject.cpp:149

Here is the call graph for this function:

void QcepObject::statusMessage ( QString  msg,
QDateTime  ts = QDateTime::currentDateTime() 
) const
virtualslot

Reimplemented in QxrdDetector, and QxrdAcquisitionExtraInputs.

Definition at line 104 of file qcepobject.cpp.

References m_Parent, and statusMessage().

Referenced by QxrdAcquisitionInterface::acquire(), QxrdAcquisitionInterface::acquireDark(), and statusMessage().

105 {
106  if (m_Parent) {
107  m_Parent->statusMessage(msg, dt);
108  } else {
109  printf("MESSAGE: %s %s\n",
110  qPrintable(dt.toString("hh:mm:ss")), qPrintable(msg));
111  }
112 }
QcepObject * m_Parent
Definition: qcepobject.h:45
virtual void statusMessage(QString msg, QDateTime ts=QDateTime::currentDateTime()) const
Definition: qcepobject.cpp:104

Here is the call graph for this function:

Here is the caller graph for this function:

void QcepObject::writeSettings ( QSettings *  set,
QString  section 
)
virtual

Member Data Documentation

QcepObjectNamer QcepObject::m_ObjectNamer
private

Definition at line 46 of file qcepobject.h.

QcepObject* QcepObject::m_Parent
private

Definition at line 45 of file qcepobject.h.

Referenced by criticalMessage(), printLine(), printMessage(), and statusMessage().

Property Documentation

QString QcepObject::name
readwrite

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