lcls2
C++ API: public headers of xtcdata, psalg, psdaq and psana
Loading...
Searching...
No Matches
Pds_Epics::MonTracker Class Reference

Monitor of one PV whose events are handled on the shared WorkQueue thread. More...

#include <MonTracker.hh>

Inherits pvac::ClientChannel::MonitorCallback, Pds_Epics::Worker, std::tr1::enable_shared_from_this< MonTracker >, and Pds_Epics::PVMonitorCb.

Inherited by Pds_Epics::PvMonitorBase.

Public Member Functions

 POINTER_DEFINITIONS (MonTracker)
 Expands the pvData POINTER_DEFINITIONS macro for this class; doxygen lists it as a function.
 
 MonTracker (const std::string &name, const std::string &request="field()")
 Connect to name through pva and start a monitor with request (default field()).
 
 MonTracker (const std::string &provider, const std::string &name, const std::string &request="field()")
 Connect to name through ca if provider is ca, otherwise pva, and start a monitor with request.
 
virtual ~MonTracker ()
 Cancel the monitor.
 
const std::string name () const
 Return the channel name.
 
bool connected () const
 Return true from the first data update until a disconnect.
 
virtual void monitorEvent (const pvac::MonitorEvent &evt) OVERRIDE FINAL
 Monitor callback on a pvAccess thread: queue the event on the WorkQueue for process().
 
virtual void process (const pvac::MonitorEvent &evt) OVERRIDE FINAL
 Handle a monitor event on the WorkQueue thread.
 
- Public Member Functions inherited from Pds_Epics::Worker
virtual ~Worker ()
 Does nothing; empty virtual destructor.
 
- Public Member Functions inherited from Pds_Epics::PVMonitorCb
virtual ~PVMonitorCb ()
 Does nothing; empty virtual destructor.
 
virtual void onConnect ()
 Called by MonTracker on the first data update after connecting; does nothing by default.
 
virtual void onDisconnect ()
 Called by MonTracker on a disconnect; does nothing by default.
 
virtual void updated ()=0
 Pure virtual: called for each update of the PV.
 

Static Public Member Functions

static void close ()
 Close the shared WorkQueue.
 

Protected Member Functions

void disconnect ()
 
void reconnect ()
 

Protected Attributes

pvd::PVStructure::const_shared_pointer _strct
 
pvd::PVStructure::shared_pointer _request
 
pvac::ClientChannel _channel
 
pvac::Monitor _mon
 
bool _connected
 

Detailed Description

Monitor of one PV whose events are handled on the shared WorkQueue thread.

The first data update after connecting calls onConnect(), later ones call updated(), and a disconnect calls onDisconnect().

Constructor & Destructor Documentation

◆ MonTracker() [1/2]

Pds_Epics::MonTracker::MonTracker ( const std::string &  name,
const std::string &  request = "field()" 
)

Connect to name through pva and start a monitor with request (default field()).

◆ MonTracker() [2/2]

Pds_Epics::MonTracker::MonTracker ( const std::string &  provider,
const std::string &  name,
const std::string &  request = "field()" 
)

Connect to name through ca if provider is ca, otherwise pva, and start a monitor with request.

◆ ~MonTracker()

virtual Pds_Epics::MonTracker::~MonTracker ( )
virtual

Cancel the monitor.

Member Function Documentation

◆ close()

static void Pds_Epics::MonTracker::close ( )
static

Close the shared WorkQueue.

◆ connected()

bool Pds_Epics::MonTracker::connected ( ) const
inline

Return true from the first data update until a disconnect.

◆ disconnect()

void Pds_Epics::MonTracker::disconnect ( )
inlineprotected

◆ monitorEvent()

virtual void Pds_Epics::MonTracker::monitorEvent ( const pvac::MonitorEvent &  evt)
virtual

Monitor callback on a pvAccess thread: queue the event on the WorkQueue for process().

Cancel events, and events that arrive while the object is being destroyed, are dropped.

◆ name()

const std::string Pds_Epics::MonTracker::name ( ) const
inline

Return the channel name.

◆ POINTER_DEFINITIONS()

Pds_Epics::MonTracker::POINTER_DEFINITIONS ( MonTracker  )

Expands the pvData POINTER_DEFINITIONS macro for this class; doxygen lists it as a function.

◆ process()

virtual void Pds_Epics::MonTracker::process ( const pvac::MonitorEvent &  evt)
virtual

Handle a monitor event on the WorkQueue thread.

Failures and cancels are printed; a disconnect clears connected() and calls onDisconnect(); for data, up to 2 updates are taken per call (the first after connecting calls onConnect(), others updated()) and the event is queued again if 2 were taken.

Implements Pds_Epics::Worker.

◆ reconnect()

void Pds_Epics::MonTracker::reconnect ( )
inlineprotected

Member Data Documentation

◆ _channel

pvac::ClientChannel Pds_Epics::MonTracker::_channel
protected

◆ _connected

bool Pds_Epics::MonTracker::_connected
protected

◆ _mon

pvac::Monitor Pds_Epics::MonTracker::_mon
protected

◆ _request

pvd::PVStructure::shared_pointer Pds_Epics::MonTracker::_request
protected

◆ _strct

pvd::PVStructure::const_shared_pointer Pds_Epics::MonTracker::_strct
protected

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