yet more support for noblock; add ci
This commit is contained in:
10
ci/travis-build.sh
Executable file
10
ci/travis-build.sh
Executable file
@@ -0,0 +1,10 @@
|
||||
#!/bin/sh
|
||||
set -e -x
|
||||
|
||||
make -j2
|
||||
|
||||
if [ "$TEST" != "NO" ]
|
||||
then
|
||||
make tapfiles
|
||||
find . -name '*.tap' -print0 | xargs -0 -n1 prove -e cat -f
|
||||
fi
|
||||
69
ci/travis-prepare.sh
Executable file
69
ci/travis-prepare.sh
Executable file
@@ -0,0 +1,69 @@
|
||||
#!/bin/sh
|
||||
set -e -x
|
||||
|
||||
cat << EOF > configure/RELEASE.local
|
||||
EPICS_BASE=$HOME/.source/epics-base
|
||||
PVDATA=$HOME/.source/pvDataCPP
|
||||
EOF
|
||||
cat configure/RELEASE.local
|
||||
|
||||
install -d "$HOME/.source"
|
||||
cd "$HOME/.source"
|
||||
|
||||
git clone --quiet --depth 5 --branch "${BRBASE:-master}" https://github.com/${SRCBASE:-epics-base}/epics-base.git epics-base
|
||||
git clone --quiet --depth 5 --branch "${BRPVD:-master}" https://github.com/${SRCPVD:-epics-base}/pvDataCPP.git pvDataCPP
|
||||
|
||||
(cd epics-base && git log -n1 )
|
||||
(cd pvDataCPP && git log -n1 )
|
||||
|
||||
EPICS_HOST_ARCH=`sh epics-base/startup/EpicsHostArch`
|
||||
|
||||
# requires wine and g++-mingw-w64-i686
|
||||
if [ "$WINE" = "32" ]
|
||||
then
|
||||
echo "Cross mingw32"
|
||||
sed -i -e '/CMPLR_PREFIX/d' epics-base/configure/os/CONFIG_SITE.linux-x86.win32-x86-mingw
|
||||
cat << EOF >> epics-base/configure/os/CONFIG_SITE.linux-x86.win32-x86-mingw
|
||||
CMPLR_PREFIX=i686-w64-mingw32-
|
||||
EOF
|
||||
cat << EOF >> epics-base/configure/CONFIG_SITE
|
||||
CROSS_COMPILER_TARGET_ARCHS+=win32-x86-mingw
|
||||
EOF
|
||||
fi
|
||||
|
||||
if [ "$STATIC" = "YES" ]
|
||||
then
|
||||
echo "Build static libraries/executables"
|
||||
cat << EOF >> epics-base/configure/CONFIG_SITE
|
||||
SHARED_LIBRARIES=NO
|
||||
STATIC_BUILD=YES
|
||||
EOF
|
||||
fi
|
||||
|
||||
case "$CMPLR" in
|
||||
clang)
|
||||
echo "Host compiler is clang"
|
||||
cat << EOF >> epics-base/configure/os/CONFIG_SITE.Common.$EPICS_HOST_ARCH
|
||||
GNU = NO
|
||||
CMPLR_CLASS = clang
|
||||
CC = clang
|
||||
CCC = clang++
|
||||
EOF
|
||||
|
||||
# hack
|
||||
sed -i -e 's/CMPLR_CLASS = gcc/CMPLR_CLASS = clang/' epics-base/configure/CONFIG.gnuCommon
|
||||
|
||||
clang --version
|
||||
;;
|
||||
*)
|
||||
echo "Host compiler is default"
|
||||
gcc --version
|
||||
;;
|
||||
esac
|
||||
|
||||
cat << EOF > pvDataCPP/configure/RELEASE.local
|
||||
EPICS_BASE=$HOME/.source/epics-base
|
||||
EOF
|
||||
|
||||
make -j2 -C epics-base
|
||||
make -j2 -C pvDataCPP
|
||||
66
documentation/htmldoxygen/pvaClientPutGetRequester.html
Normal file
66
documentation/htmldoxygen/pvaClientPutGetRequester.html
Normal file
@@ -0,0 +1,66 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
|
||||
<title>PvaClientPutGetRequester</title>
|
||||
<link rel="stylesheet" type="text/css"
|
||||
href="http://epics-pvdata.sourceforge.net/base.css" />
|
||||
<link rel="stylesheet" type="text/css"
|
||||
href="http://epics-pvdata.sourceforge.net/epicsv4.css" />
|
||||
<style type="text/css">
|
||||
/*<![CDATA[*/
|
||||
.about { margin-left: 3em; margin-right: 3em; font-size: .83em}
|
||||
table { margin-left: auto; margin-right: auto }
|
||||
.diagram { text-align: center; margin: 2.5em 0 }
|
||||
span.opt { color: grey }
|
||||
span.nterm { font-style:italic }
|
||||
span.term { font-family:courier }
|
||||
span.user { font-family:courier }
|
||||
span.user:before { content:"<" }
|
||||
span.user:after { content:">" }
|
||||
.nonnorm { font-style:italic }
|
||||
p.ed { color: #AA0000 }
|
||||
span.ed { color: #AA0000 }
|
||||
p.ed.priv { display: inline; }
|
||||
span.ed.priv { display: inline; }
|
||||
/*]]>*/</style>
|
||||
<!-- Script that generates the Table of Contents -->
|
||||
<script type="text/javascript"
|
||||
src="http://epics-pvdata.sourceforge.net/script/tocgen.js">
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<h1>PvaClientPutGetRequester</h1>
|
||||
|
||||
<p>This is a virtual class that can be implemented by a client that uses <b>PvaClientPut</b>.
|
||||
It has the methods:</p>
|
||||
<pre>
|
||||
virtual void channelPutGetConnect(
|
||||
const Status& status,
|
||||
PvaClientPutGetPtr const & clientPutGet) {}
|
||||
virtual void putGetDone(
|
||||
const Status& status,
|
||||
PvaClientPutGetPtr const & clientPutGet) {}
|
||||
virtual void getPutDone(
|
||||
const Status& status,
|
||||
PvaClientPutGetPtr const & clientPutGet) = 0;
|
||||
virtual void getGetDone(
|
||||
const Status& status,
|
||||
PvaClientPutGetPtr const & clientPutGet) = 0;
|
||||
</pre>
|
||||
|
||||
<p>The client must call</p>
|
||||
<pre>
|
||||
pvaClientPutGet->setRequester(shared_from_this());
|
||||
</pre>
|
||||
<p>
|
||||
after creating an instance of PvaClientPutGet.
|
||||
</p>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -73,6 +73,9 @@ typedef std::tr1::shared_ptr<PvaClientPutRequester> PvaClientPutRequesterPtr;
|
||||
typedef std::tr1::weak_ptr<PvaClientPutRequester> PvaClientPutRequesterWPtr;
|
||||
class PvaClientPut;
|
||||
typedef std::tr1::shared_ptr<PvaClientPut> PvaClientPutPtr;
|
||||
class PvaClientPutGetRequester;
|
||||
typedef std::tr1::shared_ptr<PvaClientPutGetRequester> PvaClientPutGetRequesterPtr;
|
||||
typedef std::tr1::weak_ptr<PvaClientPutGetRequester> PvaClientPutGetRequesterWPtr;
|
||||
class PvaClientPutGet;
|
||||
typedef std::tr1::shared_ptr<PvaClientPutGet> PvaClientPutGetPtr;
|
||||
class PvaClientMonitor;
|
||||
@@ -346,7 +349,7 @@ public:
|
||||
* @return The interface.
|
||||
*/
|
||||
PvaClientPutGetPtr createPutGet(epics::pvData::PVStructurePtr const & pvRequest);
|
||||
/** @brief Create a PvaClientPutGet.
|
||||
/** @brief Create a PvaClientArray.
|
||||
*
|
||||
* 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.
|
||||
@@ -946,7 +949,7 @@ public:
|
||||
/** @brief A process request is complete.
|
||||
*
|
||||
* @param status The status returned by the server.
|
||||
* @param clientProcess The PvaClientProcess that issued the request to create a ChannelProcess.
|
||||
* @param clientProcess The PvaClientProcess that issued the process request.
|
||||
*/
|
||||
virtual void processDone(
|
||||
const epics::pvData::Status& status,
|
||||
@@ -1089,7 +1092,7 @@ public:
|
||||
/** @brief A get request is complete.
|
||||
*
|
||||
* @param status The status returned by the server.
|
||||
* @param clientGet The PvaClientGet that issued the request to create a ChannelGet.
|
||||
* @param clientGet The PvaClientGet that issued the get request
|
||||
*/
|
||||
virtual void getDone(
|
||||
const epics::pvData::Status& status,
|
||||
@@ -1237,7 +1240,7 @@ public:
|
||||
/** @brief A get request is complete.
|
||||
*
|
||||
* @param status The status returned by the server.
|
||||
* @param clientPut The PvaClientPut that issued the request to create a ChannelPut.
|
||||
* @param clientPut The PvaClientPut that issued the get request.
|
||||
*/
|
||||
virtual void getDone(
|
||||
const epics::pvData::Status& status,
|
||||
@@ -1247,7 +1250,7 @@ public:
|
||||
/** @brief A put request is complete.
|
||||
*
|
||||
* @param status The status returned by the server.
|
||||
* @param clientPut The PvaClientPut that issued the request to create a ChannelPut.
|
||||
* @param clientPut The PvaClientPut that issued the put request.
|
||||
*/
|
||||
virtual void putDone(
|
||||
const epics::pvData::Status& status,
|
||||
@@ -1383,12 +1386,66 @@ public:
|
||||
class ChannelPutGetRequesterImpl;
|
||||
typedef std::tr1::shared_ptr<ChannelPutGetRequesterImpl> ChannelPutGetRequesterImplPtr;
|
||||
|
||||
/**
|
||||
* @brief Optional client callback.
|
||||
*
|
||||
* <a href = "../htmldoxygen/pvaClientPutGetRequester.html">Overview of PvaClientPutGetRequester</a>
|
||||
*/
|
||||
class epicsShareClass PvaClientPutGetRequester
|
||||
{
|
||||
public:
|
||||
POINTER_DEFINITIONS(PvaClientPutGetRequester);
|
||||
virtual ~PvaClientPutGetRequester() {}
|
||||
/** @brief A channelPutGet has connected.
|
||||
*
|
||||
* @param status The status returned by the server.
|
||||
* @param clientPutGet The PvaClientPutGet that issued the request to create a ChannelPutGet.
|
||||
*/
|
||||
virtual void channelPutGetConnect(
|
||||
const epics::pvData::Status& status,
|
||||
PvaClientPutGetPtr const & clientPutGet)
|
||||
{
|
||||
}
|
||||
/** @brief A putGet request is complete.
|
||||
*
|
||||
* @param status The status returned by the server.
|
||||
* @param clientPutGet The PvaClientPutGet that issued the putGet request.
|
||||
*/
|
||||
virtual void putGetDone(
|
||||
const epics::pvData::Status& status,
|
||||
PvaClientPutGetPtr const & clientPutGet) = 0;
|
||||
/** @brief A getPut request is complete.
|
||||
*
|
||||
* @param status The status returned by the server.
|
||||
* @param clientPutGet The PvaClientPutGet that issued the getPut request.
|
||||
*/
|
||||
virtual void getPutDone(
|
||||
const epics::pvData::Status& status,
|
||||
PvaClientPutGetPtr const & clientPutGet)
|
||||
{
|
||||
}
|
||||
/** @brief A getGet request is complete.
|
||||
*
|
||||
* @param status The status returned by the server.
|
||||
* @param clientPutGet The PvaClientPutGet that issued the getGet request.
|
||||
*/
|
||||
virtual void getGetDone(
|
||||
const epics::pvData::Status& status,
|
||||
PvaClientPutGetPtr const & clientPutGet)
|
||||
{
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @brief An easy to use alternative to ChannelPutGet.
|
||||
*
|
||||
* <a href = "../htmldoxygen/pvaClientPutGet.html">Overview of PvaClientPutGet</a>
|
||||
*/
|
||||
class epicsShareClass PvaClientPutGet
|
||||
class epicsShareClass PvaClientPutGet :
|
||||
public PvaClientChannelStateChangeRequester,
|
||||
public std::tr1::enable_shared_from_this<PvaClientPutGet>
|
||||
{
|
||||
public:
|
||||
POINTER_DEFINITIONS(PvaClientPutGet);
|
||||
@@ -1400,12 +1457,16 @@ public:
|
||||
*/
|
||||
static PvaClientPutGetPtr create(
|
||||
PvaClientPtr const &pvaClient,
|
||||
epics::pvAccess::Channel::shared_pointer const & channel,
|
||||
PvaClientChannelPtr const & pvaClientChannel,
|
||||
epics::pvData::PVStructurePtr const &pvRequest
|
||||
);
|
||||
/** @brief Destructor
|
||||
*/
|
||||
~PvaClientPutGet();
|
||||
/** @brief Set a user callback.
|
||||
* @param pvaClientPutGetRequester The requester which must be implemented by the caller.
|
||||
*/
|
||||
void setRequester(PvaClientPutGetRequesterPtr const & pvaClientPutGetRequester);
|
||||
|
||||
/** @brief Call issueConnect and then waitConnect.
|
||||
*
|
||||
@@ -1470,6 +1531,11 @@ public:
|
||||
* @return The interface.
|
||||
*/
|
||||
PvaClientGetDataPtr getGetData();
|
||||
/** @brief Get the PvaClientChannel;
|
||||
*
|
||||
* @return The interface.
|
||||
*/
|
||||
PvaClientChannelPtr getPvaClientChannel();
|
||||
private :
|
||||
std::string getRequesterName();
|
||||
void message(std::string const & message,epics::pvData::MessageType messageType);
|
||||
@@ -1496,13 +1562,13 @@ private :
|
||||
|
||||
PvaClientPutGet(
|
||||
PvaClientPtr const &pvaClient,
|
||||
epics::pvAccess::Channel::shared_pointer const & channel,
|
||||
PvaClientChannelPtr const & pvaClientChannel,
|
||||
epics::pvData::PVStructurePtr const &pvRequest);
|
||||
void checkPutGetState();
|
||||
enum PutGetConnectState {connectIdle,connectActive,connected};
|
||||
|
||||
PvaClient::weak_pointer pvaClient;
|
||||
epics::pvAccess::Channel::weak_pointer channel;
|
||||
PvaClientChannelPtr pvaClientChannel;
|
||||
epics::pvData::PVStructurePtr pvRequest;
|
||||
epics::pvData::Mutex mutex;
|
||||
epics::pvData::Event waitForConnect;
|
||||
@@ -1518,6 +1584,10 @@ private :
|
||||
enum PutGetState {putGetIdle,putGetActive,putGetComplete};
|
||||
PutGetState putGetState;
|
||||
ChannelPutGetRequesterImplPtr channelPutGetRequester;
|
||||
PvaClientChannelStateChangeRequesterWPtr pvaClientChannelStateChangeRequester;
|
||||
PvaClientPutGetRequesterWPtr pvaClientPutGetRequester;
|
||||
public:
|
||||
void channelStateChange(PvaClientChannelPtr const & pvaClientChannel, bool isConnected);
|
||||
friend class ChannelPutGetRequesterImpl;
|
||||
};
|
||||
|
||||
|
||||
@@ -430,7 +430,7 @@ PvaClientPutGetPtr PvaClientChannel::createPutGet(PVStructurePtr const & pvReque
|
||||
if(connectState!=connected) connect(5.0);
|
||||
PvaClientPtr yyy = pvaClient.lock();
|
||||
if(!yyy) throw std::runtime_error("PvaClient was destroyed");
|
||||
return PvaClientPutGet::create(yyy,channel,pvRequest);
|
||||
return PvaClientPutGet::create(yyy,shared_from_this(),pvRequest);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -51,9 +51,12 @@ PvaClientGetDataPtr PvaClientGetData::create(StructureConstPtr const & structure
|
||||
}
|
||||
|
||||
PvaClientGetData::PvaClientGetData(StructureConstPtr const & structure)
|
||||
: structure(structure)
|
||||
: structure(structure),
|
||||
pvStructure(getPVDataCreate()->createPVStructure(structure)),
|
||||
bitSet(BitSetPtr(new BitSet(pvStructure->getNumberFields())))
|
||||
{
|
||||
messagePrefix = "";
|
||||
pvValue = pvStructure->getSubField("value");
|
||||
}
|
||||
|
||||
void PvaClientGetData::checkValue()
|
||||
|
||||
@@ -256,6 +256,10 @@ void PvaClientMonitor::monitorConnect(
|
||||
cout << "PvaClientMonitor::monitorConnect calling waitForConnect.signal\n";
|
||||
}
|
||||
waitForConnect.signal();
|
||||
if(PvaClient::getDebug()) {
|
||||
cout << "PvaClientMonitor::monitorConnect calling start\n";
|
||||
}
|
||||
start();
|
||||
} else {
|
||||
if(PvaClient::getDebug()) {
|
||||
cout << "PvaClientMonitor::monitorConnect calling start\n";
|
||||
@@ -339,7 +343,8 @@ Status PvaClientMonitor::waitConnect()
|
||||
connectState = monitorConnectStatus.isOK() ? connected : connectIdle;
|
||||
if(PvaClient::getDebug()) {
|
||||
cout << "PvaClientMonitor::waitConnect"
|
||||
<< " monitorConnectStatus " << (monitorConnectStatus.isOK() ? "connected" : "not connected");
|
||||
<< " monitorConnectStatus " << (monitorConnectStatus.isOK() ? "connected" : "not connected")
|
||||
<< endl;
|
||||
}
|
||||
return monitorConnectStatus;
|
||||
}
|
||||
@@ -410,7 +415,6 @@ void PvaClientMonitor::start(string const & request)
|
||||
new MonitorRequesterImpl(shared_from_this(),client));
|
||||
pvRequest = pvr;
|
||||
connect();
|
||||
start();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -70,7 +70,7 @@ public:
|
||||
clientPut->getDone(status,channelPut,pvStructure,bitSet);
|
||||
}
|
||||
|
||||
virtual void putDone(
|
||||
virtual void putDone(
|
||||
const Status& status,
|
||||
ChannelPut::shared_pointer const & channelPut)
|
||||
{
|
||||
|
||||
@@ -96,28 +96,28 @@ public:
|
||||
|
||||
PvaClientPutGetPtr PvaClientPutGet::create(
|
||||
PvaClientPtr const &pvaClient,
|
||||
Channel::shared_pointer const & channel,
|
||||
PvaClientChannelPtr const & pvaClientChannel,
|
||||
PVStructurePtr const &pvRequest)
|
||||
{
|
||||
PvaClientPutGetPtr epv(new PvaClientPutGet(pvaClient,channel,pvRequest));
|
||||
epv->channelPutGetRequester = ChannelPutGetRequesterImplPtr(
|
||||
new ChannelPutGetRequesterImpl(epv,pvaClient));
|
||||
return epv;
|
||||
PvaClientPutGetPtr clientPutGet(new PvaClientPutGet(pvaClient,pvaClientChannel,pvRequest));
|
||||
clientPutGet->channelPutGetRequester = ChannelPutGetRequesterImplPtr(
|
||||
new ChannelPutGetRequesterImpl(clientPutGet,pvaClient));
|
||||
return clientPutGet;
|
||||
}
|
||||
|
||||
PvaClientPutGet::PvaClientPutGet(
|
||||
PvaClientPtr const &pvaClient,
|
||||
Channel::shared_pointer const & channel,
|
||||
PvaClientChannelPtr const & pvaClientChannel,
|
||||
PVStructurePtr const &pvRequest)
|
||||
: pvaClient(pvaClient),
|
||||
channel(channel),
|
||||
pvaClientChannel(pvaClientChannel),
|
||||
pvRequest(pvRequest),
|
||||
connectState(connectIdle),
|
||||
putGetState(putGetIdle)
|
||||
{
|
||||
if(PvaClient::getDebug()) {
|
||||
cout<< "PvaClientPutGet::PvaClientPutGet"
|
||||
<< " channelName " << channel->getChannelName()
|
||||
<< " channelName " << pvaClientChannel->getChannel()->getChannelName()
|
||||
<< endl;
|
||||
}
|
||||
}
|
||||
@@ -125,20 +125,46 @@ PvaClientPutGet::PvaClientPutGet(
|
||||
PvaClientPutGet::~PvaClientPutGet()
|
||||
{
|
||||
if(PvaClient::getDebug()) {
|
||||
string channelName("disconnected");
|
||||
Channel::shared_pointer chan(channel.lock());
|
||||
if(chan) channelName = chan->getChannelName();
|
||||
cout<< "PvaClientPutGet::~PvaClientPutGet"
|
||||
<< " channelName " << channelName
|
||||
<< " channelName " << pvaClientChannel->getChannel()->getChannelName()
|
||||
<< endl;
|
||||
}
|
||||
}
|
||||
|
||||
void PvaClientPutGet::channelStateChange(PvaClientChannelPtr const & pvaClientChannel, bool isConnected)
|
||||
{
|
||||
if(PvaClient::getDebug()) {
|
||||
cout<< "PvaClientPutGet::channelStateChange"
|
||||
<< " channelName " << pvaClientChannel->getChannel()->getChannelName()
|
||||
<< " isConnected " << (isConnected ? "true" : "false")
|
||||
<< endl;
|
||||
}
|
||||
if(isConnected&&!channelPutGet)
|
||||
{
|
||||
connectState = connectActive;
|
||||
channelPutGet = pvaClientChannel->getChannel()->createChannelPutGet(channelPutGetRequester,pvRequest);
|
||||
}
|
||||
PvaClientChannelStateChangeRequesterPtr req(pvaClientChannelStateChangeRequester.lock());
|
||||
if(req) {
|
||||
req->channelStateChange(pvaClientChannel,isConnected);
|
||||
}
|
||||
}
|
||||
|
||||
void PvaClientPutGet::checkPutGetState()
|
||||
{
|
||||
if(PvaClient::getDebug()) {
|
||||
cout << "PvaClientPutGet::checkPutGetState"
|
||||
<< " channelName " << pvaClientChannel->getChannel()->getChannelName()
|
||||
<< endl;
|
||||
}
|
||||
if(connectState==connectIdle){
|
||||
connect();
|
||||
getPut();
|
||||
connect();
|
||||
}
|
||||
if(connectState==connectActive){
|
||||
string message = string("channel ") + pvaClientChannel->getChannel()->getChannelName()
|
||||
+ " "
|
||||
+ channelPutGetConnectStatus.getMessage();
|
||||
throw std::runtime_error(message);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -164,17 +190,33 @@ void PvaClientPutGet::channelPutGetConnect(
|
||||
{
|
||||
if(PvaClient::getDebug()) {
|
||||
cout << "PvaClientPutGet::channelPutGetConnect"
|
||||
<< " channelName " << channelPutGet->getChannel()->getChannelName()
|
||||
<< " channelName " << pvaClientChannel->getChannel()->getChannelName()
|
||||
<< " status.isOK " << (status.isOK() ? "true" : "false")
|
||||
<< endl;
|
||||
}
|
||||
channelPutGetConnectStatus = status;
|
||||
this->channelPutGet = channelPutGet;
|
||||
if(status.isOK()) {
|
||||
pvaClientPutData = PvaClientPutData::create(putStructure);
|
||||
pvaClientPutData->setMessagePrefix(channelPutGet->getChannel()->getChannelName());
|
||||
pvaClientGetData = PvaClientGetData::create(getStructure);
|
||||
pvaClientGetData->setMessagePrefix(channelPutGet->getChannel()->getChannelName());
|
||||
{
|
||||
Lock xx(mutex);
|
||||
this->channelPutGet = channelPutGet;
|
||||
if(status.isOK()) {
|
||||
channelPutGetConnectStatus = status;
|
||||
connectState = connected;
|
||||
pvaClientPutData = PvaClientPutData::create(putStructure);
|
||||
pvaClientPutData->setMessagePrefix(channelPutGet->getChannel()->getChannelName());
|
||||
pvaClientGetData = PvaClientGetData::create(getStructure);
|
||||
pvaClientGetData->setMessagePrefix(channelPutGet->getChannel()->getChannelName());
|
||||
|
||||
} else {
|
||||
stringstream ss;
|
||||
ss << pvRequest;
|
||||
string message = string("\nPvaClientPutGet::channelPutGetConnect)")
|
||||
+ "\npvRequest\n" + ss.str()
|
||||
+ "\nerror\n" + status.getMessage();
|
||||
channelPutGetConnectStatus = Status(Status::STATUSTYPE_ERROR,message);
|
||||
}
|
||||
}
|
||||
PvaClientPutGetRequesterPtr req(pvaClientPutGetRequester.lock());
|
||||
if(req) {
|
||||
req->channelPutGetConnect(status,shared_from_this());
|
||||
}
|
||||
waitForConnect.signal();
|
||||
|
||||
@@ -187,17 +229,22 @@ void PvaClientPutGet::putGetDone(
|
||||
BitSetPtr const & getChangedBitSet)
|
||||
{
|
||||
if(PvaClient::getDebug()) {
|
||||
string channelName("disconnected");
|
||||
Channel::shared_pointer chan(channel.lock());
|
||||
if(chan) channelName = chan->getChannelName();
|
||||
cout << "PvaClientPutGet::putGetDone"
|
||||
<< " channelName " << channelName
|
||||
<< " channelName " << pvaClientChannel->getChannel()->getChannelName()
|
||||
<< " status.isOK " << (status.isOK() ? "true" : "false")
|
||||
<< endl;
|
||||
}
|
||||
channelPutGetStatus = status;
|
||||
if(status.isOK()) {
|
||||
pvaClientGetData->setData(getPVStructure,getChangedBitSet);
|
||||
PVStructurePtr pvs = pvaClientGetData->getPVStructure();
|
||||
pvs->copyUnchecked(*getPVStructure,*getChangedBitSet);
|
||||
BitSetPtr bs = pvaClientGetData->getChangedBitSet();
|
||||
bs->clear();
|
||||
*bs |= *getChangedBitSet;
|
||||
}
|
||||
PvaClientPutGetRequesterPtr req(pvaClientPutGetRequester.lock());
|
||||
if(req) {
|
||||
req->putGetDone(status,shared_from_this());
|
||||
}
|
||||
waitForPutGet.signal();
|
||||
}
|
||||
@@ -209,11 +256,8 @@ void PvaClientPutGet::getPutDone(
|
||||
BitSetPtr const & putBitSet)
|
||||
{
|
||||
if(PvaClient::getDebug()) {
|
||||
string channelName("disconnected");
|
||||
Channel::shared_pointer chan(channel.lock());
|
||||
if(chan) channelName = chan->getChannelName();
|
||||
cout << "PvaClientPutGet::getPutDone"
|
||||
<< " channelName " << channelName
|
||||
<< " channelName " << pvaClientChannel->getChannel()->getChannelName()
|
||||
<< " status.isOK " << (status.isOK() ? "true" : "false")
|
||||
<< endl;
|
||||
}
|
||||
@@ -225,6 +269,10 @@ void PvaClientPutGet::getPutDone(
|
||||
bs->clear();
|
||||
*bs |= *putBitSet;
|
||||
}
|
||||
PvaClientPutGetRequesterPtr req(pvaClientPutGetRequester.lock());
|
||||
if(req) {
|
||||
req->getPutDone(status,shared_from_this());
|
||||
}
|
||||
waitForPutGet.signal();
|
||||
}
|
||||
|
||||
@@ -235,31 +283,38 @@ void PvaClientPutGet::getGetDone(
|
||||
BitSetPtr const & getChangedBitSet)
|
||||
{
|
||||
if(PvaClient::getDebug()) {
|
||||
string channelName("disconnected");
|
||||
Channel::shared_pointer chan(channel.lock());
|
||||
if(chan) channelName = chan->getChannelName();
|
||||
cout << "PvaClientPutGet::getGetDone"
|
||||
<< " channelName " << channelName
|
||||
<< " channelName " << pvaClientChannel->getChannel()->getChannelName()
|
||||
<< " status.isOK " << (status.isOK() ? "true" : "false")
|
||||
<< endl;
|
||||
}
|
||||
channelPutGetStatus = status;
|
||||
if(status.isOK()) {
|
||||
pvaClientGetData->setData(getPVStructure,getChangedBitSet);
|
||||
PVStructurePtr pvs = pvaClientGetData->getPVStructure();
|
||||
pvs->copyUnchecked(*getPVStructure,*getChangedBitSet);
|
||||
BitSetPtr bs = pvaClientGetData->getChangedBitSet();
|
||||
bs->clear();
|
||||
*bs |= *getChangedBitSet;
|
||||
}
|
||||
PvaClientPutGetRequesterPtr req(pvaClientPutGetRequester.lock());
|
||||
if(req) {
|
||||
req->getGetDone(status,shared_from_this());
|
||||
}
|
||||
waitForPutGet.signal();
|
||||
}
|
||||
|
||||
void PvaClientPutGet::connect()
|
||||
{
|
||||
if(PvaClient::getDebug()) {
|
||||
cout << "PvaClientPutGet::connect"
|
||||
<< " channelName " << pvaClientChannel->getChannel()->getChannelName()
|
||||
<< endl;
|
||||
}
|
||||
issueConnect();
|
||||
Status status = waitConnect();
|
||||
if(status.isOK()) return;
|
||||
Channel::shared_pointer chan(channel.lock());
|
||||
string channelName("disconnected");
|
||||
if(chan) channelName = chan->getChannelName();
|
||||
string message = string("channel ")
|
||||
+ channelName
|
||||
+ pvaClientChannel->getChannel()->getChannelName()
|
||||
+ " PvaClientPutGet::connect "
|
||||
+ status.getMessage();
|
||||
throw std::runtime_error(message);
|
||||
@@ -267,24 +322,29 @@ void PvaClientPutGet::connect()
|
||||
|
||||
void PvaClientPutGet::issueConnect()
|
||||
{
|
||||
Channel::shared_pointer chan(channel.lock());
|
||||
if(PvaClient::getDebug()) {
|
||||
cout << "PvaClientPutGet::issueConnect"
|
||||
<< " channelName " << pvaClientChannel->getChannel()->getChannelName()
|
||||
<< endl;
|
||||
}
|
||||
if(connectState!=connectIdle) {
|
||||
string channelName("disconnected");
|
||||
if(chan) channelName = chan->getChannelName();
|
||||
string message = string("channel ") + channelName
|
||||
string message = string("channel ")
|
||||
+ pvaClientChannel->getChannel()->getChannelName()
|
||||
+ " pvaClientPutGet already connected ";
|
||||
throw std::runtime_error(message);
|
||||
}
|
||||
if(chan) {
|
||||
connectState = connectActive;
|
||||
channelPutGet = chan->createChannelPutGet(channelPutGetRequester,pvRequest);
|
||||
return;
|
||||
}
|
||||
throw std::runtime_error("PvaClientPutGet::issueConnect() but channel disconnected");
|
||||
connectState = connectActive;
|
||||
channelPutGetConnectStatus = Status(Status::STATUSTYPE_ERROR, "connect active");
|
||||
channelPutGet = pvaClientChannel->getChannel()->createChannelPutGet(channelPutGetRequester,pvRequest);
|
||||
}
|
||||
|
||||
Status PvaClientPutGet::waitConnect()
|
||||
{
|
||||
if(PvaClient::getDebug()) {
|
||||
cout << "PvaClientPutGet::waitConnect"
|
||||
<< " channelName " << pvaClientChannel->getChannel()->getChannelName()
|
||||
<< endl;
|
||||
}
|
||||
{
|
||||
Lock xx(mutex);
|
||||
if(connectState==connected) {
|
||||
@@ -292,30 +352,30 @@ Status PvaClientPutGet::waitConnect()
|
||||
return channelPutGetConnectStatus;
|
||||
}
|
||||
if(connectState!=connectActive) {
|
||||
Channel::shared_pointer chan(channel.lock());
|
||||
string channelName("disconnected");
|
||||
if(chan) channelName = chan->getChannelName();
|
||||
string message = string("channel ") + channelName
|
||||
string message = string("channel ")
|
||||
+ pvaClientChannel->getChannel()->getChannelName()
|
||||
+ " PvaClientPutGet::waitConnect illegal connect state ";
|
||||
throw std::runtime_error(message);
|
||||
}
|
||||
}
|
||||
waitForConnect.wait();
|
||||
connectState = channelPutGetConnectStatus.isOK() ? connected : connectIdle;
|
||||
if(!channelPutGetConnectStatus.isOK()) connectState = connectIdle;
|
||||
return channelPutGetConnectStatus;
|
||||
}
|
||||
|
||||
|
||||
void PvaClientPutGet::putGet()
|
||||
{
|
||||
if(PvaClient::getDebug()) {
|
||||
cout << "PvaClientPutGet::putGet"
|
||||
<< " channelName " << pvaClientChannel->getChannel()->getChannelName()
|
||||
<< endl;
|
||||
}
|
||||
issuePutGet();
|
||||
Status status = waitPutGet();
|
||||
if(status.isOK()) return;
|
||||
Channel::shared_pointer chan(channel.lock());
|
||||
string channelName("disconnected");
|
||||
if(chan) channelName = chan->getChannelName();
|
||||
string message = string("channel ")
|
||||
+ channelName
|
||||
+ pvaClientChannel->getChannel()->getChannelName()
|
||||
+ " PvaClientPut::putGet "
|
||||
+ status.getMessage();
|
||||
throw std::runtime_error(message);
|
||||
@@ -323,12 +383,15 @@ void PvaClientPutGet::putGet()
|
||||
|
||||
void PvaClientPutGet::issuePutGet()
|
||||
{
|
||||
if(PvaClient::getDebug()) {
|
||||
cout << "PvaClientPutGet::issuePutGet"
|
||||
<< " channelName " << pvaClientChannel->getChannel()->getChannelName()
|
||||
<< endl;
|
||||
}
|
||||
if(connectState==connectIdle) connect();
|
||||
if(putGetState!=putGetIdle) {
|
||||
Channel::shared_pointer chan(channel.lock());
|
||||
string channelName("disconnected");
|
||||
if(chan) channelName = chan->getChannelName();
|
||||
string message = string("channel ") + channelName
|
||||
if(putGetState==putGetActive) {
|
||||
string message = string("channel ")
|
||||
+ pvaClientChannel->getChannel()->getChannelName()
|
||||
+ " PvaClientPutGet::issuePutGet get or put aleady active ";
|
||||
throw std::runtime_error(message);
|
||||
}
|
||||
@@ -339,29 +402,35 @@ void PvaClientPutGet::issuePutGet()
|
||||
|
||||
Status PvaClientPutGet::waitPutGet()
|
||||
{
|
||||
if(PvaClient::getDebug()) {
|
||||
cout << "PvaClientPutGet::waitPutGet"
|
||||
<< " channelName " << pvaClientChannel->getChannel()->getChannelName()
|
||||
<< endl;
|
||||
}
|
||||
if(putGetState!=putGetActive){
|
||||
Channel::shared_pointer chan(channel.lock());
|
||||
string channelName("disconnected");
|
||||
if(chan) channelName = chan->getChannelName();
|
||||
string message = string("channel ") + channelName
|
||||
string message = string("channel ")
|
||||
+ pvaClientChannel->getChannel()->getChannelName()
|
||||
+ " PvaClientPutGet::waitPutGet get or put aleady active ";
|
||||
throw std::runtime_error(message);
|
||||
}
|
||||
waitForPutGet.wait();
|
||||
putGetState = putGetIdle;
|
||||
putGetState = putGetComplete;
|
||||
if(channelPutGetStatus.isOK()) pvaClientPutData->getChangedBitSet()->clear();
|
||||
return channelPutGetStatus;
|
||||
}
|
||||
|
||||
void PvaClientPutGet::getGet()
|
||||
{
|
||||
if(PvaClient::getDebug()) {
|
||||
cout << "PvaClientPutGet::getGet"
|
||||
<< " channelName " << pvaClientChannel->getChannel()->getChannelName()
|
||||
<< endl;
|
||||
}
|
||||
issueGetGet();
|
||||
Status status = waitGetGet();
|
||||
if(status.isOK()) return;
|
||||
Channel::shared_pointer chan(channel.lock());
|
||||
string channelName("disconnected");
|
||||
if(chan) channelName = chan->getChannelName();
|
||||
string message = string("channel ")
|
||||
+ channelName
|
||||
+ pvaClientChannel->getChannel()->getChannelName()
|
||||
+ " PvaClientPut::getGet "
|
||||
+ status.getMessage();
|
||||
throw std::runtime_error(message);
|
||||
@@ -369,12 +438,15 @@ void PvaClientPutGet::getGet()
|
||||
|
||||
void PvaClientPutGet::issueGetGet()
|
||||
{
|
||||
if(PvaClient::getDebug()) {
|
||||
cout << "PvaClientPutGet::issueGetGet"
|
||||
<< " channelName " << pvaClientChannel->getChannel()->getChannelName()
|
||||
<< endl;
|
||||
}
|
||||
if(connectState==connectIdle) connect();
|
||||
if(putGetState!=putGetIdle) {
|
||||
Channel::shared_pointer chan(channel.lock());
|
||||
string channelName("disconnected");
|
||||
if(chan) channelName = chan->getChannelName();
|
||||
string message = string("channel ") + channelName
|
||||
if(putGetState==putGetActive) {
|
||||
string message = string("channel ")
|
||||
+ pvaClientChannel->getChannel()->getChannelName()
|
||||
+ " PvaClientPutGet::issueGetGet get or put aleady active ";
|
||||
throw std::runtime_error(message);
|
||||
}
|
||||
@@ -384,29 +456,34 @@ void PvaClientPutGet::issueGetGet()
|
||||
|
||||
Status PvaClientPutGet::waitGetGet()
|
||||
{
|
||||
if(PvaClient::getDebug()) {
|
||||
cout << "PvaClientPutGet::waitGetGet"
|
||||
<< " channelName " << pvaClientChannel->getChannel()->getChannelName()
|
||||
<< endl;
|
||||
}
|
||||
if(putGetState!=putGetActive){
|
||||
Channel::shared_pointer chan(channel.lock());
|
||||
string channelName("disconnected");
|
||||
if(chan) channelName = chan->getChannelName();
|
||||
string message = string("channel ") + channelName
|
||||
string message = string("channel ")
|
||||
+ pvaClientChannel->getChannel()->getChannelName()
|
||||
+ " PvaClientPutGet::waitGetGet get or put aleady active ";
|
||||
throw std::runtime_error(message);
|
||||
}
|
||||
waitForPutGet.wait();
|
||||
putGetState = putGetIdle;
|
||||
putGetState = putGetComplete;
|
||||
return channelPutGetStatus;
|
||||
}
|
||||
|
||||
void PvaClientPutGet::getPut()
|
||||
{
|
||||
if(PvaClient::getDebug()) {
|
||||
cout << "PvaClientPutGet::getGetPut"
|
||||
<< " channelName " << pvaClientChannel->getChannel()->getChannelName()
|
||||
<< endl;
|
||||
}
|
||||
issueGetPut();
|
||||
Status status = waitGetPut();
|
||||
if(status.isOK()) return;
|
||||
Channel::shared_pointer chan(channel.lock());
|
||||
string channelName("disconnected");
|
||||
if(chan) channelName = chan->getChannelName();
|
||||
string message = string("channel ")
|
||||
+ channelName
|
||||
+ pvaClientChannel->getChannel()->getChannelName()
|
||||
+ " PvaClientPut::getPut "
|
||||
+ status.getMessage();
|
||||
throw std::runtime_error(message);
|
||||
@@ -414,12 +491,15 @@ void PvaClientPutGet::getPut()
|
||||
|
||||
void PvaClientPutGet::issueGetPut()
|
||||
{
|
||||
if(PvaClient::getDebug()) {
|
||||
cout << "PvaClientPutGet::issueGetPut"
|
||||
<< " channelName " << pvaClientChannel->getChannel()->getChannelName()
|
||||
<< endl;
|
||||
}
|
||||
if(connectState==connectIdle) connect();
|
||||
if(putGetState!=putGetIdle) {
|
||||
Channel::shared_pointer chan(channel.lock());
|
||||
string channelName("disconnected");
|
||||
if(chan) channelName = chan->getChannelName();
|
||||
string message = string("channel ") + channelName
|
||||
if(putGetState==putGetActive) {
|
||||
string message = string("channel ")
|
||||
+ pvaClientChannel->getChannel()->getChannelName()
|
||||
+ " PvaClientPutGet::issueGetPut get or put aleady active ";
|
||||
throw std::runtime_error(message);
|
||||
}
|
||||
@@ -429,29 +509,62 @@ void PvaClientPutGet::issueGetPut()
|
||||
|
||||
Status PvaClientPutGet::waitGetPut()
|
||||
{
|
||||
if(PvaClient::getDebug()) {
|
||||
cout << "PvaClientPutGet::waitGetPut"
|
||||
<< " channelName " << pvaClientChannel->getChannel()->getChannelName()
|
||||
<< endl;
|
||||
}
|
||||
if(putGetState!=putGetActive){
|
||||
Channel::shared_pointer chan(channel.lock());
|
||||
string channelName("disconnected");
|
||||
if(chan) channelName = chan->getChannelName();
|
||||
string message = string("channel ") + channelName
|
||||
string message = string("channel ")
|
||||
+ pvaClientChannel->getChannel()->getChannelName()
|
||||
+ " PvaClientPutGet::waitGetPut get or put aleady active ";
|
||||
throw std::runtime_error(message);
|
||||
}
|
||||
waitForPutGet.wait();
|
||||
putGetState = putGetIdle;
|
||||
putGetState = putGetComplete;
|
||||
return channelPutGetStatus;
|
||||
}
|
||||
|
||||
PvaClientGetDataPtr PvaClientPutGet::getGetData()
|
||||
{
|
||||
if(PvaClient::getDebug()) {
|
||||
cout<< "PvaClientPutGet::getGetData"
|
||||
<< " channelName " << pvaClientChannel->getChannel()->getChannelName()
|
||||
<< endl;
|
||||
}
|
||||
checkPutGetState();
|
||||
if(putGetState==putGetIdle) getGet();
|
||||
return pvaClientGetData;
|
||||
}
|
||||
|
||||
PvaClientPutDataPtr PvaClientPutGet::getPutData()
|
||||
{
|
||||
if(PvaClient::getDebug()) {
|
||||
cout<< "PvaClientPutGet::getPutData"
|
||||
<< " channelName " << pvaClientChannel->getChannel()->getChannelName()
|
||||
<< endl;
|
||||
}
|
||||
checkPutGetState();
|
||||
if(putGetState==putGetIdle) getPut();
|
||||
return pvaClientPutData;
|
||||
}
|
||||
|
||||
void PvaClientPutGet::setRequester(PvaClientPutGetRequesterPtr const & pvaClientPutGetRequester)
|
||||
{
|
||||
if(PvaClient::getDebug()) {
|
||||
cout << "PvaClientPutGet::setRequester"
|
||||
<< " channelName " << pvaClientChannel->getChannel()->getChannelName()
|
||||
<< endl;
|
||||
}
|
||||
this->pvaClientPutGetRequester = pvaClientPutGetRequester;
|
||||
}
|
||||
|
||||
|
||||
PvaClientChannelPtr PvaClientPutGet::getPvaClientChannel()
|
||||
{
|
||||
return pvaClientChannel;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}}
|
||||
|
||||
Reference in New Issue
Block a user