From fcd039033b1f48776815dfab9a78b51fb6a31395 Mon Sep 17 00:00:00 2001
From: Ruud Overeem <overeem@astron.nl>
Date: Thu, 10 Jan 2008 10:10:24 +0000
Subject: [PATCH] Bug 1000: Added stationlist to Observation Class.

---
 .../APLCommon/include/APL/APLCommon/Observation.h    |  1 +
 .../APLCommon/include/APL/APLCommon/StationInfo.h    | 12 ++++++------
 MAC/APL/APLCommon/src/Observation.cc                 |  8 ++++++++
 MAC/APL/APLCommon/src/StationInfo.cc                 |  7 +++++--
 4 files changed, 20 insertions(+), 8 deletions(-)

diff --git a/MAC/APL/APLCommon/include/APL/APLCommon/Observation.h b/MAC/APL/APLCommon/include/APL/APLCommon/Observation.h
index ffe02edee83..01beaead5dd 100644
--- a/MAC/APL/APLCommon/include/APL/APLCommon/Observation.h
+++ b/MAC/APL/APLCommon/include/APL/APLCommon/Observation.h
@@ -62,6 +62,7 @@ public:
 	int16			nyquistZone;
 	vector<int16>	subbands;
 	vector<int16>	beamlets;
+	vector<string>	stations;
 	int32			sampleClock;
 	string			filter;
 	string			antennaArray;
diff --git a/MAC/APL/APLCommon/include/APL/APLCommon/StationInfo.h b/MAC/APL/APLCommon/include/APL/APLCommon/StationInfo.h
index 06c82f00483..e3fb5000af3 100644
--- a/MAC/APL/APLCommon/include/APL/APLCommon/StationInfo.h
+++ b/MAC/APL/APLCommon/include/APL/APLCommon/StationInfo.h
@@ -52,12 +52,12 @@ namespace LOFAR {
 //		  ring = 1..9  [ 2 digits ]
 //		  CUType = C | W
 //
-uint16	stationRingNr();		// 0..99; 0 = error
-uint16	stationArmNr();			// 0..5	; 0 = error
-int16	stationTypeValue();		//-1..2 : for resp. error, CS, RS, ES
-string	stationTypeStr();		// "", CS, RS, ES
-string	PVSSDatabaseName();		// hostname w/o CUtype
-string	realHostname(const string&	someName);	// adds 'C' when it is missing.
+uint16	stationRingNr();									// 0..99; 0 = error
+uint16	stationArmNr();										// 0..5	; 0 = error
+int16	stationTypeValue();									//-1..2 : for resp. error, CS, RS, ES
+string	stationTypeStr();									// "", CS, RS, ES
+string	PVSSDatabaseName(const string&	someName = "");		// hostname w/o CUtype
+string	realHostname(const string&	someName);				// adds 'C' when it is missing.
 
 
 // @}
diff --git a/MAC/APL/APLCommon/src/Observation.cc b/MAC/APL/APLCommon/src/Observation.cc
index 4ba033e9abb..fe722a474b1 100644
--- a/MAC/APL/APLCommon/src/Observation.cc
+++ b/MAC/APL/APLCommon/src/Observation.cc
@@ -92,6 +92,14 @@ Observation::Observation(ParameterSet*		aParSet) :
 		beamlets = blParset.getInt16Vector("x");
 	}
 
+	if (aParSet->isDefined(prefix+"VirtualInstrument.stationList")) {
+		string stString("x=" + APLUtilities::expandedArrayString(
+											aParSet->getString(prefix+"VirtualInstrument.stationList")));
+		ParameterSet	stParset;
+		stParset.adoptBuffer(stString);
+		stations = stParset.getStringVector("x");
+	}
+
 	if (aParSet->isDefined(prefix+"bandFilter")) {
 		filter = aParSet->getString(prefix+"bandFilter");
 	}
diff --git a/MAC/APL/APLCommon/src/StationInfo.cc b/MAC/APL/APLCommon/src/StationInfo.cc
index 0466a112ddb..a1213d8ed4f 100644
--- a/MAC/APL/APLCommon/src/StationInfo.cc
+++ b/MAC/APL/APLCommon/src/StationInfo.cc
@@ -114,9 +114,12 @@ string	stationTypeStr()
 //
 // PVSSDatabaseName
 //
-string	PVSSDatabaseName()
+string	PVSSDatabaseName(const string&	someName)
 {
-	string hostname(myHostname(false));
+	string hostname(someName);
+	if (hostname.empty()) {
+		hostname = myHostname(false);
+	}
 
 	// hostname is like <stationtype><arm><ring><CUtype>
 	// where CUtype = C or W
-- 
GitLab