diff --git a/LICENSE b/LICENSE deleted file mode 100644 index 3f43ff2..0000000 --- a/LICENSE +++ /dev/null @@ -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. -________________________________________________________________________ diff --git a/LICENSE.txt b/LICENSE.txt new file mode 100644 index 0000000..adc40d3 --- /dev/null +++ b/LICENSE.txt @@ -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. + diff --git a/src/pv/pvaClient.h b/src/pv/pvaClient.h index bc668c6..69b4050 100644 --- a/src/pv/pvaClient.h +++ b/src/pv/pvaClient.h @@ -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 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; diff --git a/src/pv/pvaClientMultiChannel.h b/src/pv/pvaClientMultiChannel.h index 20e8537..faa9cb8 100644 --- a/src/pv/pvaClientMultiChannel.h +++ b/src/pv/pvaClientMultiChannel.h @@ -168,8 +168,6 @@ private: PvaClientChannelArray pvaClientChannelArray; epics::pvData::shared_vector isConnected; epics::pvData::CreateRequest::shared_pointer createRequest; - bool isDestroyed; - }; /** @@ -227,7 +225,6 @@ private: epics::pvData::shared_vector doubleValue; std::vector pvaClientGet; bool isGetConnected; - bool isDestroyed; }; /** @@ -280,7 +277,6 @@ private: std::vector pvaClientPut; bool isPutConnected; - bool isDestroyed; }; /** @@ -348,7 +344,6 @@ private: epics::pvData::shared_vector doubleValue; std::vector pvaClientMonitor; bool isMonitorConnected; - bool isDestroyed; }; /** @@ -414,7 +409,6 @@ private: PvaClientNTMultiDataPtr pvaClientNTMultiData; std::vector pvaClientGet; bool isConnected; - bool isDestroyed; }; /** @@ -475,7 +469,6 @@ private: epics::pvData::shared_vector value; std::vector pvaClientPut; bool isConnected; - bool isDestroyed; }; /** @@ -546,7 +539,6 @@ private: PvaClientNTMultiDataPtr pvaClientNTMultiData; std::vector pvaClientMonitor; bool isConnected; - bool isDestroyed; }; /** @@ -627,7 +619,6 @@ private: std::vector topPVStructure; bool gotAlarm; bool gotTimeStamp; - bool isDestroyed; epics::pvData::StructureConstPtr ntMultiChannelStructure; epics::pvData::shared_vector unionValue; diff --git a/src/pvaClient.cpp b/src/pvaClient.cpp index b385557..6697d59 100644 --- a/src/pvaClient.cpp +++ b/src/pvaClient.cpp @@ -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"; diff --git a/src/pvaClientChannel.cpp b/src/pvaClientChannel.cpp index fb2c901..7045860 100644 --- a/src/pvaClientChannel.cpp +++ b/src/pvaClientChannel.cpp @@ -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, diff --git a/src/pvaClientGet.cpp b/src/pvaClientGet.cpp index 4a3ba6a..69615fc 100644 --- a/src/pvaClientGet.cpp +++ b/src/pvaClientGet.cpp @@ -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()); diff --git a/src/pvaClientMonitor.cpp b/src/pvaClientMonitor.cpp index 5c472f7..e15fbcd 100644 --- a/src/pvaClientMonitor.cpp +++ b/src/pvaClientMonitor.cpp @@ -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()); diff --git a/src/pvaClientMultiChannel.cpp b/src/pvaClientMultiChannel.cpp index 12e638c..33e6481 100644 --- a/src/pvaClientMultiChannel.cpp +++ b/src/pvaClientMultiChannel.cpp @@ -53,8 +53,7 @@ PvaClientMultiChannel::PvaClientMultiChannel( numConnected(0), pvaClientChannelArray(PvaClientChannelArray(numChannel,PvaClientChannelPtr())), isConnected(shared_vector(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() diff --git a/src/pvaClientMultiGetDouble.cpp b/src/pvaClientMultiGetDouble.cpp index 61dfb8d..9b803d7 100644 --- a/src/pvaClientMultiGetDouble.cpp +++ b/src/pvaClientMultiGetDouble.cpp @@ -9,7 +9,6 @@ * @date 2015.03 */ -#include #include #include @@ -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(nchannel)), pvaClientGet(std::vector(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 PvaClientMultiGetDouble::get() if(isConnected[i]) { PVStructurePtr pvStructure = pvaClientGet[i]->getData()->getPVStructure(); - doubleValue[i] = convert->toDouble(pvStructure->getSubField("value")); + doubleValue[i] = getConvert()->toDouble(pvStructure->getSubField("value")); } else { doubleValue[i] = epicsNAN; } diff --git a/src/pvaClientMultiMonitorDouble.cpp b/src/pvaClientMultiMonitorDouble.cpp index 79be101..95dda92 100644 --- a/src/pvaClientMultiMonitorDouble.cpp +++ b/src/pvaClientMultiMonitorDouble.cpp @@ -10,8 +10,6 @@ */ #include -#include -#include #include #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(nchannel,epicsNAN)), pvaClientMonitor(std::vector(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 isConnected = pvaClientMultiChannel->getIsConnected(); diff --git a/src/pvaClientMultiPutDouble.cpp b/src/pvaClientMultiPutDouble.cpp index 03ca318..0169641 100644 --- a/src/pvaClientMultiPutDouble.cpp +++ b/src/pvaClientMultiPutDouble.cpp @@ -9,7 +9,6 @@ * @date 2015.03 */ -#include #include #include @@ -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(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 const &da if(isConnected[i]) { PVStructurePtr pvTop = pvaClientPut[i]->getData()->getPVStructure(); PVScalarPtr pvValue = pvTop->getSubField("value"); - convert->fromDouble(pvValue,data[i]); + getConvert()->fromDouble(pvValue,data[i]); pvaClientPut[i]->issuePut(); } if(isConnected[i]) { diff --git a/src/pvaClientNTMultiData.cpp b/src/pvaClientNTMultiData.cpp index 9b3bb53..1f1caa5 100644 --- a/src/pvaClientNTMultiData.cpp +++ b/src/pvaClientNTMultiData.cpp @@ -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 val(nchannel); diff --git a/src/pvaClientNTMultiGet.cpp b/src/pvaClientNTMultiGet.cpp index b976310..0f77ce1 100644 --- a/src/pvaClientNTMultiGet.cpp +++ b/src/pvaClientNTMultiGet.cpp @@ -9,8 +9,6 @@ * @date 2015.03 */ -#include -#include #include #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() diff --git a/src/pvaClientNTMultiMonitor.cpp b/src/pvaClientNTMultiMonitor.cpp index c42e9ca..126476a 100644 --- a/src/pvaClientNTMultiMonitor.cpp +++ b/src/pvaClientNTMultiMonitor.cpp @@ -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(); } diff --git a/src/pvaClientNTMultiPut.cpp b/src/pvaClientNTMultiPut.cpp index f5b7cc0..cd18a6e 100644 --- a/src/pvaClientNTMultiPut.cpp +++ b/src/pvaClientNTMultiPut.cpp @@ -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(nchannel,PVUnionPtr())), value(shared_vector(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; idestroy(); } @@ -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"; diff --git a/src/pvaClientPut.cpp b/src/pvaClientPut.cpp index 72705f8..8b21cb7 100644 --- a/src/pvaClientPut.cpp +++ b/src/pvaClientPut.cpp @@ -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); diff --git a/src/pvaClientPutData.cpp b/src/pvaClientPutData.cpp index 59208fa..94ad0a8 100644 --- a/src/pvaClientPutData.cpp +++ b/src/pvaClientPutData.cpp @@ -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 PVArrayPtr; diff --git a/src/pvaClientPutGet.cpp b/src/pvaClientPutGet.cpp index 4da7f41..65a009d 100644 --- a/src/pvaClientPutGet.cpp +++ b/src/pvaClientPutGet.cpp @@ -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()); diff --git a/src/pvaClientRPC.cpp b/src/pvaClientRPC.cpp index 83da666..04d47ce 100644 --- a/src/pvaClientRPC.cpp +++ b/src/pvaClientRPC.cpp @@ -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());