This is Unofficial EPICS BASE Doxygen Site
epics::pvAccess::Monitor::Impl Struct Reference
+ Inheritance diagram for epics::pvAccess::Monitor::Impl:
+ Collaboration diagram for epics::pvAccess::Monitor::Impl:

Public Member Functions

 Impl (ClientChannel::MonitorCallback *cb)
 
virtual ~Impl ()
 
void callEvent (CallbackGuard &G, MonitorEvent::event_t evt=MonitorEvent::Fail)
 
void cancel ()
 
virtual std::string getRequesterName () OVERRIDE FINAL
 
virtual void monitorConnect (pvd::Status const &status, pva::MonitorPtr const &operation, pvd::StructureConstPtr const &structure) OVERRIDE FINAL
 
virtual void channelDisconnect (bool destroy) OVERRIDE FINAL
 
virtual void monitorEvent (pva::MonitorPtr const &monitor) OVERRIDE FINAL
 
virtual void unlisten (pva::MonitorPtr const &monitor) OVERRIDE FINAL
 
- Public Member Functions inherited from pvac::detail::CallbackStorage
 CallbackStorage ()
 
- Public Member Functions inherited from epics::pvAccess::MonitorRequester
 POINTER_DEFINITIONS (MonitorRequester)
 
virtual ~MonitorRequester ()
 
- Public Member Functions inherited from epics::pvAccess::ChannelBaseRequester
 POINTER_DEFINITIONS (ChannelBaseRequester)
 
 ChannelBaseRequester ()
 
virtual ~ChannelBaseRequester ()
 
- Public Member Functions inherited from pvac::detail::wrapped_shared_from_this< Monitor::Impl >
std::tr1::shared_ptr< Monitor::Impl > internal_shared_from_this ()
 

Public Attributes

pva::Channel::shared_pointer chan
 
operation_type::shared_pointer op
 
bool started
 
bool done
 
bool seenEmpty
 
ClientChannel::MonitorCallback * cb
 
MonitorEvent event
 
pva::MonitorElement::Ref last
 
- Public Attributes inherited from pvac::detail::CallbackStorage
epicsMutex mutex
 
epicsEvent wakeup
 
size_t nwaitcb
 
epicsThreadId incb
 

Static Public Attributes

static size_t num_instances
 
- Static Public Attributes inherited from epics::pvAccess::ChannelBaseRequester
static size_t num_instances
 

Additional Inherited Members

- Public Types inherited from epics::pvAccess::MonitorRequester
typedef Monitor operation_type
 
- Static Public Member Functions inherited from pvac::detail::wrapped_shared_from_this< Monitor::Impl >
static std::tr1::shared_ptr< Monitor::Impl > build ()
 
static std::tr1::shared_ptr< Monitor::Impl > build (A a)
 
static std::tr1::shared_ptr< Monitor::Impl > build (A a, B b)
 

Detailed Description

Definition at line 25 of file clientMonitor.cpp.

Constructor & Destructor Documentation

epics::pvAccess::Monitor::Impl::Impl ( ClientChannel::MonitorCallback *  cb)
inline

Definition at line 40 of file clientMonitor.cpp.

41  :started(false)
42  ,done(false)
43  ,seenEmpty(false)
44  ,cb(cb)
45  {REFTRACE_INCREMENT(num_instances);}
ClientChannel::MonitorCallback * cb
virtual epics::pvAccess::Monitor::Impl::~Impl ( )
inlinevirtual

Definition at line 46 of file clientMonitor.cpp.

46  {
47  CallbackGuard G(*this);
48  cb = 0;
49  G.wait(); // paranoia
50  REFTRACE_DECREMENT(num_instances);
51  }
ClientChannel::MonitorCallback * cb

Member Function Documentation

void epics::pvAccess::Monitor::Impl::callEvent ( CallbackGuard G,
MonitorEvent::event_t  evt = MonitorEvent::Fail 
)
inline

Definition at line 53 of file clientMonitor.cpp.

54  {
55  ClientChannel::MonitorCallback *cb=this->cb;
56  if(!cb) return;
57 
58  event.event = evt;
59 
61  this->cb = 0; // last event
62 
63  try {
64  CallbackUse U(G);
65  cb->monitorEvent(event);
66  return;
67  }catch(std::exception& e){
68  if(!this->cb || evt==MonitorEvent::Fail) {
69  LOG(pva::logLevelError, "Unhandled exception in ClientChannel::MonitorCallback::monitorEvent(): %s", e.what());
70  return;
71  } else {
72  event.event = MonitorEvent::Fail;
73  event.message = e.what();
74  }
75  }
76  // continues error handling
77  try {
78  CallbackUse U(G);
79  cb->monitorEvent(event);
80  return;
81  }catch(std::exception& e){
82  LOG(pva::logLevelError, "Unhandled exception following exception in ClientChannel::MonitorCallback::monitorEvent(): %s", e.what());
83  }
84  }
ClientChannel::MonitorCallback * cb
subscription ends in cancellation
Definition: client.h:188
#define LOG(level, format,...)
Definition: logger.h:48
subscription ends in an error
Definition: client.h:187
void epics::pvAccess::Monitor::Impl::cancel ( )
inline

Definition at line 87 of file clientMonitor.cpp.

88  {
89  operation_type::shared_pointer temp;
90  {
91  // keepalive for safety in case callback wants to destroy us
92  std::tr1::shared_ptr<Monitor::Impl> keepalive(internal_shared_from_this());
93 
94  CallbackGuard G(*this);
95 
96  last.reset();
97 
98  if(started && op) {
99  op->stop();
100  started = false;
101  }
102  temp.swap(op);
103 
105  G.wait();
106  }
107  if(temp)
108  temp->destroy();
109  }
subscription ends in cancellation
Definition: client.h:188
std::tr1::shared_ptr< Monitor::Impl > internal_shared_from_this()
Definition: clientpvt.h:44
pva::MonitorElement::Ref last
void callEvent(CallbackGuard &G, MonitorEvent::event_t evt=MonitorEvent::Fail)
operation_type::shared_pointer op
virtual void epics::pvAccess::Monitor::Impl::channelDisconnect ( bool  destroy)
inlinevirtual

Notification when underlying Channel becomes DISCONNECTED or DESTORYED

(re)connection is notified through a sub-class *Connect() method.

Any in-progress get()/put()/request()/start() is implicitly cancel()'d or stop()'d before this method is called.

Ownership of any PVStructures passed to completion callbacks (eg. ChannelGetRequester::getDone() ) is returned the operation

Parameters
destroytrue for final disconnect.

Reimplemented from epics::pvAccess::ChannelBaseRequester.

Definition at line 150 of file clientMonitor.cpp.

151  {
152  std::tr1::shared_ptr<Monitor::Impl> keepalive(internal_shared_from_this());
153  CallbackGuard G(*this);
154  if(!cb || done) return;
155  event.message = "Disconnect";
156  started = false;
158  }
ClientChannel::MonitorCallback * cb
subscription interrupted due to loss of communication
Definition: client.h:189
std::tr1::shared_ptr< Monitor::Impl > internal_shared_from_this()
Definition: clientpvt.h:44
void callEvent(CallbackGuard &G, MonitorEvent::event_t evt=MonitorEvent::Fail)
virtual std::string epics::pvAccess::Monitor::Impl::getRequesterName ( )
inlinevirtual

Definition at line 111 of file clientMonitor.cpp.

112  {
113  Guard G(mutex);
114  return chan ? chan->getRequesterName() : "<dead>";
115  }
pva::Channel::shared_pointer chan
virtual void epics::pvAccess::Monitor::Impl::monitorConnect ( pvd::Status const &  status,
pva::MonitorPtr const &  monitor,
pvd::StructureConstPtr const &  structure 
)
inlinevirtual

Underlying Channel is connected and operation setup is complete. Call start() to begin subscription updates.

Parameters
statusCompletion status.
monitorThe monitor
structureThe structure defining the data.

Implements epics::pvAccess::MonitorRequester.

Definition at line 118 of file clientMonitor.cpp.

121  {
122  std::tr1::shared_ptr<Monitor::Impl> keepalive(internal_shared_from_this());
123  CallbackGuard G(*this);
124  if(!cb || started || done) return;
125 
126  if(!status.isOK()) {
127  event.message = status.getMessage();
128  } else {
129  event.message.clear();
130  }
131  if(!status.isSuccess()) {
132  callEvent(G);
133 
134  } else {
135  pvd::Status sts(operation->start());
136  if(sts.isSuccess()) {
137  started = true;
138  /* storing raw pointer to operation, which is expected
139  * to outlive our 'op'.
140  */
141  last.attach(operation);
142  } else {
143  event.message = sts.getMessage();
144  callEvent(G);
145  }
146  }
147  }
pvd::Status status
ClientChannel::MonitorCallback * cb
const std::string & getMessage() const
Definition: status.h:80
const std::tr1::weak_ptr< Process2PutProxy > operation
Definition: pvAccess.cpp:69
std::tr1::shared_ptr< Monitor::Impl > internal_shared_from_this()
Definition: clientpvt.h:44
pva::MonitorElement::Ref last
bool isSuccess() const
Definition: status.h:103
void callEvent(CallbackGuard &G, MonitorEvent::event_t evt=MonitorEvent::Fail)
bool isOK() const
Definition: status.h:95
virtual void epics::pvAccess::Monitor::Impl::monitorEvent ( pva::MonitorPtr const &  monitor)
inlinevirtual

Monitor queue is not empty.

The requester must call Monitor.poll to get data.

Parameters
monitorThe monitor.

Implements epics::pvAccess::MonitorRequester.

Definition at line 160 of file clientMonitor.cpp.

161  {
162  std::tr1::shared_ptr<Monitor::Impl> keepalive(internal_shared_from_this());
163  CallbackGuard G(*this);
164  if(!cb || done) return;
165  event.message.clear();
166 
168  }
ClientChannel::MonitorCallback * cb
std::tr1::shared_ptr< Monitor::Impl > internal_shared_from_this()
Definition: clientpvt.h:44
void callEvent(CallbackGuard &G, MonitorEvent::event_t evt=MonitorEvent::Fail)
Data queue not empty. Call Monitor::poll()
Definition: client.h:190
virtual void epics::pvAccess::Monitor::Impl::unlisten ( pva::MonitorPtr const &  monitor)
inlinevirtual

No more subscription update will be sent.

Parameters
monitorThe monitor.

Implements epics::pvAccess::MonitorRequester.

Definition at line 170 of file clientMonitor.cpp.

171  {
172  std::tr1::shared_ptr<Monitor::Impl> keepalive(internal_shared_from_this());
173  CallbackGuard G(*this);
174  if(!cb || done) return;
175  done = true;
176 
177  if(seenEmpty)
179  // else // wait until final poll()
180  }
ClientChannel::MonitorCallback * cb
std::tr1::shared_ptr< Monitor::Impl > internal_shared_from_this()
Definition: clientpvt.h:44
void callEvent(CallbackGuard &G, MonitorEvent::event_t evt=MonitorEvent::Fail)
Data queue not empty. Call Monitor::poll()
Definition: client.h:190

Member Data Documentation

ClientChannel::MonitorCallback* epics::pvAccess::Monitor::Impl::cb

Definition at line 33 of file clientMonitor.cpp.

pva::Channel::shared_pointer epics::pvAccess::Monitor::Impl::chan

Definition at line 29 of file clientMonitor.cpp.

bool epics::pvAccess::Monitor::Impl::done

Definition at line 31 of file clientMonitor.cpp.

MonitorEvent epics::pvAccess::Monitor::Impl::event

Definition at line 34 of file clientMonitor.cpp.

pva::MonitorElement::Ref epics::pvAccess::Monitor::Impl::last

Definition at line 36 of file clientMonitor.cpp.

size_t epics::pvAccess::Monitor::Impl::num_instances
static

Definition at line 38 of file clientMonitor.cpp.

operation_type::shared_pointer epics::pvAccess::Monitor::Impl::op

Definition at line 30 of file clientMonitor.cpp.

bool epics::pvAccess::Monitor::Impl::seenEmpty

Definition at line 31 of file clientMonitor.cpp.

bool epics::pvAccess::Monitor::Impl::started

Definition at line 31 of file clientMonitor.cpp.


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