diff --git a/pvDataApp/factory/PVAuxInfoImpl.cpp b/pvDataApp/factory/PVAuxInfoImpl.cpp index 633b82a..f63c75f 100644 --- a/pvDataApp/factory/PVAuxInfoImpl.cpp +++ b/pvDataApp/factory/PVAuxInfoImpl.cpp @@ -13,24 +13,20 @@ #include #include #include -#include namespace epics { namespace pvData { static PVScalarPtr nullPVScalar; -PVDATA_REFCOUNT_MONITOR_DEFINE(pvAuxInfo); PVAuxInfo::PVAuxInfo(PVField * pvField) : pvField(pvField), pvInfos(std::map > ()) { - PVDATA_REFCOUNT_MONITOR_CONSTRUCT(pvAuxInfo); } PVAuxInfo::~PVAuxInfo() { - PVDATA_REFCOUNT_MONITOR_DESTRUCT(pvAuxInfo); } @@ -53,7 +49,7 @@ PVScalarPtr PVAuxInfo::createInfo(String key,ScalarType scalarType) return pvScalar; } -PVScalarPtr& PVAuxInfo::getInfo(String key) +PVScalarPtr PVAuxInfo::getInfo(String key) { PVInfoIter iter; iter = pvInfos.find(key); diff --git a/pvDataApp/factory/PVStructure.cpp b/pvDataApp/factory/PVStructure.cpp index 83516a2..744a66d 100644 --- a/pvDataApp/factory/PVStructure.cpp +++ b/pvDataApp/factory/PVStructure.cpp @@ -38,7 +38,7 @@ static PVStructurePtr nullPVStructure; static PVStructureArrayPtr nullPVStructureArray; static PVScalarArrayPtr nullPVScalarArray; -static PVFieldPtr &findSubField(String fieldName,PVStructure *pvStructure); +static PVFieldPtr findSubField(String fieldName,PVStructure *pvStructure); PVStructure::PVStructure(StructureConstPtr& structurePtr) : PVField(structurePtr), @@ -87,13 +87,13 @@ PVFieldPtrArray & PVStructure::getPVFields() return pvFields; } -PVFieldPtr &PVStructure::getSubField(String fieldName) +PVFieldPtr PVStructure::getSubField(String fieldName) { return findSubField(fieldName,this); } -PVFieldPtr &PVStructure::getSubField(size_t fieldOffset) +PVFieldPtr PVStructure::getSubField(size_t fieldOffset) { if(fieldOffset<=getFieldOffset()) { return nullPVField; @@ -622,7 +622,7 @@ void PVStructure::deserialize(ByteBuffer *pbuffer, } } -static PVFieldPtr &findSubField(String fieldName,PVStructure *pvStructure) { +static PVFieldPtr findSubField(String fieldName,PVStructure *pvStructure) { if( fieldName.length()<1) return nullPVField; String::size_type index = fieldName.find('.'); String name = fieldName; @@ -640,11 +640,7 @@ static PVFieldPtr &findSubField(String fieldName,PVStructure *pvStructure) { pvField = pvFields[i]; size_t result = pvField->getFieldName().compare(name); if(result==0) { - if(restOfName.length()==0) { - PVFieldPtr & xxx = pvFields[i]; -printf("%p %p\n",pvFields[i].get(),xxx.get()); - return pvFields[i]; - } + if(restOfName.length()==0) return pvFields[i]; if(pvField->getField()->getType()!=structure) return nullPVField; PVStructurePtr pvStructure = std::tr1::static_pointer_cast(pvField); diff --git a/pvDataApp/factory/StandardField.cpp b/pvDataApp/factory/StandardField.cpp index dc4006b..ac7959f 100644 --- a/pvDataApp/factory/StandardField.cpp +++ b/pvDataApp/factory/StandardField.cpp @@ -370,7 +370,7 @@ StructureConstPtr StandardField::enumerated() StructureConstPtr StandardField::enumerated(String properties) { - StructureConstPtr field = enumerated(valueFieldName); + StructureConstPtr field = enumerated(); return createProperties(field,properties); } diff --git a/pvDataApp/property/pvEnumerated.cpp b/pvDataApp/property/pvEnumerated.cpp index a51d9b9..123ca28 100644 --- a/pvDataApp/property/pvEnumerated.cpp +++ b/pvDataApp/property/pvEnumerated.cpp @@ -95,6 +95,7 @@ StringArray& PVEnumerated:: getChoices() } StringArrayData data; pvChoices->get(0,pvChoices->getLength(),data); +printf("getChoices %p size %d\n",&data.data,data.data.size()); return data.data; } diff --git a/pvDataApp/pv/pvData.h b/pvDataApp/pv/pvData.h index 6364844..5bc43d9 100644 --- a/pvDataApp/pv/pvData.h +++ b/pvDataApp/pv/pvData.h @@ -99,7 +99,7 @@ public: * Get the Auxinfo with the specified key. * @return The PVScalar or null if it does not exist. */ - PVScalarPtr & getInfo(String key); + PVScalarPtr getInfo(String key); /** * Get the map for the info. * @return The map; @@ -585,13 +585,13 @@ public: * @param fieldName The name of the field. * @return Pointer to the field or null if field does not exist. */ - PVFieldPtr & getSubField(String fieldName); + PVFieldPtr getSubField(String fieldName); /** * Get the subfield with the specified offset. * @param fieldOffset The offset. * @return Pointer to the field or null if field does not exist. */ - PVFieldPtr & getSubField(std::size_t fieldOffset); + PVFieldPtr getSubField(std::size_t fieldOffset); /** * Append a field to the structure. * @param fieldName The name of the field to append. diff --git a/testApp/property/Makefile b/testApp/property/Makefile index 4f00425..0c57bf3 100644 --- a/testApp/property/Makefile +++ b/testApp/property/Makefile @@ -2,9 +2,9 @@ TOP=../.. include $(TOP)/configure/CONFIG -#PROD_HOST += testProperty -#testProperty_SRCS += testProperty.cpp -#testProperty_LIBS += pvData Com +PROD_HOST += testProperty +testProperty_SRCS += testProperty.cpp +testProperty_LIBS += pvData Com include $(TOP)/configure/RULES diff --git a/testApp/property/testProperty.cpp b/testApp/property/testProperty.cpp index 05531e5..1f3fdd8 100644 --- a/testApp/property/testProperty.cpp +++ b/testApp/property/testProperty.cpp @@ -83,7 +83,7 @@ static void testAlarm(FILE * fd,FILE *auxfd) PVAlarm pvAlarm; bool result; PVFieldPtr pvField = doubleRecord->getSubField(String("alarm")); - if(pvField.get()==0) { + if(pvField.get()==NULL) { printf("testAlarm ERROR did not find field alarm\n"); return; } @@ -111,8 +111,8 @@ static void testTimeStamp(FILE * fd,FILE *auxfd) TimeStamp timeStamp; PVTimeStamp pvTimeStamp; bool result; - PVField *pvField = doubleRecord->getSubField(String("timeStamp")); - if(pvField==0) { + PVFieldPtr pvField = doubleRecord->getSubField(String("timeStamp")); + if(pvField.get()==NULL) { printf("testTimeStamp ERROR did not find field timeStamp\n"); return; } @@ -148,8 +148,8 @@ static void testControl(FILE * fd,FILE *auxfd) Control control; PVControl pvControl; bool result; - PVField *pvField = doubleRecord->getSubField(String("control")); - if(pvField==0) { + PVFieldPtr pvField = doubleRecord->getSubField(String("control")); + if(pvField.get()==NULL) { printf("testControl ERROR did not find field control\n"); return; } @@ -174,8 +174,8 @@ static void testDisplay(FILE * fd,FILE *auxfd) Display display; PVDisplay pvDisplay; bool result; - PVField *pvField = doubleRecord->getSubField(String("display")); - if(pvField==0) { + PVFieldPtr pvField = doubleRecord->getSubField(String("display")); + if(pvField.get()==NULL) { printf("testDisplay ERROR did not find field display\n"); return; } @@ -205,8 +205,8 @@ static void testEnumerated(FILE * fd,FILE *auxfd) fprintf(fd,"testEnumerated\n"); PVEnumerated pvEnumerated; bool result; - PVField *pvField = enumeratedRecord->getSubField(String("value")); - if(pvField==0) { + PVFieldPtr pvField = enumeratedRecord->getSubField(String("value")); + if(pvField.get()==NULL) { printf("testEnumerated ERROR did not find field enumerated\n"); return; } @@ -214,8 +214,13 @@ static void testEnumerated(FILE * fd,FILE *auxfd) assert(result); int32 index = pvEnumerated.getIndex(); String choice = pvEnumerated.getChoice(); - StringArray choices = pvEnumerated.getChoices(); + StringArray &choices = pvEnumerated.getChoices(); int32 numChoices = pvEnumerated.getNumberChoices(); +printf("%p size %d numChoices %d\n",&choices,choices.size(),numChoices); +for(int i=0; igetSubField("child2.Bill"); -printf("pvField %p\n",pvField.get()); assert(pvField.get()!=NULL); pvField->renameField("Joe"); builder.clear();