From eaed29bbc8d28d2e1a94190e67c9ece3954735a7 Mon Sep 17 00:00:00 2001
From: Ruud Overeem <overeem@astron.nl>
Date: Fri, 12 Oct 2012 11:42:01 +0000
Subject: [PATCH] Task #3713: Updated conversion-regexes between PVSS and SAS
 to support the LBA and HBA antenna's.

---
 LCS/ApplCommon/src/StationInfo.cc   | 28 +++++++++++++++-------------
 LCS/ApplCommon/test/CMakeLists.txt  |  1 +
 LCS/ApplCommon/test/tStationInfo.cc | 10 +++++++++-
 3 files changed, 25 insertions(+), 14 deletions(-)

diff --git a/LCS/ApplCommon/src/StationInfo.cc b/LCS/ApplCommon/src/StationInfo.cc
index 698a00e9903..dee590ae604 100644
--- a/LCS/ApplCommon/src/StationInfo.cc
+++ b/LCS/ApplCommon/src/StationInfo.cc
@@ -147,32 +147,34 @@ string	realHostname(const string&	someName)
 //
 // SAS :  LOFAR.PIC.<RING>.<SYSTEM>.xxx
 // PVSS:  <SYSTEM>:LOFAR_PIC_xxx
-//        ^       ^      ^
-//        |       |      +-- locationPos + locationLen
-//        |       +-- colon
-//        +-- systemLen
 //
 // NOTE: instead of PIC the DPname may contain PermSW or ObsSW_Observation<n>
 //
 string PVSS2SASname(const string&	PVSSname)
 {
 	const char*		structure_match = "(([A-Z]{2,3}[0-9]{3}[A-Z]?):LOFAR_(PIC|PermSW)_)|"		// 1,2,3
-									  "(([A-Z]{2,3}[0-9]{3}[A-Z]?):LOFAR_(PIC|PermSW)\\.)";	// 4,5,6
+									  "(([A-Z]{2,3}[0-9]{3}[A-Z]?):LOFAR_(PIC|PermSW)\\.)";		// 4,5,6
+									  "(([A-Z]{2,3}[0-9]{3}[A-Z]?):LOFAR_PIC_(LBA|HBA)\\.)";	// 7,8,9
 	const char*		location_match  = "(RCU[0-9]{3})|"									// 1
-									  "_(CS[0-9]{3}[A-Z]?)_|" 							// 2 CS999
-									  "_(RS[0-9]{3}[A-Z]?)_|"							// 3 RS999
-									  "_([ABD-QS-Z][A-Z][0-9]{3}[A-Z]?)_|"				// 4 XX999
-									  "_([A-Z]{3}[0-9]{3}[A-Z]?)_";						// 5 XXX999
+									  "(LBA[0-9]{3})|"									// 2 LBA999
+									  "(HBA[0-9]{2})|"									// 3 HBA99
+									  "_(CS[0-9]{3}[A-Z]?)_|" 							// 4 CS999
+									  "_(RS[0-9]{3}[A-Z]?)_|"							// 5 RS999
+									  "_([ABD-QS-Z][A-Z][0-9]{3}[A-Z]?)_|"				// 6 XX999
+									  "_([A-Z]{3}[0-9]{3}[A-Z]?)_";						// 7 XXX999
 	const char*		separator_match = "(_)|(\\.)";
 	const char*		boundary_match  = "(^([^_]+)_)";
 
 	const char*		structure_repl  = "(?1LOFAR_$3_$2_)"	// LOFAR_PIC_RS002
 									  "(?4LOFAR_$6.)";		// LOFAR_PIC
+									  "(?7LOFAR_PIC_$6.)";	// LOFAR_PIC_[HL]BA
 	const char*		location_repl	= "(?1$&)"				// ignore RCU999
-									  "(?2_Core$&)"			 
-									  "(?3_Remote$&)"
-									  "(?4_Europe$&)"
-									  "(?5_Control$&)";
+									  "(?2$&)"
+									  "(?3$&)"
+									  "(?4_Core$&)"			 
+									  "(?5_Remote$&)"
+									  "(?6_Europe$&)"
+									  "(?7_Control$&)";
 	const char*		separator_repl  = "(?1.)(?2_)";			// swap separators
 	const char*		boundary_repl   = "$2.";				// reverse separator on object-field edge
 
diff --git a/LCS/ApplCommon/test/CMakeLists.txt b/LCS/ApplCommon/test/CMakeLists.txt
index faab09b58de..d2f57bccdcf 100644
--- a/LCS/ApplCommon/test/CMakeLists.txt
+++ b/LCS/ApplCommon/test/CMakeLists.txt
@@ -6,3 +6,4 @@ lofar_add_test(tAntField tAntField.cc)
 lofar_add_test(tAntennaSet tAntennaSet.cc)
 lofar_add_test(tObservation tObservation.cc)
 lofar_add_executable(tHasDataslots tHasDataslots.cc)
+lofar_add_executable(tStationInfo tStationInfo.cc)
diff --git a/LCS/ApplCommon/test/tStationInfo.cc b/LCS/ApplCommon/test/tStationInfo.cc
index b755f1d4d52..074da1c8c27 100644
--- a/LCS/ApplCommon/test/tStationInfo.cc
+++ b/LCS/ApplCommon/test/tStationInfo.cc
@@ -33,7 +33,7 @@
 
 using namespace LOFAR;
 
-int main (int	argc, char* argv[]) 
+int main (int/*argc*/, char* argv[]) 
 {
 	INIT_LOGGER(argv[0]);
 	
@@ -59,6 +59,10 @@ int main (int	argc, char* argv[])
 				PVSS2SASname("RS002:LOFAR_ObsSW_Observation5.antennaArray"));
 	LOG_INFO_STR("PVSS==>SAS(RS002:LOFAR_ObsSW_Observation5_BeamControl.status.state)  = " << 
 				PVSS2SASname("RS002:LOFAR_ObsSW_Observation5_BeamControl.status.state"));
+	LOG_INFO_STR("PVSS==>SAS(RS005:LOFAR_PIC_HBA05.status.state)         = " << 
+				PVSS2SASname("RS005:LOFAR_PIC_HBA05.status.state"));
+	LOG_INFO_STR("PVSS==>SAS(DE603:LOFAR_PIC_LBA005.status.state)         = " << 
+				PVSS2SASname("DE603:LOFAR_PIC_LBA005.status.state"));
 
 	LOG_INFO_STR("SAS==>PVSS(LOFAR.PIC.Remote.RS002.Cabinet0.Subrack0.status_state)        = " << 
 				SAS2PVSSname("LOFAR.PIC.Remote.RS002.Cabinet0.Subrack0.status_state"));
@@ -68,6 +72,10 @@ int main (int	argc, char* argv[])
 				SAS2PVSSname("LOFAR.PermSW.Control.MCU001.MACScheduler.status_state"));
 	LOG_INFO_STR("SAS==>PVSS(LOFAR.ObsSW.Observation.VirtualInstrument.stationList) = " << 
 				SAS2PVSSname("LOFAR.ObsSW.Observation.VirtualInstrument.stationList"));
+	LOG_INFO_STR("SAS==>PVSS(LOFAR.PIC.Remote.RS005.LBA123.status_state)        = " << 
+				SAS2PVSSname("LOFAR.PIC.Remote.RS005.LBA123.status_state"));
+	LOG_INFO_STR("SAS==>PVSS(LOFAR.PIC.Europe.DE603.HBA23.status_state)        = " << 
+				SAS2PVSSname("LOFAR.PIC.Europe.DE603.HBA23.status_state"));
 
 	return (0);
 }
-- 
GitLab