Merge pull request #3 from mdavidsaver/getdeprecate
Deprecated PVStructure::get*Field methods trigger a warning
This commit is contained in:
@@ -78,11 +78,11 @@ PVCopyPtr PVCopy::create(
|
||||
PVStructurePtr pvStructure(pvRequest);
|
||||
if(structureName.size()>0) {
|
||||
if(pvRequest->getStructure()->getNumberFields()>0) {
|
||||
pvStructure = pvRequest->getStructureField(structureName);
|
||||
pvStructure = pvRequest->getSubField<PVStructure>(structureName);
|
||||
if(!pvStructure) return NULLPVCopy;
|
||||
}
|
||||
} else if(pvStructure->getSubField("field")) {
|
||||
pvStructure = pvRequest->getStructureField("field");
|
||||
pvStructure = pvRequest->getSubField<PVStructure>("field");
|
||||
}
|
||||
PVCopyPtr pvCopy = PVCopyPtr(new PVCopy(pvMaster));
|
||||
bool result = pvCopy->init(pvStructure);
|
||||
@@ -349,7 +349,7 @@ bool PVCopy::init(epics::pvData::PVStructurePtr const &pvRequest)
|
||||
if(len==0) entireMaster = true;
|
||||
PVStructurePtr pvOptions;
|
||||
if(len==1 && pvRequest->getSubField("_options")) {
|
||||
pvOptions = pvRequest->getStructureField("_options");
|
||||
pvOptions = pvRequest->getSubField<PVStructure>("_options");
|
||||
}
|
||||
if(entireMaster) {
|
||||
structure = pvMasterStructure->getStructure();
|
||||
|
||||
@@ -28,14 +28,14 @@ bool PVAlarm::attach(PVFieldPtr const & pvField)
|
||||
{
|
||||
if(pvField->getField()->getType()!=structure) return false;
|
||||
PVStructurePtr pvStructure = static_pointer_cast<PVStructure>(pvField);
|
||||
pvSeverity = pvStructure->getIntField("severity");
|
||||
pvSeverity = pvStructure->getSubField<PVInt>("severity");
|
||||
if(pvSeverity.get()==NULL) return false;
|
||||
pvStatus = pvStructure->getIntField("status");
|
||||
pvStatus = pvStructure->getSubField<PVInt>("status");
|
||||
if(pvStatus.get()==NULL) {
|
||||
pvSeverity.reset();
|
||||
return false;
|
||||
}
|
||||
pvMessage = pvStructure->getStringField("message");
|
||||
pvMessage = pvStructure->getSubField<PVString>("message");
|
||||
if(pvMessage.get()==NULL) {
|
||||
pvSeverity.reset();
|
||||
pvStatus.reset();
|
||||
|
||||
@@ -28,14 +28,14 @@ bool PVControl::attach(PVFieldPtr const & pvField)
|
||||
{
|
||||
if(pvField->getField()->getType()!=structure) return false;
|
||||
PVStructurePtr pvStructure = static_pointer_cast<PVStructure>(pvField);
|
||||
pvLow = pvStructure->getDoubleField("limitLow");
|
||||
pvLow = pvStructure->getSubField<PVDouble>("limitLow");
|
||||
if(pvLow.get()==NULL) return false;
|
||||
pvHigh = pvStructure->getDoubleField("limitHigh");
|
||||
pvHigh = pvStructure->getSubField<PVDouble>("limitHigh");
|
||||
if(pvHigh.get()==NULL) {
|
||||
pvLow.reset();
|
||||
return false;
|
||||
}
|
||||
pvMinStep = pvStructure->getDoubleField("minStep");
|
||||
pvMinStep = pvStructure->getSubField<PVDouble>("minStep");
|
||||
if(pvMinStep.get()==NULL) {
|
||||
pvLow.reset();
|
||||
pvHigh.reset();
|
||||
|
||||
@@ -28,24 +28,24 @@ bool PVDisplay::attach(PVFieldPtr const & pvField)
|
||||
{
|
||||
if(pvField->getField()->getType()!=structure) return false;
|
||||
PVStructurePtr pvStructure = static_pointer_cast<PVStructure>(pvField);
|
||||
pvDescription = pvStructure->getStringField("description");
|
||||
pvDescription = pvStructure->getSubField<PVString>("description");
|
||||
if(pvDescription.get()==NULL) return false;
|
||||
pvFormat = pvStructure->getStringField("format");
|
||||
pvFormat = pvStructure->getSubField<PVString>("format");
|
||||
if(pvFormat.get()==NULL) {
|
||||
detach();
|
||||
return false;
|
||||
}
|
||||
pvUnits = pvStructure->getStringField("units");
|
||||
pvUnits = pvStructure->getSubField<PVString>("units");
|
||||
if(pvUnits.get()==NULL) {
|
||||
detach();
|
||||
return false;
|
||||
}
|
||||
pvLow = pvStructure->getDoubleField(string("limitLow"));
|
||||
pvLow = pvStructure->getSubField<PVDouble>(string("limitLow"));
|
||||
if(pvLow.get()==NULL) {
|
||||
detach();
|
||||
return false;
|
||||
}
|
||||
pvHigh = pvStructure->getDoubleField(string("limitHigh"));
|
||||
pvHigh = pvStructure->getSubField<PVDouble>(string("limitHigh"));
|
||||
if(pvHigh.get()==NULL) {
|
||||
detach();
|
||||
return false;
|
||||
|
||||
@@ -28,7 +28,7 @@ bool PVEnumerated::attach(PVFieldPtr const & pvField)
|
||||
{
|
||||
if(pvField->getField()->getType()!=structure) return false;
|
||||
PVStructurePtr pvStructure = static_pointer_cast<PVStructure>(pvField);
|
||||
pvIndex = pvStructure->getIntField("index");
|
||||
pvIndex = pvStructure->getSubField<PVInt>("index");
|
||||
if(pvIndex.get()==NULL) return false;
|
||||
PVScalarArrayPtr pvScalarArray = pvStructure->getScalarArrayField(
|
||||
"choices",pvString);
|
||||
|
||||
@@ -30,11 +30,11 @@ bool PVTimeStamp::attach(PVFieldPtr const & pvField)
|
||||
PVStructurePtr xxx = static_pointer_cast<PVStructure>(pvField);
|
||||
PVStructure* pvStructure = xxx.get();
|
||||
while(true) {
|
||||
PVLongPtr pvLong = pvStructure->getLongField("secondsPastEpoch");
|
||||
PVLongPtr pvLong = pvStructure->getSubField<PVLong>("secondsPastEpoch");
|
||||
if(pvLong.get()!=NULL) {
|
||||
pvSecs = pvLong;
|
||||
pvNano = pvStructure->getIntField("nanoseconds");
|
||||
pvUserTag = pvStructure->getIntField("userTag");
|
||||
pvNano = pvStructure->getSubField<PVInt>("nanoseconds");
|
||||
pvUserTag = pvStructure->getSubField<PVInt>("userTag");
|
||||
}
|
||||
if(pvSecs.get()!=NULL
|
||||
&& pvNano.get()!=NULL
|
||||
|
||||
@@ -33,6 +33,14 @@
|
||||
typedef class std::ios std::ios_base;
|
||||
#endif
|
||||
|
||||
#if defined(__GNUC__) && !(defined(__vxworks) && !defined(_WRS_VXWORKS_MAJOR))
|
||||
#define USAGE_DEPRECATED __attribute__((deprecated))
|
||||
#define USAGE_ERROR(MSG) __attribute__((error(MSG)))
|
||||
#else
|
||||
#define USAGE_DEPRECATED
|
||||
#define USAGE_ERROR(MSG) { throw std::runtime_error(MSG); }
|
||||
#endif
|
||||
|
||||
namespace epics { namespace pvData {
|
||||
|
||||
class PostHandler;
|
||||
@@ -709,84 +717,84 @@ public:
|
||||
* @param fieldName The name of the field to get.
|
||||
* @return Pointer to the field of null if a field with that name and type does not exist.
|
||||
*/
|
||||
PVBooleanPtr getBooleanField(std::string const &fieldName) ;
|
||||
PVBooleanPtr getBooleanField(std::string const &fieldName) USAGE_DEPRECATED;
|
||||
/**
|
||||
* Get a byte field with the specified name.
|
||||
* @deprecated No longer needed. Use templete version of getSubField
|
||||
* @param fieldName The name of the field to get.
|
||||
* @return Pointer to the field of null if a field with that name and type does not exist.
|
||||
*/
|
||||
PVBytePtr getByteField(std::string const &fieldName) ;
|
||||
PVBytePtr getByteField(std::string const &fieldName) USAGE_DEPRECATED;
|
||||
/**
|
||||
* Get a short field with the specified name.
|
||||
* @deprecated No longer needed. Use templete version of getSubField
|
||||
* @param fieldName The name of the field to get.
|
||||
* @return Pointer to the field of null if a field with that name and type does not exist.
|
||||
*/
|
||||
PVShortPtr getShortField(std::string const &fieldName) ;
|
||||
PVShortPtr getShortField(std::string const &fieldName) USAGE_DEPRECATED;
|
||||
/**
|
||||
* Get a int field with the specified name.
|
||||
* @deprecated No longer needed. Use templete version of getSubField
|
||||
* @param fieldName The name of the field to get.
|
||||
* @return Pointer to the field of null if a field with that name and type does not exist.
|
||||
*/
|
||||
PVIntPtr getIntField(std::string const &fieldName) ;
|
||||
PVIntPtr getIntField(std::string const &fieldName) USAGE_DEPRECATED;
|
||||
/**
|
||||
* Get a long field with the specified name.
|
||||
* @deprecated No longer needed. Use templete version of getSubField
|
||||
* @param fieldName The name of the field to get.
|
||||
* @return Pointer to the field of null if a field with that name and type does not exist.
|
||||
*/
|
||||
PVLongPtr getLongField(std::string const &fieldName) ;
|
||||
PVLongPtr getLongField(std::string const &fieldName) USAGE_DEPRECATED;
|
||||
/**
|
||||
* Get an unsigned byte field with the specified name.
|
||||
* @deprecated No longer needed. Use templete version of getSubField
|
||||
* @param fieldName The name of the field to get.
|
||||
* @return Pointer to the field of null if a field with that name and type does not exist.
|
||||
*/
|
||||
PVUBytePtr getUByteField(std::string const &fieldName) ;
|
||||
PVUBytePtr getUByteField(std::string const &fieldName) USAGE_DEPRECATED;
|
||||
/**
|
||||
* Get an unsigned short field with the specified name.
|
||||
* @deprecated No longer needed. Use templete version of getSubField
|
||||
* @param fieldName The name of the field to get.
|
||||
* @return Pointer to the field of null if a field with that name and type does not exist.
|
||||
*/
|
||||
PVUShortPtr getUShortField(std::string const &fieldName) ;
|
||||
PVUShortPtr getUShortField(std::string const &fieldName) USAGE_DEPRECATED;
|
||||
/**
|
||||
* Get an unsigned int field with the specified name.
|
||||
* @deprecated No longer needed. Use templete version of getSubField
|
||||
* @param fieldName The name of the field to get.
|
||||
* @return Pointer to the field of null if a field with that name and type does not exist.
|
||||
*/
|
||||
PVUIntPtr getUIntField(std::string const &fieldName) ;
|
||||
PVUIntPtr getUIntField(std::string const &fieldName) USAGE_DEPRECATED;
|
||||
/**
|
||||
* Get an unsigned long field with the specified name.
|
||||
* @deprecated No longer needed. Use templete version of getSubField
|
||||
* @param fieldName The name of the field to get.
|
||||
* @return Pointer to the field of null if a field with that name and type does not exist.
|
||||
*/
|
||||
PVULongPtr getULongField(std::string const &fieldName) ;
|
||||
PVULongPtr getULongField(std::string const &fieldName) USAGE_DEPRECATED;
|
||||
/**
|
||||
* Get a float field with the specified name.
|
||||
* @deprecated No longer needed. Use templete version of getSubField
|
||||
* @param fieldName The name of the field to get.
|
||||
* @return Pointer to the field of null if a field with that name and type does not exist.
|
||||
*/
|
||||
PVFloatPtr getFloatField(std::string const &fieldName) ;
|
||||
PVFloatPtr getFloatField(std::string const &fieldName) USAGE_DEPRECATED;
|
||||
/**
|
||||
* Get a double field with the specified name.
|
||||
* @deprecated No longer needed. Use templete version of getSubField
|
||||
* @param fieldName The name of the field to get.
|
||||
* @return Pointer to the field of null if a field with that name and type does not exist.
|
||||
*/
|
||||
PVDoublePtr getDoubleField(std::string const &fieldName) ;
|
||||
PVDoublePtr getDoubleField(std::string const &fieldName) USAGE_DEPRECATED;
|
||||
/**
|
||||
* Get a string field with the specified name.
|
||||
* @deprecated No longer needed. Use templete version of getSubField
|
||||
* @param fieldName The name of the field to get.
|
||||
* @return Pointer to the field of null if a field with that name and type does not exist.
|
||||
*/
|
||||
PVStringPtr getStringField(std::string const &fieldName) ;
|
||||
PVStringPtr getStringField(std::string const &fieldName) USAGE_DEPRECATED;
|
||||
|
||||
/**
|
||||
* Get a structure field with the specified name.
|
||||
@@ -794,14 +802,14 @@ public:
|
||||
* @param fieldName The name of the field to get.
|
||||
* @return Pointer to the field of null if a field with that name and type does not exist.
|
||||
*/
|
||||
PVStructurePtr getStructureField(std::string const &fieldName) ;
|
||||
PVStructurePtr getStructureField(std::string const &fieldName) USAGE_DEPRECATED;
|
||||
/**
|
||||
* Get a union field with the specified name.
|
||||
* @deprecated No longer needed. Use templete version of getSubField
|
||||
* @param fieldName The name of the field to get.
|
||||
* @return Pointer to the field of null if a field with that name and type does not exist.
|
||||
*/
|
||||
PVUnionPtr getUnionField(std::string const &fieldName) ;
|
||||
PVUnionPtr getUnionField(std::string const &fieldName) USAGE_DEPRECATED;
|
||||
/**
|
||||
* Get a scalarArray field with the specified name.
|
||||
* @deprecated No longer needed. Use templete version of getSubField
|
||||
@@ -810,21 +818,21 @@ public:
|
||||
* @return Pointer to the field of null if a field with that name and type does not exist.
|
||||
*/
|
||||
PVScalarArrayPtr getScalarArrayField(
|
||||
std::string const &fieldName,ScalarType elementType) ;
|
||||
std::string const &fieldName,ScalarType elementType);
|
||||
/**
|
||||
* Get a structureArray field with the specified name.
|
||||
* @deprecated No longer needed. Use templete version of getSubField
|
||||
* @param fieldName The name of the field to get.
|
||||
* @return Pointer to the field of null if a field with that name and type does not exist.
|
||||
*/
|
||||
PVStructureArrayPtr getStructureArrayField(std::string const &fieldName) ;
|
||||
PVStructureArrayPtr getStructureArrayField(std::string const &fieldName) USAGE_DEPRECATED;
|
||||
/**
|
||||
* Get a unionArray field with the specified name.
|
||||
* @deprecated No longer needed. Use templete version of getSubField
|
||||
* @param fieldName The name of the field to get.
|
||||
* @return Pointer to the field of null if a field with that name and type does not exist.
|
||||
*/
|
||||
PVUnionArrayPtr getUnionArrayField(std::string const &fieldName) ;
|
||||
PVUnionArrayPtr getUnionArrayField(std::string const &fieldName) USAGE_DEPRECATED;
|
||||
/**
|
||||
* Serialize.
|
||||
* @param pbuffer The byte buffer.
|
||||
@@ -1621,6 +1629,9 @@ namespace std{
|
||||
epicsShareExtern std::ostream& operator<<(std::ostream& o, const epics::pvData::PVField *ptr);
|
||||
}
|
||||
|
||||
#undef USAGE_DEPRECATED
|
||||
#undef USAGE_ERROR
|
||||
|
||||
#endif /* PVDATA_H */
|
||||
|
||||
/** @page Overview Documentation
|
||||
|
||||
@@ -32,17 +32,17 @@ void test()
|
||||
string buffer;
|
||||
string properties("alarm,timeStamp,display");
|
||||
PVStructurePtr pvStructure = standardPVField->scalar(pvDouble,properties);
|
||||
PVDoublePtr pvValue = pvStructure->getDoubleField("value");
|
||||
PVDoublePtr pvValue = pvStructure->getSubField<PVDouble>("value");
|
||||
uint32 valueOffset = (uint32) pvValue->getFieldOffset();
|
||||
PVStructurePtr pvAlarm = pvStructure->getStructureField("alarm");
|
||||
PVIntPtr pvSeverity = pvAlarm->getIntField("severity");
|
||||
PVStringPtr pvMessage = pvAlarm->getStringField("message");
|
||||
PVStructurePtr pvAlarm = pvStructure->getSubField<PVStructure>("alarm");
|
||||
PVIntPtr pvSeverity = pvAlarm->getSubField<PVInt>("severity");
|
||||
PVStringPtr pvMessage = pvAlarm->getSubField<PVString>("message");
|
||||
uint32 severityOffset = (uint32) pvSeverity->getFieldOffset();
|
||||
uint32 messageOffset = (uint32) pvMessage->getFieldOffset();
|
||||
PVStructurePtr pvTimeStamp = pvStructure->getStructureField("timeStamp");
|
||||
PVLongPtr pvSeconds = pvTimeStamp->getLongField("secondsPastEpoch");
|
||||
PVIntPtr pvNanoseconds = pvTimeStamp->getIntField("nanoseconds");
|
||||
PVIntPtr pvUserTag = pvTimeStamp->getIntField("userTag");
|
||||
PVStructurePtr pvTimeStamp = pvStructure->getSubField<PVStructure>("timeStamp");
|
||||
PVLongPtr pvSeconds = pvTimeStamp->getSubField<PVLong>("secondsPastEpoch");
|
||||
PVIntPtr pvNanoseconds = pvTimeStamp->getSubField<PVInt>("nanoseconds");
|
||||
PVIntPtr pvUserTag = pvTimeStamp->getSubField<PVInt>("userTag");
|
||||
uint32 timeStampOffset = (uint32) pvTimeStamp->getFieldOffset();
|
||||
uint32 secondsOffset = (uint32) pvSeconds->getFieldOffset();
|
||||
uint32 nanosecondsOffset = (uint32) pvNanoseconds->getFieldOffset();
|
||||
|
||||
@@ -385,9 +385,9 @@ void testStructure() {
|
||||
|
||||
testDiag("\tSimple structure serialization");
|
||||
PVStructurePtr pvStructure = factory->createPVStructure(getStandardField()->timeStamp());
|
||||
pvStructure->getLongField("secondsPastEpoch")->put(123);
|
||||
pvStructure->getIntField("nanoseconds")->put(456);
|
||||
pvStructure->getIntField("userTag")->put(789);
|
||||
pvStructure->getSubField<PVLong>("secondsPastEpoch")->put(123);
|
||||
pvStructure->getSubField<PVInt>("nanoseconds")->put(456);
|
||||
pvStructure->getSubField<PVInt>("userTag")->put(789);
|
||||
|
||||
serializationTest(pvStructure);
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ MAIN(testOperators)
|
||||
|
||||
const double testDV = 12.8;
|
||||
|
||||
PVDoublePtr pvValue = pvStructure->getDoubleField("value");
|
||||
PVDoublePtr pvValue = pvStructure->getSubField<PVDouble>("value");
|
||||
*pvValue <<= testDV;
|
||||
|
||||
double dv;
|
||||
@@ -41,7 +41,7 @@ MAIN(testOperators)
|
||||
|
||||
const string testSV = "test message";
|
||||
|
||||
PVStringPtr pvMessage = pvStructure->getStringField("alarm.message");
|
||||
PVStringPtr pvMessage = pvStructure->getSubField<PVString>("alarm.message");
|
||||
*pvMessage <<= testSV;
|
||||
|
||||
string sv;
|
||||
@@ -90,7 +90,7 @@ MAIN(testOperators)
|
||||
pvStructures[i]=
|
||||
pvDataCreate->createPVStructure(structure);
|
||||
}
|
||||
PVStructureArrayPtr pvStructureArray = pvStructure->getStructureArrayField("value");
|
||||
PVStructureArrayPtr pvStructureArray = pvStructure->getSubField<PVStructureArray>("value");
|
||||
pvStructureArray->replace(freeze(pvStructures));
|
||||
std::cout << *pvStructure << std::endl;
|
||||
|
||||
|
||||
@@ -89,7 +89,7 @@ static void testPVScalarWithProperties(
|
||||
pvStructure = standardPVField->scalar(
|
||||
stype,alarmTimeStampValueAlarm);
|
||||
hasBooleanAlarm = true;
|
||||
PVBooleanPtr pvField = pvStructure->getBooleanField("value");
|
||||
PVBooleanPtr pvField = pvStructure->getSubField<PVBoolean>("value");
|
||||
pvField->put(true);
|
||||
break;
|
||||
}
|
||||
@@ -98,7 +98,7 @@ static void testPVScalarWithProperties(
|
||||
stype,allProperties);
|
||||
hasValueAlarm = true;
|
||||
hasDisplayControl = true;
|
||||
PVBytePtr pvField = pvStructure->getByteField("value");
|
||||
PVBytePtr pvField = pvStructure->getSubField<PVByte>("value");
|
||||
pvField->put(127);
|
||||
break;
|
||||
}
|
||||
@@ -107,7 +107,7 @@ static void testPVScalarWithProperties(
|
||||
stype,allProperties);
|
||||
hasValueAlarm = true;
|
||||
hasDisplayControl = true;
|
||||
PVShortPtr pvField = pvStructure->getShortField("value");
|
||||
PVShortPtr pvField = pvStructure->getSubField<PVShort>("value");
|
||||
pvField->put(32767);
|
||||
break;
|
||||
}
|
||||
@@ -116,7 +116,7 @@ static void testPVScalarWithProperties(
|
||||
stype,allProperties);
|
||||
hasValueAlarm = true;
|
||||
hasDisplayControl = true;
|
||||
PVIntPtr pvField = pvStructure->getIntField("value");
|
||||
PVIntPtr pvField = pvStructure->getSubField<PVInt>("value");
|
||||
pvField->put((int32)0x80000000);
|
||||
break;
|
||||
}
|
||||
@@ -125,7 +125,7 @@ static void testPVScalarWithProperties(
|
||||
stype,allProperties);
|
||||
hasValueAlarm = true;
|
||||
hasDisplayControl = true;
|
||||
PVLongPtr pvField = pvStructure->getLongField("value");
|
||||
PVLongPtr pvField = pvStructure->getSubField<PVLong>("value");
|
||||
int64 value = 0x80000000;
|
||||
value <<= 32;
|
||||
value |= 0xffffffff;
|
||||
@@ -137,7 +137,7 @@ static void testPVScalarWithProperties(
|
||||
stype,allProperties);
|
||||
hasValueAlarm = true;
|
||||
hasDisplayControl = true;
|
||||
PVUBytePtr pvField = pvStructure->getUByteField("value");
|
||||
PVUBytePtr pvField = pvStructure->getSubField<PVUByte>("value");
|
||||
pvField->put(255);
|
||||
break;
|
||||
}
|
||||
@@ -146,7 +146,7 @@ static void testPVScalarWithProperties(
|
||||
stype,allProperties);
|
||||
hasValueAlarm = true;
|
||||
hasDisplayControl = true;
|
||||
PVUShortPtr pvField = pvStructure->getUShortField("value");
|
||||
PVUShortPtr pvField = pvStructure->getSubField<PVUShort>("value");
|
||||
pvField->put(65535);
|
||||
break;
|
||||
}
|
||||
@@ -155,7 +155,7 @@ static void testPVScalarWithProperties(
|
||||
stype,allProperties);
|
||||
hasValueAlarm = true;
|
||||
hasDisplayControl = true;
|
||||
PVUIntPtr pvField = pvStructure->getUIntField("value");
|
||||
PVUIntPtr pvField = pvStructure->getSubField<PVUInt>("value");
|
||||
pvField->put((uint32)0x80000000);
|
||||
break;
|
||||
}
|
||||
@@ -164,7 +164,7 @@ static void testPVScalarWithProperties(
|
||||
stype,allProperties);
|
||||
hasValueAlarm = true;
|
||||
hasDisplayControl = true;
|
||||
PVULongPtr pvField = pvStructure->getULongField("value");
|
||||
PVULongPtr pvField = pvStructure->getSubField<PVULong>("value");
|
||||
int64 value = 0x80000000;
|
||||
value <<= 32;
|
||||
value |= 0xffffffff;
|
||||
@@ -176,7 +176,7 @@ static void testPVScalarWithProperties(
|
||||
stype,allProperties);
|
||||
hasValueAlarm = true;
|
||||
hasDisplayControl = true;
|
||||
PVFloatPtr pvField = pvStructure->getFloatField("value");
|
||||
PVFloatPtr pvField = pvStructure->getSubField<PVFloat>("value");
|
||||
pvField->put(1.123e8);
|
||||
break;
|
||||
}
|
||||
@@ -185,57 +185,57 @@ static void testPVScalarWithProperties(
|
||||
stype,allProperties);
|
||||
hasValueAlarm = true;
|
||||
hasDisplayControl = true;
|
||||
PVDoublePtr pvField = pvStructure->getDoubleField("value");
|
||||
PVDoublePtr pvField = pvStructure->getSubField<PVDouble>("value");
|
||||
pvField->put(1.123e35);
|
||||
break;
|
||||
}
|
||||
case pvString: {
|
||||
pvStructure = standardPVField->scalar(
|
||||
stype,alarmTimeStamp);
|
||||
PVStringPtr pvField = pvStructure->getStringField("value");
|
||||
PVStringPtr pvField = pvStructure->getSubField<PVString>("value");
|
||||
pvField->put(string("this is a string"));
|
||||
break;
|
||||
}
|
||||
}
|
||||
PVLongPtr seconds = pvStructure->getLongField(
|
||||
PVLongPtr seconds = pvStructure->getSubField<PVLong>(
|
||||
string("timeStamp.secondsPastEpoch"));
|
||||
testOk1(seconds.get()!=0);
|
||||
seconds->put(123456789);
|
||||
PVIntPtr nano = pvStructure->getIntField(string("timeStamp.nanoseconds"));
|
||||
PVIntPtr nano = pvStructure->getSubField<PVInt>(string("timeStamp.nanoseconds"));
|
||||
testOk1(nano.get()!=0);
|
||||
nano->put(1000000);
|
||||
PVIntPtr severity = pvStructure->getIntField(string("alarm.severity"));
|
||||
PVIntPtr severity = pvStructure->getSubField<PVInt>(string("alarm.severity"));
|
||||
testOk1(severity.get()!=0);
|
||||
severity->put(2);
|
||||
PVStringPtr message = pvStructure->getStringField(string("alarm.message"));
|
||||
PVStringPtr message = pvStructure->getSubField<PVString>(string("alarm.message"));
|
||||
testOk1(message.get()!=0);
|
||||
message->put(string("messageForAlarm"));
|
||||
if(hasDisplayControl) {
|
||||
PVStringPtr desc = pvStructure->getStringField(
|
||||
PVStringPtr desc = pvStructure->getSubField<PVString>(
|
||||
string("display.description"));
|
||||
testOk1(desc.get()!=0);
|
||||
desc->put(string("this is a description"));
|
||||
PVStringPtr format = pvStructure->getStringField(
|
||||
PVStringPtr format = pvStructure->getSubField<PVString>(
|
||||
string("display.format"));
|
||||
testOk1(format.get()!=0);
|
||||
format->put(string("f10.2"));
|
||||
PVStringPtr units = pvStructure->getStringField(
|
||||
PVStringPtr units = pvStructure->getSubField<PVString>(
|
||||
string("display.units"));
|
||||
testOk1(units.get()!=0);
|
||||
units->put(string("SomeUnits"));
|
||||
PVDoublePtr limit = pvStructure->getDoubleField(
|
||||
PVDoublePtr limit = pvStructure->getSubField<PVDouble>(
|
||||
string("display.limitLow"));
|
||||
testOk1(limit.get()!=0);
|
||||
limit->put(0.0);
|
||||
limit = pvStructure->getDoubleField(
|
||||
limit = pvStructure->getSubField<PVDouble>(
|
||||
string("display.limitHigh"));
|
||||
testOk1(limit.get()!=0);
|
||||
limit->put(10.0);
|
||||
limit = pvStructure->getDoubleField(
|
||||
limit = pvStructure->getSubField<PVDouble>(
|
||||
string("control.limitLow"));
|
||||
testOk1(limit.get()!=0);
|
||||
limit->put(1.0);
|
||||
limit = pvStructure->getDoubleField(
|
||||
limit = pvStructure->getSubField<PVDouble>(
|
||||
string("control.limitHigh"));
|
||||
testOk1(limit.get()!=0);
|
||||
limit->put(9.0);
|
||||
@@ -255,15 +255,15 @@ static void testPVScalarWithProperties(
|
||||
pvtemp = static_pointer_cast<PVScalar>(pvField);
|
||||
testOk1(pvtemp.get()!=0);
|
||||
convert->fromDouble(pvtemp,9.0);
|
||||
severity = pvStructure->getIntField(
|
||||
severity = pvStructure->getSubField<PVInt>(
|
||||
string("valueAlarm.lowAlarmSeverity"));
|
||||
testOk1(severity.get()!=0);
|
||||
severity->put(2);
|
||||
severity = pvStructure->getIntField(
|
||||
severity = pvStructure->getSubField<PVInt>(
|
||||
string("valueAlarm.highAlarmSeverity"));
|
||||
testOk1(severity.get()!=0);
|
||||
severity->put(2);
|
||||
PVBooleanPtr active = pvStructure->getBooleanField(
|
||||
PVBooleanPtr active = pvStructure->getSubField<PVBoolean>(
|
||||
string("valueAlarm.active"));
|
||||
testOk1(active.get()!=0);
|
||||
active->put(true);
|
||||
@@ -273,15 +273,15 @@ static void testPVScalarWithProperties(
|
||||
string("valueAlarm.active"));
|
||||
PVBooleanPtr pvBoolean = static_pointer_cast<PVBoolean>(pvField);
|
||||
pvBoolean->put(true);
|
||||
severity = pvStructure->getIntField(
|
||||
severity = pvStructure->getSubField<PVInt>(
|
||||
string("valueAlarm.falseSeverity"));
|
||||
testOk1(severity.get()!=0);
|
||||
severity->put(0);
|
||||
severity = pvStructure->getIntField(
|
||||
severity = pvStructure->getSubField<PVInt>(
|
||||
string("valueAlarm.trueSeverity"));
|
||||
testOk1(severity.get()!=0);
|
||||
severity->put(2);
|
||||
severity = pvStructure->getIntField(
|
||||
severity = pvStructure->getSubField<PVInt>(
|
||||
string("valueAlarm.changeStateSeverity"));
|
||||
testOk1(severity.get()!=0);
|
||||
severity->put(1);
|
||||
|
||||
@@ -45,11 +45,11 @@ MAIN(testStandardPVField)
|
||||
testPlan(1);
|
||||
PVStructurePtr pvStructure = standardPVField->scalar(pvDouble,
|
||||
"alarm,timeStamp,display,control,valueAlarm");
|
||||
PVDoublePtr pvValue = pvStructure->getDoubleField("value");
|
||||
PVDoublePtr pvValue = pvStructure->getSubField<PVDouble>("value");
|
||||
pvValue->put(10.0);
|
||||
PVIntPtr pvSeverity = pvStructure->getIntField("alarm.severity");
|
||||
PVIntPtr pvSeverity = pvStructure->getSubField<PVInt>("alarm.severity");
|
||||
pvSeverity->put(2);
|
||||
PVStringPtr pvMessage = pvStructure->getStringField("alarm.message");
|
||||
PVStringPtr pvMessage = pvStructure->getSubField<PVString>("alarm.message");
|
||||
pvMessage->put("test message");
|
||||
print("scalarTest", pvStructure);
|
||||
pvStructure = standardPVField->scalar(pvBoolean,"alarm,timeStamp,valueAlarm");
|
||||
@@ -71,7 +71,7 @@ MAIN(testStandardPVField)
|
||||
pvStructures[i]=
|
||||
pvDataCreate->createPVStructure(structure);
|
||||
}
|
||||
PVStructureArrayPtr pvStructureArray = pvStructure->getStructureArrayField("value");
|
||||
PVStructureArrayPtr pvStructureArray = pvStructure->getSubField<PVStructureArray>("value");
|
||||
pvStructureArray->replace(freeze(pvStructures));
|
||||
print("structureArrayTest", pvStructure);
|
||||
testPass("testStandardPVField");
|
||||
|
||||
Reference in New Issue
Block a user