From 8ca77c331b33a84941f2ebd16af2ffbfcc9932d3 Mon Sep 17 00:00:00 2001 From: Ruud Overeem <overeem@astron.nl> Date: Tue, 25 Jul 2006 09:48:53 +0000 Subject: [PATCH] BugID: 826 Fixed bug in locateKey. --- LCS/ACC/APS/include/APS/ParameterSetImpl.h | 1 + LCS/ACC/APS/src/ParameterSetImpl.cc | 5 +++-- LCS/ACC/APS/test/tParameterSet.cc | 2 +- LCS/ACC/APS/test/tParameterSet.stdout | 2 +- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/LCS/ACC/APS/include/APS/ParameterSetImpl.h b/LCS/ACC/APS/include/APS/ParameterSetImpl.h index 44fcfb3c5d3..1e74314ba15 100644 --- a/LCS/ACC/APS/include/APS/ParameterSetImpl.h +++ b/LCS/ACC/APS/include/APS/ParameterSetImpl.h @@ -161,6 +161,7 @@ public: { return (find(searchKey) != end()); }; // Searches for a key whose name end in the given shortKey. + // e.g: a.b.c.d.param=xxx ; locateKey('d') --> 'a.b.c.' string locateKey(const string& shortKey) const; // Return the 'metadata' from the parameterCollection. diff --git a/LCS/ACC/APS/src/ParameterSetImpl.cc b/LCS/ACC/APS/src/ParameterSetImpl.cc index 9ac6c9fe6b3..53eb8ff2928 100644 --- a/LCS/ACC/APS/src/ParameterSetImpl.cc +++ b/LCS/ACC/APS/src/ParameterSetImpl.cc @@ -888,13 +888,14 @@ int32 indexValue (const string& label, char indexMarker[2]) // locateKey(hortKey) // // Searches for a key ending in the given 'shortkey' and returns it full name. +// e.g: a.b.c.d.param=xxxx --> locateKey(d)-->a.b.c. string ParameterSetImpl::locateKey(const string& shortKey) const { const_iterator iter = begin(); const_iterator eom = end(); while ((iter != eom)) { - if (keyName(iter->first) == shortKey) { - return (iter->first); + if (keyName(moduleName(iter->first)) == shortKey) { + return (moduleName(moduleName((iter->first)))+"."); } iter++; } diff --git a/LCS/ACC/APS/test/tParameterSet.cc b/LCS/ACC/APS/test/tParameterSet.cc index 248bde16f10..6c9b4cdd683 100644 --- a/LCS/ACC/APS/test/tParameterSet.cc +++ b/LCS/ACC/APS/test/tParameterSet.cc @@ -68,7 +68,7 @@ int main() { cout << "\nThe main ParameterSet contains:\n"; cout << myPS; - cout << "Fullname of 'lange_naam=" << myPS.locateKey("lange_naam") << endl; + cout << "Fullname of 'b'=" << myPS.locateKey("b") << endl; // cout << "The name of the ParameterSet = " << myPS.getName() << endl; diff --git a/LCS/ACC/APS/test/tParameterSet.stdout b/LCS/ACC/APS/test/tParameterSet.stdout index b5fd87cc3a8..7405a1b8b09 100644 --- a/LCS/ACC/APS/test/tParameterSet.stdout +++ b/LCS/ACC/APS/test/tParameterSet.stdout @@ -35,7 +35,7 @@ The main ParameterSet contains: [e.g],[een voorbeeld] [egg],[een ei] [vtest.intVector1Dim],[[ 3, "20485", 002, '4904' , 25 ]] -Fullname of 'lange_naam=a.b.lange_naam +Fullname of 'b'=a. isValidVersionNr(1.2.3.4) = 0 isValidVersionNr(1.2.3) = 1 isValidVersionNr(1.2) = 0 -- GitLab