From c98d03a8af8bd8ad35e86cc6cd1c09cb3983ab6c Mon Sep 17 00:00:00 2001 From: Ruud Overeem <overeem@astron.nl> Date: Fri, 28 Jul 2006 14:02:32 +0000 Subject: [PATCH] BugID: 802 Added definition for the online- and offline controllers. --- .../include/APL/APLCommon/ControllerDefines.h | 2 ++ .../APLCommon/include/APL/APLCommon/Makefile.am | 1 + MAC/APL/APLCommon/src/ChildControl.cc | 12 +++++++----- MAC/APL/APLCommon/src/ControllerDefines.cc | 16 +++++++++++++++- MAC/APL/APLCommon/src/Makefile.am | 1 + MAC/APL/APLCommon/src/ParentControl.cc | 2 +- 6 files changed, 27 insertions(+), 7 deletions(-) diff --git a/MAC/APL/APLCommon/include/APL/APLCommon/ControllerDefines.h b/MAC/APL/APLCommon/include/APL/APLCommon/ControllerDefines.h index 4c2c7ebf27a..d6cb089b037 100644 --- a/MAC/APL/APLCommon/include/APL/APLCommon/ControllerDefines.h +++ b/MAC/APL/APLCommon/include/APL/APLCommon/ControllerDefines.h @@ -46,6 +46,8 @@ enum { CNTLRTYPE_NO_TYPE = 0, // no type defined yet CNTLRTYPE_SCHEDULERCTRL, // MACscheduler CNTLRTYPE_OBSERVATIONCTRL, // ObservationControl + CNTLRTYPE_ONLINECTRL, // OnlineControl + CNTLRTYPE_OFFLINECTRL, // OfflineControl CNTLRTYPE_BEAMDIRECTIONCTRL, // BeamDirectionControl CNTLRTYPE_GROUPCTRL, // RingControl CNTLRTYPE_STATIONCTRL, // StationControl diff --git a/MAC/APL/APLCommon/include/APL/APLCommon/Makefile.am b/MAC/APL/APLCommon/include/APL/APLCommon/Makefile.am index 861fb54d5fb..fae43cd2a76 100644 --- a/MAC/APL/APLCommon/include/APL/APLCommon/Makefile.am +++ b/MAC/APL/APLCommon/include/APL/APLCommon/Makefile.am @@ -6,6 +6,7 @@ pkginclude_HEADERS = \ APL_Defines.h \ APLUtilities.h \ ControllerDefines.h \ + StationInfo.h \ PropertySetAnswer.h \ PropertySetAnswerHandlerInterface.h \ CTState.h \ diff --git a/MAC/APL/APLCommon/src/ChildControl.cc b/MAC/APL/APLCommon/src/ChildControl.cc index b34acf73df7..c176fd59b74 100644 --- a/MAC/APL/APLCommon/src/ChildControl.cc +++ b/MAC/APL/APLCommon/src/ChildControl.cc @@ -25,11 +25,11 @@ //# Includes #include <Common/LofarLogger.h> -#include <Deployment/StationInfo.h> #include <APS/ParameterSet.h> #include <GCF/GCF_ServiceInfo.h> #include <GCF/Utils.h> #include <APL/APLCommon/APLUtilities.h> +#include <APL/APLCommon/StationInfo.h> #include <APL/APLCommon/ChildControl.h> #include <Controller_Protocol.ph> #include <StartDaemon_Protocol.ph> @@ -178,9 +178,10 @@ bool ChildControl::startChild (const string& aName, // Add some comment lines and some extra fields to the file cntlrSet.add("prefix", prefix+position+nodeName+"."); cntlrSet.add("_instanceNr", lexical_cast<string>(instanceNr)); + cntlrSet.add("_moduleName", nodeName); cntlrSet.add("_treeID", lexical_cast<string>(anObsID)); - cntlrSet.add("# modulename", nodeName); - cntlrSet.add("# pathname", prefix+position+nodeName+"."); + cntlrSet.add("# moduleName", nodeName); + cntlrSet.add("# pathName", prefix+position+nodeName+"."); cntlrSet.add("# treeID", lexical_cast<string>(anObsID)); // Finally write to subset to the file. cntlrSet.writeFile (cntlrSetName); @@ -441,7 +442,7 @@ void ChildControl::_processActionList() switch (action->requestedState) { case CTState::CONNECTED: // start program, wait for CONNECTED msgs of child { - // first check if connection if StartDaemon is made + // first check if connection with StartDaemon is made SDiter startDaemon = itsStartDaemonMap.find(action->hostname); if (startDaemon == itsStartDaemonMap.end() || !startDaemon->second->isConnected()) { @@ -781,7 +782,8 @@ GCFEvent::TResult ChildControl::operational(GCFEvent& event, case F_INIT: break; - case F_ENTRY: + case F_ENTRY: // process actions that where queued during my startup. + _processActionList(); break; case F_ACCEPT_REQ: { diff --git a/MAC/APL/APLCommon/src/ControllerDefines.cc b/MAC/APL/APLCommon/src/ControllerDefines.cc index e7018538be5..d594163e492 100644 --- a/MAC/APL/APLCommon/src/ControllerDefines.cc +++ b/MAC/APL/APLCommon/src/ControllerDefines.cc @@ -26,10 +26,10 @@ //# Includes #include <Common/LofarLogger.h> #include <Common/StringUtil.h> // rtrim -#include <Deployment/StationInfo.h> #include <GCF/Utils.h> // myHostname #include <APS/ParameterSet.h> // indexValue #include <APL/APLCommon/ControllerDefines.h> +#include <APL/APLCommon/StationInfo.h> #include <boost/config.hpp> #include <boost/lexical_cast.hpp> @@ -47,9 +47,13 @@ typedef struct cntlrDefinition { } cntlrDefinition_t; static cntlrDefinition_t controllerTable[] = { +// executable parsetNode shared +//---------------------------------------------------------- { "", "", false }, { "MACScheduler", "MACScheduler", false }, { "ObservationControl", "ObsCtrl", false }, + { "OnlineControl", "OnlineCtrl", false }, + { "OfflineControl", "OfflineCtrl", false }, { "BeamDirectionControl", "BeamDirCtrl", true }, { "RingControl", "RingCtrl", true }, { "StationControl", "StationCtrl", false }, @@ -134,6 +138,7 @@ int32 getControllerType (const string& controllerName) { string cntlrName(controllerName); // destroyable copy rtrim(cntlrName, "[]{}0123456789"); // cut down to executable name + // first try on controllername uint32 idx = CNTLRTYPE_NO_TYPE + 1; while (idx < CNTLRTYPE_NR_TYPES) { if (!strcmp (controllerTable[idx].cntlrName, cntlrName.c_str())) { @@ -142,6 +147,15 @@ int32 getControllerType (const string& controllerName) idx++; } + // not found, may user passed parsetNodename + idx = CNTLRTYPE_NO_TYPE + 1; + while (idx < CNTLRTYPE_NR_TYPES) { + if (!strcmp (controllerTable[idx].parsetName, cntlrName.c_str())) { + return (idx); + } + idx++; + } + return (CNTLRTYPE_NO_TYPE); } diff --git a/MAC/APL/APLCommon/src/Makefile.am b/MAC/APL/APLCommon/src/Makefile.am index 1444d091d7f..6680bd38dd9 100644 --- a/MAC/APL/APLCommon/src/Makefile.am +++ b/MAC/APL/APLCommon/src/Makefile.am @@ -15,6 +15,7 @@ libaplcommon_la_SOURCES = $(DOCHDRS) \ Controller_Protocol.cc \ APLUtilities.cc \ ControllerDefines.cc \ + StationInfo.cc \ PropertySetAnswer.cc \ CTState.cc \ ControllerAdmin.cc \ diff --git a/MAC/APL/APLCommon/src/ParentControl.cc b/MAC/APL/APLCommon/src/ParentControl.cc index d5551fe9160..0d2c14916eb 100644 --- a/MAC/APL/APLCommon/src/ParentControl.cc +++ b/MAC/APL/APLCommon/src/ParentControl.cc @@ -25,12 +25,12 @@ //# Includes #include <Common/LofarLogger.h> -#include <Deployment/StationInfo.h> #include <APS/ParameterSet.h> #include <GCF/GCF_ServiceInfo.h> #include <GCF/Utils.h> #include <APL/APLCommon/APLUtilities.h> #include <APL/APLCommon/ParentControl.h> +#include <APL/APLCommon/StationInfo.h> #include <Controller_Protocol.ph> #include <StartDaemon_Protocol.ph> -- GitLab