Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
//+=============================================================================
//
// file : SAThread.h
//
// description : Include for the ConnectionThread class.
// This class is used for reading SA stream
//
// project : LiberaSparkSRBPM TANGO Device Server
//
// copyleft : European Synchrotron Radiation Facility
// BP 220, Grenoble 38043
// FRANCE
//
//-=============================================================================
#ifndef LIBERASPARKSRBPM_SATHREAD_H
#define LIBERASPARKSRBPM_SATHREAD_H
#include <LiberaSparkSRBPM.h>
namespace LiberaSparkSRBPM_ns {
class SAThread : public omni_thread, public Tango::LogAdapter {
public:
// Constructor
SAThread(LiberaSparkSRBPM *, PosCalculation *, omni_mutex &);
void *run_undetached(void *);
bool exitThread;
string threadStatus;
bool isConnected;
void setHistoryLength(int length);
int getHistoryLength();
void setAveraging(bool avg);
bool isAveraging();
void setAvgLength(int length);
int getAvgLength();
void setStatLength(int length);
int getStatLength();
double GetVa();
double GetVb();
double GetVc();
double GetVd();
double GetSum();
double GetX();
double GetZ();
double GetXStdDev();
double GetZStdDev();
double GetQ();
void getVaHistory(double *hist,int *length);
void getVbHistory(double *hist,int *length);
void getVcHistory(double *hist,int *length);
void getVdHistory(double *hist,int *length);
void getSumHistory(double *hist,int *length);
void getXHistory(double *hist,int *length);
void getZHistory(double *hist,int *length);
void getQHistory(double *hist,int *length);
void wakeup();
private:
void computeAveraging();
void computeStats();
LiberaSparkSRBPM *ds;
omni_mutex &mutex;
PosCalculation *PC;
vector<BP> saValues;
int historyLength;
int avgLength;
int statLength;
bool average;
double HStdDev;
double VStdDev;
int64_t saCount;
BP currentPos;
std::shared_ptr<RStream> m_stream;
std::shared_ptr<StreamClient> m_streamClient;
std::shared_ptr<Int32Buffer> m_buf;
bool OpenStream();
}; // class SAThread
} // namespace LiberaSparkSRBPM_ns
#endif //LIBERASPARKSRBPM_SATHREAD_H