This is Unofficial EPICS BASE Doxygen Site
epics::pvaClient::PvaClientGet Class Reference

An easy to use alternative to ChannelGet. More...

#include "pvaClient.h"

+ Inheritance diagram for epics::pvaClient::PvaClientGet:
+ Collaboration diagram for epics::pvaClient::PvaClientGet:

Public Member Functions

 POINTER_DEFINITIONS (PvaClientGet)
 
 ~PvaClientGet ()
 Destructor. More...
 
void setRequester (PvaClientGetRequesterPtr const &pvaClientGetRequester)
 Set a user callback. More...
 
void connect ()
 Call issueConnect and then waitConnect. More...
 
void issueConnect ()
 create the channelGet connection to the channel. More...
 
epics::pvData::Status waitConnect ()
 Wait until the channelGet connection to the channel is complete. More...
 
void get ()
 Call issueGet and then waitGet. An exception is thrown if get fails. More...
 
void issueGet ()
 Issue a get and return immediately. More...
 
epics::pvData::Status waitGet ()
 Wait until get completes. More...
 
PvaClientGetDataPtr getData ()
 Get the data/. More...
 
PvaClientChannelPtr getPvaClientChannel ()
 Get the PvaClientChannel;. More...
 

Static Public Member Functions

static PvaClientGetPtr create (PvaClientPtr const &pvaClient, PvaClientChannelPtr const &pvaClientChannel, epics::pvData::PVStructurePtr const &pvRequest)
 Create a PvaClientGet. More...
 

Friends

class ChannelGetRequesterImpl
 

Detailed Description

An easy to use alternative to ChannelGet.

Overview of PvaClientGet

Definition at line 1035 of file pvaClient.h.

Constructor & Destructor Documentation

epics::pvaClient::PvaClientGet::~PvaClientGet ( )

Destructor.

Definition at line 106 of file pvaClientGet.cpp.

107 {
108  if(PvaClient::getDebug()) {
109  cout<< "PvaClientGet::~PvaClientGet channelName "
110  << pvaClientChannel->getChannel()->getChannelName() << "\n";
111  }
112 }
static bool getDebug()
Is debug set?
Definition: pvaClient.cpp:97

Member Function Documentation

void epics::pvaClient::PvaClientGet::connect ( )

Call issueConnect and then waitConnect.

An exception is thrown if connect fails.

Exceptions
runtime_errorif failure.

Definition at line 215 of file pvaClientGet.cpp.

216 {
217  if(PvaClient::getDebug()) {
218  cout << "PvaClientGet::connect channelName "
219  << pvaClientChannel->getChannel()->getChannelName() << "\n";
220  }
221  issueConnect();
223  if(status.isOK()) return;
224  string message = string("channel ") + pvaClientChannel->getChannel()->getChannelName()
225  + " PvaClientGet::connect " + status.getMessage();
226  throw std::runtime_error(message);
227 }
pvd::Status status
const std::string & getMessage() const
Definition: status.h:80
void issueConnect()
create the channelGet connection to the channel.
epics::pvData::Status waitConnect()
Wait until the channelGet connection to the channel is complete.
bool isOK() const
Definition: status.h:95
static bool getDebug()
Is debug set?
Definition: pvaClient.cpp:97
PvaClientGetPtr epics::pvaClient::PvaClientGet::create ( PvaClientPtr const &  pvaClient,
PvaClientChannelPtr const &  pvaClientChannel,
epics::pvData::PVStructurePtr const &  pvRequest 
)
static

Create a PvaClientGet.

Parameters
pvaClientInterface to PvaClient
pvaClientChannelInterface to PvaClientChannel
pvRequestThe request structure.
Returns
The interface to the PvaClientGet.

Definition at line 73 of file pvaClientGet.cpp.

77 {
78  if(PvaClient::getDebug()) {
79  cout<< "PvaClientGet::create(pvaClient,channelName,pvRequest)\n"
80  << " channelName " << pvaClientChannel->getChannel()->getChannelName()
81  << " pvRequest " << pvRequest
82  << endl;
83  }
84  PvaClientGetPtr clientGet(new PvaClientGet(pvaClient,pvaClientChannel,pvRequest));
85  clientGet->channelGetRequester = ChannelGetRequesterImplPtr(
86  new ChannelGetRequesterImpl(clientGet,pvaClient));
87  return clientGet;
88 }
std::tr1::shared_ptr< ChannelGetRequesterImpl > ChannelGetRequesterImplPtr
Definition: pvaClient.h:998
friend class ChannelGetRequesterImpl
Definition: pvaClient.h:1137
std::tr1::shared_ptr< PvaClientGet > PvaClientGetPtr
Definition: pvaClient.h:71
static bool getDebug()
Is debug set?
Definition: pvaClient.cpp:97
void epics::pvaClient::PvaClientGet::get ( )

Call issueGet and then waitGet. An exception is thrown if get fails.

Definition at line 268 of file pvaClientGet.cpp.

269 {
270  if(PvaClient::getDebug()) {
271  cout << "PvaClientGet::get channelName "
272  << pvaClientChannel->getChannel()->getChannelName() << "\n";
273  }
274  issueGet();
275  Status status = waitGet();
276  if(status.isOK()) return;
277  string message = string("channel ") + pvaClientChannel->getChannel()->getChannelName()
278  + " PvaClientGet::get " + status.getMessage();
279  throw std::runtime_error(message);
280 }
pvd::Status status
const std::string & getMessage() const
Definition: status.h:80
epics::pvData::Status waitGet()
Wait until get completes.
void issueGet()
Issue a get and return immediately.
bool isOK() const
Definition: status.h:95
static bool getDebug()
Is debug set?
Definition: pvaClient.cpp:97
PvaClientGetDataPtr epics::pvaClient::PvaClientGet::getData ( )

Get the data/.

Returns
The interface.

Definition at line 320 of file pvaClientGet.cpp.

321 {
322  if(PvaClient::getDebug()) {
323  cout<< "PvaClientGet::getData channelName "
324  << pvaClientChannel->getChannel()->getChannelName() << "\n";
325  }
326  checkConnectState();
327  if(getState==getIdle) get();
328  return pvaClientData;
329 }
static bool getDebug()
Is debug set?
Definition: pvaClient.cpp:97
PvaClientChannelPtr epics::pvaClient::PvaClientGet::getPvaClientChannel ( )

Get the PvaClientChannel;.

Returns
The interface.

Definition at line 340 of file pvaClientGet.cpp.

341 {
342  return pvaClientChannel;
343 }
void epics::pvaClient::PvaClientGet::issueConnect ( )

create the channelGet connection to the channel.

This can only be called once.

Definition at line 229 of file pvaClientGet.cpp.

230 {
231  if(PvaClient::getDebug()) {
232  cout << "PvaClientGet::issueConnect channelName "
233  << pvaClientChannel->getChannel()->getChannelName() << "\n";
234  }
235  if(connectState!=connectIdle) {
236  string message = string("channel ") + pvaClientChannel->getChannel()->getChannelName()
237  + " pvaClientGet already connected ";
238  throw std::runtime_error(message);
239  }
240  connectState = connectActive;
241  channelGetConnectStatus = Status(Status::STATUSTYPE_ERROR, "connect active");
242  channelGet = pvaClientChannel->getChannel()->createChannelGet(channelGetRequester,pvRequest);
243 }
static bool getDebug()
Is debug set?
Definition: pvaClient.cpp:97
void epics::pvaClient::PvaClientGet::issueGet ( )

Issue a get and return immediately.

Definition at line 282 of file pvaClientGet.cpp.

283 {
284  if(PvaClient::getDebug()) {
285  cout << "PvaClientGet::issueGet channelName "
286  << pvaClientChannel->getChannel()->getChannelName() << "\n";
287  }
288  if(connectState==connectIdle) connect();
289  if(getState==getActive) {
290  string message = string("channel ") + pvaClientChannel->getChannel()->getChannelName()
291  + " PvaClientGet::issueGet get aleady active ";
292  throw std::runtime_error(message);
293  }
294  getState = getActive;
295  channelGet->get();
296 }
void connect()
Call issueConnect and then waitConnect.
static bool getDebug()
Is debug set?
Definition: pvaClient.cpp:97
epics::pvaClient::PvaClientGet::POINTER_DEFINITIONS ( PvaClientGet  )
void epics::pvaClient::PvaClientGet::setRequester ( PvaClientGetRequesterPtr const &  pvaClientGetRequester)

Set a user callback.

Parameters
pvaClientGetRequesterThe requester which must be implemented by the caller.

Definition at line 331 of file pvaClientGet.cpp.

332 {
333  if(PvaClient::getDebug()) {
334  cout << "PvaClientGet::setRequester channelName "
335  << pvaClientChannel->getChannel()->getChannelName() << "\n";
336  }
337  this->pvaClientGetRequester = pvaClientGetRequester;
338 }
static bool getDebug()
Is debug set?
Definition: pvaClient.cpp:97
Status epics::pvaClient::PvaClientGet::waitConnect ( )

Wait until the channelGet connection to the channel is complete.

Returns
status;

Definition at line 245 of file pvaClientGet.cpp.

246 {
247  if(PvaClient::getDebug()) {
248  cout << "PvaClientGet::waitConnect channelName "
249  << pvaClientChannel->getChannel()->getChannelName() << "\n";
250  }
251  {
252  Lock xx(mutex);
253  if(connectState==connected) {
254  if(!channelGetConnectStatus.isOK()) connectState = connectIdle;
255  return channelGetConnectStatus;
256  }
257  if(connectState!=connectActive) {
258  string message = string("channel ") + pvaClientChannel->getChannel()->getChannelName()
259  + " PvaClientGet::waitConnect illegal connect state ";
260  throw std::runtime_error(message);
261  }
262  }
263  waitForConnect.wait();
264  if(!channelGetConnectStatus.isOK()) connectState = connectIdle;
265  return channelGetConnectStatus;
266 }
A lock for multithreading.
Definition: lock.h:36
bool isOK() const
Definition: status.h:95
static bool getDebug()
Is debug set?
Definition: pvaClient.cpp:97
Status epics::pvaClient::PvaClientGet::waitGet ( )

Wait until get completes.

Returns
status;

Definition at line 298 of file pvaClientGet.cpp.

299 {
300  if(PvaClient::getDebug()) {
301  cout << "PvaClientGet::waitGet channelName "
302  << pvaClientChannel->getChannel()->getChannelName() << "\n";
303  }
304  {
305  Lock xx(mutex);
306  if(getState==getComplete) {
307  getState = getIdle;
308  return channelGetStatus;
309  }
310  if(getState!=getActive){
311  string message = string("channel ") + pvaClientChannel->getChannel()->getChannelName()
312  + " PvaClientGet::waitGet llegal get state";
313  throw std::runtime_error(message);
314  }
315  }
316  waitForGet.wait();
317  getState = getComplete;
318  return channelGetStatus;
319 }
A lock for multithreading.
Definition: lock.h:36
static bool getDebug()
Is debug set?
Definition: pvaClient.cpp:97

Friends And Related Function Documentation

friend class ChannelGetRequesterImpl
friend

Definition at line 1137 of file pvaClient.h.


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