qmca  0.0.20
Public Slots | Public Member Functions | Private Attributes | List of all members
MCAGroup Class Reference

#include <mcagroup.h>

Inheritance diagram for MCAGroup:
Inheritance graph

Public Slots

void erase_mcas ()
 
void start_mcas ()
 
void stop_mcas ()
 
void erase_start_mcas ()
 
void save_data ()
 
void setPresetRealTime (double t)
 
void setPresetLiveTime (double t)
 

Public Member Functions

 MCAGroup (QObject *parent)
 
virtual ~MCAGroup ()
 
void append (EpicsMCA *mca)
 
int count ()
 
void write_data (QString name)
 

Private Attributes

QList< EpicsMCA * > m_MCAList
 

Detailed Description

Definition at line 9 of file mcagroup.h.

Constructor & Destructor Documentation

MCAGroup::MCAGroup ( QObject *  parent)

Definition at line 8 of file mcagroup.cpp.

9  : QObject(parent)
10 {
11 }
MCAGroup::~MCAGroup ( )
virtual

Definition at line 13 of file mcagroup.cpp.

References m_MCAList.

14 {
15  while (!m_MCAList.isEmpty()) {
16  delete m_MCAList.takeFirst();
17  }
18 }
QList< EpicsMCA * > m_MCAList
Definition: mcagroup.h:33

Member Function Documentation

void MCAGroup::append ( EpicsMCA mca)

Definition at line 20 of file mcagroup.cpp.

References m_MCAList.

21 {
22  m_MCAList.append(mca);
23 }
QList< EpicsMCA * > m_MCAList
Definition: mcagroup.h:33
int MCAGroup::count ( )

Definition at line 25 of file mcagroup.cpp.

References m_MCAList.

26 {
27  return m_MCAList.count();
28 }
QList< EpicsMCA * > m_MCAList
Definition: mcagroup.h:33
void MCAGroup::erase_mcas ( )
slot

Definition at line 30 of file mcagroup.cpp.

References EpicsMCA::erase(), and m_MCAList.

31 {
32  EpicsMCA *mca;
33 
34  foreach(mca, m_MCAList) {
35  mca->erase();
36  }
37 }
QList< EpicsMCA * > m_MCAList
Definition: mcagroup.h:33
void erase()
Definition: epicsmca.cpp:55
void MCAGroup::erase_start_mcas ( )
slot

Definition at line 57 of file mcagroup.cpp.

References EpicsMCA::eraseAndStart(), and m_MCAList.

58 {
59  EpicsMCA *mca;
60 
61  foreach(mca, m_MCAList) {
62  mca->eraseAndStart();
63  }
64 }
QList< EpicsMCA * > m_MCAList
Definition: mcagroup.h:33
void eraseAndStart()
Definition: epicsmca.cpp:65
void MCAGroup::save_data ( )
slot

Definition at line 84 of file mcagroup.cpp.

References write_data().

85 {
86  QString name = QFileDialog::getSaveFileName(0, "Save MCA Data...");
87 
88  if (name != "") {
89  write_data(name);
90  }
91 }
void write_data(QString name)
Definition: mcagroup.cpp:93
void MCAGroup::setPresetLiveTime ( double  t)
slot

Definition at line 75 of file mcagroup.cpp.

References m_MCAList, and EpicsMCA::setPresetLiveTime().

76 {
77  EpicsMCA *mca;
78 
79  foreach(mca, m_MCAList) {
80  mca->setPresetLiveTime(t);
81  }
82 }
QList< EpicsMCA * > m_MCAList
Definition: mcagroup.h:33
void setPresetLiveTime(double t)
Definition: epicsmca.cpp:30
void MCAGroup::setPresetRealTime ( double  t)
slot

Definition at line 66 of file mcagroup.cpp.

References m_MCAList, and EpicsMCA::setPresetRealTime().

67 {
68  EpicsMCA *mca;
69 
70  foreach(mca, m_MCAList) {
71  mca->setPresetRealTime(t);
72  }
73 }
void setPresetRealTime(double t)
Definition: epicsmca.cpp:25
QList< EpicsMCA * > m_MCAList
Definition: mcagroup.h:33
void MCAGroup::start_mcas ( )
slot

Definition at line 39 of file mcagroup.cpp.

References m_MCAList, and EpicsMCA::start().

40 {
41  EpicsMCA *mca;
42 
43  foreach(mca, m_MCAList) {
44  mca->start();
45  }
46 }
QList< EpicsMCA * > m_MCAList
Definition: mcagroup.h:33
void start()
Definition: epicsmca.cpp:60
void MCAGroup::stop_mcas ( )
slot

Definition at line 48 of file mcagroup.cpp.

References m_MCAList, and EpicsMCA::stop().

49 {
50  EpicsMCA *mca;
51 
52  foreach(mca, m_MCAList) {
53  mca->stop();
54  }
55 }
void stop()
Definition: epicsmca.cpp:70
QList< EpicsMCA * > m_MCAList
Definition: mcagroup.h:33
void MCAGroup::write_data ( QString  name)

Definition at line 93 of file mcagroup.cpp.

References m_MCAList, EpicsObject::pvName(), and EpicsArray::value().

Referenced by save_data().

94 {
95  FILE *f = fopen(qPrintable(name),"w");
96 
97  QVector<QVector<double> > cols;
98  EpicsMCA *mca;
99 
100  fprintf(f, "#N");
101 
102  foreach(mca, m_MCAList) {
103  fprintf(f,"\t%s",qPrintable(mca->pvName()));
104  cols.append(mca->value());
105  }
106 
107  fprintf(f, "\n");
108 
109  int ncols = cols.count();
110  int nrows = 0;
111 
112  if (ncols) {
113  nrows = cols[0].count();
114  }
115 
116  printf("%d rows x %d columns\n", nrows, ncols);
117 
118  for (int i=0; i<nrows; i++) {
119  fprintf(f, "%d", i);
120 
121  for (int j=0; j<ncols; j++) {
122  fprintf(f, "\t%g", cols[j][i]);
123  }
124 
125  fprintf(f, "\n");
126  }
127 
128  fclose(f);
129 }
QList< EpicsMCA * > m_MCAList
Definition: mcagroup.h:33
QString pvName()
Definition: epicsobject.cpp:30
QVector< double > value()
Definition: epicsarray.cpp:90

Member Data Documentation

QList<EpicsMCA*> MCAGroup::m_MCAList
private

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