diff --git a/.gitattributes b/.gitattributes index d76885dc0cd29102fd964702b1e6967671d29b35..84ee673367e1936d8d0d0689b25590eeb0a7ff0f 100644 --- a/.gitattributes +++ b/.gitattributes @@ -131,23 +131,18 @@ MAC/APL/lofarconf.in -text svneol=native#application/octet-stream MAC/Config/LofarPropertyTypes.pvss -text svneol=native#application/octet-stream MAC/Config/mac.ns -text svneol=native#application/octet-stream MAC/Config/mac.top -text svneol=native#application/octet-stream -MAC/GCF/BaseTools/lofarconf.in -text svneol=native#application/octet-stream MAC/GCF/DEPENDENCIES -text svneol=native#application/octet-stream MAC/GCF/GCFCommon/Makefile.am -text svneol=native#application/octet-stream MAC/GCF/GCFCommon/autogen/protocol.tpl -text svneol=native#application/octet-stream MAC/GCF/GCFCommon/configure.in -text svneol=native#application/octet-stream MAC/GCF/GCFCommon/src/Makefile.am -text svneol=native#application/octet-stream -MAC/GCF/HighLevelTools/lofarconf.in -text svneol=native#application/octet-stream MAC/GCF/Makefile.am -text svneol=native#application/octet-stream MAC/GCF/README -text svneol=native#application/octet-stream -MAC/GCF/Services/Activator/lofarconf.in -text svneol=native#application/octet-stream -MAC/GCF/Services/GCL/lofarconf.in -text svneol=native#application/octet-stream MAC/GCF/Services/Makefile.am -text svneol=native#application/octet-stream MAC/GCF/Services/PI/Makefile.am -text svneol=native#application/octet-stream MAC/GCF/Services/PI/configure.in -text svneol=native#application/octet-stream MAC/GCF/Services/PI/src/Makefile.am -text svneol=native#application/octet-stream MAC/GCF/Services/PI/src/SS/F_Supervisory_Protocol.prot -text svneol=native#application/octet-stream -MAC/GCF/Services/lofarconf.in -text svneol=native#application/octet-stream MAC/GCF/_CoreComps/Makefile.am -text svneol=native#application/octet-stream MAC/GCF/_CoreComps/PA/Makefile.am -text svneol=native#application/octet-stream MAC/GCF/_CoreComps/PA/configure.in -text svneol=native#application/octet-stream @@ -172,7 +167,6 @@ MAC/GCF/_CoreComps/TM/test/Echo_Protocol.prot -text svneol=native#application/oc MAC/GCF/_CoreComps/TM/test/Makefile.am -text svneol=native#application/octet-stream MAC/GCF/_CoreComps/TM/test/tutorial.ns.in -text svneol=native#application/octet-stream MAC/GCF/_CoreComps/TM/test/tutorial.top.in -text svneol=native#application/octet-stream -MAC/GCF/_CoreComps/lofarconf.in -text svneol=native#application/octet-stream MAC/GCF/configure.in -text svneol=native#application/octet-stream MAC/GCF/src/Makefile.am -text svneol=native#application/octet-stream MAC/Test/GCF/DEPENDENCIES -text svneol=native#application/octet-stream diff --git a/MAC/Config/Apc/ApcT1-D.xml b/MAC/Config/Apc/ApcT1-D.xml deleted file mode 100644 index ed32d0dbf0ca275fe95ed9888f0e0c5eac017f3c..0000000000000000000000000000000000000000 --- a/MAC/Config/Apc/ApcT1-D.xml +++ /dev/null @@ -1,7 +0,0 @@ -<?xml version="1.0"?> - -<T1> - <P1> <MACType> MACInteger </MACType> <MACDefault> 100 </MACDefault> </P1> - <P2> <MACType> MACChar </MACType> <MACDefault> 200 </MACDefault> </P2> - <P3> <MACType> MACDouble </MACType> <MACDefault> 100.5 </MACDefault> </P3> -</T1> diff --git a/MAC/Config/Apc/ApcT1a-D.xml b/MAC/Config/Apc/ApcT1a-D.xml deleted file mode 100644 index 919318f04b22fa464bcb5bf9f28129d74f76c49e..0000000000000000000000000000000000000000 --- a/MAC/Config/Apc/ApcT1a-D.xml +++ /dev/null @@ -1,6 +0,0 @@ -<?xml version="1.0"?> - -<T1a> - <P1> <MACType> MACInteger </MACType> <MACDefault> 200 </MACDefault> </P1> - <P2> <MACType> MACChar </MACType> <MACDefault> 150 </MACDefault> </P2> -</T1a> diff --git a/MAC/Config/Apc/ApcT1b-D.xml b/MAC/Config/Apc/ApcT1b-D.xml deleted file mode 100644 index 40c27fb3d7a6deb0f9b5fba87e23554c4b32da5f..0000000000000000000000000000000000000000 --- a/MAC/Config/Apc/ApcT1b-D.xml +++ /dev/null @@ -1,12 +0,0 @@ -<?xml version="1.0"?> - -<T1> - <C> - <P1> <MACType> MACInteger </MACType> <MACDefault> 300 </MACDefault> </P1> - <P2> <MACType> MACChar </MACType> <MACDefault> 120 </MACDefault> </P2> - </C> - <D> - <P1> <MACType> MACInteger </MACType> <MACDefault> 400 </MACDefault> </P1> - <P2> <MACType> MACChar </MACType> <MACDefault> 110 </MACDefault> </P2> - </D> -</T1> diff --git a/MAC/Config/Apc/ApcT2-D.xml b/MAC/Config/Apc/ApcT2-D.xml deleted file mode 100644 index 5951627656c660ffca7247d16ab51549fd8f74f6..0000000000000000000000000000000000000000 --- a/MAC/Config/Apc/ApcT2-D.xml +++ /dev/null @@ -1,5 +0,0 @@ -<?xml version="1.0"?> - -<T2> - <P7> <MACType> MACString </MACType> <MACDefault> apc-aap </MACDefault> </P7> -</T2> diff --git a/MAC/Config/Apc/ApcT3-D.xml b/MAC/Config/Apc/ApcT3-D.xml deleted file mode 100644 index 08d29e3a2b92d8dec29af826be0fb941cb4c3df8..0000000000000000000000000000000000000000 --- a/MAC/Config/Apc/ApcT3-D.xml +++ /dev/null @@ -1,110 +0,0 @@ -<?xml version="1.0"?> - -<T3> - <I> - <P8> <MACType> MACString </MACType> <MACDefault> apc-noot </MACDefault> </P8> - <P9> <MACType> MACString </MACType> <MACDefault> apc-mies </MACDefault> </P9> - </I> - <J> - <P00> <MACType> MACDouble </MACType> <MACDefault> 100.0 </MACDefault> </P00> - <P01> <MACType> MACDouble </MACType> <MACDefault> 100.1 </MACDefault> </P01> - <P02> <MACType> MACDouble </MACType> <MACDefault> 100.2 </MACDefault> </P02> - <P03> <MACType> MACDouble </MACType> <MACDefault> 100.3 </MACDefault> </P03> - <P04> <MACType> MACDouble </MACType> <MACDefault> 100.4 </MACDefault> </P04> - <P05> <MACType> MACDouble </MACType> <MACDefault> 100.5 </MACDefault> </P05> - <P06> <MACType> MACDouble </MACType> <MACDefault> 100.6 </MACDefault> </P06> - <P07> <MACType> MACDouble </MACType> <MACDefault> 100.7 </MACDefault> </P07> - <P08> <MACType> MACDouble </MACType> <MACDefault> 100.8 </MACDefault> </P08> - <P09> <MACType> MACDouble </MACType> <MACDefault> 100.9 </MACDefault> </P09> - <P10> <MACType> MACDouble </MACType> <MACDefault> 100.10 </MACDefault> </P10> - <P11> <MACType> MACDouble </MACType> <MACDefault> 100.11 </MACDefault> </P11> - <P12> <MACType> MACDouble </MACType> <MACDefault> 100.12 </MACDefault> </P12> - <P13> <MACType> MACDouble </MACType> <MACDefault> 100.13 </MACDefault> </P13> - <P14> <MACType> MACDouble </MACType> <MACDefault> 100.14 </MACDefault> </P14> - <P15> <MACType> MACDouble </MACType> <MACDefault> 100.15 </MACDefault> </P15> - <P16> <MACType> MACDouble </MACType> <MACDefault> 100.16 </MACDefault> </P16> - <P17> <MACType> MACDouble </MACType> <MACDefault> 100.17 </MACDefault> </P17> - <P18> <MACType> MACDouble </MACType> <MACDefault> 100.18 </MACDefault> </P18> - <P19> <MACType> MACDouble </MACType> <MACDefault> 100.19 </MACDefault> </P19> - <P20> <MACType> MACDouble </MACType> <MACDefault> 100.20 </MACDefault> </P20> - <P21> <MACType> MACDouble </MACType> <MACDefault> 100.21 </MACDefault> </P21> - <P22> <MACType> MACDouble </MACType> <MACDefault> 100.22 </MACDefault> </P22> - <P23> <MACType> MACDouble </MACType> <MACDefault> 100.23 </MACDefault> </P23> - <P24> <MACType> MACDouble </MACType> <MACDefault> 100.24 </MACDefault> </P24> - <P25> <MACType> MACDouble </MACType> <MACDefault> 100.25 </MACDefault> </P25> - <P26> <MACType> MACDouble </MACType> <MACDefault> 100.26 </MACDefault> </P26> - <P27> <MACType> MACDouble </MACType> <MACDefault> 100.27 </MACDefault> </P27> - <P28> <MACType> MACDouble </MACType> <MACDefault> 100.28 </MACDefault> </P28> - <P29> <MACType> MACDouble </MACType> <MACDefault> 100.29 </MACDefault> </P29> - <P30> <MACType> MACDouble </MACType> <MACDefault> 100.30 </MACDefault> </P30> - <P31> <MACType> MACDouble </MACType> <MACDefault> 100.31 </MACDefault> </P31> - <P32> <MACType> MACDouble </MACType> <MACDefault> 100.32 </MACDefault> </P32> - <P33> <MACType> MACDouble </MACType> <MACDefault> 100.33 </MACDefault> </P33> - <P34> <MACType> MACDouble </MACType> <MACDefault> 100.34 </MACDefault> </P34> - <P35> <MACType> MACDouble </MACType> <MACDefault> 100.35 </MACDefault> </P35> - <P36> <MACType> MACDouble </MACType> <MACDefault> 100.36 </MACDefault> </P36> - <P37> <MACType> MACDouble </MACType> <MACDefault> 100.37 </MACDefault> </P37> - <P38> <MACType> MACDouble </MACType> <MACDefault> 100.38 </MACDefault> </P38> - <P39> <MACType> MACDouble </MACType> <MACDefault> 100.39 </MACDefault> </P39> - <P40> <MACType> MACDouble </MACType> <MACDefault> 100.40 </MACDefault> </P40> - <P41> <MACType> MACDouble </MACType> <MACDefault> 100.41 </MACDefault> </P41> - <P42> <MACType> MACDouble </MACType> <MACDefault> 100.42 </MACDefault> </P42> - <P43> <MACType> MACDouble </MACType> <MACDefault> 100.43 </MACDefault> </P43> - <P44> <MACType> MACDouble </MACType> <MACDefault> 100.44 </MACDefault> </P44> - <P45> <MACType> MACDouble </MACType> <MACDefault> 100.45 </MACDefault> </P45> - <P46> <MACType> MACDouble </MACType> <MACDefault> 100.46 </MACDefault> </P46> - <P47> <MACType> MACDouble </MACType> <MACDefault> 100.47 </MACDefault> </P47> - <P48> <MACType> MACDouble </MACType> <MACDefault> 100.48 </MACDefault> </P48> - <P49> <MACType> MACDouble </MACType> <MACDefault> 100.49 </MACDefault> </P49> - <P50> <MACType> MACDouble </MACType> <MACDefault> 100.50 </MACDefault> </P50> - <P51> <MACType> MACDouble </MACType> <MACDefault> 100.51 </MACDefault> </P51> - <P52> <MACType> MACDouble </MACType> <MACDefault> 100.52 </MACDefault> </P52> - <P53> <MACType> MACDouble </MACType> <MACDefault> 100.53 </MACDefault> </P53> - <P54> <MACType> MACDouble </MACType> <MACDefault> 100.45 </MACDefault> </P54> - <P55> <MACType> MACDouble </MACType> <MACDefault> 100.55 </MACDefault> </P55> - <P56> <MACType> MACDouble </MACType> <MACDefault> 100.56 </MACDefault> </P56> - <P57> <MACType> MACDouble </MACType> <MACDefault> 100.57 </MACDefault> </P57> - <P58> <MACType> MACDouble </MACType> <MACDefault> 100.58 </MACDefault> </P58> - <P59> <MACType> MACDouble </MACType> <MACDefault> 100.59 </MACDefault> </P59> - <P60> <MACType> MACDouble </MACType> <MACDefault> 100.60 </MACDefault> </P60> - <P61> <MACType> MACDouble </MACType> <MACDefault> 100.61 </MACDefault> </P61> - <P62> <MACType> MACDouble </MACType> <MACDefault> 100.62 </MACDefault> </P62> - <P63> <MACType> MACDouble </MACType> <MACDefault> 100.63 </MACDefault> </P63> - <P64> <MACType> MACDouble </MACType> <MACDefault> 100.64 </MACDefault> </P64> - <P65> <MACType> MACDouble </MACType> <MACDefault> 100.65 </MACDefault> </P65> - <P66> <MACType> MACDouble </MACType> <MACDefault> 100.66 </MACDefault> </P66> - <P67> <MACType> MACDouble </MACType> <MACDefault> 100.67 </MACDefault> </P67> - <P68> <MACType> MACDouble </MACType> <MACDefault> 100.68 </MACDefault> </P68> - <P69> <MACType> MACDouble </MACType> <MACDefault> 100.69 </MACDefault> </P69> - <P70> <MACType> MACDouble </MACType> <MACDefault> 100.70 </MACDefault> </P70> - <P71> <MACType> MACDouble </MACType> <MACDefault> 100.71 </MACDefault> </P71> - <P72> <MACType> MACDouble </MACType> <MACDefault> 100.72 </MACDefault> </P72> - <P73> <MACType> MACDouble </MACType> <MACDefault> 100.73 </MACDefault> </P73> - <P74> <MACType> MACDouble </MACType> <MACDefault> 100.74 </MACDefault> </P74> - <P75> <MACType> MACDouble </MACType> <MACDefault> 100.75 </MACDefault> </P75> - <P76> <MACType> MACDouble </MACType> <MACDefault> 100.76 </MACDefault> </P76> - <P77> <MACType> MACDouble </MACType> <MACDefault> 100.77 </MACDefault> </P77> - <P78> <MACType> MACDouble </MACType> <MACDefault> 100.78 </MACDefault> </P78> - <P79> <MACType> MACDouble </MACType> <MACDefault> 100.79 </MACDefault> </P79> - <P80> <MACType> MACDouble </MACType> <MACDefault> 100.80 </MACDefault> </P80> - <P81> <MACType> MACDouble </MACType> <MACDefault> 100.81 </MACDefault> </P81> - <P82> <MACType> MACDouble </MACType> <MACDefault> 100.82 </MACDefault> </P82> - <P83> <MACType> MACDouble </MACType> <MACDefault> 100.83 </MACDefault> </P83> - <P84> <MACType> MACDouble </MACType> <MACDefault> 100.84 </MACDefault> </P84> - <P85> <MACType> MACDouble </MACType> <MACDefault> 100.85 </MACDefault> </P85> - <P86> <MACType> MACDouble </MACType> <MACDefault> 100.86 </MACDefault> </P86> - <P87> <MACType> MACDouble </MACType> <MACDefault> 100.87 </MACDefault> </P87> - <P88> <MACType> MACDouble </MACType> <MACDefault> 100.88 </MACDefault> </P88> - <P89> <MACType> MACDouble </MACType> <MACDefault> 100.89 </MACDefault> </P89> - <P90> <MACType> MACDouble </MACType> <MACDefault> 100.90 </MACDefault> </P90> - <P91> <MACType> MACDouble </MACType> <MACDefault> 100.91 </MACDefault> </P91> - <P92> <MACType> MACDouble </MACType> <MACDefault> 100.92 </MACDefault> </P92> - <P93> <MACType> MACDouble </MACType> <MACDefault> 100.93 </MACDefault> </P93> - <P94> <MACType> MACDouble </MACType> <MACDefault> 100.94 </MACDefault> </P94> - <P95> <MACType> MACDouble </MACType> <MACDefault> 100.95 </MACDefault> </P95> - <P96> <MACType> MACDouble </MACType> <MACDefault> 100.96 </MACDefault> </P96> - <P97> <MACType> MACDouble </MACType> <MACDefault> 100.97 </MACDefault> </P97> - <P98> <MACType> MACDouble </MACType> <MACDefault> 100.98 </MACDefault> </P98> - <P99> <MACType> MACDouble </MACType> <MACDefault> 100.99 </MACDefault> </P99> - </J> -</T3> diff --git a/MAC/Config/Apc/ApcT4-D.xml b/MAC/Config/Apc/ApcT4-D.xml deleted file mode 100644 index ef69577cdd81cc3b5a3792413703a4536f3ca51c..0000000000000000000000000000000000000000 --- a/MAC/Config/Apc/ApcT4-D.xml +++ /dev/null @@ -1,10 +0,0 @@ -<?xml version="1.0"?> - -<T4> - <P1> <MACType> MACInteger </MACType> <MACDefault> 100 </MACDefault> </P1> - <P2> <MACType> MACChar </MACType> <MACDefault> 200 </MACDefault> </P2> - <P3> <MACType> MACDouble </MACType> <MACDefault> 100,5 </MACDefault> </P3> - <P4> <MACType> MACInteger </MACType> <MACDefault> 100 </MACDefault> </P4> - <P5> <MACType> MACChar </MACType> <MACDefault> 200 </MACDefault> </P5> - <P6> <MACType> MACDouble </MACType> <MACDefault> 100,5 </MACDefault> </P6> -</T4> diff --git a/MAC/GCF/BaseTools/lofarconf.in b/MAC/GCF/BaseTools/lofarconf.in deleted file mode 100644 index 8b137891791fe96927ad78e64b0aad7bded08bdc..0000000000000000000000000000000000000000 --- a/MAC/GCF/BaseTools/lofarconf.in +++ /dev/null @@ -1 +0,0 @@ - diff --git a/MAC/GCF/DEPENDENCIES b/MAC/GCF/DEPENDENCIES index a96a78c976b4769c1ac82a05913b3b9af9ccb982..4399bc10736a8a66eb2bb420e931a6ee171829f8 100644 --- a/MAC/GCF/DEPENDENCIES +++ b/MAC/GCF/DEPENDENCIES @@ -12,7 +12,7 @@ PVSS II 2.12.1 > newproj <project path> > export PVSS_II=<project path>/config/config > start_pvss2 - > PVSS00ascii -in LofarPropertyTypes.pvss + > PVSS00ascii -in <lofar root>/MAC/Config/LofarPropertyTypes.pvss - now the started project is ready for GCF xerces-c @@ -30,5 +30,6 @@ xerces-c contains 2 compiler errors (line 1054: add '/'; line 1189: add an 'a' befor the 'g'). These error have to be fixed first. -LOFAR PACKAGES: -MAC/Tools/LofarLogger ( indirect external log4cplus) +MAC/Tools/LofarLogger +log4cplus (see LofarLogger +LCS/Common diff --git a/MAC/GCF/HighLevelTools/lofarconf.in b/MAC/GCF/HighLevelTools/lofarconf.in deleted file mode 100644 index 8b137891791fe96927ad78e64b0aad7bded08bdc..0000000000000000000000000000000000000000 --- a/MAC/GCF/HighLevelTools/lofarconf.in +++ /dev/null @@ -1 +0,0 @@ - diff --git a/MAC/GCF/Services/Activator/lofarconf.in b/MAC/GCF/Services/Activator/lofarconf.in deleted file mode 100644 index 8b137891791fe96927ad78e64b0aad7bded08bdc..0000000000000000000000000000000000000000 --- a/MAC/GCF/Services/Activator/lofarconf.in +++ /dev/null @@ -1 +0,0 @@ - diff --git a/MAC/GCF/Services/GCL/lofarconf.in b/MAC/GCF/Services/GCL/lofarconf.in deleted file mode 100644 index 8b137891791fe96927ad78e64b0aad7bded08bdc..0000000000000000000000000000000000000000 --- a/MAC/GCF/Services/GCL/lofarconf.in +++ /dev/null @@ -1 +0,0 @@ - diff --git a/MAC/GCF/Services/lofarconf.in b/MAC/GCF/Services/lofarconf.in deleted file mode 100644 index af4378c2020b290ffa5c81824afc9e89b72940fd..0000000000000000000000000000000000000000 --- a/MAC/GCF/Services/lofarconf.in +++ /dev/null @@ -1,3 +0,0 @@ -GCL -Activator -PI diff --git a/MAC/GCF/_CoreComps/PA/src/GPA_APC.cc b/MAC/GCF/_CoreComps/PA/src/GPA_APC.cc deleted file mode 100644 index f93daa91213c4dbee3f66f45d20ef31fe31f34f6..0000000000000000000000000000000000000000 --- a/MAC/GCF/_CoreComps/PA/src/GPA_APC.cc +++ /dev/null @@ -1,428 +0,0 @@ -//# GPA_APC.cc: -//# -//# Copyright (C) 2002-2003 -//# ASTRON (Netherlands Foundation for Research in Astronomy) -//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl -//# -//# This program is free software; you can redistribute it and/or modify -//# it under the terms of the GNU General Public License as published by -//# the Free Software Foundation; either version 2 of the License, or -//# (at your option) any later version. -//# -//# This program is distributed in the hope that it will be useful, -//# but WITHOUT ANY WARRANTY; without even the implied warranty of -//# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -//# GNU General Public License for more details. -//# -//# You should have received a copy of the GNU General Public License -//# along with this program; if not, write to the Free Software -//# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -//# -//# $Id$ - -#include <GPA_APC.h> -#include <TM/GCF_Task.h> -#include <GCFCommon/CmdLine.h> -#include <xercesc/util/PlatformUtils.hpp> -#include <xercesc/parsers/AbstractDOMParser.hpp> -#include <xercesc/dom/DOMImplementation.hpp> -#include <xercesc/dom/DOMImplementationLS.hpp> -#include <xercesc/dom/DOMImplementationRegistry.hpp> -#include <xercesc/dom/DOMException.hpp> -#include <xercesc/dom/DOMDocument.hpp> -#include <xercesc/dom/DOMNodeList.hpp> -#include <xercesc/dom/DOMError.hpp> -#include <xercesc/dom/DOMLocator.hpp> -#include <xercesc/dom/DOMNamedNodeMap.hpp> -#include <xercesc/dom/DOMAttr.hpp> -#include <xercesc/dom/DOMText.hpp> - -#include <SAL/GCF_PValue.h> - -static void Trim_White_Spaces(string & string_to_trim) -{ - // Trim leading white spaces - size_t nowhite = string_to_trim.find_first_not_of( " \t\n\r\b\f\v" ); - string_to_trim.erase( 0, nowhite ); - // Trim trailing white spaces - nowhite = string_to_trim.find_last_not_of( " \t\n\r\b\f\v" ); - string_to_trim.erase( nowhite + 1 ); -} - -GPAAPC::GPAAPC() -{ - AbstractDOMParser::ValSchemes valScheme = AbstractDOMParser::Val_Auto; - bool doNamespaces = false; - bool doSchema = false; - bool schemaFullChecking = false; - - char* macConfigPath = getenv("MAC_CONFIG"); - if (macConfigPath) - _apcRootPath = macConfigPath; - _apcRootPath += "/Apc"; - if (GCFTask::_argv != 0) - { - CCmdLine cmdLine; - - // parse argc,argv - if (cmdLine.SplitLine(GCFTask::_argc, GCFTask::_argv) > 0) - { - _apcRootPath = cmdLine.GetSafeArgument("-apcp", 0, "./Apc"); - } - } - - try - { - XMLPlatformUtils::Initialize(); - } - catch (const XMLException& toCatch) - { - LOFAR_LOG_ERROR(PA_STDOUT_LOGGER, ( - "\n\tError during initialization! : '%s'\n\t", - StrX(toCatch.getMessage()).localForm())); - } - - // Instantiate the DOM parser. - static const XMLCh gLS[] = { chLatin_L, chLatin_S, chNull }; - DOMImplementation *impl = DOMImplementationRegistry::getDOMImplementation(gLS); - _pXmlParser = ((DOMImplementationLS*)impl)->createDOMBuilder(DOMImplementationLS::MODE_SYNCHRONOUS, 0); - - _pXmlParser->setFeature(XMLUni::fgDOMNamespaces, doNamespaces); - _pXmlParser->setFeature(XMLUni::fgXercesSchema, doSchema); - _pXmlParser->setFeature(XMLUni::fgXercesSchemaFullChecking, schemaFullChecking); - - if (valScheme == AbstractDOMParser::Val_Auto) - { - _pXmlParser->setFeature(XMLUni::fgDOMValidateIfSchema, true); - } - else if (valScheme == AbstractDOMParser::Val_Never) - { - _pXmlParser->setFeature(XMLUni::fgDOMValidation, false); - } - else if (valScheme == AbstractDOMParser::Val_Always) - { - _pXmlParser->setFeature(XMLUni::fgDOMValidation, true); - } - - // enable datatype normalization - default is off - _pXmlParser->setFeature(XMLUni::fgDOMDatatypeNormalization, true); -} - -GPAAPC::~GPAAPC() -{ - // - // We can do away with the parser! - // - _pXmlParser->release(); - XMLPlatformUtils::Terminate(); -} - -TPAResult GPAAPC::load(const string apcName, const string scope) -{ - TPAResult result(PA_NO_ERROR); - - // And create our error handler and install it - DOMCountErrorHandler errorHandler; - _pXmlParser->setErrorHandler(&errorHandler); - - _scope = scope; - for (list<TAPCProperty>::iterator iter = _properties.begin(); - iter != _properties.end(); ++iter) - { - if (iter->pValue) - delete iter->pValue; - } - _properties.clear(); - Trim_White_Spaces(_scope); - - if (_scope.length() == 0) - return PA_EMPTY_SCOPE; - - XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument *doc = 0; - - try - { - // reset document pool - _pXmlParser->resetDocumentPool(); - - string fullApcFileName = _apcRootPath + "/" + apcName + ".xml"; - doc = _pXmlParser->parseURI(fullApcFileName.c_str()); - } - catch (const XMLException& toCatch) - { - LOFAR_LOG_ERROR(PA_STDOUT_LOGGER, ( - "\n\tError during parsing: '%s'\n\tException message is: \n\t%s\n\t", - apcName.c_str(), - StrX(toCatch.getMessage()).localForm())); - result = PA_UNABLE_TO_LOAD_APC; - } - catch (const DOMException& toCatch) - { - const unsigned int maxChars = 2047; - XMLCh errText[maxChars + 1]; - - if (DOMImplementation::loadDOMExceptionMsg(toCatch.code, errText, maxChars)) - { - LOFAR_LOG_ERROR(PA_STDOUT_LOGGER, ( - "\n\tDOM Error during parsing: '%s'\n\tDOMException code is: %s\n\t", - "Message is: %s\n\t", - apcName.c_str(), - toCatch.code, - StrX(errText).localForm())); - } - else - { - LOFAR_LOG_ERROR(PA_STDOUT_LOGGER, ( - "\n\tDOM Error during parsing: '%s'\n\tDOMException code is: %s\n\t", - apcName.c_str(), - toCatch.code)); - } - result = PA_UNABLE_TO_LOAD_APC; - } - catch (...) - { - LOFAR_LOG_ERROR(PA_STDOUT_LOGGER, ( - "\n\tUnexpected exception during parsing: '%s'\n\t", - apcName.c_str())); - result = PA_UNABLE_TO_LOAD_APC; - } - - // - // Extract the DOM tree, get the list of all the elements and report the - // length as the count of elements. - // - if (!errorHandler.getSawErrors()) - { - if (doc) - { - DOMNode* pChild; - DOMNode* pN = (DOMNode*)doc->getDocumentElement(); - if (pN) - { - // ignore root node -> type of APC - for (pChild = pN->getFirstChild(); pChild != 0; - pChild = pChild->getNextSibling()) - makePropList(pChild, ""); - } - } - } - - return result; -} - -TPAResult GPAAPC::makePropList(DOMNode* pN, string path) -{ - TPAResult result(PA_NO_ERROR); - DOMNode* pChild; - static bool propertyEntered = false; - static bool macDefaultSet = false; - static string macType = ""; - static string macDefault = ""; - static string propName = ""; - if (pN) - { - if (pN->getNodeType() == DOMNode::ELEMENT_NODE) - { - char* name = XMLString::transcode(pN->getNodeName()); - if (strncmp(name, "MACType", 7) == 0) - { - result = getValue(pN, macType); - propertyEntered = true; - propName = path; - XMLString::release(&name); - return result; - } - else if (strncmp(name, "MACDefault", 10) == 0) - { - result = getValue(pN, macDefault); - propertyEntered = true; - macDefaultSet = true; - propName = path; - XMLString::release(&name); - return result; - } - else - { - if (path.length() > 0) - path += '_'; - path += name; - XMLString::release(&name); - } - } - if (path != propName && propertyEntered) - { - Trim_White_Spaces(macType); - if (macType.length() > 0) - { - TAPCProperty property; - if (propName.length() > 0) - { - property.name = _scope + string("_") + propName; - } - else - { - property.name = _scope; - } - GCFPValue* pV(0); - Trim_White_Spaces(macDefault); - if ((result = createMACValueObject(macType, - macDefault, - macDefaultSet, - &pV)) - == PA_NO_ERROR) - { - property.pValue = pV; - property.defaultSet = macDefaultSet; - _properties.push_back(property); - } - propertyEntered = false; - macDefaultSet = false; - } - else - { - LOFAR_LOG_ERROR(PA_STDOUT_LOGGER, ( - "No MACType specified on property: '%s'", - propName.c_str())); - result = PA_NO_TYPE_SPECIFIED_IN_APC; - } - } - for (pChild = pN->getFirstChild(); pChild != 0; - pChild = pChild->getNextSibling()) - makePropList(pChild, path); - } - return result; -} - -TPAResult GPAAPC::getValue(DOMNode* pN, string& value) -{ - TPAResult result(PA_NO_ERROR); - if (pN) - { - if (pN->getChildNodes()->getLength() == 1) - { - DOMNode* pChild; - pChild = pN->getFirstChild(); - if (pChild->getNodeType() == DOMNode::TEXT_NODE) - { - char* pValue = XMLString::transcode(pChild->getNodeValue()); - value = pValue; - XMLString::release(&pValue); - } - } - } - return result; -} - -TPAResult GPAAPC::createMACValueObject( - const string& macType, - const string& valueData, - bool defaultSet, - GCFPValue** pReturnValue) -{ - TPAResult result(PA_NO_ERROR); - *pReturnValue = 0; - - if (macType == "MACBool") - { - *pReturnValue = GCFPValue::createMACTypeObject(GCFPValue::LPT_BOOL); - } - else if (macType == "MACChar") - { - *pReturnValue = GCFPValue::createMACTypeObject(GCFPValue::LPT_CHAR); - } - else if (macType == "MACUnsigned") - { - *pReturnValue = GCFPValue::createMACTypeObject(GCFPValue::LPT_UNSIGNED); - } - else if (macType == "MACInteger") - { - *pReturnValue = GCFPValue::createMACTypeObject(GCFPValue::LPT_INTEGER); - } - else if (macType == "MACDouble") - { - *pReturnValue = GCFPValue::createMACTypeObject(GCFPValue::LPT_DOUBLE); - } - else if (macType == "MACString") - { - *pReturnValue = GCFPValue::createMACTypeObject(GCFPValue::LPT_STRING); - } -/* else if (macType == "BIT32_VAL") - { - *pMacValue = new GCFPVBit32(((Bit32Var *)&variable)->getValue()); - } - else if (macType == "LPT_REF") - { - *pMacValue = new GCFPVRef(((TextVar *)&variable)->getValue()); - } - else if (macType == "LPT_BLOB") - { - *pMacValue = new GCFPVBlob(((BlobVar *)&variable)->getValue()); - } - else if (macType == "LPT_DATETIME") - { - *pMacValue = new GCFPVDateTime(((TimeVar *)&variable)->getValue()); - }*/ - else - { - result = PA_MACTYPE_UNKNOWN; - } - if (*pReturnValue && defaultSet) - { - result = ((*pReturnValue)->setValue(valueData) == GCF_NO_ERROR ? - PA_NO_ERROR : - PA_SAL_ERROR); - } - - return result; -} - - -DOMCountErrorHandler::DOMCountErrorHandler() : - _sawErrors(false) -{ -} - -DOMCountErrorHandler::~DOMCountErrorHandler() -{ -} - -// --------------------------------------------------------------------------- -// DOMCountHandlers: Overrides of the DOM ErrorHandler interface -// --------------------------------------------------------------------------- -bool DOMCountErrorHandler::handleError(const DOMError& domError) -{ - _sawErrors = true; - if (domError.getSeverity() == DOMError::DOM_SEVERITY_WARNING) - { - LOFAR_LOG_WARN(PA_STDOUT_LOGGER, ( - "\nWarning at file %s, line %s, char %s\n Message: %s\n\t", - StrX(domError.getLocation()->getURI()).localForm(), - domError.getLocation()->getLineNumber(), - domError.getLocation()->getColumnNumber(), - StrX(domError.getMessage()).localForm())); - } - else if (domError.getSeverity() == DOMError::DOM_SEVERITY_ERROR) - { - LOFAR_LOG_ERROR(PA_STDOUT_LOGGER, ( - "\nError at file %s, line %s, char %s\n Message: %s\n\t", - StrX(domError.getLocation()->getURI()).localForm(), - domError.getLocation()->getLineNumber(), - domError.getLocation()->getColumnNumber(), - StrX(domError.getMessage()).localForm())); - } - else - { - LOFAR_LOG_FATAL(PA_STDOUT_LOGGER, ( - "\nFatal Error at file %s, line %s, char %s\n Message: %s\n\t", - StrX(domError.getLocation()->getURI()).localForm(), - domError.getLocation()->getLineNumber(), - domError.getLocation()->getColumnNumber(), - StrX(domError.getMessage()).localForm())); - } - return true; -} - -void DOMCountErrorHandler::resetErrors() -{ - _sawErrors = false; -} diff --git a/MAC/GCF/_CoreComps/PA/src/GPA_APC.h b/MAC/GCF/_CoreComps/PA/src/GPA_APC.h deleted file mode 100644 index 10cd1f122872252c1fdc725a70553a03bcfe5f79..0000000000000000000000000000000000000000 --- a/MAC/GCF/_CoreComps/PA/src/GPA_APC.h +++ /dev/null @@ -1,164 +0,0 @@ -//# GPA_APC.h: helper class for loading XML files with APC into RAM -//# -//# Copyright (C) 2002-2003 -//# ASTRON (Netherlands Foundation for Research in Astronomy) -//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl -//# -//# This program is free software; you can redistribute it and/or modify -//# it under the terms of the GNU General Public License as published by -//# the Free Software Foundation; either version 2 of the License, or -//# (at your option) any later version. -//# -//# This program is distributed in the hope that it will be useful, -//# but WITHOUT ANY WARRANTY; without even the implied warranty of -//# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -//# GNU General Public License for more details. -//# -//# You should have received a copy of the GNU General Public License -//# along with this program; if not, write to the Free Software -//# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -//# -//# $Id$ - -#ifndef GPA_APC_H -#define GPA_APC_H - -#include <GPA_Defines.h> - -#include <xercesc/dom/DOMErrorHandler.hpp> -#include <xercesc/util/XMLString.hpp> -#include <xercesc/dom/DOMBuilder.hpp> -#include <Common/lofar_list.h> - -/** - This is a helper class for loading XML files with APC into RAM -*/ -class GCFPValue; - -XERCES_CPP_NAMESPACE_USE - -class GPAAPC -{ - public: - GPAAPC(); - virtual ~GPAAPC(); - - inline const list<TAPCProperty>& getProperties() const {return _properties;} - TPAResult load(const string apcName, - const string scope); - - private: //helper methods - TPAResult makePropList(DOMNode* pN, - string path); - TPAResult getValue(DOMNode* pN, - string& value); - TPAResult createMACValueObject(const string& macType, - const string& valueData, - bool defaultSet, - GCFPValue** pReturnValue); - - private: - - DOMBuilder* _pXmlParser; - list<TAPCProperty> _properties; - string _scope; - string _apcRootPath; -}; - -// --------------------------------------------------------------------------- -// Simple error handler deriviative to install on parser -// --------------------------------------------------------------------------- -class DOMCountErrorHandler : public DOMErrorHandler -{ - public: - // ----------------------------------------------------------------------- - // Constructors and Destructor - // ----------------------------------------------------------------------- - DOMCountErrorHandler(); - ~DOMCountErrorHandler(); - - - // ----------------------------------------------------------------------- - // Getter methods - // ----------------------------------------------------------------------- - bool getSawErrors() const; - - - // ----------------------------------------------------------------------- - // Implementation of the DOM ErrorHandler interface - // ----------------------------------------------------------------------- - bool handleError(const DOMError& domError); - void resetErrors(); - - - private : - // ----------------------------------------------------------------------- - // Unimplemented constructors and operators - // ----------------------------------------------------------------------- - DOMCountErrorHandler(const DOMCountErrorHandler&); - void operator=(const DOMCountErrorHandler&); - - - // ----------------------------------------------------------------------- - // Private data members - // - // _sawErrors - // This is set if we get any errors, and is queryable via a getter - // method. Its used by the main code to suppress output if there are - // errors. - // ----------------------------------------------------------------------- - bool _sawErrors; -}; - - -// --------------------------------------------------------------------------- -// This is a simple class that lets us do easy (though not terribly efficient) -// trancoding of XMLCh data to local code page for display. -// --------------------------------------------------------------------------- -class StrX -{ - public : - // ----------------------------------------------------------------------- - // Constructors and Destructor - // ----------------------------------------------------------------------- - StrX(const XMLCh* const toTranscode) - { - // Call the private transcoding method - _localForm = XMLString::transcode(toTranscode); - } - - ~StrX() - { - XMLString::release(&_localForm); - } - - - // ----------------------------------------------------------------------- - // Getter methods - // ----------------------------------------------------------------------- - const char* localForm() const - { - return _localForm; - } - - private : - // ----------------------------------------------------------------------- - // Private data members - // - // _localForm - // This is the local code page form of the string. - // ----------------------------------------------------------------------- - char* _localForm; -}; - -inline ostream& operator<<(ostream& target, const StrX& toDump) -{ - target << toDump.localForm(); - return target; -} - -inline bool DOMCountErrorHandler::getSawErrors() const -{ - return _sawErrors; -} -#endif diff --git a/MAC/GCF/_CoreComps/PA/test/xml/GPA_APCLoader.cc b/MAC/GCF/_CoreComps/PA/test/xml/GPA_APCLoader.cc deleted file mode 100644 index 0b6842b6be72ffdb38fb84d610e3e817aefd1a90..0000000000000000000000000000000000000000 --- a/MAC/GCF/_CoreComps/PA/test/xml/GPA_APCLoader.cc +++ /dev/null @@ -1,247 +0,0 @@ -//# GPA_APCLoader.cc: -//# -//# Copyright (C) 2002-2003 -//# ASTRON (Netherlands Foundation for Research in Astronomy) -//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl -//# -//# This program is free software; you can redistribute it and/or modify -//# it under the terms of the GNU General Public License as published by -//# the Free Software Foundation; either version 2 of the License, or -//# (at your option) any later version. -//# -//# This program is distributed in the hope that it will be useful, -//# but WITHOUT ANY WARRANTY; without even the implied warranty of -//# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -//# GNU General Public License for more details. -//# -//# You should have received a copy of the GNU General Public License -//# along with this program; if not, write to the Free Software -//# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -//# -//# $Id$ - - -// --------------------------------------------------------------------------- -// Includes -// --------------------------------------------------------------------------- -#include <xercesc/util/XMLUniDefs.hpp> -#include <xercesc/sax2/Attributes.hpp> -#include "GPA_APCLoader.h" - - -// --------------------------------------------------------------------------- -// Local const data -// -// Note: This is the 'safe' way to do these strings. If you compiler supports -// L"" style strings, and portability is not a concern, you can use -// those types constants directly. -// --------------------------------------------------------------------------- -static const XMLCh gEndElement[] = { chOpenAngle, chForwardSlash, chNull }; -static const XMLCh gEndPI[] = { chQuestion, chCloseAngle, chNull }; -static const XMLCh gStartPI[] = { chOpenAngle, chQuestion, chNull }; -static const XMLCh gXMLDecl1[] = -{ - chOpenAngle, chQuestion, chLatin_x, chLatin_m, chLatin_l, - chSpace, chLatin_v, chLatin_e, chLatin_r, chLatin_s, chLatin_i, - chLatin_o, chLatin_n, chEqual, chDoubleQuote, chDigit_1, chPeriod, - chDigit_0, chDoubleQuote, chSpace, chLatin_e, chLatin_n, chLatin_c, - chLatin_o, chLatin_d, chLatin_i, chLatin_n, chLatin_g, chEqual, - chDoubleQuote, chNull -}; - -static const XMLCh gXMLDecl2[] = -{ - chDoubleQuote, chQuestion, chCloseAngle, - chLF, chNull -}; - - -// --------------------------------------------------------------------------- -// GPAAPCLoader: Constructors and Destructor -// --------------------------------------------------------------------------- -GPAAPCLoader::GPAAPCLoader( - const char* const encodingName, - const XMLFormatter::UnRepFlags unRepFlags, - const bool expandNamespaces) : - _formatter(encodingName, 0, this, XMLFormatter::NoEscapes, unRepFlags), - _expandNS(expandNamespaces) -{ -} - -GPAAPCLoader::~GPAAPCLoader() -{ -} - - -// --------------------------------------------------------------------------- -// GPAAPCLoader: Overrides of the output formatter target interface -// --------------------------------------------------------------------------- -void GPAAPCLoader::writeChars(const XMLByte* const toWrite) -{ -} - -void GPAAPCLoader::writeChars(const XMLByte* const toWrite, - const unsigned int count, - XMLFormatter* const formatter) -{ - // For this one, just dump them to the standard output - // Surprisingly, Solaris was the only platform on which - // required the char* cast to print out the string correctly. - // Without the cast, it was printing the pointer value in hex. - // Quite annoying, considering every other platform printed - // the string with the explicit cast to char* below. - cout.write((char *) toWrite, (int) count); - cout.flush(); -} - - -// --------------------------------------------------------------------------- -// GPAAPCLoader: Overrides of the SAX ErrorHandler interface -// --------------------------------------------------------------------------- -void GPAAPCLoader::error(const SAXParseException& e) -{ - cerr << "\nError at file " << StrX(e.getSystemId()) - << ", line " << e.getLineNumber() - << ", char " << e.getColumnNumber() - << "\n Message: " << StrX(e.getMessage()) << endl; -} - -void GPAAPCLoader::fatalError(const SAXParseException& e) -{ - cerr << "\nFatal Error at file " << StrX(e.getSystemId()) - << ", line " << e.getLineNumber() - << ", char " << e.getColumnNumber() - << "\n Message: " << StrX(e.getMessage()) << endl; -} - -void GPAAPCLoader::warning(const SAXParseException& e) -{ - cerr << "\nWarning at file " << StrX(e.getSystemId()) - << ", line " << e.getLineNumber() - << ", char " << e.getColumnNumber() - << "\n Message: " << StrX(e.getMessage()) << endl; -} - - -// --------------------------------------------------------------------------- -// GPAAPCLoader: Overrides of the SAX DTDHandler interface -// --------------------------------------------------------------------------- -void GPAAPCLoader::unparsedEntityDecl( - const XMLCh* const name, - const XMLCh* const publicId, - const XMLCh* const systemId, - const XMLCh* const notationName) -{ - // Not used at this time -} - - -void GPAAPCLoader::notationDecl( - const XMLCh* const name, - const XMLCh* const publicId, - const XMLCh* const systemId) -{ - // Not used at this time -} - - -// --------------------------------------------------------------------------- -// GPAAPCLoader: Overrides of the SAX DocumentHandler interface -// --------------------------------------------------------------------------- -void GPAAPCLoader::characters(const XMLCh* const chars - , const unsigned int length) -{ - _formatter.formatBuf(chars, length, XMLFormatter::CharEscapes); -} - - -void GPAAPCLoader::endDocument() -{ -} - - -void GPAAPCLoader::endElement( - const XMLCh* const uri, - const XMLCh* const localname, - const XMLCh* const qname) -{ - // No escapes are legal here - _formatter << XMLFormatter::NoEscapes << gEndElement ; - if ( _expandNS ) - { - if (XMLString::compareIString(uri,XMLUni::fgZeroLenString) != 0) - _formatter << uri << chColon; - _formatter << localname << chCloseAngle; - } - else - _formatter << qname << chCloseAngle; -} - - -void GPAAPCLoader::ignorableWhitespace( - const XMLCh* const chars, - const unsigned int length) -{ - _formatter.formatBuf(chars, length, XMLFormatter::NoEscapes); -} - - -void GPAAPCLoader::processingInstruction( - const XMLCh* const target, - const XMLCh* const data) -{ - _formatter << XMLFormatter::NoEscapes << gStartPI << target; - if (data) - _formatter << chSpace << data; - _formatter << XMLFormatter::NoEscapes << gEndPI; -} - - -void GPAAPCLoader::startDocument() -{ -} - - -void GPAAPCLoader::startElement( - const XMLCh* const uri, - const XMLCh* const localname, - const XMLCh* const qname, - const Attributes& attributes) -{ - // The name has to be representable without any escapes - _formatter << XMLFormatter::NoEscapes << chOpenAngle ; - if ( _expandNS ) - { - if (XMLString::compareIString(uri,XMLUni::fgZeroLenString) != 0) - _formatter << uri << chColon; - _formatter << localname ; - } - else - _formatter << qname ; - - unsigned int len = attributes.getLength(); - for (unsigned int index = 0; index < len; index++) - { - // - // Again the name has to be completely representable. But the - // attribute can have refs and requires the attribute style - // escaping. - // - _formatter << XMLFormatter::NoEscapes << chSpace ; - if ( _expandNS ) - { - if (XMLString::compareIString(attributes.getURI(index),XMLUni::fgZeroLenString) != 0) - _formatter << attributes.getURI(index) << chColon; - _formatter << attributes.getLocalName(index) ; - } - else - _formatter << attributes.getQName(index) ; - - _formatter << chEqual << chDoubleQuote - << XMLFormatter::AttrEscapes - << attributes.getValue(index) - << XMLFormatter::NoEscapes - << chDoubleQuote; - } - _formatter << chCloseAngle; -} diff --git a/MAC/GCF/_CoreComps/PA/test/xml/GPA_APCLoader.h b/MAC/GCF/_CoreComps/PA/test/xml/GPA_APCLoader.h deleted file mode 100644 index aac833c569b9bb28ac48b65880f16a073c18e868..0000000000000000000000000000000000000000 --- a/MAC/GCF/_CoreComps/PA/test/xml/GPA_APCLoader.h +++ /dev/null @@ -1,189 +0,0 @@ -//# GPA_APCLoader.h: -//# -//# Copyright (C) 2002-2003 -//# ASTRON (Netherlands Foundation for Research in Astronomy) -//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl -//# -//# This program is free software; you can redistribute it and/or modify -//# it under the terms of the GNU General Public License as published by -//# the Free Software Foundation; either version 2 of the License, or -//# (at your option) any later version. -//# -//# This program is distributed in the hope that it will be useful, -//# but WITHOUT ANY WARRANTY; without even the implied warranty of -//# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -//# GNU General Public License for more details. -//# -//# You should have received a copy of the GNU General Public License -//# along with this program; if not, write to the Free Software -//# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -//# -//# $Id$ - -#ifndef GPA_APCLOADER_H -#define GPA_APCLOADER_H -#include <iostream.h> -#include <xercesc/sax2/DefaultHandler.hpp> -#include <xercesc/framework/XMLFormatter.hpp> - -XERCES_CPP_NAMESPACE_USE - -class GPAAPCLoader : public DefaultHandler, private XMLFormatTarget -{ - public: - // ----------------------------------------------------------------------- - // Constructors - // ----------------------------------------------------------------------- - GPAAPCLoader - ( - const char* const encodingName, - const XMLFormatter::UnRepFlags unRepFlags, - const bool expandNamespaces - ); - ~GPAAPCLoader(); - - - // ----------------------------------------------------------------------- - // Implementations of the format target interface - // ----------------------------------------------------------------------- - void writeChars - ( - const XMLByte* const toWrite - ); - - void writeChars - ( - const XMLByte* const toWrite, - const unsigned int count, - XMLFormatter* const formatter - ); - - - // ----------------------------------------------------------------------- - // Implementations of the SAX DocumentHandler interface - // ----------------------------------------------------------------------- - void endDocument(); - - void endElement - ( - const XMLCh* const uri, - const XMLCh* const localname, - const XMLCh* const qname - ); - - void characters - ( - const XMLCh* const chars, - const unsigned int length - ); - - void ignorableWhitespace - ( - const XMLCh* const chars, - const unsigned int length - ); - - void processingInstruction - ( - const XMLCh* const target, - const XMLCh* const data - ); - - void startDocument(); - - void startElement - ( - const XMLCh* const uri, - const XMLCh* const localname, - const XMLCh* const qname, - const Attributes& attributes - ); - - - - // ----------------------------------------------------------------------- - // Implementations of the SAX ErrorHandler interface - // ----------------------------------------------------------------------- - void warning(const SAXParseException& exception); - void error(const SAXParseException& exception); - void fatalError(const SAXParseException& exception); - - - - // ----------------------------------------------------------------------- - // Implementation of the SAX DTDHandler interface - // ----------------------------------------------------------------------- - void notationDecl - ( - const XMLCh* const name, - const XMLCh* const publicId, - const XMLCh* const systemId - ); - - void unparsedEntityDecl - ( - const XMLCh* const name, - const XMLCh* const publicId, - const XMLCh* const systemId, - const XMLCh* const notationName - ); - - private : - // ----------------------------------------------------------------------- - // Private data members - // - // _formatter - // This is the formatter object that is used to output the data - // to the target. It is set up to format to the standard output - // stream. - // ----------------------------------------------------------------------- - XMLFormatter _formatter; - bool _expandNS; -}; - -// --------------------------------------------------------------------------- -// This is a simple class that lets us do easy (though not terribly efficient) -// trancoding of XMLCh data to local code page for display. -// --------------------------------------------------------------------------- -class StrX -{ - public : - // ----------------------------------------------------------------------- - // Constructors and Destructor - // ----------------------------------------------------------------------- - StrX(const XMLCh* const toTranscode) - { - // Call the private transcoding method - _localForm = XMLString::transcode(toTranscode); - } - - ~StrX() - { - XMLString::release(&_localForm); - } - - // ----------------------------------------------------------------------- - // Getter methods - // ----------------------------------------------------------------------- - const char* localForm() const - { - return _localForm; - } - - private : - // ----------------------------------------------------------------------- - // Private data members - // - // fLocalForm - // This is the local code page form of the string. - // ----------------------------------------------------------------------- - char* _localForm; -}; - -inline ostream& operator<<(ostream& target, const StrX& toDump) -{ - target << toDump.localForm(); - return target; -} - -#endif diff --git a/MAC/GCF/_CoreComps/PA/test/xml/GPA_APCsax.cc b/MAC/GCF/_CoreComps/PA/test/xml/GPA_APCsax.cc deleted file mode 100644 index e1a78504aeb6770f43626a88a020f3d591883d7e..0000000000000000000000000000000000000000 --- a/MAC/GCF/_CoreComps/PA/test/xml/GPA_APCsax.cc +++ /dev/null @@ -1,120 +0,0 @@ -//# GPA_APC.cc: -//# -//# Copyright (C) 2002-2003 -//# ASTRON (Netherlands Foundation for Research in Astronomy) -//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl -//# -//# This program is free software; you can redistribute it and/or modify -//# it under the terms of the GNU General Public License as published by -//# the Free Software Foundation; either version 2 of the License, or -//# (at your option) any later version. -//# -//# This program is distributed in the hope that it will be useful, -//# but WITHOUT ANY WARRANTY; without even the implied warranty of -//# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -//# GNU General Public License for more details. -//# -//# You should have received a copy of the GNU General Public License -//# along with this program; if not, write to the Free Software -//# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -//# -//# $Id$ - -#include "GPA_APC.h" -#include "GPA_APCLoader.h" -#include <xercesc/sax2/XMLReaderFactory.hpp> -#include <xercesc/util/XMLString.hpp> - -static const char* encodingName = "LATIN1"; -static XMLFormatter::UnRepFlags unRepFlags = XMLFormatter::UnRep_CharRef; -static bool expandNamespaces= false ; -static bool doSchema = true; -static bool schemaFullChecking = false; -static bool namespacePrefixes = false; - -GPAAPC::GPAAPC()// : - //_xmlHandler(encodingName, unRepFlags, expandNamespaces) -{ - try - { - XMLPlatformUtils::Initialize(); - } - - catch (const XMLException& toCatch) - { - cerr << "Error during initialization! :\n" - << StrX(toCatch.getMessage()) << endl; - exit(1); - } - - _pXmlParser = XMLReaderFactory::createXMLReader(); - - // - // Set some features in the XMLReader - // - _pXmlParser->setFeature(XMLUni::fgXercesDynamic, true); - _pXmlParser->setFeature(XMLUni::fgSAX2CoreValidation, true); // optional - _pXmlParser->setFeature(XMLUni::fgSAX2CoreNameSpaces, true); // optional - _pXmlParser->setFeature(XMLUni::fgXercesSchema, doSchema); - _pXmlParser->setFeature(XMLUni::fgXercesSchemaFullChecking, schemaFullChecking); - _pXmlParser->setFeature(XMLUni::fgSAX2CoreNameSpacePrefixes, namespacePrefixes); - -} - -GPAAPC::~GPAAPC() -{ - // - // We can do away with the parser! - // - delete _pXmlParser; - _pXmlParser = 0; - XMLPlatformUtils::Terminate(); -} - -TPAResult GPAAPC::loadFile(const string& apcName) -{ - TPAResult result(PA_NO_ERROR); - - GPAAPCLoader xmlHandler(encodingName, unRepFlags, expandNamespaces); - // - // Tell the XMLReader who's the contenthandler... - // - _pXmlParser->setContentHandler( &xmlHandler ); - _pXmlParser->setErrorHandler( &xmlHandler ); - - try - { - _pXmlParser->parse(apcName.c_str()); - } - catch( const XMLException& e ) - { - LOFAR_LOG_ERROR(PA_STDOUT_LOGGER, ( - "XMLException: %s\n", - XMLString::transcode(e.getMessage()))); - result = PA_UNABLE_TO_LOAD_APC; - } - catch( const SAXParseException& e ) - { - LOFAR_LOG_ERROR(PA_STDOUT_LOGGER, ( - "SAXParseException: %s\n", - XMLString::transcode(e.getMessage()))); - result = PA_UNABLE_TO_LOAD_APC; - } -/* catch( const ExceptionObject& e ) - { - LOFAR_LOG_ERROR(PA_STDOUT_LOGGER, ( - "%s/%s in %s @line %d, fn= %s\n", - e.getType(), e.getText(), - e.getFile(), e.getLine(), - e.getFunction())); - result = PA_UNABLE_TO_LOAD_APC; - } -*/ catch (...) - { - LOFAR_LOG_ERROR(PA_STDOUT_LOGGER, ( - "Unexpected Exception\n")); - result = PA_UNABLE_TO_LOAD_APC; - } - - return result; -} diff --git a/MAC/GCF/_CoreComps/PA/test/xml/GPA_APCsax.h b/MAC/GCF/_CoreComps/PA/test/xml/GPA_APCsax.h deleted file mode 100644 index 20c06f83322d78017b3bebb8d120e3ae631efbf4..0000000000000000000000000000000000000000 --- a/MAC/GCF/_CoreComps/PA/test/xml/GPA_APCsax.h +++ /dev/null @@ -1,41 +0,0 @@ -//# GPA_APC.h: -//# -//# Copyright (C) 2002-2003 -//# ASTRON (Netherlands Foundation for Research in Astronomy) -//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl -//# -//# This program is free software; you can redistribute it and/or modify -//# it under the terms of the GNU General Public License as published by -//# the Free Software Foundation; either version 2 of the License, or -//# (at your option) any later version. -//# -//# This program is distributed in the hope that it will be useful, -//# but WITHOUT ANY WARRANTY; without even the implied warranty of -//# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -//# GNU General Public License for more details. -//# -//# You should have received a copy of the GNU General Public License -//# along with this program; if not, write to the Free Software -//# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -//# -//# $Id$ - -#ifndef GPA_APC_H -#define GPA_APC_H - -#include "GPA_APCLoader.h" -#include <xercesc/sax2/SAX2XMLReader.hpp> -#include <GPA_Defines.h> - -class GPAAPC -{ - public: - GPAAPC(); - virtual ~GPAAPC(); - - TPAResult loadFile(const string& apcName); - - private: - SAX2XMLReader* _pXmlParser; -}; -#endif diff --git a/MAC/GCF/_CoreComps/PA/test/xml/GPA_SAX2Count.h b/MAC/GCF/_CoreComps/PA/test/xml/GPA_SAX2Count.h deleted file mode 100644 index 82f55dce1985a9fc839874e023123e38e567c380..0000000000000000000000000000000000000000 --- a/MAC/GCF/_CoreComps/PA/test/xml/GPA_SAX2Count.h +++ /dev/null @@ -1,130 +0,0 @@ -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 1999-2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, - * if any, must include the following acknowledgment: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowledgment may appear in the software itself, - * if and wherever such third-party acknowledgments normally appear. - * - * 4. The names "Xerces" and "Apache Software Foundation" must - * not be used to endorse or promote products derived from this - * software without prior written permission. For written - * permission, please contact apache\@apache.org. - * - * 5. Products derived from this software may not be called "Apache", - * nor may "Apache" appear in their name, without prior written - * permission of the Apache Software Foundation. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation, and was - * originally based on software copyright (c) 1999, International - * Business Machines, Inc., http://www.ibm.com . For more information - * on the Apache Software Foundation, please see - * <http://www.apache.org/>. - */ - -/* - * $Log$ - * Revision 1.4 2003/02/05 18:53:23 tng - * [Bug 11915] Utility for freeing memory. - * - * Revision 1.3 2002/02/01 22:38:52 peiyongz - * sane_include - * - * Revision 1.2 2000/08/09 22:40:15 jpolast - * updates for changes to sax2 core functionality. - * - * Revision 1.1 2000/08/08 17:17:20 jpolast - * initial checkin of SAX2Count - * - * - */ - - -// --------------------------------------------------------------------------- -// Includes for all the program files to see -// --------------------------------------------------------------------------- -#include <xercesc/util/PlatformUtils.hpp> -#include "GPA_SAX2Handler.h" -#include <xercesc/sax2/XMLReaderFactory.hpp> -#include <xercesc/sax2/SAX2XMLReader.hpp> -#include <stdlib.h> -#include <string.h> -#include <iostream.h> - - -// --------------------------------------------------------------------------- -// This is a simple class that lets us do easy (though not terribly efficient) -// trancoding of XMLCh data to local code page for display. -// --------------------------------------------------------------------------- -class StrX -{ -public : - // ----------------------------------------------------------------------- - // Constructors and Destructor - // ----------------------------------------------------------------------- - StrX(const XMLCh* const toTranscode) - { - // Call the private transcoding method - fLocalForm = XMLString::transcode(toTranscode); - } - - ~StrX() - { - XMLString::release(&fLocalForm); - } - - // ----------------------------------------------------------------------- - // Getter methods - // ----------------------------------------------------------------------- - const char* localForm() const - { - return fLocalForm; - } - -private : - // ----------------------------------------------------------------------- - // Private data members - // - // fLocalForm - // This is the local code page form of the string. - // ----------------------------------------------------------------------- - char* fLocalForm; -}; - -inline ostream& operator<<(ostream& target, const StrX& toDump) -{ - target << toDump.localForm(); - return target; -} diff --git a/MAC/GCF/_CoreComps/PA/test/xml/GPA_SAX2Handler.cc b/MAC/GCF/_CoreComps/PA/test/xml/GPA_SAX2Handler.cc deleted file mode 100644 index 8e84d35f7b9d12d5dd2d65472d5ad7d4f0e60027..0000000000000000000000000000000000000000 --- a/MAC/GCF/_CoreComps/PA/test/xml/GPA_SAX2Handler.cc +++ /dev/null @@ -1,164 +0,0 @@ -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 1999-2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, - * if any, must include the following acknowledgment: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowledgment may appear in the software itself, - * if and wherever such third-party acknowledgments normally appear. - * - * 4. The names "Xerces" and "Apache Software Foundation" must - * not be used to endorse or promote products derived from this - * software without prior written permission. For written - * permission, please contact apache\@apache.org. - * - * 5. Products derived from this software may not be called "Apache", - * nor may "Apache" appear in their name, without prior written - * permission of the Apache Software Foundation. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation, and was - * originally based on software copyright (c) 1999, International - * Business Machines, Inc., http://www.ibm.com . For more information - * on the Apache Software Foundation, please see - * <http://www.apache.org/>. - */ - -/* - * $Log$ - * Revision 1.4 2002/02/01 22:38:52 peiyongz - * sane_include - * - * Revision 1.3 2001/08/02 17:10:29 tng - * Allow DOMCount/SAXCount/IDOMCount/SAX2Count to take a file that has a list of xml file as input. - * - * Revision 1.2 2000/08/09 22:40:15 jpolast - * updates for changes to sax2 core functionality. - * - * Revision 1.1 2000/08/08 17:17:20 jpolast - * initial checkin of SAX2Count - * - * - */ - -// --------------------------------------------------------------------------- -// Includes -// --------------------------------------------------------------------------- -#include "GPA_SAX2Count.h" -#include <xercesc/sax2/Attributes.hpp> -#include <xercesc/sax/SAXParseException.hpp> -#include <xercesc/sax/SAXException.hpp> - -// --------------------------------------------------------------------------- -// GPASAX2Handler: Constructors and Destructor -// --------------------------------------------------------------------------- -GPASAX2Handler::GPASAX2Handler() : - - fElementCount(0) - , fAttrCount(0) - , fCharacterCount(0) - , fSpaceCount(0) - , fSawErrors(false) -{ -} - -GPASAX2Handler::~GPASAX2Handler() -{ -} - -// --------------------------------------------------------------------------- -// GPASAX2Handler: Implementation of the SAX DocumentHandler interface -// --------------------------------------------------------------------------- -void GPASAX2Handler::startElement(const XMLCh* const uri - , const XMLCh* const localname - , const XMLCh* const qname - , const Attributes& attrs) -{ - fElementCount++; - fAttrCount += attrs.getLength(); -} - -void GPASAX2Handler::characters( const XMLCh* const chars - , const unsigned int length) -{ - fCharacterCount += length; -} - -void GPASAX2Handler::ignorableWhitespace( const XMLCh* const chars - , const unsigned int length) -{ - fSpaceCount += length; -} - -void GPASAX2Handler::resetDocument() -{ - fAttrCount = 0; - fCharacterCount = 0; - fElementCount = 0; - fSpaceCount = 0; -} - - -// --------------------------------------------------------------------------- -// GPASAX2Handler: Overrides of the SAX ErrorHandler interface -// --------------------------------------------------------------------------- -void GPASAX2Handler::error(const SAXParseException& e) -{ - fSawErrors = true; - cerr << "\nError at file " << StrX(e.getSystemId()) - << ", line " << e.getLineNumber() - << ", char " << e.getColumnNumber() - << "\n Message: " << StrX(e.getMessage()) << endl; -} - -void GPASAX2Handler::fatalError(const SAXParseException& e) -{ - fSawErrors = true; - cerr << "\nFatal Error at file " << StrX(e.getSystemId()) - << ", line " << e.getLineNumber() - << ", char " << e.getColumnNumber() - << "\n Message: " << StrX(e.getMessage()) << endl; -} - -void GPASAX2Handler::warning(const SAXParseException& e) -{ - cerr << "\nWarning at file " << StrX(e.getSystemId()) - << ", line " << e.getLineNumber() - << ", char " << e.getColumnNumber() - << "\n Message: " << StrX(e.getMessage()) << endl; -} - -void GPASAX2Handler::resetErrors() -{ - fSawErrors = false; -} diff --git a/MAC/GCF/_CoreComps/PA/test/xml/GPA_SAX2Handler.h b/MAC/GCF/_CoreComps/PA/test/xml/GPA_SAX2Handler.h deleted file mode 100644 index 3b7cbf092ab6ad3c8c3a519bf834df50cfe5c4f8..0000000000000000000000000000000000000000 --- a/MAC/GCF/_CoreComps/PA/test/xml/GPA_SAX2Handler.h +++ /dev/null @@ -1,194 +0,0 @@ -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 1999-2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, - * if any, must include the following acknowledgment: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowledgment may appear in the software itself, - * if and wherever such third-party acknowledgments normally appear. - * - * 4. The names "Xerces" and "Apache Software Foundation" must - * not be used to endorse or promote products derived from this - * software without prior written permission. For written - * permission, please contact apache\@apache.org. - * - * 5. Products derived from this software may not be called "Apache", - * nor may "Apache" appear in their name, without prior written - * permission of the Apache Software Foundation. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation, and was - * originally based on software copyright (c) 1999, International - * Business Machines, Inc., http://www.ibm.com . For more information - * on the Apache Software Foundation, please see - * <http://www.apache.org/>. - */ - -/* - * $Log$ - * Revision 1.5 2002/11/05 21:46:20 tng - * Explicit code using namespace in application. - * - * Revision 1.4 2002/02/01 22:38:52 peiyongz - * sane_include - * - * Revision 1.3 2001/08/02 17:10:29 tng - * Allow DOMCount/SAXCount/IDOMCount/SAX2Count to take a file that has a list of xml file as input. - * - * Revision 1.2 2000/08/09 22:40:15 jpolast - * updates for changes to sax2 core functionality. - * - * Revision 1.1 2000/08/08 17:17:21 jpolast - * initial checkin of SAX2Count - * - * - */ - - -// --------------------------------------------------------------------------- -// Includes -// --------------------------------------------------------------------------- -#include <xercesc/sax2/Attributes.hpp> -#include <xercesc/sax2/DefaultHandler.hpp> -#include <xercesc/util/PlatformUtils.hpp> -#include <xercesc/util/TransService.hpp> -#include <xercesc/sax2/SAX2XMLReader.hpp> -#include <xercesc/framework/XMLFormatter.hpp> -#include <xercesc/internal/VecAttributesImpl.hpp> -#include <Common/lofar_vector.h> -#include <Common/lofar_stack.h> -#include <Common/lofar_string.h> - -XERCES_CPP_NAMESPACE_USE - -class GPASAX2Handler : public DefaultHandler -{ -public: - // ----------------------------------------------------------------------- - // Constructors and Destructor - // ----------------------------------------------------------------------- - GPASAX2Handler(); - ~GPASAX2Handler(); - - // ----------------------------------------------------------------------- - // Implementations of the SAX DocumentHandler interface - // ----------------------------------------------------------------------- - virtual void endDocument(); - - virtual void endElement (const XMLCh* const uri, - const XMLCh* const localname, - const XMLCh* const qname); - - virtual void startDocument(); - - virtual void startElement (const XMLCh* const uri, - const XMLCh* const localname, - const XMLCh* const qname, - const Attributes& attributes); - - // ----------------------------------------------------------------------- - // Implementations of the SAX ErrorHandler interface - // ----------------------------------------------------------------------- - - virtual void warning (const SAXParseException &exception); - - virtual void error (const SAXParseException &exception); - - virtual void fatalError (const SAXParseException &exception); - - virtual void resetErrors(); - -private: - - void handleRoot (const Attributes& attributes, bool start); - - void handleSimul (const Attributes& attributes, bool start); - - void handleStep (const Attributes& attributes, bool start); - - void handleWorkHolder (const Attributes& attributes, bool start); - - void handleDataHolder (const Attributes& attributes, bool start); - - void handleConnect (const Attributes& attributes, bool start); - - void handleExStep (const Attributes& attributes, bool start); - - // ----------------------------------------------------------------------- - // Function to make a copy of an Attributes. Use this function until - // Apache XML parser for C++ implements some clone() function in the - // abstract Attributes class, or it implements some other convenient - // method for copying an Attributes object - // ----------------------------------------------------------------------- - VecAttributesImpl* copyAttributes(const Attributes &att); - - bool itsActiveFlag; - string itsFocusSimul; // for partial parsing - bool itsRootSimulWasSet; - const XMLCh* itsContainerType; - stack<VecAttributesImpl*> itsAttStack; - vector<string> itsInDHVector; - vector<string> itsOutDHVector; -}; - -// --------------------------------------------------------------------------- -// This is a simple class that lets us do easy (though not terribly efficient) -// transcoding of XMLCh data to local code page for display. -// --------------------------------------------------------------------------- -class SAXLocalStr -{ -public: - - // ----------------------------------------------------------------------- - // Constructors and Destructor - // ----------------------------------------------------------------------- - SAXLocalStr (const XMLCh* const toTranscode) - { if (toTranscode) { - char* flocal = XMLString::transcode(toTranscode); - itsLocalForm = flocal; - delete [] flocal; - } - } - - const string& localForm() const - { return itsLocalForm; } - -private: - string itsLocalForm; -}; - -inline ostream& operator<<(ostream& target, const SAXLocalStr& toDump) -{ - target << toDump.localForm(); - return target; -} diff --git a/MAC/GCF/_CoreComps/PA/test/xml/GPA_SAXHandler.cc b/MAC/GCF/_CoreComps/PA/test/xml/GPA_SAXHandler.cc deleted file mode 100644 index c0a93fc740b0b78a4ac2f839ddc8a4226e4e9c73..0000000000000000000000000000000000000000 --- a/MAC/GCF/_CoreComps/PA/test/xml/GPA_SAXHandler.cc +++ /dev/null @@ -1,240 +0,0 @@ -// -//# $Id$ -// -//# $Log$ -//# Revision 1.6 2002/09/17 09:26:16 verkout -//# HV: Couple of parsing issues - -//# 1) if the parser encountered an element that it recognizes before AND -//# after it was done parsing the rootelement, it would *replace* the -//# element tree to the new element. This is now fixed. Once an element -//# tree is successfully built, recognized elements are discarded. -//# 2) The default behaviour was that the rootelement of the tree was the -//# first element the parser encountered and recognized. This might not -//# necessarily be the rootelement you were hoping for :). -//# It is now possible to specify which element you want for root-element. -//# If you do not specify a root-element, the default behaviour applies -//# (i.e. root-element=first recognized element) -//# -//# Revision 1.5 2002/07/16 10:42:58 loose -//# Added "SAXHandler: " in output of error handling methods. -//# -//# Revision 1.4 2002/07/15 12:01:22 verkout -//# HV: Undo (i.e. remove) printing of an obsolete error message. -//# -//# Revision 1.3 2002/07/10 10:46:08 verkout -//# HV: Merged my local addition into the new version -//# -// -#include <saxutil/SAXHandler.h> -#include <saxutil/SAXString.h> -#include <myutil/ExceptionObject.h> -#include <xercesc/sax2/Attributes.hpp> -#include <iostream> - -using std::cerr; -using std::endl; -using std::string; -using std::pair; - - -//#---------------------------------------------------------------------------- -//# Constructors & destructors -//#---------------------------------------------------------------------------- - -SAXHandler::SAXHandler() : - itsErrorFlag(false), - doneRootElement(false) -{ -} - - -SAXHandler::SAXHandler( const creatormap_t& aCreatorMap, const string& rootelemname ) : - itsErrorFlag(false), - doneRootElement(false), - itsRootElementName( rootelemname ), - itsCreatorMap(aCreatorMap) -{ -} - - -//#---------------------------------------------------------------------------- -//# Implementation of the SAX ContentHandler interface -//#---------------------------------------------------------------------------- - -void SAXHandler::endDocument() -{ -} - - -void SAXHandler::endElement(const XMLCh *const uri, - const XMLCh *const localname, - const XMLCh *const qname) -{ - // Check if the element stack is not empty - if (!itsElementStack.empty()) - { - // Pop the current element of the stack. - CountedPointer<SAXElement> ptr(itsElementStack.top()); - - itsElementStack.pop(); - // If the stack is not empty, add the popped element to its parent, - // which is now on top of the stack. - if (!itsElementStack.empty()) - { - // This should never fail, unless the programmer forgot to add the - // necessary code in the overloaded addElement() method. - if (!itsElementStack.top()->addElement(*ptr)) - { - string err = "Don't know how to add " + ptr->type() + " to " - + itsElementStack.top()->type(); - - throw EXCEPTION(err.c_str()); - } - } - else - { - // apparently, the stack has become empty, which - // basically means that we've seen the end of - // our root element! So let's stop parsing! - doneRootElement = true; - } - } -} - - -// -// If we start a new document, presumable we -// haven't done the root element yet, have we? :) -// -void SAXHandler::startDocument() -{ - doneRootElement = false; -} - - -void SAXHandler::startElement(const XMLCh *const uri, - const XMLCh *const localname, - const XMLCh *const qname, - const Attributes &attrs) -{ - // if doneRootElement==true, we have done our stuff and there's - // really no need in actually wasting more CPU cycles. - // so let's bail out before we do anything else! - if( doneRootElement ) - { - return; - } - - // if the stack.size()==0 we haven't started the rootelement yet. - // we can save time by checking if the name of this element - // matches the rootelementname (if specified). If it doesn't, - // we can bail out immediately! - SAXString elemname( localname ); - - if( itsElementStack.size()==0 && - itsRootElementName.size()!=0 && - itsRootElementName!=elemname ) - { - //cout << "Start element: skipping non-root-element " << elemname << endl; - return; - } - - // See if we know what to do with this element. - creatormap_t::iterator it = itsCreatorMap.find(elemname); - - // Hmm, obviously we don't - if (it == itsCreatorMap.end()) - { - // If element stack is not empty, we *should* know what to do with - // this element. The programmer probably forgot to add it to the - // creator map. Remind him/her subtly ;-) - if (!itsElementStack.empty()) - { - string err = "Don't know how to create " + SAXString(localname); - throw EXCEPTION(err.c_str()); - } - return; - } - - // OK, so we do know what to do with this element. - else - { - // Put all attributes in a (type,value) map. - attributemap_t attribMap; - for(unsigned i = 0; i < attrs.getLength(); ++i) - { - pair<string,string> aPair(SAXString(attrs.getLocalName(i)), - SAXString(attrs.getValue(i))); - attribMap.insert(aPair); - } - // Call the creator method (which is the value field in itsCreatorMap) - // and store the returned SAXElement*. - CountedPointer<SAXElement> ptr(it->second(attribMap)); - - // If element stack is empty, we must save a copy in itsElementTree, - // because from now on we're building up the element tree. - if( itsElementStack.empty() ) - { - itsElementTree = ptr; - } - // Place the stored SAXElement* onto the element stack. - itsElementStack.push(ptr); - } - - return; -} - - -//#---------------------------------------------------------------------------- -//# Implementation of the SAX ErrorHandler interface -//#---------------------------------------------------------------------------- - -void SAXHandler::error(const SAXParseException& e) -{ - itsErrorFlag = true; - cerr << "\nSAXHandler: " - << "Error at file " << e.getSystemId() - << ", line " << e.getLineNumber() - << ", char " << e.getColumnNumber() - << "\n Message: " << e.getMessage() << endl; -} - - -void SAXHandler::fatalError(const SAXParseException& e) -{ - itsErrorFlag = true; - cerr << "\nSAXHandler: " - << "Fatal Error at file " << e.getSystemId() - << ", line " << e.getLineNumber() - << ", char " << e.getColumnNumber() - << "\n Message: " << e.getMessage() << endl; - throw e; -} - - -void SAXHandler::warning(const SAXParseException& e) -{ - cerr << "\nSAXHandler: " - << "Warning at file " << e.getSystemId() - << ", line " << e.getLineNumber() - << ", char " << e.getColumnNumber() - << "\n Message: " << e.getMessage() << endl; -} - - -void SAXHandler::resetErrors() -{ - itsErrorFlag = false; -} - - -bool SAXHandler::sawErrors() -{ - return itsErrorFlag; -} - - -CountedPointer<SAXElement> SAXHandler::getElementTree() -{ - return itsElementTree; -} diff --git a/MAC/GCF/_CoreComps/PA/test/xml/GPA_SAXHandler.h b/MAC/GCF/_CoreComps/PA/test/xml/GPA_SAXHandler.h deleted file mode 100644 index b663653a71be98495f3cc2018f3cb10295b3fd4c..0000000000000000000000000000000000000000 --- a/MAC/GCF/_CoreComps/PA/test/xml/GPA_SAXHandler.h +++ /dev/null @@ -1,141 +0,0 @@ -//# GPA_SAXHandler.h: -//# -//# Copyright (C) 2002-2003 -//# ASTRON (Netherlands Foundation for Research in Astronomy) -//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl -//# -//# This program is free software; you can redistribute it and/or modify -//# it under the terms of the GNU General Public License as published by -//# the Free Software Foundation; either version 2 of the License, or -//# (at your option) any later version. -//# -//# This program is distributed in the hope that it will be useful, -//# but WITHOUT ANY WARRANTY; without even the implied warranty of -//# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -//# GNU General Public License for more details. -//# -//# You should have received a copy of the GNU General Public License -//# along with this program; if not, write to the Free Software -//# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -//# -//# $Id$ - -#ifndef GPA_SAXHANDLER_H -#define GPA_SAXHANDLER_H - -#include <xercesc/sax2/DefaultHandler.hpp> -#include <xercesc/sax/SAXParseException.hpp> - -#include <Common/lofar_vector.h> -#include <Common/lofar_string.h> - -//class VecAttributesImpl; - -// This class provides the proper overloaded methods for handling the PCInt -// XML configuration files. It implements the SAX ContentHandler interface -// and the SAX ErrorHandler interface. -class SAXHandler : public DefaultHandler -{ -public: - // ----------------------------------------------------------------------- - // Constructors - // ----------------------------------------------------------------------- - SAXHandler(); - - virtual ~SAXHandler(); - - - // ----------------------------------------------------------------------- - // Implementations of the SAX DocumentHandler interface - // ----------------------------------------------------------------------- - virtual void endDocument(); - - virtual void endElement (const XMLCh* const uri, - const XMLCh* const localname, - const XMLCh* const qname); - - virtual void startDocument(); - - virtual void startElement (const XMLCh* const uri, - const XMLCh* const localname, - const XMLCh* const qname, - const Attributes& attributes); - - // ----------------------------------------------------------------------- - // Implementations of the SAX ErrorHandler interface - // ----------------------------------------------------------------------- - - virtual void warning (const SAXParseException &exception); - - virtual void error (const SAXParseException &exception); - - virtual void fatalError (const SAXParseException &exception); - - virtual void resetErrors(); - -private: - - void handleRoot (const Attributes& attributes, bool start); - - void handleSimul (const Attributes& attributes, bool start); - - void handleStep (const Attributes& attributes, bool start); - - void handleWorkHolder (const Attributes& attributes, bool start); - - void handleDataHolder (const Attributes& attributes, bool start); - - void handleConnect (const Attributes& attributes, bool start); - - void handleExStep (const Attributes& attributes, bool start); - - // ----------------------------------------------------------------------- - // Function to make a copy of an Attributes. Use this function until - // Apache XML parser for C++ implements some clone() function in the - // abstract Attributes class, or it implements some other convenient - // method for copying an Attributes object - // ----------------------------------------------------------------------- -// VecAttributesImpl* copyAttributes(const Attributes &att); - - bool itsActiveFlag; - string itsFocusSimul; // for partial parsing - bool itsRootSimulWasSet; - const XMLCh* itsContainerType; -// stack<VecAttributesImpl*> itsAttStack; - vector<string> itsInDHVector; - vector<string> itsOutDHVector; -}; - - -// --------------------------------------------------------------------------- -// This is a simple class that lets us do easy (though not terribly efficient) -// transcoding of XMLCh data to local code page for display. -// --------------------------------------------------------------------------- -class SAXLocalStr -{ -public: - - // ----------------------------------------------------------------------- - // Constructors and Destructor - // ----------------------------------------------------------------------- - SAXLocalStr (const XMLCh* const toTranscode) - { if (toTranscode) { - char* flocal = XMLString::transcode(toTranscode); - itsLocalForm = flocal; - delete [] flocal; - } - } - - const string& localForm() const - { return itsLocalForm; } - -private: - string itsLocalForm; -}; - -inline ostream& operator<<(ostream& target, const SAXLocalStr& toDump) -{ - target << toDump.localForm(); - return target; -} -#endif diff --git a/MAC/GCF/_CoreComps/PA/test/xml/SAX2Handler.cc b/MAC/GCF/_CoreComps/PA/test/xml/SAX2Handler.cc deleted file mode 100644 index b0201176f159f9b35e9e9e59b4c83de4272e3bf5..0000000000000000000000000000000000000000 --- a/MAC/GCF/_CoreComps/PA/test/xml/SAX2Handler.cc +++ /dev/null @@ -1,319 +0,0 @@ -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 1999-2001 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, - * if any, must include the following acknowledgment: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowledgment may appear in the software itself, - * if and wherever such third-party acknowledgments normally appear. - * - * 4. The names "Xerces" and "Apache Software Foundation" must - * not be used to endorse or promote products derived from this - * software without prior written permission. For written - * permission, please contact apache\@apache.org. - * - * 5. Products derived from this software may not be called "Apache", - * nor may "Apache" appear in their name, without prior written - * permission of the Apache Software Foundation. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation, and was - * originally based on software copyright (c) 1999, International - * Business Machines, Inc., http://www.ibm.com . For more information - * on the Apache Software Foundation, please see - * <http://www.apache.org/>. - */ - -/* - * $Log$ - * Revision 1.8 2003/03/17 21:03:52 peiyongz - * Bug#17983 - * - * Revision 1.7 2002/05/28 20:24:15 tng - * XMLUni::fgEmptyString which is defined as "EMPTY" is incorrectly used as an empty string, should use XMLUni::fgZeroLenString instead - * - * Revision 1.6 2002/02/01 22:40:44 peiyongz - * sane_include - * - * Revision 1.5 2001/05/11 13:24:57 tng - * Copyright update. - * - * Revision 1.4 2001/05/03 16:00:03 tng - * Schema: samples update with schema - * - * Revision 1.3 2000/10/10 23:55:53 andyh - * XMLFormatter patch, contributed by Bill Schindler. Fix problems with - * output to multi-byte encodings. - * - * Revision 1.2 2000/08/09 22:20:38 jpolast - * updates for changes to sax2 core functionality. - * - * Revision 1.1 2000/08/02 19:16:14 jpolast - * initial checkin of SAX2Print - * - * - */ - - - -// --------------------------------------------------------------------------- -// Includes -// --------------------------------------------------------------------------- -#include <xercesc/util/XMLUniDefs.hpp> -#include <xercesc/sax2/Attributes.hpp> -#include "SAX2Handler.h" - - -// --------------------------------------------------------------------------- -// Local const data -// -// Note: This is the 'safe' way to do these strings. If you compiler supports -// L"" style strings, and portability is not a concern, you can use -// those types constants directly. -// --------------------------------------------------------------------------- -static const XMLCh gEndElement[] = { chOpenAngle, chForwardSlash, chNull }; -static const XMLCh gEndPI[] = { chQuestion, chCloseAngle, chNull }; -static const XMLCh gStartPI[] = { chOpenAngle, chQuestion, chNull }; -static const XMLCh gXMLDecl1[] = -{ - chOpenAngle, chQuestion, chLatin_x, chLatin_m, chLatin_l - , chSpace, chLatin_v, chLatin_e, chLatin_r, chLatin_s, chLatin_i - , chLatin_o, chLatin_n, chEqual, chDoubleQuote, chDigit_1, chPeriod - , chDigit_0, chDoubleQuote, chSpace, chLatin_e, chLatin_n, chLatin_c - , chLatin_o, chLatin_d, chLatin_i, chLatin_n, chLatin_g, chEqual - , chDoubleQuote, chNull -}; - -static const XMLCh gXMLDecl2[] = -{ - chDoubleQuote, chQuestion, chCloseAngle - , chLF, chNull -}; - - -// --------------------------------------------------------------------------- -// SAX2Handler: Constructors and Destructor -// --------------------------------------------------------------------------- -SAX2Handler::SAX2Handler( const char* const encodingName - , const XMLFormatter::UnRepFlags unRepFlags - , const bool expandNamespaces) : - - fFormatter - ( - encodingName - , 0 - , this - , XMLFormatter::NoEscapes - , unRepFlags - ), - fExpandNS ( expandNamespaces ) -{ - // - // Go ahead and output an XML Decl with our known encoding. This - // is not the best answer, but its the best we can do until we - // have SAX2 support. - // - fFormatter << gXMLDecl1 << fFormatter.getEncodingName() << gXMLDecl2; -} - -SAX2Handler::~SAX2Handler() -{ -} - - -// --------------------------------------------------------------------------- -// SAX2Handler: Overrides of the output formatter target interface -// --------------------------------------------------------------------------- -void SAX2Handler::writeChars(const XMLByte* const toWrite) -{ -} - -void SAX2Handler::writeChars(const XMLByte* const toWrite, - const unsigned int count, - XMLFormatter* const formatter) -{ - // For this one, just dump them to the standard output - // Surprisingly, Solaris was the only platform on which - // required the char* cast to print out the string correctly. - // Without the cast, it was printing the pointer value in hex. - // Quite annoying, considering every other platform printed - // the string with the explicit cast to char* below. - cout.write((char *) toWrite, (int) count); - cout.flush(); -} - - -// --------------------------------------------------------------------------- -// SAX2Handler: Overrides of the SAX ErrorHandler interface -// --------------------------------------------------------------------------- -void SAX2Handler::error(const SAXParseException& e) -{ - cerr << "\nError at file " << StrX(e.getSystemId()) - << ", line " << e.getLineNumber() - << ", char " << e.getColumnNumber() - << "\n Message: " << StrX(e.getMessage()) << endl; -} - -void SAX2Handler::fatalError(const SAXParseException& e) -{ - cerr << "\nFatal Error at file " << StrX(e.getSystemId()) - << ", line " << e.getLineNumber() - << ", char " << e.getColumnNumber() - << "\n Message: " << StrX(e.getMessage()) << endl; -} - -void SAX2Handler::warning(const SAXParseException& e) -{ - cerr << "\nWarning at file " << StrX(e.getSystemId()) - << ", line " << e.getLineNumber() - << ", char " << e.getColumnNumber() - << "\n Message: " << StrX(e.getMessage()) << endl; -} - - -// --------------------------------------------------------------------------- -// SAX2Handler: Overrides of the SAX DTDHandler interface -// --------------------------------------------------------------------------- -void SAX2Handler::unparsedEntityDecl(const XMLCh* const name - , const XMLCh* const publicId - , const XMLCh* const systemId - , const XMLCh* const notationName) -{ - // Not used at this time -} - - -void SAX2Handler::notationDecl(const XMLCh* const name - , const XMLCh* const publicId - , const XMLCh* const systemId) -{ - // Not used at this time -} - - -// --------------------------------------------------------------------------- -// SAX2Handler: Overrides of the SAX DocumentHandler interface -// --------------------------------------------------------------------------- -void SAX2Handler::characters(const XMLCh* const chars - , const unsigned int length) -{ - fFormatter.formatBuf(chars, length, XMLFormatter::CharEscapes); -} - - -void SAX2Handler::endDocument() -{ -} - - -void SAX2Handler::endElement(const XMLCh* const uri, - const XMLCh* const localname, - const XMLCh* const qname) -{ - // No escapes are legal here - fFormatter << XMLFormatter::NoEscapes << gEndElement ; - if ( fExpandNS ) - { - if (XMLString::compareIString(uri,XMLUni::fgZeroLenString) != 0) - fFormatter << uri << chColon; - fFormatter << localname << chCloseAngle; - } - else - fFormatter << qname << chCloseAngle; -} - - -void SAX2Handler::ignorableWhitespace( const XMLCh* const chars - ,const unsigned int length) -{ - fFormatter.formatBuf(chars, length, XMLFormatter::NoEscapes); -} - - -void SAX2Handler::processingInstruction(const XMLCh* const target - , const XMLCh* const data) -{ - fFormatter << XMLFormatter::NoEscapes << gStartPI << target; - if (data) - fFormatter << chSpace << data; - fFormatter << XMLFormatter::NoEscapes << gEndPI; -} - - -void SAX2Handler::startDocument() -{ -} - - -void SAX2Handler::startElement(const XMLCh* const uri, - const XMLCh* const localname, - const XMLCh* const qname, - const Attributes& attributes) -{ - // The name has to be representable without any escapes - fFormatter << XMLFormatter::NoEscapes << chOpenAngle ; - if ( fExpandNS ) - { - if (XMLString::compareIString(uri,XMLUni::fgZeroLenString) != 0) - fFormatter << uri << chColon; - fFormatter << localname ; - } - else - fFormatter << qname ; - - unsigned int len = attributes.getLength(); - for (unsigned int index = 0; index < len; index++) - { - // - // Again the name has to be completely representable. But the - // attribute can have refs and requires the attribute style - // escaping. - // - fFormatter << XMLFormatter::NoEscapes << chSpace ; - if ( fExpandNS ) - { - if (XMLString::compareIString(attributes.getURI(index),XMLUni::fgZeroLenString) != 0) - fFormatter << attributes.getURI(index) << chColon; - fFormatter << attributes.getLocalName(index) ; - } - else - fFormatter << attributes.getQName(index) ; - - fFormatter << chEqual << chDoubleQuote - << XMLFormatter::AttrEscapes - << attributes.getValue(index) - << XMLFormatter::NoEscapes - << chDoubleQuote; - } - fFormatter << chCloseAngle; -} diff --git a/MAC/GCF/_CoreComps/PA/test/xml/SAX2Handler.h b/MAC/GCF/_CoreComps/PA/test/xml/SAX2Handler.h deleted file mode 100644 index 7486024c42fa34c5f7bac1e0914a0c4ca2eb3bda..0000000000000000000000000000000000000000 --- a/MAC/GCF/_CoreComps/PA/test/xml/SAX2Handler.h +++ /dev/null @@ -1,233 +0,0 @@ -/* - * The Apache Software License, Version 1.1 - * - * Copyright (c) 1999-2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, - * if any, must include the following acknowledgment: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowledgment may appear in the software itself, - * if and wherever such third-party acknowledgments normally appear. - * - * 4. The names "Xerces" and "Apache Software Foundation" must - * not be used to endorse or promote products derived from this - * software without prior written permission. For written - * permission, please contact apache\@apache.org. - * - * 5. Products derived from this software may not be called "Apache", - * nor may "Apache" appear in their name, without prior written - * permission of the Apache Software Foundation. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation, and was - * originally based on software copyright (c) 1999, International - * Business Machines, Inc., http://www.ibm.com . For more information - * on the Apache Software Foundation, please see - * <http://www.apache.org/>. - */ - -/* - * $Log$ - * Revision 1.5 2002/11/05 21:46:20 tng - * Explicit code using namespace in application. - * - * Revision 1.4 2002/02/01 22:40:44 peiyongz - * sane_include - * - * Revision 1.3 2000/10/10 23:55:55 andyh - * XMLFormatter patch, contributed by Bill Schindler. Fix problems with - * output to multi-byte encodings. - * - * Revision 1.2 2000/08/09 22:20:39 jpolast - * updates for changes to sax2 core functionality. - * - * Revision 1.1 2000/08/02 19:16:14 jpolast - * initial checkin of SAX2Print - * - * - */ -#ifndef SAX2HANDLER_H -#define SAX2HANDLER_H -#include <iostream.h> -#include <xercesc/sax2/DefaultHandler.hpp> -#include <xercesc/framework/XMLFormatter.hpp> - -XERCES_CPP_NAMESPACE_USE - -class SAX2Handler : public DefaultHandler, private XMLFormatTarget -{ -public: - // ----------------------------------------------------------------------- - // Constructors - // ----------------------------------------------------------------------- - SAX2Handler - ( - const char* const encodingName - , const XMLFormatter::UnRepFlags unRepFlags - , const bool expandNamespaces - ); - ~SAX2Handler(); - - - // ----------------------------------------------------------------------- - // Implementations of the format target interface - // ----------------------------------------------------------------------- - void writeChars - ( - const XMLByte* const toWrite - ); - - void writeChars - ( - const XMLByte* const toWrite - , const unsigned int count - , XMLFormatter* const formatter - ); - - - // ----------------------------------------------------------------------- - // Implementations of the SAX DocumentHandler interface - // ----------------------------------------------------------------------- - void endDocument(); - - void endElement( const XMLCh* const uri, - const XMLCh* const localname, - const XMLCh* const qname); - - void characters(const XMLCh* const chars, const unsigned int length); - - void ignorableWhitespace - ( - const XMLCh* const chars - , const unsigned int length - ); - - void processingInstruction - ( - const XMLCh* const target - , const XMLCh* const data - ); - - void startDocument(); - - void startElement( const XMLCh* const uri, - const XMLCh* const localname, - const XMLCh* const qname, - const Attributes& attributes); - - - - // ----------------------------------------------------------------------- - // Implementations of the SAX ErrorHandler interface - // ----------------------------------------------------------------------- - void warning(const SAXParseException& exception); - void error(const SAXParseException& exception); - void fatalError(const SAXParseException& exception); - - - - // ----------------------------------------------------------------------- - // Implementation of the SAX DTDHandler interface - // ----------------------------------------------------------------------- - void notationDecl - ( - const XMLCh* const name - , const XMLCh* const publicId - , const XMLCh* const systemId - ); - - void unparsedEntityDecl - ( - const XMLCh* const name - , const XMLCh* const publicId - , const XMLCh* const systemId - , const XMLCh* const notationName - ); - -private : - // ----------------------------------------------------------------------- - // Private data members - // - // fFormatter - // This is the formatter object that is used to output the data - // to the target. It is set up to format to the standard output - // stream. - // ----------------------------------------------------------------------- - XMLFormatter fFormatter; - bool fExpandNS ; -}; - -// --------------------------------------------------------------------------- -// This is a simple class that lets us do easy (though not terribly efficient) -// trancoding of XMLCh data to local code page for display. -// --------------------------------------------------------------------------- -class StrX -{ -public : - // ----------------------------------------------------------------------- - // Constructors and Destructor - // ----------------------------------------------------------------------- - StrX(const XMLCh* const toTranscode) - { - // Call the private transcoding method - fLocalForm = XMLString::transcode(toTranscode); - } - - ~StrX() - { - XMLString::release(&fLocalForm); - } - - // ----------------------------------------------------------------------- - // Getter methods - // ----------------------------------------------------------------------- - const char* localForm() const - { - return fLocalForm; - } - -private : - // ----------------------------------------------------------------------- - // Private data members - // - // fLocalForm - // This is the local code page form of the string. - // ----------------------------------------------------------------------- - char* fLocalForm; -}; - -inline ostream& operator<<(ostream& target, const StrX& toDump) -{ - target << toDump.localForm(); - return target; -} - -#endif diff --git a/MAC/GCF/_CoreComps/PML/src/GCF_PropertyProxy.h b/MAC/GCF/_CoreComps/PML/src/GCF_PropertyProxy.h deleted file mode 100644 index 66c2f391f79434fab1def97ede4dd8c840d24da5..0000000000000000000000000000000000000000 --- a/MAC/GCF/_CoreComps/PML/src/GCF_PropertyProxy.h +++ /dev/null @@ -1,79 +0,0 @@ -//# GCF_PropertyProxy.h: abstract class provides the possibility to -//# (un)subscribe from/on, set or get property (values) -//# in the SCADA DB and handle their responses. -//# -//# Copyright (C) 2002-2003 -//# ASTRON (Netherlands Foundation for Research in Astronomy) -//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl -//# -//# This program is free software; you can redistribute it and/or modify -//# it under the terms of the GNU General Public License as published by -//# the Free Software Foundation; either version 2 of the License, or -//# (at your option) any later version. -//# -//# This program is distributed in the hope that it will be useful, -//# but WITHOUT ANY WARRANTY; without even the implied warranty of -//# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -//# GNU General Public License for more details. -//# -//# You should have received a copy of the GNU General Public License -//# along with this program; if not, write to the Free Software -//# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -//# -//# $Id$ - -#ifndef GCF_PROPERTYPROXY_H -#define GCF_PROPERTYPROXY_H - -#include <lofar_config.h> -#ifdef HAVE_LOFAR_PML -#include <GCFCommon/GCF_Defines.h> -#else -#include <GCF_Defines.h> -#endif - -/** - This abstract class provides the possibility to (un)subscribe from/on, set or - get property (values) in the SCADA DB and handle their responses. Opposite to - classes based on the GCFPropertyBase class this class has no knowledge about - the property itself but only which actions on properties are possible. So it - could happen that APL can perform multiple subscriptions on a certain property - by means of the same proxy. Then multiple value-changed indications on one - value change in the SCADA DB will be received. In most of the cases this is - not wanted. Always use this class with cautions. -*/ -class GPMPropertyProxy; -class GCFPValue; - -class GCFPropertyProxy -{ - public: - GCFPropertyProxy (); - virtual ~GCFPropertyProxy (); - - TGCFResult subscribe (const string& propName); - TGCFResult unsubscribe (const string& propName); - TGCFResult get (const string& propName); - TGCFResult set (const string& propName, - const GCFPValue& value); - bool exists (const string& propName); - - protected: - friend class GPMPropertyProxy; - virtual void propSubscribed (const string& propName) = 0; - virtual void propUnsubscribed (const string& propName) = 0; - virtual void propValueGet (const string& propName, - const GCFPValue& value) = 0; - virtual void propValueChanged (const string& propName, - const GCFPValue& value) = 0; - - private: - /** - * Don't allow copying this object. - */ - GCFPropertyProxy (const GCFPropertyProxy&); - GCFPropertyProxy& operator= (const GCFPropertyProxy&); - - GPMPropertyProxy* _pPMProxy; -}; -#endif diff --git a/MAC/GCF/_CoreComps/PML/src/GCF_SupTask.cc b/MAC/GCF/_CoreComps/PML/src/GCF_SupTask.cc deleted file mode 100644 index 401fc37d698718798beb28a2d0eaca983bc5a542..0000000000000000000000000000000000000000 --- a/MAC/GCF/_CoreComps/PML/src/GCF_SupTask.cc +++ /dev/null @@ -1,98 +0,0 @@ -//# GCF_SupTask.cc: -//# -//# Copyright (C) 2002-2003 -//# ASTRON (Netherlands Foundation for Research in Astronomy) -//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl -//# -//# This program is free software; you can redistribute it and/or modify -//# it under the terms of the GNU General Public License as published by -//# the Free Software Foundation; either version 2 of the License, or -//# (at your option) any later version. -//# -//# This program is distributed in the hope that it will be useful, -//# but WITHOUT ANY WARRANTY; without even the implied warranty of -//# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -//# GNU General Public License for more details. -//# -//# You should have received a copy of the GNU General Public License -//# along with this program; if not, write to the Free Software -//# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -//# -//# $Id$ - -#include "GCF_SupTask.h" -#include "GPM_Controller.h" - -GCFSupervisedTask::GCFSupervisedTask(State initial, string& name) : - GCFTask(initial, name) -{ - _pController = new GPMController(*this); - _pController->start(); -} - -GCFSupervisedTask::~GCFSupervisedTask() -{ - delete _pController; - _pController = 0; -} - -TGCFResult GCFSupervisedTask::loadAPC(const string apcName, - const string scope) -{ - return (_pController->loadAPC(apcName, scope) == PM_NO_ERROR ? - GCF_NO_ERROR : - GCF_PML_ERROR); -} - -TGCFResult GCFSupervisedTask::unloadAPC(const string apcName, - const string scope) -{ - return (_pController->unloadAPC(apcName, scope) == PM_NO_ERROR ? - GCF_NO_ERROR : - GCF_PML_ERROR); -} - -TGCFResult GCFSupervisedTask::reloadAPC(const string apcName, - const string scope) -{ - return (_pController->reloadAPC(apcName, scope) == PM_NO_ERROR ? - GCF_NO_ERROR : - GCF_PML_ERROR); -} - -TGCFResult GCFSupervisedTask::loadMyProperties(const TPropertySet& newSet) -{ - return (_pController->loadMyProperties(newSet) == PM_NO_ERROR ? - GCF_NO_ERROR : - GCF_PML_ERROR); -} - -TGCFResult GCFSupervisedTask::unloadMyProperties(const string scope) -{ - return (_pController->unloadMyProperties(scope) == PM_NO_ERROR ? - GCF_NO_ERROR : - GCF_PML_ERROR); -} - -TGCFResult GCFSupervisedTask::set(const string propName, - const GCFPValue& value) -{ - return (_pController->set(propName, value) == PM_NO_ERROR ? - GCF_NO_ERROR : - GCF_PML_ERROR); -} - -TGCFResult GCFSupervisedTask::get(const string propName) -{ - return (_pController->get(propName) == PM_NO_ERROR ? - GCF_NO_ERROR : - GCF_PML_ERROR); -} - -TGCFResult GCFSupervisedTask::getMyOldValue(const string propName, GCFPValue** pValue) -{ - return (_pController->getMyOldValue(propName, pValue) == PM_NO_ERROR ? - GCF_NO_ERROR : - GCF_PML_ERROR); -} - diff --git a/MAC/GCF/_CoreComps/PML/src/GCF_SupTask.h b/MAC/GCF/_CoreComps/PML/src/GCF_SupTask.h deleted file mode 100644 index f985ebf321842ac6b26aa1aa9eeaad01b44968c0..0000000000000000000000000000000000000000 --- a/MAC/GCF/_CoreComps/PML/src/GCF_SupTask.h +++ /dev/null @@ -1,69 +0,0 @@ -//# GCF_SupTask.h: -//# -//# Copyright (C) 2002-2003 -//# ASTRON (Netherlands Foundation for Research in Astronomy) -//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl -//# -//# This program is free software; you can redistribute it and/or modify -//# it under the terms of the GNU General Public License as published by -//# the Free Software Foundation; either version 2 of the License, or -//# (at your option) any later version. -//# -//# This program is distributed in the hope that it will be useful, -//# but WITHOUT ANY WARRANTY; without even the implied warranty of -//# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -//# GNU General Public License for more details. -//# -//# You should have received a copy of the GNU General Public License -//# along with this program; if not, write to the Free Software -//# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -//# -//# $Id$ - -#ifndef GCF_SUBTASK_H -#define GCF_SUBTASK_H - -#include <lofar_config.h> -#ifdef HAVE_LOFAR_PML -#include <TM/GCF_Task.h> -#include <SAL/GCF_PValue.h> -#include <GCFCommon/GCF_Defines.h> -#else -#include <GCF_Task.h> -#include <GCF_PValue.h> -#include <GCF_Defines.h> -#endif - - -class GPMController; - -class GCFSupervisedTask : public GCFTask -{ - public: - virtual ~GCFSupervisedTask(); - - TGCFResult loadAPC(const string apcName, const string scope); - TGCFResult unloadAPC(const string apcName, const string scope); - TGCFResult reloadAPC(const string apcName, const string scope); - TGCFResult loadMyProperties(const TPropertySet& newSet); - TGCFResult unloadMyProperties(const string scope); - TGCFResult set(const string propName, const GCFPValue& value); - TGCFResult get(const string propName); - TGCFResult getMyOldValue(const string propName, GCFPValue** pValue); - - protected: - GCFSupervisedTask(State initial, string& name); - - friend class GPMController; - virtual void valueChanged(const string& propName, const GCFPValue& value) = 0; - virtual void valueGet(const string& propName, const GCFPValue& value) = 0; - virtual void apcLoaded(const string& apcName, const string& scope, TGCFResult result) = 0; - virtual void apcUnloaded(const string& apcName, const string& scope, TGCFResult result) = 0; - virtual void apcReloaded(const string& apcName, const string& scope, TGCFResult result) = 0; - virtual void myPropertiesLoaded(const string& scope, TGCFResult result) = 0; - virtual void myPropertiesUnloaded(const string& scope, TGCFResult result) = 0; - - private: - GPMController* _pController; -}; -#endif diff --git a/MAC/GCF/_CoreComps/PML/src/GPM_Property.cc b/MAC/GCF/_CoreComps/PML/src/GPM_Property.cc deleted file mode 100644 index 568feb83b3c23fa86701aa51356cb4c5e333da71..0000000000000000000000000000000000000000 --- a/MAC/GCF/_CoreComps/PML/src/GPM_Property.cc +++ /dev/null @@ -1,127 +0,0 @@ -//# GPM_Property.cc: -//# -//# Copyright (C) 2002-2003 -//# ASTRON (Netherlands Foundation for Research in Astronomy) -//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl -//# -//# This program is free software; you can redistribute it and/or modify -//# it under the terms of the GNU General Public License as published by -//# the Free Software Foundation; either version 2 of the License, or -//# (at your option) any later version. -//# -//# This program is distributed in the hope that it will be useful, -//# but WITHOUT ANY WARRANTY; without even the implied warranty of -//# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -//# GNU General Public License for more details. -//# -//# You should have received a copy of the GNU General Public License -//# along with this program; if not, write to the Free Software -//# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -//# -//# $Id$ - -#include "GPM_Property.h" -#include <SAL/GCF_PValue.h> - -GPMProperty::GPMProperty(GCFPValue::TMACValueType type, string name) : - _isLinked(false), _name(name) -{ - _pCurValue = GCFPValue::createMACTypeObject(type); - assert(_pCurValue); - _pOldValue = _pCurValue->clone(); -} - -GPMProperty::GPMProperty(const TProperty& propertyFields) : - _isLinked(false) -{ - _name = propertyFields.propName; - _pCurValue = GCFPValue::createMACTypeObject((GCFPValue::TMACValueType) propertyFields.type); - assert(_pCurValue); - if (propertyFields.defaultValue) - { - _pCurValue->setValue(propertyFields.defaultValue); - } - _pOldValue = _pCurValue->clone(); - _accessMode = propertyFields.accessMode; -} - -GPMProperty::~GPMProperty() -{ - if (_pOldValue) - delete _pOldValue; - - if (_pCurValue) - delete _pCurValue; - - _pOldValue = 0; - _pCurValue = 0; -} - -TPMResult GPMProperty::setValue(const GCFPValue& value) -{ - TPMResult result(PM_NO_ERROR); - if (!_pOldValue || !_pCurValue) - result = PM_PROP_NOT_VALID; - else if (_pOldValue->copy(*_pCurValue) != GCF_NO_ERROR) - result = PM_PROP_WRONG_TYPE; - else if (_pCurValue->copy(value) != GCF_NO_ERROR) - result = PM_PROP_WRONG_TYPE; - - return result; -} - -TPMResult GPMProperty::getValue(GCFPValue& value, bool curValue) const -{ - TPMResult result(PM_NO_ERROR); - if (curValue && _pCurValue) - { - if (value.copy(*_pCurValue) != GCF_NO_ERROR) - result = PM_PROP_WRONG_TYPE; - } - else if (!curValue && _pOldValue) - { - if (value.copy(*_pOldValue) != GCF_NO_ERROR) - result = PM_PROP_WRONG_TYPE; - } - else - { - result = PM_PROP_NOT_VALID; - } - - return result; -} - -GCFPValue* GPMProperty::getValue(bool curValue) const -{ - if (curValue && _pCurValue) - return _pCurValue->clone(); - else if (!curValue && _pOldValue) - return _pOldValue->clone(); - else - return 0; -} - -TPMResult GPMProperty::setLink(bool linkSwitch) -{ - TPMResult result(PM_NO_ERROR); - - if (linkSwitch == _isLinked) - result = PM_PROP_LINK_NOT_IN_SYNC; - else - _isLinked = linkSwitch; - - return result; -} - -void GPMProperty::setAccessMode(TAccessMode mode, bool on) -{ - if (on) - _accessMode |= mode; - else - _accessMode &= ~mode; -} - -bool GPMProperty::testAccessMode(TAccessMode mode) const -{ - return (_accessMode & mode); -} diff --git a/MAC/GCF/_CoreComps/PML/src/GPM_Property.h b/MAC/GCF/_CoreComps/PML/src/GPM_Property.h deleted file mode 100644 index 0857b2358f4c2245c3f2a9349541477be2702035..0000000000000000000000000000000000000000 --- a/MAC/GCF/_CoreComps/PML/src/GPM_Property.h +++ /dev/null @@ -1,57 +0,0 @@ -//# GPM_Property.h: -//# -//# Copyright (C) 2002-2003 -//# ASTRON (Netherlands Foundation for Research in Astronomy) -//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl -//# -//# This program is free software; you can redistribute it and/or modify -//# it under the terms of the GNU General Public License as published by -//# the Free Software Foundation; either version 2 of the License, or -//# (at your option) any later version. -//# -//# This program is distributed in the hope that it will be useful, -//# but WITHOUT ANY WARRANTY; without even the implied warranty of -//# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -//# GNU General Public License for more details. -//# -//# You should have received a copy of the GNU General Public License -//# along with this program; if not, write to the Free Software -//# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -//# -//# $Id$ - -#ifndef GPM_PROPERTY_H -#define GPM_PROPERTY_H - -#include <SAL/GCF_PValue.h> -#include <GCFCommon/GCF_Defines.h> -#include "GPM_Defines.h" - -class GPMPropertySet; - -class GPMProperty -{ - public: - GPMProperty(GCFPValue::TMACValueType type, string name = ""); - GPMProperty(const TProperty& propertyFields); - ~GPMProperty(); - - private: - friend class GPMPropertySet; - TPMResult setValue(const GCFPValue& value); - TPMResult getValue(GCFPValue& value, bool curValue = true) const; - GCFPValue* getValue(bool curValue = true) const; - TPMResult setLink(bool link); - inline bool isLinked() const {return _isLinked;} - void setAccessMode(TAccessMode mode, bool on); - bool testAccessMode(TAccessMode mode) const; - inline const string& getName() const {return _name;} - - private: - TAccessMode _accessMode; - GCFPValue* _pCurValue; - GCFPValue* _pOldValue; - bool _isLinked; - string _name; -}; -#endif diff --git a/MAC/GCF/_CoreComps/PML/src/GPM_PropertyProxy.cc b/MAC/GCF/_CoreComps/PML/src/GPM_PropertyProxy.cc deleted file mode 100644 index 69f301247b7c2eec9d99fe9196cb3e5b89bc309e..0000000000000000000000000000000000000000 --- a/MAC/GCF/_CoreComps/PML/src/GPM_PropertyProxy.cc +++ /dev/null @@ -1,24 +0,0 @@ -//# GPM_PropertyProxy.cc: -//# -//# Copyright (C) 2002-2003 -//# ASTRON (Netherlands Foundation for Research in Astronomy) -//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl -//# -//# This program is free software; you can redistribute it and/or modify -//# it under the terms of the GNU General Public License as published by -//# the Free Software Foundation; either version 2 of the License, or -//# (at your option) any later version. -//# -//# This program is distributed in the hope that it will be useful, -//# but WITHOUT ANY WARRANTY; without even the implied warranty of -//# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -//# GNU General Public License for more details. -//# -//# You should have received a copy of the GNU General Public License -//# along with this program; if not, write to the Free Software -//# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -//# -//# $Id$ - -#include "GPM_PropertyProxy.h" - diff --git a/MAC/GCF/_CoreComps/PML/src/GPM_PropertyProxy.h b/MAC/GCF/_CoreComps/PML/src/GPM_PropertyProxy.h deleted file mode 100644 index 2dcec03ec446345fd1c360e7254b4154cbeec45d..0000000000000000000000000000000000000000 --- a/MAC/GCF/_CoreComps/PML/src/GPM_PropertyProxy.h +++ /dev/null @@ -1,82 +0,0 @@ -//# GPM_PropertyProxy.h: -//# -//# Copyright (C) 2002-2003 -//# ASTRON (Netherlands Foundation for Research in Astronomy) -//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl -//# -//# This program is free software; you can redistribute it and/or modify -//# it under the terms of the GNU General Public License as published by -//# the Free Software Foundation; either version 2 of the License, or -//# (at your option) any later version. -//# -//# This program is distributed in the hope that it will be useful, -//# but WITHOUT ANY WARRANTY; without even the implied warranty of -//# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -//# GNU General Public License for more details. -//# -//# You should have received a copy of the GNU General Public License -//# along with this program; if not, write to the Free Software -//# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -//# -//# $Id$ - -#ifndef GPM_PROPERTYPROXY_H -#define GPM_PROPERTYPROXY_H - -#include "GPM_Defines.h" -#include <SAL/GSA_Service.h> -#include "GCF_PropertyProxy.h" - -class GCFPropertyProxy; - -class GPMPropertyProxy : public GSAService -{ - public: - GPMPropertyProxy(GCFPropertyProxy& gcfProxy) : _gcfProxy(gcfProxy) {;} - virtual ~GPMPropertyProxy() {;} - - inline TSAResult subscribePM(const string& propName) - { - return GSAService::subscribe(propName); - } - inline TSAResult unsubscribePM(const string& propName) - { - return GSAService::unsubscribe(propName); - } - inline TSAResult getPM(const string& propName) - { - return GSAService::get(propName); - } - inline TSAResult setPM(const string& propName, const GCFPValue& value) - { - return GSAService::set(propName, value); - } - inline bool existsPM(const string& propName) - { - return GSAService::exists(propName); - } - - protected: - inline void propCreated(const string& /*propName*/) {}; - inline void propDeleted(const string& /*propName*/) {}; - inline void propSubscribed(const string& propName) - { - _gcfProxy.propSubscribed(propName); - } - inline void propUnsubscribed(const string& propName) - { - _gcfProxy.propUnsubscribed(propName); - } - inline void propValueGet(const string& propName, const GCFPValue& value) - { - _gcfProxy.propValueGet(propName, value); - } - inline void propValueChanged(const string& propName, const GCFPValue& value) - { - _gcfProxy.propValueChanged(propName, value); - } - - private: - GCFPropertyProxy& _gcfProxy; -}; -#endif diff --git a/MAC/GCF/_CoreComps/PML/src/GPM_PropertySet.cc b/MAC/GCF/_CoreComps/PML/src/GPM_PropertySet.cc deleted file mode 100644 index cbda70cd71eb8d7eef1beca957b1b911a0da478b..0000000000000000000000000000000000000000 --- a/MAC/GCF/_CoreComps/PML/src/GPM_PropertySet.cc +++ /dev/null @@ -1,257 +0,0 @@ -//# GPM_PropertySet.cc: -//# -//# Copyright (C) 2002-2003 -//# ASTRON (Netherlands Foundation for Research in Astronomy) -//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl -//# -//# This program is free software; you can redistribute it and/or modify -//# it under the terms of the GNU General Public License as published by -//# the Free Software Foundation; either version 2 of the License, or -//# (at your option) any later version. -//# -//# This program is distributed in the hope that it will be useful, -//# but WITHOUT ANY WARRANTY; without even the implied warranty of -//# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -//# GNU General Public License for more details. -//# -//# You should have received a copy of the GNU General Public License -//# along with this program; if not, write to the Free Software -//# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -//# -//# $Id$ - -#include "GPM_PropertySet.h" -#include "GPM_Property.h" -#include "GPM_Controller.h" - -GPMPropertySet::GPMPropertySet(GPMController& controller, const TPropertySet& propSet) : - _controller(controller), - _counter(0) -{ - GPMProperty* pProperty; - _scope = propSet.scope; - for (unsigned int i = 0; i < propSet.nrOfProperties; i++) - { - // TODO: should be checked, whether there are no double properties are created here - pProperty = new GPMProperty(propSet.properties[i]); - _properties[pProperty->getName()] = pProperty; - } -} - -GPMPropertySet::~GPMPropertySet() -{ - GPMProperty* pProperty; - for (TPropertyIter iter = _properties.begin(); - iter != _properties.end(); ++iter) - { - pProperty = iter->second; - assert(pProperty); - delete pProperty; - } -} - -void GPMPropertySet::propSubscribed(const string& propName) -{ - // TODO: Make this more secure (see linkProperties) - string shortPropName(propName); - cutScope(shortPropName); - _properties[shortPropName]->setLink(true); - //_tempLinkList.remove(shortPropName); - _counter--; - if (_counter == 0 && _tempLinkList.size() == 0) - { - _controller.propertiesLinked(_scope, _tempLinkList); - } -} - -void GPMPropertySet::propUnsubscribed(const string& propName) -{ - // TODO: Make this more secure (see unlinkProperties) - string shortPropName(propName); - cutScope(shortPropName); - _properties[shortPropName]->setLink(false); - _tempLinkList.remove(shortPropName); - _counter--; - if (_counter == 0) - { - _controller.propertiesUnlinked(_scope, _tempLinkList); - } -} - -void GPMPropertySet::propValueChanged(const string& propName, const GCFPValue& value) -{ - string shortPropName(propName); - - cutScope(shortPropName); - - GPMProperty* pProperty = _properties[shortPropName]; - assert(pProperty); - assert(pProperty->isLinked()); - - pProperty->setValue(value); - _controller.valueChanged(propName, value); -} - -void GPMPropertySet::retryLinking() -{ - if (_tempLinkList.size() > 0) - { - GPMProperty* pProperty; - string fullPropName; - TSAResult result(SA_NO_ERROR); - - list<string>::iterator iter = _tempLinkList.begin(); - - while (iter != _tempLinkList.end()) - { - pProperty = _properties[*iter]; - assert(pProperty); - assert(!pProperty->isLinked()); - //TODO: test the accessMode too - - GCFPValue* pValue = pProperty->getValue(true); // clone of the current value - assert(pValue); - fullPropName = _scope + "_" + *iter; - result = GSAService::set(fullPropName, *pValue); - - delete pValue; - - if (result == SA_NO_ERROR) - { - result = GSAService::subscribe(fullPropName); - - assert(result == SA_NO_ERROR); - _counter++; - iter = _tempLinkList.erase(iter); - } - else - break; - } - } -} - -void GPMPropertySet::linkProperties(unsigned int seqnr, list<string>& properties) -{ - _tempLinkList = properties; - _tempSeqnr = seqnr; - - assert(_counter == 0); - - retryLinking(); -} - -TPMResult GPMPropertySet::unlinkProperties(unsigned int seqnr, list<string>& properties) -{ - TPMResult result(PM_NO_ERROR); - GPMProperty* pProperty; - _tempLinkList = properties; - _tempSeqnr = seqnr; - - if (_counter > 0) - { - result = PM_PROP_SET_BUSY; - } - else - { - for (list<string>::iterator iter = properties.begin(); - iter != properties.end(); ++iter) - { - pProperty = _properties[*iter]; - assert(pProperty); - assert(pProperty->isLinked()); - result = (GSAService::unsubscribe(_scope + "_" + *iter) == SA_NO_ERROR ? - PM_NO_ERROR : - PM_SCADA_ERROR); - _counter++; - } - for (list<string>::iterator iter = properties.begin(); - iter != properties.end(); ++iter) - { - propUnsubscribed(_scope + "_" + *iter); - } - } - - return result; -} - -TPMResult GPMPropertySet::getValue(const string& propName, GCFPValue** pValue) -{ - TPMResult result(PM_NO_ERROR); - GPMProperty* pProperty; - string shortPropName = propName; - result = cutScope(shortPropName); - - assert(result == PM_NO_ERROR); - - if ((pProperty = _properties[shortPropName]) == 0) - { - result = PM_PROP_NOT_IN_SET; - } - else - { - *pValue = pProperty->getValue(); - } - - return result; -} - -TPMResult GPMPropertySet::setValue(const string& propName, const GCFPValue& value) -{ - TPMResult result(PM_NO_ERROR); - GPMProperty* pProperty; - string shortPropName = propName; - result = cutScope(shortPropName); - - assert(result == PM_NO_ERROR); - if ((pProperty = _properties[shortPropName]) == 0) - { - result = PM_PROP_NOT_IN_SET; - } - else if ((result = pProperty->setValue(value)) == PM_NO_ERROR) - { - if (pProperty->isLinked()) - result = (GSAService::set(propName, value) == SA_NO_ERROR ? - PM_NO_ERROR : PM_SCADA_ERROR); - } - - return result; -} - -TPMResult GPMPropertySet::getOldValue(const string& propName, GCFPValue** pValue) -{ - TPMResult result(PM_NO_ERROR); - GPMProperty* pProperty; - string shortPropName = propName; - - result = cutScope(shortPropName); - assert(result == PM_NO_ERROR); - - if ((pProperty = _properties[shortPropName]) == 0) - { - result = PM_PROP_NOT_IN_SET; - } - else - { - *pValue = pProperty->getValue(false); // false == oldValue - } - - return result; -} - -TPMResult GPMPropertySet::cutScope(string& propName) -{ - TPMResult result(PM_NO_ERROR); - - if (propName.find(_scope) == 0) - { - // plus 1 means erase the '_' after scope too - propName.erase(0, _scope.size() + 1); - } - else - { - result = PM_SCOPE_NOT_FOUND; - } - - return result; -} - diff --git a/MAC/GCF/_CoreComps/PML/src/GPM_PropertySet.h b/MAC/GCF/_CoreComps/PML/src/GPM_PropertySet.h deleted file mode 100644 index 17c5d6d4bdc369039cbd368f70e4c3e8291e7e1f..0000000000000000000000000000000000000000 --- a/MAC/GCF/_CoreComps/PML/src/GPM_PropertySet.h +++ /dev/null @@ -1,71 +0,0 @@ -//# GPM_PropertySet.h: -//# -//# Copyright (C) 2002-2003 -//# ASTRON (Netherlands Foundation for Research in Astronomy) -//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl -//# -//# This program is free software; you can redistribute it and/or modify -//# it under the terms of the GNU General Public License as published by -//# the Free Software Foundation; either version 2 of the License, or -//# (at your option) any later version. -//# -//# This program is distributed in the hope that it will be useful, -//# but WITHOUT ANY WARRANTY; without even the implied warranty of -//# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -//# GNU General Public License for more details. -//# -//# You should have received a copy of the GNU General Public License -//# along with this program; if not, write to the Free Software -//# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -//# -//# $Id$ - -#ifndef GPM_PROPERTYSET_H -#define GPM_PROPERTYSET_H - -#include <SAL/GSA_Service.h> -#include <GCFCommon/GCF_Defines.h> -#include "GPM_Defines.h" -#include <Common/lofar_map.h> -#include <Common/lofar_list.h> - -class GPMProperty; -class GPMController; - -class GPMPropertySet : public GSAService -{ - public: - GPMPropertySet(GPMController& controller, const TPropertySet& propSet); - ~GPMPropertySet(); - - protected: - void propCreated(const string& /*propName*/) {}; - void propDeleted(const string& /*propName*/) {}; - void propValueGet(const string& /*propName*/, const GCFPValue& /*value*/) {}; - void propSubscribed(const string& propName); - void propUnsubscribed(const string& propName); - void propValueChanged(const string& propName, const GCFPValue& value); - - private: // methods for GPMController - friend class GPMController; - void linkProperties(unsigned int seqnr, list<string>& properties); - TPMResult unlinkProperties(unsigned int seqnr, list<string>& properties); - TPMResult getValue(const string& propName, GCFPValue** pValue); - TPMResult setValue(const string& propName, const GCFPValue& value); - TPMResult getOldValue(const string& propName, GCFPValue** value); - inline const string& getScope() const {return _scope;} - void retryLinking(); - - private: // helper methods - TPMResult cutScope(string& propName); - - private: - map<string, GPMProperty*> _properties; - list<string> _tempLinkList; - unsigned int _tempSeqnr; - typedef map<string, GPMProperty*>::iterator TPropertyIter; - GPMController& _controller; - string _scope; - unsigned int _counter; -}; -#endif diff --git a/MAC/GCF/_CoreComps/PML/src/GPM_Service.cc b/MAC/GCF/_CoreComps/PML/src/GPM_Service.cc deleted file mode 100644 index d24e08efce5acc88ef4ffb84f63d4db95a743116..0000000000000000000000000000000000000000 --- a/MAC/GCF/_CoreComps/PML/src/GPM_Service.cc +++ /dev/null @@ -1,44 +0,0 @@ -//# GPM_Service.cc: -//# -//# Copyright (C) 2002-2003 -//# ASTRON (Netherlands Foundation for Research in Astronomy) -//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl -//# -//# This program is free software; you can redistribute it and/or modify -//# it under the terms of the GNU General Public License as published by -//# the Free Software Foundation; either version 2 of the License, or -//# (at your option) any later version. -//# -//# This program is distributed in the hope that it will be useful, -//# but WITHOUT ANY WARRANTY; without even the implied warranty of -//# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -//# GNU General Public License for more details. -//# -//# You should have received a copy of the GNU General Public License -//# along with this program; if not, write to the Free Software -//# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -//# -//# $Id$ - -#include "GPM_Service.h" -#include "GPM_Controller.h" - -TSAResult GPMService::get(const string& propName) -{ - return GSAService::get(propName); -} - -TSAResult GPMService::set(const string& propName, const GCFPValue& value) -{ - return GSAService::set(propName, value); -} - -bool GPMService::exists(const string& propName) -{ - return GSAService::exists(propName); -} - -void GPMService::propValueGet(const string& propName, const GCFPValue& value) -{ - _controller.valueGet(propName, value); -} diff --git a/MAC/GCF/_CoreComps/PML/src/GPM_Service.h b/MAC/GCF/_CoreComps/PML/src/GPM_Service.h deleted file mode 100644 index 393c5076700176ce762e5c17e9217ce9d0a641c4..0000000000000000000000000000000000000000 --- a/MAC/GCF/_CoreComps/PML/src/GPM_Service.h +++ /dev/null @@ -1,52 +0,0 @@ -//# GPM_Service.h: -//# -//# Copyright (C) 2002-2003 -//# ASTRON (Netherlands Foundation for Research in Astronomy) -//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl -//# -//# This program is free software; you can redistribute it and/or modify -//# it under the terms of the GNU General Public License as published by -//# the Free Software Foundation; either version 2 of the License, or -//# (at your option) any later version. -//# -//# This program is distributed in the hope that it will be useful, -//# but WITHOUT ANY WARRANTY; without even the implied warranty of -//# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -//# GNU General Public License for more details. -//# -//# You should have received a copy of the GNU General Public License -//# along with this program; if not, write to the Free Software -//# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -//# -//# $Id$ - -#ifndef GPM_SERVICE_H -#define GPM_SERVICE_H - -#include <SAL/GSA_Service.h> - -class GPMController; - -class GPMService : public GSAService -{ - public: - GPMService(GPMController& controller) : _controller(controller) {;} - virtual ~GPMService() {;} - - TSAResult get(const string& propName); - TSAResult set(const string& propName, const GCFPValue& value); - bool exists(const string& propName); - - protected: - inline void propCreated(const string& /*propName*/) {}; - inline void propDeleted(const string& /*propName*/) {}; - inline void propSubscribed(const string& /*propName*/) {}; - inline void propUnsubscribed(const string& /*propName*/) {}; - inline void propValueGet(const string& propName, const GCFPValue& value); - inline void propValueChanged(const string& /*propName*/, const GCFPValue& /*value*/) {}; - - private: - GPMController& _controller; -}; - -#endif diff --git a/MAC/GCF/_CoreComps/SAL/src/GCF_PVBool.h b/MAC/GCF/_CoreComps/SAL/src/GCF_PVBool.h deleted file mode 100644 index 31fca64efaf7753816c4be10da91122821747ae4..0000000000000000000000000000000000000000 --- a/MAC/GCF/_CoreComps/SAL/src/GCF_PVBool.h +++ /dev/null @@ -1,67 +0,0 @@ -//# GCF_PVBool.h: MAC boolean property type -//# -//# Copyright (C) 2002-2003 -//# ASTRON (Netherlands Foundation for Research in Astronomy) -//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl -//# -//# This program is free software; you can redistribute it and/or modify -//# it under the terms of the GNU General Public License as published by -//# the Free Software Foundation; either version 2 of the License, or -//# (at your option) any later version. -//# -//# This program is distributed in the hope that it will be useful, -//# but WITHOUT ANY WARRANTY; without even the implied warranty of -//# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -//# GNU General Public License for more details. -//# -//# You should have received a copy of the GNU General Public License -//# along with this program; if not, write to the Free Software -//# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -//# -//# $Id$ - -#ifndef GCF_PVBOOL_H -#define GCF_PVBOOL_H - -#include <lofar_config.h> -#ifdef HAVE_LOFAR_SAL -#include <SAL/GCF_PValue.h> -#else -#include <GCF_PValue.h> -#endif - -/** - By means of this property type a boolean (TRUE/FALSE or YES/NO) value can be - used. -*/ - -class GCFPVBool : public GCFPValue -{ - public: - GCFPVBool (bool val = false) : GCFPValue(LPT_BOOL), _value(val) {;} - virtual ~GCFPVBool () {;} - - /** Changes the value of this object */ - inline void setValue (const bool newVal) {_value = newVal;}; - - /** - * Changes the value of this object by means of a stringbuffer, - * which will be translated. - * @see GCFPValue::setValue(const string value) - */ - virtual TGCFResult setValue (const string value); - - /** Returns the value of this object*/ - inline bool getValue () const {return _value;}; - - /** @see GCFPValue::clone() */ - virtual GCFPValue* clone () const; - - /** @see GCFPValue::copy() */ - virtual TGCFResult copy (const GCFPValue& value); - - private: // Private attributes - /** The value */ - volatile bool _value; -}; -#endif diff --git a/MAC/GCF/_CoreComps/SAL/src/GCF_PVChar.h b/MAC/GCF/_CoreComps/SAL/src/GCF_PVChar.h deleted file mode 100644 index cc05269744782d943035c8ef6b5512f4ffd6e989..0000000000000000000000000000000000000000 --- a/MAC/GCF/_CoreComps/SAL/src/GCF_PVChar.h +++ /dev/null @@ -1,67 +0,0 @@ -//# GCF_PVChar.h: MAC char property type -//# -//# Copyright (C) 2002-2003 -//# ASTRON (Netherlands Foundation for Research in Astronomy) -//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl -//# -//# This program is free software; you can redistribute it and/or modify -//# it under the terms of the GNU General Public License as published by -//# the Free Software Foundation; either version 2 of the License, or -//# (at your option) any later version. -//# -//# This program is distributed in the hope that it will be useful, -//# but WITHOUT ANY WARRANTY; without even the implied warranty of -//# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -//# GNU General Public License for more details. -//# -//# You should have received a copy of the GNU General Public License -//# along with this program; if not, write to the Free Software -//# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -//# -//# $Id$ - -#ifndef GCF_PVCHAR_H -#define GCF_PVCHAR_H - -#include <lofar_config.h> -#ifdef HAVE_LOFAR_SAL -#include <SAL/GCF_PValue.h> -#else -#include <GCF_PValue.h> -#endif - -/** - By means of this property type a character (0...255) value can be used. -*/ - -class GCFPVChar : public GCFPValue -{ - public: - GCFPVChar (char val = 0) : GCFPValue(LPT_CHAR), _value(val) {;} - virtual ~GCFPVChar () {;} - - /** Changes the value of this object */ - inline void setValue (const char newVal) {_value = newVal;} - - /** - * Changes the value of this object by means of a stringbuffer, - * which will be translated. - * @see GCFPValue::setValue(const string value) - */ - virtual TGCFResult setValue (const string value); - - /** Returns the value of this object*/ - inline char getValue () const {return _value;} - - /** @see GCFPValue::clone() */ - virtual GCFPValue* clone () const; - - /** @see GCFPValue::copy() */ - virtual TGCFResult copy (const GCFPValue& value); - - private: // Private attributes - /** The value */ - char _value; -}; - -#endif diff --git a/MAC/GCF/_CoreComps/SAL/src/GCF_PVDouble.h b/MAC/GCF/_CoreComps/SAL/src/GCF_PVDouble.h deleted file mode 100644 index 3558d12bfb0c6d5966e7f6a0ca9e76571a4e8f40..0000000000000000000000000000000000000000 --- a/MAC/GCF/_CoreComps/SAL/src/GCF_PVDouble.h +++ /dev/null @@ -1,67 +0,0 @@ -//# GCF_PVDouble.h: MAC double property type -//# -//# Copyright (C) 2002-2003 -//# ASTRON (Netherlands Foundation for Research in Astronomy) -//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl -//# -//# This program is free software; you can redistribute it and/or modify -//# it under the terms of the GNU General Public License as published by -//# the Free Software Foundation; either version 2 of the License, or -//# (at your option) any later version. -//# -//# This program is distributed in the hope that it will be useful, -//# but WITHOUT ANY WARRANTY; without even the implied warranty of -//# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -//# GNU General Public License for more details. -//# -//# You should have received a copy of the GNU General Public License -//# along with this program; if not, write to the Free Software -//# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -//# -//# $Id$ - -#ifndef GCF_PVDOUBLE_H -#define GCF_PVDOUBLE_H - -#include <lofar_config.h> -#ifdef HAVE_LOFAR_SAL -#include <SAL/GCF_PValue.h> -#else -#include <GCF_PValue.h> -#endif - -/** - * By means of this property type a double value (-3.4*10^38 to 3.4*10^38) can - * be used. - */ - -class GCFPVDouble : public GCFPValue -{ - public: - GCFPVDouble (double val = 0.0) : GCFPValue(LPT_DOUBLE), _value(val) {;} - virtual ~GCFPVDouble () {;} - - /** Changes the value of this object */ - inline void setValue ( const double newVal) {_value = newVal;}; - - /** - * Changes the value of this object by means of a stringbuffer, - * which will be translated. - * @see GCFPValue::setValue(const string value) - */ - virtual TGCFResult setValue (const string value); - - /** Returns the value of this object*/ - inline double getValue () const {return _value;}; - - /** @see GCFPValue::clone() */ - virtual GCFPValue* clone () const; - - /** @see GCFPValue::copy() */ - virtual TGCFResult copy (const GCFPValue& value); - - private: // Private attributes - /** */ - volatile double _value; -}; -#endif diff --git a/MAC/GCF/_CoreComps/SAL/src/GCF_PVDynArr.h b/MAC/GCF/_CoreComps/SAL/src/GCF_PVDynArr.h deleted file mode 100644 index 0274517dd4953eaba3296304f9a1aa9d660026e7..0000000000000000000000000000000000000000 --- a/MAC/GCF/_CoreComps/SAL/src/GCF_PVDynArr.h +++ /dev/null @@ -1,76 +0,0 @@ -//# GCF_PVDynArr.h: MAC dynamic array property type -//# -//# Copyright (C) 2002-2003 -//# ASTRON (Netherlands Foundation for Research in Astronomy) -//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl -//# -//# This program is free software; you can redistribute it and/or modify -//# it under the terms of the GNU General Public License as published by -//# the Free Software Foundation; either version 2 of the License, or -//# (at your option) any later version. -//# -//# This program is distributed in the hope that it will be useful, -//# but WITHOUT ANY WARRANTY; without even the implied warranty of -//# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -//# GNU General Public License for more details. -//# -//# You should have received a copy of the GNU General Public License -//# along with this program; if not, write to the Free Software -//# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -//# -//# $Id$ - -#ifndef GCF_PVDYNARR_H -#define GCF_PVDYNARR_H - -#include <lofar_config.h> -#ifdef HAVE_LOFAR_SAL -#include <SAL/GCF_PValue.h> -#else -#include <GCF_PValue.h> -#endif -#include <Common/lofar_vector.h> - -typedef vector<GCFPValue*> GCFPValueArray; - -/** - * By means of this complex property type a dynamic list of property values of - * the same simple type can be managed. - */ - -class GCFPVDynArr : public GCFPValue -{ - public: - GCFPVDynArr(TMACValueType itemType, const GCFPValueArray& val); - GCFPVDynArr(TMACValueType itemType); - virtual ~GCFPVDynArr(); - - /** Changes the value of this object */ - virtual void setValue(const GCFPValueArray& newVal); - - /** - * Changes the value of this object by means of a stringbuffer, - * which will be translated. - * NOT YET IMPLEMENTED - * @see GCFPValue::setValue(const string value) - */ - virtual TGCFResult setValue(const string value); - - /** Returns the value of this object*/ - virtual inline const GCFPValueArray& getValue() const {return _values;} - - /** @see GCFPValue::clone() */ - virtual GCFPValue* clone() const; - - /** @see GCFPValue::copy() */ - virtual TGCFResult copy(const GCFPValue& value); - - private: // help members - /** cleanup the array item objects */ - void cleanup(); - - private: // Private attributes - /** The values*/ - GCFPValueArray _values; -}; -#endif diff --git a/MAC/GCF/_CoreComps/SAL/src/GCF_PVInteger.h b/MAC/GCF/_CoreComps/SAL/src/GCF_PVInteger.h deleted file mode 100644 index 358b7a325807c9919a5c26ed34f7c69129d567a8..0000000000000000000000000000000000000000 --- a/MAC/GCF/_CoreComps/SAL/src/GCF_PVInteger.h +++ /dev/null @@ -1,66 +0,0 @@ -//# GCF_PVInteger.h: MAC integer property type -//# -//# Copyright (C) 2002-2003 -//# ASTRON (Netherlands Foundation for Research in Astronomy) -//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl -//# -//# This program is free software; you can redistribute it and/or modify -//# it under the terms of the GNU General Public License as published by -//# the Free Software Foundation; either version 2 of the License, or -//# (at your option) any later version. -//# -//# This program is distributed in the hope that it will be useful, -//# but WITHOUT ANY WARRANTY; without even the implied warranty of -//# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -//# GNU General Public License for more details. -//# -//# You should have received a copy of the GNU General Public License -//# along with this program; if not, write to the Free Software -//# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -//# -//# $Id$ - -#ifndef GCF_PVINTEGER_H -#define GCF_PVINTEGER_H - -#include <lofar_config.h> -#ifdef HAVE_LOFAR_SAL -#include <SAL/GCF_PValue.h> -#else -#include <GCF_PValue.h> -#endif - -/** - * By means of this property type a integer (-2,147,483,648 to 2,147,483,647) - * value can be used. - */ -class GCFPVInteger : public GCFPValue -{ - public: - GCFPVInteger (int val = 0) : GCFPValue(LPT_INTEGER), _value(val) {;} - virtual ~GCFPVInteger () {;} - - /** Changes the value of this object */ - virtual inline void setValue (const int newVal) {_value = newVal;} - - /** - * Changes the value of this object by means of a stringbuffer, - * which will be translated. - * @see GCFPValue::setValue(const string value) - */ - virtual TGCFResult setValue (const string value); - - /** Returns the value of this object*/ - virtual inline int getValue () const {return _value;} - - /** @see GCFPValue::clone() */ - virtual GCFPValue* clone () const; - - /** @see GCFPValue::copy() */ - virtual TGCFResult copy (const GCFPValue& value); - - private: // Private attributes - /** The value */ - int _value; -}; -#endif diff --git a/MAC/GCF/_CoreComps/SAL/src/GCF_PVString.h b/MAC/GCF/_CoreComps/SAL/src/GCF_PVString.h deleted file mode 100644 index 6eed2ded3ce9ddd169a549fddba31c22796bbca1..0000000000000000000000000000000000000000 --- a/MAC/GCF/_CoreComps/SAL/src/GCF_PVString.h +++ /dev/null @@ -1,59 +0,0 @@ -//# GCF_PVString.h: MAC string property type -//# -//# Copyright (C) 2002-2003 -//# ASTRON (Netherlands Foundation for Research in Astronomy) -//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl -//# -//# This program is free software; you can redistribute it and/or modify -//# it under the terms of the GNU General Public License as published by -//# the Free Software Foundation; either version 2 of the License, or -//# (at your option) any later version. -//# -//# This program is distributed in the hope that it will be useful, -//# but WITHOUT ANY WARRANTY; without even the implied warranty of -//# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -//# GNU General Public License for more details. -//# -//# You should have received a copy of the GNU General Public License -//# along with this program; if not, write to the Free Software -//# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -//# -//# $Id$ - -#ifndef GCF_PVSTRING_H -#define GCF_PVSTRING_H - -#include <lofar_config.h> -#ifdef HAVE_LOFAR_SAL -#include <SAL/GCF_PValue.h> -#else -#include <GCF_PValue.h> -#endif - -/** - * By means of this property type a zero terminated string (max. length ~30.000 - * characters) value can be used. - */ -class GCFPVString : public GCFPValue -{ - public: - GCFPVString(string val = "") : GCFPValue(LPT_STRING), _value(val) {;} - virtual ~GCFPVString() {;} - - /** Changes the value of this object */ - virtual TGCFResult setValue(const string value); - - /** Returns the value of this object*/ - virtual inline const string& getValue() const {return _value;} - - /** @see GCFPValue::clone() */ - virtual GCFPValue* clone() const; - - /** @see GCFPValue::copy() */ - virtual TGCFResult copy(const GCFPValue& value); - - private: // Private attributes - /** The value*/ - string _value; -}; -#endif diff --git a/MAC/GCF/_CoreComps/SAL/src/GCF_PVUnsigned.h b/MAC/GCF/_CoreComps/SAL/src/GCF_PVUnsigned.h deleted file mode 100644 index 15d79fb3bf51c283cf87ac8349c99e843db5cef2..0000000000000000000000000000000000000000 --- a/MAC/GCF/_CoreComps/SAL/src/GCF_PVUnsigned.h +++ /dev/null @@ -1,66 +0,0 @@ -//# GCF_PVUnsigned.h: MAC unsigned integer property type -//# -//# Copyright (C) 2002-2003 -//# ASTRON (Netherlands Foundation for Research in Astronomy) -//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl -//# -//# This program is free software; you can redistribute it and/or modify -//# it under the terms of the GNU General Public License as published by -//# the Free Software Foundation; either version 2 of the License, or -//# (at your option) any later version. -//# -//# This program is distributed in the hope that it will be useful, -//# but WITHOUT ANY WARRANTY; without even the implied warranty of -//# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -//# GNU General Public License for more details. -//# -//# You should have received a copy of the GNU General Public License -//# along with this program; if not, write to the Free Software -//# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -//# -//# $Id$ - -#ifndef GCF_PVUNSIGNED_H -#define GCF_PVUNSIGNED_H - -#include <lofar_config.h> -#ifdef HAVE_LOFAR_SAL -#include <SAL/GCF_PValue.h> -#else -#include <GCF_PValue.h> -#endif - -/** - * By means of this property type a unsigned integer (0 to 4,294,967,295) value - * can be used. - */ -class GCFPVUnsigned : public GCFPValue -{ - public: - GCFPVUnsigned(unsigned int val = 0) : GCFPValue(LPT_UNSIGNED), _value(val) {;} - virtual ~GCFPVUnsigned() {;} - - /** Changes the value of this object */ - virtual inline void setValue( const unsigned int newVal) {_value = newVal;} - - /** - * Changes the value of this object by means of a stringbuffer, - * which will be translated. - * @see GCFPValue::setValue(const string value) - */ - virtual TGCFResult setValue(const string value); - - /** Returns the value of this object*/ - virtual inline unsigned int getValue() const {return _value;} - - /** @see GCFPValue::clone() */ - virtual GCFPValue* clone() const; - - /** @see GCFPValue::copy() */ - virtual TGCFResult copy(const GCFPValue& value); - - private: // Private attributes - /** The value */ - unsigned int _value; -}; -#endif diff --git a/MAC/GCF/_CoreComps/SAL/src/GCF_PValue.h b/MAC/GCF/_CoreComps/SAL/src/GCF_PValue.h deleted file mode 100644 index 373c36c917a21170f14824ccc5b000dadf03a60d..0000000000000000000000000000000000000000 --- a/MAC/GCF/_CoreComps/SAL/src/GCF_PValue.h +++ /dev/null @@ -1,113 +0,0 @@ -//# GCF_PValue.h: abstract class for all MAC types -//# -//# Copyright (C) 2002-2003 -//# ASTRON (Netherlands Foundation for Research in Astronomy) -//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl -//# -//# This program is free software; you can redistribute it and/or modify -//# it under the terms of the GNU General Public License as published by -//# the Free Software Foundation; either version 2 of the License, or -//# (at your option) any later version. -//# -//# This program is distributed in the hope that it will be useful, -//# but WITHOUT ANY WARRANTY; without even the implied warranty of -//# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -//# GNU General Public License for more details. -//# -//# You should have received a copy of the GNU General Public License -//# along with this program; if not, write to the Free Software -//# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -//# -//# $Id$ - -#ifndef GCF_PVALUE_H -#define GCF_PVALUE_H - -#include <lofar_config.h> -#ifdef HAVE_LOFAR_SAL -#include <GCFCommon/GCF_Defines.h> -#else -#include <GCF_Defines.h> -#endif - -/** - This is the abstract value type class, which will be used to transport values - through a whole MAC application in a generic way. Instances of - specialisations of this class will normally used to hold values in local - properties or transport property values from PVSS to the MAC application or - visa versa. -*/ - -class GCFPValue -{ - public: - /** - * The enumeration of possible MAC property types - * In case a dynamic array will be used the type ID enumeration starts on - * 0x80. - */ - enum TMACValueType {NO_LPT, LPT_BOOL, LPT_CHAR, LPT_UNSIGNED, LPT_INTEGER, - BIT32_VAL, LPT_BLOB, LPT_REF, LPT_DOUBLE, LPT_DATETIME, - LPT_STRING, LPT_DYNARR = 0x80, - LPT_DYNBOOL, LPT_DYNCHAR, LPT_DYNUNSIGNED, LPT_DYNINTEGER, - DYNBIT32_VAL, LPT_DYNBLOB, LPT_DYNREF, LPT_DYNDOUBLE, LPT_DYNDATETIME, - LPT_DYNSTRING }; - /** - * The constructor - * Sets the type ID for each subclassed property value type class - * @param type MAC property type ID - */ - GCFPValue (TMACValueType type) : _type(type) {}; - - /** - * The destructor - */ - virtual ~GCFPValue () {}; - - /** - * Returns MAC type ID. - * @return MAC type ID - */ - inline const TMACValueType& getType () const {return _type;} - - /** - * Pure virtual method - * @return a hard copy of this object - * <b>IMPORTANT: must be deleted by "user" of this method</b> - */ - virtual GCFPValue* clone () const = 0; - - /** - * Pure virtual method - * Copys the arguments value to the affected object - * @param value value to be copied into <b>this</b> object - * @return GCF_DIFFERENT_TYPES if type of <b>value<b> is different to - * <b>this</b> object. Otherwise GCF_NO_ERROR. - */ - virtual TGCFResult copy (const GCFPValue& value) = 0; - - /** - * Pure virtual method - * Sets a value to the affected object by means of a string buffer. - * This value will be translated by the concrete subclassed value type class. - * @param value value to be translated to value of <b>this</b> object - * @return GCF_VALUESTRING_NOT_VALID if <b>value<b> could not be translated - * to the value of <b>this</b> object. Otherwise GCF_NO_ERROR. - */ - virtual TGCFResult setValue (const string value) = 0; - - /** - * Static method - * Creates a property value object of MAC type <b>type<b> - * @param type property type to created - * @return pointer to created property value type object - * <b>IMPORTANT: must be deleted by "user" of this method</b> - */ - static GCFPValue* createMACTypeObject (TMACValueType type); - - private: // private data members - /** Holds MAC property value type ID*/ - TMACValueType _type; -}; - -#endif diff --git a/MAC/GCF/_CoreComps/TM/src/GCF_Control.h b/MAC/GCF/_CoreComps/TM/src/GCF_Control.h deleted file mode 100644 index 1e421f9602a880c0347b810872b4bf6f978d1d3d..0000000000000000000000000000000000000000 --- a/MAC/GCF/_CoreComps/TM/src/GCF_Control.h +++ /dev/null @@ -1,55 +0,0 @@ -//# GCF_Control.h: Include this header file when programming tasks. -//# It includes everything that you need. -//# -//# Copyright (C) 2002-2003 -//# ASTRON (Netherlands Foundation for Research in Astronomy) -//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl -//# -//# This program is free software; you can redistribute it and/or modify -//# it under the terms of the GNU General Public License as published by -//# the Free Software Foundation; either version 2 of the License, or -//# (at your option) any later version. -//# -//# This program is distributed in the hope that it will be useful, -//# but WITHOUT ANY WARRANTY; without even the implied warranty of -//# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -//# GNU General Public License for more details. -//# -//# You should have received a copy of the GNU General Public License -//# along with this program; if not, write to the Free Software -//# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -//# -//# $Id$ - -// -// Each file is guarded with the multiple inclusion guard as -// used in the files. The guards in this file prevent opening and -// reading the file when it has already been included. -// This speeds up compilation. -// - -#ifndef GCF_CONTROL_H -#define GCF_CONTROL_H - -#include <lofar_config.h> -#ifdef HAVE_LOFAR_TM -#include <TM/PortInterface/GCF_Port.h> -#include <TM/PortInterface/GCF_PortInterface.h> -#include <TM/PortInterface/GCF_PeerAddr.h> -#include <TM/Socket/GCF_TCPPort.h> -#include <TM/GCF_Task.h> -#include <TM/GCF_Fsm.h> -#include <TM/GCF_TMProtocols.h> -#include <TM/GCF_Event.h> -#else -#include <GCF_Port.h> -#include <GCF_PortInterface.h> -#include <GCF_PeerAddr.h> -#include <GCF_TCPPort.h> -#include <GCF_Task.h> -#include <GCF_Fsm.h> -#include <GCF_TMProtocols.h> -#include <GCF_Event.h> -#endif - -#endif /* GCF_CONTROL_H */ diff --git a/MAC/GCF/_CoreComps/TM/src/GCF_Event.h b/MAC/GCF/_CoreComps/TM/src/GCF_Event.h deleted file mode 100644 index fee4c3a3a7e88c25b3bd09f0b7c8b218c1f8990d..0000000000000000000000000000000000000000 --- a/MAC/GCF/_CoreComps/TM/src/GCF_Event.h +++ /dev/null @@ -1,91 +0,0 @@ -//# GCF_Event.h: finite state machine events -//# -//# Copyright (C) 2002-2003 -//# ASTRON (Netherlands Foundation for Research in Astronomy) -//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl -//# -//# This program is free software; you can redistribute it and/or modify -//# it under the terms of the GNU General Public License as published by -//# the Free Software Foundation; either version 2 of the License, or -//# (at your option) any later version. -//# -//# This program is distributed in the hope that it will be useful, -//# but WITHOUT ANY WARRANTY; without even the implied warranty of -//# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -//# GNU General Public License for more details. -//# -//# You should have received a copy of the GNU General Public License -//# along with this program; if not, write to the Free Software -//# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -//# -//# $Id$ - -#ifndef GCF_EVENT_H -#define GCF_EVENT_H - -#include <sys/types.h> -/** - * This struct is the base event data container to exchange messages between two - * tasks. - * Application tasks will have to define their own protocol by specifying the - * contents of events that are exchanged between tasks. Creating sub class from - * GCFEvent creates application (tasks) specific events. All GCFEvent sub - * classes are generally the same except for the parameters that make the event - * unique. A protocol is a collection of events where each event has a specific - * direction (IN/OUT). To create a new protocol a protocol specification file - * must be created (with extension '.prot'). The autogen utility is then used to - * convert this specification file into a header file containing GCFEvent sub - * class definitions. - * The protocol specification consists of a list of the possible events in the - * protocol each with its own parameters (or no parameters) and with the - * direction in which the event can be sent. The autogen utility is used to - * generate a header file from this definition using a template for the header - * file and the nested key-value pairs from the specification file. This header - * file contains definitions of GCFEvent sub classes, one for each event. - */ -struct GCFEvent -{ - GCFEvent() : - signal(0), pad0(0), length(sizeof(GCFEvent)) - {} - - GCFEvent(unsigned short sig) : - signal(sig), pad0(0), length(sizeof(GCFEvent)) - {} - - enum TResult { ERROR = -1, HANDLED = 0, NOT_HANDLED = 1}; - - /** - * @code - * Signal format - * - * 2 most significant bits indicate direction of signal: - * F_IN = 0b01 - * F_OUT = 0b10 - * F_INOUT = 0b11 (F_IN_SIGNAL | F_OUT_SIGNAL) - * - * +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ - * | O | I | P | P | P | P | P | S | S | S | S | S | S | S | S | S | - * +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ - * 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 - * <- I/O-><--- protocol ---------><--------- signal --------------> - * @endcode - */ - unsigned short signal; // lsb contains signal id (0-255) - // msb contains protocol id (0-255) - unsigned short pad0; // DO NOT USE - size_t length; // length of the event (should be <= SSIZE_MAX) -}; - -/** - * Macros to aid in decoding the signal field. - */ -#define F_EVT_INOUT_MASK (0xc000) -#define F_EVT_PROTOCOL_MASK (0x3f00) -#define F_EVT_SIGNAL_MASK (0x00ff) - -#define F_EVT_INOUT(e) (((e).signal & F_EVT_INOUT_MASK) >> 14) -#define F_EVT_PROTOCOL(e) (((e).signal & F_EVT_PROTOCOL_MASK) >> 8) -#define F_EVT_SIGNAL(e) ((e).signal & F_EVT_SIGNAL_MASK) - -#endif diff --git a/MAC/GCF/_CoreComps/TM/src/GCF_Fsm.h b/MAC/GCF/_CoreComps/TM/src/GCF_Fsm.h deleted file mode 100644 index 229331efc4e78ddb53e98833c659e8a6e92356bd..0000000000000000000000000000000000000000 --- a/MAC/GCF/_CoreComps/TM/src/GCF_Fsm.h +++ /dev/null @@ -1,169 +0,0 @@ -//# GCF_Fsm.h: header file for the finite state machine implementation. -//# -//# Copyright (C) 2002-2003 -//# ASTRON (Netherlands Foundation for Research in Astronomy) -//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl -//# -//# This program is free software; you can redistribute it and/or modify -//# it under the terms of the GNU General Public License as published by -//# the Free Software Foundation; either version 2 of the License, or -//# (at your option) any later version. -//# -//# This program is distributed in the hope that it will be useful, -//# but WITHOUT ANY WARRANTY; without even the implied warranty of -//# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -//# GNU General Public License for more details. -//# -//# You should have received a copy of the GNU General Public License -//# along with this program; if not, write to the Free Software -//# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -//# -//# $Id$ - -#ifndef GCF_FSM_H -#define GCF_FSM_H - -#include <lofar_config.h> -#ifdef HAVE_LOFAR_TM -#include <TM/GCF_Event.h> -#include <TM/GCF_TMProtocols.h> -#include <TM/PortInterface/GCF_PortInterface.h> -#else -#include <GCF_Event.h> -#include <GCF_TMProtocols.h> -#include <GCF_PortInterface.h> -#endif -#include <iostream> -#include <cstdlib> - -#define TRAN(_target_) \ - { \ - tran(static_cast<State>(&_target_), __func__, #_target_); \ - } - -/** - * This type of port can be used to transport internal messages linked to a - * port, which does not implement anything of the typical features of a port - */ -class GCFDummyPort : public GCFPortInterface -{ - public: - GCFDummyPort (GCFTask* pTask, - string name, - int protocol) : - GCFPortInterface(pTask, name, SPP, protocol) - {}; - - inline int close () {return 0;} - inline int open () {return 0;} - - inline ssize_t send (const GCFEvent& /*event*/, - void* /*buf*/ = 0, - size_t /*count*/ = 0) - { - return 0; - } - - inline ssize_t sendv (const GCFEvent& /*event*/, - const iovec /*buffers*/[], - int /*n*/) - { - return 0; - } - - inline ssize_t recv (void* /*buf*/, - size_t /*count*/) - { - return 0; - } - - inline ssize_t recvv (iovec /*buffers*/[], - int /*n*/) - { - - return 0; - } - - inline long setTimer (long /*delay_sec*/, - long /*delay_usec*/, - long /*interval_sec*/, - long /*interval_usec*/, - const void* /*arg*/) - { - return 0; - } - - inline long setTimer (double /*delay_seconds*/, - double /*interval_seconds*/, - const void* /*arg*/) - { - return 0; - } - - inline int cancelTimer (long /*timerid*/, - const void** /*arg*/) - { - return 0; - } - - inline int cancelAllTimers () {return 0;} - - inline int resetTimerInterval (long /*timerid*/, - long /*sec*/, - long /*usec*/) - { - return 0; - } -}; - -/** - * Fsm = Finite State Machine - * All tasks implement their behaviour in terms of a finite state machine. The - * implementation in the GCFFsm class from which the GCFTask derives is a direct - * implementation of the design described in [ref. AD.6]. This design is based - * around the concept of state event handlers. Events are received when the - * state machine is in a certain state. This state is represented by a method of - * the APLExampleTaskA class (derived from GCFFTask). This state handler method - * is called when a new event arrives for the task. The handler has two - * arguments: a reference to the event (GCFEvent) that was received, and a - * reference to the port on which it was received (GCFPortInterface). - * @code - - int my_state(GCFEvent& e, GCFPortInterface& p); - - * @encode - * A task is therefore an event driven application. In fact the programmer using - * the sub-framework does not control the main loop of the application. This - * loop is handled by the framework through the GCFTask::run() method. - */ -class GCFFsm -{ - public: - typedef GCFEvent::TResult (GCFFsm::*State)(GCFEvent& event, GCFPortInterface& port); // ptr to state handler type - - GCFFsm (State initial) : _state(initial) {;} - virtual ~GCFFsm () {;} - - void initFsm (); - - inline GCFEvent::TResult dispatch (GCFEvent& event, - GCFPortInterface& port) - { - return (this->*_state)(event, port); - } - - protected: - - void tran (State target, - const char* from, - const char* to); - - protected: - volatile State _state; - - private: - static GCFDummyPort _gcfPort; -}; - - -#endif diff --git a/MAC/GCF/_CoreComps/TM/src/GCF_Handler.h b/MAC/GCF/_CoreComps/TM/src/GCF_Handler.h deleted file mode 100644 index e536cff3186592d79325a273e90d9ec354b9d0b0..0000000000000000000000000000000000000000 --- a/MAC/GCF/_CoreComps/TM/src/GCF_Handler.h +++ /dev/null @@ -1,73 +0,0 @@ -//# GCF_Handler.h: abstract baseclass for all concrete message handlers -//# -//# Copyright (C) 2002-2003 -//# ASTRON (Netherlands Foundation for Research in Astronomy) -//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl -//# -//# This program is free software; you can redistribute it and/or modify -//# it under the terms of the GNU General Public License as published by -//# the Free Software Foundation; either version 2 of the License, or -//# (at your option) any later version. -//# -//# This program is distributed in the hope that it will be useful, -//# but WITHOUT ANY WARRANTY; without even the implied warranty of -//# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -//# GNU General Public License for more details. -//# -//# You should have received a copy of the GNU General Public License -//# along with this program; if not, write to the Free Software -//# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -//# -//# $Id$ - -#ifndef GCF_HANDLER_H -#define GCF_HANDLER_H - -//# Includes - - -//# forward declaration -class GCFTask; - -/** - * This is the pure abstract (interface) class for all different kind of - * handlers, which wants to be added to the application main loop. All handlers - * together are responsible to guarantee that all incoming and outgoing events - * from/to outside of a task (or process) will be serviced. So each handler - * services a part of all possible events when their workProc method is called. - * With other words: In the main loop of the applications all specialised - * workProc operations of the registered handlers will be repeatedly invoked - * in the same order. - * This concept is introduced because of the two facts: - * 1) the PVSS API library for Linux is not thread safe and compiled with - * GNU 2.96 (in case of RedHat 7.2). A compiler of version 3.0 or higher - * cannot compile application or library code written for the GNU 2.96. - * 2) and other communication chancels should be possible. - * So it was very important to create a possibility to manage different message - * handlers, which runs in the same thread/process and supports together - * transparent event driven processing. - * A new handler must be registered on the static register of the GCFTask class. - * An other important issue is related to the priority of handling different - * event streams (PVSS or ports). From Applications point of view it is - * important to know that the event stream over ports will be handled as fast - * as possible. Two, SCADA and Socket, handlers are based on the socket pattern. - * They work with a max. timeout value to wait for incoming events. That's why - * the (max.) timeout of the SCADA handler must be very low and the timeout of - * Socket Handler significant higher than of the SCADA handler. Here an overview - * what the timeout could be (for now; these values has to be fine tuned during - * testing the performance). - * - Handler Timeout - SCADA 1us - Socket 10ms - * - */ - -class GCFHandler -{ - private: - virtual void workProc () = 0; - virtual void stop () = 0; - friend GCFTask; -}; -#endif diff --git a/MAC/GCF/_CoreComps/TM/src/GCF_TMProtocols.h b/MAC/GCF/_CoreComps/TM/src/GCF_TMProtocols.h deleted file mode 100644 index 8be7fc604e770c9a562e0680c4ac1de9d0526300..0000000000000000000000000000000000000000 --- a/MAC/GCF/_CoreComps/TM/src/GCF_TMProtocols.h +++ /dev/null @@ -1,126 +0,0 @@ -//# GCF_TMProtocols.h: protocols used by the framework -//# -//# Copyright (C) 2002-2003 -//# ASTRON (Netherlands Foundation for Research in Astronomy) -//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl -//# -//# This program is free software; you can redistribute it and/or modify -//# it under the terms of the GNU General Public License as published by -//# the Free Software Foundation; either version 2 of the License, or -//# (at your option) any later version. -//# -//# This program is distributed in the hope that it will be useful, -//# but WITHOUT ANY WARRANTY; without even the implied warranty of -//# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -//# GNU General Public License for more details. -//# -//# You should have received a copy of the GNU General Public License -//# along with this program; if not, write to the Free Software -//# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -//# -//# $Id$ - -#ifndef GCF_PROTOCOLS_H -#define GCF_PROTOCOLS_H - -#include <lofar_config.h> -#ifdef HAVE_LOFAR_TM -#include <TM/GCF_Event.h> -#else -#include <GCF_Event.h> -#endif - -/** - * Macro to encode an event's signal from the signal id, protocal an in/out direction - */ -#define F_SIGNAL(prot, sig, inout) ( (((unsigned short)(inout) & 0x3) << 14) \ - | (((unsigned short)(prot) & 0x3f) << 8) \ - | ((unsigned short)(sig) & 0xff) \ - ) - -/** - * Define different types of signals - */ -#define F_IN 0x01 -#define F_OUT 0x02 -#define F_INOUT (F_IN | F_OUT) - -/** - * This enum lists all framework protocols. The application protocols should - * start numbering enums at F_APPLICATION_PROTOCOL, e.g.: - * - * enum { - * MY_CONTROL_PROTOCOL = F_APPLICATION_PROTOCOL, - * MY_MONITORING_PROTOCOL, - * }; - * - * NOTE: All application protocols should be enumerated in the same - * enum to guarantee application global uniqueness. - * - */ -enum { - F_FSM_PROTOCOL = 1, // state machine protocol (encoded in msb) - F_PORT_PROTOCOL, // port connection protocol - F_GCF_PROTOCOL, // GCF specific protocol numbers start here - F_APL_PROTOCOL = 10, // APPlication specific protocol numbers start here -}; - -/** - * F_FSM_PROTOCOL signals - */ -enum { - F_ENTRY_ID = 1, // state entry; currently unused (encoded in lsb) - F_EXIT_ID, // state exit; currently unused - F_INIT_ID, // initial transition -}; - -// convenience macros -#define F_ENTRY_SIG F_SIGNAL(F_FSM_PROTOCOL, F_ENTRY_ID, F_IN) -#define F_EXIT_SIG F_SIGNAL(F_FSM_PROTOCOL, F_EXIT_ID, F_IN) -#define F_INIT_SIG F_SIGNAL(F_FSM_PROTOCOL, F_INIT_ID, F_IN) - -extern const char* F_FSM_PROTOCOL_names[]; // defined in GCF_Protocols.cc - -/** - * F_PORT_PROTOCOL signals - */ -enum { - F_CONNECT_ID = 1, // sent to the accept port to connect - // to a specific SPP port - F_CONNECTED_ID, // sent to the port to indicate completion - F_DISCONNECTED_ID, // sent to the port that is disconnected - F_CLOSED_ID, // to delay closing a port - F_TIMER_ID, // timer expired - F_DATAIN_ID, // data available for reading - F_DATAOUT_ID, // space available to write - F_RAW_ID, // no event!, only the data is sent (used with direct ports) - F_ACCEPT_REQ_ID, // indicatation of the port provider to the user about a client connect request (SAP) - F_DISPATCHED_ID // SCADA API has dispachted (read/write on own ports) right now -}; - -#define F_CONNECT_SIG F_SIGNAL(F_PORT_PROTOCOL, F_CONNECT_ID, F_IN) -#define F_CONNECTED_SIG F_SIGNAL(F_PORT_PROTOCOL, F_CONNECTED_ID, F_IN) -#define F_DISCONNECTED_SIG F_SIGNAL(F_PORT_PROTOCOL, F_DISCONNECTED_ID, F_IN) -#define F_CLOSED_SIG F_SIGNAL(F_PORT_PROTOCOL, F_CLOSED_ID, F_IN) -#define F_TIMER_SIG F_SIGNAL(F_PORT_PROTOCOL, F_TIMER_ID, F_IN) -#define F_DATAIN_SIG F_SIGNAL(F_PORT_PROTOCOL, F_DATAIN_ID, F_IN) -#define F_DATAOUT_SIG F_SIGNAL(F_PORT_PROTOCOL, F_DATAOUT_ID, F_IN) -#define F_RAW_SIG F_SIGNAL(F_PORT_PROTOCOL, F_RAW_ID, F_INOUT) -#define F_ACCEPT_REQ_SIG F_SIGNAL(F_PORT_PROTOCOL, F_ACCEPT_REQ_ID, F_IN) -#define F_DISPATCHED_SIG F_SIGNAL(F_PORT_PROTOCOL, F_DISPATCHED_ID, F_IN) - -extern const char* F_PORT_PROTOCOL_names[]; // defined in GCF_TMProtocols.cc - -struct GCFTimerEvent : public GCFEvent -{ - GCFTimerEvent() : GCFEvent(F_TIMER_SIG) - { - length = sizeof(GCFTimerEvent); - } - - long sec; - long usec; - const void* arg; -}; - -#endif diff --git a/MAC/GCF/_CoreComps/TM/src/GCF_Task.h b/MAC/GCF/_CoreComps/TM/src/GCF_Task.h deleted file mode 100644 index 0385955fffea12ec50eeee0cce0f423786193970..0000000000000000000000000000000000000000 --- a/MAC/GCF/_CoreComps/TM/src/GCF_Task.h +++ /dev/null @@ -1,125 +0,0 @@ -//# GCF_Task.h: handles all events for a task. -//# -//# Copyright (C) 2002-2003 -//# ASTRON (Netherlands Foundation for Research in Astronomy) -//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl -//# -//# This program is free software; you can redistribute it and/or modify -//# it under the terms of the GNU General Public License as published by -//# the Free Software Foundation; either version 2 of the License, or -//# (at your option) any later version. -//# -//# This program is distributed in the hope that it will be useful, -//# but WITHOUT ANY WARRANTY; without even the implied warranty of -//# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -//# GNU General Public License for more details. -//# -//# You should have received a copy of the GNU General Public License -//# along with this program; if not, write to the Free Software -//# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -//# -//# $Id$ - -#ifndef GCF_TASK_H -#define GCF_TASK_H - -//# Includes -#include <lofar_config.h> -#ifdef HAVE_LOFAR_TM -#include <TM/GCF_Fsm.h> -#else -#include <GCF_Fsm.h> -#endif -#include <Common/lofar_string.h> -#include <Common/lofar_vector.h> -#include <Common/lofar_map.h> - -// forward declaration -class GCFPort; -class GCFHandler; - -/** - * This is the base class for all tasks in an application. Different - * specialisations of this class results in a number of concurrent finite state - * machines with own ports to other tasks (in other processes). - * Note: This is not a representation of a 'thread' related to the - * multithreading concept. - * @todo Don't register protocol in static task context but in port interface. - * Because the protocol parameter of the port (interface) is not used the - * protocol string can be passed to the port (interface) instead of the - * protocol ID. - */ - -class GCFTask : public GCFFsm -{ - public: - - /** - * The static run method. This starts the event processing loop. - * When multiple tasks are declared within the same binary, only - * one call to GCFTask::run will suffice. - * A call to this function will NEVER return. It is an error if it - * does return. - * - * @code - * - * class MyTask : public GCFTask { ... } - * - * int main(int argc, char** argv) - * { - * // create two tasks, a and b. - * GCFTask::init(argc, argv); - * - * MyTask a("a"); - * MyTask b("b"); - * a.start(); - * b.start(); - * // start the event processing loop - * GCFTask::run(); - * } - * - * @endcode - */ - void start (); - static void init (int argc, char** argv); - static void run (); - static void registerHandler (GCFHandler& handler); - static void stop (); - - // Get the name of the task. - inline const string& getName () const {return _name;} - /// Set the name of the task. - inline void setName (string& name) {_name = name;} - static int _argc; - static char** _argv; - - protected: - GCFTask (State initial, - string& name); - virtual ~GCFTask(); - /** - * Register the protocol. This is used for logging. The name of each event - * that is part of the protocol is specified. Index 0 should not be used for - * a signal. Signal numbers should start at 1. - */ - void registerProtocol(unsigned short protocol_id, - const char* signal_names[]); - - private: - friend class GCFPort; - friend class GTMSocket; - friend class GCFRawPort; - const char* evtstr(const GCFEvent& e) const; - /// Is private to avoid initialising a task without giving an inital state and the task name - GCFTask(); - string _name; - static vector<GCFHandler*> _handlers; - typedef vector<GCFHandler*>::iterator THandlerIter; - - static map<unsigned short, const char**> _protocols; - typedef map<unsigned short, const char**>::iterator TProtocolIter; - - static void signalHandler(int sig); - static bool _doExit; -}; -#endif diff --git a/MAC/GCF/_CoreComps/TM/src/PortInterface/GCF_PeerAddr.h b/MAC/GCF/_CoreComps/TM/src/PortInterface/GCF_PeerAddr.h deleted file mode 100644 index 60ebbdcc8ae410c18c8acc5cb5f14bd0f7dd2b89..0000000000000000000000000000000000000000 --- a/MAC/GCF/_CoreComps/TM/src/PortInterface/GCF_PeerAddr.h +++ /dev/null @@ -1,65 +0,0 @@ -//# GCF_PeerAddr.h: This class holds information about port host and the port -//# number. This will be used to hold the remote and local address. -//# -//# Copyright (C) 2002-2003 -//# ASTRON (Netherlands Foundation for Research in Astronomy) -//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl -//# -//# This program is free software; you can redistribute it and/or modify -//# it under the terms of the GNU General Public License as published by -//# the Free Software Foundation; either version 2 of the License, or -//# (at your option) any later version. -//# -//# This program is distributed in the hope that it will be useful, -//# but WITHOUT ANY WARRANTY; without even the implied warranty of -//# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -//# GNU General Public License for more details. -//# -//# You should have received a copy of the GNU General Public License -//# along with this program; if not, write to the Free Software -//# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -//# -//# $Id$ - -#ifndef GCF_PEERADDR_H -#define GCF_PEERADDR_H - -#include <Common/lofar_string.h> - -/** - * This class holds information about port host and the port number. This will - * be used to hold the remote and local address. - */ -class GCFPeerAddr -{ - public: - - GCFPeerAddr (); - GCFPeerAddr (string& taskname, - string& host, - string& portname, - string& porttype, - int portnumber = 0); - virtual ~GCFPeerAddr (); - - const string& getTaskname () const; - const string& getHost () const; - int getPortnumber () const; - const string& getPortname () const; - const string& getPorttype () const; - - void setTaskname (const string& taskname); - void setHost (const string& host); - void setPortname (const string& portname); - void setPorttype (const string& porttype); - void setPortnumber (int portnumber); - - private: - string _taskname; - string _host; - string _portname; - string _porttype; - int _portnumber; -}; - -#endif diff --git a/MAC/GCF/_CoreComps/TM/src/PortInterface/GCF_Port.h b/MAC/GCF/_CoreComps/TM/src/PortInterface/GCF_Port.h deleted file mode 100644 index 2369db53db72d56ac3be77340782905f2e8f3775..0000000000000000000000000000000000000000 --- a/MAC/GCF/_CoreComps/TM/src/PortInterface/GCF_Port.h +++ /dev/null @@ -1,135 +0,0 @@ -//# GCF_Port.h: represents a protocol port to a remote process -//# -//# Copyright (C) 2002-2003 -//# ASTRON (Netherlands Foundation for Research in Astronomy) -//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl -//# -//# This program is free software; you can redistribute it and/or modify -//# it under the terms of the GNU General Public License as published by -//# the Free Software Foundation; either version 2 of the License, or -//# (at your option) any later version. -//# -//# This program is distributed in the hope that it will be useful, -//# but WITHOUT ANY WARRANTY; without even the implied warranty of -//# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -//# GNU General Public License for more details. -//# -//# You should have received a copy of the GNU General Public License -//# along with this program; if not, write to the Free Software -//# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -//# -//# $Id$ - -#ifndef GCF_PORT_H -#define GCF_PORT_H - -#include <lofar_config.h> -#ifdef HAVE_LOFAR_TM -#include <TM/PortInterface/GCF_PortInterface.h> -#include <TM/PortInterface/GCF_PeerAddr.h> -#else -#include <GCF_PortInterface.h> -#include <GCF_PeerAddr.h> -#endif - -// forward declaration -class GCFTask; -class GCFRawPort; - -/** - * This class represents a protocol port that is used to exchange events defined - * in a protocol independent from the transport mechanism. On initialisation of - * the port it creates a concrete raw port class (with the transport mechanism). - * It is possible to init GCFPort's with complete information or the information - * can be received from a name service. This port is always the master of raw - * ports. - */ -class GCFPort : public GCFPortInterface -{ - public: - - /** - * constructors - * @param protocol NOT USED - */ - GCFPort (GCFTask& containertask, - string& name, - TPortType type, - int protocol); - - GCFPort (); - - /** - * destructor - */ - virtual ~GCFPort (); - - /** initialize function, to follow-up default constructor */ - void init (GCFTask& containertask, - string name, - TPortType type, - int protocol); - - /** - * open/close functions - */ - virtual int open (); - virtual int close (); - - /** - * send/recv functions - */ - virtual ssize_t send (const GCFEvent& event, - void* buf = 0, - size_t count = 0); - virtual ssize_t sendv (const GCFEvent& event, - const iovec buffers[], - int n); - virtual ssize_t recv (void* buf, - size_t count); - virtual ssize_t recvv (iovec buffers[], - int n); - - /** - * Timer functions. - * Upon expiration of a timer a F_TIMER_SIG will be - * received on the port. - */ - virtual long setTimer (long delay_sec, long delay_usec = 0, - long interval_sec = 0, long interval_usec = 0, - const void* arg = 0); - - virtual long setTimer (double delay_seconds, - double interval_seconds = 0.0, - const void* arg = 0); - - virtual int cancelTimer (long timerid, - const void** arg = 0); - - virtual int cancelAllTimers (); - - /** - * THIS METHOD IS NOT IMPLEMENTED YET - */ - virtual int resetTimerInterval (long timerid, - long sec, - long usec = 0); - - private: - - /** - * Don't allow copying this object. - */ - GCFPort (const GCFPort&); - GCFPort& operator= (const GCFPort&); - - friend class GCFRawPort; - - private: - - GCFPeerAddr _localAddr; - GCFPeerAddr _remoteAddr; - - GCFPortInterface* _pSlave; -}; -#endif diff --git a/MAC/GCF/_CoreComps/TM/src/PortInterface/GCF_PortInterface.h b/MAC/GCF/_CoreComps/TM/src/PortInterface/GCF_PortInterface.h deleted file mode 100644 index 14708fd1226ba6fa68a4fe8707764d8e2a88e97d..0000000000000000000000000000000000000000 --- a/MAC/GCF/_CoreComps/TM/src/PortInterface/GCF_PortInterface.h +++ /dev/null @@ -1,145 +0,0 @@ -//# GCF_PortInterface.h: container class for all port implementations -//# -//# Copyright (C) 2002-2003 -//# ASTRON (Netherlands Foundation for Research in Astronomy) -//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl -//# -//# This program is free software; you can redistribute it and/or modify -//# it under the terms of the GNU General Public License as published by -//# the Free Software Foundation; either version 2 of the License, or -//# (at your option) any later version. -//# -//# This program is distributed in the hope that it will be useful, -//# but WITHOUT ANY WARRANTY; without even the implied warranty of -//# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -//# GNU General Public License for more details. -//# -//# You should have received a copy of the GNU General Public License -//# along with this program; if not, write to the Free Software -//# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -//# -//# $Id$ - -#ifndef GCF_PORTINTERFACE_H -#define GCF_PORTINTERFACE_H - -#include <sys/types.h> -#include <sys/uio.h> -#include <string.h> - -#include <Common/lofar_string.h> - -// forward declacations -class GCFTask; -class GCFEvent; - -/** - * This is the abstract base class for all port implementations like TCP, shared - * memory. It provides the possibility to: - * - send and receive events to/from peers in a generic way. - * - start and stop timers on the port - */ -class GCFPortInterface -{ - public: - - /** - * port types - */ - typedef enum - { - SAP = 1, /**< Service Access Point (port connector)*/ - SPP, /**< Service Provision Point (port acceptor)*/ - MSPP, /**< Multi Service Provision Point (port provider)*/ - } TPortType; - - /** @param protocol NOT USED */ - GCFPortInterface (GCFTask* pTask, - string name, - TPortType type, - int protocol) : - _pTask(pTask), - _name(name), - _isConnected(false), - _type(type), - _protocol(protocol) - { - } - - virtual ~GCFPortInterface () {}; - - virtual int close () = 0; - virtual int open () = 0; - - /** - * send/recv functions - */ - virtual ssize_t send (const GCFEvent& event, - void* buf = 0, - size_t count = 0) = 0; - virtual ssize_t sendv (const GCFEvent& event, - const iovec buffers[], - int n) = 0; - - virtual ssize_t recv (void* buf, - size_t count) = 0; - virtual ssize_t recvv (iovec buffers[], - int n) = 0; - - /** - * Timer functions. - * Upon expiration of a timer a F_TIMER_SIG will be - * received on the port. - */ - virtual long setTimer (long delay_sec, - long delay_usec = 0, - long interval_sec = 0, - long interval_usec = 0, - const void* arg = 0) = 0; - - virtual long setTimer (double delay_seconds, - double interval_seconds = 0.0, - const void* arg = 0) = 0; - - virtual int cancelTimer (long timerid, - const void** arg = 0) = 0; - - virtual int cancelAllTimers() = 0; - - virtual int resetTimerInterval(long timerid, - long sec, - long usec = 0) = 0; - - /** - * Attribute access functions - */ - inline const string& getName () const {return _name;} - inline TPortType getType () const {return _type;} - inline bool isConnected () const {return _isConnected;} - inline const GCFTask* getTask () const {return _pTask;} - inline int getProtocol () const {return _protocol;} - - protected: - GCFTask* _pTask; - string _name; - bool _isConnected; - TPortType _type; - int _protocol; /**< NOT USED */ - - virtual inline void setIsConnected (bool connected) {_isConnected = connected;} - - /** @param protocol NOT USED */ - virtual void init(GCFTask& task, - string& name, - TPortType type, - int protocol) - { - _pTask = &task; - _name = name; - _type = type; - _protocol = protocol; - _isConnected = false; - } -}; - -#endif diff --git a/MAC/GCF/_CoreComps/TM/src/PortInterface/GCF_RawPort.h b/MAC/GCF/_CoreComps/TM/src/PortInterface/GCF_RawPort.h deleted file mode 100644 index 6f4147bc61027b59be4b4866bbd5991d2c67a90f..0000000000000000000000000000000000000000 --- a/MAC/GCF/_CoreComps/TM/src/PortInterface/GCF_RawPort.h +++ /dev/null @@ -1,122 +0,0 @@ -//# GCF_RawPort.h: connection to a remote process -//# -//# Copyright (C) 2002-2003 -//# ASTRON (Netherlands Foundation for Research in Astronomy) -//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl -//# -//# This program is free software; you can redistribute it and/or modify -//# it under the terms of the GNU General Public License as published by -//# the Free Software Foundation; either version 2 of the License, or -//# (at your option) any later version. -//# -//# This program is distributed in the hope that it will be useful, -//# but WITHOUT ANY WARRANTY; without even the implied warranty of -//# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -//# GNU General Public License for more details. -//# -//# You should have received a copy of the GNU General Public License -//# along with this program; if not, write to the Free Software -//# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -//# -//# $Id$ - -#ifndef GCF_RAWPORT_H -#define GCF_RAWPORT_H - -#include <lofar_config.h> -#ifdef HAVE_LOFAR_TM -#include <TM/PortInterface/GCF_PortInterface.h> -#include <TM/PortInterface/GCF_PeerAddr.h> -#include <TM/GCF_Event.h> -#else -#include <GCF_PortInterface.h> -#include <GCF_PeerAddr.h> -#include <GCF_Event.h> -#endif - -#include <Common/lofar_string.h> -#include <Common/lofar_map.h> - -// forward declaration -class GCFTask; -class GCFPort; -class GTMTimer; - -/** - * This is the abstract base class for all concrete port implementations (like - * TCP, shared memory). A concrete raw port can be a slave of the GCFPort class - * or a master of itself. If it is a slave than the GCFPort has created the - * concrete raw port to hide the transport mechanism. Otherwise the concrete raw - * port is deliberate instantiated by a concrete task. - */ -class GCFRawPort : public GCFPortInterface -{ - public: - /** @param protocol NOT USED */ - GCFRawPort (GCFTask& task, - string& name, - TPortType type, - int protocol = 0); - - GCFRawPort (); - - virtual ~GCFRawPort (); - - /** @param protocol NOT USED */ - void init (GCFTask& task, - string name, - TPortType type, - int protocol = 0 ); - - /// GCFPortInterface methods - - /** - * Timer functions. - * Upon expiration of a timer a F_TIMER_SIG will be - * received on the port. - */ - virtual long setTimer (long delay_sec, - long delay_usec = 0, - long interval_sec = 0, - long interval_usec = 0, - const void* arg = 0); - - virtual long setTimer (double delay_seconds, - double interval_seconds = 0.0, - const void* arg = 0); - - virtual int cancelTimer (long timerid, - const void** arg = 0); - - virtual int cancelAllTimers (); - - virtual int resetTimerInterval (long timerid, - long sec, - long usec = 0); - - - protected: - friend class GCFPort; // to access the setMaster method - friend class GTMTimer; - - void schedule_disconnected(); - void schedule_close(); - void schedule_connected(); - - inline bool isSlave () const {return _pMaster != 0;} - virtual void setMaster (GCFPort* pMaster); - virtual GCFEvent::TResult dispatch (GCFEvent& event); - bool findAddr (GCFPeerAddr& addr); - - private: - - /** - * Don't allow copying this object. - */ - GCFRawPort (const GCFRawPort&); - GCFRawPort& operator= (const GCFRawPort&); - - GCFPort* _pMaster; -}; - -#endif diff --git a/MAC/GCF/_CoreComps/TM/src/Socket/GCF_TCPPort.h b/MAC/GCF/_CoreComps/TM/src/Socket/GCF_TCPPort.h deleted file mode 100644 index 4d06e398526c032591fa18ae454e0d9f80477d8e..0000000000000000000000000000000000000000 --- a/MAC/GCF/_CoreComps/TM/src/Socket/GCF_TCPPort.h +++ /dev/null @@ -1,104 +0,0 @@ -//# GCF_TCPPort.h: TCP connection to a remote process -//# -//# Copyright (C) 2002-2003 -//# ASTRON (Netherlands Foundation for Research in Astronomy) -//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl -//# -//# This program is free software; you can redistribute it and/or modify -//# it under the terms of the GNU General Public License as published by -//# the Free Software Foundation; either version 2 of the License, or -//# (at your option) any later version. -//# -//# This program is distributed in the hope that it will be useful, -//# but WITHOUT ANY WARRANTY; without even the implied warranty of -//# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -//# GNU General Public License for more details. -//# -//# You should have received a copy of the GNU General Public License -//# along with this program; if not, write to the Free Software -//# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -//# -//# $Id$ - -#ifndef GCF_TCPPORT_H -#define GCF_TCPPORT_H - -#include <lofar_config.h> -#ifdef HAVE_LOFAR_TM -#include <TM/PortInterface/GCF_RawPort.h> -#else -#include <GCF_RawPort.h> -#endif - -#include <Common/lofar_string.h> - -// forward declaration -class GCFTask; -class GTMSocket; -class GCFEvent; - -/** - * This is the class, which implements the special port with the TCP message - * transport protocol. It uses socket pattern to do this. Is can act as MSPP - * (port provider), SPP (server) and SAP (client). - */ -class GCFTCPPort : public GCFRawPort -{ - public: - - /// Construction methods - /** @param protocol NOT USED */ - GCFTCPPort (GCFTask& task, - string name, - TPortType type, - int protocol = 0); - GCFTCPPort (); - - virtual ~GCFTCPPort (); - - public: - - /** - * open/close functions - */ - virtual int open (); - virtual int close (); - - virtual int accept (GCFTCPPort& port); - /** - * send/recv functions - */ - virtual ssize_t send (const GCFEvent& event, - void* buf = 0, - size_t count = 0); - virtual ssize_t sendv (const GCFEvent& e, - const iovec buffers[], - int n); - virtual ssize_t recv (void* buf, - size_t count); - virtual ssize_t recvv (iovec buffers[], - int n); - public: - - // addr is local address if getType == (M)SPP - // addr is remote addres if getType == SAP - void setAddr (const GCFPeerAddr& addr); - - protected: - friend class GTMSocket; - friend class GTMServerSocket; - - private: - /** - * Don't allow copying this object. - */ - GCFTCPPort (const GCFTCPPort&); - GCFTCPPort& operator= (const GCFTCPPort&); - - private: - bool _addrIsSet; - GTMSocket* _pSocket; - GCFPeerAddr _addr; -}; - -#endif diff --git a/MAC/GCF/_CoreComps/lofarconf.in b/MAC/GCF/_CoreComps/lofarconf.in deleted file mode 100644 index be061b3fd3d3fb1bb9a0b9f388e91206f98e3be9..0000000000000000000000000000000000000000 --- a/MAC/GCF/_CoreComps/lofarconf.in +++ /dev/null @@ -1,4 +0,0 @@ -TM -SAL -PA -PML diff --git a/MAC/Test/GCF/DEPENDENCIES b/MAC/Test/GCF/DEPENDENCIES index 16c3e1643c77aeba9db04119d647bc0a877f38c6..fb44ee82e7a6cdac67f519d18e5b031a59355b08 100644 --- a/MAC/Test/GCF/DEPENDENCIES +++ b/MAC/Test/GCF/DEPENDENCIES @@ -4,13 +4,8 @@ Because the 3.2 is already installed with RedHat 8.0 the gcc and g++ of the comp installation must be renamed (to for instance gcc296 and g++296). EXTERNAL PACKAGES: -PVSS II 2.12.1 - > export PATH=$PATH:<pvss root>/bin - > export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:<pvss root>/bin - > export API_ROOT=<pvss root>/api - - if no pvss project exist yet which is prepared for using GCF - > newproj <project path> - > export PVSS_II=<project path>/config/config - > start_pvss2 - > PVSS00ascii -in LofarPropertyTypes.pvss - - now the started project is ready for GCF \ No newline at end of file +PVSS II 2.12.1 (see MAC/GCF) +LCS/Common +MAC/Tools/LofarLogger +MAC/GCF +log4cplus \ No newline at end of file diff --git a/MAC/Test/GCF/configure.in b/MAC/Test/GCF/configure.in index fbcc55ca5d1766db830fbe55f54e265a539ddb7f..44baf1b74c78dd80a3a65405adb337e875a7c652 100644 --- a/MAC/Test/GCF/configure.in +++ b/MAC/Test/GCF/configure.in @@ -56,7 +56,8 @@ lofar_QATOOLS lofar_DOCXX lofar_MPI(0) lofar_PVSS(1) -lofar_PACKAGE(MAC/GCF/CoreComps/PML) +lofar_PACKAGE(MAC/Tools/LofarLogger) +lofar_EXTERNAL(gcf,1,GCF/GCF_Task.h,,~/workspace3/LOFAR/installed/gnu_debug) dnl dnl Output Makefiles diff --git a/MAC/Test/GCF/src/Answer.cc b/MAC/Test/GCF/src/Answer.cc new file mode 100644 index 0000000000000000000000000000000000000000..9d962e2f133462d8600bac6154fc7e7b976bb14d --- /dev/null +++ b/MAC/Test/GCF/src/Answer.cc @@ -0,0 +1,7 @@ +#include "Answer.h" +#include "SupervisedTask.h" + +void Answer::handleAnswer(GCFEvent& answer) +{ + _st.handleAnswer(answer); +} diff --git a/MAC/Test/GCF/src/Answer.h b/MAC/Test/GCF/src/Answer.h new file mode 100644 index 0000000000000000000000000000000000000000..383bbe137afd9ebd6d19cff70027253acc929cb0 --- /dev/null +++ b/MAC/Test/GCF/src/Answer.h @@ -0,0 +1,23 @@ +#ifndef ANSWER_H +#define ANSWER_H + +#include <GCF/GCF_Answer.h> + +class GCFEvent; +class SupervisedTask; + +class Answer : public GCFAnswer +{ + public: + Answer(SupervisedTask& st) : + _st(st) + {;} + + ~Answer() {;} + + void handleAnswer(GCFEvent& answer); + + private: + SupervisedTask& _st; +}; +#endif diff --git a/MAC/Test/GCF/src/Application1.cc b/MAC/Test/GCF/src/Application1.cc index 32ca9e088120b2935c4c1d1f4f68c965f4f74341..e61d2badd6ee3e83452aaffbdc23047ac725334d 100644 --- a/MAC/Test/GCF/src/Application1.cc +++ b/MAC/Test/GCF/src/Application1.cc @@ -1,8 +1,10 @@ #include "Application1.h" #include "Defines.h" -#include <SAL/GCF_PVInteger.h> -#include <SAL/GCF_PVChar.h> -#include <SAL/GCF_PVDouble.h> +#include <GCF/GCF_PVInteger.h> +#include <GCF/GCF_PVChar.h> +#include <GCF/GCF_PVDouble.h> +#include <GCF/GCF_Property.h> +#include <GCF/GCF_MyProperty.h> #include <math.h> #define DECLARE_SIGNAL_NAMES #include "TST_Protocol.ph" @@ -26,7 +28,15 @@ Application::Application() : _passed(0), _failed(0), _counter(0), - _curRemoteTestNr(0) + _curRemoteTestNr(0), + _propertySetA1(propertySetA1, &_supTask1.getAnswerObj()), + _propertySetE1(propertySetE1, &_supTask1.getAnswerObj()), + _propertySetB1(propertySetB1, &_supTask1.getAnswerObj()), + _propertySetB2(propertySetB2, &_supTask2.getAnswerObj()), + _propertySetB3(propertySetB3, &_supTask2.getAnswerObj()), + _propertySetB4(propertySetB4, &_supTask2.getAnswerObj()), + _apcT1("ApcT1", "A_C", &_supTask2.getAnswerObj()), + _apcT3("ApcT3", "A_H", &_supTask1.getAnswerObj()) { // register the protocol for debugging purposes registerProtocol(TST_PROTOCOL, TST_PROTOCOL_signalnames); @@ -60,7 +70,7 @@ GCFEvent::TResult Application::test101(GCFEvent& e, GCFPortInterface& p) switch (e.signal) { case F_ENTRY_SIG: - if (_supTask1.loadMyProperties(propertySetA1) != GCF_NO_ERROR) + if (_propertySetA1.load() != GCF_NO_ERROR) { failed(101); TRAN(Application::test102); @@ -71,9 +81,9 @@ GCFEvent::TResult Application::test101(GCFEvent& e, GCFPortInterface& p) } break; - case F_MYLOADED_SIG: + case F_MYPLOADED_SIG: { - GCFPMLMYPAnswerEvent* pResponse = static_cast<GCFPMLMYPAnswerEvent*>(&e); + GCFMYPropAnswerEvent* pResponse = static_cast<GCFMYPropAnswerEvent*>(&e); assert(pResponse); if (ready) { TRAN(Application::test102); break;} if ((strcmp(pResponse->pScope, propertySetA1.scope) == 0) && @@ -110,7 +120,7 @@ GCFEvent::TResult Application::test102(GCFEvent& e, GCFPortInterface& p) switch (e.signal) { case F_ENTRY_SIG: - if (_supTask1.unloadMyProperties(propertySetA1.scope) != GCF_NO_ERROR) + if (_propertySetA1.unload() != GCF_NO_ERROR) { failed(102); TRAN(Application::test103); @@ -121,9 +131,9 @@ GCFEvent::TResult Application::test102(GCFEvent& e, GCFPortInterface& p) } break; - case F_MYUNLOADED_SIG: + case F_MYPUNLOADED_SIG: { - GCFPMLMYPAnswerEvent* pResponse = static_cast<GCFPMLMYPAnswerEvent*>(&e); + GCFMYPropAnswerEvent* pResponse = static_cast<GCFMYPropAnswerEvent*>(&e); assert(pResponse); if (ready) { TRAN(Application::test103); break;} if ((strcmp(pResponse->pScope, propertySetA1.scope) == 0) && @@ -161,7 +171,7 @@ GCFEvent::TResult Application::test103(GCFEvent& e, GCFPortInterface& p) switch (e.signal) { case F_ENTRY_SIG: - if (_supTask1.loadMyProperties(propertySetB1) != GCF_NO_ERROR) + if (_propertySetB1.load() != GCF_NO_ERROR) { failed(103); TRAN(Application::test104); @@ -169,7 +179,7 @@ GCFEvent::TResult Application::test103(GCFEvent& e, GCFPortInterface& p) else { _counter = 1; - if (_supTask1.loadMyProperties(propertySetB1) == GCF_NO_ERROR) + if (_propertySetB1.load() == GCF_NO_ERROR) { _counter = 2; } @@ -177,9 +187,9 @@ GCFEvent::TResult Application::test103(GCFEvent& e, GCFPortInterface& p) } break; - case F_MYLOADED_SIG: + case F_MYPLOADED_SIG: { - GCFPMLMYPAnswerEvent* pResponse = static_cast<GCFPMLMYPAnswerEvent*>(&e); + GCFMYPropAnswerEvent* pResponse = static_cast<GCFMYPropAnswerEvent*>(&e); assert(pResponse); if (ready) { TRAN(Application::test103); break;} if ((strcmp(pResponse->pScope, propertySetB1.scope) == 0) && @@ -218,7 +228,7 @@ GCFEvent::TResult Application::test104(GCFEvent& e, GCFPortInterface& p) switch (e.signal) { case F_ENTRY_SIG: - if (_supTask1.loadMyProperties(propertySetA1) != GCF_NO_ERROR) + if (_propertySetA1.load() != GCF_NO_ERROR) { failed(104); TRAN(Application::test105); @@ -230,9 +240,9 @@ GCFEvent::TResult Application::test104(GCFEvent& e, GCFPortInterface& p) _counter = 1; break; - case F_MYLOADED_SIG: + case F_MYPLOADED_SIG: { - GCFPMLMYPAnswerEvent* pResponse = static_cast<GCFPMLMYPAnswerEvent*>(&e); + GCFMYPropAnswerEvent* pResponse = static_cast<GCFMYPropAnswerEvent*>(&e); assert(pResponse); switch (_counter) { @@ -241,7 +251,7 @@ GCFEvent::TResult Application::test104(GCFEvent& e, GCFPortInterface& p) (pResponse->result == GCF_NO_ERROR) && (&p == &_supTask1.getPort())) { - if (_supTask1.loadMyProperties(propertySetB2) != GCF_NO_ERROR) + if (_propertySetB2.load() != GCF_NO_ERROR) { failed(104); TRAN(Application::test105); @@ -253,9 +263,9 @@ GCFEvent::TResult Application::test104(GCFEvent& e, GCFPortInterface& p) case 2: if ((strcmp(pResponse->pScope, propertySetB2.scope) == 0) && (pResponse->result == GCF_NO_ERROR) && - (&p == &_supTask1.getPort())) + (&p == &_supTask2.getPort())) { - if (_supTask2.loadMyProperties(propertySetB3) != GCF_NO_ERROR) + if (_propertySetB3.load() != GCF_NO_ERROR) { failed(104); TRAN(Application::test105); @@ -269,7 +279,7 @@ GCFEvent::TResult Application::test104(GCFEvent& e, GCFPortInterface& p) (pResponse->result == GCF_NO_ERROR) && (&p == &_supTask2.getPort())) { - if (_supTask2.loadMyProperties(propertySetB4) != GCF_NO_ERROR) + if (_propertySetB4.load() != GCF_NO_ERROR) { failed(104); TRAN(Application::test105); @@ -283,7 +293,7 @@ GCFEvent::TResult Application::test104(GCFEvent& e, GCFPortInterface& p) (pResponse->result == GCF_NO_ERROR) && (&p == &_supTask2.getPort())) { - if (_supTask1.unloadMyProperties(propertySetA1.scope) != GCF_NO_ERROR) + if (_propertySetA1.unload() != GCF_NO_ERROR) { failed(104); TRAN(Application::test105); @@ -294,9 +304,9 @@ GCFEvent::TResult Application::test104(GCFEvent& e, GCFPortInterface& p) } break; } - case F_MYUNLOADED_SIG: + case F_MYPUNLOADED_SIG: { - GCFPMLMYPAnswerEvent* pResponse = static_cast<GCFPMLMYPAnswerEvent*>(&e); + GCFMYPropAnswerEvent* pResponse = static_cast<GCFMYPropAnswerEvent*>(&e); assert(pResponse); switch (_counter) { @@ -305,7 +315,7 @@ GCFEvent::TResult Application::test104(GCFEvent& e, GCFPortInterface& p) (pResponse->result == GCF_NO_ERROR) && (&p == &_supTask1.getPort())) { - if (_supTask1.unloadMyProperties(propertySetB2.scope) != GCF_NO_ERROR) + if (_propertySetB2.unload() != GCF_NO_ERROR) { failed(104); TRAN(Application::test105); @@ -317,9 +327,9 @@ GCFEvent::TResult Application::test104(GCFEvent& e, GCFPortInterface& p) case 6: if ((strcmp(pResponse->pScope, propertySetB2.scope) == 0) && (pResponse->result == GCF_NO_ERROR) && - (&p == &_supTask1.getPort())) + (&p == &_supTask2.getPort())) { - if (_supTask2.unloadMyProperties(propertySetB3.scope) != GCF_NO_ERROR) + if (_propertySetB3.unload() != GCF_NO_ERROR) { failed(104); TRAN(Application::test105); @@ -333,7 +343,7 @@ GCFEvent::TResult Application::test104(GCFEvent& e, GCFPortInterface& p) (pResponse->result == GCF_NO_ERROR) && (&p == &_supTask2.getPort())) { - if (_supTask2.unloadMyProperties(propertySetB4.scope) != GCF_NO_ERROR) + if (_propertySetB4.unload() != GCF_NO_ERROR) { failed(104); TRAN(Application::test105); @@ -379,7 +389,7 @@ GCFEvent::TResult Application::test105(GCFEvent& e, GCFPortInterface& p) switch (e.signal) { case F_ENTRY_SIG: - if (_supTask1.loadMyProperties(propertySetA1) != GCF_NO_ERROR) + if (_propertySetA1.load() != GCF_NO_ERROR) { failed(105); TRAN(Application::test201); @@ -388,9 +398,9 @@ GCFEvent::TResult Application::test105(GCFEvent& e, GCFPortInterface& p) _counter = 1; break; - case F_MYLOADED_SIG: + case F_MYPLOADED_SIG: { - GCFPMLMYPAnswerEvent* pResponse = static_cast<GCFPMLMYPAnswerEvent*>(&e); + GCFMYPropAnswerEvent* pResponse = static_cast<GCFMYPropAnswerEvent*>(&e); assert(pResponse); switch (_counter) { @@ -399,7 +409,7 @@ GCFEvent::TResult Application::test105(GCFEvent& e, GCFPortInterface& p) (pResponse->result == GCF_NO_ERROR) && (&p == &_supTask1.getPort())) { - if (_supTask1.loadMyProperties(propertySetB2) != GCF_NO_ERROR) + if (_propertySetB2.load() != GCF_NO_ERROR) { failed(105); TRAN(Application::test201); @@ -412,7 +422,7 @@ GCFEvent::TResult Application::test105(GCFEvent& e, GCFPortInterface& p) case 2: if ((strcmp(pResponse->pScope, propertySetB2.scope) == 0) && (pResponse->result == GCF_NO_ERROR) && - (&p == &_supTask1.getPort())) + (&p == &_supTask2.getPort())) { passed(105); } @@ -443,14 +453,14 @@ GCFEvent::TResult Application::test105(GCFEvent& e, GCFPortInterface& p) return status; } -GCFEvent::TResult Application::test201(GCFEvent& e, GCFPortInterface& p) +GCFEvent::TResult Application::test201(GCFEvent& e, GCFPortInterface& /*p*/) { GCFEvent::TResult status = GCFEvent::HANDLED; switch (e.signal) { case F_ENTRY_SIG: - skiped(201); + skipped(201); TRAN(Application::test202); break; @@ -470,14 +480,14 @@ GCFEvent::TResult Application::test201(GCFEvent& e, GCFPortInterface& p) return status; } -GCFEvent::TResult Application::test202(GCFEvent& e, GCFPortInterface& p) +GCFEvent::TResult Application::test202(GCFEvent& e, GCFPortInterface& /*p*/) { GCFEvent::TResult status = GCFEvent::HANDLED; switch (e.signal) { case F_ENTRY_SIG: - skiped(202); + skipped(202); TRAN(Application::test203); break; @@ -497,14 +507,14 @@ GCFEvent::TResult Application::test202(GCFEvent& e, GCFPortInterface& p) return status; } -GCFEvent::TResult Application::test203(GCFEvent& e, GCFPortInterface& p) +GCFEvent::TResult Application::test203(GCFEvent& e, GCFPortInterface& /*p*/) { GCFEvent::TResult status = GCFEvent::HANDLED; switch (e.signal) { case F_ENTRY_SIG: - skiped(203); + skipped(203); TRAN(Application::test204); break; @@ -524,14 +534,14 @@ GCFEvent::TResult Application::test203(GCFEvent& e, GCFPortInterface& p) return status; } -GCFEvent::TResult Application::test204(GCFEvent& e, GCFPortInterface& p) +GCFEvent::TResult Application::test204(GCFEvent& e, GCFPortInterface& /*p*/) { GCFEvent::TResult status = GCFEvent::HANDLED; switch (e.signal) { case F_ENTRY_SIG: - skiped(204); + skipped(204); TRAN(Application::test205); break; @@ -568,7 +578,7 @@ GCFEvent::TResult Application::test205(GCFEvent& e, GCFPortInterface& p) } case F_ENTRY_SIG: if (_curRemoteTestNr == 0) break; - if (_supTask2.loadAPC("ApcT1-D", "A_C") != GCF_NO_ERROR) + if (_apcT1.load() != GCF_NO_ERROR) { failed(205); TRAN(Application::test206); @@ -578,19 +588,18 @@ GCFEvent::TResult Application::test205(GCFEvent& e, GCFPortInterface& p) case F_APCLOADED_SIG: { - GCFPMLAPCAnswerEvent* pResponse = static_cast<GCFPMLAPCAnswerEvent*>(&e); + GCFAPCAnswerEvent* pResponse = static_cast<GCFAPCAnswerEvent*>(&e); assert(pResponse); switch (_counter) { case 1: if ((strcmp(pResponse->pScope, "A_C") == 0) && - (strcmp(pResponse->pApcName, "ApcT1-D") == 0) && + (strcmp(pResponse->pApcName, "ApcT1") == 0) && (pResponse->result == GCF_NO_ERROR) && (&p == &_supTask2.getPort())) { - CHECK_DB; - - if (_supTask2.unloadAPC("ApcT1", "A_C") != GCF_NO_ERROR) + CHECK_DB; + if (_apcT1.unload() != GCF_NO_ERROR) { failed(204); TRAN(Application::test205); @@ -609,7 +618,7 @@ GCFEvent::TResult Application::test205(GCFEvent& e, GCFPortInterface& p) case F_APCUNLOADED_SIG: { - GCFPMLAPCAnswerEvent* pResponse = static_cast<GCFPMLAPCAnswerEvent*>(&e); + GCFAPCAnswerEvent* pResponse = static_cast<GCFAPCAnswerEvent*>(&e); assert(pResponse); switch (_counter) { @@ -659,7 +668,7 @@ GCFEvent::TResult Application::test206(GCFEvent& e, GCFPortInterface& p) TSTTestreadyEvent* pIndication = static_cast<TSTTestreadyEvent*>(&e); assert(pIndication); _curRemoteTestNr = pIndication->testnr; - if (_supTask2.loadAPC("ApcT1-D", "A_C") != GCF_NO_ERROR) + if (_apcT1.load() != GCF_NO_ERROR) { failed(206); TRAN(Application::test207); @@ -672,18 +681,17 @@ GCFEvent::TResult Application::test206(GCFEvent& e, GCFPortInterface& p) } case F_APCLOADED_SIG: { - GCFPMLAPCAnswerEvent* pResponse = static_cast<GCFPMLAPCAnswerEvent*>(&e); + GCFAPCAnswerEvent* pResponse = static_cast<GCFAPCAnswerEvent*>(&e); assert(pResponse); if (_counter == 1) { if ((strcmp(pResponse->pScope, "A_C") == 0) && - (strcmp(pResponse->pApcName, "ApcT1-D") == 0) && + (strcmp(pResponse->pApcName, "ApcT1") == 0) && (pResponse->result == GCF_NO_ERROR) && (&p == &_supTask2.getPort())) { - CHECK_DB - - if (_supTask2.unloadAPC("ApcT1", "A_C") != GCF_NO_ERROR) + CHECK_DB; + if (_apcT1.unload() != GCF_NO_ERROR) { failed(206); TRAN(Application::test207); @@ -701,7 +709,7 @@ GCFEvent::TResult Application::test206(GCFEvent& e, GCFPortInterface& p) case F_APCUNLOADED_SIG: { - GCFPMLAPCAnswerEvent* pResponse = static_cast<GCFPMLAPCAnswerEvent*>(&e); + GCFAPCAnswerEvent* pResponse = static_cast<GCFAPCAnswerEvent*>(&e); assert(pResponse); if (_counter == 2) { @@ -710,7 +718,7 @@ GCFEvent::TResult Application::test206(GCFEvent& e, GCFPortInterface& p) (pResponse->result == GCF_NO_ERROR) && (&p == &_supTask2.getPort())) { - CHECK_DB + CHECK_DB; passed(206); } else @@ -735,14 +743,14 @@ GCFEvent::TResult Application::test206(GCFEvent& e, GCFPortInterface& p) return status; } -GCFEvent::TResult Application::test207(GCFEvent& e, GCFPortInterface& p) +GCFEvent::TResult Application::test207(GCFEvent& e, GCFPortInterface& /*p*/) { GCFEvent::TResult status = GCFEvent::HANDLED; switch (e.signal) { case F_ENTRY_SIG: - skiped(207); + skipped(207); TRAN(Application::test208); break; @@ -776,8 +784,7 @@ GCFEvent::TResult Application::test208(GCFEvent& e, GCFPortInterface& p) } case F_ENTRY_SIG: if (_curRemoteTestNr != 208) break; - - if (_supTask1.loadAPC("ApcT3", "A_H") != GCF_NO_ERROR) + if (_apcT3.load(false) != GCF_NO_ERROR) { failed(208); TRAN(Application::test301); @@ -789,7 +796,7 @@ GCFEvent::TResult Application::test208(GCFEvent& e, GCFPortInterface& p) break; case F_APCLOADED_SIG: { - GCFPMLAPCAnswerEvent* pResponse = static_cast<GCFPMLAPCAnswerEvent*>(&e); + GCFAPCAnswerEvent* pResponse = static_cast<GCFAPCAnswerEvent*>(&e); assert(pResponse); if (_counter == 1) { @@ -800,7 +807,7 @@ GCFEvent::TResult Application::test208(GCFEvent& e, GCFPortInterface& p) { CHECK_DB - if (_supTask1.unloadAPC("ApcT3", "A_H") != GCF_NO_ERROR) + if (_apcT3.unload() != GCF_NO_ERROR) { failed(208); TRAN(Application::test301); @@ -821,7 +828,7 @@ GCFEvent::TResult Application::test208(GCFEvent& e, GCFPortInterface& p) case F_APCUNLOADED_SIG: { - GCFPMLAPCAnswerEvent* pResponse = static_cast<GCFPMLAPCAnswerEvent*>(&e); + GCFAPCAnswerEvent* pResponse = static_cast<GCFAPCAnswerEvent*>(&e); assert(pResponse); if (_counter == 2) { @@ -848,7 +855,7 @@ GCFEvent::TResult Application::test208(GCFEvent& e, GCFPortInterface& p) return status; } -GCFEvent::TResult Application::test209(GCFEvent& e, GCFPortInterface& p) +GCFEvent::TResult Application::test209(GCFEvent& e, GCFPortInterface& /*p*/) { GCFEvent::TResult status = GCFEvent::HANDLED; @@ -865,7 +872,7 @@ GCFEvent::TResult Application::test209(GCFEvent& e, GCFPortInterface& p) return status; } -GCFEvent::TResult Application::test210(GCFEvent& e, GCFPortInterface& p) +GCFEvent::TResult Application::test210(GCFEvent& e, GCFPortInterface& /*p*/) { GCFEvent::TResult status = GCFEvent::HANDLED; @@ -886,10 +893,12 @@ GCFEvent::TResult Application::test301(GCFEvent& e, GCFPortInterface& p) { GCFEvent::TResult status = GCFEvent::HANDLED; + GCFPValue* pValue; + switch (e.signal) { case F_ENTRY_SIG: - if (_supTask1.unloadMyProperties(propertySetB1.scope) != GCF_NO_ERROR) + if (_propertySetB1.unload() != GCF_NO_ERROR) { failed(301); TRAN(Application::test302); @@ -898,15 +907,15 @@ GCFEvent::TResult Application::test301(GCFEvent& e, GCFPortInterface& p) _counter = 1; break; - case F_MYUNLOADED_SIG: + case F_MYPUNLOADED_SIG: { - GCFPMLMYPAnswerEvent* pResponse = static_cast<GCFPMLMYPAnswerEvent*>(&e); + GCFMYPropAnswerEvent* pResponse = static_cast<GCFMYPropAnswerEvent*>(&e); assert(pResponse); if ((strcmp(pResponse->pScope, propertySetB1.scope) == 0) && (pResponse->result == GCF_NO_ERROR) && (&p == &_supTask1.getPort())) { - if (_supTask1.loadMyProperties(propertySetB1) != GCF_NO_ERROR) + if (_propertySetB1.load() != GCF_NO_ERROR) { failed(301); TRAN(Application::test302); @@ -920,19 +929,96 @@ GCFEvent::TResult Application::test301(GCFEvent& e, GCFPortInterface& p) break; } - case F_MYLOADED_SIG: + case F_MYPLOADED_SIG: { - GCFPMLMYPAnswerEvent* pResponse = static_cast<GCFPMLMYPAnswerEvent*>(&e); + GCFMYPropAnswerEvent* pResponse = static_cast<GCFMYPropAnswerEvent*>(&e); assert(pResponse); if ((strcmp(pResponse->pScope, propertySetB1.scope) == 0) && (pResponse->result == GCF_NO_ERROR) && (&p == &_supTask1.getPort())) { - if (_supTask1.get("A_C_P1") != GCF_NO_ERROR) + // A_C_P1 section start + pValue = _propertySetB1.getValue("P1"); // its a clone + assert(pValue); + if (((GCFPVInteger*)pValue)->getValue() != 11) + { + failed(301); + TRAN(Application::test302); + } + delete pValue; + GCFPVInteger iv(12); + if (_propertySetB1.setValue("P1", iv) != GCF_NO_ERROR) { failed(301); TRAN(Application::test302); } + pValue = _propertySetB1.getValue("P1"); // its a clone + assert(pValue); + if (((GCFPVInteger*)pValue)->getValue() != 12) + { + failed(301); + TRAN(Application::test302); + } + delete pValue; + + // A_C_P2 section start + GCFMyProperty* pProperty(0); + pProperty = static_cast<GCFMyProperty*>(_propertySetB1.getProperty("A_C_P2")); + assert(pProperty); + pValue = pProperty->getValue(); // its a clone + assert(pValue); + if (((GCFPVChar*)pValue)->getValue() != 25) + { + failed(301); + TRAN(Application::test302); + break; + } + delete pValue; + GCFPVChar cv(26); + if (_propertySetB1.setValue("P2", cv) != GCF_NO_ERROR) + { + failed(301); + TRAN(Application::test302); + break; + } + pValue = _propertySetB1.getValue("P2"); // its a clone + assert(pValue); + if (((GCFPVChar*)pValue)->getValue() != 26) + { + failed(301); + TRAN(Application::test302); + break; + } + delete pValue; + // A_C_P3 section start + pValue = _propertySetB1.getValue("A_C_P3"); + assert(pValue); + if (((GCFPVDouble*)pValue)->getValue() != 33.3) + { + failed(301); + TRAN(Application::test302); + break; + } + delete pValue; + GCFPVDouble dv(33.4); + if (_propertySetB1.setValue("P3", dv) != GCF_NO_ERROR) + { + failed(301); + TRAN(Application::test302); + break; + } + pValue = _propertySetB1.getValue("P3"); // its a clone + assert(pValue); + if (((GCFPVDouble*)pValue)->getValue() != 33.4) + { + failed(301); + TRAN(Application::test302); + break; + } + delete pValue; + + passed(301); + TRAN(Application::test302); } else { @@ -942,147 +1028,6 @@ GCFEvent::TResult Application::test301(GCFEvent& e, GCFPortInterface& p) break; } - case F_VGETRESP_SIG: - { - GCFPMLValueEvent* pResponse = static_cast<GCFPMLValueEvent*>(&e); - assert(pResponse); - switch (_counter) - { - case 1: - if ((pResponse->pValue->getType() == GCFPValue::LPT_INTEGER) && - (strcmp(pResponse->pPropName, "A_C_P1") == 0) && - (((GCFPVInteger*)pResponse->pValue)->getValue() == 11) && - (&p == &_supTask1.getPort())) - { - GCFPVInteger iv(12); - if (_supTask1.set("A_C_P1", iv ) != GCF_NO_ERROR) - { - failed(301); - TRAN(Application::test302); - } - else if (_supTask1.get("A_C_P1") != GCF_NO_ERROR) - { - failed(301); - TRAN(Application::test302); - } - else - _counter = 2; - } - else - { - failed(301); - TRAN(Application::test302); - } - break; - case 2: - if ((pResponse->pValue->getType() == GCFPValue::LPT_INTEGER) && - (strcmp(pResponse->pPropName, "A_C_P1") == 0) && - (((GCFPVInteger*)pResponse->pValue)->getValue() == 12) && - (&p == &_supTask1.getPort())) - { - if (_supTask1.get("A_C_P2") != GCF_NO_ERROR) - { - failed(301); - TRAN(Application::test302); - } - else - _counter = 3; - } - else - { - failed(301); - TRAN(Application::test302); - } - break; - case 3: - if ((pResponse->pValue->getType() == GCFPValue::LPT_CHAR) && - (strcmp(pResponse->pPropName, "A_C_P2") == 0) && - (((GCFPVChar*)pResponse->pValue)->getValue() == 25) && - (&p == &_supTask1.getPort())) - { - GCFPVChar cv(26); - if (_supTask1.set("A_C_P2", cv ) != GCF_NO_ERROR) - { - failed(301); - TRAN(Application::test302); - } - else if (_supTask1.get("A_C_P2") != GCF_NO_ERROR) - { - failed(301); - TRAN(Application::test302); - } - else - _counter = 4; - } - else - { - failed(301); - TRAN(Application::test302); - } - break; - case 4: - if ((pResponse->pValue->getType() == GCFPValue::LPT_CHAR) && - (strcmp(pResponse->pPropName, "A_C_P2") == 0) && - (((GCFPVChar*)pResponse->pValue)->getValue() == 26) && - (&p == &_supTask1.getPort())) - { - if (_supTask1.get("A_C_P3") != GCF_NO_ERROR) - { - failed(301); - TRAN(Application::test302); - } - else - _counter = 5; - } - else - { - failed(301); - TRAN(Application::test302); - } - break; - case 5: - if ((pResponse->pValue->getType() == GCFPValue::LPT_DOUBLE) && - (strcmp(pResponse->pPropName, "A_C_P3") == 0) && - (((GCFPVDouble*)pResponse->pValue)->getValue() == 33.3) && - (&p == &_supTask1.getPort())) - { - GCFPVDouble dv(33.4); - if (_supTask1.set("A_C_P3", dv ) != GCF_NO_ERROR) - { - failed(301); - TRAN(Application::test302); - } - else if (_supTask1.get("A_C_P3") != GCF_NO_ERROR) - { - failed(301); - TRAN(Application::test302); - } - else - _counter = 6; - } - else - { - failed(301); - TRAN(Application::test302); - } - break; - case 6: - if ((pResponse->pValue->getType() == GCFPValue::LPT_DOUBLE) && - (strcmp(pResponse->pPropName, "A_C_P3") == 0) && - (((GCFPVDouble*)pResponse->pValue)->getValue() == 33.4) && - (&p == &_supTask1.getPort())) - { - passed(301); - } - else - { - failed(301); - } - TRAN(Application::test302); - break; - } - break; - } default: status = GCFEvent::NOT_HANDLED; break; @@ -1100,7 +1045,8 @@ GCFEvent::TResult Application::test302(GCFEvent& e, GCFPortInterface& p) switch (e.signal) { case F_ENTRY_SIG: - if (_supTask1.loadAPC("ApcT1", "A_C") != GCF_NO_ERROR) + _apcT1.setAnswer(&_supTask1.getAnswerObj()); + if (_apcT1.load(false) != GCF_NO_ERROR) { failed(302); TRAN(Application::test303); @@ -1109,21 +1055,21 @@ GCFEvent::TResult Application::test302(GCFEvent& e, GCFPortInterface& p) case F_APCLOADED_SIG: { - GCFPMLAPCAnswerEvent* pResponse = static_cast<GCFPMLAPCAnswerEvent*>(&e); + GCFAPCAnswerEvent* pResponse = static_cast<GCFAPCAnswerEvent*>(&e); assert(pResponse); if ((strcmp(pResponse->pScope, "A_C") == 0) && (strcmp(pResponse->pApcName, "ApcT1") == 0) && (pResponse->result == GCF_NO_ERROR) && (&p == &_supTask1.getPort())) { - CHECK_DB + CHECK_DB; GCFPVInteger iv(22); - if (_supTask2.set("A_C_P1", iv) != GCF_NO_ERROR) + if (_supTask2.getProxy().setPropValue("A_C_P1", iv) != GCF_NO_ERROR) { failed(302); TRAN(Application::test303); } - else if (_supTask2.get("A_C_P1") != GCF_NO_ERROR) + else if (_supTask2.getProxy().requestPropValue("A_C_P1") != GCF_NO_ERROR) { failed(302); TRAN(Application::test303); @@ -1135,23 +1081,23 @@ GCFEvent::TResult Application::test302(GCFEvent& e, GCFPortInterface& p) } case F_VGETRESP_SIG: { - GCFPMLValueEvent* pResponse = static_cast<GCFPMLValueEvent*>(&e); + GCFPropValueEvent* pResponse = static_cast<GCFPropValueEvent*>(&e); assert(pResponse); switch (_counter) { case 1: - if ((pResponse->pValue->getType() == GCFPValue::LPT_INTEGER) && + if ((pResponse->pValue->getType() == GCFPValue::INTEGER_VAL) && (strcmp(pResponse->pPropName, "A_C_P1") == 0) && (((GCFPVInteger*)pResponse->pValue)->getValue() == 22) && (&p == &_supTask2.getPort())) { GCFPVChar cv(22); - if (_supTask2.set("A_C_P2", cv) != GCF_NO_ERROR) + if (_supTask2.getProxy().setPropValue("A_C_P2", cv) != GCF_NO_ERROR) { failed(302); TRAN(Application::test303); } - else if (_supTask2.get("A_C_P2") != GCF_NO_ERROR) + else if (_supTask2.getProxy().requestPropValue("A_C_P2") != GCF_NO_ERROR) { failed(302); TRAN(Application::test303); @@ -1166,18 +1112,18 @@ GCFEvent::TResult Application::test302(GCFEvent& e, GCFPortInterface& p) } break; case 2: - if ((pResponse->pValue->getType() == GCFPValue::LPT_CHAR) && + if ((pResponse->pValue->getType() == GCFPValue::CHAR_VAL) && (strcmp(pResponse->pPropName, "A_C_P2") == 0) && (((GCFPVChar*)pResponse->pValue)->getValue() == 22) && (&p == &_supTask2.getPort())) { GCFPVDouble dv(22.0); - if (_supTask2.set("A_C_P3", dv) != GCF_NO_ERROR) + if (_supTask2.getProxy().setPropValue("A_C_P3", dv) != GCF_NO_ERROR) { failed(302); TRAN(Application::test303); } - else if (_supTask2.get("A_C_P3") != GCF_NO_ERROR) + else if (_supTask2.getProxy().requestPropValue("A_C_P3") != GCF_NO_ERROR) { failed(302); TRAN(Application::test303); @@ -1192,7 +1138,7 @@ GCFEvent::TResult Application::test302(GCFEvent& e, GCFPortInterface& p) } break; case 3: - if ((pResponse->pValue->getType() == GCFPValue::LPT_DOUBLE) && + if ((pResponse->pValue->getType() == GCFPValue::DOUBLE_VAL) && (strcmp(pResponse->pPropName, "A_C_P3") == 0) && (((GCFPVChar*)pResponse->pValue)->getValue() == 22.0) && (&p == &_supTask2.getPort())) @@ -1218,7 +1164,7 @@ GCFEvent::TResult Application::test302(GCFEvent& e, GCFPortInterface& p) } case F_VCHANGEMSG_SIG: { - GCFPMLValueEvent* pResponse = static_cast<GCFPMLValueEvent*>(&e); + GCFPropValueEvent* pResponse = static_cast<GCFPropValueEvent*>(&e); assert(pResponse); if ((strncmp(pResponse->pPropName, "A_C_P", 5) == 0) && (&p == &_supTask1.getPort())) @@ -1268,7 +1214,7 @@ GCFEvent::TResult Application::test303(GCFEvent& e, GCFPortInterface& p) if (_curRemoteTestNr == 303) { GCFPVInteger iv(22); - if (_supTask1.set("A_C_P1", iv) != GCF_NO_ERROR) + if (_supTask1.getProxy().setPropValue("A_C_P1", iv) != GCF_NO_ERROR) { failed(303); TRAN(Application::test304); @@ -1278,9 +1224,9 @@ GCFEvent::TResult Application::test303(GCFEvent& e, GCFPortInterface& p) } case F_VCHANGEMSG_SIG: { - GCFPMLValueEvent* pResponse = static_cast<GCFPMLValueEvent*>(&e); + GCFPropValueEvent* pResponse = static_cast<GCFPropValueEvent*>(&e); assert(pResponse); - if ((pResponse->pValue->getType() == GCFPValue::LPT_INTEGER) && + if ((pResponse->pValue->getType() == GCFPValue::INTEGER_VAL) && (strcmp(pResponse->pPropName, "A_C_P1") == 0) && (((GCFPVInteger*)pResponse->pValue)->getValue() == 22) && (&p == &_supTask1.getPort())) @@ -1313,7 +1259,7 @@ GCFEvent::TResult Application::test304(GCFEvent& e, GCFPortInterface& p) { case F_ENTRY_SIG: _counter = 0; - if (_supTask1.loadAPC("ApcT3", "A_H") != GCF_NO_ERROR) + if (_apcT3.load(false) != GCF_NO_ERROR) { failed(304); TRAN(Application::test305); @@ -1322,7 +1268,7 @@ GCFEvent::TResult Application::test304(GCFEvent& e, GCFPortInterface& p) case F_APCLOADED_SIG: { - GCFPMLAPCAnswerEvent* pResponse = static_cast<GCFPMLAPCAnswerEvent*>(&e); + GCFAPCAnswerEvent* pResponse = static_cast<GCFAPCAnswerEvent*>(&e); assert(pResponse); if ((strcmp(pResponse->pScope, "A_H") == 0) && (strcmp(pResponse->pApcName, "ApcT3") == 0) && @@ -1336,7 +1282,7 @@ GCFEvent::TResult Application::test304(GCFEvent& e, GCFPortInterface& p) for (unsigned int j = 0; j <= 9; j++) { propName[8] = j + '0'; - if (_supTask1.getProxy().subscribe(propName) == GCF_NO_ERROR) + if (_supTask1.getProxy().subscribeProp(propName) == GCF_NO_ERROR) { _counter++; } @@ -1352,7 +1298,7 @@ GCFEvent::TResult Application::test304(GCFEvent& e, GCFPortInterface& p) } case F_SUBSCRIBED_SIG: { - GCFPMLAnswerEvent* pResponse = static_cast<GCFPMLAnswerEvent*>(&e); + GCFPropAnswerEvent* pResponse = static_cast<GCFPropAnswerEvent*>(&e); assert(pResponse); if ((strncmp(pResponse->pPropName, "A_H_J_P", 7) == 0) && (&p == &_supTask1.getPort())) @@ -1373,9 +1319,9 @@ GCFEvent::TResult Application::test304(GCFEvent& e, GCFPortInterface& p) } case F_VCHANGEMSG_SIG: { - GCFPMLValueEvent* pResponse = static_cast<GCFPMLValueEvent*>(&e); + GCFPropValueEvent* pResponse = static_cast<GCFPropValueEvent*>(&e); assert(pResponse); - if ((pResponse->pValue->getType() == GCFPValue::LPT_DOUBLE) && + if ((pResponse->pValue->getType() == GCFPValue::DOUBLE_VAL) && (strncmp(pResponse->pPropName, "A_H_J_P", 7) == 0) && (&p == &_supTask1.getPort())) { @@ -1388,13 +1334,13 @@ GCFEvent::TResult Application::test304(GCFEvent& e, GCFPortInterface& p) } else { - cerr << "Propvalue: " << doubleVal << " PropNr: " << propNr << endl; + cerr << "Propvalue: " << dv * 100 << " PropNr: " << propNr << endl; nrOfFaults++; } } else { - cerr << "Propname fails " << pResponse->pPropName << endl; + cerr << "Propname fails" << pResponse->pPropName << endl; nrOfFaults++; } if (_counter == 100 ) @@ -1430,6 +1376,11 @@ GCFEvent::TResult Application::test305(GCFEvent& e, GCFPortInterface& p) GCFEvent::TResult status = GCFEvent::HANDLED; static unsigned int nrOfFaults = 0; + static GCFProperty propertyAHJP00_1("A_H_J_P00"); + propertyAHJP00_1.setAnswer(&_supTask1.getAnswerObj()); + static GCFProperty propertyAHJP00_2("A_H_J_P00"); + propertyAHJP00_2.setAnswer(&_supTask2.getAnswerObj()); + switch (e.signal) { case TST_TESTREADY: @@ -1441,7 +1392,7 @@ GCFEvent::TResult Application::test305(GCFEvent& e, GCFPortInterface& p) case F_ENTRY_SIG: if (_curRemoteTestNr != 305) break; _counter = 0; - if (_supTask1.getProxy().subscribe("A_H_J_P00") != GCF_NO_ERROR) + if (propertyAHJP00_1.subscribe() != GCF_NO_ERROR) { failed(305); TRAN(Application::test306); @@ -1450,13 +1401,13 @@ GCFEvent::TResult Application::test305(GCFEvent& e, GCFPortInterface& p) case F_SUBSCRIBED_SIG: { - GCFPMLAnswerEvent* pResponse = static_cast<GCFPMLAnswerEvent*>(&e); + GCFPropAnswerEvent* pResponse = static_cast<GCFPropAnswerEvent*>(&e); assert(pResponse); if ((strcmp(pResponse->pPropName, "A_H_J_P00") == 0)) { if (&p == &_supTask1.getPort()) { - if (_supTask2.getProxy().subscribe("A_H_J_P00") != GCF_NO_ERROR) + if (propertyAHJP00_2.subscribe() != GCF_NO_ERROR) { failed(305); TRAN(Application::test306); @@ -1478,9 +1429,9 @@ GCFEvent::TResult Application::test305(GCFEvent& e, GCFPortInterface& p) case F_VCHANGEMSG_SIG: { - GCFPMLValueEvent* pResponse = static_cast<GCFPMLValueEvent*>(&e); + GCFPropValueEvent* pResponse = static_cast<GCFPropValueEvent*>(&e); assert(pResponse); - if ((pResponse->pValue->getType() == GCFPValue::LPT_DOUBLE) && + if ((pResponse->pValue->getType() == GCFPValue::DOUBLE_VAL) && (strcmp(pResponse->pPropName, "A_H_J_P00") == 0) && (((GCFPVDouble*)pResponse->pValue)->getValue() == 3.12)) { @@ -1511,12 +1462,15 @@ GCFEvent::TResult Application::test305(GCFEvent& e, GCFPortInterface& p) return status; } -GCFEvent::TResult Application::test306(GCFEvent& e, GCFPortInterface& p) +GCFEvent::TResult Application::test306(GCFEvent& e, GCFPortInterface& /*p*/) { GCFEvent::TResult status = GCFEvent::HANDLED; static unsigned int nrOfFaults = 0; static unsigned int nrOfSucceded = 0; + static GCFProperty propertyACP1("A_C_P1"); + propertyACP1.setAnswer(&_supTask1.getAnswerObj()); + switch (e.signal) { case TST_TESTREADY: @@ -1528,7 +1482,7 @@ GCFEvent::TResult Application::test306(GCFEvent& e, GCFPortInterface& p) case F_ENTRY_SIG: if (_curRemoteTestNr != 306) break; - if (_supTask1.getProxy().subscribe("A_C_P1") != GCF_NO_ERROR) + if (propertyACP1.subscribe() != GCF_NO_ERROR) { failed(306); TRAN(Application::test403); @@ -1537,13 +1491,13 @@ GCFEvent::TResult Application::test306(GCFEvent& e, GCFPortInterface& p) case F_SUBSCRIBED_SIG: { - GCFPMLAnswerEvent* pResponse = static_cast<GCFPMLAnswerEvent*>(&e); + GCFPropAnswerEvent* pResponse = static_cast<GCFPropAnswerEvent*>(&e); assert(pResponse); _counter = 0; if ((strcmp(pResponse->pPropName, "A_C_P1") == 0)) { GCFPVInteger iv(_counter); - if (_supTask1.set("A_K_P1", iv) != GCF_NO_ERROR) + if (_supTask1.getProxy().setPropValue("A_K_P1", iv) != GCF_NO_ERROR) { failed(306); TRAN(Application::test403); @@ -1559,10 +1513,10 @@ GCFEvent::TResult Application::test306(GCFEvent& e, GCFPortInterface& p) case F_VCHANGEMSG_SIG: { - GCFPMLValueEvent* pResponse = static_cast<GCFPMLValueEvent*>(&e); + GCFPropValueEvent* pResponse = static_cast<GCFPropValueEvent*>(&e); assert(pResponse); if (pResponse->internal) break; - if ((pResponse->pValue->getType() == GCFPValue::LPT_INTEGER) && + if ((pResponse->pValue->getType() == GCFPValue::INTEGER_VAL) && (strcmp(pResponse->pPropName, "A_C_P1") == 0) && (((GCFPVInteger*)pResponse->pValue)->getValue() == _counter)) { @@ -1586,7 +1540,7 @@ GCFEvent::TResult Application::test306(GCFEvent& e, GCFPortInterface& p) else { GCFPVInteger iv(_counter); - if (_supTask1.set("A_K_P1", iv) != GCF_NO_ERROR) + if (_supTask1.getProxy().setPropValue("A_K_P1", iv) != GCF_NO_ERROR) { failed(306); TRAN(Application::test403); @@ -1724,14 +1678,13 @@ GCFEvent::TResult Application::test402(GCFEvent& e, GCFPortInterface& p) return status; } -GCFEvent::TResult Application::test403(GCFEvent& e, GCFPortInterface& p) +GCFEvent::TResult Application::test403(GCFEvent& e, GCFPortInterface& /*p*/) { GCFEvent::TResult status = GCFEvent::HANDLED; switch (e.signal) { case F_ENTRY_SIG: - GCFTask::stop(); break; default: diff --git a/MAC/Test/GCF/src/Application1.h b/MAC/Test/GCF/src/Application1.h index 6126c5755dbbe9e46c753dfc34df501bf01d75bc..9773b78d111b3259dbe10b8beee7c0f0af92a68a 100644 --- a/MAC/Test/GCF/src/Application1.h +++ b/MAC/Test/GCF/src/Application1.h @@ -1,8 +1,10 @@ #ifndef APPLICATION_H #define APPLICATION_H -#include <TM/GCF_Task.h> +#include <GCF/GCF_Task.h> #include "SupervisedTask.h" +#include <GCF/GCF_MyPropertySet.h> +#include <GCF/GCF_Apc.h> class GCFEvent; class GCFPortInterface; @@ -49,9 +51,9 @@ class Application : public GCFTask cerr << "Test " << failedTest << " failed\n"; _failed++; } - void skiped(unsigned int skipedTest) + void skipped(unsigned int skippedTest) { - cerr << "Nothing to do in test " << skipedTest << " => skiped\n"; + cerr << "Nothing to do in test " << skippedTest << " => skipped\n"; } private: SupervisedTask _supTask1; @@ -60,5 +62,13 @@ class Application : public GCFTask unsigned char _failed; unsigned char _counter; unsigned int _curRemoteTestNr; + GCFMyPropertySet _propertySetA1; + GCFMyPropertySet _propertySetE1; + GCFMyPropertySet _propertySetB1; + GCFMyPropertySet _propertySetB2; + GCFMyPropertySet _propertySetB3; + GCFMyPropertySet _propertySetB4; + GCFApc _apcT1; + GCFApc _apcT3; }; #endif diff --git a/MAC/Test/GCF/src/Application2.cc b/MAC/Test/GCF/src/Application2.cc index 17a2a00a8eb501aac524622b5d197cb03d508a2f..9442fbc83d36142913be4287171371c9c732dfde 100644 --- a/MAC/Test/GCF/src/Application2.cc +++ b/MAC/Test/GCF/src/Application2.cc @@ -1,7 +1,8 @@ #include "Application2.h" #include "Defines.h" -#include <SAL/GCF_PVInteger.h> -#include <SAL/GCF_PVDouble.h> +#include <GCF/GCF_PVInteger.h> +#include <GCF/GCF_PVDouble.h> +#include <GCF/GCF_Property.h> #include <math.h> #define DECLARE_SIGNAL_NAMES #include "TST_Protocol.ph" @@ -27,7 +28,15 @@ Application::Application() : _counter(0), _curRemoteTestNr(0), _pSTPort1(0), - _pSTPort2(0) + _pSTPort2(0), + _propertySetC1(propertySetC1, &_supTask3.getAnswerObj()), + _propertySetD1(propertySetD1, &_supTask3.getAnswerObj()), + _propertySetB4(propertySetB4, &_supTask3.getAnswerObj()), + _apcT1("ApcT1", "A_C", &_supTask3.getAnswerObj()), + _apcT1K("ApcT1", "A_K", &_supTask3.getAnswerObj()), + _apcT1a("ApcT1a", "A_C", &_supTask3.getAnswerObj()), + _apcT1b("ApcT1b", "A", &_supTask3.getAnswerObj()), + _apcT3("ApcT3", "A_H", &_supTask3.getAnswerObj()) { // register the protocol for debugging purposes registerProtocol(TST_PROTOCOL, TST_PROTOCOL_signalnames); @@ -59,7 +68,7 @@ GCFEvent::TResult Application::test101(GCFEvent& e, GCFPortInterface& /*p*/) switch (e.signal) { case F_ENTRY_SIG: - skiped(101); + skipped(101); TRAN(Application::test102); break; @@ -85,7 +94,7 @@ GCFEvent::TResult Application::test102(GCFEvent& e, GCFPortInterface& /*p*/) switch (e.signal) { case F_ENTRY_SIG: - skiped(102); + skipped(102); TRAN(Application::test103); break; @@ -111,7 +120,7 @@ GCFEvent::TResult Application::test103(GCFEvent& e, GCFPortInterface& /*p*/) switch (e.signal) { case F_ENTRY_SIG: - skiped(103); + skipped(103); TRAN(Application::test104); break; @@ -149,7 +158,7 @@ GCFEvent::TResult Application::test104(GCFEvent& e, GCFPortInterface& p) } case F_ENTRY_SIG: if (_curRemoteTestNr == 0) break; - if (_supTask3.loadMyProperties(propertySetC1) != GCF_NO_ERROR) + if (_propertySetC1.load() != GCF_NO_ERROR) { failed(104); TRAN(Application::test105); @@ -161,9 +170,9 @@ GCFEvent::TResult Application::test104(GCFEvent& e, GCFPortInterface& p) } break; - case F_MYLOADED_SIG: + case F_MYPLOADED_SIG: { - GCFPMLMYPAnswerEvent* pResponse = static_cast<GCFPMLMYPAnswerEvent*>(&e); + GCFMYPropAnswerEvent* pResponse = static_cast<GCFMYPropAnswerEvent*>(&e); assert(pResponse); switch (_counter) { @@ -172,7 +181,7 @@ GCFEvent::TResult Application::test104(GCFEvent& e, GCFPortInterface& p) (pResponse->result == GCF_NO_ERROR) && (&p == &_supTask3.getPort())) { - if (_supTask3.loadMyProperties(propertySetD1) != GCF_NO_ERROR) + if (_propertySetD1.load() != GCF_NO_ERROR) { failed(104); TRAN(Application::test105); @@ -186,7 +195,7 @@ GCFEvent::TResult Application::test104(GCFEvent& e, GCFPortInterface& p) (pResponse->result == GCF_NO_ERROR) && (&p == &_supTask3.getPort())) { - if (_supTask3.unloadMyProperties(propertySetC1.scope) != GCF_NO_ERROR) + if (_propertySetC1.unload() != GCF_NO_ERROR) { failed(104); TRAN(Application::test105); @@ -197,9 +206,9 @@ GCFEvent::TResult Application::test104(GCFEvent& e, GCFPortInterface& p) } break; } - case F_MYUNLOADED_SIG: + case F_MYPUNLOADED_SIG: { - GCFPMLMYPAnswerEvent* pResponse = static_cast<GCFPMLMYPAnswerEvent*>(&e); + GCFMYPropAnswerEvent* pResponse = static_cast<GCFMYPropAnswerEvent*>(&e); assert(pResponse); switch (_counter) { @@ -208,7 +217,7 @@ GCFEvent::TResult Application::test104(GCFEvent& e, GCFPortInterface& p) (pResponse->result == GCF_NO_ERROR) && (&p == &_supTask3.getPort())) { - if (_supTask3.unloadMyProperties(propertySetD1.scope) != GCF_NO_ERROR) + if (_propertySetD1.unload() != GCF_NO_ERROR) { failed(104); TRAN(Application::test105); @@ -254,7 +263,7 @@ GCFEvent::TResult Application::test105(GCFEvent& e, GCFPortInterface& p) switch (e.signal) { case F_ENTRY_SIG: - if (_supTask3.loadMyProperties(propertySetC1) != GCF_NO_ERROR) + if (_propertySetC1.load() != GCF_NO_ERROR) { failed(105); TRAN(Application::test201); @@ -265,9 +274,9 @@ GCFEvent::TResult Application::test105(GCFEvent& e, GCFPortInterface& p) } break; - case F_MYLOADED_SIG: + case F_MYPLOADED_SIG: { - GCFPMLMYPAnswerEvent* pResponse = static_cast<GCFPMLMYPAnswerEvent*>(&e); + GCFMYPropAnswerEvent* pResponse = static_cast<GCFMYPropAnswerEvent*>(&e); assert(pResponse); switch (_counter) { @@ -276,7 +285,7 @@ GCFEvent::TResult Application::test105(GCFEvent& e, GCFPortInterface& p) (pResponse->result == GCF_NO_ERROR) && (&p == &_supTask3.getPort())) { - if (_supTask3.loadMyProperties(propertySetD1) != GCF_NO_ERROR) + if (_propertySetD1.load() != GCF_NO_ERROR) { failed(105); TRAN(Application::test201); @@ -330,7 +339,7 @@ GCFEvent::TResult Application::test201(GCFEvent& e, GCFPortInterface& p) } case F_ENTRY_SIG: if (_curRemoteTestNr != 105) break; - if (_supTask3.loadAPC("ApcT1-D", "A_C") != GCF_NO_ERROR) + if (_apcT1.load() != GCF_NO_ERROR) { failed(201); TRAN(Application::test202); @@ -344,17 +353,17 @@ GCFEvent::TResult Application::test201(GCFEvent& e, GCFPortInterface& p) case F_APCLOADED_SIG: { - GCFPMLAPCAnswerEvent* pResponse = static_cast<GCFPMLAPCAnswerEvent*>(&e); + GCFAPCAnswerEvent* pResponse = static_cast<GCFAPCAnswerEvent*>(&e); assert(pResponse); switch (_counter) { case 1: if ((strcmp(pResponse->pScope, "A_C") == 0) && - (strcmp(pResponse->pApcName, "ApcT1-D") == 0) && + (strcmp(pResponse->pApcName, "ApcT1") == 0) && (pResponse->result == GCF_NO_ERROR) && (&p == &_supTask3.getPort())) { - if (_supTask3.unloadAPC("ApcT1", "A_C") != GCF_NO_ERROR) + if (_apcT1.unload() != GCF_NO_ERROR) { failed(201); TRAN(Application::test202); @@ -367,7 +376,7 @@ GCFEvent::TResult Application::test201(GCFEvent& e, GCFPortInterface& p) } case F_APCUNLOADED_SIG: { - GCFPMLAPCAnswerEvent* pResponse = static_cast<GCFPMLAPCAnswerEvent*>(&e); + GCFAPCAnswerEvent* pResponse = static_cast<GCFAPCAnswerEvent*>(&e); assert(pResponse); switch (_counter) { @@ -409,7 +418,7 @@ GCFEvent::TResult Application::test202(GCFEvent& e, GCFPortInterface& p) switch (e.signal) { case F_ENTRY_SIG: - if (_supTask3.loadAPC("ApcT1", "A_C") != GCF_NO_ERROR) + if (_apcT1.load(false) != GCF_NO_ERROR) { failed(202); TRAN(Application::test203); @@ -423,7 +432,7 @@ GCFEvent::TResult Application::test202(GCFEvent& e, GCFPortInterface& p) case F_APCLOADED_SIG: { - GCFPMLAPCAnswerEvent* pResponse = static_cast<GCFPMLAPCAnswerEvent*>(&e); + GCFAPCAnswerEvent* pResponse = static_cast<GCFAPCAnswerEvent*>(&e); assert(pResponse); switch (_counter) { @@ -464,8 +473,8 @@ GCFEvent::TResult Application::test203(GCFEvent& e, GCFPortInterface& p) switch (e.signal) { - case F_ENTRY_SIG: - if (_supTask3.unloadAPC("ApcT1", "A_C") != GCF_NO_ERROR) + case F_ENTRY_SIG: + if (_apcT1.unload() != GCF_NO_ERROR) { failed(203); TRAN(Application::test204); @@ -478,7 +487,7 @@ GCFEvent::TResult Application::test203(GCFEvent& e, GCFPortInterface& p) case F_APCUNLOADED_SIG: { - GCFPMLAPCAnswerEvent* pResponse = static_cast<GCFPMLAPCAnswerEvent*>(&e); + GCFAPCAnswerEvent* pResponse = static_cast<GCFAPCAnswerEvent*>(&e); assert(pResponse); if (_counter == 1) { @@ -513,7 +522,7 @@ GCFEvent::TResult Application::test204(GCFEvent& e, GCFPortInterface& p) switch (e.signal) { case F_ENTRY_SIG: - if (_supTask3.loadAPC("ApcT1-D", "A_C") != GCF_NO_ERROR) + if (_apcT1.load() != GCF_NO_ERROR) { failed(204); TRAN(Application::test205); @@ -526,17 +535,17 @@ GCFEvent::TResult Application::test204(GCFEvent& e, GCFPortInterface& p) case F_APCLOADED_SIG: { - GCFPMLAPCAnswerEvent* pResponse = static_cast<GCFPMLAPCAnswerEvent*>(&e); + GCFAPCAnswerEvent* pResponse = static_cast<GCFAPCAnswerEvent*>(&e); assert(pResponse); switch (_counter) { case 1: if ((strcmp(pResponse->pScope, "A_C") == 0) && - (strcmp(pResponse->pApcName, "ApcT1-D") == 0) && + (strcmp(pResponse->pApcName, "ApcT1") == 0) && (pResponse->result == GCF_NO_ERROR) && (&p == &_supTask3.getPort())) { - if (_supTask3.reloadAPC("ApcT1-D", "A_C") != GCF_NO_ERROR) + if (_apcT1.reload() != GCF_NO_ERROR) { failed(204); TRAN(Application::test205); @@ -549,13 +558,13 @@ GCFEvent::TResult Application::test204(GCFEvent& e, GCFPortInterface& p) } case F_APCRELOADED_SIG: { - GCFPMLAPCAnswerEvent* pResponse = static_cast<GCFPMLAPCAnswerEvent*>(&e); + GCFAPCAnswerEvent* pResponse = static_cast<GCFAPCAnswerEvent*>(&e); assert(pResponse); switch (_counter) { case 2: if ((strcmp(pResponse->pScope, "A_C") == 0) && - (strcmp(pResponse->pApcName, "ApcT1-D") == 0) && + (strcmp(pResponse->pApcName, "ApcT1") == 0) && (pResponse->result == GCF_NO_ERROR) && (&p == &_supTask3.getPort())) { @@ -605,7 +614,7 @@ GCFEvent::TResult Application::test205(GCFEvent& e, GCFPortInterface& p) else { started = true; - if (_supTask3.unloadAPC("ApcT1", "A_C") != GCF_NO_ERROR) + if (_apcT1.unload() != GCF_NO_ERROR) { failed(205); TRAN(Application::test206); @@ -619,7 +628,7 @@ GCFEvent::TResult Application::test205(GCFEvent& e, GCFPortInterface& p) } case F_APCUNLOADED_SIG: { - GCFPMLAPCAnswerEvent* pResponse = static_cast<GCFPMLAPCAnswerEvent*>(&e); + GCFAPCAnswerEvent* pResponse = static_cast<GCFAPCAnswerEvent*>(&e); assert(pResponse); switch (_counter) { @@ -657,7 +666,7 @@ GCFEvent::TResult Application::test206(GCFEvent& e, GCFPortInterface& p) { case F_ENTRY_SIG: _counter = 0; - if (_supTask3.loadAPC("ApcT1-D", "A_C") != GCF_NO_ERROR) + if (_apcT1.load() != GCF_NO_ERROR) { failed(204); TRAN(Application::test205); @@ -675,7 +684,7 @@ GCFEvent::TResult Application::test206(GCFEvent& e, GCFPortInterface& p) _curRemoteTestNr = pIndication->testnr; if (_counter == 2) { - if (_supTask3.unloadAPC("ApcT1", "A_C") != GCF_NO_ERROR) + if (_apcT1.unload() != GCF_NO_ERROR) { failed(206); TRAN(Application::test207); @@ -686,16 +695,16 @@ GCFEvent::TResult Application::test206(GCFEvent& e, GCFPortInterface& p) } case F_APCLOADED_SIG: { - GCFPMLAPCAnswerEvent* pResponse = static_cast<GCFPMLAPCAnswerEvent*>(&e); + GCFAPCAnswerEvent* pResponse = static_cast<GCFAPCAnswerEvent*>(&e); assert(pResponse); if (_counter == 1) { if ((strcmp(pResponse->pScope, "A_C") == 0) && - (strcmp(pResponse->pApcName, "ApcT1-D") == 0) && + (strcmp(pResponse->pApcName, "ApcT1") == 0) && (pResponse->result == GCF_NO_ERROR) && (&p == &_supTask3.getPort())) { - if (_supTask3.reloadAPC("ApcT1-D", "A_C") != GCF_NO_ERROR) + if (_apcT1.reload() != GCF_NO_ERROR) { failed(206); TRAN(Application::test207); @@ -708,12 +717,12 @@ GCFEvent::TResult Application::test206(GCFEvent& e, GCFPortInterface& p) case F_APCRELOADED_SIG: { - GCFPMLAPCAnswerEvent* pResponse = static_cast<GCFPMLAPCAnswerEvent*>(&e); + GCFAPCAnswerEvent* pResponse = static_cast<GCFAPCAnswerEvent*>(&e); assert(pResponse); if (_counter == 2) { if ((strcmp(pResponse->pScope, "A_C") == 0) && - (strcmp(pResponse->pApcName, "ApcT1-D") == 0) && + (strcmp(pResponse->pApcName, "ApcT1") == 0) && (pResponse->result == GCF_NO_ERROR) && (&p == &_supTask3.getPort())) { @@ -726,7 +735,7 @@ GCFEvent::TResult Application::test206(GCFEvent& e, GCFPortInterface& p) } case F_APCUNLOADED_SIG: { - GCFPMLAPCAnswerEvent* pResponse = static_cast<GCFPMLAPCAnswerEvent*>(&e); + GCFAPCAnswerEvent* pResponse = static_cast<GCFAPCAnswerEvent*>(&e); assert(pResponse); if (_counter == 3) { @@ -770,7 +779,7 @@ GCFEvent::TResult Application::test207(GCFEvent& e, GCFPortInterface& p) } case F_ENTRY_SIG: if (_curRemoteTestNr == 0) break; - if (_supTask3.loadAPC("ApcT1a", "A_C") != GCF_NO_ERROR) + if (_apcT1a.load(false) != GCF_NO_ERROR) { failed(207); TRAN(Application::test208); @@ -783,7 +792,7 @@ GCFEvent::TResult Application::test207(GCFEvent& e, GCFPortInterface& p) case F_APCLOADED_SIG: { - GCFPMLAPCAnswerEvent* pResponse = static_cast<GCFPMLAPCAnswerEvent*>(&e); + GCFAPCAnswerEvent* pResponse = static_cast<GCFAPCAnswerEvent*>(&e); assert(pResponse); switch (_counter) { @@ -793,7 +802,7 @@ GCFEvent::TResult Application::test207(GCFEvent& e, GCFPortInterface& p) (pResponse->result == GCF_NO_ERROR) && (&p == &_supTask3.getPort())) { - if (_supTask3.unloadAPC("ApcT1a", "A_C") != GCF_NO_ERROR) + if (_apcT1a.unload() != GCF_NO_ERROR) { failed(207); TRAN(Application::test208); @@ -806,7 +815,7 @@ GCFEvent::TResult Application::test207(GCFEvent& e, GCFPortInterface& p) } case F_APCUNLOADED_SIG: { - GCFPMLAPCAnswerEvent* pResponse = static_cast<GCFPMLAPCAnswerEvent*>(&e); + GCFAPCAnswerEvent* pResponse = static_cast<GCFAPCAnswerEvent*>(&e); assert(pResponse); switch (_counter) { @@ -840,8 +849,8 @@ GCFEvent::TResult Application::test208(GCFEvent& e, GCFPortInterface& p) switch (e.signal) { - case F_ENTRY_SIG: - if (_supTask3.loadAPC("ApcT1b", "A") != GCF_NO_ERROR) + case F_ENTRY_SIG: + if (_apcT1b.load(false) != GCF_NO_ERROR) { failed(208); TRAN(Application::test301); @@ -854,7 +863,7 @@ GCFEvent::TResult Application::test208(GCFEvent& e, GCFPortInterface& p) case F_APCLOADED_SIG: { - GCFPMLAPCAnswerEvent* pResponse = static_cast<GCFPMLAPCAnswerEvent*>(&e); + GCFAPCAnswerEvent* pResponse = static_cast<GCFAPCAnswerEvent*>(&e); assert(pResponse); switch (_counter) { @@ -864,7 +873,7 @@ GCFEvent::TResult Application::test208(GCFEvent& e, GCFPortInterface& p) (pResponse->result == GCF_NO_ERROR) && (&p == &_supTask3.getPort())) { - if (_supTask3.unloadAPC("ApcT1b", "A") != GCF_NO_ERROR) + if (_apcT1b.unload() != GCF_NO_ERROR) { failed(208); TRAN(Application::test301); @@ -882,7 +891,7 @@ GCFEvent::TResult Application::test208(GCFEvent& e, GCFPortInterface& p) } case F_APCUNLOADED_SIG: { - GCFPMLAPCAnswerEvent* pResponse = static_cast<GCFPMLAPCAnswerEvent*>(&e); + GCFAPCAnswerEvent* pResponse = static_cast<GCFAPCAnswerEvent*>(&e); assert(pResponse); switch (_counter) { @@ -918,6 +927,7 @@ GCFEvent::TResult Application::test208(GCFEvent& e, GCFPortInterface& p) return status; } +// Will be skipped due to problems in the design GCFEvent::TResult Application::test209(GCFEvent& e, GCFPortInterface& p) { GCFEvent::TResult status = GCFEvent::HANDLED; @@ -932,7 +942,8 @@ GCFEvent::TResult Application::test209(GCFEvent& e, GCFPortInterface& p) TSTTestreadyEvent* pIndication = static_cast<TSTTestreadyEvent*>(&e); assert(pIndication); _curRemoteTestNr = pIndication->testnr; - if (_supTask3.loadAPC("ApcT3", "A_C") != GCF_NO_ERROR) + _apcT3.setScope("A_C"); + if (_apcT3.load(false) != GCF_NO_ERROR) { failed(209); TRAN(Application::test210); @@ -945,7 +956,7 @@ GCFEvent::TResult Application::test209(GCFEvent& e, GCFPortInterface& p) } case F_APCLOADED_SIG: { - GCFPMLAPCAnswerEvent* pResponse = static_cast<GCFPMLAPCAnswerEvent*>(&e); + GCFAPCAnswerEvent* pResponse = static_cast<GCFAPCAnswerEvent*>(&e); assert(pResponse); switch (_counter) { @@ -973,7 +984,8 @@ GCFEvent::TResult Application::test209(GCFEvent& e, GCFPortInterface& p) return status; } -GCFEvent::TResult Application::test210(GCFEvent& e, GCFPortInterface& p) +// Will be skipped due to combinations of other tests coverts this test +GCFEvent::TResult Application::test210(GCFEvent& e, GCFPortInterface& /*p*/) { GCFEvent::TResult status = GCFEvent::HANDLED; @@ -990,14 +1002,14 @@ GCFEvent::TResult Application::test210(GCFEvent& e, GCFPortInterface& p) return status; } -GCFEvent::TResult Application::test301(GCFEvent& e, GCFPortInterface& p) +GCFEvent::TResult Application::test301(GCFEvent& e, GCFPortInterface& /*p*/) { GCFEvent::TResult status = GCFEvent::HANDLED; switch (e.signal) { case F_ENTRY_SIG: - skiped(301); + skipped(301); TRAN(Application::test302); break; @@ -1017,16 +1029,15 @@ GCFEvent::TResult Application::test301(GCFEvent& e, GCFPortInterface& p) return status; } -GCFEvent::TResult Application::test302(GCFEvent& e, GCFPortInterface& p) +GCFEvent::TResult Application::test302(GCFEvent& e, GCFPortInterface& /*p*/) { GCFEvent::TResult status = GCFEvent::HANDLED; switch (e.signal) { case F_ENTRY_SIG: - skiped(302); - if (_curRemoteTestNr == 302) - TRAN(Application::test303); + skipped(302); + TRAN(Application::test303); break; case TST_TESTREADY: @@ -1034,8 +1045,6 @@ GCFEvent::TResult Application::test302(GCFEvent& e, GCFPortInterface& p) TSTTestreadyEvent* pIndication = static_cast<TSTTestreadyEvent*>(&e); assert(pIndication); _curRemoteTestNr = pIndication->testnr; - if (_curRemoteTestNr == 302) - TRAN(Application::test303); break; } @@ -1051,6 +1060,8 @@ GCFEvent::TResult Application::test303(GCFEvent& e, GCFPortInterface& p) { GCFEvent::TResult status = GCFEvent::HANDLED; + static GCFProperty propertyACP1("A_C_P1"); + propertyACP1.setAnswer(&_supTask3.getAnswerObj()); switch (e.signal) { case TST_TESTREADY: @@ -1060,8 +1071,8 @@ GCFEvent::TResult Application::test303(GCFEvent& e, GCFPortInterface& p) _curRemoteTestNr = pIndication->testnr; } case F_ENTRY_SIG: - if (_curRemoteTestNr != 302) break; - if (_supTask3.loadAPC("ApcT1", "A_C") != GCF_NO_ERROR) + if (_curRemoteTestNr != 302) break; + if (_apcT1.load(false) != GCF_NO_ERROR) { failed(303); TRAN(Application::test304); @@ -1074,14 +1085,14 @@ GCFEvent::TResult Application::test303(GCFEvent& e, GCFPortInterface& p) case F_APCLOADED_SIG: { - GCFPMLAPCAnswerEvent* pResponse = static_cast<GCFPMLAPCAnswerEvent*>(&e); + GCFAPCAnswerEvent* pResponse = static_cast<GCFAPCAnswerEvent*>(&e); assert(pResponse); if ((strcmp(pResponse->pScope, "A_C") == 0) && (strcmp(pResponse->pApcName, "ApcT1") == 0) && (pResponse->result == GCF_NO_ERROR) && (&p == &_supTask3.getPort())) { - if (_supTask3.getProxy().subscribe("A_C_P1") != GCF_NO_ERROR) + if (propertyACP1.subscribe() != GCF_NO_ERROR) { failed(303); TRAN(Application::test304); @@ -1097,7 +1108,7 @@ GCFEvent::TResult Application::test303(GCFEvent& e, GCFPortInterface& p) case F_SUBSCRIBED_SIG: { - GCFPMLAnswerEvent* pResponse = static_cast<GCFPMLAnswerEvent*>(&e); + GCFPropAnswerEvent* pResponse = static_cast<GCFPropAnswerEvent*>(&e); assert(pResponse); if ((strcmp(pResponse->pPropName, "A_C_P1") == 0) && (&p == &_supTask3.getPort())) @@ -1116,9 +1127,9 @@ GCFEvent::TResult Application::test303(GCFEvent& e, GCFPortInterface& p) case F_VCHANGEMSG_SIG: { - GCFPMLValueEvent* pResponse = static_cast<GCFPMLValueEvent*>(&e); + GCFPropValueEvent* pResponse = static_cast<GCFPropValueEvent*>(&e); assert(pResponse); - if ((pResponse->pValue->getType() == GCFPValue::LPT_INTEGER) && + if ((pResponse->pValue->getType() == GCFPValue::INTEGER_VAL) && (strcmp(pResponse->pPropName, "A_C_P1") == 0) && (((GCFPVInteger*)pResponse->pValue)->getValue() == 22) && (&p == &_supTask3.getPort())) @@ -1134,7 +1145,7 @@ GCFEvent::TResult Application::test303(GCFEvent& e, GCFPortInterface& p) break; } case F_EXIT_SIG: - _supTask3.getProxy().unsubscribe("A_C_P1"); + propertyACP1.unsubscribe(); break; default: status = GCFEvent::NOT_HANDLED; @@ -1170,7 +1181,7 @@ GCFEvent::TResult Application::test304(GCFEvent& e, GCFPortInterface& p) { propName[8] = j + '0'; dv.setValue(((double) (i * 10 + j)) / 100.0 ); - if (_supTask3.set(propName, dv) == GCF_NO_ERROR) + if (_supTask3.getProxy().setPropValue(propName, dv) == GCF_NO_ERROR) { _counter++; } @@ -1187,9 +1198,9 @@ GCFEvent::TResult Application::test304(GCFEvent& e, GCFPortInterface& p) } case F_VCHANGEMSG_SIG: { - GCFPMLValueEvent* pResponse = static_cast<GCFPMLValueEvent*>(&e); + GCFPropValueEvent* pResponse = static_cast<GCFPropValueEvent*>(&e); assert(pResponse); - if ((pResponse->pValue->getType() == GCFPValue::LPT_DOUBLE) && + if ((pResponse->pValue->getType() == GCFPValue::DOUBLE_VAL) && (strncmp(pResponse->pPropName, "A_H_J_P", 7) == 0) && (&p == &_supTask3.getPort())) { @@ -1202,13 +1213,14 @@ GCFEvent::TResult Application::test304(GCFEvent& e, GCFPortInterface& p) } else { - cerr << "Propvalue: " << doubleVal << " PropNr: " << propNr << endl; + double dv = ((GCFPVDouble*)pResponse->pValue)->getValue(); + cerr << "Propvalue: " << dv << " PropNr: " << propNr << endl; nrOfFaults++; } } else { - cerr << "Propname fails " << pResponse->pPropName << endl; + cerr << "Propname fails" << pResponse->pPropName << endl; nrOfFaults++; } if (_counter == 100 ) @@ -1236,11 +1248,14 @@ GCFEvent::TResult Application::test305(GCFEvent& e, GCFPortInterface& p) GCFEvent::TResult status = GCFEvent::HANDLED; static unsigned int nrOfFaults = 0; + static GCFProperty propertyAHJP00("A_H_J_P00"); + propertyAHJP00.setAnswer(&_supTask3.getAnswerObj()); + switch (e.signal) { case F_ENTRY_SIG: _counter = 0; - if (_supTask3.loadAPC("ApcT3", "A_H") != GCF_NO_ERROR) + if (_apcT3.load(false) != GCF_NO_ERROR) { failed(305); TRAN(Application::test306); @@ -1249,14 +1264,14 @@ GCFEvent::TResult Application::test305(GCFEvent& e, GCFPortInterface& p) case F_APCLOADED_SIG: { - GCFPMLAPCAnswerEvent* pResponse = static_cast<GCFPMLAPCAnswerEvent*>(&e); + GCFAPCAnswerEvent* pResponse = static_cast<GCFAPCAnswerEvent*>(&e); assert(pResponse); if ((strcmp(pResponse->pScope, "A_H") == 0) && (strcmp(pResponse->pApcName, "ApcT3") == 0) && (pResponse->result == GCF_NO_ERROR) && (&p == &_supTask3.getPort())) { - if (_supTask3.getProxy().subscribe("A_H_J_P00") != GCF_NO_ERROR) + if (propertyAHJP00.subscribe() != GCF_NO_ERROR) { failed(305); TRAN(Application::test306); @@ -1271,7 +1286,7 @@ GCFEvent::TResult Application::test305(GCFEvent& e, GCFPortInterface& p) } case F_SUBSCRIBED_SIG: { - GCFPMLAnswerEvent* pResponse = static_cast<GCFPMLAnswerEvent*>(&e); + GCFPropAnswerEvent* pResponse = static_cast<GCFPropAnswerEvent*>(&e); assert(pResponse); if ((strcmp(pResponse->pPropName, "A_H_J_P00") == 0) && (&p == &_supTask3.getPort())) @@ -1296,7 +1311,7 @@ GCFEvent::TResult Application::test305(GCFEvent& e, GCFPortInterface& p) { GCFPVDouble dv(3.12); _counter = 0; - if (_supTask3.set("A_H_J_P00", dv) != GCF_NO_ERROR) + if (propertyAHJP00.setValue(dv) != GCF_NO_ERROR) { failed(305); TRAN(Application::test306); @@ -1306,9 +1321,9 @@ GCFEvent::TResult Application::test305(GCFEvent& e, GCFPortInterface& p) } case F_VCHANGEMSG_SIG: { - GCFPMLValueEvent* pResponse = static_cast<GCFPMLValueEvent*>(&e); + GCFPropValueEvent* pResponse = static_cast<GCFPropValueEvent*>(&e); assert(pResponse); - if ((pResponse->pValue->getType() == GCFPValue::LPT_DOUBLE) && + if ((pResponse->pValue->getType() == GCFPValue::DOUBLE_VAL) && (strcmp(pResponse->pPropName, "A_H_J_P00") == 0) && (((GCFPVDouble*)pResponse->pValue)->getValue() == 3.12) && (&p == &_supTask3.getPort())) @@ -1348,22 +1363,22 @@ GCFEvent::TResult Application::test306(GCFEvent& e, GCFPortInterface& p) switch (e.signal) { case F_ENTRY_SIG: - if (_supTask3.loadMyProperties(propertySetB4) != GCF_NO_ERROR) + if (_propertySetB4.load() != GCF_NO_ERROR) { failed(306); TRAN(Application::test403); } break; - case F_MYLOADED_SIG: + case F_MYPLOADED_SIG: { - GCFPMLMYPAnswerEvent* pResponse = static_cast<GCFPMLMYPAnswerEvent*>(&e); + GCFMYPropAnswerEvent* pResponse = static_cast<GCFMYPropAnswerEvent*>(&e); assert(pResponse); if ((strcmp(pResponse->pScope, propertySetB4.scope) == 0) && (pResponse->result == GCF_NO_ERROR) && (&p == &_supTask3.getPort())) { - if (_supTask3.loadAPC("ApcT1", "A_K") != GCF_NO_ERROR) + if (_apcT1K.load(false) != GCF_NO_ERROR) { failed(306); TRAN(Application::test403); @@ -1380,14 +1395,14 @@ GCFEvent::TResult Application::test306(GCFEvent& e, GCFPortInterface& p) } case F_APCLOADED_SIG: { - GCFPMLAPCAnswerEvent* pResponse = static_cast<GCFPMLAPCAnswerEvent*>(&e); + GCFAPCAnswerEvent* pResponse = static_cast<GCFAPCAnswerEvent*>(&e); assert(pResponse); if ((strcmp(pResponse->pScope, "A_K") == 0) && (strcmp(pResponse->pApcName, "ApcT1") == 0) && (pResponse->result == GCF_NO_ERROR) && (&p == &_supTask3.getPort())) { - if (_supTask3.getProxy().subscribe("A_K_P1") != GCF_NO_ERROR) + if (_supTask3.getProxy().subscribeProp("A_K_P1") != GCF_NO_ERROR) { failed(306); TRAN(Application::test403); @@ -1402,7 +1417,7 @@ GCFEvent::TResult Application::test306(GCFEvent& e, GCFPortInterface& p) } case F_SUBSCRIBED_SIG: { - GCFPMLAnswerEvent* pResponse = static_cast<GCFPMLAnswerEvent*>(&e); + GCFPropAnswerEvent* pResponse = static_cast<GCFPropAnswerEvent*>(&e); assert(pResponse); if ((strcmp(pResponse->pPropName, "A_K_P1") == 0) && (&p == &_supTask3.getPort())) @@ -1421,10 +1436,10 @@ GCFEvent::TResult Application::test306(GCFEvent& e, GCFPortInterface& p) } case F_VCHANGEMSG_SIG: { - GCFPMLValueEvent* pResponse = static_cast<GCFPMLValueEvent*>(&e); + GCFPropValueEvent* pResponse = static_cast<GCFPropValueEvent*>(&e); assert(pResponse); if (pResponse->internal) break; - if ((pResponse->pValue->getType() == GCFPValue::LPT_INTEGER) && + if ((pResponse->pValue->getType() == GCFPValue::INTEGER_VAL) && (strcmp(pResponse->pPropName, "A_K_P1") == 0) && (((GCFPVInteger*)pResponse->pValue)->getValue() == _counter) && (&p == &_supTask3.getPort())) @@ -1438,7 +1453,7 @@ GCFEvent::TResult Application::test306(GCFEvent& e, GCFPortInterface& p) _counter++; GCFPVInteger iv; iv.copy(*(pResponse->pValue)); - if (_supTask3.set("A_C_P1", iv) != GCF_NO_ERROR) + if (_supTask3.getProxy().setPropValue("A_C_P1", iv) != GCF_NO_ERROR) { failed(306); TRAN(Application::test403); @@ -1601,14 +1616,13 @@ GCFEvent::TResult Application::test402(GCFEvent& e, GCFPortInterface& p) return status; } -GCFEvent::TResult Application::test403(GCFEvent& e, GCFPortInterface& p) +GCFEvent::TResult Application::test403(GCFEvent& e, GCFPortInterface& /*p*/) { GCFEvent::TResult status = GCFEvent::HANDLED; switch (e.signal) { case F_ENTRY_SIG: - GCFTask::stop(); break; default: diff --git a/MAC/Test/GCF/src/Application2.h b/MAC/Test/GCF/src/Application2.h index b80b58cc4014826c42ade98b7bb11f40788ae215..a98fc469239f9c79ab68733b1bd16d1fb8e1b3cd 100644 --- a/MAC/Test/GCF/src/Application2.h +++ b/MAC/Test/GCF/src/Application2.h @@ -1,8 +1,10 @@ #ifndef APPLICATION_H #define APPLICATION_H -#include <TM/GCF_Task.h> +#include <GCF/GCF_Task.h> #include "SupervisedTask.h" +#include <GCF/GCF_MyPropertySet.h> +#include <GCF/GCF_Apc.h> class GCFEvent; class GCFPortInterface; @@ -49,9 +51,9 @@ class Application : public GCFTask cerr << "Test " << failedTest << " failed\n"; _failed++; } - void skiped(unsigned int skipedTest) + void skipped(unsigned int skippedTest) { - cerr << "Nothing to do in test " << skipedTest << " => skiped\n"; + cerr << "Nothing to do in test " << skippedTest << " => skipped\n"; } private: @@ -63,5 +65,13 @@ class Application : public GCFTask unsigned int _curRemoteTestNr; GCFTCPPort* _pSTPort1; GCFTCPPort* _pSTPort2; + GCFMyPropertySet _propertySetC1; + GCFMyPropertySet _propertySetD1; + GCFMyPropertySet _propertySetB4; + GCFApc _apcT1; + GCFApc _apcT1K; + GCFApc _apcT1a; + GCFApc _apcT1b; + GCFApc _apcT3; }; #endif diff --git a/MAC/Test/GCF/src/Defines.h b/MAC/Test/GCF/src/Defines.h index aaa65f8d36ca77411fd2e9cef922eac47b90c26e..3172bc82aa8a15698e7babf52e18d6abb7662580 100644 --- a/MAC/Test/GCF/src/Defines.h +++ b/MAC/Test/GCF/src/Defines.h @@ -1,18 +1,19 @@ -#include <GCFCommon/GCF_Defines.h> -#include <SAL/GCF_PValue.h> +#include <GCF/GCF_Defines.h> +#include <GCF/GCF_PValue.h> //#define WAIT_FOR_INPUT +#define GCF_READWRITE_PROP (GCF_READABLE_PROP | GCF_WRITABLE_PROP) // property sets // PropertySetA1: start const TProperty propertiesSA1[] = { - {"F_P4", GCFPValue::LPT_INTEGER, 0, "10"}, - {"F_P5", GCFPValue::LPT_CHAR, 0, "20"}, - {"G_P6", GCFPValue::LPT_DOUBLE, 0, "12.1"}, - {"G_P7", GCFPValue::LPT_STRING, 0, "geit"}, + {"F_P4", GCFPValue::INTEGER_VAL, GCF_READWRITE_PROP, "10"}, + {"F_P5", GCFPValue::CHAR_VAL, GCF_READWRITE_PROP, "20"}, + {"G_P6", GCFPValue::DOUBLE_VAL, GCF_READWRITE_PROP, "12.1"}, + {"G_P7", GCFPValue::STRING_VAL, GCF_READWRITE_PROP, "geit"}, }; const TPropertySet propertySetA1 = @@ -26,9 +27,9 @@ const TPropertySet propertySetA1 = const TProperty propertiesSB1[] = { - {"P1", GCFPValue::LPT_INTEGER, 0, "11"}, - {"P2", GCFPValue::LPT_CHAR, 0, "25"}, - {"P3", GCFPValue::LPT_DOUBLE, 0, "33.3"}, + {"P1", GCFPValue::INTEGER_VAL, GCF_READWRITE_PROP, "11"}, + {"P2", GCFPValue::CHAR_VAL, GCF_READWRITE_PROP, "25"}, + {"P3", GCFPValue::DOUBLE_VAL, GCF_READWRITE_PROP, "33.3"}, }; const TPropertySet propertySetB1 = @@ -42,9 +43,9 @@ const TPropertySet propertySetB1 = const TProperty propertiesSB2[] = { - {"P1", GCFPValue::LPT_INTEGER, 0, "12"}, - {"P2", GCFPValue::LPT_CHAR, 0, "26"}, - {"P3", GCFPValue::LPT_DOUBLE, 0, "34.3"}, + {"P1", GCFPValue::INTEGER_VAL, GCF_READWRITE_PROP, "12"}, + {"P2", GCFPValue::CHAR_VAL, GCF_READWRITE_PROP, "26"}, + {"P3", GCFPValue::DOUBLE_VAL, GCF_READWRITE_PROP, "34.3"}, }; const TPropertySet propertySetB2 = @@ -58,9 +59,9 @@ const TPropertySet propertySetB2 = const TProperty propertiesSB3[] = { - {"P1", GCFPValue::LPT_INTEGER, 0, "13"}, - {"P2", GCFPValue::LPT_CHAR, 0, "27"}, - {"P3", GCFPValue::LPT_DOUBLE, 0, "35.3"}, + {"P1", GCFPValue::INTEGER_VAL, GCF_READWRITE_PROP, "13"}, + {"P2", GCFPValue::CHAR_VAL, GCF_READWRITE_PROP, "27"}, + {"P3", GCFPValue::DOUBLE_VAL, GCF_READWRITE_PROP, "35.3"}, }; const TPropertySet propertySetB3 = @@ -75,9 +76,9 @@ const TPropertySet propertySetB3 = const TProperty propertiesSB4[] = { - {"P1", GCFPValue::LPT_INTEGER, 0, "14"}, - {"P2", GCFPValue::LPT_CHAR, 0, "28"}, - {"P3", GCFPValue::LPT_DOUBLE, 0, "36.3"}, + {"P1", GCFPValue::INTEGER_VAL, GCF_READWRITE_PROP, "14"}, + {"P2", GCFPValue::CHAR_VAL, GCF_READWRITE_PROP, "28"}, + {"P3", GCFPValue::DOUBLE_VAL, GCF_READWRITE_PROP, "36.3"}, }; const TPropertySet propertySetB4 = @@ -91,8 +92,8 @@ const TPropertySet propertySetB4 = const TProperty propertiesSC1[] = { - {"P8", GCFPValue::LPT_STRING, 0, "aap"}, - {"P9", GCFPValue::LPT_STRING, 0, "noot"}, + {"P8", GCFPValue::STRING_VAL, GCF_READWRITE_PROP, "aap"}, + {"P9", GCFPValue::STRING_VAL, GCF_READWRITE_PROP, "noot"}, }; const TPropertySet propertySetC1 = @@ -106,106 +107,106 @@ const TPropertySet propertySetC1 = const TProperty propertiesSD1[] = { - {"J_P00", GCFPValue::LPT_DOUBLE, 0, "10.00"}, - {"J_P01", GCFPValue::LPT_DOUBLE, 0, "10.01"}, - {"J_P02", GCFPValue::LPT_DOUBLE, 0, "10.02"}, - {"J_P03", GCFPValue::LPT_DOUBLE, 0, "10.03"}, - {"J_P04", GCFPValue::LPT_DOUBLE, 0, "10.04"}, - {"J_P05", GCFPValue::LPT_DOUBLE, 0, "10.05"}, - {"J_P06", GCFPValue::LPT_DOUBLE, 0, "10.06"}, - {"J_P07", GCFPValue::LPT_DOUBLE, 0, "10.07"}, - {"J_P08", GCFPValue::LPT_DOUBLE, 0, "10.08"}, - {"J_P09", GCFPValue::LPT_DOUBLE, 0, "10.09"}, - {"J_P10", GCFPValue::LPT_DOUBLE, 0, "10.00"}, - {"J_P11", GCFPValue::LPT_DOUBLE, 0, "10.11"}, - {"J_P12", GCFPValue::LPT_DOUBLE, 0, "10.12"}, - {"J_P13", GCFPValue::LPT_DOUBLE, 0, "10.13"}, - {"J_P14", GCFPValue::LPT_DOUBLE, 0, "10.14"}, - {"J_P15", GCFPValue::LPT_DOUBLE, 0, "10.15"}, - {"J_P16", GCFPValue::LPT_DOUBLE, 0, "10.16"}, - {"J_P17", GCFPValue::LPT_DOUBLE, 0, "10.17"}, - {"J_P18", GCFPValue::LPT_DOUBLE, 0, "10.18"}, - {"J_P19", GCFPValue::LPT_DOUBLE, 0, "10.19"}, - {"J_P20", GCFPValue::LPT_DOUBLE, 0, "10.20"}, - {"J_P21", GCFPValue::LPT_DOUBLE, 0, "10.21"}, - {"J_P22", GCFPValue::LPT_DOUBLE, 0, "10.22"}, - {"J_P23", GCFPValue::LPT_DOUBLE, 0, "10.23"}, - {"J_P24", GCFPValue::LPT_DOUBLE, 0, "10.24"}, - {"J_P25", GCFPValue::LPT_DOUBLE, 0, "10.25"}, - {"J_P26", GCFPValue::LPT_DOUBLE, 0, "10.26"}, - {"J_P27", GCFPValue::LPT_DOUBLE, 0, "10.27"}, - {"J_P28", GCFPValue::LPT_DOUBLE, 0, "10.28"}, - {"J_P29", GCFPValue::LPT_DOUBLE, 0, "10.29"}, - {"J_P30", GCFPValue::LPT_DOUBLE, 0, "10.30"}, - {"J_P31", GCFPValue::LPT_DOUBLE, 0, "10.31"}, - {"J_P32", GCFPValue::LPT_DOUBLE, 0, "10.32"}, - {"J_P33", GCFPValue::LPT_DOUBLE, 0, "10.33"}, - {"J_P34", GCFPValue::LPT_DOUBLE, 0, "10.34"}, - {"J_P35", GCFPValue::LPT_DOUBLE, 0, "10.35"}, - {"J_P36", GCFPValue::LPT_DOUBLE, 0, "10.36"}, - {"J_P37", GCFPValue::LPT_DOUBLE, 0, "10.37"}, - {"J_P38", GCFPValue::LPT_DOUBLE, 0, "10.38"}, - {"J_P39", GCFPValue::LPT_DOUBLE, 0, "10.39"}, - {"J_P40", GCFPValue::LPT_DOUBLE, 0, "10.40"}, - {"J_P41", GCFPValue::LPT_DOUBLE, 0, "10.41"}, - {"J_P42", GCFPValue::LPT_DOUBLE, 0, "10.42"}, - {"J_P43", GCFPValue::LPT_DOUBLE, 0, "10.43"}, - {"J_P44", GCFPValue::LPT_DOUBLE, 0, "10.44"}, - {"J_P45", GCFPValue::LPT_DOUBLE, 0, "10.45"}, - {"J_P46", GCFPValue::LPT_DOUBLE, 0, "10.46"}, - {"J_P47", GCFPValue::LPT_DOUBLE, 0, "10.47"}, - {"J_P48", GCFPValue::LPT_DOUBLE, 0, "10.48"}, - {"J_P49", GCFPValue::LPT_DOUBLE, 0, "10.49"}, - {"J_P50", GCFPValue::LPT_DOUBLE, 0, "10.50"}, - {"J_P51", GCFPValue::LPT_DOUBLE, 0, "10.51"}, - {"J_P52", GCFPValue::LPT_DOUBLE, 0, "10.52"}, - {"J_P53", GCFPValue::LPT_DOUBLE, 0, "10.53"}, - {"J_P54", GCFPValue::LPT_DOUBLE, 0, "10.54"}, - {"J_P55", GCFPValue::LPT_DOUBLE, 0, "10.55"}, - {"J_P56", GCFPValue::LPT_DOUBLE, 0, "10.56"}, - {"J_P57", GCFPValue::LPT_DOUBLE, 0, "10.57"}, - {"J_P58", GCFPValue::LPT_DOUBLE, 0, "10.58"}, - {"J_P59", GCFPValue::LPT_DOUBLE, 0, "10.59"}, - {"J_P60", GCFPValue::LPT_DOUBLE, 0, "10.60"}, - {"J_P61", GCFPValue::LPT_DOUBLE, 0, "10.61"}, - {"J_P62", GCFPValue::LPT_DOUBLE, 0, "10.62"}, - {"J_P63", GCFPValue::LPT_DOUBLE, 0, "10.63"}, - {"J_P64", GCFPValue::LPT_DOUBLE, 0, "10.64"}, - {"J_P65", GCFPValue::LPT_DOUBLE, 0, "10.65"}, - {"J_P66", GCFPValue::LPT_DOUBLE, 0, "10.66"}, - {"J_P67", GCFPValue::LPT_DOUBLE, 0, "10.67"}, - {"J_P68", GCFPValue::LPT_DOUBLE, 0, "10.68"}, - {"J_P69", GCFPValue::LPT_DOUBLE, 0, "10.69"}, - {"J_P70", GCFPValue::LPT_DOUBLE, 0, "10.70"}, - {"J_P71", GCFPValue::LPT_DOUBLE, 0, "10.71"}, - {"J_P72", GCFPValue::LPT_DOUBLE, 0, "10.72"}, - {"J_P73", GCFPValue::LPT_DOUBLE, 0, "10.73"}, - {"J_P74", GCFPValue::LPT_DOUBLE, 0, "10.74"}, - {"J_P75", GCFPValue::LPT_DOUBLE, 0, "10.75"}, - {"J_P76", GCFPValue::LPT_DOUBLE, 0, "10.76"}, - {"J_P77", GCFPValue::LPT_DOUBLE, 0, "10.77"}, - {"J_P78", GCFPValue::LPT_DOUBLE, 0, "10.78"}, - {"J_P79", GCFPValue::LPT_DOUBLE, 0, "10.79"}, - {"J_P80", GCFPValue::LPT_DOUBLE, 0, "10.80"}, - {"J_P81", GCFPValue::LPT_DOUBLE, 0, "10.81"}, - {"J_P82", GCFPValue::LPT_DOUBLE, 0, "10.82"}, - {"J_P83", GCFPValue::LPT_DOUBLE, 0, "10.83"}, - {"J_P84", GCFPValue::LPT_DOUBLE, 0, "10.84"}, - {"J_P85", GCFPValue::LPT_DOUBLE, 0, "10.85"}, - {"J_P86", GCFPValue::LPT_DOUBLE, 0, "10.86"}, - {"J_P87", GCFPValue::LPT_DOUBLE, 0, "10.87"}, - {"J_P88", GCFPValue::LPT_DOUBLE, 0, "10.88"}, - {"J_P89", GCFPValue::LPT_DOUBLE, 0, "10.89"}, - {"J_P90", GCFPValue::LPT_DOUBLE, 0, "10.90"}, - {"J_P91", GCFPValue::LPT_DOUBLE, 0, "10.91"}, - {"J_P92", GCFPValue::LPT_DOUBLE, 0, "10.92"}, - {"J_P93", GCFPValue::LPT_DOUBLE, 0, "10.93"}, - {"J_P94", GCFPValue::LPT_DOUBLE, 0, "10.94"}, - {"J_P95", GCFPValue::LPT_DOUBLE, 0, "10.95"}, - {"J_P96", GCFPValue::LPT_DOUBLE, 0, "10.96"}, - {"J_P97", GCFPValue::LPT_DOUBLE, 0, "10.97"}, - {"J_P98", GCFPValue::LPT_DOUBLE, 0, "10.98"}, - {"J_P99", GCFPValue::LPT_DOUBLE, 0, "10.99"}, + {"J_P00", GCFPValue::DOUBLE_VAL, GCF_READWRITE_PROP, "10.00"}, + {"J_P01", GCFPValue::DOUBLE_VAL, GCF_READWRITE_PROP, "10.01"}, + {"J_P02", GCFPValue::DOUBLE_VAL, GCF_READWRITE_PROP, "10.02"}, + {"J_P03", GCFPValue::DOUBLE_VAL, GCF_READWRITE_PROP, "10.03"}, + {"J_P04", GCFPValue::DOUBLE_VAL, GCF_READWRITE_PROP, "10.04"}, + {"J_P05", GCFPValue::DOUBLE_VAL, GCF_READWRITE_PROP, "10.05"}, + {"J_P06", GCFPValue::DOUBLE_VAL, GCF_READWRITE_PROP, "10.06"}, + {"J_P07", GCFPValue::DOUBLE_VAL, GCF_READWRITE_PROP, "10.07"}, + {"J_P08", GCFPValue::DOUBLE_VAL, GCF_READWRITE_PROP, "10.08"}, + {"J_P09", GCFPValue::DOUBLE_VAL, GCF_READWRITE_PROP, "10.09"}, + {"J_P10", GCFPValue::DOUBLE_VAL, GCF_READWRITE_PROP, "10.00"}, + {"J_P11", GCFPValue::DOUBLE_VAL, GCF_READWRITE_PROP, "10.11"}, + {"J_P12", GCFPValue::DOUBLE_VAL, GCF_READWRITE_PROP, "10.12"}, + {"J_P13", GCFPValue::DOUBLE_VAL, GCF_READWRITE_PROP, "10.13"}, + {"J_P14", GCFPValue::DOUBLE_VAL, GCF_READWRITE_PROP, "10.14"}, + {"J_P15", GCFPValue::DOUBLE_VAL, GCF_READWRITE_PROP, "10.15"}, + {"J_P16", GCFPValue::DOUBLE_VAL, GCF_READWRITE_PROP, "10.16"}, + {"J_P17", GCFPValue::DOUBLE_VAL, GCF_READWRITE_PROP, "10.17"}, + {"J_P18", GCFPValue::DOUBLE_VAL, GCF_READWRITE_PROP, "10.18"}, + {"J_P19", GCFPValue::DOUBLE_VAL, GCF_READWRITE_PROP, "10.19"}, + {"J_P20", GCFPValue::DOUBLE_VAL, GCF_READWRITE_PROP, "10.20"}, + {"J_P21", GCFPValue::DOUBLE_VAL, GCF_READWRITE_PROP, "10.21"}, + {"J_P22", GCFPValue::DOUBLE_VAL, GCF_READWRITE_PROP, "10.22"}, + {"J_P23", GCFPValue::DOUBLE_VAL, GCF_READWRITE_PROP, "10.23"}, + {"J_P24", GCFPValue::DOUBLE_VAL, GCF_READWRITE_PROP, "10.24"}, + {"J_P25", GCFPValue::DOUBLE_VAL, GCF_READWRITE_PROP, "10.25"}, + {"J_P26", GCFPValue::DOUBLE_VAL, GCF_READWRITE_PROP, "10.26"}, + {"J_P27", GCFPValue::DOUBLE_VAL, GCF_READWRITE_PROP, "10.27"}, + {"J_P28", GCFPValue::DOUBLE_VAL, GCF_READWRITE_PROP, "10.28"}, + {"J_P29", GCFPValue::DOUBLE_VAL, GCF_READWRITE_PROP, "10.29"}, + {"J_P30", GCFPValue::DOUBLE_VAL, GCF_READWRITE_PROP, "10.30"}, + {"J_P31", GCFPValue::DOUBLE_VAL, GCF_READWRITE_PROP, "10.31"}, + {"J_P32", GCFPValue::DOUBLE_VAL, GCF_READWRITE_PROP, "10.32"}, + {"J_P33", GCFPValue::DOUBLE_VAL, GCF_READWRITE_PROP, "10.33"}, + {"J_P34", GCFPValue::DOUBLE_VAL, GCF_READWRITE_PROP, "10.34"}, + {"J_P35", GCFPValue::DOUBLE_VAL, GCF_READWRITE_PROP, "10.35"}, + {"J_P36", GCFPValue::DOUBLE_VAL, GCF_READWRITE_PROP, "10.36"}, + {"J_P37", GCFPValue::DOUBLE_VAL, GCF_READWRITE_PROP, "10.37"}, + {"J_P38", GCFPValue::DOUBLE_VAL, GCF_READWRITE_PROP, "10.38"}, + {"J_P39", GCFPValue::DOUBLE_VAL, GCF_READWRITE_PROP, "10.39"}, + {"J_P40", GCFPValue::DOUBLE_VAL, GCF_READWRITE_PROP, "10.40"}, + {"J_P41", GCFPValue::DOUBLE_VAL, GCF_READWRITE_PROP, "10.41"}, + {"J_P42", GCFPValue::DOUBLE_VAL, GCF_READWRITE_PROP, "10.42"}, + {"J_P43", GCFPValue::DOUBLE_VAL, GCF_READWRITE_PROP, "10.43"}, + {"J_P44", GCFPValue::DOUBLE_VAL, GCF_READWRITE_PROP, "10.44"}, + {"J_P45", GCFPValue::DOUBLE_VAL, GCF_READWRITE_PROP, "10.45"}, + {"J_P46", GCFPValue::DOUBLE_VAL, GCF_READWRITE_PROP, "10.46"}, + {"J_P47", GCFPValue::DOUBLE_VAL, GCF_READWRITE_PROP, "10.47"}, + {"J_P48", GCFPValue::DOUBLE_VAL, GCF_READWRITE_PROP, "10.48"}, + {"J_P49", GCFPValue::DOUBLE_VAL, GCF_READWRITE_PROP, "10.49"}, + {"J_P50", GCFPValue::DOUBLE_VAL, GCF_READWRITE_PROP, "10.50"}, + {"J_P51", GCFPValue::DOUBLE_VAL, GCF_READWRITE_PROP, "10.51"}, + {"J_P52", GCFPValue::DOUBLE_VAL, GCF_READWRITE_PROP, "10.52"}, + {"J_P53", GCFPValue::DOUBLE_VAL, GCF_READWRITE_PROP, "10.53"}, + {"J_P54", GCFPValue::DOUBLE_VAL, GCF_READWRITE_PROP, "10.54"}, + {"J_P55", GCFPValue::DOUBLE_VAL, GCF_READWRITE_PROP, "10.55"}, + {"J_P56", GCFPValue::DOUBLE_VAL, GCF_READWRITE_PROP, "10.56"}, + {"J_P57", GCFPValue::DOUBLE_VAL, GCF_READWRITE_PROP, "10.57"}, + {"J_P58", GCFPValue::DOUBLE_VAL, GCF_READWRITE_PROP, "10.58"}, + {"J_P59", GCFPValue::DOUBLE_VAL, GCF_READWRITE_PROP, "10.59"}, + {"J_P60", GCFPValue::DOUBLE_VAL, GCF_READWRITE_PROP, "10.60"}, + {"J_P61", GCFPValue::DOUBLE_VAL, GCF_READWRITE_PROP, "10.61"}, + {"J_P62", GCFPValue::DOUBLE_VAL, GCF_READWRITE_PROP, "10.62"}, + {"J_P63", GCFPValue::DOUBLE_VAL, GCF_READWRITE_PROP, "10.63"}, + {"J_P64", GCFPValue::DOUBLE_VAL, GCF_READWRITE_PROP, "10.64"}, + {"J_P65", GCFPValue::DOUBLE_VAL, GCF_READWRITE_PROP, "10.65"}, + {"J_P66", GCFPValue::DOUBLE_VAL, GCF_READWRITE_PROP, "10.66"}, + {"J_P67", GCFPValue::DOUBLE_VAL, GCF_READWRITE_PROP, "10.67"}, + {"J_P68", GCFPValue::DOUBLE_VAL, GCF_READWRITE_PROP, "10.68"}, + {"J_P69", GCFPValue::DOUBLE_VAL, GCF_READWRITE_PROP, "10.69"}, + {"J_P70", GCFPValue::DOUBLE_VAL, GCF_READWRITE_PROP, "10.70"}, + {"J_P71", GCFPValue::DOUBLE_VAL, GCF_READWRITE_PROP, "10.71"}, + {"J_P72", GCFPValue::DOUBLE_VAL, GCF_READWRITE_PROP, "10.72"}, + {"J_P73", GCFPValue::DOUBLE_VAL, GCF_READWRITE_PROP, "10.73"}, + {"J_P74", GCFPValue::DOUBLE_VAL, GCF_READWRITE_PROP, "10.74"}, + {"J_P75", GCFPValue::DOUBLE_VAL, GCF_READWRITE_PROP, "10.75"}, + {"J_P76", GCFPValue::DOUBLE_VAL, GCF_READWRITE_PROP, "10.76"}, + {"J_P77", GCFPValue::DOUBLE_VAL, GCF_READWRITE_PROP, "10.77"}, + {"J_P78", GCFPValue::DOUBLE_VAL, GCF_READWRITE_PROP, "10.78"}, + {"J_P79", GCFPValue::DOUBLE_VAL, GCF_READWRITE_PROP, "10.79"}, + {"J_P80", GCFPValue::DOUBLE_VAL, GCF_READWRITE_PROP, "10.80"}, + {"J_P81", GCFPValue::DOUBLE_VAL, GCF_READWRITE_PROP, "10.81"}, + {"J_P82", GCFPValue::DOUBLE_VAL, GCF_READWRITE_PROP, "10.82"}, + {"J_P83", GCFPValue::DOUBLE_VAL, GCF_READWRITE_PROP, "10.83"}, + {"J_P84", GCFPValue::DOUBLE_VAL, GCF_READWRITE_PROP, "10.84"}, + {"J_P85", GCFPValue::DOUBLE_VAL, GCF_READWRITE_PROP, "10.85"}, + {"J_P86", GCFPValue::DOUBLE_VAL, GCF_READWRITE_PROP, "10.86"}, + {"J_P87", GCFPValue::DOUBLE_VAL, GCF_READWRITE_PROP, "10.87"}, + {"J_P88", GCFPValue::DOUBLE_VAL, GCF_READWRITE_PROP, "10.88"}, + {"J_P89", GCFPValue::DOUBLE_VAL, GCF_READWRITE_PROP, "10.89"}, + {"J_P90", GCFPValue::DOUBLE_VAL, GCF_READWRITE_PROP, "10.90"}, + {"J_P91", GCFPValue::DOUBLE_VAL, GCF_READWRITE_PROP, "10.91"}, + {"J_P92", GCFPValue::DOUBLE_VAL, GCF_READWRITE_PROP, "10.92"}, + {"J_P93", GCFPValue::DOUBLE_VAL, GCF_READWRITE_PROP, "10.93"}, + {"J_P94", GCFPValue::DOUBLE_VAL, GCF_READWRITE_PROP, "10.94"}, + {"J_P95", GCFPValue::DOUBLE_VAL, GCF_READWRITE_PROP, "10.95"}, + {"J_P96", GCFPValue::DOUBLE_VAL, GCF_READWRITE_PROP, "10.96"}, + {"J_P97", GCFPValue::DOUBLE_VAL, GCF_READWRITE_PROP, "10.97"}, + {"J_P98", GCFPValue::DOUBLE_VAL, GCF_READWRITE_PROP, "10.98"}, + {"J_P99", GCFPValue::DOUBLE_VAL, GCF_READWRITE_PROP, "10.99"}, }; const TPropertySet propertySetD1 = @@ -219,12 +220,12 @@ const TPropertySet propertySetD1 = const TProperty propertiesSE1[] = { - {"P1", GCFPValue::LPT_CHAR, 0, "11"}, - {"P2", GCFPValue::LPT_DOUBLE, 0, "25"}, - {"P3", GCFPValue::LPT_STRING, 0, "33.3"}, - {"P4", GCFPValue::LPT_DOUBLE, 0, "11"}, - {"P5", GCFPValue::LPT_INTEGER, 0, "25"}, - {"P6", GCFPValue::LPT_UNSIGNED, 0, "33.3"}, + {"P1", GCFPValue::CHAR_VAL, GCF_READWRITE_PROP, "11"}, + {"P2", GCFPValue::DOUBLE_VAL, GCF_READWRITE_PROP, "25"}, + {"P3", GCFPValue::STRING_VAL, GCF_READWRITE_PROP, "33.3"}, + {"P4", GCFPValue::DOUBLE_VAL, GCF_READWRITE_PROP, "11"}, + {"P5", GCFPValue::INTEGER_VAL, GCF_READWRITE_PROP, "25"}, + {"P6", GCFPValue::UNSIGNED_VAL, GCF_READWRITE_PROP, "33.3"}, }; const TPropertySet propertySetE1 = diff --git a/MAC/Test/GCF/src/Makefile.am b/MAC/Test/GCF/src/Makefile.am index a09fce972c132e659da4044d27949ba74fd892fa..7c4c00c4e24804cd1801735230eb7998d8c3797b 100644 --- a/MAC/Test/GCF/src/Makefile.am +++ b/MAC/Test/GCF/src/Makefile.am @@ -6,38 +6,38 @@ SUFFIXES = .ph DOCHDRS = \ SupervisedTask.h \ - PropertyProxy.h + PropertyProxy.h \ + Answer.h -lib_LTLIBRARIES = libgcf.la +noinst_LTLIBRARIES = libgcftest.la -libgcf_la_SOURCES= $(DOCHDRS) \ +libgcftest_la_SOURCES= $(DOCHDRS) \ SupervisedTask.cc \ - PropertyProxy.cc + PropertyProxy.cc \ + Answer.cc -bin_PROGRAMS = Application1 Application2 +noinst_PROGRAMS = Application1 Application2 Application1_SOURCES = Application1.cc -Application1_LDADD = libgcf.la -Application1_DEPENDENCIES = libgcf.la $(LOFAR_DEPEND) +Application1_LDADD = libgcftest.la +Application1_DEPENDENCIES = libgcftest.la $(LOFAR_DEPEND) Application2_SOURCES = Application2.cc -Application2_LDADD = libgcf.la -Application2_DEPENDENCIES = libgcf.la $(LOFAR_DEPEND) +Application2_LDADD = libgcftest.la +Application2_DEPENDENCIES = libgcftest.la $(LOFAR_DEPEND) BUILT_SOURCES = \ - TST_Protocol.ph - -EXTRA_DIST = \ TST_Protocol.ph \ test.ns \ test.top \ log4cplus.properties - -pkgdata_DATA = \ + +EXTRA_DIST = \ + TST_Protocol.ph \ test.ns \ test.top \ log4cplus.properties - + %.properties: $(MAC_CONFIG)/%.properties cp $< $@ diff --git a/MAC/Test/GCF/src/PropertyProxy.h b/MAC/Test/GCF/src/PropertyProxy.h index 5cb65eb18705abb2c9244a0451cc1c870db894e2..adadf1da85ed727bdc31a9dcd49afd2e7c4c6210 100644 --- a/MAC/Test/GCF/src/PropertyProxy.h +++ b/MAC/Test/GCF/src/PropertyProxy.h @@ -23,7 +23,7 @@ #ifndef PROPERTYPROXY_H #define PROPERTYPROXY_H -#include <PML/GCF_PropertyProxy.h> +#include <GCF/GCF_PropertyProxy.h> class SupervisedTask; diff --git a/MAC/Test/GCF/src/SupervisedTask.cc b/MAC/Test/GCF/src/SupervisedTask.cc index 3070eaaf9e6d41ca56d820268be98a7afef1a28c..21fbf018e554c2d5b0d0551adbdaf09bee63f32c 100644 --- a/MAC/Test/GCF/src/SupervisedTask.cc +++ b/MAC/Test/GCF/src/SupervisedTask.cc @@ -1,27 +1,12 @@ #include "SupervisedTask.h" +#include <GCF/GCF_Answer.h> #include "TST_Protocol.ph" -/** - * F_PVSS_PROTOCOL signal names - */ -const char* F_PML_PROTOCOL_signalnames[] = -{ - "F_PML_PROTOCOL: invalid signal", - "F_SUBCRIBED_SIG (IN)", - "F_UNSUBCRIBED_SIG (IN)", - "F_VCHANGEMSG_SIG (IN)", - "F_VGETRESP_SIG (IN)", - "F_APCLOADED_SIG (IN)", - "F_APCUNLOADED_SIG (IN)", - "F_APCRELOADED_SIG (IN)", - "F_MYLOADED_SIG (IN)", - "F_MYUNLOADED_SIG (IN)", -}; - SupervisedTask::SupervisedTask(GCFTask& a, string taskName) : - GCFSupervisedTask((State)&SupervisedTask::initial, taskName), + GCFTask((State)&SupervisedTask::initial, taskName), _application(a), - _proxy(*this) + _proxy(*this), + _answer(*this) { // register the protocol for debugging purposes registerProtocol(F_PML_PROTOCOL, F_PML_PROTOCOL_signalnames); @@ -40,85 +25,32 @@ int SupervisedTask::initial(GCFEvent& e, GCFPortInterface& p) void SupervisedTask::propSubscribed(const string& propName) { - GCFPMLAnswerEvent e(F_SUBSCRIBED_SIG); + GCFPropAnswerEvent e(F_SUBSCRIBED_SIG); e.pPropName = propName.c_str(); _application.dispatch(e, _port); } void SupervisedTask::propUnsubscribed(const string& propName) { - GCFPMLAnswerEvent e(F_UNSUBSCRIBED_SIG); + GCFPropAnswerEvent e(F_UNSUBSCRIBED_SIG); e.pPropName = propName.c_str(); _application.dispatch(e, _port); } void SupervisedTask::propValueChanged(const string& propName, const GCFPValue& value) { - GCFPMLValueEvent e(F_VCHANGEMSG_SIG); + GCFPropValueEvent e(F_VCHANGEMSG_SIG); e.pValue = &value; e.pPropName = propName.c_str(); e.internal = false; _application.dispatch(e, _port); } -void SupervisedTask::valueChanged(const string& propName, const GCFPValue& value) -{ - GCFPMLValueEvent e(F_VCHANGEMSG_SIG); - e.pValue = &value; - e.pPropName = propName.c_str(); - e.internal = true; - _application.dispatch(e, _port); -} - void SupervisedTask::valueGet(const string& propName, const GCFPValue& value) { - GCFPMLValueEvent e(F_VGETRESP_SIG); + GCFPropValueEvent e(F_VGETRESP_SIG); e.pValue = &value; e.pPropName = propName.c_str(); e.internal = false; _application.dispatch(e, _port); } - -void SupervisedTask::apcLoaded(const string& apcName, const string& scope, TGCFResult result) -{ - GCFPMLAPCAnswerEvent e(F_APCLOADED_SIG); - e.pScope = scope.c_str(); - e.pApcName = apcName.c_str(); - e.result = result; - _application.dispatch(e, _port); -} - -void SupervisedTask::apcUnloaded(const string& apcName, const string& scope, TGCFResult result) -{ - GCFPMLAPCAnswerEvent e(F_APCUNLOADED_SIG); - e.pScope = scope.c_str(); - e.pApcName = apcName.c_str(); - e.result = result; - _application.dispatch(e, _port); -} - -void SupervisedTask::apcReloaded(const string& apcName, const string& scope, TGCFResult result) -{ - GCFPMLAPCAnswerEvent e(F_APCRELOADED_SIG); - e.pScope = scope.c_str(); - e.pApcName = apcName.c_str(); - e.result = result; - _application.dispatch(e, _port); -} - -void SupervisedTask::myPropertiesLoaded(const string& scope, TGCFResult result) -{ - GCFPMLMYPAnswerEvent e(F_MYLOADED_SIG); - e.pScope = scope.c_str(); - e.result = result; - _application.dispatch(e, _port); -} - -void SupervisedTask::myPropertiesUnloaded(const string& scope, TGCFResult result) -{ - GCFPMLMYPAnswerEvent e(F_MYUNLOADED_SIG); - e.pScope = scope.c_str(); - e.result = result; - _application.dispatch(e, _port); -} - diff --git a/MAC/Test/GCF/src/SupervisedTask.h b/MAC/Test/GCF/src/SupervisedTask.h index 439476f423a534777f16b591fe5a89c002b3a583..fdfae9e8292d19244626ebe071944d2b0dca45bc 100644 --- a/MAC/Test/GCF/src/SupervisedTask.h +++ b/MAC/Test/GCF/src/SupervisedTask.h @@ -1,20 +1,25 @@ #ifndef SUPERVISEDTASK_H #define SUPERVISEDTASK_H -#include <PML/GCF_SupTask.h> -#include <TM/Socket/GCF_TCPPort.h> -#include <TM/GCF_TMProtocols.h> -#include <GCFCommon/GCF_Defines.h> +#include <GCF/GCF_Task.h> +#include <GCF/GCF_TCPPort.h> +#include <GCF/GCF_TMProtocols.h> +#include <GCF/GCF_Defines.h> #include "PropertyProxy.h" +#include "Answer.h" -class SupervisedTask : public GCFSupervisedTask +class SupervisedTask : public GCFTask { public: SupervisedTask(GCFTask& a, string taskName); ~SupervisedTask(); inline GCFTCPPort& getPort() {return _port;} - inline PropertyProxy& getProxy() {return _proxy;} + inline PropertyProxy& getProxy() {return _proxy;} + inline Answer& getAnswerObj() {return _answer;} + + inline void handleAnswer(GCFEvent& answer) + { _application.dispatch(answer, _port); } private: // state methods int initial(GCFEvent& e, GCFPortInterface& p); @@ -23,93 +28,13 @@ class SupervisedTask : public GCFSupervisedTask friend class PropertyProxy; void propSubscribed(const string& propName); void propUnsubscribed(const string& propName); - - private: // definition of abstract methods of GCFSupervisedTask - void valueChanged(const string& propName, const GCFPValue& value); void propValueChanged(const string& propName, const GCFPValue& value); - void valueGet(const string& propName, const GCFPValue& value); - void apcLoaded(const string& apcName, const string& scope, TGCFResult result); - void apcUnloaded(const string& apcName, const string& scope, TGCFResult result); - void apcReloaded(const string& apcName, const string& scope, TGCFResult result); - void myPropertiesLoaded(const string& scope, TGCFResult result); - void myPropertiesUnloaded(const string& scope, TGCFResult result); + void valueGet(const string& propName, const GCFPValue& value); private: GCFTCPPort _port; GCFTask& _application; PropertyProxy _proxy; + Answer _answer; }; - -// only for internal use -struct GCFPMLValueEvent : public GCFEvent -{ - GCFPMLValueEvent(unsigned short sig) : GCFEvent(sig) - { - length = sizeof(GCFPMLValueEvent); - } - const GCFPValue* pValue; - const char* pPropName; - bool internal; -}; - -struct GCFPMLAnswerEvent : public GCFEvent -{ - GCFPMLAnswerEvent(unsigned short sig) : GCFEvent(sig) - { - length = sizeof(GCFPMLAnswerEvent); - } - const char* pPropName; -}; - -struct GCFPMLAPCAnswerEvent : public GCFEvent -{ - GCFPMLAPCAnswerEvent(unsigned short sig) : GCFEvent(sig) - { - length = sizeof(GCFPMLAPCAnswerEvent); - } - const char* pApcName; - const char* pScope; - TGCFResult result; -}; - -struct GCFPMLMYPAnswerEvent : public GCFEvent -{ - GCFPMLMYPAnswerEvent(unsigned short sig) : GCFEvent(sig) - { - length = sizeof(GCFPMLMYPAnswerEvent); - } - const char* pScope; - TGCFResult result; -}; - -enum { - F_PML_PROTOCOL = F_GCF_PROTOCOL, -}; -/** - * F_PML_PROTOCOL signals - */ -enum { - F_SUBSCRIBED_ID = 1, - F_UNSUBSCRIBED_ID, - F_VCHANGEMSG_ID, - F_VGETRESP_ID, - F_APCLOADED_ID, - F_APCUNLOADED_ID, - F_APCRELOADED_ID, - F_MYLOADED_ID, - F_MYUNLOADED_ID, -}; - -#define F_SUBSCRIBED_SIG F_SIGNAL(F_PML_PROTOCOL, F_SUBSCRIBED_ID, F_IN) -#define F_UNSUBSCRIBED_SIG F_SIGNAL(F_PML_PROTOCOL, F_UNSUBSCRIBED_ID, F_IN) -#define F_VCHANGEMSG_SIG F_SIGNAL(F_PML_PROTOCOL, F_VCHANGEMSG_ID, F_IN) -#define F_VGETRESP_SIG F_SIGNAL(F_PML_PROTOCOL, F_VGETRESP_ID, F_IN) -#define F_APCLOADED_SIG F_SIGNAL(F_PML_PROTOCOL, F_APCLOADED_ID, F_IN) -#define F_APCUNLOADED_SIG F_SIGNAL(F_PML_PROTOCOL, F_APCUNLOADED_ID, F_IN) -#define F_APCRELOADED_SIG F_SIGNAL(F_PML_PROTOCOL, F_APCRELOADED_ID, F_IN) -#define F_MYLOADED_SIG F_SIGNAL(F_PML_PROTOCOL, F_MYLOADED_ID, F_IN) -#define F_MYUNLOADED_SIG F_SIGNAL(F_PML_PROTOCOL, F_MYUNLOADED_ID, F_IN) - -extern const char* F_PML_PROTOCOL_signalnames[]; - #endif diff --git a/MAC/Test/PROTO/PROP/src/FPBoolValue.h b/MAC/Test/PROTO/PROP/src/FPBoolValue.h index 03ef718e9aabff556b0d5f2fdd13887f0b59446e..384f7806b0287460f06bf24e14f9812c1cff64f5 100644 --- a/MAC/Test/PROTO/PROP/src/FPBoolValue.h +++ b/MAC/Test/PROTO/PROP/src/FPBoolValue.h @@ -33,7 +33,7 @@ class FPBoolValue : public FPValue { public: - FPBoolValue(bool val = false) : FPValue(LPT_BOOL), value_(val) {;} + FPBoolValue(bool val = false) : FPValue(BOOL_VAL), value_(val) {;} virtual ~FPBoolValue() {;} /** Write property of float value_. */ diff --git a/MAC/Test/PROTO/PROP/src/FPByteValue.h b/MAC/Test/PROTO/PROP/src/FPByteValue.h index fff3c34f3fac244b4087cebde6cf211dd59340da..672fa2b4458223dd99fbb19e342c5fa17dd2d6fb 100644 --- a/MAC/Test/PROTO/PROP/src/FPByteValue.h +++ b/MAC/Test/PROTO/PROP/src/FPByteValue.h @@ -26,9 +26,37 @@ #include "FPValue.h" +/** + *@author pvss longlong + */ + +class FPUCharValue : public FPValue { +public: + FPUCharValue(const uchar& val = 0) : FPValue(UCHAR_VAL), value_(val) {;} + virtual ~FPUCharValue() {;} + /** No descriptions */ + int setValue(FPValue* newValue); + /** Write property of unsigned char value_. */ + virtual inline void setValue( const uchar newVal) {value_ = newVal;} + /** Read property of unsigned char value_. */ + virtual inline uchar getValue() const {return value_;} + /** No descriptions */ + virtual FPValue* clone() const; + /** No descriptions */ + virtual void copy(const FPValue* pValue); + +private: // Private attributes + /** No descriptions */ + virtual uint unpack(const char* valBuf); + /** No descriptions */ + virtual uint pack(char* valBuf) const; + /** */ + uchar value_; +}; + class FPCharValue : public FPValue { public: - FPCharValue(const char& val = 0) : FPValue(LPT_CHAR), value_(val) {;} + FPCharValue(const char& val = 0) : FPValue(CHAR_VAL), value_(val) {;} virtual ~FPCharValue() {;} /** No descriptions */ int setValue(FPValue* newValue); diff --git a/MAC/Test/PROTO/PROP/src/FPDoubleValue.h b/MAC/Test/PROTO/PROP/src/FPDoubleValue.h index 4fe22e4280688aaa548029d1ee02ff4f2d1dc0ea..31e678d8162cd897f7ae5c9d365c9ee895ccd225 100644 --- a/MAC/Test/PROTO/PROP/src/FPDoubleValue.h +++ b/MAC/Test/PROTO/PROP/src/FPDoubleValue.h @@ -33,7 +33,7 @@ class FPDoubleValue : public FPValue { public: - FPDoubleValue(const double& val = 0.0) : FPValue(LPT_DOUBLE), value_(val) {;} + FPDoubleValue(const double& val = 0.0) : FPValue(DOUBLE_VAL), value_(val) {;} virtual ~FPDoubleValue() {;} /** Write property of double value_. */ @@ -57,9 +57,9 @@ private: // Private attributes class FPComplexDoubleValue : public FPValue { public: - FPComplexDoubleValue(const double val[]) : FPValue(COMPLEX_LPT_DOUBLE) + FPComplexDoubleValue(const double val[]) : FPValue(COMPLEX_DOUBLE_VAL) {value_[0] = val[0]; value_[1] = val[1];} - FPComplexDoubleValue(const double real = 0.0, const double imag = 0.0) : FPValue(COMPLEX_LPT_DOUBLE) + FPComplexDoubleValue(const double real = 0.0, const double imag = 0.0) : FPValue(COMPLEX_DOUBLE_VAL) {value_[0] = real; value_[1] = imag;} virtual ~FPComplexDoubleValue() {;} diff --git a/MAC/Test/PROTO/PROP/src/FPValue.h b/MAC/Test/PROTO/PROP/src/FPValue.h index 909a131bffcc9547b6d9c5a2aed5246681103d64..331ce4c1b8d073d1089f772ee76a1cbd7c271090 100644 --- a/MAC/Test/PROTO/PROP/src/FPValue.h +++ b/MAC/Test/PROTO/PROP/src/FPValue.h @@ -38,8 +38,8 @@ class FProperty; class FPValue { public: - enum ValueType {LPT_BOOL = 1, ULPT_CHAR, LPT_CHAR, USHORT_VAL, SHORT_VAL, ULONG_VAL, LONG_VAL, - ULONGLONG_VAL, LONGLONG_VAL, LPT_DOUBLE, COMPLEX_LPT_DOUBLE, FLOAT_VAL, + enum ValueType {BOOL_VAL = 1, UCHAR_VAL, CHAR_VAL, USHORT_VAL, SHORT_VAL, ULONG_VAL, LONG_VAL, + ULONGLONG_VAL, LONGLONG_VAL, DOUBLE_VAL, COMPLEX_DOUBLE_VAL, FLOAT_VAL, COMPLEX_FLOAT_VAL, STRING, ARRAY_VAL = 0x80}; diff --git a/MAC/Test/PROTO/PROP/src/FProperty.cc b/MAC/Test/PROTO/PROP/src/FProperty.cc index 7b917f82403a25bf6a15ab44ebb83cc33092f2af..b44aad7878799e975c60c0033e9ae3460e6a680f 100644 --- a/MAC/Test/PROTO/PROP/src/FProperty.cc +++ b/MAC/Test/PROTO/PROP/src/FProperty.cc @@ -46,17 +46,17 @@ FProperty::FProperty(const char* name, FPValue::ValueType type) : switch (type) { - case FPValue::LPT_BOOL: + case FPValue::BOOL_VAL: pOldValue_ = new FPBoolValue(); pOriginalValue_ = new FPBoolValue(); pOnlineValue_ = new FPBoolValue(); break; - case FPValue::ULPT_CHAR: + case FPValue::UCHAR_VAL: pOldValue_ = new FPUCharValue(); pOriginalValue_ = new FPUCharValue(); pOnlineValue_ = new FPUCharValue(); break; - case FPValue::LPT_CHAR: + case FPValue::CHAR_VAL: pOldValue_ = new FPCharValue(); pOriginalValue_ = new FPCharValue(); pOnlineValue_ = new FPCharValue(); @@ -101,12 +101,12 @@ FProperty::FProperty(const char* name, FPValue::ValueType type) : pOriginalValue_ = new FPComplexFloatValue(); pOnlineValue_ = new FPComplexFloatValue(); break; - case FPValue::LPT_DOUBLE: + case FPValue::DOUBLE_VAL: pOldValue_ = new FPDoubleValue(); pOriginalValue_ = new FPDoubleValue(); pOnlineValue_ = new FPDoubleValue(); break; - case FPValue::COMPLEX_LPT_DOUBLE: + case FPValue::COMPLEX_DOUBLE_VAL: pOldValue_ = new FPComplexDoubleValue(); pOriginalValue_ = new FPComplexDoubleValue(); pOnlineValue_ = new FPComplexDoubleValue(); diff --git a/MAC/Tools/LofarLogger/configure.in b/MAC/Tools/LofarLogger/configure.in index 264820d0ab8fd402a08e1377e00c3c6c5237485e..5e549b141a0e6fd337df47f57716f9b8a57788d4 100644 --- a/MAC/Tools/LofarLogger/configure.in +++ b/MAC/Tools/LofarLogger/configure.in @@ -56,7 +56,7 @@ lofar_QATOOLS lofar_DOCXX lofar_MPI(0) lofar_PACKAGE(LCS/Common) -lofar_EXTERNAL(log4cplus,1,log4cplus/logger.h,,) +lofar_EXTERNAL(log4cplus,1,log4cplus/logger.h,log4cplus,) dnl dnl Output Makefiles