lots of minor changes
This commit is contained in:
@@ -18,7 +18,6 @@
|
||||
|
||||
#include <pv/pvaClient.h>
|
||||
|
||||
using std::tr1::static_pointer_cast;
|
||||
using namespace epics::pvData;
|
||||
using namespace epics::pvAccess;
|
||||
using namespace epics::pvAccess::ca;
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
|
||||
#include <pv/pvaClient.h>
|
||||
|
||||
using std::tr1::static_pointer_cast;
|
||||
using namespace epics::pvData;
|
||||
using namespace epics::pvAccess;
|
||||
using namespace std;
|
||||
|
||||
@@ -42,10 +42,7 @@ static string noTimeStamp("no timeStamp");
|
||||
|
||||
PvaClientDataPtr PvaClientData::create(StructureConstPtr const & structure)
|
||||
{
|
||||
if(PvaClient::getDebug()) {
|
||||
cout << "PvaClientData::create"
|
||||
<< endl;
|
||||
}
|
||||
if(PvaClient::getDebug()) cout << "PvaClientData::create\n";
|
||||
PvaClientDataPtr epv(new PvaClientData(structure));
|
||||
return epv;
|
||||
}
|
||||
@@ -57,10 +54,7 @@ PvaClientData::PvaClientData(StructureConstPtr const & structure)
|
||||
|
||||
void PvaClientData::checkValue()
|
||||
{
|
||||
if(PvaClient::getDebug()) {
|
||||
cout << "PvaClientData::checkValue"
|
||||
<< endl;
|
||||
}
|
||||
if(PvaClient::getDebug()) cout << "PvaClientData::checkValue\n";
|
||||
if(pvValue) return;
|
||||
throw std::runtime_error(messagePrefix + noValue);
|
||||
}
|
||||
@@ -109,10 +103,7 @@ void PvaClientData::setData(
|
||||
PVStructurePtr const & pvStructureFrom,
|
||||
BitSetPtr const & bitSetFrom)
|
||||
{
|
||||
if(PvaClient::getDebug()) {
|
||||
cout << "PvaClientData::setData"
|
||||
<< endl;
|
||||
}
|
||||
if(PvaClient::getDebug()) cout << "PvaClientData::setData\n";
|
||||
pvStructure = pvStructureFrom;
|
||||
bitSet = bitSetFrom;
|
||||
pvValue = pvStructure->getSubField("value");
|
||||
@@ -125,62 +116,73 @@ void PvaClientData::setData(
|
||||
pvValue = pvField;
|
||||
return;
|
||||
}
|
||||
PVScalarPtr pvScalar = static_pointer_cast<PVScalar>(pvField);
|
||||
if(pvScalar) {
|
||||
if(pvField->getField()->getType()==scalar) {
|
||||
pvValue = pvField;
|
||||
return;
|
||||
}
|
||||
PVScalarArrayPtr pvScalarArray = static_pointer_cast<PVScalarArray>(pvField);
|
||||
if(pvScalarArray) {
|
||||
if(pvField->getField()->getType()==scalarArray) {
|
||||
pvValue = pvField;
|
||||
return;
|
||||
}
|
||||
if(pvField->getField()->getType()!=epics::pvData::structure) break;
|
||||
PVStructurePtr pvStructure = static_pointer_cast<PVStructure>(pvField);
|
||||
if(!pvStructure) break;
|
||||
}
|
||||
messagePrefix = "did not find a field named value or a field that is a scalar or scalar array";
|
||||
}
|
||||
|
||||
bool PvaClientData::hasValue()
|
||||
{
|
||||
if(PvaClient::getDebug()) cout << "PvaClientData::hasValue\n";
|
||||
if(!pvValue) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool PvaClientData::isValueScalar()
|
||||
{
|
||||
if(PvaClient::getDebug()) cout << "PvaClientData::isValueScalar\n";
|
||||
if(!pvValue) return false;
|
||||
if(pvValue->getField()->getType()==scalar) return true;
|
||||
if((pvValue->getFieldName().compare("value")) != 0) return false;
|
||||
if(pvValue->getField()->getType()!=epics::pvData::structure) return false;
|
||||
PVStructurePtr pvStructure = static_pointer_cast<PVStructure>(pvValue);
|
||||
while(true) {
|
||||
if(!pvStructure) break;
|
||||
PVFieldPtr pvField(pvStructure->getPVFields()[0]);
|
||||
PVScalarPtr pvScalar = static_pointer_cast<PVScalar>(pvField);
|
||||
if(pvScalar) {
|
||||
pvValue = pvField;
|
||||
return true;
|
||||
const PVFieldPtrArray fieldPtrArray(pvStructure->getPVFields());
|
||||
if(fieldPtrArray.size()<1) {
|
||||
throw std::logic_error("PvaClientData::isValueScalar() found empty structure");
|
||||
}
|
||||
PVFieldPtr pvField(fieldPtrArray[0]);
|
||||
if(!pvField) throw std::logic_error("PvaClientData::isValueScalar() found null field");
|
||||
if(pvField->getField()->getType()==scalar) {
|
||||
pvValue = pvField;
|
||||
return true;
|
||||
}
|
||||
if(pvField->getField()->getType()!=epics::pvData::structure) break;
|
||||
PVStructurePtr pvStructure = static_pointer_cast<PVStructure>(pvField);
|
||||
}
|
||||
messagePrefix = "did not find a scalar field";
|
||||
messagePrefix = "did not find a scalar field ";
|
||||
return false;
|
||||
}
|
||||
|
||||
bool PvaClientData::isValueScalarArray()
|
||||
{
|
||||
if(PvaClient::getDebug()) cout << "PvaClientData::isValueScalarArray\n";
|
||||
if(!pvValue) return false;
|
||||
if(pvValue->getField()->getType()==scalarArray) return true;
|
||||
if((pvValue->getFieldName().compare("value")) != 0) return false;
|
||||
if(pvValue->getField()->getType()!=epics::pvData::structure) return false;
|
||||
PVStructurePtr pvStructure = static_pointer_cast<PVStructure>(pvValue);
|
||||
while(true) {
|
||||
if(!pvStructure) break;
|
||||
PVFieldPtr pvField(pvStructure->getPVFields()[0]);
|
||||
PVScalarArrayPtr pvScalarArray = static_pointer_cast<PVScalarArray>(pvField);
|
||||
if(pvScalarArray) {
|
||||
const PVFieldPtrArray fieldPtrArray(pvStructure->getPVFields());
|
||||
if(fieldPtrArray.size()<1) {
|
||||
throw std::logic_error("PvaClientData::isValueScalar() found empty structure");
|
||||
}
|
||||
PVFieldPtr pvField(fieldPtrArray[0]);
|
||||
if(!pvField) throw std::logic_error("PvaClientData::isValueScalar() found null field");
|
||||
if(pvField->getField()->getType()==scalarArray) {
|
||||
pvValue = pvField;
|
||||
return true;
|
||||
}
|
||||
if(pvField->getField()->getType()!=epics::pvData::structure) break;
|
||||
PVStructurePtr pvStructure = static_pointer_cast<PVStructure>(pvField);
|
||||
}
|
||||
messagePrefix = "did not find a scalarArray field";
|
||||
@@ -189,12 +191,14 @@ bool PvaClientData::isValueScalarArray()
|
||||
|
||||
PVFieldPtr PvaClientData::getValue()
|
||||
{
|
||||
if(PvaClient::getDebug()) cout << "PvaClientData::getValue\n";
|
||||
checkValue();
|
||||
return pvValue;
|
||||
}
|
||||
|
||||
PVScalarPtr PvaClientData::getScalarValue()
|
||||
{
|
||||
if(PvaClient::getDebug()) cout << "PvaClientData::getScalarValue\n";
|
||||
checkValue();
|
||||
if(!isValueScalar()) throw std::runtime_error(messagePrefix + noScalar);
|
||||
PVScalarPtr pv = static_pointer_cast<PVScalar>(pvValue);
|
||||
@@ -204,6 +208,7 @@ PVScalarPtr PvaClientData::getScalarValue()
|
||||
|
||||
PVArrayPtr PvaClientData::getArrayValue()
|
||||
{
|
||||
if(PvaClient::getDebug()) cout << "PvaClientData::getArrayValue\n";
|
||||
checkValue();
|
||||
PVArrayPtr pv = pvStructure->getSubField<PVArray>("value");
|
||||
if(!pv) throw std::runtime_error(messagePrefix + noArray);
|
||||
@@ -212,6 +217,7 @@ PVArrayPtr PvaClientData::getArrayValue()
|
||||
|
||||
PVScalarArrayPtr PvaClientData::getScalarArrayValue()
|
||||
{
|
||||
if(PvaClient::getDebug()) cout << "PvaClientData::getScalarArrayValue\n";
|
||||
checkValue();
|
||||
if(!isValueScalarArray()) throw std::runtime_error(messagePrefix + noScalarArray);
|
||||
PVScalarArrayPtr pv = static_pointer_cast<PVScalarArray>(pvValue);
|
||||
@@ -221,6 +227,7 @@ PVScalarArrayPtr PvaClientData::getScalarArrayValue()
|
||||
|
||||
double PvaClientData::getDouble()
|
||||
{
|
||||
if(PvaClient::getDebug()) cout << "PvaClientData::getDouble\n";
|
||||
PVScalarPtr pvScalar = getScalarValue();
|
||||
ScalarType scalarType = pvScalar->getScalar()->getScalarType();
|
||||
if(scalarType==pvDouble) {
|
||||
@@ -235,29 +242,37 @@ double PvaClientData::getDouble()
|
||||
|
||||
string PvaClientData::getString()
|
||||
{
|
||||
if(PvaClient::getDebug()) cout << "PvaClientData::getString\n";
|
||||
PVScalarPtr pvScalar = getScalarValue();
|
||||
return convert->toString(pvScalar);
|
||||
}
|
||||
|
||||
shared_vector<const double> PvaClientData::getDoubleArray()
|
||||
{
|
||||
if(PvaClient::getDebug()) cout << "PvaClientData::getDoubleArray\n";
|
||||
PVScalarArrayPtr pvScalarArray = getScalarArrayValue();
|
||||
if(pvScalarArray->getScalarArray()->getElementType()!=pvDouble) {
|
||||
throw std::runtime_error(messagePrefix + notDoubleArray);
|
||||
}
|
||||
PVDoubleArrayPtr pv = static_pointer_cast<PVDoubleArray>(pvScalarArray);
|
||||
if(!pv) throw std::runtime_error(messagePrefix + notDoubleArray);
|
||||
return pv->view();
|
||||
}
|
||||
|
||||
shared_vector<const string> PvaClientData::getStringArray()
|
||||
{
|
||||
if(PvaClient::getDebug()) cout << "PvaClientData::getStringArray\n";
|
||||
PVScalarArrayPtr pvScalarArray = getScalarArrayValue();
|
||||
if(pvScalarArray->getScalarArray()->getElementType()!=pvString) {
|
||||
throw std::runtime_error(messagePrefix + notStringArray);
|
||||
}
|
||||
PVStringArrayPtr pv = static_pointer_cast<PVStringArray>(pvScalarArray);
|
||||
if(!pv) throw std::runtime_error(messagePrefix + notStringArray);
|
||||
return pv->view();
|
||||
}
|
||||
|
||||
|
||||
Alarm PvaClientData::getAlarm()
|
||||
{
|
||||
if(PvaClient::getDebug()) cout << "PvaClientData::getAlarm\n";
|
||||
if(!pvStructure) throw new std::runtime_error(messagePrefix + noStructure);
|
||||
PVStructurePtr pvs = pvStructure->getSubField<PVStructure>("alarm");
|
||||
if(!pvs) throw std::runtime_error(messagePrefix + noAlarm);
|
||||
@@ -273,6 +288,7 @@ Alarm PvaClientData::getAlarm()
|
||||
|
||||
TimeStamp PvaClientData::getTimeStamp()
|
||||
{
|
||||
if(PvaClient::getDebug()) cout << "PvaClientData::getTimeStamp\n";
|
||||
if(!pvStructure) throw new std::runtime_error(messagePrefix + noStructure);
|
||||
PVStructurePtr pvs = pvStructure->getSubField<PVStructure>("timeStamp");
|
||||
if(!pvs) throw std::runtime_error(messagePrefix + noTimeStamp);
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
|
||||
#include <pv/pvaClient.h>
|
||||
|
||||
using std::tr1::static_pointer_cast;
|
||||
using namespace epics::pvData;
|
||||
using namespace epics::pvAccess;
|
||||
using namespace std;
|
||||
@@ -99,18 +98,16 @@ PvaClientGet::PvaClientGet(
|
||||
getState(getIdle)
|
||||
{
|
||||
if(PvaClient::getDebug()) {
|
||||
cout << "PvaClientGet::PvaClientGet::PvaClientGet"
|
||||
<< " channelName " << pvaClientChannel->getChannel()->getChannelName()
|
||||
<< endl;
|
||||
cout << "PvaClientGet::PvaClientGet channelName "
|
||||
<< pvaClientChannel->getChannel()->getChannelName() << "\n";
|
||||
}
|
||||
}
|
||||
|
||||
PvaClientGet::~PvaClientGet()
|
||||
{
|
||||
if(PvaClient::getDebug()) {
|
||||
cout<< "PvaClientGet::~PvaClientGet"
|
||||
<< " channelName " << pvaClientChannel->getChannel()->getChannelName()
|
||||
<< endl;
|
||||
cout<< "PvaClientGet::~PvaClientGet channelName "
|
||||
<< pvaClientChannel->getChannel()->getChannelName() << "\n";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -118,9 +115,8 @@ PvaClientGet::~PvaClientGet()
|
||||
void PvaClientGet::checkConnectState()
|
||||
{
|
||||
if(PvaClient::getDebug()) {
|
||||
cout << "PvaClientGet::checkConnectState"
|
||||
<< " channelName " << pvaClientChannel->getChannel()->getChannelName()
|
||||
<< endl;
|
||||
cout << "PvaClientGet::checkConnectState channelName "
|
||||
<< pvaClientChannel->getChannel()->getChannelName() << "\n";
|
||||
}
|
||||
if(!pvaClientChannel->getChannel()->isConnected()) {
|
||||
string message = string("channel ") + pvaClientChannel->getChannel()->getChannelName()
|
||||
@@ -159,10 +155,10 @@ void PvaClientGet::channelGetConnect(
|
||||
StructureConstPtr const & structure)
|
||||
{
|
||||
if(PvaClient::getDebug()) {
|
||||
cout << "PvaClientGet::channelGetConnect"
|
||||
<< " channelName " << pvaClientChannel->getChannel()->getChannelName()
|
||||
cout << "PvaClientGet::channelGetConnect channelName "
|
||||
<< pvaClientChannel->getChannel()->getChannelName()
|
||||
<< " status.isOK " << (status.isOK() ? "true" : "false")
|
||||
<< endl;
|
||||
<< "\n";
|
||||
}
|
||||
{
|
||||
Lock xx(mutex);
|
||||
@@ -196,10 +192,10 @@ void PvaClientGet::getDone(
|
||||
BitSetPtr const & bitSet)
|
||||
{
|
||||
if(PvaClient::getDebug()) {
|
||||
cout << "PvaClientGet::getDone"
|
||||
<< " channelName " << pvaClientChannel->getChannel()->getChannelName()
|
||||
cout << "PvaClientGet::getDone channelName "
|
||||
<< pvaClientChannel->getChannel()->getChannelName()
|
||||
<< " status.isOK " << (status.isOK() ? "true" : "false")
|
||||
<< endl;
|
||||
<< "\n";
|
||||
}
|
||||
{
|
||||
Lock xx(mutex);
|
||||
@@ -219,9 +215,8 @@ void PvaClientGet::getDone(
|
||||
void PvaClientGet::connect()
|
||||
{
|
||||
if(PvaClient::getDebug()) {
|
||||
cout << "PvaClientGet::connect"
|
||||
<< " channelName " << pvaClientChannel->getChannel()->getChannelName()
|
||||
<< endl;
|
||||
cout << "PvaClientGet::connect channelName "
|
||||
<< pvaClientChannel->getChannel()->getChannelName() << "\n";
|
||||
}
|
||||
issueConnect();
|
||||
Status status = waitConnect();
|
||||
@@ -234,9 +229,8 @@ void PvaClientGet::connect()
|
||||
void PvaClientGet::issueConnect()
|
||||
{
|
||||
if(PvaClient::getDebug()) {
|
||||
cout << "PvaClientGet::issueConnect"
|
||||
<< " channelName " << pvaClientChannel->getChannel()->getChannelName()
|
||||
<< endl;
|
||||
cout << "PvaClientGet::issueConnect channelName "
|
||||
<< pvaClientChannel->getChannel()->getChannelName() << "\n";
|
||||
}
|
||||
if(connectState!=connectIdle) {
|
||||
string message = string("channel ") + pvaClientChannel->getChannel()->getChannelName()
|
||||
@@ -251,9 +245,8 @@ void PvaClientGet::issueConnect()
|
||||
Status PvaClientGet::waitConnect()
|
||||
{
|
||||
if(PvaClient::getDebug()) {
|
||||
cout << "PvaClientGet::waitConnect"
|
||||
<< " channelName " << pvaClientChannel->getChannel()->getChannelName()
|
||||
<< endl;
|
||||
cout << "PvaClientGet::waitConnect channelName "
|
||||
<< pvaClientChannel->getChannel()->getChannelName() << "\n";
|
||||
}
|
||||
{
|
||||
Lock xx(mutex);
|
||||
@@ -275,9 +268,8 @@ Status PvaClientGet::waitConnect()
|
||||
void PvaClientGet::get()
|
||||
{
|
||||
if(PvaClient::getDebug()) {
|
||||
cout << "PvaClientGet::get"
|
||||
<< " channelName " << pvaClientChannel->getChannel()->getChannelName()
|
||||
<< endl;
|
||||
cout << "PvaClientGet::get channelName "
|
||||
<< pvaClientChannel->getChannel()->getChannelName() << "\n";
|
||||
}
|
||||
issueGet();
|
||||
Status status = waitGet();
|
||||
@@ -290,9 +282,8 @@ void PvaClientGet::get()
|
||||
void PvaClientGet::issueGet()
|
||||
{
|
||||
if(PvaClient::getDebug()) {
|
||||
cout << "PvaClientGet::issueGet"
|
||||
<< " channelName " << pvaClientChannel->getChannel()->getChannelName()
|
||||
<< endl;
|
||||
cout << "PvaClientGet::issueGet channelName "
|
||||
<< pvaClientChannel->getChannel()->getChannelName() << "\n";
|
||||
}
|
||||
if(connectState==connectIdle) connect();
|
||||
if(getState==getActive) {
|
||||
@@ -307,9 +298,8 @@ void PvaClientGet::issueGet()
|
||||
Status PvaClientGet::waitGet()
|
||||
{
|
||||
if(PvaClient::getDebug()) {
|
||||
cout << "PvaClientGet::waitGet"
|
||||
<< " channelName " << pvaClientChannel->getChannel()->getChannelName()
|
||||
<< endl;
|
||||
cout << "PvaClientGet::waitGet channelName "
|
||||
<< pvaClientChannel->getChannel()->getChannelName() << "\n";
|
||||
}
|
||||
{
|
||||
Lock xx(mutex);
|
||||
@@ -330,9 +320,8 @@ Status PvaClientGet::waitGet()
|
||||
PvaClientGetDataPtr PvaClientGet::getData()
|
||||
{
|
||||
if(PvaClient::getDebug()) {
|
||||
cout<< "PvaClientGet::getData"
|
||||
<< " channelName " << pvaClientChannel->getChannel()->getChannelName()
|
||||
<< endl;
|
||||
cout<< "PvaClientGet::getData channelName "
|
||||
<< pvaClientChannel->getChannel()->getChannelName() << "\n";
|
||||
}
|
||||
checkConnectState();
|
||||
if(getState==getIdle) get();
|
||||
@@ -342,9 +331,8 @@ PvaClientGetDataPtr PvaClientGet::getData()
|
||||
void PvaClientGet::setRequester(PvaClientGetRequesterPtr const & pvaClientGetRequester)
|
||||
{
|
||||
if(PvaClient::getDebug()) {
|
||||
cout << "PvaClientGet::setRequester"
|
||||
<< " channelName " << pvaClientChannel->getChannel()->getChannelName()
|
||||
<< endl;
|
||||
cout << "PvaClientGet::setRequester channelName "
|
||||
<< pvaClientChannel->getChannel()->getChannelName() << "\n";
|
||||
}
|
||||
this->pvaClientGetRequester = pvaClientGetRequester;
|
||||
}
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
|
||||
#include <pv/pvaClient.h>
|
||||
|
||||
using std::tr1::static_pointer_cast;
|
||||
using namespace epics::pvData;
|
||||
using namespace epics::pvAccess;
|
||||
using namespace std;
|
||||
@@ -29,18 +28,13 @@ namespace epics { namespace pvaClient {
|
||||
|
||||
PvaClientGetDataPtr PvaClientGetData::create(StructureConstPtr const & structure)
|
||||
{
|
||||
if(PvaClient::getDebug()) {
|
||||
cout << "PvaClientGetData::create"
|
||||
<< endl;
|
||||
}
|
||||
if(PvaClient::getDebug()) cout << "PvaClientGetData::create\n";
|
||||
PvaClientGetDataPtr epv(new PvaClientGetData(structure));
|
||||
return epv;
|
||||
}
|
||||
|
||||
PvaClientGetData::PvaClientGetData(StructureConstPtr const & structure)
|
||||
: PvaClientData(structure)
|
||||
{
|
||||
// PvaClientData::create(structure);
|
||||
}
|
||||
{}
|
||||
|
||||
}}
|
||||
|
||||
@@ -17,8 +17,6 @@
|
||||
|
||||
#include <pv/pvaClient.h>
|
||||
|
||||
using std::tr1::static_pointer_cast;
|
||||
using std::tr1::dynamic_pointer_cast;
|
||||
using namespace epics::pvData;
|
||||
using namespace epics::pvAccess;
|
||||
using namespace std;
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
|
||||
#include <pv/pvaClient.h>
|
||||
|
||||
using std::tr1::static_pointer_cast;
|
||||
using namespace epics::pvData;
|
||||
using namespace epics::pvAccess;
|
||||
using namespace std;
|
||||
|
||||
@@ -17,9 +17,6 @@
|
||||
|
||||
#include <pv/pvaClientMultiChannel.h>
|
||||
|
||||
|
||||
|
||||
using std::tr1::static_pointer_cast;
|
||||
using namespace epics::pvData;
|
||||
using namespace epics::pvAccess;
|
||||
using namespace std;
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
|
||||
#include <pv/pvaClientMultiChannel.h>
|
||||
|
||||
using std::tr1::static_pointer_cast;
|
||||
using namespace epics::pvData;
|
||||
using namespace epics::pvAccess;
|
||||
using namespace epics::nt;
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
|
||||
#include <pv/pvaClientMultiChannel.h>
|
||||
|
||||
using std::tr1::static_pointer_cast;
|
||||
using namespace epics::pvData;
|
||||
using namespace epics::pvAccess;
|
||||
using namespace epics::nt;
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
|
||||
#include <pv/pvaClientMultiChannel.h>
|
||||
|
||||
using std::tr1::static_pointer_cast;
|
||||
using namespace epics::pvData;
|
||||
using namespace epics::pvAccess;
|
||||
using namespace epics::nt;
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
|
||||
#include <pv/pvaClientMultiChannel.h>
|
||||
|
||||
using std::tr1::static_pointer_cast;
|
||||
using namespace epics::pvData;
|
||||
using namespace epics::pvAccess;
|
||||
using namespace epics::nt;
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
|
||||
#include <pv/pvaClientMultiChannel.h>
|
||||
|
||||
using std::tr1::static_pointer_cast;
|
||||
using namespace epics::pvData;
|
||||
using namespace epics::pvAccess;
|
||||
using namespace epics::nt;
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
|
||||
#include <pv/pvaClientMultiChannel.h>
|
||||
|
||||
using std::tr1::static_pointer_cast;
|
||||
using namespace epics::pvData;
|
||||
using namespace epics::pvAccess;
|
||||
using namespace epics::nt;
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
|
||||
#include <pv/pvaClientMultiChannel.h>
|
||||
|
||||
using std::tr1::static_pointer_cast;
|
||||
using namespace epics::pvData;
|
||||
using namespace epics::pvAccess;
|
||||
using namespace epics::nt;
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
|
||||
#include <pv/pvaClient.h>
|
||||
|
||||
using std::tr1::static_pointer_cast;
|
||||
using namespace epics::pvData;
|
||||
using namespace epics::pvAccess;
|
||||
using namespace std;
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
|
||||
#include <pv/pvaClient.h>
|
||||
|
||||
using std::tr1::static_pointer_cast;
|
||||
using namespace epics::pvData;
|
||||
using namespace epics::pvAccess;
|
||||
using namespace std;
|
||||
|
||||
@@ -43,10 +43,7 @@ public:
|
||||
|
||||
PvaClientPutDataPtr PvaClientPutData::create(StructureConstPtr const & structure)
|
||||
{
|
||||
if(PvaClient::getDebug()) {
|
||||
cout << "PvaClientPutData::create"
|
||||
<< endl;
|
||||
}
|
||||
if(PvaClient::getDebug()) cout << "PvaClientPutData::create\n";
|
||||
PvaClientPutDataPtr epv(new PvaClientPutData(structure));
|
||||
return epv;
|
||||
}
|
||||
@@ -54,6 +51,7 @@ PvaClientPutDataPtr PvaClientPutData::create(StructureConstPtr const & structure
|
||||
PvaClientPutData::PvaClientPutData(StructureConstPtr const & structure)
|
||||
: PvaClientData(structure)
|
||||
{
|
||||
if(PvaClient::getDebug()) cout << "PvaClientPutData::PvaClientPutData\n";
|
||||
PVStructurePtr pvStructure(getPVDataCreate()->createPVStructure(structure));
|
||||
BitSetPtr bitSet(BitSetPtr(new BitSet(pvStructure->getNumberFields())));
|
||||
setData(pvStructure,bitSet);
|
||||
@@ -75,6 +73,7 @@ PvaClientPutData::PvaClientPutData(StructureConstPtr const & structure)
|
||||
|
||||
void PvaClientPutData::putDouble(double value)
|
||||
{
|
||||
if(PvaClient::getDebug()) cout << "PvaClientPutData::putDouble\n";
|
||||
PVScalarPtr pvScalar = getScalarValue();
|
||||
ScalarType scalarType = pvScalar->getScalar()->getScalarType();
|
||||
if(scalarType==pvDouble) {
|
||||
@@ -90,34 +89,43 @@ void PvaClientPutData::putDouble(double value)
|
||||
|
||||
void PvaClientPutData::putString(std::string const & value)
|
||||
{
|
||||
if(PvaClient::getDebug()) cout << "PvaClientPutData::putString\n";
|
||||
PVScalarPtr pvScalar = getScalarValue();
|
||||
convert->fromString(pvScalar,value);
|
||||
}
|
||||
|
||||
void PvaClientPutData::putDoubleArray(shared_vector<const double> const & value)
|
||||
{
|
||||
if(PvaClient::getDebug()) cout << "PvaClientPutData::putDoubleArray\n";
|
||||
PVScalarArrayPtr pvScalarArray = getScalarArrayValue();
|
||||
if(pvScalarArray->getScalarArray()->getElementType()!=pvDouble) {
|
||||
throw std::runtime_error(messagePrefix + notDoubleArray);
|
||||
}
|
||||
PVDoubleArrayPtr pv = static_pointer_cast<PVDoubleArray>(pvScalarArray);
|
||||
if(!pv) throw std::runtime_error(messagePrefix + notDoubleArray);
|
||||
pv->replace(value);
|
||||
}
|
||||
|
||||
void PvaClientPutData::putStringArray(shared_vector<const std::string> const & value)
|
||||
{
|
||||
if(PvaClient::getDebug()) cout << "PvaClientPutData::putStringArray\n";
|
||||
PVScalarArrayPtr pvScalarArray = getScalarArrayValue();
|
||||
if(pvScalarArray->getScalarArray()->getElementType()!=pvString) {
|
||||
throw std::runtime_error(messagePrefix + notStringArray);
|
||||
}
|
||||
PVStringArrayPtr pv = static_pointer_cast<PVStringArray>(pvScalarArray);
|
||||
if(!pv) throw std::runtime_error(messagePrefix + notStringArray);
|
||||
pv->replace(value);
|
||||
}
|
||||
|
||||
void PvaClientPutData::putStringArray(std::vector<std::string> const & value)
|
||||
{
|
||||
if(PvaClient::getDebug()) cout << "PvaClientPutData::putStringArray\n";
|
||||
PVScalarArrayPtr pvScalarArray = getScalarArrayValue();
|
||||
convert->fromStringArray(pvScalarArray,0,value.size(),value,0);
|
||||
}
|
||||
|
||||
void PvaClientPutData::postPut(size_t fieldNumber)
|
||||
{
|
||||
if(PvaClient::getDebug()) cout << "PvaClientPutData::postPut\n";
|
||||
getChangedBitSet()->set(fieldNumber);
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
|
||||
#include <pv/pvaClient.h>
|
||||
|
||||
using std::tr1::static_pointer_cast;
|
||||
using namespace epics::pvData;
|
||||
using namespace epics::pvAccess;
|
||||
using namespace std;
|
||||
@@ -174,7 +173,7 @@ void PvaClientPutGet::channelPutGetConnect(
|
||||
<< " channelName " << pvaClientChannel->getChannel()->getChannelName()
|
||||
<< " status.isOK " << (status.isOK() ? "true" : "false")
|
||||
<< endl;
|
||||
}
|
||||
}
|
||||
{
|
||||
Lock xx(mutex);
|
||||
this->channelPutGet = channelPutGet;
|
||||
@@ -215,10 +214,13 @@ void PvaClientPutGet::putGetDone(
|
||||
<< " status.isOK " << (status.isOK() ? "true" : "false")
|
||||
<< endl;
|
||||
}
|
||||
channelPutGetStatus = status;
|
||||
putGetState = putGetComplete;
|
||||
if(status.isOK()) {
|
||||
pvaClientGetData->setData(getPVStructure,getChangedBitSet);
|
||||
{
|
||||
Lock xx(mutex);
|
||||
channelPutGetStatus = status;
|
||||
putGetState = putGetComplete;
|
||||
if(status.isOK()) {
|
||||
pvaClientGetData->setData(getPVStructure,getChangedBitSet);
|
||||
}
|
||||
}
|
||||
PvaClientPutGetRequesterPtr req(pvaClientPutGetRequester.lock());
|
||||
if(req) {
|
||||
@@ -239,14 +241,17 @@ void PvaClientPutGet::getPutDone(
|
||||
<< " status.isOK " << (status.isOK() ? "true" : "false")
|
||||
<< endl;
|
||||
}
|
||||
channelPutGetStatus = status;
|
||||
putGetState = putGetComplete;
|
||||
if(status.isOK()) {
|
||||
PVStructurePtr pvs = pvaClientPutData->getPVStructure();
|
||||
pvs->copyUnchecked(*putPVStructure,*putBitSet);
|
||||
BitSetPtr bs = pvaClientPutData->getChangedBitSet();
|
||||
bs->clear();
|
||||
*bs |= *putBitSet;
|
||||
{
|
||||
Lock xx(mutex);
|
||||
channelPutGetStatus = status;
|
||||
putGetState = putGetComplete;
|
||||
if(status.isOK()) {
|
||||
PVStructurePtr pvs = pvaClientPutData->getPVStructure();
|
||||
pvs->copyUnchecked(*putPVStructure,*putBitSet);
|
||||
BitSetPtr bs = pvaClientPutData->getChangedBitSet();
|
||||
bs->clear();
|
||||
*bs |= *putBitSet;
|
||||
}
|
||||
}
|
||||
PvaClientPutGetRequesterPtr req(pvaClientPutGetRequester.lock());
|
||||
if(req) {
|
||||
@@ -267,10 +272,13 @@ void PvaClientPutGet::getGetDone(
|
||||
<< " status.isOK " << (status.isOK() ? "true" : "false")
|
||||
<< endl;
|
||||
}
|
||||
channelPutGetStatus = status;
|
||||
putGetState = putGetComplete;
|
||||
if(status.isOK()) {
|
||||
pvaClientGetData->setData(getPVStructure,getChangedBitSet);
|
||||
{
|
||||
Lock xx(mutex);
|
||||
channelPutGetStatus = status;
|
||||
putGetState = putGetComplete;
|
||||
if(status.isOK()) {
|
||||
pvaClientGetData->setData(getPVStructure,getChangedBitSet);
|
||||
}
|
||||
}
|
||||
PvaClientPutGetRequesterPtr req(pvaClientPutGetRequester.lock());
|
||||
if(req) {
|
||||
|
||||
@@ -17,8 +17,6 @@
|
||||
|
||||
#include <pv/pvaClient.h>
|
||||
|
||||
using std::tr1::static_pointer_cast;
|
||||
using std::tr1::dynamic_pointer_cast;
|
||||
using namespace epics::pvData;
|
||||
using namespace epics::pvAccess;
|
||||
using namespace std;
|
||||
|
||||
Reference in New Issue
Block a user