Merge pull request #29 from mrkraimer/master

mostly code cleanup
This commit is contained in:
Marty Kraimer
2016-07-07 08:43:07 -04:00
committed by GitHub
21 changed files with 104 additions and 264 deletions

78
LICENSE
View File

@ -1,78 +0,0 @@
Copyright (c) 2008 Martin R. Kraimer
Copyright (c) 2006 The University of Chicago, as Operator of Argonne
National Laboratory.
Copyright (c) 2006 Deutsches Elektronen-Synchrotron,
Member of the Helmholtz Association, (DESY), HAMBURG, GERMANY.
Copyright (c) 2007 Control System Laboratory,
(COSYLAB) Ljubljana Slovenia
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
________________________________________________________________________
This software is in part copyrighted by the University of Chicago (UofC)
In no event shall UofC be liable to any party for direct, indirect,
special, incidental, or consequential damages arising out of the use of
this software, its documentation, or any derivatives thereof, even if
UofC has been advised of the possibility of such damage.
UofC specifically disclaims any warranties, including, but not limited
to, the implied warranties of merchantability, fitness for a particular
purpose, and non-infringement. This software is provided on an "as is"
basis, and UofC has no obligation to provide maintenance, support,
updates, enhancements, or modifications.
________________________________________________________________________
This software is in part copyrighted by the BERLINER SPEICHERRING
GESELLSCHAFT FUER SYNCHROTRONSTRAHLUNG M.B.H. (BESSY), BERLIN, GERMANY.
In no event shall BESSY be liable to any party for direct, indirect,
special, incidental, or consequential damages arising out of the use of
this software, its documentation, or any derivatives thereof, even if
BESSY has been advised of the possibility of such damage.
BESSY specifically disclaims any warranties, including, but not limited
to, the implied warranties of merchantability, fitness for a particular
purpose, and non-infringement. This software is provided on an "as is"
basis, and BESSY has no obligation to provide maintenance, support,
updates, enhancements, or modifications.
________________________________________________________________________
This software is in part copyrighted by the Deutsches Elektronen-Synchroton,
Member of the Helmholtz Association, (DESY), HAMBURG, GERMANY.
In no event shall DESY be liable to any party for direct, indirect,
special, incidental, or consequential damages arising out of the use of
this software, its documentation, or any derivatives thereof, even if
DESY has been advised of the possibility of such damage.
DESY specifically disclaims any warranties, including, but not limited
to, the implied warranties of merchantability, fitness for a particular
purpose, and non-infringement. This software is provided on an "as is"
basis, and DESY has no obligation to provide maintenance, support,
updates, enhancements, or modifications.
________________________________________________________________________

65
LICENSE.txt Normal file
View File

@ -0,0 +1,65 @@
Copyright and License Terms
---------------------------
Copyright (c) 2006-2016 Martin R. Kraimer
Copyright (c) 2006-2016 UChicago Argonne LLC, as Operator of Argonne
National Laboratory.
Copyright (c) 2006 Deutsches Elektronen-Synchrotron,
Member of the Helmholtz Association, (DESY), HAMBURG, GERMANY.
Copyright (c) 2007-2016 Control System Laboratory,
(COSYLAB) Ljubljana Slovenia
Copyright (c) 2010-2016 Brookhaven Science Associates, as Operator
of Brookhaven National Laboratory
Copyright (c) 2011-2016 Diamond Light Source Limited,
(DLS) Didcot, United Kingdom
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
________________________________________________________________________
Additional Disclaimers
----------------------
This software is copyright in part by these institutions:
* Berliner Speicherring Gesellschaft fuer Synchrotronstrahlung M.B.H.,
Berlin, Germany
* Brookhaven Science Associates, as Operator of Brookhaven
National Laboratory, New York, USA
* Control System Laboratory, Ljubljana, Slovenia
* Deutsches Elektronen-Synchroton, Member of the Helmholtz
Association, Hamburg, Germany
* Diamond Light Source Limited, Didcot, United Kingdom
* UChicage Argonne LLC, as Operator of Argonne National Laboratory,
Illinois, USA
In no event shall these institutions be liable to any party for direct,
indirect, special, incidental, or consequential damages arising out of
the use of this software, its documentation, or any derivatives thereof,
even if advised of the possibility of such damage.
These institutions specifically disclaim any warranties, including, but
not limited to, the implied warranties of merchantability, fitness for a
particular purpose, and non-infringement. This software is provided on
an "as is" basis, and these institutions have no obligation to provide
maintenance, support, updates, enhancements, or modifications.

View File

@ -180,7 +180,6 @@ private:
PvaClient(std::string const & providerNames);
PvaClientChannelCachePtr pvaClientChannelCache;
epics::pvData::Requester::weak_pointer requester;
bool isDestroyed;
bool pvaStarted;
bool caStarted;
epics::pvData::Mutex mutex;
@ -198,7 +197,7 @@ class ChannelRequesterImpl;
typedef std::tr1::shared_ptr<ChannelRequesterImpl> ChannelRequesterImplPtr;
/**
* @brief An easy to be notified of a change in connection status.
* @brief A callback for change in connection status.
*
* @author mrk
*/
@ -393,9 +392,9 @@ public:
*/
epics::pvData::PVStructurePtr rpc(
epics::pvData::PVStructurePtr const & pvArgument);
/** Create an PvaClientRPC.
/** Create a PvaClientRPC.
* @param pvRequest The pvRequest that must have the same interface
* as a pvArgument that is passed to an rpcq request.
* as a pvArgument that is passed to an rpc request.
* @return The interface.
* @throw runtime_error if failure.
*/
@ -438,7 +437,6 @@ private:
std::string channelName;
std::string providerName;
ConnectState connectState;
bool isDestroyed;
epics::pvData::CreateRequest::shared_pointer createRequest;
PvaClientGetCachePtr pvaClientGetCache;
@ -949,7 +947,6 @@ private:
epics::pvData::Event waitForConnect;
epics::pvData::Event waitForProcess;
bool isDestroyed;
epics::pvData::Status channelProcessConnectStatus;
epics::pvData::Status channelProcessStatus;
epics::pvAccess::ChannelProcess::shared_pointer channelProcess;
@ -1053,7 +1050,6 @@ private:
PvaClientGetDataPtr pvaClientData;
std::string messagePrefix;
bool isDestroyed;
epics::pvData::Status channelGetConnectStatus;
epics::pvData::Status channelGetStatus;
epics::pvAccess::ChannelGet::shared_pointer channelGet;
@ -1172,7 +1168,6 @@ private :
epics::pvData::Event waitForGetPut;
PvaClientPutDataPtr pvaClientData;
bool isDestroyed;
epics::pvData::Status channelPutConnectStatus;
epics::pvData::Status channelGetPutStatus;
epics::pvAccess::ChannelPut::shared_pointer channelPut;
@ -1314,7 +1309,6 @@ private :
PvaClientGetDataPtr pvaClientGetData;
PvaClientPutDataPtr pvaClientPutData;
bool isDestroyed;
epics::pvData::Status channelPutGetConnectStatus;
epics::pvData::Status channelPutGetStatus;
epics::pvAccess::ChannelPutGet::shared_pointer channelPutGet;
@ -1452,7 +1446,6 @@ private:
epics::pvData::Event waitForEvent;
PvaClientMonitorDataPtr pvaClientData;
bool isDestroyed;
bool isStarted;
epics::pvData::Status connectStatus;
epics::pvData::MonitorPtr monitor;
@ -1561,13 +1554,9 @@ private:
void checkRPCState();
enum RPCConnectState {connectIdle,connectActive,connected};
bool isDestroyed;
epics::pvData::Status connectStatus;
RPCConnectState connectState;
enum RPCState {rpcIdle,rpcActive,rpcComplete};
RPCState rpcState;
PvaClient::weak_pointer pvaClient;
epics::pvAccess::Channel::weak_pointer channel;
epics::pvData::PVStructurePtr pvRequest;

View File

@ -168,8 +168,6 @@ private:
PvaClientChannelArray pvaClientChannelArray;
epics::pvData::shared_vector<epics::pvData::boolean> isConnected;
epics::pvData::CreateRequest::shared_pointer createRequest;
bool isDestroyed;
};
/**
@ -227,7 +225,6 @@ private:
epics::pvData::shared_vector<double> doubleValue;
std::vector<PvaClientGetPtr> pvaClientGet;
bool isGetConnected;
bool isDestroyed;
};
/**
@ -280,7 +277,6 @@ private:
std::vector<PvaClientPutPtr> pvaClientPut;
bool isPutConnected;
bool isDestroyed;
};
/**
@ -348,7 +344,6 @@ private:
epics::pvData::shared_vector<double> doubleValue;
std::vector<PvaClientMonitorPtr> pvaClientMonitor;
bool isMonitorConnected;
bool isDestroyed;
};
/**
@ -414,7 +409,6 @@ private:
PvaClientNTMultiDataPtr pvaClientNTMultiData;
std::vector<PvaClientGetPtr> pvaClientGet;
bool isConnected;
bool isDestroyed;
};
/**
@ -475,7 +469,6 @@ private:
epics::pvData::shared_vector<epics::pvData::PVFieldPtr> value;
std::vector<PvaClientPutPtr> pvaClientPut;
bool isConnected;
bool isDestroyed;
};
/**
@ -546,7 +539,6 @@ private:
PvaClientNTMultiDataPtr pvaClientNTMultiData;
std::vector<PvaClientMonitorPtr> pvaClientMonitor;
bool isConnected;
bool isDestroyed;
};
/**
@ -627,7 +619,6 @@ private:
std::vector<epics::pvData::PVStructurePtr> topPVStructure;
bool gotAlarm;
bool gotTimeStamp;
bool isDestroyed;
epics::pvData::StructureConstPtr ntMultiChannelStructure;
epics::pvData::shared_vector<epics::pvData::PVUnionPtr> unionValue;

View File

@ -103,7 +103,6 @@ PvaClientPtr PvaClient::get(std::string const & providerNames)
PvaClient::PvaClient(std::string const & providerNames)
: pvaClientChannelCache(new PvaClientChannelCache()),
isDestroyed(false),
pvaStarted(false),
caStarted(false)
{
@ -127,11 +126,6 @@ PvaClient::PvaClient(std::string const & providerNames)
}
PvaClient::~PvaClient() {
{
Lock xx(mutex);
if(isDestroyed) throw std::runtime_error("pvaClient was destroyed");
isDestroyed = true;
}
if(PvaClient::debug) {
cout<< "PvaClient::~PvaClient()\n"
<< "pvaChannel cache:\n";

View File

@ -188,7 +188,6 @@ PvaClientChannel::PvaClientChannel(
channelName(channelName),
providerName(providerName),
connectState(connectIdle),
isDestroyed(false),
createRequest(CreateRequest::create()),
pvaClientGetCache(new PvaClientGetCache()),
pvaClientPutCache(new PvaClientPutCache())
@ -200,11 +199,6 @@ PvaClientChannel::PvaClientChannel(
PvaClientChannel::~PvaClientChannel()
{
{
Lock xx(mutex);
if(isDestroyed) throw std::runtime_error("pvaClientChannel was destroyed");
isDestroyed = true;
}
if(PvaClient::getDebug()) {
cout << "PvaClientChannel::~PvaClientChannel() "
<< " channelName " << channelName
@ -218,6 +212,7 @@ void PvaClientChannel::channelCreated(const Status& status, Channel::shared_poin
if(PvaClient::getDebug()) {
cout << "PvaClientChannel::channelCreated"
<< " channelName " << channelName
<< " connectState " << connectState
<< " isConnected " << (channel->isConnected() ? "true" : "false")
<< " status.isOK " << (status.isOK() ? "true" : "false")
<< endl;
@ -327,6 +322,7 @@ void PvaClientChannel::issueConnect()
}
{
Lock xx(mutex);
if(connectState==connected) return;
if(connectState!=connectIdle) {
throw std::runtime_error("pvaClientChannel already connected");
}
@ -506,7 +502,7 @@ PvaClientMonitorPtr PvaClientChannel::monitor(string const & request)
PvaClientMonitorPtr PvaClientChannel::monitor(PvaClientMonitorRequesterPtr const & pvaClientMonitorRequester)
{
return monitor("value,alarm,timeStamp",pvaClientMonitorRequester);
return monitor("field(value,alarm,timeStamp)",pvaClientMonitorRequester);
}
PvaClientMonitorPtr PvaClientChannel::monitor(string const & request,

View File

@ -90,7 +90,6 @@ PvaClientGet::PvaClientGet(
: pvaClient(pvaClient),
channel(channel),
pvRequest(pvRequest),
isDestroyed(false),
connectState(connectIdle),
getState(getIdle)
{
@ -103,11 +102,6 @@ PvaClientGet::PvaClientGet(
PvaClientGet::~PvaClientGet()
{
{
Lock xx(mutex);
if(isDestroyed) throw std::runtime_error("pvaClientGet was destroyed");
isDestroyed = true;
}
if(PvaClient::getDebug()) {
string channelName("disconnected");
Channel::shared_pointer chan(channel.lock());

View File

@ -96,7 +96,6 @@ PvaClientMonitor::PvaClientMonitor(
: pvaClient(pvaClient),
channel(channel),
pvRequest(pvRequest),
isDestroyed(false),
isStarted(false),
connectState(connectIdle),
userPoll(false),
@ -112,11 +111,6 @@ PvaClientMonitor::PvaClientMonitor(
PvaClientMonitor::~PvaClientMonitor()
{
if(PvaClient::getDebug()) cout<< "PvaClientMonitor::~PvaClientMonitor\n";
{
Lock xx(mutex);
if(isDestroyed) throw std::runtime_error("pvaClientMonitor was destroyed");
isDestroyed = true;
}
if(PvaClient::getDebug()) {
string channelName("disconnected");
Channel::shared_pointer chan(channel.lock());

View File

@ -53,8 +53,7 @@ PvaClientMultiChannel::PvaClientMultiChannel(
numConnected(0),
pvaClientChannelArray(PvaClientChannelArray(numChannel,PvaClientChannelPtr())),
isConnected(shared_vector<epics::pvData::boolean>(numChannel,false)),
createRequest(CreateRequest::create()),
isDestroyed(false)
createRequest(CreateRequest::create())
{
if(PvaClient::getDebug()) cout<< "PvaClientMultiChannel::PvaClientMultiChannel()\n";
}
@ -62,12 +61,6 @@ PvaClientMultiChannel::PvaClientMultiChannel(
PvaClientMultiChannel::~PvaClientMultiChannel()
{
if(PvaClient::getDebug()) cout<< "PvaClientMultiChannel::~PvaClientMultiChannel()\n";
{
Lock xx(mutex);
if(isDestroyed) throw std::runtime_error("pvaClientMultiChannel was destroyed");
isDestroyed = true;
}
pvaClientChannelArray.clear();
}
void PvaClientMultiChannel::checkConnected()

View File

@ -9,7 +9,6 @@
* @date 2015.03
*/
#include <pv/standardField.h>
#include <pv/convert.h>
#include <epicsMath.h>
@ -25,11 +24,6 @@ using namespace std;
namespace epics { namespace pvaClient {
static ConvertPtr convert = getConvert();
static FieldCreatePtr fieldCreate = getFieldCreate();
static PVDataCreatePtr pvDataCreate = getPVDataCreate();
static StandardFieldPtr standardField = getStandardField();
PvaClientMultiGetDoublePtr PvaClientMultiGetDouble::create(
PvaClientMultiChannelPtr const &pvaMultiChannel,
@ -48,8 +42,7 @@ PvaClientMultiGetDouble::PvaClientMultiGetDouble(
nchannel(pvaClientChannelArray.size()),
doubleValue(shared_vector<double>(nchannel)),
pvaClientGet(std::vector<PvaClientGetPtr>(nchannel,PvaClientGetPtr())),
isGetConnected(false),
isDestroyed(false)
isGetConnected(false)
{
if(PvaClient::getDebug()) cout<< "PvaClientMultiGetDouble::PvaClientMultiGetDouble()\n";
}
@ -57,12 +50,6 @@ PvaClientMultiGetDouble::PvaClientMultiGetDouble(
PvaClientMultiGetDouble::~PvaClientMultiGetDouble()
{
if(PvaClient::getDebug()) cout<< "PvaClientMultiGetDouble::~PvaClientMultiGetDouble()\n";
{
Lock xx(mutex);
if(isDestroyed) throw std::runtime_error("pvaClientMultiGetDouble was destroyed");
isDestroyed = true;
}
pvaClientChannelArray.clear();
}
void PvaClientMultiGetDouble::connect()
@ -116,7 +103,7 @@ epics::pvData::shared_vector<double> PvaClientMultiGetDouble::get()
if(isConnected[i])
{
PVStructurePtr pvStructure = pvaClientGet[i]->getData()->getPVStructure();
doubleValue[i] = convert->toDouble(pvStructure->getSubField<PVScalar>("value"));
doubleValue[i] = getConvert()->toDouble(pvStructure->getSubField<PVScalar>("value"));
} else {
doubleValue[i] = epicsNAN;
}

View File

@ -10,8 +10,6 @@
*/
#include <epicsThread.h>
#include <pv/standardField.h>
#include <pv/convert.h>
#include <epicsMath.h>
#define epicsExportSharedSymbols
@ -26,11 +24,6 @@ using namespace std;
namespace epics { namespace pvaClient {
static ConvertPtr convert = getConvert();
static FieldCreatePtr fieldCreate = getFieldCreate();
static PVDataCreatePtr pvDataCreate = getPVDataCreate();
static StandardFieldPtr standardField = getStandardField();
PvaClientMultiMonitorDoublePtr PvaClientMultiMonitorDouble::create(
PvaClientMultiChannelPtr const &pvaMultiChannel,
@ -49,8 +42,7 @@ PvaClientMultiMonitorDouble::PvaClientMultiMonitorDouble(
nchannel(pvaClientChannelArray.size()),
doubleValue(shared_vector<double>(nchannel,epicsNAN)),
pvaClientMonitor(std::vector<PvaClientMonitorPtr>(nchannel,PvaClientMonitorPtr())),
isMonitorConnected(false),
isDestroyed(false)
isMonitorConnected(false)
{
if(PvaClient::getDebug()) cout<< "PvaClientMultiMonitorDouble::PvaClientMultiMonitorDouble()\n";
}
@ -58,12 +50,6 @@ PvaClientMultiMonitorDouble::PvaClientMultiMonitorDouble(
PvaClientMultiMonitorDouble::~PvaClientMultiMonitorDouble()
{
if(PvaClient::getDebug()) cout<< "PvaClientMultiMonitorDouble::~PvaClientMultiMonitorDouble()\n";
{
Lock xx(mutex);
if(isDestroyed) throw std::runtime_error("pvaClientMultiMonitorDouble was destroyed");
isDestroyed = true;
}
pvaClientChannelArray.clear();
}
void PvaClientMultiMonitorDouble::connect()
@ -98,7 +84,7 @@ bool PvaClientMultiMonitorDouble::poll()
{
if(!isMonitorConnected){
connect();
epicsThreadSleep(.01);
epicsThreadSleep(.1);
}
bool result = false;
shared_vector<epics::pvData::boolean> isConnected = pvaClientMultiChannel->getIsConnected();

View File

@ -9,7 +9,6 @@
* @date 2015.03
*/
#include <pv/standardField.h>
#include <pv/convert.h>
#include <epicsMath.h>
@ -25,12 +24,6 @@ using namespace std;
namespace epics { namespace pvaClient {
static ConvertPtr convert = getConvert();
static FieldCreatePtr fieldCreate = getFieldCreate();
static PVDataCreatePtr pvDataCreate = getPVDataCreate();
static StandardFieldPtr standardField = getStandardField();
static CreateRequest::shared_pointer createRequest = CreateRequest::create();
PvaClientMultiPutDoublePtr PvaClientMultiPutDouble::create(
PvaClientMultiChannelPtr const &pvaMultiChannel,
@ -48,8 +41,7 @@ PvaClientMultiPutDouble::PvaClientMultiPutDouble(
pvaClientChannelArray(pvaClientChannelArray),
nchannel(pvaClientChannelArray.size()),
pvaClientPut(std::vector<PvaClientPutPtr>(nchannel,PvaClientPutPtr())),
isPutConnected(false),
isDestroyed(false)
isPutConnected(false)
{
if(PvaClient::getDebug()) cout<< "PvaClientMultiPutDouble::PvaClientMultiPutDouble()\n";
}
@ -59,12 +51,6 @@ PvaClientMultiPutDouble::PvaClientMultiPutDouble(
PvaClientMultiPutDouble::~PvaClientMultiPutDouble()
{
if(PvaClient::getDebug()) cout<< "PvaClientMultiPutDouble::~PvaClientMultiPutDouble()\n";
{
Lock xx(mutex);
if(isDestroyed) throw std::runtime_error("pvaClientMultiPutDouble was destroyed");
isDestroyed = true;
}
pvaClientChannelArray.clear();
}
@ -103,7 +89,7 @@ void PvaClientMultiPutDouble::put(epics::pvData::shared_vector<double> const &da
if(isConnected[i]) {
PVStructurePtr pvTop = pvaClientPut[i]->getData()->getPVStructure();
PVScalarPtr pvValue = pvTop->getSubField<PVScalar>("value");
convert->fromDouble(pvValue,data[i]);
getConvert()->fromDouble(pvValue,data[i]);
pvaClientPut[i]->issuePut();
}
if(isConnected[i]) {

View File

@ -23,9 +23,6 @@ using namespace std;
namespace epics { namespace pvaClient {
static PVDataCreatePtr pvDataCreate = getPVDataCreate();
PvaClientNTMultiDataPtr PvaClientNTMultiData::create(
epics::pvData::UnionConstPtr const & u,
PvaClientMultiChannelPtr const &pvaMultiChannel,
@ -45,8 +42,7 @@ PvaClientNTMultiData::PvaClientNTMultiData(
pvaClientChannelArray(pvaClientChannelArray),
nchannel(pvaClientChannelArray.size()),
gotAlarm(false),
gotTimeStamp(false),
isDestroyed(false)
gotTimeStamp(false)
{
if(PvaClient::getDebug()) cout<< "PvaClientNTMultiData::PvaClientNTMultiData()\n";
PVFieldPtr pvValue = pvRequest->getSubField("field.value");
@ -55,6 +51,7 @@ PvaClientNTMultiData::PvaClientNTMultiData(
}
topPVStructure.resize(nchannel);
unionValue.resize(nchannel);
PVDataCreatePtr pvDataCreate = getPVDataCreate();
for(size_t i=0; i< nchannel; ++i) {
topPVStructure[i] = PVStructurePtr();
unionValue[i] = pvDataCreate->createPVUnion(u);
@ -90,12 +87,6 @@ PvaClientNTMultiData::PvaClientNTMultiData(
PvaClientNTMultiData::~PvaClientNTMultiData()
{
if(PvaClient::getDebug()) cout<< "PvaClientNTMultiData::~PvaClientNTMultiData()\n";
{
Lock xx(mutex);
if(isDestroyed) throw std::runtime_error("pvaClientNTMultiData was destroyed");
isDestroyed = true;
}
pvaClientChannelArray.clear();
}
@ -180,7 +171,7 @@ TimeStamp PvaClientNTMultiData::getTimeStamp()
NTMultiChannelPtr PvaClientNTMultiData::getNTMultiChannel()
{
PVStructurePtr pvStructure = pvDataCreate->createPVStructure(ntMultiChannelStructure);
PVStructurePtr pvStructure = getPVDataCreate()->createPVStructure(ntMultiChannelStructure);
NTMultiChannelPtr ntMultiChannel = NTMultiChannel::wrap(pvStructure);
ntMultiChannel->getChannelName()->replace(pvaClientMultiChannel->getChannelNames());
shared_vector<epics::pvData::PVUnionPtr> val(nchannel);

View File

@ -9,8 +9,6 @@
* @date 2015.03
*/
#include <pv/standardField.h>
#include <pv/convert.h>
#include <epicsMath.h>
#define epicsExportSharedSymbols
@ -25,18 +23,13 @@ using namespace std;
namespace epics { namespace pvaClient {
static ConvertPtr convert = getConvert();
static FieldCreatePtr fieldCreate = getFieldCreate();
static PVDataCreatePtr pvDataCreate = getPVDataCreate();
static StandardFieldPtr standardField = getStandardField();
PvaClientNTMultiGetPtr PvaClientNTMultiGet::create(
PvaClientMultiChannelPtr const &pvaMultiChannel,
PvaClientChannelArray const &pvaClientChannelArray,
PVStructurePtr const & pvRequest)
{
UnionConstPtr u = fieldCreate->createVariantUnion();
UnionConstPtr u = getFieldCreate()->createVariantUnion();
PvaClientNTMultiGetPtr pvaClientNTMultiGet(
new PvaClientNTMultiGet(u,pvaMultiChannel,pvaClientChannelArray,pvRequest));
return pvaClientNTMultiGet;
@ -57,8 +50,7 @@ PvaClientNTMultiGet::PvaClientNTMultiGet(
pvaClientMultiChannel,
pvaClientChannelArray,
pvRequest)),
isConnected(false),
isDestroyed(false)
isConnected(false)
{
if(PvaClient::getDebug()) cout<< "PvaClientNTMultiGet::PvaClientNTMultiGet()\n";
}
@ -66,12 +58,6 @@ PvaClientNTMultiGet::PvaClientNTMultiGet(
PvaClientNTMultiGet::~PvaClientNTMultiGet()
{
if(PvaClient::getDebug()) cout<< "PvaClientNTMultiGet::~PvaClientNTMultiGet()\n";
{
Lock xx(mutex);
if(isDestroyed) throw std::runtime_error("pvaClientNTMultiGet was destroyed");
isDestroyed = true;
}
pvaClientChannelArray.clear();
}
void PvaClientNTMultiGet::connect()

View File

@ -26,14 +26,12 @@ using namespace std;
namespace epics { namespace pvaClient {
static FieldCreatePtr fieldCreate = getFieldCreate();
PvaClientNTMultiMonitorPtr PvaClientNTMultiMonitor::create(
PvaClientMultiChannelPtr const &pvaMultiChannel,
PvaClientChannelArray const &pvaClientChannelArray,
epics::pvData::PVStructurePtr const & pvRequest)
{
UnionConstPtr u = fieldCreate->createVariantUnion();
UnionConstPtr u = getFieldCreate()->createVariantUnion();
PvaClientNTMultiMonitorPtr pvaClientNTMultiMonitor(
new PvaClientNTMultiMonitor(u,pvaMultiChannel,pvaClientChannelArray,pvRequest));
return pvaClientNTMultiMonitor;
@ -54,8 +52,7 @@ PvaClientNTMultiMonitor::PvaClientNTMultiMonitor(
pvaClientMultiChannel,
pvaClientChannelArray,
pvRequest)),
isConnected(false),
isDestroyed(false)
isConnected(false)
{
if(PvaClient::getDebug()) cout<< "PvaClientNTMultiMonitor::PvaClientNTMultiMonitor()\n";
}
@ -64,12 +61,6 @@ PvaClientNTMultiMonitor::PvaClientNTMultiMonitor(
PvaClientNTMultiMonitor::~PvaClientNTMultiMonitor()
{
if(PvaClient::getDebug()) cout<< "PvaClientNTMultiMonitor::~PvaClientNTMultiMonitor()\n";
{
Lock xx(mutex);
if(isDestroyed) throw std::runtime_error("pvaClientNTMultiMonitor was destroyed");
isDestroyed = true;
}
pvaClientChannelArray.clear();
}

View File

@ -25,10 +25,6 @@ using namespace std;
namespace epics { namespace pvaClient {
static ConvertPtr convert = getConvert();
static FieldCreatePtr fieldCreate = getFieldCreate();
static PVDataCreatePtr pvDataCreate = getPVDataCreate();
PvaClientNTMultiPutPtr PvaClientNTMultiPut::create(
PvaClientMultiChannelPtr const &pvaMultiChannel,
PvaClientChannelArray const &pvaClientChannelArray)
@ -45,8 +41,7 @@ PvaClientNTMultiPut::PvaClientNTMultiPut(
nchannel(pvaClientChannelArray.size()),
unionValue(shared_vector<epics::pvData::PVUnionPtr>(nchannel,PVUnionPtr())),
value(shared_vector<epics::pvData::PVFieldPtr>(nchannel,PVFieldPtr())),
isConnected(false),
isDestroyed(false)
isConnected(false)
{
if(PvaClient::getDebug()) cout<< "PvaClientNTMultiPut::PvaClientNTMultiPut()\n";
}
@ -55,12 +50,6 @@ PvaClientNTMultiPut::PvaClientNTMultiPut(
PvaClientNTMultiPut::~PvaClientNTMultiPut()
{
if(PvaClient::getDebug()) cout<< "PvaClientNTMultiPut::~PvaClientNTMultiPut()\n";
{
Lock xx(mutex);
if(isDestroyed) throw std::runtime_error("pvaClientNTMultiPut was destroyed");
isDestroyed = true;
}
pvaClientChannelArray.clear();
}
void PvaClientNTMultiPut::connect()
@ -100,6 +89,8 @@ void PvaClientNTMultiPut::connect()
throw std::runtime_error(message);
}
}
FieldCreatePtr fieldCreate = getFieldCreate();
PVDataCreatePtr pvDataCreate = getPVDataCreate();
for(size_t i=0; i<nchannel; ++i)
{
if(isConnected[i]) {

View File

@ -87,7 +87,6 @@ PvaClientProcess::PvaClientProcess(
: pvaClient(pvaClient),
channel(channel),
pvRequest(pvRequest),
isDestroyed(false),
connectState(connectIdle),
processState(processIdle)
{
@ -97,11 +96,6 @@ PvaClientProcess::PvaClientProcess(
PvaClientProcess::~PvaClientProcess()
{
if(PvaClient::getDebug()) cout<< "PvaClientProcess::~PvaClientProcess()\n";
{
Lock xx(mutex);
if(isDestroyed) throw std::runtime_error("pvaClientProcess was destroyed");
isDestroyed = true;
}
channelProcess->destroy();
}
@ -125,6 +119,7 @@ void PvaClientProcess::channelProcessConnect(
ChannelProcess::shared_pointer const & channelProcess)
{
channelProcessConnectStatus = status;
connectState = connected;
this->channelProcess = channelProcess;
waitForConnect.signal();
@ -135,6 +130,7 @@ void PvaClientProcess::processDone(
ChannelProcess::shared_pointer const & channelProcess)
{
channelProcessStatus = status;
processState = processComplete;
waitForProcess.signal();
}
@ -161,13 +157,17 @@ void PvaClientProcess::issueConnect()
Status PvaClientProcess::waitConnect()
{
if(connectState==connected) {
if(!channelProcessConnectStatus.isOK()) connectState = connectIdle;
return channelProcessConnectStatus;
}
if(connectState!=connectActive) {
string message = string("channel ") + channel->getChannelName()
+ " pvaClientProcess illegal connect state ";
throw std::runtime_error(message);
}
waitForConnect.wait();
connectState = channelProcessConnectStatus.isOK() ? connected : connectIdle;
if(!channelProcessConnectStatus.isOK()) connectState = connectIdle;
return channelProcessConnectStatus;
}
@ -195,6 +195,10 @@ void PvaClientProcess::issueProcess()
Status PvaClientProcess::waitProcess()
{
if(processState==processComplete) {
processState = processIdle;
return channelProcessStatus;
}
if(processState!=processActive){
string message = string("channel ") + channel->getChannelName()
+ " PvaClientProcess::waitProcess llegal process state";

View File

@ -100,7 +100,6 @@ PvaClientPut::PvaClientPut(
: pvaClient(pvaClient),
channel(channel),
pvRequest(pvRequest),
isDestroyed(false),
connectState(connectIdle),
putState(putIdle)
{
@ -113,11 +112,6 @@ PvaClientPut::PvaClientPut(
PvaClientPut::~PvaClientPut()
{
{
Lock xx(mutex);
if(isDestroyed) throw std::runtime_error("pvaClientPut was destroyed");
isDestroyed = true;
}
if(PvaClient::getDebug()) {
string channelName("disconnected");
Channel::shared_pointer chan(channel.lock());
@ -194,7 +188,6 @@ void PvaClientPut::getDone(
<< endl;
}
channelGetPutStatus = status;
connectState = connected;
if(status.isOK()) {
PVStructurePtr pvs = pvaClientData->getPVStructure();
pvs->copyUnchecked(*pvStructure,*bitSet);

View File

@ -28,12 +28,12 @@ namespace epics { namespace pvaClient {
class PvaClientPostHandlerPvt: public PostHandler
{
PvaClientPutData * easyData;
PvaClientPutData * putData;
size_t fieldNumber;
public:
PvaClientPostHandlerPvt(PvaClientPutData *easyData,size_t fieldNumber)
: easyData(easyData),fieldNumber(fieldNumber){}
void postPut() { easyData->postPut(fieldNumber);}
PvaClientPostHandlerPvt(PvaClientPutData *putData,size_t fieldNumber)
: putData(putData),fieldNumber(fieldNumber){}
void postPut() { putData->postPut(fieldNumber);}
};
typedef std::tr1::shared_ptr<PVArray> PVArrayPtr;

View File

@ -112,7 +112,6 @@ PvaClientPutGet::PvaClientPutGet(
: pvaClient(pvaClient),
channel(channel),
pvRequest(pvRequest),
isDestroyed(false),
connectState(connectIdle),
putGetState(putGetIdle)
{
@ -125,11 +124,6 @@ PvaClientPutGet::PvaClientPutGet(
PvaClientPutGet::~PvaClientPutGet()
{
{
Lock xx(mutex);
if(isDestroyed) throw std::runtime_error("pvaClientPutGet was destroyed");
isDestroyed = true;
}
if(PvaClient::getDebug()) {
string channelName("disconnected");
Channel::shared_pointer chan(channel.lock());

View File

@ -88,9 +88,8 @@ PvaClientRPC::PvaClientRPC(
PvaClientPtr const &pvaClient,
Channel::shared_pointer const & channel,
PVStructurePtr const &pvRequest)
: isDestroyed(false),
:
connectState(connectIdle),
rpcState(rpcIdle),
pvaClient(pvaClient),
channel(channel),
pvRequest(pvRequest)
@ -104,12 +103,6 @@ PvaClientRPC::PvaClientRPC(
PvaClientRPC::~PvaClientRPC()
{
if(PvaClient::getDebug()) cout<< "PvaClientRPC::~PvaClientRPC\n";
{
Lock xx(mutex);
if(isDestroyed) throw std::runtime_error("pvaClientRPC was destroyed");
isDestroyed = true;
}
if(PvaClient::getDebug()) {
string channelName("disconnected");
Channel::shared_pointer chan(channel.lock());