pvAccessCPP  7.1.7
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
baseChannelRequester.h
1 
7 #ifndef BASECHANNELREQUESTER_H_
8 #define BASECHANNELREQUESTER_H_
9 
10 #include <pv/requester.h>
11 #include <pv/destroyable.h>
12 #include <pv/serverContextImpl.h>
13 #include <pv/serverChannelImpl.h>
14 
15 namespace epics {
16 namespace pvAccess {
17 
18 class ServerChannel;
19 class ChannelRequest;
20 
21 class BaseChannelRequester :
22  virtual public epics::pvData::Requester,
23  public TransportSender,
24  public NetStats,
25  public Destroyable
26 {
27 public:
28  POINTER_DEFINITIONS(BaseChannelRequester);
29  BaseChannelRequester(ServerContextImpl::shared_pointer const & context, std::tr1::shared_ptr<ServerChannel> const & channel,
30  const pvAccessID ioid, Transport::shared_pointer const & transport);
31  virtual ~BaseChannelRequester() {};
32 
33  bool startRequest(epics::pvData::int32 qos);
34  void stopRequest();
35  epics::pvData::int32 getPendingRequest();
37  virtual std::tr1::shared_ptr<ChannelRequest> getOperation() =0;
38  virtual std::string getRequesterName() OVERRIDE FINAL;
39  virtual void message(std::string const & message, epics::pvData::MessageType messageType) OVERRIDE FINAL;
40  static void message(Transport::shared_pointer const & transport, const pvAccessID ioid, const std::string message, const epics::pvData::MessageType messageType);
41  static void sendFailureMessage(const epics::pvData::int8 command, Transport::shared_pointer const & transport, const pvAccessID ioid, const epics::pvData::int8 qos, const epics::pvData::Status status);
42 
43  virtual void stats(Stats &s) const OVERRIDE FINAL;
44 
45  static const epics::pvData::Status okStatus;
46  static const epics::pvData::Status badCIDStatus;
47  static const epics::pvData::Status badIOIDStatus;
48  static const epics::pvData::Status noReadACLStatus;
49  static const epics::pvData::Status noWriteACLStatus;
50  static const epics::pvData::Status noProcessACLStatus;
51  static const epics::pvData::Status otherRequestPendingStatus;
52  static const epics::pvData::Status notAChannelRequestStatus;
53 protected:
54  const pvAccessID _ioid;
55  const Transport::shared_pointer _transport;
56  const std::tr1::shared_ptr<ServerChannel> _channel;
57  epics::pvData::Mutex _mutex;
58 private:
59  ServerContextImpl::shared_pointer _context;
60  static const epics::pvData::int32 NULL_REQUEST;
61  epics::pvData::int32 _pendingRequest;
62 };
63 
64 class BaseChannelRequesterMessageTransportSender : public TransportSender
65 {
66 public:
67  BaseChannelRequesterMessageTransportSender(const pvAccessID _ioid, const std::string message,const epics::pvData::MessageType messageType);
68  virtual void send(epics::pvData::ByteBuffer* buffer, TransportSendControl* control) OVERRIDE FINAL;
69 private:
70  const pvAccessID _ioid;
71  const std::string _message;
72  const epics::pvData::MessageType _messageType;
73 };
74 
75 class BaseChannelRequesterFailureMessageTransportSender : public TransportSender
76 {
77 public:
78  BaseChannelRequesterFailureMessageTransportSender(const epics::pvData::int8 command, Transport::shared_pointer const & transport, const pvAccessID ioid, const epics::pvData::int8 qos, const epics::pvData::Status& status);
79  virtual void send(epics::pvData::ByteBuffer* buffer, TransportSendControl* control) OVERRIDE FINAL;
80 
81 private:
82  const epics::pvData::int8 _command;
83  const pvAccessID _ioid;
84  const epics::pvData::int8 _qos;
85  const epics::pvData::Status _status;
86  Transport::shared_pointer _transport;
87 };
88 
89 }
90 }
91 
92 
93 #endif /* BASECHANNELREQUESTER_H_ */
virtual void send(epics::pvData::ByteBuffer *buffer, TransportSendControl *control)=0
Called by transport.