This is Unofficial EPICS BASE Doxygen Site
pvas::detail::SharedPut Struct Reference

#include "sharedstateimpl.h"

+ Inheritance diagram for pvas::detail::SharedPut:
+ Collaboration diagram for pvas::detail::SharedPut:

Public Member Functions

 SharedPut (const std::tr1::shared_ptr< SharedChannel > &channel, const requester_type::shared_pointer &requester, const pvd::PVStructure::const_shared_pointer &pvRequest)
 
virtual ~SharedPut ()
 
virtual void destroy () OVERRIDE FINAL
 
virtual std::tr1::shared_ptr< pva::ChannelgetChannel () OVERRIDE FINAL
 
virtual void cancel () OVERRIDE FINAL
 
virtual void lastRequest () OVERRIDE FINAL
 
virtual void put (epics::pvData::PVStructure::shared_pointer const &pvPutStructure, epics::pvData::BitSet::shared_pointer const &putBitSet) OVERRIDE FINAL
 
virtual void get () OVERRIDE FINAL
 
- Public Member Functions inherited from epics::pvAccess::ChannelPut
 POINTER_DEFINITIONS (ChannelPut)
 
virtual ~ChannelPut ()
 
- Public Member Functions inherited from epics::pvAccess::ChannelRequest
 POINTER_DEFINITIONS (ChannelRequest)
 
 ChannelRequest ()
 
virtual ~ChannelRequest ()
 
- Public Member Functions inherited from epics::pvAccess::Destroyable
 POINTER_DEFINITIONS (Destroyable)
 
- Public Member Functions inherited from epics::pvAccess::Lockable
 POINTER_DEFINITIONS (Lockable)
 
virtual ~Lockable ()
 
virtual void lock ()
 
virtual void unlock ()
 

Public Attributes

const std::tr1::shared_ptr< SharedChannelchannel
 
const requester_type::weak_pointer requester
 
const pvd::PVStructure::const_shared_pointer pvRequest
 
pvd::PVRequestMapper mapper
 

Static Public Attributes

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

Additional Inherited Members

- Public Types inherited from epics::pvAccess::ChannelPut
typedef ChannelPutRequester requester_type
 
- Protected Member Functions inherited from epics::pvAccess::Destroyable
virtual ~Destroyable ()
 

Detailed Description

Definition at line 76 of file sharedstateimpl.h.

Constructor & Destructor Documentation

pvas::detail::SharedPut::SharedPut ( const std::tr1::shared_ptr< SharedChannel > &  channel,
const requester_type::shared_pointer &  requester,
const pvd::PVStructure::const_shared_pointer &  pvRequest 
)

Definition at line 80 of file sharedstate_put.cpp.

86 {
87  REFTRACE_INCREMENT(num_instances);
88 }
const requester_type::weak_pointer requester
static size_t num_instances
const pvd::PVStructure::const_shared_pointer pvRequest
const std::tr1::shared_ptr< SharedChannel > channel
pvas::detail::SharedPut::~SharedPut ( )
virtual

Definition at line 90 of file sharedstate_put.cpp.

91 {
92  Guard G(channel->owner->mutex);
93  channel->owner->puts.remove(this);
94  REFTRACE_DECREMENT(num_instances);
95 }
static size_t num_instances
const std::tr1::shared_ptr< SharedChannel > channel

Member Function Documentation

void pvas::detail::SharedPut::cancel ( )
virtual

Cancel any pending request. Completion will be reported via request's response callback:

  • if cancel() request is issued after the request was already complete, request success/failure completion will be reported and cancel() request ignored.
  • if the request was actually canceled, cancellation completion is reported.

Implements epics::pvAccess::ChannelRequest.

Definition at line 104 of file sharedstate_put.cpp.

104 {}
void pvas::detail::SharedPut::destroy ( )
virtual

Destroy this instance.

Implements epics::pvAccess::Destroyable.

Definition at line 97 of file sharedstate_put.cpp.

97 {}
void pvas::detail::SharedPut::get ( )
virtual

Get the current data.

Ownership transfer as with ChannelGet::get()

Implements epics::pvAccess::ChannelPut.

Definition at line 152 of file sharedstate_put.cpp.

153 {
154  pvd::Status sts;
155  pvd::PVStructurePtr current;
156  pvd::BitSetPtr changed;
157  {
158  Guard G(channel->owner->mutex);
159 
160  if(channel->dead) {
161  sts = pvd::Status::error("Dead Channel");
162 
163  } else if(channel->owner->current) {
164  assert(!!mapper.requested());
165 
166  current = mapper.buildRequested();
167  changed.reset(new pvd::BitSet);
168 
169  mapper.copyBaseToRequested(*channel->owner->current, channel->owner->valid,
170  *current, *changed);
171  }
172  }
173 
174  requester_type::shared_pointer req(requester.lock());
175  if(!req) return;
176 
177  if(!sts.isOK()) {
178  // no-op
179  } else if(!current) {
180  sts = pvd::Status::error("Get not possible, cache disabled");
181  }
182 
183  req->getDone(sts, shared_from_this(), current, changed);
184 }
void copyBaseToRequested(const PVStructure &base, const BitSet &baseMask, PVStructure &request, BitSet &requestMask) const
#define assert(exp)
Declare that a condition should be true.
Definition: epicsAssert.h:70
static Status error(const std::string &m)
Definition: status.h:50
const requester_type::weak_pointer requester
pvd::PVRequestMapper mapper
PVStructurePtr buildRequested() const
A vector of bits.
Definition: bitSet.h:56
const std::tr1::shared_ptr< SharedChannel > channel
std::tr1::shared_ptr< PVStructure > PVStructurePtr
Definition: pvData.h:87
std::tr1::shared_ptr< BitSet > BitSetPtr
Definition: bitSet.h:26
bool isOK() const
Definition: status.h:95
const StructureConstPtr & requested() const
std::tr1::shared_ptr< pva::Channel > pvas::detail::SharedPut::getChannel ( )
virtual

Get a channel instance this request belongs to.

Returns
the channel instance.

Implements epics::pvAccess::ChannelRequest.

Definition at line 99 of file sharedstate_put.cpp.

100 {
101  return channel;
102 }
const std::tr1::shared_ptr< SharedChannel > channel
void pvas::detail::SharedPut::lastRequest ( )
virtual

Announce next request as last request. When last request will be completed (regardless of completion status) the remote and local instance will be destroyed.

Implements epics::pvAccess::ChannelRequest.

Definition at line 106 of file sharedstate_put.cpp.

106 {}
void pvas::detail::SharedPut::put ( epics::pvData::PVStructure::shared_pointer const &  pvPutStructure,
epics::pvData::BitSet::shared_pointer const &  putBitSet 
)
virtual

Put data to a channel.

Completion status is reported by calling ChannelPutRequester::putDone()

Ownership of the PVStructure is transfered to the ChannelPut until ChannelPutRequester::putDone() or ChannelPutRequester::channelDisconnect() is called.

Parameters
pvPutStructureThe PVStructure that holds the putData.
putBitSetputPVStructure bit-set (selects what fields to put).

Implements epics::pvAccess::ChannelPut.

Definition at line 108 of file sharedstate_put.cpp.

111 {
112  std::tr1::shared_ptr<SharedPV::Handler> handler;
113  pvd::PVStructure::shared_pointer realval;
114  pvd::BitSet changed;
115  pvd::Status sts;
116  {
117  Guard G(channel->owner->mutex);
118 
119  if(channel->dead) {
120  sts = pvd::Status::error("Dead Channel");
121 
122  } else if(pvPutStructure->getStructure()!=mapper.requested()) {
123  requester_type::shared_pointer req(requester.lock());
124  sts = pvd::Status::error("Type changed");
125 
126  } else {
127 
128  handler = channel->owner->handler;
129 
130  realval = mapper.buildBase();
131 
132  mapper.copyBaseFromRequested(*realval, changed, *pvPutStructure, *putBitSet);
133  }
134  }
135 
136  if(!sts.isOK()) {
137  requester_type::shared_pointer req(requester.lock());
138  if(req)
139  req->putDone(sts, pva::ChannelPut::shared_pointer());
140 
141  } else {
142  std::tr1::shared_ptr<PutOP> impl(new PutOP(shared_from_this(), pvRequest, realval, changed),
143  Operation::Impl::Cleanup());
144 
145  if(handler) {
146  Operation op(impl);
147  handler->onPut(channel->owner, op);
148  }
149  }
150 }
static Status error(const std::string &m)
Definition: status.h:50
const requester_type::weak_pointer requester
pvd::PVRequestMapper mapper
A vector of bits.
Definition: bitSet.h:56
const pvd::PVStructure::const_shared_pointer pvRequest
const std::tr1::shared_ptr< SharedChannel > channel
PVStructurePtr buildBase() const
bool isOK() const
Definition: status.h:95
ChannelPut::shared_pointer op
Definition: pvAccess.cpp:132
const StructureConstPtr & requested() const
void copyBaseFromRequested(PVStructure &base, BitSet &baseMask, const PVStructure &request, const BitSet &requestMask) const

Member Data Documentation

const std::tr1::shared_ptr<SharedChannel> pvas::detail::SharedPut::channel

Definition at line 79 of file sharedstateimpl.h.

pvd::PVRequestMapper pvas::detail::SharedPut::mapper

Definition at line 84 of file sharedstateimpl.h.

size_t pvas::detail::SharedPut::num_instances
static

Definition at line 86 of file sharedstateimpl.h.

const pvd::PVStructure::const_shared_pointer pvas::detail::SharedPut::pvRequest

Definition at line 81 of file sharedstateimpl.h.

const requester_type::weak_pointer pvas::detail::SharedPut::requester

Definition at line 80 of file sharedstateimpl.h.


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