From 33b8117c72cf511b8d6ba6bfca66a8daa86c2c56 Mon Sep 17 00:00:00 2001 From: Matej Sekoranja Date: Mon, 19 Nov 2012 10:05:45 +0100 Subject: [PATCH] hierarchical pvRequest support for testServer --- testApp/remote/testServer.cpp | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/testApp/remote/testServer.cpp b/testApp/remote/testServer.cpp index 5a2960a..c6164b3 100644 --- a/testApp/remote/testServer.cpp +++ b/testApp/remote/testServer.cpp @@ -59,7 +59,7 @@ static PVStructure::shared_pointer getRequestedStructure( if (pvRequest->getSubField(subfieldName)) pvRequestFields = pvRequest->getStructureField(subfieldName); else - pvRequestFields = pvRequest; // really?!! + pvRequestFields = pvRequest; // if pvRequest is empty, just use pvStructure if (pvRequestFields->getPVFields().size() > 0) @@ -74,8 +74,23 @@ static PVStructure::shared_pointer getRequestedStructure( PVFieldPtr pvField = pvStructure->getSubField(*iter); if (pvField) { - actualFieldNames.push_back(*iter); - pvFields.push_back(pvField); + PVStructurePtr pvFieldStructure = + std::tr1::dynamic_pointer_cast(pvField); + + PVStructurePtr pvRequestFieldStructure = + std::tr1::dynamic_pointer_cast(pvRequestFields->getSubField(*iter)); + if (pvRequestFieldStructure->getPVFields().size() > 0 && pvFieldStructure.get()) + { + // add subfields only + actualFieldNames.push_back(*iter); + pvFields.push_back(getRequestedStructure(pvFieldStructure, pvRequestFieldStructure)); + } + else + { + // add entire field + actualFieldNames.push_back(*iter); + pvFields.push_back(pvField); + } } }