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

An easy to use alternative to ChannelPutGet. More...

#include "pvaClient.h"

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

Public Member Functions

 POINTER_DEFINITIONS (PvaClientPutGet)
 
 ~PvaClientPutGet ()
 Destructor. More...
 
void setRequester (PvaClientPutGetRequesterPtr const &pvaClientPutGetRequester)
 Set a user callback. More...
 
void connect ()
 Call issueConnect and then waitConnect. More...
 
void issueConnect ()
 Issue the channelPutGet connection to the channel. More...
 
epics::pvData::Status waitConnect ()
 Wait until the channelPutGet connection to the channel is complete. More...
 
void putGet ()
 Call issuePutGet and then waitPutGet. More...
 
void issuePutGet ()
 Issue a putGet and return immediately. More...
 
epics::pvData::Status waitPutGet ()
 Wait until putGet completes. More...
 
void getGet ()
 Call issueGet and then waitGetGet. An exception is thrown if get fails. More...
 
void issueGetGet ()
 Issue a getGet and return immediately. More...
 
epics::pvData::Status waitGetGet ()
 Wait until getGet completes. More...
 
void getPut ()
 Call issuePut and then waitGetPut. More...
 
void issueGetPut ()
 Issue a getPut and return immediately. More...
 
epics::pvData::Status waitGetPut ()
 Wait until getPut completes. More...
 
PvaClientPutDataPtr getPutData ()
 Get the put data. More...
 
PvaClientGetDataPtr getGetData ()
 Get the get data. More...
 
PvaClientChannelPtr getPvaClientChannel ()
 Get the PvaClientChannel;. More...
 

Static Public Member Functions

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

Friends

class ChannelPutGetRequesterImpl
 

Detailed Description

An easy to use alternative to ChannelPutGet.

Overview of PvaClientPutGet

Definition at line 1369 of file pvaClient.h.

Constructor & Destructor Documentation

epics::pvaClient::PvaClientPutGet::~PvaClientPutGet ( )

Destructor.

Definition at line 124 of file pvaClientPutGet.cpp.

125 {
126  if(PvaClient::getDebug()) {
127  cout<< "PvaClientPutGet::~PvaClientPutGet"
128  << " channelName " << pvaClientChannel->getChannel()->getChannelName()
129  << endl;
130  }
131 }
static bool getDebug()
Is debug set?
Definition: pvaClient.cpp:97

Member Function Documentation

void epics::pvaClient::PvaClientPutGet::connect ( )

Call issueConnect and then waitConnect.

An exception is thrown if connect fails.

Exceptions
runtime_errorif failure.

Definition at line 290 of file pvaClientPutGet.cpp.

291 {
292  if(PvaClient::getDebug()) {
293  cout << "PvaClientPutGet::connect"
294  << " channelName " << pvaClientChannel->getChannel()->getChannelName()
295  << endl;
296  }
297  issueConnect();
299  if(status.isOK()) return;
300  string message = string("channel ")
301  + pvaClientChannel->getChannel()->getChannelName()
302  + " PvaClientPutGet::connect "
303  + status.getMessage();
304  throw std::runtime_error(message);
305 }
pvd::Status status
void issueConnect()
Issue the channelPutGet connection to the channel.
const std::string & getMessage() const
Definition: status.h:80
epics::pvData::Status waitConnect()
Wait until the channelPutGet connection to the channel is complete.
bool isOK() const
Definition: status.h:95
static bool getDebug()
Is debug set?
Definition: pvaClient.cpp:97
PvaClientPutGetPtr epics::pvaClient::PvaClientPutGet::create ( PvaClientPtr const &  pvaClient,
PvaClientChannelPtr const &  pvaClientChannel,
epics::pvData::PVStructurePtr const &  pvRequest 
)
static

Create a PvaClientPutGet.

Parameters
pvaClientInterface to PvaClient
pvaClientChannelInterface to Channel
pvRequestThe request structure.
Returns
The interface to the PvaClientPutGet.

Definition at line 96 of file pvaClientPutGet.cpp.

100 {
101  PvaClientPutGetPtr clientPutGet(new PvaClientPutGet(pvaClient,pvaClientChannel,pvRequest));
102  clientPutGet->channelPutGetRequester = ChannelPutGetRequesterImplPtr(
103  new ChannelPutGetRequesterImpl(clientPutGet,pvaClient));
104  return clientPutGet;
105 }
std::tr1::shared_ptr< PvaClientPutGet > PvaClientPutGetPtr
Definition: pvaClient.h:81
std::tr1::shared_ptr< ChannelPutGetRequesterImpl > ChannelPutGetRequesterImplPtr
Definition: pvaClient.h:1309
void epics::pvaClient::PvaClientPutGet::getGet ( )

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

Definition at line 406 of file pvaClientPutGet.cpp.

407 {
408  if(PvaClient::getDebug()) {
409  cout << "PvaClientPutGet::getGet"
410  << " channelName " << pvaClientChannel->getChannel()->getChannelName()
411  << endl;
412  }
413  issueGetGet();
415  if(status.isOK()) return;
416  string message = string("channel ")
417  + pvaClientChannel->getChannel()->getChannelName()
418  + " PvaClientPut::getGet "
419  + status.getMessage();
420  throw std::runtime_error(message);
421 }
pvd::Status status
void issueGetGet()
Issue a getGet and return immediately.
const std::string & getMessage() const
Definition: status.h:80
epics::pvData::Status waitGetGet()
Wait until getGet completes.
bool isOK() const
Definition: status.h:95
static bool getDebug()
Is debug set?
Definition: pvaClient.cpp:97
PvaClientGetDataPtr epics::pvaClient::PvaClientPutGet::getGetData ( )

Get the get data.

Returns
The interface.

Definition at line 512 of file pvaClientPutGet.cpp.

513 {
514  if(PvaClient::getDebug()) {
515  cout<< "PvaClientPutGet::getGetData"
516  << " channelName " << pvaClientChannel->getChannel()->getChannelName()
517  << endl;
518  }
519  checkPutGetState();
520  if(putGetState==putGetIdle){
521  getGet();
522  getPut();
523  }
524  return pvaClientGetData;
525 }
void getGet()
Call issueGet and then waitGetGet. An exception is thrown if get fails.
void getPut()
Call issuePut and then waitGetPut.
static bool getDebug()
Is debug set?
Definition: pvaClient.cpp:97
void epics::pvaClient::PvaClientPutGet::getPut ( )

Call issuePut and then waitGetPut.

An exception is thrown if getPut fails.

Definition at line 459 of file pvaClientPutGet.cpp.

460 {
461  if(PvaClient::getDebug()) {
462  cout << "PvaClientPutGet::getGetPut"
463  << " channelName " << pvaClientChannel->getChannel()->getChannelName()
464  << endl;
465  }
466  issueGetPut();
468  if(status.isOK()) return;
469  string message = string("channel ")
470  + pvaClientChannel->getChannel()->getChannelName()
471  + " PvaClientPut::getPut "
472  + status.getMessage();
473  throw std::runtime_error(message);
474 }
pvd::Status status
const std::string & getMessage() const
Definition: status.h:80
epics::pvData::Status waitGetPut()
Wait until getPut completes.
bool isOK() const
Definition: status.h:95
void issueGetPut()
Issue a getPut and return immediately.
static bool getDebug()
Is debug set?
Definition: pvaClient.cpp:97
PvaClientPutDataPtr epics::pvaClient::PvaClientPutGet::getPutData ( )

Get the put data.

Returns
The interface.

Definition at line 527 of file pvaClientPutGet.cpp.

528 {
529  if(PvaClient::getDebug()) {
530  cout<< "PvaClientPutGet::getPutData"
531  << " channelName " << pvaClientChannel->getChannel()->getChannelName()
532  << endl;
533  }
534  checkPutGetState();
535  if(putGetState==putGetIdle){
536  getGet();
537  getPut();
538  }
539  return pvaClientPutData;
540 }
void getGet()
Call issueGet and then waitGetGet. An exception is thrown if get fails.
void getPut()
Call issuePut and then waitGetPut.
static bool getDebug()
Is debug set?
Definition: pvaClient.cpp:97
PvaClientChannelPtr epics::pvaClient::PvaClientPutGet::getPvaClientChannel ( )

Get the PvaClientChannel;.

Returns
The interface.

Definition at line 553 of file pvaClientPutGet.cpp.

554 {
555  return pvaClientChannel;
556 }
void epics::pvaClient::PvaClientPutGet::issueConnect ( )

Issue the channelPutGet connection to the channel.

This can only be called once. An exception is thrown if connect fails.

Definition at line 307 of file pvaClientPutGet.cpp.

308 {
309  if(PvaClient::getDebug()) {
310  cout << "PvaClientPutGet::issueConnect"
311  << " channelName " << pvaClientChannel->getChannel()->getChannelName()
312  << endl;
313  }
314  if(connectState!=connectIdle) {
315  string message = string("channel ")
316  + pvaClientChannel->getChannel()->getChannelName()
317  + " pvaClientPutGet already connected ";
318  throw std::runtime_error(message);
319  }
320  connectState = connectActive;
321  channelPutGetConnectStatus = Status(Status::STATUSTYPE_ERROR, "connect active");
322  channelPutGet = pvaClientChannel->getChannel()->createChannelPutGet(channelPutGetRequester,pvRequest);
323 }
static bool getDebug()
Is debug set?
Definition: pvaClient.cpp:97
void epics::pvaClient::PvaClientPutGet::issueGetGet ( )

Issue a getGet and return immediately.

Definition at line 423 of file pvaClientPutGet.cpp.

424 {
425  if(PvaClient::getDebug()) {
426  cout << "PvaClientPutGet::issueGetGet"
427  << " channelName " << pvaClientChannel->getChannel()->getChannelName()
428  << endl;
429  }
430  if(connectState==connectIdle) connect();
431  if(putGetState==putGetActive) {
432  string message = string("channel ")
433  + pvaClientChannel->getChannel()->getChannelName()
434  + " PvaClientPutGet::issueGetGet get or put aleady active ";
435  throw std::runtime_error(message);
436  }
437  putGetState = putGetActive;
438  channelPutGet->getGet();
439 }
void connect()
Call issueConnect and then waitConnect.
static bool getDebug()
Is debug set?
Definition: pvaClient.cpp:97
void epics::pvaClient::PvaClientPutGet::issueGetPut ( )

Issue a getPut and return immediately.

Definition at line 476 of file pvaClientPutGet.cpp.

477 {
478  if(PvaClient::getDebug()) {
479  cout << "PvaClientPutGet::issueGetPut"
480  << " channelName " << pvaClientChannel->getChannel()->getChannelName()
481  << endl;
482  }
483  if(connectState==connectIdle) connect();
484  if(putGetState==putGetActive) {
485  string message = string("channel ")
486  + pvaClientChannel->getChannel()->getChannelName()
487  + " PvaClientPutGet::issueGetPut get or put aleady active ";
488  throw std::runtime_error(message);
489  }
490  putGetState = putGetActive;
491  channelPutGet->getPut();
492 }
void connect()
Call issueConnect and then waitConnect.
static bool getDebug()
Is debug set?
Definition: pvaClient.cpp:97
void epics::pvaClient::PvaClientPutGet::issuePutGet ( )

Issue a putGet and return immediately.

Definition at line 368 of file pvaClientPutGet.cpp.

369 {
370  if(PvaClient::getDebug()) {
371  cout << "PvaClientPutGet::issuePutGet"
372  << " channelName " << pvaClientChannel->getChannel()->getChannelName()
373  << endl;
374  }
375  if(connectState==connectIdle) connect();
376  if(putGetState==putGetActive) {
377  string message = string("channel ")
378  + pvaClientChannel->getChannel()->getChannelName()
379  + " PvaClientPutGet::issuePutGet get or put aleady active ";
380  throw std::runtime_error(message);
381  }
382  putGetState = putGetActive;
383  channelPutGet->putGet(pvaClientPutData->getPVStructure(),pvaClientPutData->getChangedBitSet());
384 }
void connect()
Call issueConnect and then waitConnect.
static bool getDebug()
Is debug set?
Definition: pvaClient.cpp:97
epics::pvaClient::PvaClientPutGet::POINTER_DEFINITIONS ( PvaClientPutGet  )
void epics::pvaClient::PvaClientPutGet::putGet ( )

Call issuePutGet and then waitPutGet.

An exception is thrown if putGet fails.

Definition at line 351 of file pvaClientPutGet.cpp.

352 {
353  if(PvaClient::getDebug()) {
354  cout << "PvaClientPutGet::putGet"
355  << " channelName " << pvaClientChannel->getChannel()->getChannelName()
356  << endl;
357  }
358  issuePutGet();
360  if(status.isOK()) return;
361  string message = string("channel ")
362  + pvaClientChannel->getChannel()->getChannelName()
363  + " PvaClientPut::putGet "
364  + status.getMessage();
365  throw std::runtime_error(message);
366 }
pvd::Status status
epics::pvData::Status waitPutGet()
Wait until putGet completes.
const std::string & getMessage() const
Definition: status.h:80
void issuePutGet()
Issue a putGet and return immediately.
bool isOK() const
Definition: status.h:95
static bool getDebug()
Is debug set?
Definition: pvaClient.cpp:97
void epics::pvaClient::PvaClientPutGet::setRequester ( PvaClientPutGetRequesterPtr const &  pvaClientPutGetRequester)

Set a user callback.

Parameters
pvaClientPutGetRequesterThe requester which must be implemented by the caller.

Definition at line 542 of file pvaClientPutGet.cpp.

543 {
544  if(PvaClient::getDebug()) {
545  cout << "PvaClientPutGet::setRequester"
546  << " channelName " << pvaClientChannel->getChannel()->getChannelName()
547  << endl;
548  }
549  this->pvaClientPutGetRequester = pvaClientPutGetRequester;
550 }
static bool getDebug()
Is debug set?
Definition: pvaClient.cpp:97
Status epics::pvaClient::PvaClientPutGet::waitConnect ( )

Wait until the channelPutGet connection to the channel is complete.

Returns
status;

Definition at line 325 of file pvaClientPutGet.cpp.

326 {
327  if(PvaClient::getDebug()) {
328  cout << "PvaClientPutGet::waitConnect"
329  << " channelName " << pvaClientChannel->getChannel()->getChannelName()
330  << endl;
331  }
332  {
333  Lock xx(mutex);
334  if(connectState==connected) {
335  if(!channelPutGetConnectStatus.isOK()) connectState = connectIdle;
336  return channelPutGetConnectStatus;
337  }
338  if(connectState!=connectActive) {
339  string message = string("channel ")
340  + pvaClientChannel->getChannel()->getChannelName()
341  + " PvaClientPutGet::waitConnect illegal connect state ";
342  throw std::runtime_error(message);
343  }
344  }
345  waitForConnect.wait();
346  if(!channelPutGetConnectStatus.isOK()) connectState = connectIdle;
347  return channelPutGetConnectStatus;
348 }
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::PvaClientPutGet::waitGetGet ( )

Wait until getGet completes.

If failure getStatus can be called to get reason.

Returns
status

Definition at line 441 of file pvaClientPutGet.cpp.

442 {
443  if(PvaClient::getDebug()) {
444  cout << "PvaClientPutGet::waitGetGet"
445  << " channelName " << pvaClientChannel->getChannel()->getChannelName()
446  << endl;
447  }
448  if(putGetState==putGetComplete) return channelPutGetStatus;
449  if(putGetState!=putGetActive){
450  string message = string("channel ")
451  + pvaClientChannel->getChannel()->getChannelName()
452  + " PvaClientPutGet::waitGetGet get or put aleady active ";
453  throw std::runtime_error(message);
454  }
455  waitForPutGet.wait();
456  return channelPutGetStatus;
457 }
static bool getDebug()
Is debug set?
Definition: pvaClient.cpp:97
Status epics::pvaClient::PvaClientPutGet::waitGetPut ( )

Wait until getPut completes.

Returns
status

Definition at line 494 of file pvaClientPutGet.cpp.

495 {
496  if(PvaClient::getDebug()) {
497  cout << "PvaClientPutGet::waitGetPut"
498  << " channelName " << pvaClientChannel->getChannel()->getChannelName()
499  << endl;
500  }
501  if(putGetState==putGetComplete) return channelPutGetStatus;
502  if(putGetState!=putGetActive){
503  string message = string("channel ")
504  + pvaClientChannel->getChannel()->getChannelName()
505  + " PvaClientPutGet::waitGetPut get or put aleady active ";
506  throw std::runtime_error(message);
507  }
508  waitForPutGet.wait();
509  return channelPutGetStatus;
510 }
static bool getDebug()
Is debug set?
Definition: pvaClient.cpp:97
Status epics::pvaClient::PvaClientPutGet::waitPutGet ( )

Wait until putGet completes.

If failure getStatus can be called to get reason.

Returns
status

Definition at line 387 of file pvaClientPutGet.cpp.

388 {
389  if(PvaClient::getDebug()) {
390  cout << "PvaClientPutGet::waitPutGet"
391  << " channelName " << pvaClientChannel->getChannel()->getChannelName()
392  << endl;
393  }
394  if(putGetState==putGetComplete) return channelPutGetStatus;
395  if(putGetState!=putGetActive){
396  string message = string("channel ")
397  + pvaClientChannel->getChannel()->getChannelName()
398  + " PvaClientPutGet::waitPutGet get or put aleady active ";
399  throw std::runtime_error(message);
400  }
401  waitForPutGet.wait();
402  if(channelPutGetStatus.isOK()) pvaClientPutData->getChangedBitSet()->clear();
403  return channelPutGetStatus;
404 }
bool isOK() const
Definition: status.h:95
static bool getDebug()
Is debug set?
Definition: pvaClient.cpp:97

Friends And Related Function Documentation

friend class ChannelPutGetRequesterImpl
friend

Definition at line 1511 of file pvaClient.h.


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