From 3b9dd9c405dbd12e700dcbd1babaed2d6acafffb Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Mon, 27 Jul 2020 08:33:02 -0700 Subject: [PATCH] client Operation expose PV name Desirable to include in error messages if nothing else --- src/client.cpp | 5 +++++ src/clientimpl.h | 1 + src/pvxs/client.h | 4 ++++ 3 files changed, 10 insertions(+) diff --git a/src/client.cpp b/src/client.cpp index 706cbb3..7d161b7 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -165,6 +165,11 @@ OperationBase::OperationBase(operation_t op, const std::shared_ptr& cha OperationBase::~OperationBase() {} +const std::string& OperationBase::name() +{ + return chan->name; +} + Value OperationBase::wait(double timeout) { if(!waiter) diff --git a/src/clientimpl.h b/src/clientimpl.h index 273fc85..8847da4 100644 --- a/src/clientimpl.h +++ b/src/clientimpl.h @@ -54,6 +54,7 @@ struct OperationBase : public Operation virtual void createOp() =0; virtual void disconnected(const std::shared_ptr& self) =0; + virtual const std::string& name() override final; virtual Value wait(double timeout=-1.0) override final; virtual void interrupt() override final; }; diff --git a/src/pvxs/client.h b/src/pvxs/client.h index a66355b..d7a9473 100644 --- a/src/pvxs/client.h +++ b/src/pvxs/client.h @@ -98,6 +98,7 @@ public: //! Handle for in-progress operation struct PVXS_API Operation { + //! Operation type const enum operation_t { Info = 17, // CMD_GET_FIELD Get = 10, // CMD_GET @@ -111,6 +112,9 @@ struct PVXS_API Operation { Operation& operator=(const Operation&) = delete; virtual ~Operation() =0; + //! PV name + virtual const std::string& name() =0; + //! Explicitly cancel a pending operation. //! Blocks until an in-progress callback has completed. virtual void cancel() =0;