qmca  0.0.20
Public Slots | Signals | Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
EpicsInteger Class Reference

#include <epicsinteger.h>

Inheritance diagram for EpicsInteger:
Inheritance graph

Public Slots

void changeValue (int val)
 
void caput (int val)
 

Signals

void valueChanged (int val)
 
- Signals inherited from EpicsObject
void valueChanged ()
 

Public Member Functions

 EpicsInteger (QString pvName, QObject *parent=0, int debug=0)
 
virtual ~EpicsInteger ()
 
void changeConnection (QString pv)
 
int value ()
 
- Public Member Functions inherited from EpicsObject
 EpicsObject (QString pvName, QObject *parent=0, int debug=0)
 
virtual ~EpicsObject ()
 
void changeConnection (QString pv)
 
int count ()
 
QString pvName ()
 
QString toolTip ()
 
virtual void connected ()
 
virtual void disconnected ()
 
chid channelID ()
 
int debug ()
 
void setDebug (int dbg)
 
void settle (double t)
 
void ca_pend_io (double t)
 

Private Member Functions

virtual caEventCallBackFunc * get_event_handler ()
 

Static Private Member Functions

static void event_handler (struct event_handler_args arg)
 

Private Attributes

int m_Value
 

Additional Inherited Members

- Static Public Attributes inherited from EpicsObject
static QMutex m_Mutex
 
- Protected Attributes inherited from EpicsObject
chid m_ChannelID
 
evid m_EventID
 
bool m_HasEventHandler
 
int m_Debug
 

Detailed Description

Definition at line 7 of file epicsinteger.h.

Constructor & Destructor Documentation

EpicsInteger::EpicsInteger ( QString  pvName,
QObject *  parent = 0,
int  debug = 0 
)

Definition at line 6 of file epicsinteger.cpp.

7  : EpicsObject(pvName, parent, debug),
8  m_Value(0)
9 {
10 }
QString pvName()
Definition: epicsobject.cpp:30
EpicsObject(QString pvName, QObject *parent=0, int debug=0)
Definition: epicsobject.cpp:7
EpicsInteger::~EpicsInteger ( )
virtual

Definition at line 12 of file epicsinteger.cpp.

13 {
14 }

Member Function Documentation

void EpicsInteger::caput ( int  val)
slot

Definition at line 74 of file epicsinteger.cpp.

References EpicsObject::ca_pend_io(), and EpicsObject::channelID().

Referenced by EpicsPulseAnalyser::setEnabled(), EpicsPowerSupply::setEnabled(), EpicsA2DConverter::setOffset(), and EpicsPulseAnalyser::setSelected().

75 {
76  ca_put(DBR_INT, channelID(), &val);
77  ca_pend_io(0.5);
78 }
chid channelID()
Definition: epicsobject.cpp:63
void ca_pend_io(double t)
void EpicsInteger::changeConnection ( QString  pv)
void EpicsInteger::changeValue ( int  val)
slot

Definition at line 59 of file epicsinteger.cpp.

References EpicsObject::m_Mutex, m_Value, and EpicsObject::valueChanged().

Referenced by event_handler().

60 {
61 // printf("ca_put(%d,%p,%g)\n", DBR_INT, channelID(), newval);
62 
63 // ca_put(DBR_INT, channelID(), &newval);
64 
65  QMutexLocker lock(&m_Mutex);
66 
67  if (m_Value != newval) {
68 
69  m_Value = newval;
70  emit valueChanged(m_Value);
71  }
72 }
void valueChanged()
static QMutex m_Mutex
Definition: epicsobject.h:42
void EpicsInteger::event_handler ( struct event_handler_args  arg)
staticprivate

Definition at line 16 of file epicsinteger.cpp.

References changeValue(), and EpicsObject::debug().

Referenced by get_event_handler().

17 {
18  union db_access_val *pb = (union db_access_val *) args.dbr;
19 
20  int res=0;
21 
22  switch (args.type) {
23  case DBR_SHORT:
24  res = pb->shrtval;
25  break;
26  case DBR_LONG:
27  res = pb->longval;
28  break;
29  case DBR_FLOAT:
30  res = pb->fltval;
31  break;
32  case DBR_ENUM:
33  res = pb->enmval;
34  break;
35  case DBR_CHAR:
36  res = pb->charval;
37  break;
38  case DBR_DOUBLE:
39  res = pb->doubleval;
40  break;
41  default:
42  printf("data type %ld not supported\n", args.type);
43  }
44 
45  EpicsInteger* i = ((EpicsInteger*) args.usr);
46 
47  if (i && i->debug()) {
48  printf("%s Epics Integer Event Handler called %ld = %d\n", ca_name(args.chid), args.type, res);
49  }
50 
51  ((EpicsInteger*) args.usr) -> changeValue(res);
52 }
void changeValue(int val)
caEventCallBackFunc * EpicsInteger::get_event_handler ( )
privatevirtual

Implements EpicsObject.

Definition at line 54 of file epicsinteger.cpp.

References event_handler().

55 {
57 }
static void event_handler(struct event_handler_args arg)
int EpicsInteger::value ( )

Definition at line 80 of file epicsinteger.cpp.

References EpicsObject::m_Mutex, and m_Value.

Referenced by EpicsIntegerCheckBox::EpicsIntegerCheckBox(), and EpicsIntegerInput::EpicsIntegerInput().

81 {
82  QMutexLocker lock(&m_Mutex);
83 
84  return m_Value;
85 }
static QMutex m_Mutex
Definition: epicsobject.h:42
void EpicsInteger::valueChanged ( int  val)
signal

Member Data Documentation

int EpicsInteger::m_Value
private

Definition at line 31 of file epicsinteger.h.

Referenced by changeValue(), and value().


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