From 8e577996b17c08bd0c80d403f80d8b05df39d8ea Mon Sep 17 00:00:00 2001 From: Ger van Diepen <diepen@astron.nl> Date: Fri, 3 Jul 2015 09:55:50 +0000 Subject: [PATCH] Task #8119 Better test on vector or pattern --- CEP/DP3/DPPP/src/BaselineSelection.cc | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/CEP/DP3/DPPP/src/BaselineSelection.cc b/CEP/DP3/DPPP/src/BaselineSelection.cc index 614a6c9d67e..fd6fcb4d25b 100644 --- a/CEP/DP3/DPPP/src/BaselineSelection.cc +++ b/CEP/DP3/DPPP/src/BaselineSelection.cc @@ -113,7 +113,25 @@ namespace LOFAR { { // Handle the value(s) in the baseline selection string. ParameterValue pvBL(itsStrBL); - if (pvBL.isVector()) { + // The value can be a vector or an MSSelection string. + // Alas the ParameterValue vector test cannot be used, because + // the first character of a MSSelection string can also be [. + // So if the first is [ and a ] is found before the end and before + // another [, it must be a MSSelection string. + bool mssel = true; + if (itsStrBL[0] == '[') { + String::size_type rb = itsStrBL.find (']'); + ASSERTSTR (rb != string::npos, + "Baseline selection " + itsStrBL + + " has no ending ]"); + if (rb == itsStrBL.size()-1) { + mssel = false; + } else { + String::size_type lb = itsStrBL.find ('[', 1); + mssel = (lb == string::npos || lb > rb); + } + } + if (!mssel) { // Specified as a vector of antenna name patterns. selectBL = selectBL && handleBLVector (pvBL, info.antennaNames()); } else { -- GitLab