change the way PVField::getFieldName is implemented
This commit is contained in:
@@ -24,6 +24,7 @@
|
||||
|
||||
using namespace epics::pvData;
|
||||
using std::tr1::static_pointer_cast;
|
||||
using std::size_t;
|
||||
|
||||
static FieldCreatePtr fieldCreate;
|
||||
static PVDataCreatePtr pvDataCreate;
|
||||
@@ -35,6 +36,34 @@ static String alarmTimeStamp("alarm,timeStamp");
|
||||
static String alarmTimeStampValueAlarm("alarm,timeStamp,valueAlarm");
|
||||
static String allProperties("alarm,timeStamp,display,control,valueAlarm");
|
||||
|
||||
static void checkNameAndParent(
|
||||
FILE *fd,PVStructurePtr & pvStructure, int indentLevel)
|
||||
{
|
||||
builder.clear();
|
||||
// convert->newLine(&builder,indentLevel);
|
||||
// fprintf(fd,"%s this %p indentLevel %d",
|
||||
// builder.c_str(),pvStructure.get(),indentLevel);
|
||||
PVFieldPtrArray pvFields = pvStructure->getPVFields();
|
||||
StringArray fieldNames = pvStructure->getStructure()->getFieldNames();
|
||||
for(size_t i = 0; i<pvFields.size(); i++) {
|
||||
PVFieldPtr pvField = pvFields[i];
|
||||
assert(pvField->getParent()==pvStructure.get());
|
||||
assert(pvField->getFieldName().compare(fieldNames[i])==0);
|
||||
// builder.clear();
|
||||
// convert->newLine(&builder,indentLevel);
|
||||
// fprintf(fd,"%s this %p name %s parent %p",
|
||||
// builder.c_str(),
|
||||
// pvField.get(),
|
||||
// pvField->getFieldName().c_str(),
|
||||
// pvField->getParent());
|
||||
if(pvField->getField()->getType()==structure) {
|
||||
PVStructurePtr xxx = static_pointer_cast<PVStructure>(pvField);
|
||||
checkNameAndParent(fd,xxx,indentLevel+1);
|
||||
}
|
||||
}
|
||||
builder.clear();
|
||||
}
|
||||
|
||||
static void testAppendSimple(FILE * fd)
|
||||
{
|
||||
PVFieldPtrArray fields;
|
||||
@@ -79,6 +108,7 @@ static void testAppendMore(FILE * fd)
|
||||
builder.clear();
|
||||
pvStructure->toString(&builder);
|
||||
fprintf(fd,"%s\n",builder.c_str());
|
||||
checkNameAndParent(fd,pvStructure,0);
|
||||
}
|
||||
|
||||
static void append2(PVStructurePtr pvStructure,
|
||||
@@ -124,8 +154,10 @@ static void testAppends(FILE * fd)
|
||||
builder.clear();
|
||||
pvStructure->toString(&builder);
|
||||
fprintf(fd,"%s\n",builder.c_str());
|
||||
checkNameAndParent(fd,pvStructure,0);
|
||||
PVFieldPtr pvField = pvStructure->getSubField("child2.Bill");
|
||||
assert(pvField.get()!=0);
|
||||
printf("pvField %p\n",pvField.get());
|
||||
assert(pvField.get()!=NULL);
|
||||
pvField->renameField("Joe");
|
||||
builder.clear();
|
||||
pvStructure->toString(&builder);
|
||||
@@ -134,6 +166,7 @@ static void testAppends(FILE * fd)
|
||||
builder.clear();
|
||||
pvStructure->toString(&builder);
|
||||
fprintf(fd,"%s\n",builder.c_str());
|
||||
checkNameAndParent(fd,pvStructure,0);
|
||||
}
|
||||
|
||||
int main(int argc,char *argv[])
|
||||
|
||||
Reference in New Issue
Block a user