This is Unofficial EPICS BASE Doxygen Site
epics::pvData::PVControl Class Reference

Methods for accessing an control structure. More...

#include "pvControl.h"

Public Member Functions

 PVControl ()
 
bool attach (PVFieldPtr const &pvField)
 
void detach ()
 
bool isAttached ()
 
void get (Control &control) const
 
bool set (Control const &control)
 

Detailed Description

Methods for accessing an control structure.

An control structure has the following fields:

double limitLow
double limitHigh
double minStep

This class can be attached to an control structure field of any PVData object. The methods provide access to the fields in the attached structure, via an instance of class Control. This class should not be extended.

Definition at line 34 of file pvControl.h.

Constructor & Destructor Documentation

epics::pvData::PVControl::PVControl ( )
inline

Constructor

Definition at line 40 of file pvControl.h.

40 {}

Member Function Documentation

bool epics::pvData::PVControl::attach ( PVFieldPtr const &  pvField)

Definition at line 26 of file pvControl.cpp.

27 {
28  if(pvField->getField()->getType()!=structure) return false;
29  PVStructurePtr pvStructure = static_pointer_cast<PVStructure>(pvField);
30  pvLow = pvStructure->getSubField<PVDouble>("limitLow");
31  if(pvLow.get()==NULL) return false;
32  pvHigh = pvStructure->getSubField<PVDouble>("limitHigh");
33  if(pvHigh.get()==NULL) {
34  pvLow.reset();
35  return false;
36  }
37  pvMinStep = pvStructure->getSubField<PVDouble>("minStep");
38  if(pvMinStep.get()==NULL) {
39  pvLow.reset();
40  pvHigh.reset();
41  return false;
42  }
43  return true;
44 }
shared_ptr< T > static_pointer_cast(shared_ptr< U > const &r) BOOST_NOEXCEPT
Definition: shared_ptr.hpp:788
#define NULL
Definition: catime.c:38
std::tr1::shared_ptr< PVStructure > PVStructurePtr
Definition: pvData.h:87
PVScalarValue< double > PVDouble
Definition: pvData.h:503
void epics::pvData::PVControl::detach ( )

Detach for pvField.

Definition at line 46 of file pvControl.cpp.

47 {
48  pvLow.reset();
49  pvHigh.reset();
50 }
void epics::pvData::PVControl::get ( Control control) const

copy the control structure values to Control

Parameters
controlAn instance of class Control
Exceptions
Ifnot attached to a pvField.

Definition at line 57 of file pvControl.cpp.

58 {
59  if(pvLow.get()==NULL) {
60  throw std::logic_error(notAttached);
61  }
62  control.setLow(pvLow->get());
63  control.setHigh(pvHigh->get());
64  control.setMinStep(pvMinStep->get());
65 }
#define NULL
Definition: catime.c:38
bool epics::pvData::PVControl::isAttached ( )

Is the PVControl attached to a pvField?

Returns
(false,true) (is not,is) attached to a pvField.

Definition at line 52 of file pvControl.cpp.

52  {
53  if(pvLow.get()==NULL) return false;
54  return true;
55 }
#define NULL
Definition: catime.c:38
bool epics::pvData::PVControl::set ( Control const &  control)

copy the values from Control to the control structure.

Parameters
controlAn instance of class Control
Returns
(false,true) if pvField (immutable, mutable)
Exceptions
Ifnot attached to a pvField.

Definition at line 67 of file pvControl.cpp.

68 {
69  if(pvLow.get()==NULL) {
70  throw std::logic_error(notAttached);
71  }
72  if(pvLow->isImmutable() || pvHigh->isImmutable() || pvMinStep->isImmutable()) return false;
73  Control current;
74  get(current);
75  bool returnValue = false;
76  if(current.getLow()!=control.getLow())
77  {
78  pvLow->put(control.getLow());
79  returnValue = true;
80  }
81  if(current.getHigh()!=control.getHigh())
82  {
83  pvHigh->put(control.getHigh());
84  returnValue = true;
85  }
86  if(current.getMinStep()!=control.getMinStep())
87  {
88  pvMinStep->put(control.getMinStep());
89  returnValue = true;
90  }
91  return returnValue;
92 }
#define NULL
Definition: catime.c:38

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