diff --git a/README.md b/README.md index b138de5..d664352 100644 --- a/README.md +++ b/README.md @@ -15,8 +15,12 @@ then just type: make -If RELEASE.local does not exist then look at configure/RELEASE -for directions for how to build. +It can also be built by: + + cp configure/ExampleRELEASE.local configure/RELEASE.local + edit configure/RELEASE.local + make + Examples ------------ @@ -26,7 +30,7 @@ Project exampleCPP has examples for pvaClientCPP Status ------ -* The API is for EPICS Version 4 release 4.5.0 +* The API is for EPICS Version 4 release 4.6.0 * Everything defined in pvaClient.h is ready but see below for remaining work. * Everything defined in pvaClientMultiChannel.h is ready but see below for remaining work. @@ -34,7 +38,7 @@ Status pvaClientChannel --------------- -Channel::getField and channelArray are not supported for release 4.5 +Channel::getField and channelArray are not supported for release 4.6 pvaClientMultiChannel --------------- diff --git a/documentation/RELEASE_NOTES.md b/documentation/RELEASE_NOTES.md index d13c27b..faa83ee 100644 --- a/documentation/RELEASE_NOTES.md +++ b/documentation/RELEASE_NOTES.md @@ -1,10 +1,9 @@ EPICS V4 release 4.6 ========================== -PvaClientMultiChannel ---------------------- - -checkConnected() now throws an exception if connect fails. +* The examples are moved to exampleCPP. +* Support for channelRPC is now available. +* In PvaClientMultiChannel checkConnected() now throws an exception if connect fails. diff --git a/documentation/pvaClientCPP.html b/documentation/pvaClientCPP.html index 8dc0ea7..20ee501 100644 --- a/documentation/pvaClientCPP.html +++ b/documentation/pvaClientCPP.html @@ -26,7 +26,7 @@

EPICS pvaClientCPP

-

Release 4.2.0-SNAPSHOT - 2016-01-12

+

Release 4.2.0-SNAPSHOT - 2016-07-14

Abstract

@@ -69,341 +69,49 @@ The data for the channels is presented via normative type NTMultiChannel.

- -

Introduction

- -

PvaClient is a synchronous API for accessing PVData via PVAccess. -It also provides a number of convenience methods. -It allows the client to request access without checking for failure, -but throws an exception if a request fails. -A client can also check for failues and thus prevent exceptions.

- -

Doxygen documentation is available at doxygenDoc

- -

The PvaClient API has the following features:

-
    -
  1. Provides a synchronous API rather than the callback API provided by pvAccess.
  2. -
  3. Makes common requests easy.
  4. -
  5. Provides full access to the pvAccess API for more demanding - applications
  6. -
  7. Allows efficient client side programs.
  8. -
  9. Takes care of most object resource management problems.
  10. -
-

Simple examples of using pva:

-
-// pvaGet
-PvaClientPtr pva = PvaClient::create();
-double value = pva->channel("exampleDouble")->get()->getData()->getDouble();
-
-// pvaPut
-PvaClientChannelPtr channel = pva->channel("exampleDouble");
-PvaClientPutPtr put = channel->put();
-PvaClientPutDataPtr putData = put->getData();
-putData->putDouble(3.0); put->put();
-
-// pvaMonitor
-PvaClientMonitorPtr monitor = pva->channel("examplePowerSupply")->monitor("");
-PvaClientMonitorDataPtr pvaData = monitor->getData();
-while(true) {
-    monitor->waitEvent();
-    cout << "changed\n";
-    pvaData->showChanged(cout);
-    cout << "overrun\n";
-    pvaData->showOverrun(cout);
-    monitor->releaseEvent();
-}
-
-// pvaProcess
-PvaClientChannelPtr channel = pva->channel("exampleDouble");
-PvaClientProcessPtr process = channel->createProcess();
-process->process();
-
-
-

A separate project exampleCPP has examples for pvDatabaseCPP -and for pvaClientCPP. -See it for pvaClientCPP examples. -

-

pvaClient does not provide support for:

-
-
ChannelArray
-
TBD
-
ChannelRPC
-
pvAccess itself already provides a synchronous interface. - exampleCPP provides helloRPC, which is an example of using channelRPC. -
-
- -

Building pvaClientCPP

+

Overview

-If a proper RELEASE.local is present one directory level above pvaClientCPP. +pvaClientCPP is one of the components of + +EPICS Version 4 + +

+

This document is only a guide to help locate code and documentation related to pvDatabaseCPP

-Just type: +It is intended for developers that want to use pvDatabaseCPP.

-
-make
-
-

-An example of a proper RELEASE.local is: +

Developer Guide

+

A guide for developers is available at + +developerGuide +

-
-EPICS4_DIR=/home/epicsv4/master
-EXAMPLE=${EPICS4_DIR}/exampleCPP
-PVDATABASE=${EPICS4_DIR}/pvDatabaseCPP
-PVACLIENT=${EPICS4_DIR}/pvaClientCPP
-PVASRV=${EPICS4_DIR}/pvaSrv
-PVACCESS=${EPICS4_DIR}/pvAccessCPP
-NORMATIVETYPES=${EPICS4_DIR}/normativeTypesCPP
-PVDATA=${EPICS4_DIR}/pvDataCPP
-PVCOMMON=${EPICS4_DIR}/pvCommonCPP
-
-EPICS_BASE=/home/install/epics/base
-
- -

pvaClientCPP can also be built if a file RELEASE.local exists in directory configure. -To create one do the following:

-
-mrk> pwd
-/home/hg/pvaClientCPP/configure
-mrk> cp ExampleRELEASE.local RELEASE.local
-
-

Then edit RELEASE.local so that it has the correct location of each -product pvaClientCPP requires. -Than at the top level just execute make:

-
-mrk> cd ..
-mrk> pwd
-/home/epicsv4/master/pvaClientCPP
-mrk> make
-
- -

PvaClient

-

An instance of PvaClient is obtained via the call:

-
-PvaClientPtr pva = PvaClient::create();
-
- -

PvaClient has methods to create instances of PvaClientChannel. -The client can specify the provider name or use the default provider. -The client can manage it's own channels or can let pvaClient cache channels. -An example of using the cached method is:

-
-PvaClientChannelPtr pvaChannel = pva->channel("exampleDouble");
-
-

This will attempt to connect to channel exampleDouble. -Since the client did not specify a timeout an exception wll be thrown if -the connection request fails. -The client will block until the connection is made or an exception is thrown. -If the request succeeds, pva caches the pvaChannel so that if the -client makes another request for the same channel the cached object is -returned to the client. +

This guide discusses all the components that are part of an EPICS V4 release. +Some understanding of the components and how they are related is necessary in order to +develop code that uses pvDatabaseCPP. +In particular read everything related to pvaClient.

-

An example of using a non cached method is:

-
-PvaClientChannelPtr pvaChannel = pva->createChannel("exampleDouble");
-
-

This will create an PvaClientChannel and return it to the client. -The client must itself connect. -This is useful if the client wants to connect to multiple channels in parallel. +

The developerGuide discusses code in a way that applies to both CPP and C++. +For the descriptions of the CPP specific code consult the next section.

-

PvaClientChannel - Wrapper For Single Channel

-

PvaClientChannel

-

This provides methods for connecting to a channel and for creating instances of -PvaClientField, PvaClientProcess, ..., PvaClientPutGet.

-

Connection must be made before any create method is called or -an exception is raised. -The following is a synchronous connection request:

-
-pvaChannel->connect(5.0); // BLOCKS AND THROWS IF NO CONNECT
-
-

This blocks until then connection is made or until timout occurs. -An exception is raised if the connection request fails. +

doxygen

+

doxygen documentation is available at +doxygen

-

The same request can be made without blocking and without exceptions.

-
-pvaChannel->issueConnect(); // DOES NOT BLOCK
-.....
-Status status =pvaChannel->waitConnect(5.0);  // BLOCKS DOES NOT THROW
-if(!status.isOK()) {
-   // failure do something
-}
-
-

Once the channel is connected other PvaClient objects can be created. -For example:

-
-PvaClientGetPtr pvaGet = pvaChannel->get(); // DOES BLOCK
-
-

This is a caching request. -If the client already has made an identical request the client will receive the -cached object. -If a new pvaGet is created than it is connected before it is returned to the client. -

-

The client can also managed it's own objects:

-
-PvaClientGetPtr pvaGet = pvaChannel->createGet(); // DOES NOT BLOCK
-
-

The client must connect the pvaGet.

-

PvaClientGetData

-

This provides the data returned by pvaGet and pvaPutGet. -It is obtained via:

-
-PvaClientGetDataPtr pvaData = pvaGet->getData();
-
-

It provides methods to get everything returned by channelGet. -In addition there are methods that make it easier to handle a value -field that is a scalar or a scalarArray. -Also for a scalar that is a double or a scalarArray with element type double. +

exampleCPP

+

Example code is available as part of this release. + +exampleCPP +

-

An example is:

-
-double value = pvaData->getDouble();
-
-

It also keeps a bitSet showing which fields have changed since the last channelGet or channelPutGet.

- -

PvaClientMonitorData

-

To the client this looks identical to PvaClientGetData except that -it provides two BitSets: changedBitSet and overrrunBitSet. -It is used by pvaMonitor. -

-

PvaClientPutData

-

This is used to provided data for pvaPut and pvaPutGet. -It has many of the same methods as pvaGetData. -It does not have a bitSet. -It also has put methods like:

-
-void pvaData->putDouble(5.0);
-
-

PvaClientGet

-

This provides methods to connect to channelGet and to issue get request. -To connect via a single synchronous call:

-
-easyGet->connect();  // BLOCKS AND CAN THROW
-
-

This can also be done in two steps:

-
-pvaGet->issueConnect(); // DOES NOT BLOCK
-...
-Status status = pvaGet->waitConnect(); // BLOCKS AND DOES NOT THROW
-
-

Once connected gets are issued via either:

-
-void pvaGet->get(); // BLOCKS AND CAN THROW
-
-or -
-pvaGet->issueGet(); // DOES NOT BLOCK
-...
-Status status = pvaGet->waitGet(); // BLOCKS AND DOES NOT THROW
-
-

PvaClientPut

-

This is similar to pvaGet except that it wraps channelPut instead of channelGet. -

-

Once connected puts are issued via either:

-
-void pvaPut->put(); // BLOCKS AND CAN THROW
-
-or -
-pvaPut->issuePut(); // DOES NOT BLOCK
-...
-Status status = pvaPut->waitPut(); // BLOCKS AND DOES NOT THROW
-
-

PvaClientMonitor

-

Connecting is similar to pvaGet and pvaPut. -The other methods are:

-
-
start
-
Starts monitoring
-
stop
-
Stops monitoring
-
poll
-
polls for a monitorEvent. - The data is avalable via pvaMonitorData. -
-
releaseEvent
-
Release the data from the last poll. - Note that this must be called before another poll is requested. -
-
waitEvent
-
Block until a monitorEvent is available. - If true is returned a poll has already been issued. -
-
setRequester
-
A client callback is registered to receive notice of monitorEvents.
-
-

PvaClientProcess

-

Connecting is similar to pvaGet. -It has methods:

-
-
process
-
call issueProcess and waitProcess.
-
issueProcess
-
call channelProcess->process() and return immediately. -
-
waitProcess
-
Wait for process to complete.
-
-

PvaClientPutGet

-

Connecting is similar to pvaGet. -It has methods:

-
-
putGet
-
calls issuePutGet and waitPutGet. - throws an exception if not successfull. -
-
issuePutGet
-
- Calls channel->putGet() and returns. -
-
waitPutGet
-
- Waits until putGet completes and returns status. -
-
getGet,issueGetGet, and waitGetGet
-
Gets the data for the get part of channelPutGet.
-
getPut,issueGetPut,and waitGetPut
-
Gets the data for the put part of channelPutGet.
-
getPutData
-
- Returns the PvaClientData for the put part of channelPutGet. -
-
getGetData
-
- Returns the PvaClientData for the get part of channelPutGet. -
-
-

Look at javaDoc for details.

- -

PvaClientMultiChannel - Wrapper For Multiple Channels

-

PvaClientMultiChannel

-

This provides methods for connecting to multiple channels. -

-

PvaClientMultiGetDouble

-

This provides support for channelGet to multiple channels where each channel has a value field that is a numeric scalar. -

-

PvaClientMultiPutDouble

-

This provides support for channelPut to multiple channels where each channel has a value field that is a numeric scalar. -

-

PvaClientMultiMonitorDouble

-

This provides support for monitoring changes to multiple channels where each channel has a value field that is a numeric scalar. -

-

PvaClientNTMultiGet

-

This provides support for channelGet to multiple channels where each channel has a value field that has any valid type. -

-

PvaClientNTMultiPut

-

This provides support for channelPut to multiple channels where each channel has a value -field that has any valid type. -

-

PvaClientNTMultiMonitor

-

This provides support for monitoring changes to multiple channels where each channel has a -value field that has any valid type. -

-

PvaClientNTMultiData

-

This provides support for monitoring changes to multiple channels where each channel has a value field that has any valid type. -The client can get the data as normative type NTMultiChannel. +

In particular look at exampleClient. +It has many examples of using pvaClientCPP.

diff --git a/src/pv/pvaClient.h b/src/pv/pvaClient.h index 69b4050..eada8b1 100644 --- a/src/pv/pvaClient.h +++ b/src/pv/pvaClient.h @@ -1,13 +1,8 @@ -/* pvaClient.h */ /** * Copyright - See the COPYRIGHT that is included with this distribution. * EPICS pvData is distributed subject to a Software License Agreement found * in file LICENSE that is included with this distribution. */ -/** - * @author mrk - * @date 2015.02 - */ #ifndef PVACLIENT_H #define PVACLIENT_H @@ -86,9 +81,12 @@ class PvaClientChannelCache; typedef std::tr1::shared_ptr PvaClientChannelCachePtr; /** - * @brief A synchronous interface to pvAccess plus convenience methods. + * @brief pvaClient is a synchronous wrapper for the pvAccess API, which is a callback based API. * + * Thus it is easier to use than pvAccess itself. + * In addition pvaClient provides many convenience methods. * @author mrk + * @date 2015.02 */ class epicsShareClass PvaClient : public epics::pvData::Requester, @@ -97,15 +95,15 @@ class epicsShareClass PvaClient : public: POINTER_DEFINITIONS(PvaClient); /** - * Destructor + * @brief Destructor */ ~PvaClient(); - /** Get the single instance of PvaClient. + /** @brief Get the single instance of PvaClient. * @param providerNames Space separated list of provider names. * @return shared pointer to the single instance. */ static PvaClientPtr get(std::string const & providerNames = "pva ca"); - /** Create an instance of PvaClient with providerName "pva ca". + /** @brief Create an instance of PvaClient with providerName "pva ca". * \deprecated This method will go away in future versions. Use get instead. * @return shared pointer to the single instance */ @@ -113,11 +111,12 @@ public: { return get(); } - /** Get the requester name. + /** @brief Get the requester name. * @return The name. */ std::string getRequesterName(); - /** A new message. + /** @brief A new message. + * * If a requester is set then it is called otherwise message is displayed * on standard out. * @param message The message. @@ -126,7 +125,7 @@ public: void message( std::string const & message, epics::pvData::MessageType messageType); - /** Get a cached channel or create and connect to a new channel. + /** @brief Get a cached channel or create and connect to a new channel. * @param channelName The channelName. * @param providerName The providerName. * @param timeOut The number of seconds to wait for connection. 0.0 means forever. @@ -137,7 +136,7 @@ public: std::string const & channelName, std::string const &providerName = "pva", double timeOut = 5.0); - /** Create an PvaClientChannel with the specified provider. + /** @brief Create an PvaClientChannel with the specified provider. * @param channelName The channelName. * @param providerName The provider. * @return The interface. @@ -147,30 +146,31 @@ public: std::string const & channelName, std::string const & providerName = "pva"); - /** Set a requester. + /** @brief Set a requester. + * * The default is for PvaClient to handle messages by printing to System.out. * @param requester The requester. */ void setRequester(epics::pvData::RequesterPtr const & requester); - /** Clear the requester. PvaClient will handle messages. + /** @brief Clear the requester. PvaClient will handle messages. */ void clearRequester(); - /** Show the list of cached channels. + /** @brief Show the list of cached channels. */ void showCache(); - /** Get the number of cached channels. + /** @brief Get the number of cached channels. */ size_t cacheSize(); /** Should debug info be shown? * @param value true or false */ static void setDebug(bool value) {debug = value;} - /** Is debug set? + /** @brief Is debug set? * @return true or false */ static bool getDebug() {return debug;} - /** Deprecated method + /** @brief Deprecated method * \deprecated This method will go away in future versions. */ void destroy() EPICS_DEPRECATED {} @@ -210,7 +210,7 @@ public: */ virtual ~PvaClientChannelStateChangeRequester(){} /** - * A channel connection state change has occurred. + * @brief A channel connection state change has occurred. * @param channel The channel. * @param isConnected The new connection status. */ @@ -229,40 +229,41 @@ class epicsShareClass PvaClientChannel : public: POINTER_DEFINITIONS(PvaClientChannel); /** - * Destructor + * @brief Destructor */ ~PvaClientChannel(); void setStateChangeRequester(PvaClientChannelStateChangeRequesterPtr const &stateChangeRequester); - /** Get the name of the channel to which PvaClientChannel is connected. + /** @brief Get the name of the channel to which PvaClientChannel is connected. * @return The channel name. */ std::string getChannelName(); - /** Get the the channel to which PvaClientChannel is connected. + /** @brief Get the the channel to which PvaClientChannel is connected. * @return The channel interface. */ epics::pvAccess::Channel::shared_pointer getChannel(); - /** Connect to the channel. + /** @brief Connect to the channel. + * * This calls issueConnect and waitConnect. * @param timeout The time to wait for connecting to the channel. The defaut is 5 seconds. * @throw runtime_error if connection fails. */ void connect(double timeout=5.0); - /** Issue a connect request and return immediately. + /** @brief Issue a connect request and return immediately. */ void issueConnect(); - /** Wait until the connection completes or for timeout. + /** @brief Wait until the connection completes or for timeout. * @param timeout The time in seconds to wait. A value of 0 means forever. * @return status. * @throw runtime_error if failure. */ epics::pvData::Status waitConnect(double timeout = 5.0); - /** Create a PvaClientField for the specified subField. + /** @brief Create a PvaClientField for the specified subField. * @param subField The desired subField, i. e. "field.field...." * An empty string, i. e. "", asks for the entire top level struture as defined by the server. * @return The interface. */ PvaClientFieldPtr createField(std::string const & subField = ""); - /** First call createRequest as implemented by pvDataCPP and then call the next method. + /** @brief First call createRequest as implemented by pvDataCPP and then call the next method. * @param request The syntax of request is defined by the copy facility of pvData. * @return The interface. * @throw runtime_error if failure. @@ -274,27 +275,32 @@ public: * @throw runtime_error if failure. */ PvaClientProcessPtr createProcess(epics::pvData::PVStructurePtr const & pvRequest); - /** Get a cached PvaClientGet or create and connect to a new PvaClientGet. + /** @brief Get a cached PvaClientGet or create and connect to a new PvaClientGet. + * * If connection can not be made an exception is thrown. * @param request The syntax of request is defined by the copy facility of pvData. * @return The interface. * @throw runtime_error if failure. */ PvaClientGetPtr get(std::string const & request = "field(value,alarm,timeStamp)"); - /** First call createRequest as implemented by pvDataJava and then call the next method. + /** @brief create a PvaClientGet. + * + * First call createRequest as implemented by pvDataJava and then call the next method. * Then get a cached PvaClientGet or create and connect to a new PvaClientGet. * @param request The syntax of request is defined by the copy facility of pvData. * @return The interface. * @throw runtime_error if failure. */ PvaClientGetPtr createGet(std::string const & request = "field(value,alarm,timeStamp)"); - /** Creates an PvaClientGet. + /** @brief Creates an PvaClientGet. * @param pvRequest The syntax of pvRequest is defined by the copy facility of pvData. * @return The interface. * @throw runtime_error if failure. */ PvaClientGetPtr createGet(epics::pvData::PVStructurePtr const & pvRequest); - /** First call createRequest as implemented by pvDataJava. + /** @brief create a PvaClientPut. + * + * First call createRequest as implemented by pvDataJava. * Then get a cached PvaClientPut or create and connect to a new PvaClientPut. * Then call it's get method. * @param request The syntax of request is defined by the copy facility of pvData. @@ -302,42 +308,50 @@ public: * @throw runtime_error if connection fails */ PvaClientPutPtr put(std::string const & request = "field(value)"); - /** First call createRequest as implemented by pvDataJava and then call the next method. + /** @brief create a PvaClientPut. + * + * First call createRequest as implemented by pvDataJava and then call the next method. * @param request The syntax of request is defined by the copy facility of pvData. * @return The interface. * @throw runtime_error if failure. */ PvaClientPutPtr createPut(std::string const & request = "field(value)"); - /** Create an PvaClientPut. + /** @brief Create a PvaClientPut. * @param pvRequest The syntax of pvRequest is defined by the copy facility of pvData. * @return The interface. */ PvaClientPutPtr createPut(epics::pvData::PVStructurePtr const & pvRequest); - /** First call createRequest as implemented by pvDataJava and then calls the next method. + /** @brief create a PvaClientPutGet. + * + * First call createRequest as implemented by pvDataJava and then calls the next method. * @param request The syntax of request is defined by the copy facility of pvData. * @return The interface. * @throw runtime_error if failure. */ PvaClientPutGetPtr createPutGet( std::string const & request = "putField(argument)getField(result)"); - /** Create an PvaClientPutGet. + /** @brief Create a PvaClientPutGet. * @param pvRequest The syntax of pvRequest is defined by the copy facility of pvData. * @return The interface. */ PvaClientPutGetPtr createPutGet(epics::pvData::PVStructurePtr const & pvRequest); - /** First call createRequest as implemented by pvDataJava and then call the next method. + /** @brief Create a PvaClientPutGet. + * + * First call createRequest as implemented by pvDataJava and then call the next method. * @param request The syntax of request is defined by the copy facility of pvData. * @return The interface. * @throw runtime_error if failure. */ PvaClientArrayPtr createArray(std::string const & request = "field(value)"); - /** Create an PvaClientArray. + /** @brief Create a PvaClientArray. * @param pvRequest The syntax of pvRequest is defined by the copy facility of pvData. * @return The interface. * @throw runtime_error if failure. */ PvaClientArrayPtr createArray(epics::pvData::PVStructurePtr const & pvRequest); - /** Create and connect to a new PvaClientMonitor. + /** @brief Create a PvaClientMonitor. + * + * Create and connect to a new PvaClientMonitor. * Then call it's start method. * If connection can not be made an exception is thrown. * @param request The syntax of request is defined by the copy facility of pvData. @@ -345,13 +359,14 @@ public: * @throw runtime_error if failure. */ PvaClientMonitorPtr monitor(std::string const & request = "field(value,alarm,timeStamp)"); - /** Call the next method with request = "field(value,alarm,timeStamp)" + /** @brief Call the next method with request = "field(value,alarm,timeStamp)" * @param pvaClientMonitorRequester The client callback. * @return The interface. * @throw runtime_error if failure. */ PvaClientMonitorPtr monitor(PvaClientMonitorRequesterPtr const & pvaClientMonitorRequester); - /** Create and connect to a new PvaClientMonitor. + /** @brief Create and connect to a new PvaClientMonitor. + * * Then call it's start method. * If connection can not be made an exception is thrown. * @param request The syntax of request is defined by the copy facility of pvData. @@ -376,7 +391,7 @@ public: * @throw runtime_error if failure. */ PvaClientMonitorPtr createMonitor(epics::pvData::PVStructurePtr const & pvRequest); - /** Issue a channelRPC request + /** @brief Issue a channelRPC request * @param pvRequest The pvRequest that is passed to createRPC. * @param pvArgument The argument for a request. * @return The result. @@ -385,24 +400,29 @@ public: epics::pvData::PVStructurePtr rpc( epics::pvData::PVStructurePtr const & pvRequest, epics::pvData::PVStructurePtr const & pvArgument); - /** Issue a channelRPC request + /** @brief Issue a channelRPC request * @param pvArgument The argument for the request. * @return The result. * @throw runtime_error if failure. */ epics::pvData::PVStructurePtr rpc( epics::pvData::PVStructurePtr const & pvArgument); - /** Create a PvaClientRPC. + /** @brief Create a PvaClientRPC. + * @return The interface. + * @throw runtime_error if failure. + */ + PvaClientRPCPtr createRPC(); + /** @brief Create a PvaClientRPC. * @param pvRequest The pvRequest that must have the same interface * as a pvArgument that is passed to an rpc request. * @return The interface. * @throw runtime_error if failure. */ PvaClientRPCPtr createRPC(epics::pvData::PVStructurePtr const & pvRequest); - /** Show the list of cached gets and puts. + /** @brief Show the list of cached gets and puts. */ void showCache(); - /** Get the number of cached gets and puts. + /** @brief Get the number of cached gets and puts. */ size_t cacheSize(); /** Deprecated method @@ -461,36 +481,39 @@ class epicsShareClass PvaClientGetData public: POINTER_DEFINITIONS(PvaClientGetData); /** - * Destructor + * @brief Destructor */ ~PvaClientGetData() {} - /** Set a prefix for throw messages. + /** @brief Set a prefix for throw messages. + * * This is called by other pvaClient classes. * @param value The prefix. */ void setMessagePrefix(std::string const & value); - /** Get the structure. + /** @brief Get the structure. * @return The Structure * @throw runtime_error if failure. */ epics::pvData::StructureConstPtr getStructure(); - /** Get the pvStructure. + /** @brief Get the pvStructure. * @return the pvStructure. * @throw runtime_error if failure. */ epics::pvData::PVStructurePtr getPVStructure(); - /** Get the changed BitSet for the pvStructure + /** @brief Get the changed BitSet for the pvStructure + * * This shows which fields have changed value since the last get. * @return The bitSet * @throw runtime_error if failure */ epics::pvData::BitSetPtr getChangedBitSet(); - /** Show the fields that have changed value since the last get. + /** @brief Show the fields that have changed value since the last get. * @param out The stream that shows the changed fields. * @return The stream that was passed as out. */ std::ostream & showChanged(std::ostream & out); - /** New data is present. + /** @brief New data is present. + * * This is called by other pvaClient classes, i. e. not by client. * @param pvStructureFrom The new data. * @param bitSetFrom the bitSet showing which values have changed. @@ -498,19 +521,19 @@ public: void setData( epics::pvData::PVStructurePtr const & pvStructureFrom, epics::pvData::BitSetPtr const & bitSetFrom); - /** Is there a top level field named value. + /** @brief Is there a top level field named value. * @return The answer. */ bool hasValue(); - /** Is the value field a scalar? + /** @brief Is the value field a scalar? * @return The answer. */ bool isValueScalar(); - /** Is the value field a scalar array? + /** @brief Is the value field a scalar array? * @return The answer. */ bool isValueScalarArray(); - /** Get the interface to the value field. + /** @brief Get the interface to the value field. * @return The interface. * @throw runtime_error if failure. */ @@ -521,17 +544,17 @@ public: * @throw runtime_error if failure. */ epics::pvData::PVScalarPtr getScalarValue(); - /** Get the interface to an array value field. + /** @brief Get the interface to an array value field. * @return The interface. * @throw runtime_error if failure. */ std::tr1::shared_ptr getArrayValue(); - /** Get the interface to a scalar array value field. + /** @brief Get the interface to a scalar array value field. * @return Return the interface. * @throw runtime_error if failure. */ std::tr1::shared_ptr getScalarArrayValue(); - /** Get the value as a double. + /** @brief Get the value as a double. * @return The value. * @throw runtime_error if failure. */ @@ -541,30 +564,31 @@ public: * @throw runtime_error if failure. */ std::string getString(); - /** Get the value as a double array. + /** @brief Get the value as a double array. * @return The value. * @throw runtime_error if failure. */ epics::pvData::shared_vector getDoubleArray(); - /** Get the value as a string array. + /** @brief Get the value as a string array. * @return The value. * @throw runtime_error if failure. */ epics::pvData::shared_vector getStringArray(); - /** Get the alarm. + /** @brief Get the alarm. * If the pvStructure has an alarm field it's values are returned. * Otherwise an exception is thrown. * @return The alarm. * @throw runtime_error if failure. */ epics::pvData::Alarm getAlarm(); - /** Get the timeStamp. + /** @brief Get the timeStamp. * If the pvStructure has a timeStamp field, it's values are returned. * Otherwise an exception is thrown. * @return The timeStamp. */ epics::pvData::TimeStamp getTimeStamp(); - /** Factory method for creating an instance of PvaClientGetData. + /** @brief Factory method for creating an instance of PvaClientGetData. + * * NOTE: Not normally called by clients * @param structure Introspection interface * @throw runtime_error if failure. @@ -595,44 +619,44 @@ class epicsShareClass PvaClientPutData public: POINTER_DEFINITIONS(PvaClientPutData); /** - * Destructor + * @brief Destructor */ ~PvaClientPutData() {} - /** Set a prefix for throw messages. + /** @brief Set a prefix for throw messages. * @param value The prefix. */ void setMessagePrefix(std::string const & value); - /** Get the structure. + /** @brief Get the structure. * @return The Structure * @throw runtime_error if failure. */ epics::pvData::StructureConstPtr getStructure(); - /** Get the pvStructure. + /** @brief Get the pvStructure. * @return the pvStructure. * @throw runtime_error if failure. */ epics::pvData::PVStructurePtr getPVStructure(); - /** Get the changed BitSet for the pvStructure + /** @brief Get the changed BitSet for the pvStructure * This shows which fields have changed values. * @return The bitSet * @throw runtime_error if failure. */ epics::pvData::BitSetPtr getChangedBitSet(); - /** Show the fields that have changed values. + /** @brief Show the fields that have changed values. * @param out The stream that shows the changed fields. * @return The stream that was passed as out. */ std::ostream & showChanged(std::ostream & out); /** - * Is there a top level field named value. + * @brief Is there a top level field named value. * @return The answer. */ bool hasValue(); - /** Is the value field a scalar? + /** @brief Is the value field a scalar? * @return The answer. */ bool isValueScalar(); - /** Is the value field a scalar array? + /** @brief Is the value field a scalar array? * @return The answer. */ bool isValueScalarArray(); @@ -640,62 +664,64 @@ public: * @return The interface. an excetion is thrown if a value field does not exist. */ epics::pvData::PVFieldPtr getValue(); - /** Get the interface to a scalar value field. + /** @brief Get the interface to a scalar value field. * @return The interface for a scalar value field. * @throw runtime_error if failure. */ epics::pvData::PVScalarPtr getScalarValue(); - /** Get the interface to an array value field. + /** @brief Get the interface to an array value field. * @return The interface. * An exception is thown if no array value field. */ std::tr1::shared_ptr getArrayValue(); - /** Get the interface to a scalar array value field. + /** @brief Get the interface to a scalar array value field. * @return Return the interface. * @throw runtime_error if failure. */ std::tr1::shared_ptr getScalarArrayValue(); - /** Get the value as a double. + /** @brief Get the value as a double. + * * If value is not a numeric scalar an exception is thrown. * @return The value. */ double getDouble(); - /** Get the value as a string. + /** @brief Get the value as a string. * @return The value. * @throw runtime_error if failure. */ std::string getString(); - /** Get the value as a double array. + /** @brief Get the value as a double array. * If the value is not a numeric array an exception is thrown. * @return The value. */ epics::pvData::shared_vector getDoubleArray(); - /** Get the value as a string array. + /** @brief Get the value as a string array. * @return The value. * @throw runtime_error if failure. */ epics::pvData::shared_vector getStringArray(); - /** Put the value as a double. + /** @brief Put the value as a double. * @param value The new value. * An exception is also thrown if the actualy type can cause an overflow. * @throw runtime_error if failure. */ void putDouble(double value); - /** Put the value as a string. + /** @brief Put the value as a string. + * * If value is not a scalar an exception is thrown. */ void putString(std::string const & value); - /** Copy the array to the value field. + /** @brief Copy the array to the value field. * @param value The place where data is copied. * @throw runtime_error if failure. */ void putDoubleArray(epics::pvData::shared_vector const & value); - /** Copy array to the value field. + /** @brief Copy array to the value field. * @param value data source * @throw runtime_error if failure. */ void putStringArray(epics::pvData::shared_vector const & value); - /** Copy array to the value field. + /** @brief Copy array to the value field. * @param value data source * @throw runtime_error if failure. */ @@ -731,110 +757,117 @@ class epicsShareClass PvaClientMonitorData public: POINTER_DEFINITIONS(PvaClientMonitorData); /** - * Destructor + * @brief Destructor */ ~PvaClientMonitorData() {} - /** Set a prefix for throw messages. + /** @brief Set a prefix for throw messages. * @param value The prefix. */ void setMessagePrefix(std::string const & value); - /** Get the structure. + /** @brief Get the structure. * @return The Structure * @throw runtime_error if failure. */ epics::pvData::StructureConstPtr getStructure(); - /** Get the pvStructure. + /** @brief Get the pvStructure. * @return the pvStructure. * @throw runtime_error if failure. */ epics::pvData::PVStructurePtr getPVStructure(); - /** Get the changed BitSet for the pvStructure + /** @brief Get the changed BitSet for the pvStructure, + * * This shows which fields have changed value. * @return The bitSet * @throw runtime_error if failure. */ epics::pvData::BitSetPtr getChangedBitSet(); - /** Get the overrun BitSet for the pvStructure + /** @brief Get the overrun BitSet for the pvStructure * This shows which fields have had more than one change. * @return The bitSet * @throw runtime_error if failure. */ epics::pvData::BitSetPtr getOverrunBitSet(); - /** Show the fields that have changed. + /** @brief Show the fields that have changed. * @param out The stream that shows the changed fields. * @return The stream that was passed as out. */ std::ostream & showChanged(std::ostream & out); - /** Show the fields that have overrun. + /** @brief Show the fields that have overrun. * @param out The stream that shows the overrun fields. * @return The stream that was passed as out */ std::ostream & showOverrun(std::ostream & out); - /** Is there a top level field named value. + /** @brief Is there a top level field named value. * @return The answer. */ bool hasValue(); - /** Is the value field a scalar? + /** @brief Is the value field a scalar? * @return The answer. */ bool isValueScalar(); - /** Is the value field a scalar array? + /** @brief Is the value field a scalar array? * @return The answer. */ bool isValueScalarArray(); - /** Get the interface to the value field. + /** @brief Get the interface to the value field. * @return The interface. an excetion is thrown if a value field does not exist. */ epics::pvData::PVFieldPtr getValue(); - /** Get the interface to a scalar value field. + /** @brief Get the interface to a scalar value field. * @return The interface for a scalar value field. * @throw runtime_error if failure. * An exception is thown if no scalar value field. */ epics::pvData::PVScalarPtr getScalarValue(); - /** Get the interface to an array value field. + /** @brief Get the interface to an array value field. * @return The interface. * @throw runtime_error if failure. * An exception is thown if no array value field. */ std::tr1::shared_ptr getArrayValue(); - /** Get the interface to a scalar array value field. + /** @brief Get the interface to a scalar array value field. * @return Return the interface. * @throw runtime_error if failure. * An exception is thown if no scalar array value field. */ std::tr1::shared_ptr getScalarArrayValue(); - /** Get the value as a double. + /** @brief Get the value as a double. + * * If value is not a numeric scalar an exception is thrown. * @return The value. */ double getDouble(); - /** Get the value as a string. + /** @brief Get the value as a string. + * * If value is not a scalar an exception is thrown * @return The value. * @throw runtime_error if failure. */ std::string getString(); - /** Get the value as a double array. + /** @brief Get the value as a double array. + * * If the value is not a numeric array an exception is thrown. * @return The value. * @throw runtime_error if failure. */ epics::pvData::shared_vector getDoubleArray(); - /** Get the value as a string array. + /** @brief Get the value as a string array. + * * If the value is not a string array an exception is thrown. * @return The value. * @throw runtime_error if failure. */ epics::pvData::shared_vector getStringArray(); - /** Get the alarm. + /** @brief Get the alarm. + * * If the pvStructure as an alarm field it's values are returned. * If no then alarm shows that not alarm defined. * @return The alarm. * @throw runtime_error if failure. */ epics::pvData::Alarm getAlarm(); - /** Get the timeStamp. + /** @brief Get the timeStamp. + * * If the pvStructure has a timeStamp field, it's values are returned. * If no then all fields are 0. * @return The timeStamp. @@ -881,7 +914,7 @@ class epicsShareClass PvaClientProcess { public: POINTER_DEFINITIONS(PvaClientProcess); - /** Create a PvaClientProcess. + /** @brief Create a PvaClientProcess. * @param &pvaClient Interface to PvaClient * @param channel Interface to Channel * @param pvRequest The request structure. @@ -892,30 +925,33 @@ public: epics::pvAccess::Channel::shared_pointer const & channel, epics::pvData::PVStructurePtr const &pvRequest ); - /** Destructor + /** @brief Destructor */ ~PvaClientProcess(); - /** Call issueConnect and then waitConnect. + /** @brief Call issueConnect and then waitConnect. + * * An exception is thrown if connect fails. * @throw runtime_error if failure. */ void connect(); - /** Issue the channelProcess connection to the channel. + /** @brief Issue the channelProcess connection to the channel. + * * This can only be called once. */ void issueConnect(); - /** Wait until the channelProcess connection to the channel is complete. + /** @brief Wait until the channelProcess connection to the channel is complete. * @return status; */ epics::pvData::Status waitConnect(); - /** Call issueProcess and then waitProcess. + /** @brief Call issueProcess and then waitProcess. + * * An exception is thrown if get fails. */ void process(); - /** Issue a process and return immediately. + /** @brief Issue a process and return immediately. */ void issueProcess(); - /** Wait until process completes. + /** @brief Wait until process completes. * @return status. */ epics::pvData::Status waitProcess(); @@ -972,7 +1008,7 @@ class epicsShareClass PvaClientGet { public: POINTER_DEFINITIONS(PvaClientGet); - /** Create a PvaClientGet. + /** @brief Create a PvaClientGet. * @param &pvaClient Interface to PvaClient * @param channel Interface to Channel * @param pvRequest The request structure. @@ -983,31 +1019,33 @@ public: epics::pvAccess::Channel::shared_pointer const & channel, epics::pvData::PVStructurePtr const &pvRequest ); - /** Destructor + /** @brief Destructor */ ~PvaClientGet(); - /** Call issueConnect and then waitConnect. + /** @brief Call issueConnect and then waitConnect. + * * An exception is thrown if connect fails. * @throw runtime_error if failure. */ void connect(); /** * @brief create the channelGet connection to the channel. + * * This can only be called once. */ void issueConnect(); - /** Wait until the channelGet connection to the channel is complete. + /** @brief Wait until the channelGet connection to the channel is complete. * @return status; */ epics::pvData::Status waitConnect(); - /** Call issueGet and then waitGet. + /** @brief Call issueGet and then waitGet. * An exception is thrown if get fails. */ void get(); - /** Issue a get and return immediately. + /** @brief Issue a get and return immediately. */ void issueGet(); - /** Wait until get completes. + /** @brief Wait until get completes. * @return status; */ epics::pvData::Status waitGet(); @@ -1077,7 +1115,7 @@ class epicsShareClass PvaClientPut { public: POINTER_DEFINITIONS(PvaClientPut); - /** Create a PvaClientPut. + /** @brief Create a PvaClientPut. * @param &pvaClient Interface to PvaClient * @param channel Interface to Channel * @param pvRequest The request structure. @@ -1088,43 +1126,46 @@ public: epics::pvAccess::Channel::shared_pointer const & channel, epics::pvData::PVStructurePtr const &pvRequest ); - /** Destructor + /** @brief Destructor */ ~PvaClientPut(); - /** Call issueConnect and then waitConnect. + /** @brief Call issueConnect and then waitConnect. + * * An exception is thrown if connect fails. * @throw runtime_error if failure. */ void connect(); - /** Issue the channelPut connection to the channel. + /** @brief Issue the channelPut connection to the channel. + * * This can only be called once. */ void issueConnect(); - /** Wait until the channelPut connection to the channel is complete. + /** @brief Wait until the channelPut connection to the channel is complete. * @return status; */ epics::pvData::Status waitConnect(); - /** Call issueGet and then waitGet. + /** @brief Call issueGet and then waitGet. + * * An exception is thrown if get fails. * @throw runtime_error if failure. */ void get(); - /** Issue a get and return immediately. + /** @brief Issue a get and return immediately. */ void issueGet(); - /** Wait until get completes. + /** @brief Wait until get completes. * @return status */ epics::pvData::Status waitGet(); - /** Call issuePut and then waitPut. + /** @brief Call issuePut and then waitPut. * An exception is thrown if get fails. */ void put(); - /** Issue a put and return immediately. + /** @brief Issue a put and return immediately. */ void issuePut(); - /** Wait until put completes. + /** @brief Wait until put completes. * @return status */ epics::pvData::Status waitPut(); @@ -1193,7 +1234,7 @@ class epicsShareClass PvaClientPutGet { public: POINTER_DEFINITIONS(PvaClientPutGet); - /** Create a PvaClientPutGet. + /** @brief Create a PvaClientPutGet. * @param &pvaClient Interface to PvaClient * @param channel Interface to Channel * @param pvRequest The request structure. @@ -1204,64 +1245,70 @@ public: epics::pvAccess::Channel::shared_pointer const & channel, epics::pvData::PVStructurePtr const &pvRequest ); - /** Destructor + /** @brief Destructor */ ~PvaClientPutGet(); - /** Call issueConnect and then waitConnect. + /** @brief Call issueConnect and then waitConnect. + * * An exception is thrown if connect fails. * @throw runtime_error if failure. */ void connect(); - /** Issue the channelPutGet connection to the channel. + /** @brief Issue the channelPutGet connection to the channel. + * * This can only be called once. * An exception is thrown if connect fails. */ void issueConnect(); - /** Wait until the channelPutGet connection to the channel is complete. + /** @brief Wait until the channelPutGet connection to the channel is complete. * @return status; */ epics::pvData::Status waitConnect(); - /** Call issuePutGet and then waitPutGet. + /** @brief Call issuePutGet and then waitPutGet. + * * An exception is thrown if putGet fails. */ void putGet(); - /** Issue a putGet and return immediately. + /** @brief Issue a putGet and return immediately. */ void issuePutGet(); - /** Wait until putGet completes. + /** @brief Wait until putGet completes. + * * If failure getStatus can be called to get reason. * @return status */ epics::pvData::Status waitPutGet(); - /** Call issueGet and then waitGetGet. + /** @brief Call issueGet and then waitGetGet. * An exception is thrown if get fails. */ void getGet(); - /** Issue a getGet and return immediately. + /** @brief Issue a getGet and return immediately. */ void issueGetGet(); - /** Wait until getGet completes. + /** @brief Wait until getGet completes. + * * If failure getStatus can be called to get reason. * @return status */ epics::pvData::Status waitGetGet(); - /** Call issuePut and then waitGetPut. + /** @brief Call issuePut and then waitGetPut. + * * An exception is thrown if getPut fails. */ void getPut(); - /** Issue a getPut and return immediately. + /** @brief Issue a getPut and return immediately. */ void issueGetPut(); - /** Wait until getPut completes. + /** @brief Wait until getPut completes. * @return status */ epics::pvData::Status waitGetPut(); - /** Get the put data. + /** @brief Get the put data. * @return The interface. */ PvaClientPutDataPtr getPutData(); - /** Get the get data. + /** @brief Get the get data. * @return The interface. */ PvaClientGetDataPtr getGetData(); @@ -1330,12 +1377,12 @@ class epicsShareClass PvaClientMonitorRequester public: POINTER_DEFINITIONS(PvaClientMonitorRequester); virtual ~PvaClientMonitorRequester() {} - /** A monitor event has occurred. + /** @brief A monitor event has occurred. * @param monitor The PvaClientMonitor that received the event. */ virtual void event(PvaClientMonitorPtr const & monitor) = 0; /** - * The data source is no longer available. + * @brief The data source is no longer available. */ virtual void unlisten() @@ -1360,7 +1407,7 @@ class epicsShareClass PvaClientMonitor : { public: POINTER_DEFINITIONS(PvaClientMonitor); - /** Create a PvaClientMonitor. + /** @brief Create a PvaClientMonitor. * @param &pvaClient Interface to PvaClient * @param channel Interface to Channel * @param pvRequest The request structure. @@ -1371,48 +1418,52 @@ public: epics::pvAccess::Channel::shared_pointer const & channel, epics::pvData::PVStructurePtr const &pvRequest ); - /** Destructor + /** @brief Destructor */ ~PvaClientMonitor(); - /** Call issueConnect and then waitConnect. + /** @brief Call issueConnect and then waitConnect. + * * An exception is thrown if connect fails. */ void connect(); - /** Issue the channelMonitor connection to the channel. + /** @brief Issue the channelMonitor connection to the channel. + * * This can only be called once. * An exception is thrown if connect fails. * @throw runtime_error if failure. */ void issueConnect(); - /** Wait until the channelMonitor connection to the channel is complete. + /** @brief Wait until the channelMonitor connection to the channel is complete. * @return status; */ epics::pvData::Status waitConnect(); - /** Set a user callback. + /** @brief Set a user callback. * @param pvaClientMonitorrRequester The requester which must be implemented by the caller. */ void setRequester(PvaClientMonitorRequesterPtr const & pvaClientMonitorrRequester); - /** Start monitoring. + /** @brief Start monitoring. */ void start(); - /** Stop monitoring. + /** @brief Stop monitoring. */ void stop(); - /** Poll for a monitor event. + /** @brief Poll for a monitor event. + * * The data will be in PvaClientData. * @return (false,true) means event (did not, did) occur. */ bool poll(); - /** Wait for a monitor event. + /** @brief Wait for a monitor event. + * * The data will be in PvaClientData. * @param secondsToWait Time to wait for event. * @return (false,true) means event (did not, did) occur. */ bool waitEvent(double secondsToWait = 0.0); - /** Release the monitorElement returned by poll + /** @brief Release the monitorElement returned by poll */ void releaseEvent(); - /** The data in which monitor events are placed. + /** @brief The data in which monitor events are placed. * @return The interface. */ PvaClientMonitorDataPtr getData(); @@ -1469,7 +1520,7 @@ public: POINTER_DEFINITIONS(PvaClientRPCRequester); virtual ~PvaClientRPCRequester() {} /** - * The request is done. This is always called with no locks held. + * @brief The request is done. This is always called with no locks held. * @param status Completion status. * @param pvaClientRPC The pvaClientRPC interface. * @param pvResponse The response data for the RPC request or null if the request failed. @@ -1493,7 +1544,15 @@ class epicsShareClass PvaClientRPC : { public: POINTER_DEFINITIONS(PvaClientRPC); - /** Create a PvaClientRPC. + /** @brief Create a PvaClientRPC. + * @param &pvaClient Interface to PvaClient + * @param channel Interface to Channel + * @return The interface to the PvaClientRPC. + */ + static PvaClientRPCPtr create( + PvaClientPtr const &pvaClient, + epics::pvAccess::Channel::shared_pointer const & channel); + /** @brief Create a PvaClientRPC. * @param &pvaClient Interface to PvaClient * @param channel Interface to Channel * @param pvRequest The request structure. @@ -1504,31 +1563,33 @@ public: epics::pvAccess::Channel::shared_pointer const & channel, epics::pvData::PVStructurePtr const &pvRequest ); - /** Destructor + /** @brief Destructor */ ~PvaClientRPC(); - /** Call issueConnect and then waitConnect. + /** @brief Call issueConnect and then waitConnect. + * * An exception is thrown if connect fails. */ void connect(); - /** Issue the channelRPC connection to the channel. + /** @brief Issue the channelRPC connection to the channel. + * * This can only be called once. * An exception is thrown if connect fails. * @throw runtime_error if failure. */ void issueConnect(); - /** Wait until the channelRPC connection to the channel is complete. + /** @brief Wait until the channelRPC connection to the channel is complete. * @return status; */ epics::pvData::Status waitConnect(); - /** issue a request and wait for response + /** @brief Issue a request and wait for response * @param pvArgument The data to send to the service. * @return The result * @throw runtime_error if failure. */ epics::pvData::PVStructure::shared_pointer request( epics::pvData::PVStructure::shared_pointer const & pvArgument); - /** issue a request and return immediately. + /** @brief issue a request and return immediately. * @param pvArgument The data to send to the service. * @param pvaClientRPCRequester The requester that is called with the result. * @throw runtime_error if failure. diff --git a/src/pv/pvaClientMultiChannel.h b/src/pv/pvaClientMultiChannel.h index faa9cb8..ffaff18 100644 --- a/src/pv/pvaClientMultiChannel.h +++ b/src/pv/pvaClientMultiChannel.h @@ -62,7 +62,7 @@ class epicsShareClass PvaClientMultiChannel : { public: POINTER_DEFINITIONS(PvaClientMultiChannel); - /** Create a PvaClientMultiChannel. + /** @brief Create a PvaClientMultiChannel. * @param pvaClient The interface to pvaClient. * @param channelNames The names of the channel.. * @param providerName The name of the provider. @@ -76,69 +76,70 @@ public: size_t maxNotConnected=0 ); /** - * Destructor + * @brief Destructor */ ~PvaClientMultiChannel(); - /** Get the channelNames. + /** @brief Get the channelNames. * @return The names. */ epics::pvData::shared_vector getChannelNames(); - /** Connect to the channels. + /** @brief Connect to the channels. + * * This calls issueConnect and waitConnect. * An exception is thrown if connect fails. * @param timeout The time to wait for connecting to the channel. * @return status of request */ epics::pvData::Status connect(double timeout=5); - /** Are all channels connected? + /** @brief Are all channels connected? * @return if all are connected. */ bool allConnected(); - /** Has a connection state change occured? + /** @brief Has a connection state change occured? * @return (true, false) if (at least one, no) channel has changed state. */ bool connectionChange(); - /** Get the connection state of each channel. + /** @brief Get the connection state of each channel. * @return The state of each channel. */ epics::pvData::shared_vector getIsConnected(); - /** Get the pvaClientChannelArray. + /** @brief Get the pvaClientChannelArray. * @return The shared pointer. */ PvaClientChannelArray getPvaClientChannelArray(); - /** Get pvaClient. + /** @brief Get pvaClient. * @return The shared pointer. */ PvaClientPtr getPvaClient(); /** - * create a pvaClientMultiGetDouble + * @brief create a pvaClientMultiGetDouble * @return The interface. */ PvaClientMultiGetDoublePtr createGet(); /** - * create a pvaClientMultiPutDouble + * @brief Create a pvaClientMultiPutDouble. * @return The interface. */ PvaClientMultiPutDoublePtr createPut(); /** - * Create a pvaClientMultiMonitorDouble. + * @brief Create a pvaClientMultiMonitorDouble. * @return The interface. */ PvaClientMultiMonitorDoublePtr createMonitor(); /** - * Create a pvaClientNTMultiPut. + * @brief Create a pvaClientNTMultiPut. * @return The interface. */ PvaClientNTMultiPutPtr createNTPut(); /** - * Create a pvaClientNTMultiGet; + * @brief Create a pvaClientNTMultiGet; * @param request The request for each channel. * @return The interface. */ PvaClientNTMultiGetPtr createNTGet( std::string const &request = "field(value,alarm,timeStamp)"); /** - * Create a pvaClientNTMultiPut. + * @brief Create a pvaClientNTMultiPut. * @param request The request for each channel. * @return The interface. */ @@ -181,7 +182,7 @@ public: POINTER_DEFINITIONS(PvaClientMultiGetDouble); /** - * Factory method that creates a PvaClientMultiGetDouble. + * @brief Create a PvaClientMultiGetDouble. * @param pvaClientMultiChannel The interface to PvaClientMultiChannel. * @param pvaClientChannelArray The PvaClientChannel array. * @return The interface. @@ -193,15 +194,15 @@ public: ~PvaClientMultiGetDouble(); /** - * Create a channelGet for each channel. - */ + * @brief Create a channelGet for each channel. + */ void connect(); /** - * get the data. + * @brief Get the data. * @return The double[] where each element is the value field of the corresponding channel. */ epics::pvData::shared_vector get(); - /** Get the shared pointer to self. + /** @brief Get the shared pointer to self. * @return The shared pointer. */ PvaClientMultiGetDoublePtr getPtrSelf() @@ -237,7 +238,7 @@ class epicsShareClass PvaClientMultiPutDouble : public: POINTER_DEFINITIONS(PvaClientMultiPutDouble); - /** Factory method that creates a PvaClientMultiPutDouble. + /** @brief Create a PvaClientMultiPutDouble. * @param pvaClientMultiChannel The interface to PvaClientMultiChannel. * @param pvaClientChannelArray The PvaClientChannel array. * @return The interface. @@ -247,14 +248,14 @@ public: PvaClientChannelArray const &pvaClientChannelArray); ~PvaClientMultiPutDouble(); /** - * Create a channelPut for each channel. + * @brief Create a channelPut for each channel. */ void connect(); - /** put data to each channel as a double + /** @brief put data to each channel as a double * @param data The array of data for each channel. */ void put(epics::pvData::shared_vector const &data); - /** Get the shared pointer to self. + /** @brief Get the shared pointer to self. * @return The shared pointer. */ PvaClientMultiPutDoublePtr getPtrSelf() @@ -289,7 +290,7 @@ class epicsShareClass PvaClientMultiMonitorDouble : public: POINTER_DEFINITIONS(PvaClientMultiMonitorDouble); - /** Factory method that creates a PvaClientMultiMonitorDouble. + /** @brief Create a PvaClientMultiMonitorDouble. * @param pvaClientMultiChannel The interface to PvaClientMultiChannel. * @param pvaClientChannelArray The PvaClientChannel array. * @return The interface. @@ -299,17 +300,18 @@ public: PvaClientChannelArray const &pvaClientChannelArray); ~PvaClientMultiMonitorDouble(); /** - * Create a channel monitor for each channel. - */ + * @brief Connect a channel monitor for each channel. + */ void connect(); /** - * poll each channel. + * @brief Poll each channel. + * * If any has new data it is used to update the double[]. * @return (false,true) if (no, at least one) value was updated. */ bool poll(); /** - * Wait until poll returns true. + * @brief Wait until poll returns true. * @param secondsToWait The time to keep trying. * A thread sleep of .1 seconds occurs between each call to poll. * @return (false,true) if (timeOut, poll returned true). @@ -320,7 +322,7 @@ public: * @return The double[] where each element is the value field of the corresponding channel. */ epics::pvData::shared_vector get(); - /** Monitor the shared pointer to self. + /** @brief Monitor the shared pointer to self. * @return The shared pointer. */ PvaClientMultiMonitorDoublePtr getPtrSelf() @@ -356,7 +358,7 @@ class epicsShareClass PvaClientNTMultiGet : public: POINTER_DEFINITIONS(PvaClientNTMultiGet); /** - * Factory method that creates a PvaClientNTMultiGet. + * @brief Create a PvaClientNTMultiGet. * @param pvaClientMultiChannel The interface to PvaClientMultiChannel. * @param pvaClientChannelArray The PvaClientChannel array. * @param pvRequest The pvRequest for each channel. @@ -369,19 +371,19 @@ public: ~PvaClientNTMultiGet(); /** - * Create a channelGet for each channel. - */ + * @brief Connect a channelGet for each channel. + */ void connect(); /** - * get data for each channel. + * @brief Get each channel. */ void get(); /** - * get the data. + * @brief Get the data from the last get. * @return the pvaClientNTMultiData. */ PvaClientNTMultiDataPtr getData(); - /** Get the shared pointer to self. + /** @brief Get the shared pointer to self. * @return The shared pointer. */ PvaClientNTMultiGetPtr getPtrSelf() @@ -421,7 +423,7 @@ class epicsShareClass PvaClientNTMultiPut : public: POINTER_DEFINITIONS(PvaClientNTMultiPut); /** - * Factory method that creates a PvaClientNTMultiPut. + * @brief Create a PvaClientNTMultiPut. * @param pvaClientMultiChannel The interface to PvaClientMultiChannel. * @param pvaClientChannelArray The PvaClientChannel array. * @return The interface. @@ -432,19 +434,19 @@ public: ~PvaClientNTMultiPut(); /** - * Create a channelPut for each channel. + * @brief Connect a channelPut for each channel. */ void connect(); /** - * get the value field of each channel as a union. + * @brief Get the value field of each channel as a union. * @return A shared vector of union. */ epics::pvData::shared_vector getValues(); /** - * put the data to each channel. + * @brief Issue a put for each channel. ' */ void put(); - /** Get the shared pointer to self. + /** @brief Get the shared pointer to self. * @return The shared pointer. */ PvaClientNTMultiPutPtr getPtrSelf() @@ -480,7 +482,7 @@ class epicsShareClass PvaClientNTMultiMonitor : public: POINTER_DEFINITIONS(PvaClientNTMultiMonitor); - /** Factory method that creates a PvaClientNTMultiMonitor. + /** @brief Create a PvaClientNTMultiMonitor. * @param pvaClientMultiChannel The interface to PvaClientMultiChannel. * @param pvaClientChannelArray The PvaClientChannel array. * @param pvRequest The pvRequest for each channel. @@ -492,24 +494,25 @@ public: epics::pvData::PVStructurePtr const & pvRequest); ~PvaClientNTMultiMonitor(); /** - * Create a channel monitor for each channel. + * @brief Connect to a channel monitor for each channel. */ void connect(); /** - * poll each channel. + * @brief Poll each channel. + * * If any has new data it is used to update the double[]. * @return (false,true) if (no, at least one) value was updated. */ bool poll(); /** - * Wait until poll returns true. + * @brief Wait until poll returns true. * @param secondsToWait The time to keep trying. * A thread sleep of .1 seconds occurs between each call to poll. * @return (false,true) if (timeOut, poll returned true). */ bool waitEvent(double secondsToWait); /** - * get the data. + * @brief Get the data for the last successfull poll. * @return the pvaClientNTMultiData. */ PvaClientNTMultiDataPtr getData(); @@ -551,7 +554,8 @@ class epicsShareClass PvaClientNTMultiData : public: POINTER_DEFINITIONS(PvaClientNTMultiData); /** - * Factory method that creates a PvaClientNTMultiData. + * @brief Create a PvaClientNTMultiData. + * * Normally only called by PvaClientNTMultiGet and PvaClientNTMultiMonitor. * @param u The union interface for the value field of each channel. * @param pvaClientMultiChannel The interface to PvaClientMultiChannel. @@ -566,31 +570,31 @@ public: ~PvaClientNTMultiData(); /** - * Get the number of channels. + * @brief Get the number of channels. * @return The number of channels. */ size_t getNumber(); /** - * Set the timeStamp base for computing deltaTimes. + * @brief Set the timeStamp base for computing deltaTimes. */ void startDeltaTime(); /** - * Update NTMultiChannel fields. + * @brief Update NTMultiChannel fields. */ void endDeltaTime(); /** - * Get the time when the last get was made. + * @brief Get the time when the last get was made. * @return The timeStamp. */ epics::pvData::TimeStamp getTimeStamp(); /** - * Get the NTMultiChannel. + * @brief Get the NTMultiChannel. * @return The value. */ epics::nt::NTMultiChannelPtr getNTMultiChannel(); - /** Get the shared pointer to self. + /** @brief Get the shared pointer to self. * @return The shared pointer. */ PvaClientNTMultiDataPtr getPtrSelf() diff --git a/src/pvaClientChannel.cpp b/src/pvaClientChannel.cpp index 7045860..4ef0d7d 100644 --- a/src/pvaClientChannel.cpp +++ b/src/pvaClientChannel.cpp @@ -547,9 +547,17 @@ PVStructurePtr PvaClientChannel::rpc( PVStructurePtr PvaClientChannel::rpc( PVStructurePtr const & pvArgument) { - return rpc(pvArgument,pvArgument); + PvaClientRPCPtr rpc = createRPC(); + return rpc->request(pvArgument); } +PvaClientRPCPtr PvaClientChannel::createRPC() +{ + if(connectState!=connected) connect(5.0); + PvaClientPtr yyy = pvaClient.lock(); + if(!yyy) throw std::runtime_error("PvaClient was destroyed"); + return PvaClientRPC::create(yyy,channel); +} PvaClientRPCPtr PvaClientChannel::createRPC(PVStructurePtr const & pvRequest) { diff --git a/src/pvaClientRPC.cpp b/src/pvaClientRPC.cpp index 04d47ce..f58b396 100644 --- a/src/pvaClientRPC.cpp +++ b/src/pvaClientRPC.cpp @@ -72,7 +72,14 @@ public: } }; - +PvaClientRPCPtr PvaClientRPC::create( + PvaClientPtr const &pvaClient, + Channel::shared_pointer const & channel) +{ + StructureConstPtr structure(getFieldCreate()->createStructure()); + PVStructurePtr pvRequest(getPVDataCreate()->createPVStructure(structure)); + return create(pvaClient,channel,pvRequest); +} PvaClientRPCPtr PvaClientRPC::create( PvaClientPtr const &pvaClient, Channel::shared_pointer const & channel,