diff --git a/.gitattributes b/.gitattributes index ca4fdafad9a1eb769055567ff265ab9e5fe7b2db..f8bbda663ad7503a3efb24ca554afbff1fcdd3c6 100644 --- a/.gitattributes +++ b/.gitattributes @@ -141,7 +141,6 @@ MAC/GCF/_CoreComps/PA/Makefile.am -text svneol=native#application/octet-stream MAC/GCF/_CoreComps/PA/configure.in -text svneol=native#application/octet-stream MAC/GCF/_CoreComps/PA/src/Makefile.am -text svneol=native#application/octet-stream MAC/GCF/_CoreComps/PA/src/PA_Protocol.prot -text svneol=native#application/octet-stream -MAC/GCF/_CoreComps/PML/Makefile -text svneol=native#application/octet-stream MAC/GCF/_CoreComps/PML/Makefile.am -text svneol=native#application/octet-stream MAC/GCF/_CoreComps/PML/configure.in -text svneol=native#application/octet-stream MAC/GCF/_CoreComps/PML/src/Makefile.am -text svneol=native#application/octet-stream diff --git a/MAC/GCF/_CoreComps/PA/src/GPA_Controller.cc b/MAC/GCF/_CoreComps/PA/src/GPA_Controller.cc index d99ce6596527485823a13dbad216e221b537ee92..df24d3095a246f84a5bd9384565a332852dc077e 100644 --- a/MAC/GCF/_CoreComps/PA/src/GPA_Controller.cc +++ b/MAC/GCF/_CoreComps/PA/src/GPA_Controller.cc @@ -305,12 +305,10 @@ void GPAController::apcLoaded(TPAResult result) { result = _usecountManager.setDefaults(*propsFromAPC); } -#ifdef PML GCFEvent* pEvent = _requestManager.getOldestRequest(); PALoadapcEvent* pLoadapcE = static_cast<PALoadapcEvent*> (pEvent); PAApcloadedEvent e(pLoadapcE->seqnr, result); sendAPCActionResponse(e); -#endif } void GPAController::unloadAPC(char* actionData) @@ -428,14 +426,4 @@ void GPAController::unpackAPCActionData(char* pActionData) unsigned int scopeNameLength(0); sscanf(pScopeData, "%03x", &scopeNameLength); _curScope.assign(pScopeData + 3, scopeNameLength); -} - -void GPAController::loadAPCTest() -{ - const list<TAPCProperty>* propsFromAPC; - _apc.load("/home/mueller/workspace/LOFAR/MAC/GCF/CoreComps/PA/src/apc1.xml", "receptor1"); - propsFromAPC = &_apc.getProperties(); - TPAResult result = _usecountManager.incrementUsecount(*propsFromAPC); - if (!_usecountManager.waitForAsyncResponses()) - result = _usecountManager.setDefaults(*propsFromAPC); -} +} \ No newline at end of file diff --git a/MAC/GCF/_CoreComps/PA/src/GPA_Controller.h b/MAC/GCF/_CoreComps/PA/src/GPA_Controller.h index 87feb72da3bba81257ce940c52cc66f0235ba183..d4408860562b3aa3251ed12a7c91195255ff2230 100644 --- a/MAC/GCF/_CoreComps/PA/src/GPA_Controller.h +++ b/MAC/GCF/_CoreComps/PA/src/GPA_Controller.h @@ -41,8 +41,6 @@ class GPAController : public GCFTask GPAController(); virtual ~GPAController(); - void loadAPCTest(); - private: // GPAUsecountManager call back methods friend class GPAUsecountManager; void propertiesCreated(list<string>& propList); diff --git a/MAC/GCF/_CoreComps/PA/src/GPA_Main.cc b/MAC/GCF/_CoreComps/PA/src/GPA_Main.cc index 83211780bdf02b17a05973b6ad3fa9f970f1a2ba..311620594d7e572d7b8c45af79f1d3503c127c3c 100644 --- a/MAC/GCF/_CoreComps/PA/src/GPA_Main.cc +++ b/MAC/GCF/_CoreComps/PA/src/GPA_Main.cc @@ -29,7 +29,6 @@ int main(int argC, char *argV[]) GPAController propertyAgent; - propertyAgent.loadAPCTest(); propertyAgent.start(); // make initial transition GCFTask::run(); diff --git a/MAC/GCF/_CoreComps/PA/src/Makefile.am b/MAC/GCF/_CoreComps/PA/src/Makefile.am index 760454467be6d913331c2d6b01ccc2a064337c3c..022629d1d1b6f6d0964f990d67da0916064fc8fb 100644 --- a/MAC/GCF/_CoreComps/PA/src/Makefile.am +++ b/MAC/GCF/_CoreComps/PA/src/Makefile.am @@ -1,7 +1,8 @@ AUTOGEN = autogen SUFFIXES = .ph %.ph: %.prot - $(AUTOGEN) -L $(top_srcdir)/../../GCFCommon/autogen $< + $(AUTOGEN) -L $(top_srcdir)/../../GCFCommon/autogen $< && \ + chmod a+w $@ DOCHDRS = \ GPA_Controller.h \ diff --git a/MAC/GCF/_CoreComps/PA/src/apc1.xml b/MAC/GCF/_CoreComps/PA/src/apc1.xml deleted file mode 100644 index cad1c870056024961245dbf9baa3031315b5329b..0000000000000000000000000000000000000000 --- a/MAC/GCF/_CoreComps/PA/src/apc1.xml +++ /dev/null @@ -1,16 +0,0 @@ -<?xml version="1.0"?> - -<receptor> - <status> - <MACDefault> true </MACDefault> - <MACType> BOOL_VAL </MACType> - </status> - <gain> - <MACType> FLOAT_VAL </MACType> - <MACDefault> -1.3 </MACDefault> - </gain> - <sn> - <MACType> FLOAT_VAL </MACType> - <MACDefault> 8432083.434345 </MACDefault> - </sn> -</receptor> diff --git a/MAC/GCF/_CoreComps/PML/Makefile b/MAC/GCF/_CoreComps/PML/Makefile deleted file mode 100644 index 2714634878956d06450df954bdf8da66dc45a6cb..0000000000000000000000000000000000000000 --- a/MAC/GCF/_CoreComps/PML/Makefile +++ /dev/null @@ -1,45 +0,0 @@ -lof_subdir = $(shell pwd | sed -e "s%[a-zA-Z0-9/.\-_]*LOFAR/%%g") -back_dir = $(shell echo $(lof_subdir) | sed -e "s%/[^/]\+%/..%g" -e "s%^[^/]\+%..%") - -all: - cd ./build/gnu_debug && make && echo done - -all_opt: - cd ./build/gnu_opt && make && echo done - -all_dopt: - cd ./build/gnu_dopt && make && echo done - -check: - cd ./build/gnu_debug && make check && echo done - -aids: - cd ./build/gnu_debug && make aids && echo done - -clean: - cd ./build/gnu_debug && make clean && echo done - -distcd: - cd ./build/gnu_debug && make distclean && echo done - -.PHONY: config configure bootstrap - -bootstrap: - ./cleanup && \ - test -f bootstrap || (sed '$(back_dir)/bootstrap' -e "s%autoconf%$(back_dir)/autoconf%g" > bootstrap && chmod a+x bootstrap ) && \ - test -d build || (mkdir build && mkdir build/gnu_debug) && \ - ./bootstrap && cd build/gnu_debug && export CC=gcc296 CXX=g++296 && ../../lofarconf && echo done - -configure: - test -d build || (mkdir build && mkdir build/gnu_debug) && \ - cd build/gnu_debug && export CC=gcc296 CXX=g++296 && ../../lofarconf && echo done - -configure_opt: - test -f bootstrap || (sed '$(back_dir)/bootstrap' -e "s%autoconf%$(back_dir)/autoconf%g" > bootstrap && chmod a+x bootstrap ) && \ - test -d build || (mkdir build && mkdir build/gnu_opt) && \ - ./bootstrap && cd build/gnu_opt && ../../lofarconf && echo done - -configure_dopt: - test -f bootstrap || (sed '$(back_dir)/bootstrap' -e "s%autoconf%$(back_dir)/autoconf%g" > bootstrap && chmod a+x bootstrap ) && \ - test -d build || (mkdir build && mkdir build/gnu_dopt) && \ - ./bootstrap && cd build/gnu_dopt && ../../lofarconf && echo done diff --git a/MAC/GCF/_CoreComps/SAL/src/GCF_PVChar.cc b/MAC/GCF/_CoreComps/SAL/src/GCF_PVChar.cc new file mode 100644 index 0000000000000000000000000000000000000000..b3e3cfb1bb8ef24102df13e661b6e00f90c4f484 --- /dev/null +++ b/MAC/GCF/_CoreComps/SAL/src/GCF_PVChar.cc @@ -0,0 +1,44 @@ +//# GCF_PVChar.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_PVChar.h" + +/** No descriptions */ +GCFPValue* GCFPVChar::clone() const +{ + GCFPValue* pNewValue = new GCFPVChar(_value); + return pNewValue; +} + +/** No descriptions */ +TSAResult GCFPVChar::copy(const GCFPValue& newVal) +{ + TSAResult result(SA_NO_ERROR); + + if (newVal.getType() == getType()) + _value = ((GCFPVChar *)&newVal)->getValue(); + else + result = SA_DIFFERENT_TYPES; + + return result; +} diff --git a/MAC/GCF/_CoreComps/SAL/src/GCF_PVChar.h b/MAC/GCF/_CoreComps/SAL/src/GCF_PVChar.h new file mode 100644 index 0000000000000000000000000000000000000000..a558c3a76e6366fd059f6edb616601c7c6dc9783 --- /dev/null +++ b/MAC/GCF/_CoreComps/SAL/src/GCF_PVChar.h @@ -0,0 +1,47 @@ +//# GCF_PVChar.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_PVCHAR_H +#define GCF_PVCHAR_H + +#include "GCF_PValue.h" + +class GCFPVChar : public GCFPValue +{ + public: + GCFPVChar(char val = 0) : GCFPValue(CHAR_VAL), _value(val) {;} + virtual ~GCFPVChar() {;} + /** Write property of char value. */ + inline void setValue( const char newVal) {_value = newVal;} + /** Read property of char value. */ + inline char getValue() const {return _value;} + /** No descriptions */ + virtual GCFPValue* clone() const; + /** No descriptions */ + virtual TSAResult copy(const GCFPValue& value); + + private: // Private attributes + /** */ + char _value; +}; + +#endif diff --git a/MAC/GCF/_CoreComps/SAL/src/GCF_PVDynArr.cc b/MAC/GCF/_CoreComps/SAL/src/GCF_PVDynArr.cc new file mode 100644 index 0000000000000000000000000000000000000000..6880574ce5a3ed8acbdc4b8bd25688602f9c472b --- /dev/null +++ b/MAC/GCF/_CoreComps/SAL/src/GCF_PVDynArr.cc @@ -0,0 +1,83 @@ +//# GCF_PVDynArr.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_PVDynArr.h" + +GCFPVDynArr::GCFPVDynArr(TMACValueType itemType, const GCFPValueArray& val) : + GCFPValue((TMACValueType) (DYNARR_VAL | itemType)) +{ + assert(itemType != DYNARR_VAL); + setValue(val); +} + +GCFPVDynArr::GCFPVDynArr(TMACValueType itemType) : + GCFPValue((TMACValueType) (DYNARR_VAL | itemType)) +{ + assert(itemType != DYNARR_VAL); +} + +GCFPVDynArr::~GCFPVDynArr() +{ + cleanup(); +} + +void GCFPVDynArr::setValue(const GCFPValueArray& newVal) +{ + cleanup(); + for (GCFPValueArray::const_iterator iter = newVal.begin(); + iter != newVal.end(); ++iter) + { + if ((*iter)->getType() == (getType() & ~DYNARR_VAL)) + _values.push_back((*iter)->clone()); + } +} + +/** No descriptions */ +GCFPValue* GCFPVDynArr::clone() const +{ + GCFPValue* pNewValue = new GCFPVDynArr(getType(), _values); + return pNewValue; +} + +/** No descriptions */ +TSAResult GCFPVDynArr::copy(const GCFPValue& newVal) +{ + TSAResult result(SA_NO_ERROR); + + if (newVal.getType() == getType()) + setValue(((GCFPVDynArr*)&newVal)->getValue()); + else + result = SA_DIFFERENT_TYPES; + + return result; +} + +void GCFPVDynArr::cleanup() +{ + for (GCFPValueArray::iterator iter = _values.begin(); + iter != _values.end(); ++iter) + { + delete *iter; + } + _values.clear(); +} diff --git a/MAC/GCF/_CoreComps/SAL/src/GCF_PVDynArr.h b/MAC/GCF/_CoreComps/SAL/src/GCF_PVDynArr.h new file mode 100644 index 0000000000000000000000000000000000000000..bf5438fd4d269d8ccc505f816ab7ee3e01acd980 --- /dev/null +++ b/MAC/GCF/_CoreComps/SAL/src/GCF_PVDynArr.h @@ -0,0 +1,53 @@ +//# GCF_PVDynArr.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_PVDYNARR_H +#define GCF_PVDYNARR_H + +#include "GCF_PValue.h" +#include <Common/lofar_vector.h> + +typedef vector<GCFPValue*> GCFPValueArray; + +class GCFPVDynArr : public GCFPValue +{ + public: + GCFPVDynArr(TMACValueType itemType, const GCFPValueArray& val); + GCFPVDynArr(TMACValueType itemType); + virtual ~GCFPVDynArr(); + /** Write property of list value_. */ + virtual void setValue(const GCFPValueArray& newVal); + /** Read property of list value_. */ + virtual inline const GCFPValueArray& getValue() const {return _values;} + /** No descriptions */ + virtual GCFPValue* clone() const; + /** No descriptions */ + virtual TSAResult copy(const GCFPValue& value); + + private: // help members + void cleanup(); + + private: // Private attributes + /** */ + GCFPValueArray _values; +}; +#endif diff --git a/MAC/GCF/_CoreComps/SAL/src/GCF_PVInteger.cc b/MAC/GCF/_CoreComps/SAL/src/GCF_PVInteger.cc new file mode 100644 index 0000000000000000000000000000000000000000..b33d6561b11600c5e803aba5c9bf5d6c128a3405 --- /dev/null +++ b/MAC/GCF/_CoreComps/SAL/src/GCF_PVInteger.cc @@ -0,0 +1,44 @@ +//# GCF_PVInteger.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_PVInteger.h" + +/** No descriptions */ +GCFPValue* GCFPVInteger::clone() const +{ + GCFPValue* pNewValue = new GCFPVInteger(_value); + return pNewValue; +} + +/** No descriptions */ +TSAResult GCFPVInteger::copy(const GCFPValue& newVal) +{ + TSAResult result(SA_NO_ERROR); + + if (newVal.getType() == getType()) + _value = ((GCFPVInteger *)&newVal)->getValue(); + else + result = SA_DIFFERENT_TYPES; + + return result; +} diff --git a/MAC/GCF/_CoreComps/SAL/src/GCF_PVInteger.h b/MAC/GCF/_CoreComps/SAL/src/GCF_PVInteger.h new file mode 100644 index 0000000000000000000000000000000000000000..0d8759592bcbbb5dd0a645cf4c421cb97cd763c9 --- /dev/null +++ b/MAC/GCF/_CoreComps/SAL/src/GCF_PVInteger.h @@ -0,0 +1,46 @@ +//# GCF_PVInteger.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_PVINTEGER_H +#define GCF_PVINTEGER_H + +#include "GCF_PValue.h" + +class GCFPVInteger : public GCFPValue +{ + public: + GCFPVInteger(int val = 0) : GCFPValue(INTEGER_VAL), _value(val) {;} + virtual ~GCFPVInteger() {;} + /** Write property of integer value_. */ + virtual inline void setValue( const int newVal) {_value = newVal;} + /** Read property of integer value_. */ + virtual inline int getValue() const {return _value;} + /** No descriptions */ + virtual GCFPValue* clone() const; + /** No descriptions */ + virtual TSAResult copy(const GCFPValue& value); + + private: // Private attributes + /** */ + int _value; +}; +#endif diff --git a/MAC/GCF/_CoreComps/SAL/src/GCF_PVString.cc b/MAC/GCF/_CoreComps/SAL/src/GCF_PVString.cc new file mode 100644 index 0000000000000000000000000000000000000000..a789dd631941b2bf13f05ca411435af19339241d --- /dev/null +++ b/MAC/GCF/_CoreComps/SAL/src/GCF_PVString.cc @@ -0,0 +1,44 @@ +//# GCF_PVString.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_PVString.h" + +/** No descriptions */ +GCFPValue* GCFPVString::clone() const +{ + GCFPValue* pNewValue = new GCFPVString(_value); + return pNewValue; +} + +/** No descriptions */ +TSAResult GCFPVString::copy(const GCFPValue& newVal) +{ + TSAResult result(SA_NO_ERROR); + + if (newVal.getType() == getType()) + _value = ((GCFPVString *)&newVal)->getValue(); + else + result = SA_DIFFERENT_TYPES; + + return result; +} diff --git a/MAC/GCF/_CoreComps/SAL/src/GCF_PVString.h b/MAC/GCF/_CoreComps/SAL/src/GCF_PVString.h new file mode 100644 index 0000000000000000000000000000000000000000..c701bcf49e433f430806ac9f84135a82e2816266 --- /dev/null +++ b/MAC/GCF/_CoreComps/SAL/src/GCF_PVString.h @@ -0,0 +1,46 @@ +//# GCF_PVString.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_PVSTRING_H +#define GCF_PVSTRING_H + +#include "GCF_PValue.h" + +class GCFPVString : public GCFPValue +{ + public: + GCFPVString(string val = "") : GCFPValue(STRING_VAL), _value(val) {;} + virtual ~GCFPVString() {;} + /** Write property of string value. */ + virtual inline void setValue(const string newVal) {_value = newVal;} + /** Read property of string value. */ + virtual inline const string& getValue() const {return _value;} + /** No descriptions */ + virtual GCFPValue* clone() const; + /** No descriptions */ + virtual TSAResult copy(const GCFPValue& value); + + private: // Private attributes + /** */ + string _value; +}; +#endif diff --git a/MAC/GCF/_CoreComps/SAL/src/GCF_PVUnsigned.cc b/MAC/GCF/_CoreComps/SAL/src/GCF_PVUnsigned.cc new file mode 100644 index 0000000000000000000000000000000000000000..0a9f656e3e7f0d011a244c72d853ab3962e5bddd --- /dev/null +++ b/MAC/GCF/_CoreComps/SAL/src/GCF_PVUnsigned.cc @@ -0,0 +1,44 @@ +//# GCF_PVUnsigned.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_PVUnsigned.h" + +/** No descriptions */ +GCFPValue* GCFPVUnsigned::clone() const +{ + GCFPValue* pNewValue = new GCFPVUnsigned(_value); + return pNewValue; +} + +/** No descriptions */ +TSAResult GCFPVUnsigned::copy(const GCFPValue& newVal) +{ + TSAResult result(SA_NO_ERROR); + + if (newVal.getType() == getType()) + _value = ((GCFPVUnsigned *)&newVal)->getValue(); + else + result = SA_DIFFERENT_TYPES; + + return result; +} diff --git a/MAC/GCF/_CoreComps/SAL/src/GCF_PVUnsigned.h b/MAC/GCF/_CoreComps/SAL/src/GCF_PVUnsigned.h new file mode 100644 index 0000000000000000000000000000000000000000..eb599f612abdfb6710e12b9896001e51f3ccc18a --- /dev/null +++ b/MAC/GCF/_CoreComps/SAL/src/GCF_PVUnsigned.h @@ -0,0 +1,46 @@ +//# GCF_PVUnsigned.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_PVUNSIGNED_H +#define GCF_PVUNSIGNED_H + +#include "GCF_PValue.h" + +class GCFPVUnsigned : public GCFPValue +{ + public: + GCFPVUnsigned(unsigned int val = 0) : GCFPValue(UNSIGNED_VAL), _value(val) {;} + virtual ~GCFPVUnsigned() {;} + /** Write property of unsigned value. */ + virtual inline void setValue( const unsigned int newVal) {_value = newVal;} + /** Read property of unsigned value. */ + virtual inline unsigned int getValue() const {return _value;} + /** No descriptions */ + virtual GCFPValue* clone() const; + /** No descriptions */ + virtual TSAResult copy(const GCFPValue& value); + + private: // Private attributes + /** */ + unsigned int _value; +}; +#endif diff --git a/MAC/GCF/_CoreComps/SAL/src/GSA_Service.cc b/MAC/GCF/_CoreComps/SAL/src/GSA_Service.cc index 8bccb6124b78ec78c49a4c8c51b8219342567450..b7dcba0482fd307285982deb1ab99ba4ccf35ad1 100644 --- a/MAC/GCF/_CoreComps/SAL/src/GSA_Service.cc +++ b/MAC/GCF/_CoreComps/SAL/src/GSA_Service.cc @@ -26,7 +26,12 @@ #include "GSA_SCADAHandler.h" #include "GCF_PVBool.h" +#include "GCF_PVChar.h" +#include "GCF_PVInteger.h" +#include "GCF_PVUnsigned.h" #include "GCF_PVDouble.h" +#include "GCF_PVString.h" +#include "GCF_PVDynArr.h" #include <DpMsgAnswer.hxx> #include <DpMsgHotLink.hxx> @@ -36,6 +41,11 @@ #include <ErrClass.hxx> #include <Manager.hxx> #include <FloatVar.hxx> +#include <CharVar.hxx> +#include <TextVar.hxx> +#include <IntegerVar.hxx> +#include <UIntegerVar.hxx> +#include <DynVar.hxx> GSAService::GSAService() : _pWFA(0) { @@ -604,22 +614,27 @@ TSAResult GSAService::convertPVSSToMAC(const Variable& variable, else result = SA_VARIABLE_WRONG_TYPE; } -/* else if (typeName == "BIT32_VAL") - { - *pMacValue = new GCFPVBit32(((Bit32Var *)&variable)->getValue()); - } else if (typeName == "CHAR_VAL") { - *pMacValue = new GCFPVChar(((CharVar *)&variable)->getValue()); + if (variable.isA() == CHAR_VAR) + *pMacValue = new GCFPVChar(((CharVar *)&variable)->getValue()); + else + result = SA_VARIABLE_WRONG_TYPE; } else if (typeName == "UNSIGNED_VAL") { - *pMacValue = new GCFPVUnsigned(((UIntegerVar *)&variable)->getValue()); + if (variable.isA() == UINTEGER_VAR) + *pMacValue = new GCFPVUnsigned(((UIntegerVar *)&variable)->getValue()); + else + result = SA_VARIABLE_WRONG_TYPE; } else if (typeName == "INTEGER_VAL") { - *pMacValue = new GCFVPInteger(((IntegerVar *)&variable)->getValue()); - }*/ + if (variable.isA() == INTEGER_VAR) + *pMacValue = new GCFPVInteger(((IntegerVar *)&variable)->getValue()); + else + result = SA_VARIABLE_WRONG_TYPE; + } else if (typeName == "FLOAT_VAL") { if (variable.isA() == FLOAT_VAR) @@ -627,9 +642,76 @@ TSAResult GSAService::convertPVSSToMAC(const Variable& variable, else result = SA_VARIABLE_WRONG_TYPE; } -/* else if (typeName == "STRING_VAL") + else if (typeName == "STRING_VAL") { - *pMacValue = new GCFPVString(((TextVar *)&variable)->getValue()); + if (variable.isA() == TEXT_VAR) + *pMacValue = new GCFPVString(((TextVar *)&variable)->getValue()); + else + result = SA_VARIABLE_WRONG_TYPE; + } + else if (typeName.ncmp("DYN", 3)) + { + const DynVar* pDynVar = static_cast<const DynVar*>(&variable); + if (pDynVar) + { + GCFPValueArray arrayTo; + GCFPValue* pItemValue(0); + GCFPValue::TMACValueType type(GCFPValue::DYNARR_VAL); + // the type for the new FPValue must be determined + // separate, because the array could be empty + switch (DynVar::getItemType(pDynVar->isA())) + { + case BIT_VAR: + type = (GCFPValue::TMACValueType) (type | GCFPValue::BOOL_VAL); + break; + case CHAR_VAR: + type = (GCFPValue::TMACValueType) (type | GCFPValue::CHAR_VAL); + break; + case INTEGER_VAR: + type = (GCFPValue::TMACValueType) (type | GCFPValue::INTEGER_VAL); + break; + case UINTEGER_VAR: + type = (GCFPValue::TMACValueType) (type | GCFPValue::UNSIGNED_VAL); + break; + case FLOAT_VAR: + type = (GCFPValue::TMACValueType) (type | GCFPValue::DOUBLE_VAL); + break; + case TEXT_VAR: + type = (GCFPValue::TMACValueType) (type | GCFPValue::STRING_VAL); + break; + } + for (Variable* pVar = pDynVar->getFirst(); + pVar; pVar = pDynVar->getNext()) + { + switch (pVar->isA()) + { + case BIT_VAR: + pItemValue = new GCFPVBool(((BitVar*)pVar)->getValue()); + break; + case CHAR_VAR: + pItemValue = new GCFPVChar(((CharVar*)pVar)->getValue()); + break; + case INTEGER_VAR: + pItemValue = new GCFPVInteger(((IntegerVar*)pVar)->getValue()); + break; + case UINTEGER_VAR: + pItemValue = new GCFPVUnsigned(((UIntegerVar*)pVar)->getValue()); + break; + case FLOAT_VAR: + pItemValue = new GCFPVDouble(((FloatVar*)pVar)->getValue()); + break; + case TEXT_VAR: + pItemValue = new GCFPVString(((TextVar*)pVar)->getValue()); + break; + } + arrayTo.push_back(pItemValue); + } + *pMacValue = new GCFPVDynArr(type, arrayTo); + } + } +/* else if (typeName == "BIT32_VAL") + { + *pMacValue = new GCFPVBit32(((Bit32Var *)&variable)->getValue()); } else if (typeName == "REF_VAL") { @@ -657,40 +739,98 @@ TSAResult GSAService::convertMACToPVSS(const GCFPValue& macValue, switch (macValue.getType()) { case GCFPValue::BOOL_VAL: - *pVar = new BitVar(((GCFPVBool *)&macValue)->getValue()); - break; -/* case GCFPValue::BIT32_VAL: - *pVar = new Bit32Var(((GCFPVBit32 *)&macValue)->getValue()); + *pVar = new BitVar(((GCFPVBool*)&macValue)->getValue()); break; case GCFPValue::CHAR_VAL: - *pVar = new CharVar(((GCFPVChar *)&macValue)->getValue()); + *pVar = new CharVar(((GCFPVChar*)&macValue)->getValue()); break; case GCFPValue::UNSIGNED_VAL: - *pVar = new UIntegerVar(((GCFPVUnsigned *)&macValue)->getValue()); + *pVar = new UIntegerVar(((GCFPVUnsigned*)&macValue)->getValue()); break; case GCFPValue::INTEGER_VAL: - *pVar = new IntegerVar(((GCFVPInteger *)&macValue)->getValue()); - break;*/ + *pVar = new IntegerVar(((GCFPVInteger*)&macValue)->getValue()); + break; case GCFPValue::DOUBLE_VAL: - *pVar = new FloatVar(((GCFPVDouble *)&macValue)->getValue()); + *pVar = new FloatVar(((GCFPVDouble*)&macValue)->getValue()); break; -/* case GCFPValue::STRING_VAL: - *pVar = new TextVar(((GCFPVString *)&macValue)->getValue()); + case GCFPValue::STRING_VAL: + *pVar = new TextVar(((GCFPVString*)&macValue)->getValue().c_str()); break; - case GCFPValue::REF_VAL: - *pVar = new TextVar(((GCFPVRef *)&macValue)->getValue()); +/* case GCFPValue::REF_VAL: + *pVar = new TextVar(((GCFPVRef*)&macValue)->getValue()); break; case GCFPValue::BLOB_VAL: - *pVar = new BlobVar(((GCFPVBlob *)&macValue)->getValue()); + *pVar = new BlobVar(((GCFPVBlob*)&macValue)->getValue()); break; case GCFPValue::DATETIME_VAL: - *pVar = new TimeVar(((GCFPVDateTime *)&macValue)->getValue()); + *pVar = new TimeVar(((GCFPVDateTime*)&macValue)->getValue()); + break; + case GCFPValue::BIT32_VAL: + *pVar = new Bit32Var(((GCFPVBit32 *)&macValue)->getValue()); break;*/ default: - LOFAR_LOG_ERROR(SAL_STDOUT_LOGGER, ( - "Type of MAC value is unknown: '%d'", - macValue.getType())); - result = SA_MACTYPE_UNKNOWN; + if (macValue.getType() > GCFPValue::DYNARR_VAL && + macValue.getType() <= (GCFPValue::DYNARR_VAL & GCFPValue::STRING_VAL)) + { + Variable* pItemValue; + VariableType type(NOTYPE_VAR); + // the type for the new FPValue must be determined + // separat, because the array could be empty + switch (macValue.getType() & ~GCFPValue::DYNARR_VAL) + { + case GCFPValue::BOOL_VAL: + type = BIT_VAR; + break; + case GCFPValue::CHAR_VAL: + type = CHAR_VAR; + break; + case GCFPValue::INTEGER_VAL: + type = INTEGER_VAR; + break; + case GCFPValue::UNSIGNED_VAL: + type = UINTEGER_VAR; + break; + case GCFPValue::DOUBLE_VAL: + type = FLOAT_VAR; + break; + case GCFPValue::STRING_VAL: + type = TEXT_VAR; + break; + } + *pVar = new DynVar(type); + GCFPValue* pValue; + const GCFPValueArray& arrayFrom = ((GCFPVDynArr*)&macValue)->getValue(); + for (GCFPValueArray::const_iterator iter = arrayFrom.begin(); + iter != arrayFrom.end(); ++iter) + { + pValue = (*iter); + switch (pValue->getType()) + { + case GCFPValue::BOOL_VAL: + pItemValue = new BitVar(((GCFPVBool*)pValue)->getValue()); + break; + case GCFPValue::CHAR_VAL: + pItemValue = new CharVar(((GCFPVChar*)pValue)->getValue()); + break; + case GCFPValue::INTEGER_VAL: + pItemValue = new IntegerVar(((GCFPVInteger*)pValue)->getValue()); + break; + case GCFPValue::UNSIGNED_VAL: + pItemValue = new UIntegerVar(((GCFPVUnsigned*)pValue)->getValue()); + break; + case GCFPValue::DOUBLE_VAL: + pItemValue = new FloatVar(((GCFPVDouble*)pValue)->getValue()); + break; + case GCFPValue::STRING_VAL: + pItemValue = new TextVar(((GCFPVString*)pValue)->getValue().c_str()); + break; + } + if (pItemValue) + ((DynVar *)(*pVar))->append(*pItemValue); + } + } + else + result = SA_MACTYPE_UNKNOWN; break; } diff --git a/MAC/GCF/_CoreComps/SAL/src/Makefile.am b/MAC/GCF/_CoreComps/SAL/src/Makefile.am index a3cc4385dd576aaedc8a3871a9521e0008a8343a..ae9be6076c14ce9679c55f9fa7beb71a897e8ac6 100644 --- a/MAC/GCF/_CoreComps/SAL/src/Makefile.am +++ b/MAC/GCF/_CoreComps/SAL/src/Makefile.am @@ -7,7 +7,12 @@ DOCHDRS = \ GCF_PValue.h \ GCF_PVBool.h \ GCF_PVDouble.h \ - GAS_Defines.h + GCF_PVInteger.h \ + GCF_PVUnsigned.h \ + GCF_PVString.h \ + GCF_PVChar.h \ + GCF_PVDynArr.h \ + GSA_Defines.h lib_LTLIBRARIES = libsal.la @@ -19,6 +24,11 @@ libsal_la_SOURCES= $(DOCHDRS) \ GCF_PVBool.cc \ GCF_PValue.cc \ GCF_PVDouble.cc \ + GCF_PVInteger.cc \ + GCF_PVUnsigned.cc \ + GCF_PVString.cc \ + GCF_PVChar.cc \ + GCF_PVDynArr.cc \ GSA_WaitForAnswer.cc include $(lofar_sharedir)/Makefile.common diff --git a/MAC/GCF/_CoreComps/SAL/test/Makefile.am b/MAC/GCF/_CoreComps/SAL/test/Makefile.am index d38496213110ba07d73d88e262ea1204b8a30447..4f9dc887157bcdd6a601dafa08c98abe25b4c502 100644 --- a/MAC/GCF/_CoreComps/SAL/test/Makefile.am +++ b/MAC/GCF/_CoreComps/SAL/test/Makefile.am @@ -13,7 +13,8 @@ ping_DEPENDENCIES = $(LOFAR_DEPEND) AUTOGEN = autogen SUFFIXES = .ph %.ph: %.prot - $(AUTOGEN) -L $(top_srcdir)/../../GCFCommon/autogen $< + $(AUTOGEN) -L $(top_srcdir)/../../GCFCommon/autogen $< && \ + chmod a+w $@ BUILT_SOURCES = \ Echo_Protocol.ph diff --git a/MAC/GCF/_CoreComps/TM/test/Makefile.am b/MAC/GCF/_CoreComps/TM/test/Makefile.am index ad894d2a9dec81130eee1a33bf98e1a520005c41..b1c55963992f66704df4e553e5f28d142343f76f 100644 --- a/MAC/GCF/_CoreComps/TM/test/Makefile.am +++ b/MAC/GCF/_CoreComps/TM/test/Makefile.am @@ -13,7 +13,8 @@ ping_DEPENDENCIES = ../src/libtm.la $(LOFAR_DEPEND) AUTOGEN = autogen SUFFIXES = .ph %.ph: %.prot - $(AUTOGEN) -L $(top_srcdir)/../../GCFCommon/autogen $< + $(AUTOGEN) -L $(top_srcdir)/../../GCFCommon/autogen $< && \ + chmod a+w $@ BUILT_SOURCES = \ Echo_Protocol.ph