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

An easy to use alternative to ChannelPut. More...

#include "pvaClient.h"

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

Public Member Functions

 POINTER_DEFINITIONS (PvaClientPut)
 
 ~PvaClientPut ()
 Destructor. More...
 
void setRequester (PvaClientPutRequesterPtr const &pvaClientPutRequester)
 Set a user callback. More...
 
void connect ()
 Call issueConnect and then waitConnect. More...
 
void issueConnect ()
 Issue the channelPut connection to the channel. More...
 
epics::pvData::Status waitConnect ()
 Wait until the channelPut connection to the channel is complete. More...
 
void get ()
 Call issueGet and then waitGet. More...
 
void issueGet ()
 Issue a get and return immediately. More...
 
epics::pvData::Status waitGet ()
 Wait until get completes. More...
 
void put ()
 Call issuePut and then waitPut. An exception is thrown if get fails. More...
 
void issuePut ()
 Issue a put and return immediately. More...
 
epics::pvData::Status waitPut ()
 Wait until put completes. More...
 
PvaClientPutDataPtr getData ()
 Get the data/. More...
 
PvaClientChannelPtr getPvaClientChannel ()
 Get the PvaClientChannel;. More...
 

Static Public Member Functions

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

Friends

class ChannelPutRequesterImpl
 

Detailed Description

An easy to use alternative to ChannelPut.

Overview of PvaClientPut

Definition at line 1191 of file pvaClient.h.

Constructor & Destructor Documentation

epics::pvaClient::PvaClientPut::~PvaClientPut ( )

Destructor.

Definition at line 111 of file pvaClientPut.cpp.

112 {
113  if(PvaClient::getDebug()) {
114  cout<< "PvaClientPut::~PvaClientPut"
115  << " channelName " << pvaClientChannel->getChannel()->getChannelName()
116  << endl;
117  }
118 }
static bool getDebug()
Is debug set?
Definition: pvaClient.cpp:97

Member Function Documentation

void epics::pvaClient::PvaClientPut::connect ( )

Call issueConnect and then waitConnect.

An exception is thrown if connect fails.

Exceptions
runtime_errorif failure.

Definition at line 242 of file pvaClientPut.cpp.

243 {
244  if(PvaClient::getDebug()) {
245  cout << "PvaClientPut::connect"
246  << " channelName " << pvaClientChannel->getChannel()->getChannelName()
247  << endl;
248  }
249  issueConnect();
251  if(status.isOK()) return;
252  string message = string("channel ")
253  + pvaClientChannel->getChannel()->getChannelName()
254  + " PvaClientPut::connect "
255  + status.getMessage();
256  throw std::runtime_error(message);
257 }
pvd::Status status
const std::string & getMessage() const
Definition: status.h:80
void issueConnect()
Issue the channelPut connection to the channel.
epics::pvData::Status waitConnect()
Wait until the channelPut connection to the channel is complete.
bool isOK() const
Definition: status.h:95
static bool getDebug()
Is debug set?
Definition: pvaClient.cpp:97
PvaClientPutPtr epics::pvaClient::PvaClientPut::create ( PvaClientPtr const &  pvaClient,
PvaClientChannelPtr const &  pvaClientChannel,
epics::pvData::PVStructurePtr const &  pvRequest 
)
static

Create a PvaClientPut.

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

Definition at line 82 of file pvaClientPut.cpp.

86 {
87  PvaClientPutPtr clientPut(new PvaClientPut(pvaClient,pvaClientChannel,pvRequest));
88  clientPut->channelPutRequester = ChannelPutRequesterImplPtr(
89  new ChannelPutRequesterImpl(clientPut,pvaClient));
90  return clientPut;
91 }
friend class ChannelPutRequesterImpl
Definition: pvaClient.h:1304
std::tr1::shared_ptr< PvaClientPut > PvaClientPutPtr
Definition: pvaClient.h:76
std::tr1::shared_ptr< ChannelPutRequesterImpl > ChannelPutRequesterImplPtr
Definition: pvaClient.h:1143
void epics::pvaClient::PvaClientPut::get ( )

Call issueGet and then waitGet.

An exception is thrown if get fails.

Exceptions
runtime_errorif failure.

Definition at line 301 of file pvaClientPut.cpp.

302 {
303  if(PvaClient::getDebug()) {
304  cout << "PvaClientPut::get"
305  << " channelName " << pvaClientChannel->getChannel()->getChannelName()
306  << endl;
307  }
308  issueGet();
309  Status status = waitGet();
310  if(status.isOK()) return;
311  string message = string("channel ")
312  + pvaClientChannel->getChannel()->getChannelName()
313  + " PvaClientPut::get "
314  + status.getMessage();
315  throw std::runtime_error(message);
316 }
pvd::Status status
epics::pvData::Status waitGet()
Wait until get completes.
const std::string & getMessage() const
Definition: status.h:80
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
PvaClientPutDataPtr epics::pvaClient::PvaClientPut::getData ( )

Get the data/.

Returns
The interface.

Definition at line 416 of file pvaClientPut.cpp.

417 {
418  if(PvaClient::getDebug()) {
419  cout<< "PvaClientPut::getData"
420  << " channelName " << pvaClientChannel->getChannel()->getChannelName()
421  << endl;
422  }
423  checkConnectState();
424  if(putState==putIdle) get();
425  return pvaClientData;
426 }
static bool getDebug()
Is debug set?
Definition: pvaClient.cpp:97
PvaClientChannelPtr epics::pvaClient::PvaClientPut::getPvaClientChannel ( )

Get the PvaClientChannel;.

Returns
The interface.

Definition at line 438 of file pvaClientPut.cpp.

439 {
440  return pvaClientChannel;
441 }
void epics::pvaClient::PvaClientPut::issueConnect ( )

Issue the channelPut connection to the channel.

This can only be called once.

Definition at line 259 of file pvaClientPut.cpp.

260 {
261  if(PvaClient::getDebug()) {
262  cout << "PvaClientPut::issueConnect"
263  << " channelName " << pvaClientChannel->getChannel()->getChannelName()
264  << endl;
265  }
266  if(connectState!=connectIdle) {
267  string message = string("channel ") + pvaClientChannel->getChannel()->getChannelName()
268  + " pvaClientPut already connected ";
269  throw std::runtime_error(message);
270  }
271  connectState = connectActive;
272  channelPutConnectStatus = Status(Status::STATUSTYPE_ERROR, "connect active");
273  channelPut = pvaClientChannel->getChannel()->createChannelPut(channelPutRequester,pvRequest);
274 
275 }
static bool getDebug()
Is debug set?
Definition: pvaClient.cpp:97
void epics::pvaClient::PvaClientPut::issueGet ( )

Issue a get and return immediately.

Definition at line 318 of file pvaClientPut.cpp.

319 {
320  if(PvaClient::getDebug()) {
321  cout << "PvaClientPut::issueGet"
322  << " channelName " << pvaClientChannel->getChannel()->getChannelName()
323  << endl;
324  }
325  if(connectState==connectIdle) connect();
326  if(putState==getActive || putState==putActive) {
327  string message = string("channel ")
328  + pvaClientChannel->getChannel()->getChannelName()
329  + "PvaClientPut::issueGet get or put aleady active ";
330  throw std::runtime_error(message);
331  }
332  putState = getActive;
333  channelPut->get();
334 }
void connect()
Call issueConnect and then waitConnect.
static bool getDebug()
Is debug set?
Definition: pvaClient.cpp:97
void epics::pvaClient::PvaClientPut::issuePut ( )

Issue a put and return immediately.

Definition at line 374 of file pvaClientPut.cpp.

375 {
376  if(PvaClient::getDebug()) {
377  cout << "PvaClientPut::issuePut"
378  << " channelName " << pvaClientChannel->getChannel()->getChannelName()
379  << " pvStructure\n" << pvaClientData->getPVStructure()
380  << " bitSet " << *pvaClientData->getChangedBitSet() << endl
381  << endl;
382  }
383  if(connectState==connectIdle) connect();
384  if(putState==getActive || putState==putActive) {
385  string message = string("channel ")
386  + pvaClientChannel->getChannel()->getChannelName()
387  + "PvaClientPut::issuePut get or put aleady active ";
388  throw std::runtime_error(message);
389  }
390  putState = putActive;
391  channelPut->put(pvaClientData->getPVStructure(),pvaClientData->getChangedBitSet());
392 }
void connect()
Call issueConnect and then waitConnect.
static bool getDebug()
Is debug set?
Definition: pvaClient.cpp:97
epics::pvaClient::PvaClientPut::POINTER_DEFINITIONS ( PvaClientPut  )
void epics::pvaClient::PvaClientPut::put ( )

Call issuePut and then waitPut. An exception is thrown if get fails.

Definition at line 357 of file pvaClientPut.cpp.

358 {
359  if(PvaClient::getDebug()) {
360  cout << "PvaClientPut::put"
361  << " channelName " << pvaClientChannel->getChannel()->getChannelName()
362  << endl;
363  }
364  issuePut();
365  Status status = waitPut();
366  if(status.isOK()) return;
367  string message = string("channel ")
368  + pvaClientChannel->getChannel()->getChannelName()
369  + " PvaClientPut::put "
370  + status.getMessage();
371  throw std::runtime_error(message);
372 }
pvd::Status status
const std::string & getMessage() const
Definition: status.h:80
void issuePut()
Issue a put and return immediately.
epics::pvData::Status waitPut()
Wait until put completes.
bool isOK() const
Definition: status.h:95
static bool getDebug()
Is debug set?
Definition: pvaClient.cpp:97
void epics::pvaClient::PvaClientPut::setRequester ( PvaClientPutRequesterPtr const &  pvaClientPutRequester)

Set a user callback.

Parameters
pvaClientPutRequesterThe requester which must be implemented by the caller.

Definition at line 428 of file pvaClientPut.cpp.

429 {
430  if(PvaClient::getDebug()) {
431  cout << "PvaClientPut::setRequester"
432  << " channelName " << pvaClientChannel->getChannel()->getChannelName()
433  << endl;
434  }
435  this->pvaClientPutRequester = pvaClientPutRequester;
436 }
static bool getDebug()
Is debug set?
Definition: pvaClient.cpp:97
Status epics::pvaClient::PvaClientPut::waitConnect ( )

Wait until the channelPut connection to the channel is complete.

Returns
status;

Definition at line 277 of file pvaClientPut.cpp.

278 {
279  if(PvaClient::getDebug()) {
280  cout << "PvaClientPut::waitConnect"
281  << " channelName " << pvaClientChannel->getChannel()->getChannelName()
282  << endl;
283  }
284  {
285  Lock xx(mutex);
286  if(connectState==connected) {
287  if(!channelPutConnectStatus.isOK()) connectState = connectIdle;
288  return channelPutConnectStatus;
289  }
290  if(connectState!=connectActive) {
291  string message = string("channel ") + pvaClientChannel->getChannel()->getChannelName()
292  + " PvaClientPut::waitConnect illegal connect state ";
293  throw std::runtime_error(message);
294  }
295  }
296  waitForConnect.wait();
297  if(!channelPutConnectStatus.isOK()) connectState = connectIdle;
298  return channelPutConnectStatus;
299 }
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::PvaClientPut::waitGet ( )

Wait until get completes.

Returns
status

Definition at line 336 of file pvaClientPut.cpp.

337 {
338  if(PvaClient::getDebug()) {
339  cout << "PvaClientPut::waitGet"
340  << " channelName " << pvaClientChannel->getChannel()->getChannelName()
341  << endl;
342  }
343  {
344  Lock xx(mutex);
345  if(putState==putComplete) return channelGetPutStatus;
346  if(putState!=getActive){
347  string message = string("channel ")
348  + pvaClientChannel->getChannel()->getChannelName()
349  + " PvaClientPut::waitGet illegal put state";
350  throw std::runtime_error(message);
351  }
352  }
353  waitForGetPut.wait();
354  return channelGetPutStatus;
355 }
A lock for multithreading.
Definition: lock.h:36
static bool getDebug()
Is debug set?
Definition: pvaClient.cpp:97
Status epics::pvaClient::PvaClientPut::waitPut ( )

Wait until put completes.

Returns
status

Definition at line 394 of file pvaClientPut.cpp.

395 {
396  if(PvaClient::getDebug()) {
397  cout << "PvaClientPut::waitPut"
398  << " channelName " << pvaClientChannel->getChannel()->getChannelName()
399  << endl;
400  }
401  {
402  Lock xx(mutex);
403  if(putState==putComplete) return channelGetPutStatus;
404  if(putState!=putActive){
405  string message = string("channel ")
406  + pvaClientChannel->getChannel()->getChannelName()
407  + " PvaClientPut::waitPut illegal put state";
408  throw std::runtime_error(message);
409  }
410  }
411  waitForGetPut.wait();
412  if(channelGetPutStatus.isOK()) pvaClientData->getChangedBitSet()->clear();
413  return channelGetPutStatus;
414 }
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

Friends And Related Function Documentation

friend class ChannelPutRequesterImpl
friend

Definition at line 1304 of file pvaClient.h.


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