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

Methods for accessing an display structure. More...

#include "pvDisplay.h"

Public Member Functions

 PVDisplay ()
 
bool attach (PVFieldPtr const &pvField)
 
void detach ()
 
bool isAttached ()
 
void get (Display &display) const
 
bool set (Display const &display)
 

Detailed Description

Methods for accessing an display structure.

A display structure has the following fields:

double limitLow
double limitHigh
string description
string format
string units

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

Definition at line 39 of file pvDisplay.h.

Constructor & Destructor Documentation

epics::pvData::PVDisplay::PVDisplay ( )
inline

Constructor

Definition at line 45 of file pvDisplay.h.

45 {}

Member Function Documentation

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

Definition at line 26 of file pvDisplay.cpp.

27 {
28  if(pvField->getField()->getType()!=structure) return false;
29  PVStructurePtr pvStructure = static_pointer_cast<PVStructure>(pvField);
30  pvDescription = pvStructure->getSubField<PVString>("description");
31  if(pvDescription.get()==NULL) return false;
32  pvFormat = pvStructure->getSubField<PVString>("format");
33  if(pvFormat.get()==NULL) {
34  detach();
35  return false;
36  }
37  pvUnits = pvStructure->getSubField<PVString>("units");
38  if(pvUnits.get()==NULL) {
39  detach();
40  return false;
41  }
42  pvLow = pvStructure->getSubField<PVDouble>(string("limitLow"));
43  if(pvLow.get()==NULL) {
44  detach();
45  return false;
46  }
47  pvHigh = pvStructure->getSubField<PVDouble>(string("limitHigh"));
48  if(pvHigh.get()==NULL) {
49  detach();
50  return false;
51  }
52  return true;
53 }
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::PVDisplay::detach ( )

Detach for pvField.

Definition at line 55 of file pvDisplay.cpp.

56 {
57  pvDescription.reset();
58  pvFormat.reset();
59  pvUnits.reset();
60  pvLow.reset();
61  pvHigh.reset();
62 }
void epics::pvData::PVDisplay::get ( Display display) const

copy the display structure values to Display

Parameters
displayAn instance of class Display
Exceptions
Ifnot attached to a pvField.

Definition at line 69 of file pvDisplay.cpp.

70 {
71  if(pvDescription.get()==NULL) {
72  throw std::logic_error(notAttached);
73  }
74  display.setDescription(pvDescription->get());
75  display.setFormat(pvFormat->get());
76  display.setUnits(pvUnits->get());
77  display.setLow(pvLow->get());
78  display.setHigh(pvHigh->get());
79 }
#define NULL
Definition: catime.c:38
bool epics::pvData::PVDisplay::isAttached ( )

Is the PVDisplay attached to a pvField?

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

Definition at line 64 of file pvDisplay.cpp.

64  {
65  if(pvDescription.get()) return false;
66  return true;
67 }
bool epics::pvData::PVDisplay::set ( Display const &  display)

copy the values from Display to the display structure.

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

Definition at line 81 of file pvDisplay.cpp.

82 {
83  if(pvDescription.get()==NULL) {
84  throw std::logic_error(notAttached);
85  }
86  if(pvDescription->isImmutable() || pvFormat->isImmutable()) return false;
87  if(pvUnits->isImmutable() || pvLow->isImmutable() || pvHigh->isImmutable())
88  {
89  return false;
90  }
91  Display current;
92  get(current);
93  bool returnValue = false;
94  if(current.getDescription()!=display.getDescription())
95  {
96  pvDescription->put(display.getDescription());
97  returnValue = true;
98  }
99  if(current.getFormat()!=display.getFormat())
100  {
101  pvFormat->put(display.getFormat());
102  returnValue = true;
103  }
104  if(current.getUnits()!=display.getUnits())
105  {
106  pvUnits->put(display.getUnits());
107  returnValue = true;
108  }
109  if(current.getLow()!=display.getLow())
110  {
111  pvLow->put(display.getLow());
112  returnValue = true;
113  }
114  if(current.getHigh()!=display.getHigh())
115  {
116  pvHigh->put(display.getHigh());
117  returnValue = true;
118  }
119  return returnValue;
120 }
#define NULL
Definition: catime.c:38

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