diff --git a/CoInterface/src/CorrelatedData.h b/CoInterface/src/CorrelatedData.h index b191945a19cd916087701ebe517dc3818b4576f1..0349882787d640d9427f78dae8661a1144238e44 100644 --- a/CoInterface/src/CorrelatedData.h +++ b/CoInterface/src/CorrelatedData.h @@ -21,8 +21,7 @@ #ifndef LOFAR_INTERFACE_CORRELATED_DATA_H #define LOFAR_INTERFACE_CORRELATED_DATA_H -#include <Common/lofar_complex.h> -#include <Common/DataConvert.h> +#include <Common/complex.h> #include <Stream/Stream.h> #include <CoInterface/Align.h> #include <CoInterface/Allocator.h> diff --git a/CoInterface/src/FinalMetaData.cc b/CoInterface/src/FinalMetaData.cc index f3a5f88b7ea2cfb91c4bfb071ecd395fd1ffb507..19acdadf5e87d709994d9a9097386535a82c2a88 100644 --- a/CoInterface/src/FinalMetaData.cc +++ b/CoInterface/src/FinalMetaData.cc @@ -23,7 +23,6 @@ #include <CoInterface/FinalMetaData.h> #include <Common/LofarTypes.h> -#include <Common/DataConvert.h> namespace LOFAR { diff --git a/CoInterface/src/Parset.cc b/CoInterface/src/Parset.cc index 6baa18494da852cde799e6b52d0713e188ca9111..e661a5ba377f15ae3e83cad7a43fe54581ef0ce9 100644 --- a/CoInterface/src/Parset.cc +++ b/CoInterface/src/Parset.cc @@ -37,7 +37,6 @@ #include <boost/algorithm/string.hpp> #include <Common/LofarLogger.h> -#include <Common/DataConvert.h> #include <Common/LofarBitModeInfo.h> #include <Common/StringUtil.h> #include <ApplCommon/PosixTime.h> diff --git a/CoInterface/src/StreamableData.h b/CoInterface/src/StreamableData.h index 320f81dc0191c2337a334db3258b365c9df138b8..5a52277415268fd998be44983e2efa757cc458a0 100644 --- a/CoInterface/src/StreamableData.h +++ b/CoInterface/src/StreamableData.h @@ -25,7 +25,7 @@ #include <cstring> #include <Common/LofarTypes.h> -#include <Common/DataConvert.h> +#include <Common/complex.h> #include <Stream/Stream.h> #include "Parset.h" #include "MultiDimArray.h" @@ -38,6 +38,16 @@ namespace LOFAR namespace Cobalt { + inline void byteSwap32 (void* inout) + { + char v0 = ((const char*)(inout))[0]; + char v1 = ((const char*)(inout))[1]; + ((char*)(inout))[0] = ((const char*)(inout))[3]; + ((char*)(inout))[1] = ((const char*)(inout))[2]; + ((char*)(inout))[2] = v1; + ((char*)(inout))[3] = v0; + } + // TODO: Update documentation. // Data which needs to be transported between CN, ION and Storage. // Apart from read() and write() functionality, the data is augmented diff --git a/CoInterface/src/TABTranspose.cc b/CoInterface/src/TABTranspose.cc index 2f91e84280b13e48f982e572785cfb8cf09bf2a7..e888fb1ff9f56eaa9abb773628109194a0a4d2ff 100644 --- a/CoInterface/src/TABTranspose.cc +++ b/CoInterface/src/TABTranspose.cc @@ -28,7 +28,6 @@ #include <Common/LofarLogger.h> #include <Common/Timer.h> -#include <ApplCommon/PVSSDatapointDefs.h> #include <CoInterface/TimeFuncs.h> #include <CoInterface/BudgetTimer.h> diff --git a/CoInterface/test/tRspStationPacket.cc b/CoInterface/test/tRspStationPacket.cc index 0296a235ea787e1d0302cdd6496c25b21403dee1..e4dd3d53277708cfe381a0932e23b32cfc161841 100644 --- a/CoInterface/test/tRspStationPacket.cc +++ b/CoInterface/test/tRspStationPacket.cc @@ -9,7 +9,6 @@ #include <iostream> #include <Common/LofarLogger.h> -#include <Common/DataConvert.h> #include <Stream/FileStream.h> #include <CoInterface/RspStationPacket.h> diff --git a/CoInterface/test/tSdpStationPacket.cc b/CoInterface/test/tSdpStationPacket.cc index b73a803aedde3d3e1bd08f20fde8225b9f3df80a..75b4992c35491ff5e40b65a92998e06022f5b9f4 100644 --- a/CoInterface/test/tSdpStationPacket.cc +++ b/CoInterface/test/tSdpStationPacket.cc @@ -8,7 +8,6 @@ #include <iostream> #include <string> -#include <Common/DataConvert.h> #include <Common/LofarLogger.h> #include <Stream/FileStream.h> diff --git a/GPUProc/src/Kernels/BandPassCorrectionKernel.cc b/GPUProc/src/Kernels/BandPassCorrectionKernel.cc index b507ccb45778a2c146792fc0e8c5ba70c76a5af5..78742c6ba0f1ded278c8b701955c428a6abd5b40 100644 --- a/GPUProc/src/Kernels/BandPassCorrectionKernel.cc +++ b/GPUProc/src/Kernels/BandPassCorrectionKernel.cc @@ -26,7 +26,7 @@ #include <GPUProc/BandPass.h> #include <CoInterface/BlockID.h> #include <CoInterface/Config.h> -#include <Common/lofar_complex.h> +#include <Common/complex.h> #include <Common/LofarLogger.h> #include <boost/lexical_cast.hpp> diff --git a/GPUProc/src/Kernels/BeamFormerKernel.cc b/GPUProc/src/Kernels/BeamFormerKernel.cc index 78c928d2128dfe9f22096d893146265e77061b1a..690a88567b47502e78eb223cf86ef205210eb8f4 100644 --- a/GPUProc/src/Kernels/BeamFormerKernel.cc +++ b/GPUProc/src/Kernels/BeamFormerKernel.cc @@ -25,7 +25,7 @@ #include "BeamFormerKernel.h" -#include <Common/lofar_complex.h> +#include <Common/complex.h> #include <Common/LofarLogger.h> #include <GPUProc/gpu_utils.h> #include <CoInterface/BlockID.h> diff --git a/GPUProc/src/Kernels/BeamFormerTransposeKernel.cc b/GPUProc/src/Kernels/BeamFormerTransposeKernel.cc index a4e6a3a10f46a49012191804dfaf5293c5acc4ce..da783c09e2ac2dfebb055eceecb4b20a988a8323 100644 --- a/GPUProc/src/Kernels/BeamFormerTransposeKernel.cc +++ b/GPUProc/src/Kernels/BeamFormerTransposeKernel.cc @@ -26,7 +26,7 @@ #include <CoInterface/Align.h> #include <CoInterface/BlockID.h> #include <CoInterface/Config.h> -#include <Common/lofar_complex.h> +#include <Common/complex.h> #include <Common/LofarLogger.h> #include <boost/lexical_cast.hpp> diff --git a/GPUProc/src/Kernels/CoherentStokesKernel.cc b/GPUProc/src/Kernels/CoherentStokesKernel.cc index eecd1446cdf937c5e2198e31a8eb0f3bef31d2c7..e77d64e1bc075c4dbfd1c477ed3e53e1e4d6eb82 100644 --- a/GPUProc/src/Kernels/CoherentStokesKernel.cc +++ b/GPUProc/src/Kernels/CoherentStokesKernel.cc @@ -27,7 +27,7 @@ #include <boost/lexical_cast.hpp> #include <boost/format.hpp> -#include <Common/lofar_complex.h> +#include <Common/complex.h> #include <Common/LofarLogger.h> #include <CoInterface/BlockID.h> #include <CoInterface/Align.h> diff --git a/GPUProc/src/Kernels/CoherentStokesTransposeKernel.cc b/GPUProc/src/Kernels/CoherentStokesTransposeKernel.cc index 06f487e7fdb4edcbe0375ea26ffa001b713cd06d..0de5df0928c92e3492d858f4b349fa2bf00eccd8 100644 --- a/GPUProc/src/Kernels/CoherentStokesTransposeKernel.cc +++ b/GPUProc/src/Kernels/CoherentStokesTransposeKernel.cc @@ -26,7 +26,7 @@ #include <CoInterface/Align.h> #include <CoInterface/BlockID.h> #include <CoInterface/Config.h> -#include <Common/lofar_complex.h> +#include <Common/complex.h> #include <Common/LofarLogger.h> #include <boost/lexical_cast.hpp> diff --git a/GPUProc/src/Kernels/CorrelatorKernel.cc b/GPUProc/src/Kernels/CorrelatorKernel.cc index 818cf771603a5130e351b3912950e8d2d5c04107..03a56e77075d59e01031deddb4b21576721db6ac 100644 --- a/GPUProc/src/Kernels/CorrelatorKernel.cc +++ b/GPUProc/src/Kernels/CorrelatorKernel.cc @@ -25,7 +25,7 @@ #include <GPUProc/gpu_utils.h> #include <CoInterface/BlockID.h> #include <CoInterface/Config.h> -#include <Common/lofar_complex.h> +#include <Common/complex.h> #include <Common/LofarLogger.h> #include <boost/format.hpp> diff --git a/GPUProc/src/Kernels/DedispersionChirpKernel.cc b/GPUProc/src/Kernels/DedispersionChirpKernel.cc index 77afbabf6bead29c1299792b36d4056b216c0e54..d426b4705532eaa40bef16c36a9a6c7ca1770a9a 100644 --- a/GPUProc/src/Kernels/DedispersionChirpKernel.cc +++ b/GPUProc/src/Kernels/DedispersionChirpKernel.cc @@ -22,7 +22,7 @@ #include "DedispersionChirpKernel.h" -#include <Common/lofar_complex.h> +#include <Common/complex.h> #include <Common/LofarLogger.h> #include <GPUProc/global_defines.h> diff --git a/GPUProc/src/Kernels/DelayAndBandPassKernel.cc b/GPUProc/src/Kernels/DelayAndBandPassKernel.cc index 7f6f99ce5e712282086c91b99f48a0c725fcc94a..d7530d102569c92bfec72b97cb7a3914ed207dcd 100644 --- a/GPUProc/src/Kernels/DelayAndBandPassKernel.cc +++ b/GPUProc/src/Kernels/DelayAndBandPassKernel.cc @@ -26,7 +26,7 @@ #include <GPUProc/BandPass.h> #include <CoInterface/BlockID.h> #include <CoInterface/Config.h> -#include <Common/lofar_complex.h> +#include <Common/complex.h> #include <Common/LofarLogger.h> #include <boost/lexical_cast.hpp> diff --git a/GPUProc/src/Kernels/FFTShiftKernel.cc b/GPUProc/src/Kernels/FFTShiftKernel.cc index f3096efc2dd2c02d852dfb03b78487ccb1edd889..3f6bc2ff7fd7f7f5a0b81f8d34c9234743b6a3d8 100644 --- a/GPUProc/src/Kernels/FFTShiftKernel.cc +++ b/GPUProc/src/Kernels/FFTShiftKernel.cc @@ -25,7 +25,7 @@ #include <GPUProc/gpu_utils.h> #include <CoInterface/BlockID.h> #include <CoInterface/Config.h> -#include <Common/lofar_complex.h> +#include <Common/complex.h> #include <boost/lexical_cast.hpp> #include <boost/format.hpp> diff --git a/GPUProc/src/Kernels/IncoherentStokesKernel.cc b/GPUProc/src/Kernels/IncoherentStokesKernel.cc index 986def158508ec99c8a7cd68cfacf3a03cec61e7..38f2b7862b662f28085b693a02a149715c916841 100644 --- a/GPUProc/src/Kernels/IncoherentStokesKernel.cc +++ b/GPUProc/src/Kernels/IncoherentStokesKernel.cc @@ -25,7 +25,7 @@ #include <boost/lexical_cast.hpp> #include <boost/format.hpp> -#include <Common/lofar_complex.h> +#include <Common/complex.h> #include <CoInterface/Align.h> #include <CoInterface/Config.h> diff --git a/GPUProc/src/Kernels/IncoherentStokesTransposeKernel.cc b/GPUProc/src/Kernels/IncoherentStokesTransposeKernel.cc index 02452f032bcea8d75a83b45bfca49de712647d47..493bcf03ffce3e98fb00f5ec2bc638583f9a5ae4 100644 --- a/GPUProc/src/Kernels/IncoherentStokesTransposeKernel.cc +++ b/GPUProc/src/Kernels/IncoherentStokesTransposeKernel.cc @@ -24,7 +24,7 @@ #include <CoInterface/Align.h> #include <CoInterface/Config.h> -#include <Common/lofar_complex.h> +#include <Common/complex.h> #include <boost/format.hpp> #include <boost/lexical_cast.hpp> diff --git a/GPUProc/src/Kernels/IntToFloatKernel.cc b/GPUProc/src/Kernels/IntToFloatKernel.cc index 26ec22642fa86e57dd8d204d181d020a33edf235..891a0d0fccd6abede5ba23d85a9dbb0594dc9428 100644 --- a/GPUProc/src/Kernels/IntToFloatKernel.cc +++ b/GPUProc/src/Kernels/IntToFloatKernel.cc @@ -26,7 +26,7 @@ #include <CoInterface/BlockID.h> #include <CoInterface/Config.h> #include <CoInterface/PrintVector.h> -#include <Common/lofar_complex.h> +#include <Common/complex.h> #include <Common/LofarLogger.h> #include <boost/lexical_cast.hpp> diff --git a/GPUProc/src/Kernels/QuantizeOutputKernel.cc b/GPUProc/src/Kernels/QuantizeOutputKernel.cc index 220393838deb7ce6cf671520be59141e748d6f54..36c6986cac4a01895fb84e60656f56dc36298ba8 100644 --- a/GPUProc/src/Kernels/QuantizeOutputKernel.cc +++ b/GPUProc/src/Kernels/QuantizeOutputKernel.cc @@ -27,7 +27,7 @@ #include <boost/lexical_cast.hpp> #include <boost/format.hpp> -#include <Common/lofar_complex.h> +#include <Common/complex.h> #include <Common/LofarLogger.h> #include <CoInterface/BlockID.h> #include <CoInterface/Align.h> diff --git a/GPUProc/src/Kernels/QuantizeOutputKernel.h b/GPUProc/src/Kernels/QuantizeOutputKernel.h index 45ab76246176524114e07e9ecd581dc4061a0d09..2c24f8bbf676830d7171adb93cea67f05dadf8bd 100644 --- a/GPUProc/src/Kernels/QuantizeOutputKernel.h +++ b/GPUProc/src/Kernels/QuantizeOutputKernel.h @@ -21,6 +21,7 @@ #ifndef LOFAR_GPUPROC_CUDA_QUANTIZE_OUTPUT_KERNEL_H #define LOFAR_GPUPROC_CUDA_QUANTIZE_OUTPUT_KERNEL_H +#include <Common/complex.h> #include <CoInterface/Parset.h> #include <GPUProc/Kernels/Kernel.h> diff --git a/GPUProc/src/Kernels/UHEP_BeamFormerKernel.cc b/GPUProc/src/Kernels/UHEP_BeamFormerKernel.cc index 5a8d59d4ee01f0fd7574ed98ddfdd8c6a64e7291..4475c4066de2af7972aec48956feeba9f889f36a 100644 --- a/GPUProc/src/Kernels/UHEP_BeamFormerKernel.cc +++ b/GPUProc/src/Kernels/UHEP_BeamFormerKernel.cc @@ -24,7 +24,7 @@ #include <algorithm> -#include <Common/lofar_complex.h> +#include <Common/complex.h> #include <GPUProc/global_defines.h> diff --git a/GPUProc/src/Kernels/UHEP_InvFFT_Kernel.cc b/GPUProc/src/Kernels/UHEP_InvFFT_Kernel.cc index 63f1f83498099738495d3bf37f854921a73747ba..12c64768570387b5e045c3e6181051c8902d05aa 100644 --- a/GPUProc/src/Kernels/UHEP_InvFFT_Kernel.cc +++ b/GPUProc/src/Kernels/UHEP_InvFFT_Kernel.cc @@ -22,7 +22,7 @@ #include "UHEP_InvFFT_Kernel.h" -#include <Common/lofar_complex.h> +#include <Common/complex.h> #include <GPUProc/global_defines.h> diff --git a/GPUProc/src/Kernels/UHEP_TransposeKernel.cc b/GPUProc/src/Kernels/UHEP_TransposeKernel.cc index 866e0338a2d61a1d53e552dbaf26b5d82a4c9b9c..949574268a3e0297b24a6111e3be178ac0493ccc 100644 --- a/GPUProc/src/Kernels/UHEP_TransposeKernel.cc +++ b/GPUProc/src/Kernels/UHEP_TransposeKernel.cc @@ -22,7 +22,7 @@ #include "UHEP_TransposeKernel.h" -#include <Common/lofar_complex.h> +#include <Common/complex.h> #include <GPUProc/global_defines.h> diff --git a/GPUProc/src/Kernels/ZeroingKernel.cc b/GPUProc/src/Kernels/ZeroingKernel.cc index 85c5c636e985b6239cf18776e8ec2cf9850911f9..628e2a3466cac8408a3e37e68f401c7579caab21 100644 --- a/GPUProc/src/Kernels/ZeroingKernel.cc +++ b/GPUProc/src/Kernels/ZeroingKernel.cc @@ -26,7 +26,7 @@ #include <CoInterface/BlockID.h> #include <CoInterface/Config.h> #include <CoInterface/SubbandMetaData.h> -#include <Common/lofar_complex.h> +#include <Common/complex.h> #include <Common/Timer.h> #include <boost/lexical_cast.hpp> diff --git a/GPUProc/src/MPIReceiver.h b/GPUProc/src/MPIReceiver.h index 03fff3dd28b22504629e8a5b6676162194e54393..70cab68a526c35f7d1ce247b62bedab9cdaeb419 100644 --- a/GPUProc/src/MPIReceiver.h +++ b/GPUProc/src/MPIReceiver.h @@ -26,7 +26,7 @@ #include <InputProc/Transpose/MPIUtil.h> #include <InputProc/SampleType.h> -#include <Common/ComplexStdInt.h> +#include <Common/complex.h> // From here MPIInput diff --git a/GPUProc/src/Pipelines/Pipeline.cc b/GPUProc/src/Pipelines/Pipeline.cc index 1900fe61af5af6f022aa9c9fce4ab1f632500e8c..5c546a5437b03ee2c29b568343d6b459582f97c2 100644 --- a/GPUProc/src/Pipelines/Pipeline.cc +++ b/GPUProc/src/Pipelines/Pipeline.cc @@ -29,7 +29,6 @@ #include <Common/Timer.h> #include <Common/lofar_iomanip.h> #include <ApplCommon/PosixTime.h> -#include <ApplCommon/PVSSDatapointDefs.h> #include <Stream/Stream.h> #include <Stream/FileStream.h> #include <Stream/NullStream.h> diff --git a/GPUProc/src/rtcp.cc b/GPUProc/src/rtcp.cc index f03417576de6dbcb82cf7135e2205c4dc94d09de..e6e7db611a2c927f9e46671993cde303fa2fb49a 100644 --- a/GPUProc/src/rtcp.cc +++ b/GPUProc/src/rtcp.cc @@ -50,8 +50,6 @@ #include <MessageBus/ToBus.h> #include <MessageBus/Util.h> #include <MessageBus/Protocols/TaskFeedbackProcessing.h> -#include <ApplCommon/PVSSDatapointDefs.h> -#include <ApplCommon/StationInfo.h> #include <CoInterface/Parset.h> #include <CoInterface/LTAFeedback.h> #include <CoInterface/OutputTypes.h> @@ -115,30 +113,6 @@ void ignore_sigpipe() THROW_SYSCALL("sigaction(SIGPIPE, <SIG_IGN>)"); } -string GPUProc_PVSSPrefix(const Parset &ps, int cpuNr) -{ - const string hostName = myHostname(false); - - // For GPUProc use boost::format to fill in the two conv specifications (%xx). - string fmtStr(createPropertySetName(PSN_COBALTGPU_PROC, "", ps.PVSS_TempObsName())); - format prFmt; - prFmt.exceptions(boost::io::no_error_bits); // avoid throw - prFmt.parse(fmtStr); - int cbmNodeNr = hostName.compare(0, sizeof("cbm") - 1, "cbm") == 0 ? - atoi(hostName.c_str() + sizeof("cbm") - 1) : 0; // default 0 like atoi() - return str(prFmt % cbmNodeNr % cpuNr); -} - -string InputProc_PVSSPrefix(const Parset &ps, const string &antennaFieldName) { - // For InputProc use boost::format to fill in one conv specifications (%xx). - string fmtStrInputProc(createPropertySetName(PSN_COBALT_STATION_INPUT, - "", ps.PVSS_TempObsName())); - format prFmtInputProc; - prFmtInputProc.exceptions(boost::io::no_error_bits); // avoid throw - prFmtInputProc.parse(fmtStrInputProc); - return str(prFmtInputProc % antennaFieldName); -} - int main(int argc, char **argv) { /* diff --git a/GPUProc/test/Kernels/tCorrelatorKernel.cc b/GPUProc/test/Kernels/tCorrelatorKernel.cc index 0b048f6d2f419681ba86f09acb7adc03cb7d7c75..d164b3c42d393843eacd1d8999c124ea561f0307 100644 --- a/GPUProc/test/Kernels/tCorrelatorKernel.cc +++ b/GPUProc/test/Kernels/tCorrelatorKernel.cc @@ -20,6 +20,7 @@ //# $Id$ #include <lofar_config.h> +#include <Common/complex.h> #include <GPUProc/Kernels/CorrelatorKernel.h> #include <GPUProc/gpu_wrapper.h> #include <GPUProc/MultiDimArrayHostBuffer.h> @@ -32,6 +33,7 @@ using namespace LOFAR; using namespace LOFAR::Cobalt; +using namespace std; using boost::format; struct TestFixture diff --git a/GPUProc/test/Kernels/tFIR_FilterKernel.cc b/GPUProc/test/Kernels/tFIR_FilterKernel.cc index c674e42408a5e02b677a3aafd82aa06010e573c6..2297f28c17b3f89d05ea637b08f8b7186fc89da2 100644 --- a/GPUProc/test/Kernels/tFIR_FilterKernel.cc +++ b/GPUProc/test/Kernels/tFIR_FilterKernel.cc @@ -24,7 +24,7 @@ #include <GPUProc/Kernels/FIR_FilterKernel.h> #include <GPUProc/MultiDimArrayHostBuffer.h> #include <CoInterface/Parset.h> -#include <Common/lofar_complex.h> +#include <Common/complex.h> #include <UnitTest++.h> #include <memory> diff --git a/GPUProc/test/Kernels/tKernelFunctions.cc b/GPUProc/test/Kernels/tKernelFunctions.cc index 3b677de9bdbcc833fd207b2f16f189957569cd85..1674c106a5b479d1ab9b9474df313f54ae09df86 100644 --- a/GPUProc/test/Kernels/tKernelFunctions.cc +++ b/GPUProc/test/Kernels/tKernelFunctions.cc @@ -24,7 +24,7 @@ #include <GPUProc/Kernels/FIR_FilterKernel.h> #include <CoInterface/Parset.h> #include <CoInterface/BlockID.h> -#include <Common/lofar_complex.h> +#include <Common/complex.h> #include <sstream> #include <UnitTest++.h> diff --git a/GPUProc/test/SubbandProcs/tBeamFormerStationSubsetSubbandProcProcessSb.cc b/GPUProc/test/SubbandProcs/tBeamFormerStationSubsetSubbandProcProcessSb.cc index 3690f1ca235706820287c3c83ad9a8e82ea9ec42..9a5c375121041909e77a21875ede54616a2f73d4 100644 --- a/GPUProc/test/SubbandProcs/tBeamFormerStationSubsetSubbandProcProcessSb.cc +++ b/GPUProc/test/SubbandProcs/tBeamFormerStationSubsetSubbandProcProcessSb.cc @@ -26,6 +26,7 @@ #include <iomanip> #include <Common/LofarLogger.h> +#include <Common/complex.h> #include <CoInterface/Parset.h> #include <CoInterface/fpequals.h> #include <GPUProc/gpu_utils.h> @@ -33,7 +34,7 @@ using namespace std; using namespace LOFAR::Cobalt; -using namespace LOFAR::TYPES; +using namespace LOFAR; void initialize_input( Parset& ps, diff --git a/GPUProc/test/SubbandProcs/tBeamFormerSubbandProcProcessSb.cc b/GPUProc/test/SubbandProcs/tBeamFormerSubbandProcProcessSb.cc index a96042277fe8759908bd43b50e7fa1bcf6dccb61..72f3c7e9dca85b8decd116c676008b8d606b3b3c 100644 --- a/GPUProc/test/SubbandProcs/tBeamFormerSubbandProcProcessSb.cc +++ b/GPUProc/test/SubbandProcs/tBeamFormerSubbandProcProcessSb.cc @@ -26,6 +26,7 @@ #include <iomanip> #include <Common/LofarLogger.h> +#include <Common/complex.h> #include <CoInterface/Parset.h> #include <CoInterface/fpequals.h> #include <GPUProc/gpu_utils.h> @@ -33,7 +34,7 @@ using namespace std; using namespace LOFAR::Cobalt; -using namespace LOFAR::TYPES; +using namespace LOFAR; float sqr(float x) { diff --git a/GPUProc/test/SubbandProcs/tBeamFormerSubbandSubsetSubbandProcProcessSb.cc b/GPUProc/test/SubbandProcs/tBeamFormerSubbandSubsetSubbandProcProcessSb.cc index 6c418181843602f796562abc683d883cbc0b580e..7da1419db7ef6c91dac4073d65a0b7aab5c09a7f 100644 --- a/GPUProc/test/SubbandProcs/tBeamFormerSubbandSubsetSubbandProcProcessSb.cc +++ b/GPUProc/test/SubbandProcs/tBeamFormerSubbandSubsetSubbandProcProcessSb.cc @@ -26,6 +26,7 @@ #include <iomanip> #include <Common/LofarLogger.h> +#include <Common/complex.h> #include <CoInterface/Parset.h> #include <CoInterface/fpequals.h> #include <GPUProc/gpu_utils.h> @@ -33,7 +34,7 @@ using namespace std; using namespace LOFAR::Cobalt; -using namespace LOFAR::TYPES; +using namespace LOFAR; #define DUMMY_VALUE 42.0f diff --git a/GPUProc/test/SubbandProcs/tCoherentStokesBeamFormerSubbandProcProcessSb.cc b/GPUProc/test/SubbandProcs/tCoherentStokesBeamFormerSubbandProcProcessSb.cc index a941e90bce02fcecc955353ec2485cbd9a307a1c..4ad1f61c42fe6de5a2d86bfc4d07803e69da8c7d 100644 --- a/GPUProc/test/SubbandProcs/tCoherentStokesBeamFormerSubbandProcProcessSb.cc +++ b/GPUProc/test/SubbandProcs/tCoherentStokesBeamFormerSubbandProcProcessSb.cc @@ -26,6 +26,7 @@ #include <iomanip> #include <Common/LofarLogger.h> +#include <Common/complex.h> #include <CoInterface/Parset.h> #include <CoInterface/fpequals.h> #include <GPUProc/gpu_utils.h> @@ -35,7 +36,7 @@ using namespace std; using namespace LOFAR::Cobalt; -using namespace LOFAR::TYPES; +using namespace LOFAR; template<typename T> T inputSignal(size_t t) { diff --git a/GPUProc/test/SubbandProcs/tFlysEyeBeamFormerSubbandProcProcessSb.cc b/GPUProc/test/SubbandProcs/tFlysEyeBeamFormerSubbandProcProcessSb.cc index 462cb16aa15276b9624347818758c159f202cafb..96ff5034bd1f27162830ea2eddfeb52bceac53f6 100644 --- a/GPUProc/test/SubbandProcs/tFlysEyeBeamFormerSubbandProcProcessSb.cc +++ b/GPUProc/test/SubbandProcs/tFlysEyeBeamFormerSubbandProcProcessSb.cc @@ -27,6 +27,7 @@ #include <iomanip> #include <Common/LofarLogger.h> +#include <Common/complex.h> #include <CoInterface/Parset.h> #include <CoInterface/fpequals.h> #include <GPUProc/gpu_utils.h> @@ -34,7 +35,7 @@ using namespace std; using namespace LOFAR::Cobalt; -using namespace LOFAR::TYPES; +using namespace LOFAR; template<typename T> T inputSignal(size_t t) { diff --git a/GPUProc/test/cuda/tBandPassCorrection.cc b/GPUProc/test/cuda/tBandPassCorrection.cc index 0cc21a49b8874fc2bf3033c3ea9ec5b1f1f5fbce..feea091321a508ecf0b00d67eeed863b3717dec1 100644 --- a/GPUProc/test/cuda/tBandPassCorrection.cc +++ b/GPUProc/test/cuda/tBandPassCorrection.cc @@ -34,6 +34,7 @@ #include <Common/LofarLogger.h> #include <Common/LofarTypes.h> +#include <Common/complex.h> #include <GPUProc/gpu_wrapper.h> #include <GPUProc/gpu_utils.h> #include <GPUProc/MultiDimArrayHostBuffer.h> diff --git a/GPUProc/test/cuda/tCoherentStokesTranspose.cc b/GPUProc/test/cuda/tCoherentStokesTranspose.cc index 7f4a17ab44b9a721ddbe2e8ed97e6c760b21a6c7..3e4808c8af117d8448a48c81268ecc0097f4cc94 100644 --- a/GPUProc/test/cuda/tCoherentStokesTranspose.cc +++ b/GPUProc/test/cuda/tCoherentStokesTranspose.cc @@ -28,6 +28,7 @@ #include <Common/Exception.h> #include <Common/LofarLogger.h> +#include <Common/complex.h> #include <CoInterface/BlockID.h> #include <GPUProc/gpu_wrapper.h> @@ -38,7 +39,7 @@ using namespace std; using namespace boost; using namespace LOFAR::Cobalt::gpu; using namespace LOFAR::Cobalt; -using namespace LOFAR::TYPES; +using namespace LOFAR; using LOFAR::Exception; unsigned NR_CHANNELS = 256; @@ -48,7 +49,7 @@ unsigned NR_POLARIZATIONS = 2; Exception::TerminateHandler t(Exception::terminate); -void runTest( Context &ctx, Stream &stream ) +void runTest( Context &ctx, gpu::Stream &stream ) { Parset ps; ps.add("Observation.VirtualInstrument.stationList", "[CS001]"); @@ -128,7 +129,7 @@ int main() // Create a stream Device device(0); Context ctx(device); - Stream stream(ctx); + gpu::Stream stream(ctx); // Run the test runTest(ctx, stream); diff --git a/GPUProc/test/cuda/tCorrelator2.cc b/GPUProc/test/cuda/tCorrelator2.cc index 1537b330d427f43ef1cdf28ef89955ce7b53d72f..64b2fc9b49afffe832ef9071458ee447d4d0e2c4 100644 --- a/GPUProc/test/cuda/tCorrelator2.cc +++ b/GPUProc/test/cuda/tCorrelator2.cc @@ -29,6 +29,7 @@ #include <Common/Exception.h> #include <Common/LofarLogger.h> +#include <Common/complex.h> #include <CoInterface/BlockID.h> #include <CoInterface/fpequals.h> @@ -40,7 +41,7 @@ using namespace std; using namespace boost; using namespace LOFAR::Cobalt::gpu; using namespace LOFAR::Cobalt; -using namespace LOFAR::TYPES; +using namespace LOFAR; using LOFAR::Exception; Exception::TerminateHandler t(Exception::terminate); @@ -51,7 +52,7 @@ dcomplex correlate( const dcomplex s1, const dcomplex s2 ) } void runTest( - Context &ctx, Stream &stream, + Context &ctx, gpu::Stream &stream, unsigned NR_STATIONS, unsigned BLOCKSIZE, unsigned NR_INTEGRATIONS, @@ -160,7 +161,7 @@ void runTest( } } -void runAllTests( Context &ctx, Stream &stream ) +void runAllTests( Context &ctx, gpu::Stream &stream ) { unsigned channels[] = { 1, 16, 64, 256 }; @@ -210,7 +211,7 @@ int main() // Create a stream Device device(0); Context ctx(device); - Stream stream(ctx); + gpu::Stream stream(ctx); // Run the test runAllTests(ctx, stream); diff --git a/GPUProc/test/cuda/tDelayAndBandPass.cc b/GPUProc/test/cuda/tDelayAndBandPass.cc index c54636cea8a4fcb607588e80408dff4e192bcb42..11fed9074b2879ef857a9908782693ccd21f7260 100644 --- a/GPUProc/test/cuda/tDelayAndBandPass.cc +++ b/GPUProc/test/cuda/tDelayAndBandPass.cc @@ -34,6 +34,7 @@ #include <Common/LofarLogger.h> #include <Common/LofarTypes.h> +#include <Common/complex.h> #include <GPUProc/gpu_wrapper.h> #include <GPUProc/gpu_utils.h> #include <GPUProc/MultiDimArrayHostBuffer.h> diff --git a/GPUProc/test/cuda/tFFT.cc b/GPUProc/test/cuda/tFFT.cc index 881cff517f3f78a6fda7d8871aa402954c951735..972be6e3d7a06ae4e93b190be927dc91eadd3bfd 100644 --- a/GPUProc/test/cuda/tFFT.cc +++ b/GPUProc/test/cuda/tFFT.cc @@ -29,6 +29,7 @@ #include <Common/LofarLogger.h> #include <Common/LofarTypes.h> +#include <Common/complex.h> #include <CoInterface/BlockID.h> #include <GPUProc/Kernels/FFT_Kernel.h> #include <GPUProc/KernelFactory.h> diff --git a/GPUProc/test/cuda/tIncoherentStokesTranspose.cc b/GPUProc/test/cuda/tIncoherentStokesTranspose.cc index f4f49f5837d2e57d931a4b2984bf8e2b314c904d..c0433fd8e0c27dd20319166562019debc199be3a 100644 --- a/GPUProc/test/cuda/tIncoherentStokesTranspose.cc +++ b/GPUProc/test/cuda/tIncoherentStokesTranspose.cc @@ -26,6 +26,7 @@ #include <GPUProc/MultiDimArrayHostBuffer.h> #include <CoInterface/BlockID.h> #include <Common/Exception.h> +#include <Common/complex.h> #include <boost/lexical_cast.hpp> #include <complex> @@ -35,7 +36,7 @@ using namespace std; using namespace LOFAR; using namespace LOFAR::Cobalt; -using namespace LOFAR::TYPES; +using namespace LOFAR; unsigned NR_CHANNELS = 61; unsigned NR_SAMPLES_PER_CHANNEL = 47; diff --git a/GPUProc/test/cuda/tIntToFloat.cc b/GPUProc/test/cuda/tIntToFloat.cc index 5d841ab5390b5ac68ec136b45dbe321228cfd638..3c0007dccb111655f0a2b14429d711184d81690f 100644 --- a/GPUProc/test/cuda/tIntToFloat.cc +++ b/GPUProc/test/cuda/tIntToFloat.cc @@ -35,6 +35,7 @@ #include <Common/LofarLogger.h> #include <Common/LofarTypes.h> +#include <Common/complex.h> #include <GPUProc/gpu_wrapper.h> #include <GPUProc/gpu_utils.h> #include <GPUProc/MultiDimArrayHostBuffer.h> diff --git a/GPUProc/test/cuda/tTranspose2.cc b/GPUProc/test/cuda/tTranspose2.cc index bacc617a606083fb5a53bc11706f5c98bad8b934..0c42ffe53397c1f13bf7eca6e9b74bd9fb9a8e5d 100644 --- a/GPUProc/test/cuda/tTranspose2.cc +++ b/GPUProc/test/cuda/tTranspose2.cc @@ -28,6 +28,7 @@ #include <Common/Exception.h> #include <Common/LofarLogger.h> +#include <Common/complex.h> #include <CoInterface/BlockID.h> #include <GPUProc/gpu_wrapper.h> @@ -38,7 +39,7 @@ using namespace std; using namespace boost; using namespace LOFAR::Cobalt::gpu; using namespace LOFAR::Cobalt; -using namespace LOFAR::TYPES; +using namespace LOFAR; using LOFAR::Exception; unsigned NR_CHANNELS = 2048; @@ -48,7 +49,7 @@ unsigned NR_POLARIZATIONS = 2; Exception::TerminateHandler t(Exception::terminate); -void runTest( Context &ctx, Stream &stream ) +void runTest( Context &ctx, gpu::Stream &stream ) { Parset ps; ps.add("Observation.VirtualInstrument.stationList", "[CS001]"); @@ -118,7 +119,7 @@ int main() // Create a stream Device device(0); Context ctx(device); - Stream stream(ctx); + gpu::Stream stream(ctx); // Run the test runTest(ctx, stream); diff --git a/InputProc/src/SampleType.h b/InputProc/src/SampleType.h index 48248a9cbc7656704a232df76ab4f4a7aea599bb..32ef27f0ee5b73eb2b6eab3291b19bdd11d7b584 100644 --- a/InputProc/src/SampleType.h +++ b/InputProc/src/SampleType.h @@ -24,7 +24,7 @@ #include <ostream> #include <Common/LofarConstants.h> -#include <Common/lofar_complex.h> +#include <Common/complex.h> namespace LOFAR { diff --git a/InputProc/src/Station/printStationPacket.cc b/InputProc/src/Station/printStationPacket.cc index c5e45dcbb639b5e4e8ef77ec7b0383a8740b4e12..e1ea0fed543676a7f3ebc2fc29935436b3e2e40c 100644 --- a/InputProc/src/Station/printStationPacket.cc +++ b/InputProc/src/Station/printStationPacket.cc @@ -17,7 +17,6 @@ #include <CoInterface/RspStationPacket.h> #include <CoInterface/SdpStationPacket.h> #include <CoInterface/StationPacket.h> -#include <Common/DataConvert.h> #include <Common/LofarLogger.h> #include <Stream/FileStream.h> diff --git a/OutputProc/src/GPUProcIO.cc b/OutputProc/src/GPUProcIO.cc index c789b5edb105194e0647e186ccb94daf542c8273..a8f45f5750da08c9f2c7d3a16e8ceb7af2f9068e 100644 --- a/OutputProc/src/GPUProcIO.cc +++ b/OutputProc/src/GPUProcIO.cc @@ -42,7 +42,6 @@ #include <MessageBus/Protocols/TaskFeedbackDataproducts.h> #include <Stream/PortBroker.h> #include <Stream/NetFuncs.h> -#include <ApplCommon/PVSSDatapointDefs.h> #include <ApplCommon/StationInfo.h> #include <CoInterface/Exceptions.h> #include <CoInterface/OMPThread.h> diff --git a/OutputProc/src/OutputThread.cc b/OutputProc/src/OutputThread.cc index 1d3d7325d6affb7f2d71415fd86c239d92cdb34e..cde7e348fdf7642c7aa1e77546559920e5051270 100644 --- a/OutputProc/src/OutputThread.cc +++ b/OutputProc/src/OutputThread.cc @@ -35,7 +35,6 @@ #include <Common/Thread/Mutex.h> #include <Common/Thread/Cancellation.h> #include <Common/StreamUtil.h> // LOFAR::print() -#include <ApplCommon/PVSSDatapointDefs.h> #include <CoInterface/OutputTypes.h> #include <CoInterface/Exceptions.h> diff --git a/OutputProc/src/plotMS.cc b/OutputProc/src/plotMS.cc index 60eb6808cedcd0d82a4ec6a1d52deddaec7f5fc0..c38ab05135083a69c6979d0d8461d5a16da000ae 100644 --- a/OutputProc/src/plotMS.cc +++ b/OutputProc/src/plotMS.cc @@ -32,7 +32,6 @@ #include <Common/LofarLogger.h> #include <Common/Exception.h> #include <Common/StringUtil.h> -#include <Common/DataConvert.h> #include <Stream/FileStream.h> #include <CoInterface/Parset.h> #include <CoInterface/CorrelatedData.h> diff --git a/dependencies/ApplCommon/include/ApplCommon/AntField.h b/dependencies/ApplCommon/include/ApplCommon/AntField.h index 6f921af9f0bab07bf429e0237cd8512c511ca834..56530e6d37af56c3e7f6455af1256a02df08dd73 100644 --- a/dependencies/ApplCommon/include/ApplCommon/AntField.h +++ b/dependencies/ApplCommon/include/ApplCommon/AntField.h @@ -28,12 +28,18 @@ //# Never #include <config.h> or #include <lofar_config.h> in a header file! //# Includes -#include <Common/lofar_vector.h> -#include <Common/lofar_string.h> -#include <Common/lofar_map.h> #include <Common/LofarLogger.h> #include <Common/StringUtil.h> #include <sstream> +#include <vector> +#include <string> +#include <map> +#include <utility> + +using std::vector; +using std::string; +using std::map; +using std::pair; //# Avoid 'using namespace' in headerfiles diff --git a/dependencies/ApplCommon/include/ApplCommon/AntennaSets.h b/dependencies/ApplCommon/include/ApplCommon/AntennaSets.h index 165d99f0a3ebf676d7bc4bee6710a697ff0a1776..6ca189aeb68d922d332b486e8b0770367c562c60 100644 --- a/dependencies/ApplCommon/include/ApplCommon/AntennaSets.h +++ b/dependencies/ApplCommon/include/ApplCommon/AntennaSets.h @@ -31,10 +31,14 @@ #include <Common/LofarConstants.h> #include <Common/lofar_bitset.h> #include <Common/lofar_iostream.h> -#include <Common/lofar_map.h> -#include <Common/lofar_string.h> -#include <Common/lofar_vector.h> #include <ApplCommon/StationInfo.h> +#include <vector> +#include <string> +#include <map> + +using std::string; +using std::vector; +using std::map; //# Avoid 'using namespace' in headerfiles diff --git a/dependencies/ApplCommon/include/ApplCommon/CMakeLists.txt b/dependencies/ApplCommon/include/ApplCommon/CMakeLists.txt index 58ce3fd81ec94dd7b04d2ba49a13c25db39be5bc..6c32d44e1a6a7cd6ab19f750613f5d56e1307883 100644 --- a/dependencies/ApplCommon/include/ApplCommon/CMakeLists.txt +++ b/dependencies/ApplCommon/include/ApplCommon/CMakeLists.txt @@ -5,11 +5,8 @@ set(inst_HEADERS AntField.h AntennaSets.h LofarDirs.h - Observation.h PosixTime.h - PVSSDatapointDefs.h StationConfig.h - StationDatatypes.h StationInfo.h) # Create symbolic link to include directory. diff --git a/dependencies/ApplCommon/include/ApplCommon/Observation.h b/dependencies/ApplCommon/include/ApplCommon/Observation.h deleted file mode 100644 index 32076f379498144dfc87309fad4a527a717311ac..0000000000000000000000000000000000000000 --- a/dependencies/ApplCommon/include/ApplCommon/Observation.h +++ /dev/null @@ -1,242 +0,0 @@ -//# Observation.h: class/struct that holds the Observation information -//# -//# Copyright (C) 2006 -//# ASTRON (Netherlands Institute for Radio Astronomy) -//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands -//# -//# This file is part of the LOFAR software suite. -//# The LOFAR software suite 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 3 of the License, or -//# (at your option) any later version. -//# -//# The LOFAR software suite 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 the LOFAR software suite. If not, see <http://www.gnu.org/licenses/>. -//# -//# $Id$ - -#ifndef LOFAR_APPLCOMMON_OBSERVATION_H -#define LOFAR_APPLCOMMON_OBSERVATION_H - -// \file -// class/struct that holds the Observation information - -//# Never #include <config.h> or #include <lofar_config.h> in a header file! - -//# Includes -#include <Common/ParameterSet.h> -#include <Common/lofar_bitset.h> -#include <Common/lofar_vector.h> -#include <Common/lofar_string.h> -#include <Common/LofarConstants.h> -#include <ctime> - -namespace LOFAR { - -// \addtogroup ApplCommon -// @{ - -//# Forward Declarations -//class forward; - - -// The Observation class is a public struct that can be used as base-class -// for holding Observation related information. -// It can be instantiated with a parset containing Observation information. -class Observation -{ -public: - Observation(); - ~Observation(); -// explicit Observation (const ParameterSet* aParSet, bool hasDualHBA = false); - explicit Observation (const ParameterSet* aParSet, bool hasDualHBA, unsigned nrBGPIOnodes = 64); - - // global function for converting filtername to nyquist zone - static uint nyquistzoneFromFilter(const string& filterName); - - // get name of a beam (idx starts at 0) - string getBeamName(uint beamIdx) const; - string getAnaBeamName() const; - - // check if the given Observation conflicts with this one - bool conflicts(const Observation& other) const; - - // Returns a bitset containing the RCU's requested by the observation. - bitset<MAX_RCUS> getRCUbitset(int nrLBAs, int nrHBAs, const string& anAntennaSet); - - // Support for dynamic dataslot allocation - vector<int> getBeamAllocation(const string& stationName = "") const; - vector<int> getBeamlets (uint beamIdx, const string& stationName = "") const; - - // for operator << - ostream& print (ostream& os) const; - - // TEMP HACK - string getAntennaFieldName(bool hasSplitters, uint32 beamIdx = 0) const; - - // data types - typedef bitset<MAX_RCUS> RCUset_t; - - class Pointing { - public: - Pointing() {}; - ~Pointing() {}; - double angle1; - double angle2; - string directionType; - time_t startTime; - int duration; - }; - - class TiedArrayBeam { - public: - TiedArrayBeam() {}; - ~TiedArrayBeam() {}; - double angle1; - double angle2; - string directionType; - double dispersionMeasure; - bool coherent; - }; - - class Beam { - public: - Beam() {}; - ~Beam() {}; - Beam& operator=(const Beam& that) { - if (this != &that) { - this->name = that.name; - this->antennaSet = that.antennaSet; - this->pointings = that.pointings; - this->momID = that.momID; - this->subbands = that.subbands; - } - return (*this); - } - // -- datamembers -- - string name; - string target; - string antennaSet; - vector<Pointing> pointings; - - int momID; - vector<int> subbands; - - int nrTABs; - int nrTABrings; - double TABringSize; // Radians - vector<TiedArrayBeam> TABs; - }; - - class AnaBeam { - public: - AnaBeam() {}; - ~AnaBeam() {}; - AnaBeam& operator=(const AnaBeam& that) { - if (this != &that) { - this->name = that.name; - this->antennaSet = that.antennaSet; - this->pointings = that.pointings; - this->rank = that.rank; - } - return (*this); - }; - // -- datamembers -- - string name; - string antennaSet; - vector<Pointing> pointings; - - int rank; - }; - - class StreamToStorage { - public: - string dataProduct; - unsigned dataProductNr; - - unsigned streamNr; - string filename; - - unsigned sourcePset; - - string destStorageNode; - string destDirectory; - - unsigned adderNr; - unsigned writerNr; - }; - - //# Datamembers - string name; - int obsID; - time_t startTime; - time_t stopTime; - uint nyquistZone; - vector<string> stations; - int nrSlotsInFrame; - int sampleClock; // 160 | 200 - int bitsPerSample; // 4 | 8 | 16 - string filter; // LBA_30_80, LBA_10_90, HBA_110_190, etc. - string MSNameMask; - string realPVSSdatapoint; - - // old way of specifying antennas - string antennaArray; - - // new way of selecting antennas - string antennaSet; // like LBA_INNER, LBA_OUTER, etc. - bool useLongBaselines; - bool splitterOn; // On or Off - bool dualMode; // HBA_DUAL selected - - // beams - vector<Beam> beams; - vector<AnaBeam> anaBeams; - - vector<StreamToStorage> streamsToStorage; - - // type of observation - string processType; - string processSubtype; - string strategy; - - // couple of values of the virtual instrument as compacted strings - string receiverList; - string stationList; - string BGLNodeList; - string storageNodeList; - -private: - bool _isStationName(const string& hostname) const; - bool _hasDataSlots (const ParameterSet* aPS) const; - - void getDataSlotMapping( const string &station, const string &fieldName, vector<int> &boards, vector<int> &slots ) const; - - RCUset_t RCUset; // set with participating receivers, use getRCUbitset to get this value. - - // many(!) vectors for dataslot allocation - bool itsHasDataslots; // old or new type of parset - bool itsStnHasDualHBA; // - ParameterSet itsDataslotParset; // subset of parset with dataslotinfo for getxxxAllocation() - vector<int> itsSlotTemplate; // clean template with the slots that may be used. - vector<uint> itsBeamSlotList; // beamnumber vector - vector<int> beamlet2beams; // OLD:to which beam each beamlet belongs -}; - -//# -//# operator << -//# -inline ostream& operator<< (ostream& os, const Observation& anObs) -{ - return (anObs.print(os)); -} - -// @} -} // namespace LOFAR - -#endif diff --git a/dependencies/ApplCommon/include/ApplCommon/PVSSDatapointDefs.h b/dependencies/ApplCommon/include/ApplCommon/PVSSDatapointDefs.h deleted file mode 100644 index 9177bcef58bcc6911636dbd973b83ffa8eda1ee0..0000000000000000000000000000000000000000 --- a/dependencies/ApplCommon/include/ApplCommon/PVSSDatapointDefs.h +++ /dev/null @@ -1,692 +0,0 @@ -// This file was generated by create_db_files v2.0 on Tue May 23 11:53:15 UTC 2017 - -#ifndef LOFAR_DEPLOYMENT_PVSSDATAPOINTS_H -#define LOFAR_DEPLOYMENT_PVSSDATAPOINTS_H -// process -#define PN_FSM_PROCESSID "process.processID" -#define PN_FSM_START_TIME "process.startTime" -#define PN_FSM_STOP_TIME "process.stopTime" -#define PN_FSM_LOG_MSG "process.logMsg" -#define PN_FSM_ERROR "process.error" -#define PN_FSM_CURRENT_ACTION "process.currentAction" -// object -#define PN_OBJ_STATE "object.state" -#define PN_OBJ_CHILD_STATE "object.childState" -#define PN_OBJ_MESSAGE "object.message" -#define PN_OBJ_LEAF "object.leaf" -#define PN_OBJ_CHILD_SUM_ALERT "object.childSumAlert" - -// MACScheduler -#define PSN_MAC_SCHEDULER "LOFAR_PermSW_MACScheduler" -#define PST_MAC_SCHEDULER "MACScheduler" -#define PN_MS_PLANNED_OBSERVATIONS "plannedObservations" -#define PN_MS_ACTIVE_OBSERVATIONS "activeObservations" -#define PN_MS_FINISHED_OBSERVATIONS "finishedObservations" -#define PN_MS_OTDB_CONNECTED "OTDB.connected" -#define PN_MS_OTDB_LAST_POLL "OTDB.lastPoll" -#define PN_MS_OTDB_POLLINTERVAL "OTDB.pollinterval" - -// CRTriggerControl -#define PSN_CR_TRIGGER_CONTROL "LOFAR_PermSW_CRTriggerControl" -#define PST_CR_TRIGGER_CONTROL "CRTriggerControl" - -// Observation -#define PSN_OBSERVATION "LOFAR_ObsSW_@observation@" -#define PST_OBSERVATION "Observation" -#define PN_OBS_CLAIM_CLAIM_DATE "claim.claimDate" -#define PN_OBS_CLAIM_FREE_DATE "claim.freeDate" -#define PN_OBS_CLAIM_NAME "claim.name" -#define PN_OBS_CLAIM_PERIOD "claimPeriod" -#define PN_OBS_PREPARE_PERIOD "preparePeriod" -#define PN_OBS_START_TIME "startTime" -#define PN_OBS_STOP_TIME "stopTime" -#define PN_OBS_BAND_FILTER "bandFilter" -#define PN_OBS_NYQUISTZONE "nyquistzone" -#define PN_OBS_ANTENNA_ARRAY "antennaArray" -#define PN_OBS_RECEIVER_LIST "receiverList" -#define PN_OBS_SAMPLE_CLOCK "sampleClock" -#define PN_OBS_RUN_STATE "runState" -#define PN_OBS_MEASUREMENT_SET "measurementSet" -#define PN_OBS_PROCESS_TYPE "processType" -#define PN_OBS_PROCESS_SUBTYPE "processSubtype" -#define PN_OBS_STRATEGY "strategy" -#define PN_OBS_STATION_LIST "stationList" -#define PN_OBS_INPUT_NODE_LIST "inputNodeList" -#define PN_OBS_BGL_NODE_LIST "BGLNodeList" -#define PN_OBS_STORAGE_NODE_LIST "storageNodeList" -#define PN_OBS_BEAMS_ANGLE1 "Beams.angle1" -#define PN_OBS_BEAMS_ANGLE2 "Beams.angle2" -#define PN_OBS_BEAMS_DIRECTION_TYPE "Beams.directionType" -#define PN_OBS_BEAMS_SUBBAND_LIST "Beams.subbandList" -#define PN_OBS_TIED_ARRAY_BEAMS_BEAM_INDEX "TiedArrayBeams.beamIndex" -#define PN_OBS_TIED_ARRAY_BEAMS_ANGLE1 "TiedArrayBeams.angle1" -#define PN_OBS_TIED_ARRAY_BEAMS_ANGLE2 "TiedArrayBeams.angle2" -#define PN_OBS_TIED_ARRAY_BEAMS_DIRECTION_TYPE "TiedArrayBeams.directionType" -#define PN_OBS_TIED_ARRAY_BEAMS_DISPERSION "TiedArrayBeams.dispersion" -#define PN_OBS_TIED_ARRAY_BEAMS_COHERENT "TiedArrayBeams.coherent" - -// ObservationControl -#define PSN_OBSERVATION_CONTROL "LOFAR_ObsSW_@observation@_ObservationControl" -#define PST_OBSERVATION_CONTROL "ObservationControl" -#define PN_OBSCTRL_COMMAND "command" - -// StorageHost -#define PSN_STORAGE_HOST "LOFAR_PIC_@storagehost@" -#define PST_STORAGE_HOST "StorageHost" - -// CEPHardwareMonitor -#define PSN_CEP_HARDWARE_MONITOR "LOFAR_PermSW_CEPHardwareMonitor" -#define PST_CEP_HARDWARE_MONITOR "CEPHardwareMonitor" -#define PN_CHM_COBALT_CONNECTED "Cobalt.connected" -#define PN_CHM_CLUSTER_CONNECTED "Cluster.connected" - -// OnlineControl -#define PSN_ONLINE_CONTROL "LOFAR_ObsSW_@observation@_OnlineControl" -#define PST_ONLINE_CONTROL "OnlineControl" - -// CobaltNIC -#define PSN_COBALTNIC "LOFAR_PIC_Cobalt_@cobaltnode@_@cobaltnic@" -#define PST_COBALTNIC "CobaltNIC" -#define PN_CNI_NODE "Node" -#define PN_CNI_CPU "CPU" -#define PN_CNI_INTERFACE "Interface" -#define PN_CNI_MAC "MAC" -#define PN_CNI_STATION_LIST "stationList" -#define PN_CNI_RSP_LIST "RSPList" -#define PN_CNI_IP_LIST "IPList" - -// CobaltStationInput -#define PSN_COBALT_STATION_INPUT "LOFAR_PermSW_@stationfield@_CobaltStationInput" -#define PST_COBALT_STATION_INPUT "CobaltStationInput" -#define PN_CSI_NODE "Node" -#define PN_CSI_CPU "CPU" -#define PN_CSI_OBSERVATION_NAME "observationName" -#define PN_CSI_STREAM0_BLOCKS_IN "stream0.blocksIn" -#define PN_CSI_STREAM0_REJECTED "stream0.rejected" -#define PN_CSI_STREAM1_BLOCKS_IN "stream1.blocksIn" -#define PN_CSI_STREAM1_REJECTED "stream1.rejected" -#define PN_CSI_STREAM2_BLOCKS_IN "stream2.blocksIn" -#define PN_CSI_STREAM2_REJECTED "stream2.rejected" -#define PN_CSI_STREAM3_BLOCKS_IN "stream3.blocksIn" -#define PN_CSI_STREAM3_REJECTED "stream3.rejected" - -// CobaltGPUProc -#define PSN_COBALTGPU_PROC "LOFAR_ObsSW_@observation@_@oscobaltnode@_@cobaltgpuproc@" -#define PST_COBALTGPU_PROC "CobaltGPUProc" -#define PN_CGP_OBSERVATION_NAME "observationName" -#define PN_CGP_DATA_PRODUCT_TYPE "dataProductType" -#define PN_CGP_SUBBAND "subband" -#define PN_CGP_DROPPING "dropping" -#define PN_CGP_WRITTEN "written" -#define PN_CGP_DROPPED "dropped" - -// CobaltOutputProc -#define PSN_COBALT_OUTPUT_PROC "LOFAR_ObsSW_@observation@_CobaltOutputProc" -#define PST_COBALT_OUTPUT_PROC "CobaltOutputProc" -#define PN_COP_STORAGE_HOST "storageHost" -#define PN_COP_DATA_PRODUCT_TYPE "dataProductType" -#define PN_COP_FILE_NAME "fileName" -#define PN_COP_DIRECTORY "directory" -#define PN_COP_DROPPING "dropping" -#define PN_COP_WRITTEN "written" -#define PN_COP_DROPPED "dropped" - -// AARTFAAC -#define PSN_AARTFAAC "LOFAR_PIC_AARTFAAC" -#define PST_AARTFAAC "AARTFAAC" -#define PN_AF_PIGGYBACK "piggyback" - -// Cabinet -#define PSN_CABINET "LOFAR_PIC_@cabinet@" -#define PST_CABINET "Cabinet" -#define PN_CAB_FRONT_DOOR_OPEN "frontDoorOpen" -#define PN_CAB_FRONT_FAN_INNER "frontFanInner" -#define PN_CAB_FRONT_FAN_OUTER "frontFanOuter" -#define PN_CAB_FRONT_AIRFLOW "frontAirflow" -#define PN_CAB_BACK_DOOR_OPEN "backDoorOpen" -#define PN_CAB_BACK_FAN_INNER "backFanInner" -#define PN_CAB_BACK_FAN_OUTER "backFanOuter" -#define PN_CAB_BACK_AIRFLOW "backAirflow" -#define PN_CAB_TEMP_ALARM "tempAlarm" -#define PN_CAB_HUMIDITY_ALARM "humidityAlarm" -#define PN_CAB_TEMPERATURE "temperature" -#define PN_CAB_TEMP_MIN "tempMin" -#define PN_CAB_TEMP_MAX "tempMax" -#define PN_CAB_TEMP_MAX_MAX "tempMaxMax" -#define PN_CAB_HUMIDITY "humidity" -#define PN_CAB_HUMIDITY_MAX "humidityMax" -#define PN_CAB_HUMIDITY_MAX_MAX "humidityMaxMax" -#define PN_CAB_CONTROL_MODE "controlMode" -#define PN_CAB_TEMPERATURE_SENSOR "temperatureSensor" -#define PN_CAB_HUMIDITY_CONTROL "humidityControl" -#define PN_CAB_DOOR_CONTROL "doorControl" -#define PN_CAB_COMPRESSED_AVG_TEMPERATURE "compressed.avg_temperature" -#define PN_CAB_COMPRESSED_AVG_HUMIDITY "compressed.avg_humidity" - -// SubRack -#define PSN_SUB_RACK "LOFAR_PIC_@cabinet@_@subrack@" -#define PST_SUB_RACK "SubRack" -#define PN_SRCK_SPU_STATUS_STATE "SPU.status.state" -#define PN_SRCK_SPU_STATUS_CHILD_STATE "SPU.status.childState" -#define PN_SRCK_SPU_STATUS_MESSAGE "SPU.status.message" -#define PN_SRCK_SPU_STATUS_LEAF "SPU.status.leaf" -#define PN_SRCK_SPU_STATUS_CHILD_SUM_ALERT "SPU.status.childSumAlert" -#define PN_SRCK_SPU__VHBA "SPU.Vhba" -#define PN_SRCK_SPU__VLBA "SPU.Vlba" -#define PN_SRCK_SPU__VSPU "SPU.Vspu" -#define PN_SRCK_SPU__VDIG "SPU.Vdig" -#define PN_SRCK_SPU_TEMPERATURE "SPU.temperature" -#define PN_SRCK_CLOCK_BOARD_STATUS_STATE "clockBoard.status.state" -#define PN_SRCK_CLOCK_BOARD_STATUS_CHILD_STATE "clockBoard.status.childState" -#define PN_SRCK_CLOCK_BOARD_STATUS_MESSAGE "clockBoard.status.message" -#define PN_SRCK_CLOCK_BOARD_STATUS_LEAF "clockBoard.status.leaf" -#define PN_SRCK_CLOCK_BOARD_STATUS_CHILD_SUM_ALERT "clockBoard.status.childSumAlert" -#define PN_SRCK_CLOCK_BOARD__VFSP "clockBoard.Vfsp" -#define PN_SRCK_CLOCK_BOARD__VCLOCK "clockBoard.Vclock" -#define PN_SRCK_CLOCK_BOARD_VERSION "clockBoard.version" -#define PN_SRCK_CLOCK_BOARD_FREQ "clockBoard.freq" -#define PN_SRCK_CLOCK_BOARD_LOCK160 "clockBoard.lock160" -#define PN_SRCK_CLOCK_BOARD_LOCK200 "clockBoard.lock200" -#define PN_SRCK_CLOCK_BOARD_TEMPERATURE "clockBoard.temperature" -#define PN_SRCK_COMPRESSED_SPU_AVG__VHBA "compressed.SPU.avg_Vhba" -#define PN_SRCK_COMPRESSED_SPU_AVG__VLBA "compressed.SPU.avg_Vlba" -#define PN_SRCK_COMPRESSED_SPU_AVG__VDIG "compressed.SPU.avg_Vdig" -#define PN_SRCK_COMPRESSED_SPU_AVG_TEMPERATURE "compressed.SPU.avg_temperature" -#define PN_SRCK_COMPRESSED_CLOCK_BOARD_AVG__VFSP "compressed.clockBoard.avg_Vfsp" -#define PN_SRCK_COMPRESSED_CLOCK_BOARD_AVG__VCLOCK "compressed.clockBoard.avg_Vclock" -#define PN_SRCK_COMPRESSED_CLOCK_BOARD_AVG_FREQ "compressed.clockBoard.avg_freq" -#define PN_SRCK_COMPRESSED_CLOCK_BOARD_AVG_TEMPERATURE "compressed.clockBoard.avg_temperature" - -// RSPBoard -#define PSN_RSP_BOARD "LOFAR_PIC_@cabinet@_@subrack@_@RSPBoard@" -#define PST_RSP_BOARD "RSPBoard" -#define PN_RSP_VOLTAGE12 "voltage12" -#define PN_RSP_VOLTAGE25 "voltage25" -#define PN_RSP_VOLTAGE33 "voltage33" -#define PN_RSP_VERSION "version" -#define PN_RSP_BITMODE "bitmode" -#define PN_RSP_BITMODE_CAPABILITY "bitmodeCapability" -#define PN_RSP_ALERT "alert" -#define PN_RSP_SPLITTER_ON "splitterOn" -#define PN_RSP__ETHERNET_STATUS_STATE "Ethernet.status.state" -#define PN_RSP__ETHERNET_STATUS_CHILD_STATE "Ethernet.status.childState" -#define PN_RSP__ETHERNET_STATUS_MESSAGE "Ethernet.status.message" -#define PN_RSP__ETHERNET_STATUS_LEAF "Ethernet.status.leaf" -#define PN_RSP__ETHERNET_STATUS_CHILD_SUM_ALERT "Ethernet.status.childSumAlert" -#define PN_RSP_ETHERNET_PACKETS_RECEIVED "Ethernet.packetsReceived" -#define PN_RSP_ETHERNET_PACKETS_ERROR "Ethernet.packetsError" -#define PN_RSP_ETHERNET_LAST_ERROR "Ethernet.lastError" -#define PN_RSP_MEP_SEQNR "MEP.seqnr" -#define PN_RSP_MEP_ERROR "MEP.error" -#define PN_RSP_BP_STATUS_STATE "BP.status.state" -#define PN_RSP_BP_STATUS_CHILD_STATE "BP.status.childState" -#define PN_RSP_BP_STATUS_MESSAGE "BP.status.message" -#define PN_RSP_BP_STATUS_LEAF "BP.status.leaf" -#define PN_RSP_BP_STATUS_CHILD_SUM_ALERT "BP.status.childSumAlert" -#define PN_RSP_BP_TEMPERATURE "BP.temperature" -#define PN_RSP_BP_VERSION "BP.version" -#define PN_RSP_AP0_STATUS_STATE "AP0.status.state" -#define PN_RSP_AP0_STATUS_CHILD_STATE "AP0.status.childState" -#define PN_RSP_AP0_STATUS_MESSAGE "AP0.status.message" -#define PN_RSP_AP0_STATUS_LEAF "AP0.status.leaf" -#define PN_RSP_AP0_STATUS_CHILD_SUM_ALERT "AP0.status.childSumAlert" -#define PN_RSP_AP0_TEMPERATURE "AP0.temperature" -#define PN_RSP_AP0_VERSION "AP0.version" -#define PN_RSP_AP0_SYNC_SAMPLE_COUNT "AP0.SYNC.sampleCount" -#define PN_RSP_AP0_SYNC_SYNC_COUNT "AP0.SYNC.syncCount" -#define PN_RSP_AP0_SYNC_ERROR_COUNT "AP0.SYNC.errorCount" -#define PN_RSP_AP1_STATUS_STATE "AP1.status.state" -#define PN_RSP_AP1_STATUS_CHILD_STATE "AP1.status.childState" -#define PN_RSP_AP1_STATUS_MESSAGE "AP1.status.message" -#define PN_RSP_AP1_STATUS_LEAF "AP1.status.leaf" -#define PN_RSP_AP1_STATUS_CHILD_SUM_ALERT "AP1.status.childSumAlert" -#define PN_RSP_AP1_TEMPERATURE "AP1.temperature" -#define PN_RSP_AP1_VERSION "AP1.version" -#define PN_RSP_AP1_SYNC_SAMPLE_COUNT "AP1.SYNC.sampleCount" -#define PN_RSP_AP1_SYNC_SYNC_COUNT "AP1.SYNC.syncCount" -#define PN_RSP_AP1_SYNC_ERROR_COUNT "AP1.SYNC.errorCount" -#define PN_RSP_AP2_STATUS_STATE "AP2.status.state" -#define PN_RSP_AP2_STATUS_CHILD_STATE "AP2.status.childState" -#define PN_RSP_AP2_STATUS_MESSAGE "AP2.status.message" -#define PN_RSP_AP2_STATUS_LEAF "AP2.status.leaf" -#define PN_RSP_AP2_STATUS_CHILD_SUM_ALERT "AP2.status.childSumAlert" -#define PN_RSP_AP2_TEMPERATURE "AP2.temperature" -#define PN_RSP_AP2_VERSION "AP2.version" -#define PN_RSP_AP2_SYNC_SAMPLE_COUNT "AP2.SYNC.sampleCount" -#define PN_RSP_AP2_SYNC_SYNC_COUNT "AP2.SYNC.syncCount" -#define PN_RSP_AP2_SYNC_ERROR_COUNT "AP2.SYNC.errorCount" -#define PN_RSP_AP3_STATUS_STATE "AP3.status.state" -#define PN_RSP_AP3_STATUS_CHILD_STATE "AP3.status.childState" -#define PN_RSP_AP3_STATUS_MESSAGE "AP3.status.message" -#define PN_RSP_AP3_STATUS_LEAF "AP3.status.leaf" -#define PN_RSP_AP3_STATUS_CHILD_SUM_ALERT "AP3.status.childSumAlert" -#define PN_RSP_AP3_TEMPERATURE "AP3.temperature" -#define PN_RSP_AP3_VERSION "AP3.version" -#define PN_RSP_AP3_SYNC_SAMPLE_COUNT "AP3.SYNC.sampleCount" -#define PN_RSP_AP3_SYNC_SYNC_COUNT "AP3.SYNC.syncCount" -#define PN_RSP_AP3_SYNC_ERROR_COUNT "AP3.SYNC.errorCount" -#define PN_RSP_COMPRESSED_AVG_VOLTAGE12 "compressed.avg_voltage12" -#define PN_RSP_COMPRESSED_AVG_VOLTAGE25 "compressed.avg_voltage25" -#define PN_RSP_COMPRESSED_AVG_VOLTAGE33 "compressed.avg_voltage33" -#define PN_RSP_COMPRESSED__ETHERNET_AVG_PACKETS_RECEIVED "compressed.Ethernet.avg_packetsReceived" -#define PN_RSP_COMPRESSED__ETHERNET_AVG_PACKETS_ERROR "compressed.Ethernet.avg_packetsError" -#define PN_RSP_COMPRESSED_BP_AVG_TEMPERATURE "compressed.BP.avg_temperature" -#define PN_RSP_COMPRESSED_AP0_AVG_TEMPERATURE "compressed.AP0.avg_temperature" -#define PN_RSP_COMPRESSED_AP0_SYNC_AVG_SAMPLE_COUNT "compressed.AP0.SYNC.avg_sampleCount" -#define PN_RSP_COMPRESSED_AP0_SYNC_AVG_SYNC_COUNT "compressed.AP0.SYNC.avg_syncCount" -#define PN_RSP_COMPRESSED_AP0_SYNC_AVG_ERROR_COUNT "compressed.AP0.SYNC.avg_errorCount" -#define PN_RSP_COMPRESSED_AP1_AVG_TEMPERATURE "compressed.AP1.avg_temperature" -#define PN_RSP_COMPRESSED_AP1_SYNC_AVG_SAMPLE_COUNT "compressed.AP1.SYNC.avg_sampleCount" -#define PN_RSP_COMPRESSED_AP1_SYNC_AVG_SYNC_COUNT "compressed.AP1.SYNC.avg_syncCount" -#define PN_RSP_COMPRESSED_AP1_SYNC_AVG_ERROR_COUNT "compressed.AP1.SYNC.avg_errorCount" -#define PN_RSP_COMPRESSED_AP2_AVG_TEMPERATURE "compressed.AP2.avg_temperature" -#define PN_RSP_COMPRESSED_AP2_SYNC_AVG_SAMPLE_COUNT "compressed.AP2.SYNC.avg_sampleCount" -#define PN_RSP_COMPRESSED_AP2_SYNC_AVG_SYNC_COUNT "compressed.AP2.SYNC.avg_syncCount" -#define PN_RSP_COMPRESSED_AP2_SYNC_AVG_ERROR_COUNT "compressed.AP2.SYNC.avg_errorCount" -#define PN_RSP_COMPRESSED_AP3_AVG_TEMPERATURE "compressed.AP3.avg_temperature" -#define PN_RSP_COMPRESSED_AP3_SYNC_AVG_SAMPLE_COUNT "compressed.AP3.SYNC.avg_sampleCount" -#define PN_RSP_COMPRESSED_AP3_SYNC_AVG_SYNC_COUNT "compressed.AP3.SYNC.avg_syncCount" -#define PN_RSP_COMPRESSED_AP3_SYNC_AVG_ERROR_COUNT "compressed.AP3.SYNC.avg_errorCount" - -// RCU -#define PSN_RCU "LOFAR_PIC_@cabinet@_@subrack@_@RSPBoard@_@rcu@" -#define PST_RCU "RCU" -#define PN_RCU_DELAY "Delay" -#define PN_RCU_INPUT_ENABLE "InputEnable" -#define PN_RCU_LBL_ENABLE "LBLEnable" -#define PN_RCU_LBH_ENABLE "LBHEnable" -#define PN_RCU_HBA_ENABLE "HBAEnable" -#define PN_RCU_BAND_SEL_LBA_HBA "bandSelLbaHba" -#define PN_RCU_HBA_FILTER_SEL "HBAFilterSel" -#define PN_RCU_VL_ENABLE "VlEnable" -#define PN_RCU_VH_ENABLE "VhEnable" -#define PN_RCU_VDD_VCC_ENABLE "VddVccEnable" -#define PN_RCU_BAND_SEL_LBL_LBH "bandSelLblLbh" -#define PN_RCU_LBA_FILTER_SEL "LBAFilterSel" -#define PN_RCU_ATTENUATION "Attenuation" -#define PN_RCU_NOF_OVERFLOW "nofOverflow" -#define PN_RCU_ADC_STATISTICS_OVERFLOW "ADCStatistics.overflow" -#define PN_RCU_ANTENNAS "antennas" -#define PN_RCU_TBB_ERROR "TBB.error" -#define PN_RCU_TBB_MODE "TBB.mode" -#define PN_RCU_TBB_START_ADDR "TBB.startAddr" -#define PN_RCU_TBB_BUF_SIZE "TBB.bufSize" -#define PN_RCU_TRIGGER_STARTLEVEL "Trigger.startlevel" -#define PN_RCU_TRIGGER_BASELEVEL "Trigger.baselevel" -#define PN_RCU_TRIGGER_STOPLEVEL "Trigger.stoplevel" -#define PN_RCU_TRIGGER_FILTER "Trigger.filter" -#define PN_RCU_TRIGGER_WINDOW "Trigger.window" -#define PN_RCU_TRIGGER_OPERATING_MODE "Trigger.operatingMode" -#define PN_RCU_TRIGGER_TRIGGER_MODE "Trigger.triggerMode" -#define PN_RCU_TRIGGER_FILTER0_COEFF0 "Trigger.filter0.coeff0" -#define PN_RCU_TRIGGER_FILTER0_COEFF1 "Trigger.filter0.coeff1" -#define PN_RCU_TRIGGER_FILTER0_COEFF2 "Trigger.filter0.coeff2" -#define PN_RCU_TRIGGER_FILTER0_COEFF3 "Trigger.filter0.coeff3" -#define PN_RCU_TRIGGER_FILTER1_COEFF0 "Trigger.filter1.coeff0" -#define PN_RCU_TRIGGER_FILTER1_COEFF1 "Trigger.filter1.coeff1" -#define PN_RCU_TRIGGER_FILTER1_COEFF2 "Trigger.filter1.coeff2" -#define PN_RCU_TRIGGER_FILTER1_COEFF3 "Trigger.filter1.coeff3" - -// TBBoard -#define PSN_TB_BOARD "LOFAR_PIC_@cabinet@_@subrack@_@TBBoard@" -#define PST_TB_BOARD "TBBoard" -#define PN_TBB_BOARDID "boardID" -#define PN_TBB_RAM_SIZE "RAMSize" -#define PN_TBB_SW_VERSION "SWVersion" -#define PN_TBB_BOARD_VERSION "boardVersion" -#define PN_TBB_TP_VERSION "TPVersion" -#define PN_TBB_MP0_VERSION "MP0Version" -#define PN_TBB_MP1_VERSION "MP1Version" -#define PN_TBB_MP2_VERSION "MP2Version" -#define PN_TBB_MP3_VERSION "MP3Version" -#define PN_TBB_VOLTAGE12 "voltage12" -#define PN_TBB_VOLTAGE25 "voltage25" -#define PN_TBB_VOLTAGE33 "voltage33" -#define PN_TBB_TEMPPCB "tempPCB" -#define PN_TBB_TEMPTP "tempTP" -#define PN_TBB_TEMPMP0 "tempMP0" -#define PN_TBB_TEMPMP1 "tempMP1" -#define PN_TBB_TEMPMP2 "tempMP2" -#define PN_TBB_TEMPMP3 "tempMP3" -#define PN_TBB_RECORDING "recording" -#define PN_TBB_IMAGE_INFO_VERSION "imageInfo.version" -#define PN_TBB_IMAGE_INFO_WRITE_DATE "imageInfo.writeDate" -#define PN_TBB_IMAGE_INFO_TP_FILE "imageInfo.TPFile" -#define PN_TBB_IMAGE_INFO_MP_FILE "imageInfo.MPFile" -#define PN_TBB_COMPRESSED_AVG_VOLTAGE12 "compressed.avg_voltage12" -#define PN_TBB_COMPRESSED_AVG_VOLTAGE25 "compressed.avg_voltage25" -#define PN_TBB_COMPRESSED_AVG_VOLTAGE33 "compressed.avg_voltage33" -#define PN_TBB_COMPRESSED_AVG_TEMPPCB "compressed.avg_tempPCB" -#define PN_TBB_COMPRESSED_AVG_TEMPTP "compressed.avg_tempTP" -#define PN_TBB_COMPRESSED_AVG_TEMPMP0 "compressed.avg_tempMP0" -#define PN_TBB_COMPRESSED_AVG_TEMPMP1 "compressed.avg_tempMP1" -#define PN_TBB_COMPRESSED_AVG_TEMPMP2 "compressed.avg_tempMP2" -#define PN_TBB_COMPRESSED_AVG_TEMPMP3 "compressed.avg_tempMP3" - -// UniBoard -#define PSN_UNI_BOARD "LOFAR_PIC_Cabinet1_UniBoard_@uniboard@" -#define PST_UNI_BOARD "UniBoard" -#define PN_UNI_POWER "power" -#define PN_UNI_ETH_TEMP "ethTemp" -#define PN_UNI_CURRENT "current" -#define PN_UNI_VOLTAGE "voltage" -#define PN_UNI_I2C_ERROR "i2cError" -#define PN_UNI_COMPRESSED_AVG_ETH_TEMP "compressed.avg_ethTemp" -#define PN_UNI_COMPRESSED_AVG_CURRENT "compressed.avg_current" -#define PN_UNI_COMPRESSED_AVG_VOLTAGE "compressed.avg_voltage" - -// FPGA -#define PSN_FPGA "LOFAR_PIC_Cabinet1_UniBoard_@fpga@" -#define PST_FPGA "FPGA" -#define PN_FPGA_FIRM_NAME "firmName" -#define PN_FPGA_FIRM_VERSION "firmVersion" -#define PN_FPGA_HW_VERSION "hwVersion" -#define PN_FPGA_HIGH_TEMP "highTemp" -#define PN_FPGA_FPGA_TEMP "fpgaTemp" -#define PN_FPGA_COMPRESSED_AVG_HIGH_TEMP "compressed.avg_highTemp" -#define PN_FPGA_COMPRESSED_AVG_FPGA_TEMP "compressed.avg_fpgaTemp" - -// URIBoard -#define PSN_URI_BOARD "LOFAR_PIC_@uriboard@" -#define PST_URI_BOARD "URIBoard" -#define PN_URI_FIRM_VERSION "firmVersion" -#define PN_URI_HW_VERSION "hwVersion" -#define PN_URI_HSC_STATUS "hscStatus" -#define PN_URI_INPUT_VOLTAGE "inputVoltage" -#define PN_URI_BOARD_VOLTAGE "boardVoltage" -#define PN_URI_BOARD_CURRENT "boardCurrent" -#define PN_URI_UR_ISTATUS "URIstatus" -#define PN_URI_COMPRESSED_AVG_INPUT_VOLTAGE "compressed.avg_inputVoltage" -#define PN_URI_COMPRESSED_AVG_BOARD_VOLTAGE "compressed.avg_boardVoltage" -#define PN_URI_COMPRESSED_AVG_BOARD_CURRENT "compressed.avg_boardCurrent" - -// LBAAntenna -#define PSN_LBA_ANTENNA "LOFAR_PIC_@lbaantenna@" -#define PST_LBA_ANTENNA "LBAAntenna" -#define PN_LBA_COMMON_RCUX "common.RCUX" -#define PN_LBA_COMMON_RCUY "common.RCUY" -#define PN_LBA_COMMON_DELTAX "common.deltaX" -#define PN_LBA_COMMON_DELTAY "common.deltaY" -#define PN_LBA_COMMON_DELTAZ "common.deltaZ" - -// HBAAntenna -#define PSN_HBA_ANTENNA "LOFAR_PIC_@hbaantenna@" -#define PST_HBA_ANTENNA "HBAAntenna" -#define PN_HBA_COMMON_RCUX "common.RCUX" -#define PN_HBA_COMMON_RCUY "common.RCUY" -#define PN_HBA_COMMON_DELTAX "common.deltaX" -#define PN_HBA_COMMON_DELTAY "common.deltaY" -#define PN_HBA_COMMON_DELTAZ "common.deltaZ" -#define PN_HBA_ELEMENT00_STATUS "element00.status" -#define PN_HBA_ELEMENT00_X "element00.X" -#define PN_HBA_ELEMENT00_STATUS "element00.status" -#define PN_HBA_ELEMENT00_Y "element00.Y" -#define PN_HBA_ELEMENT00_STATUS "element00.status" -#define PN_HBA_ELEMENT00_COMM "element00.comm" -#define PN_HBA_ELEMENT00_STATUS "element00.status" -#define PN_HBA_ELEMENT01_STATUS "element01.status" -#define PN_HBA_ELEMENT01_X "element01.X" -#define PN_HBA_ELEMENT01_STATUS "element01.status" -#define PN_HBA_ELEMENT01_Y "element01.Y" -#define PN_HBA_ELEMENT01_STATUS "element01.status" -#define PN_HBA_ELEMENT01_COMM "element01.comm" -#define PN_HBA_ELEMENT01_STATUS "element01.status" -#define PN_HBA_ELEMENT02_STATUS "element02.status" -#define PN_HBA_ELEMENT02_X "element02.X" -#define PN_HBA_ELEMENT02_STATUS "element02.status" -#define PN_HBA_ELEMENT02_Y "element02.Y" -#define PN_HBA_ELEMENT02_STATUS "element02.status" -#define PN_HBA_ELEMENT02_COMM "element02.comm" -#define PN_HBA_ELEMENT02_STATUS "element02.status" -#define PN_HBA_ELEMENT03_STATUS "element03.status" -#define PN_HBA_ELEMENT03_X "element03.X" -#define PN_HBA_ELEMENT03_STATUS "element03.status" -#define PN_HBA_ELEMENT03_Y "element03.Y" -#define PN_HBA_ELEMENT03_STATUS "element03.status" -#define PN_HBA_ELEMENT03_COMM "element03.comm" -#define PN_HBA_ELEMENT03_STATUS "element03.status" -#define PN_HBA_ELEMENT04_STATUS "element04.status" -#define PN_HBA_ELEMENT04_X "element04.X" -#define PN_HBA_ELEMENT04_STATUS "element04.status" -#define PN_HBA_ELEMENT04_Y "element04.Y" -#define PN_HBA_ELEMENT04_STATUS "element04.status" -#define PN_HBA_ELEMENT04_COMM "element04.comm" -#define PN_HBA_ELEMENT04_STATUS "element04.status" -#define PN_HBA_ELEMENT05_STATUS "element05.status" -#define PN_HBA_ELEMENT05_X "element05.X" -#define PN_HBA_ELEMENT05_STATUS "element05.status" -#define PN_HBA_ELEMENT05_Y "element05.Y" -#define PN_HBA_ELEMENT05_STATUS "element05.status" -#define PN_HBA_ELEMENT05_COMM "element05.comm" -#define PN_HBA_ELEMENT05_STATUS "element05.status" -#define PN_HBA_ELEMENT06_STATUS "element06.status" -#define PN_HBA_ELEMENT06_X "element06.X" -#define PN_HBA_ELEMENT06_STATUS "element06.status" -#define PN_HBA_ELEMENT06_Y "element06.Y" -#define PN_HBA_ELEMENT06_STATUS "element06.status" -#define PN_HBA_ELEMENT06_COMM "element06.comm" -#define PN_HBA_ELEMENT06_STATUS "element06.status" -#define PN_HBA_ELEMENT07_STATUS "element07.status" -#define PN_HBA_ELEMENT07_X "element07.X" -#define PN_HBA_ELEMENT07_STATUS "element07.status" -#define PN_HBA_ELEMENT07_Y "element07.Y" -#define PN_HBA_ELEMENT07_STATUS "element07.status" -#define PN_HBA_ELEMENT07_COMM "element07.comm" -#define PN_HBA_ELEMENT07_STATUS "element07.status" -#define PN_HBA_ELEMENT08_STATUS "element08.status" -#define PN_HBA_ELEMENT08_X "element08.X" -#define PN_HBA_ELEMENT08_STATUS "element08.status" -#define PN_HBA_ELEMENT08_Y "element08.Y" -#define PN_HBA_ELEMENT08_STATUS "element08.status" -#define PN_HBA_ELEMENT08_COMM "element08.comm" -#define PN_HBA_ELEMENT08_STATUS "element08.status" -#define PN_HBA_ELEMENT09_STATUS "element09.status" -#define PN_HBA_ELEMENT09_X "element09.X" -#define PN_HBA_ELEMENT09_STATUS "element09.status" -#define PN_HBA_ELEMENT09_Y "element09.Y" -#define PN_HBA_ELEMENT09_STATUS "element09.status" -#define PN_HBA_ELEMENT09_COMM "element09.comm" -#define PN_HBA_ELEMENT09_STATUS "element09.status" -#define PN_HBA_ELEMENT10_STATUS "element10.status" -#define PN_HBA_ELEMENT10_X "element10.X" -#define PN_HBA_ELEMENT10_STATUS "element10.status" -#define PN_HBA_ELEMENT10_Y "element10.Y" -#define PN_HBA_ELEMENT10_STATUS "element10.status" -#define PN_HBA_ELEMENT10_COMM "element10.comm" -#define PN_HBA_ELEMENT10_STATUS "element10.status" -#define PN_HBA_ELEMENT11_STATUS "element11.status" -#define PN_HBA_ELEMENT11_X "element11.X" -#define PN_HBA_ELEMENT11_STATUS "element11.status" -#define PN_HBA_ELEMENT11_Y "element11.Y" -#define PN_HBA_ELEMENT11_STATUS "element11.status" -#define PN_HBA_ELEMENT11_COMM "element11.comm" -#define PN_HBA_ELEMENT11_STATUS "element11.status" -#define PN_HBA_ELEMENT12_STATUS "element12.status" -#define PN_HBA_ELEMENT12_X "element12.X" -#define PN_HBA_ELEMENT12_STATUS "element12.status" -#define PN_HBA_ELEMENT12_Y "element12.Y" -#define PN_HBA_ELEMENT12_STATUS "element12.status" -#define PN_HBA_ELEMENT12_COMM "element12.comm" -#define PN_HBA_ELEMENT12_STATUS "element12.status" -#define PN_HBA_ELEMENT13_STATUS "element13.status" -#define PN_HBA_ELEMENT13_X "element13.X" -#define PN_HBA_ELEMENT13_STATUS "element13.status" -#define PN_HBA_ELEMENT13_Y "element13.Y" -#define PN_HBA_ELEMENT13_STATUS "element13.status" -#define PN_HBA_ELEMENT13_COMM "element13.comm" -#define PN_HBA_ELEMENT13_STATUS "element13.status" -#define PN_HBA_ELEMENT14_STATUS "element14.status" -#define PN_HBA_ELEMENT14_X "element14.X" -#define PN_HBA_ELEMENT14_STATUS "element14.status" -#define PN_HBA_ELEMENT14_Y "element14.Y" -#define PN_HBA_ELEMENT14_STATUS "element14.status" -#define PN_HBA_ELEMENT14_COMM "element14.comm" -#define PN_HBA_ELEMENT14_STATUS "element14.status" -#define PN_HBA_ELEMENT15_STATUS "element15.status" -#define PN_HBA_ELEMENT15_X "element15.X" -#define PN_HBA_ELEMENT15_STATUS "element15.status" -#define PN_HBA_ELEMENT15_Y "element15.Y" -#define PN_HBA_ELEMENT15_STATUS "element15.status" -#define PN_HBA_ELEMENT15_COMM "element15.comm" -#define PN_HBA_ELEMENT15_STATUS "element15.status" - -// StationInfo -#define PSN_STATION_INFO "LOFAR_PIC_StationInfo" -#define PST_STATION_INFO "StationInfo" -#define PN_STI_STATIONID "stationID" -#define PN_STI_STATIONIP "stationIP" -#define PN_STI_N_RSP_BOARDS "N_RSPBoards" -#define PN_STI_N_TB_BOARDS "N_TBBoards" -#define PN_STI_N_LBAS "N_LBAS" -#define PN_STI_N_HBAS "N_HBAS" -#define PN_STI_HBA__SPLIT "HBA_Split" -#define PN_STI_WIDE_LBAS "wide_LBAS" -#define PN_STI_AARTFAAC "AARTFAAC" -#define PN_STI_POWER48_ON "power48On" -#define PN_STI_POWER220_ON "power220On" -#define PN_STI_NR_OF_POWER_UNITS "nrOfPowerUnits" -#define PN_STI_DATASTREAM0 "datastream0" -#define PN_STI_DATASTREAM1 "datastream1" -#define PN_STI_CABINET_X "Cabinet.X" -#define PN_STI_CABINET_Y "Cabinet.Y" -#define PN_STI_CABINET_Z "Cabinet.Z" -#define PN_STI_HBA_NR_BROKEN "HBA.nrBroken" -#define PN_STI_HBA_NR_BROKEN_ARCHIVE "HBA.nrBrokenArchive" -#define PN_STI_HBA_CENTERX "HBA.centerX" -#define PN_STI_HBA_CENTERY "HBA.centerY" -#define PN_STI_HBA_CENTERZ "HBA.centerZ" -#define PN_STI_HBA_HBA0_CENTERX "HBA.HBA0.centerX" -#define PN_STI_HBA_HBA0_CENTERY "HBA.HBA0.centerY" -#define PN_STI_HBA_HBA0_CENTERZ "HBA.HBA0.centerZ" -#define PN_STI_HBA_HBA0__NORMAL_VECTOR_X "HBA.HBA0.NormalVector.X" -#define PN_STI_HBA_HBA0__NORMAL_VECTOR_Y "HBA.HBA0.NormalVector.Y" -#define PN_STI_HBA_HBA0__NORMAL_VECTOR_Z "HBA.HBA0.NormalVector.Z" -#define PN_STI_HBA_HBA0__ROTATION_MATRIX_X "HBA.HBA0.RotationMatrix.X" -#define PN_STI_HBA_HBA0__ROTATION_MATRIX_Y "HBA.HBA0.RotationMatrix.Y" -#define PN_STI_HBA_HBA0__ROTATION_MATRIX_Z "HBA.HBA0.RotationMatrix.Z" -#define PN_STI_HBA_HBA0_ROTATION "HBA.HBA0.rotation" -#define PN_STI_HBA_HBA1_CENTERX "HBA.HBA1.centerX" -#define PN_STI_HBA_HBA1_CENTERY "HBA.HBA1.centerY" -#define PN_STI_HBA_HBA1_CENTERZ "HBA.HBA1.centerZ" -#define PN_STI_HBA_HBA1__NORMAL_VECTOR_X "HBA.HBA1.NormalVector.X" -#define PN_STI_HBA_HBA1__NORMAL_VECTOR_Y "HBA.HBA1.NormalVector.Y" -#define PN_STI_HBA_HBA1__NORMAL_VECTOR_Z "HBA.HBA1.NormalVector.Z" -#define PN_STI_HBA_HBA1__ROTATION_MATRIX_X "HBA.HBA1.RotationMatrix.X" -#define PN_STI_HBA_HBA1__ROTATION_MATRIX_Y "HBA.HBA1.RotationMatrix.Y" -#define PN_STI_HBA_HBA1__ROTATION_MATRIX_Z "HBA.HBA1.RotationMatrix.Z" -#define PN_STI_HBA_HBA1_ROTATION "HBA.HBA1.rotation" -#define PN_STI_LBA_NR_BROKEN "LBA.nrBroken" -#define PN_STI_LBA_NR_BROKEN_ARCHIVE "LBA.nrBrokenArchive" -#define PN_STI_LBA_CENTERX "LBA.centerX" -#define PN_STI_LBA_CENTERY "LBA.centerY" -#define PN_STI_LBA_CENTERZ "LBA.centerZ" -#define PN_STI_LBA__NORMAL_VECTOR_X "LBA.NormalVector.X" -#define PN_STI_LBA__NORMAL_VECTOR_Y "LBA.NormalVector.Y" -#define PN_STI_LBA__NORMAL_VECTOR_Z "LBA.NormalVector.Z" -#define PN_STI_LBA__ROTATION_MATRIX_X "LBA.RotationMatrix.X" -#define PN_STI_LBA__ROTATION_MATRIX_Y "LBA.RotationMatrix.Y" -#define PN_STI_LBA__ROTATION_MATRIX_Z "LBA.RotationMatrix.Z" - -// PowerUnit -#define PSN_POWER_UNIT "LOFAR_PIC_@powec@" -#define PST_POWER_UNIT "PowerUnit" -#define PN_POW_POWER_SYSTEM_TYPE "powerSystemType" -#define PN_POW_NR_OF_MODULES "nrOfModules" -#define PN_POW_VOLTAGE "voltage" -#define PN_POW_CURRENT "current" -#define PN_POW_TEMPERATURE "temperature" -#define PN_POW_OK "OK" -#define PN_POW_NR_OF_ALARMS "nrOfAlarms" -#define PN_POW_ALARM_TYPE "alarmType" -#define PN_POW_ALARM_REASON "alarmReason" -#define PN_POW_ALARM_TIME "alarmTime" -#define PN_POW_ALARM_TEXT "alarmText" -#define PN_POW_CLEAR_ALARM_HISTORY "clearAlarmHistory" - -// LogProcessor -#define PSN_LOG_PROCESSOR "LOFAR_PermSW_Daemons_LogProcessor" -#define PST_LOG_PROCESSOR "LogProcessor" - -// SASGateway -#define PSN_SAS_GATEWAY "LOFAR_PermSW_Daemons_SASGateway" -#define PST_SAS_GATEWAY "SASGateway" - -// SoftwareMonitor -#define PSN_SOFTWARE_MONITOR "LOFAR_PermSW_Daemons_SoftwareMonitor" -#define PST_SOFTWARE_MONITOR "SoftwareMonitor" -#define PN_SWM_SW_LEVEL "SWLevel" - -// HardwareMonitor -#define PSN_HARDWARE_MONITOR "LOFAR_PermSW_HardwareMonitor" -#define PST_HARDWARE_MONITOR "HardwareMonitor" -#define PN_HWM_RSP_CONNECTED "RSP.connected" -#define PN_HWM_TBB_CONNECTED "TBB.connected" -#define PN_HWM_EC_CONNECTED "EC.connected" - -// SHMInfoServer -#define PSN_SHM_INFO_SERVER "LOFAR_PermSW_SHMInfoServer" -#define PST_SHM_INFO_SERVER "SHMInfoServer" - -// StationControl -#define PSN_STATION_CONTROL "LOFAR_PermSW_StationControl" -#define PST_STATION_CONTROL "StationControl" -#define PN_SC_ACTIVE_OBSERVATIONS "activeObservations" - -// ClockControl -#define PSN_CLOCK_CONTROL "LOFAR_PermSW_ClockControl" -#define PST_CLOCK_CONTROL "ClockControl" -#define PN_CLC_CONNECTED "connected" -#define PN_CLC_REQUESTED_CLOCK "requestedClock" -#define PN_CLC_ACTUAL_CLOCK "actualClock" -#define PN_CLC_REQUESTED_BITMODE "requestedBitmode" -#define PN_CLC_ACTUAL_BITMODE "actualBitmode" - -// StnObservation -#define PSN_STN_OBSERVATION "LOFAR_ObsSW_@observation@" -#define PST_STN_OBSERVATION "StnObservation" -#define PN_OBS_NAME "name" -#define PN_OBS_CLAIM_CLAIM_DATE "claim.claimDate" -#define PN_OBS_CLAIM_FREE_DATE "claim.freeDate" -#define PN_OBS_CLAIM_NAME "claim.name" -#define PN_OBS_RECEIVER_BITMAP "receiverBitmap" -#define PN_OBS_HBA_BITMAP "HBABitmap" -#define PN_OBS_LBA_BITMAP "LBABitmap" - -// BeamControl -#define PSN_BEAM_CONTROL "LOFAR_ObsSW_@observation@_BeamControl" -#define PST_BEAM_CONTROL "BeamControl" -#define PN_BC_CONNECTED "connected" -#define PN_BC_SUB_ARRAY "subArray" -#define PN_BC_SUBBAND_LIST "subbandList" -#define PN_BC_BEAMLET_LIST "beamletList" -#define PN_BC_ANGLE1 "angle1" -#define PN_BC_ANGLE2 "angle2" -#define PN_BC_DIRECTION_TYPE "directionType" -#define PN_BC_BEAM_NAME "beamName" - -// CalibrationControl -#define PSN_CALIBRATION_CONTROL "LOFAR_ObsSW_@observation@_CalibrationControl" -#define PST_CALIBRATION_CONTROL "CalibrationControl" -#define PN_CC_CONNECTED "connected" -#define PN_CC_BEAM_NAMES "beamNames" -#define PN_CC_ANTENNA_ARRAY "antennaArray" -#define PN_CC_FILTER "filter" -#define PN_CC_NYQUISTZONE "nyquistzone" -#define PN_CC_RCUS "rcus" - -// TBBControl -#define PSN_TBB_CONTROL "LOFAR_ObsSW_@observation@_TBBControl" -#define PST_TBB_CONTROL "TBBControl" -#define PN_TBC_CONNECTED "connected" -#define PN_TBC_TRIGGER_RCU_NR "trigger.rcuNr" -#define PN_TBC_TRIGGER_SEQUENCE_NR "trigger.sequenceNr" -#define PN_TBC_TRIGGER_TIME "trigger.time" -#define PN_TBC_TRIGGER_SAMPLE_NR "trigger.sampleNr" -#define PN_TBC_TRIGGER_SUM "trigger.sum" -#define PN_TBC_TRIGGER_NR_SAMPLES "trigger.nrSamples" -#define PN_TBC_TRIGGER_PEAK_VALUE "trigger.peakValue" -#define PN_TBC_TRIGGER_FLAGS "trigger.flags" -#define PN_TBC_TRIGGER_TABLE "trigger.table" -#define PN_TBC_TRIGGER_MISSED "trigger.missed" - -#endif diff --git a/dependencies/ApplCommon/include/ApplCommon/StationDatatypes.h b/dependencies/ApplCommon/include/ApplCommon/StationDatatypes.h deleted file mode 100644 index 443df01e330ee34ab386a232eaefc93d68b8a373..0000000000000000000000000000000000000000 --- a/dependencies/ApplCommon/include/ApplCommon/StationDatatypes.h +++ /dev/null @@ -1,54 +0,0 @@ -//# StationDataTypes.h.h: Several 'deployment' related routines. -//# -//# Copyright (C) 2006 -//# ASTRON (Netherlands Institute for Radio Astronomy) -//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands -//# -//# This file is part of the LOFAR software suite. -//# The LOFAR software suite 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 3 of the License, or -//# (at your option) any later version. -//# -//# The LOFAR software suite 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 the LOFAR software suite. If not, see <http://www.gnu.org/licenses/>. -//# -//# $Id: StationDataTypes.h.h 14057 2009-09-18 12:26:29Z diepen $ - -#ifndef LOFAR_APPLCOMMON_STATIONDATATYPES_H -#define LOFAR_APPLCOMMON_STATIONDATATYPES_H - -// \file StationDataTypes.h -// Several station related datatypes and conversions - -//# Never #include <config.h> or #include <lofar_config.h> in a header file! -//# Includes -#include <Common/LofarConstants.h> - -//# Avoid 'using namespace' in headerfiles - -namespace LOFAR { - -// \addtogroup ApplCommon -// @{ - -typedef bitset<MAX_RCUS> RCUmask_t; -typedef bitset<MAX_ANTENNAS> AntennaMask_t; -typedef bitset<MAX_SUBBANDS> SubbandMask_t; - -using LOFAR::RCUmask_t; -using LOFAR::AntennaMask_t; -using LOFAR::SubbandMask_t; - -RCUmask_t Antenna2RCUmask(const AntennaMask_t& am); -AntennaMask_t RCU2AntennaMask(const RCUmask_t& rm); - -// @} -} // namespace LOFAR - -#endif diff --git a/dependencies/ApplCommon/include/ApplCommon/StationInfo.h b/dependencies/ApplCommon/include/ApplCommon/StationInfo.h index 747880f273a4bdb0d783e58f4e83d97a98bedd78..218861105a3fe6779a5b6a2948197ce6d7750895 100644 --- a/dependencies/ApplCommon/include/ApplCommon/StationInfo.h +++ b/dependencies/ApplCommon/include/ApplCommon/StationInfo.h @@ -30,7 +30,8 @@ //# Includes #include <ApplCommon/LofarDirs.h> #include <Common/LofarTypes.h> -#include <Common/lofar_string.h> + +using std::string; //# Avoid 'using namespace' in headerfiles diff --git a/dependencies/ApplCommon/src/AntField.cc b/dependencies/ApplCommon/src/AntField.cc index 5ddb1499f79ae3174acb4f1e3f4523ed320d3dbf..00c25af9a6b5d0adf4dbde174456a4963e139634 100644 --- a/dependencies/ApplCommon/src/AntField.cc +++ b/dependencies/ApplCommon/src/AntField.cc @@ -33,6 +33,8 @@ #include <Common/SystemUtil.h> #include <ApplCommon/AntField.h> +#include <cmath> + namespace LOFAR { // AntField(fileName) // @@ -275,7 +277,7 @@ namespace LOFAR { getData(rcuLen).resize (nrrcu); for (int i=0; i<nrrcu; ++i) { const double* pos = &(getData(antennaPos)[i*3]); - getData(rcuLen)[i] = sqrt(pos[0]*pos[0] + pos[1]*pos[1] + pos[2]*pos[2]); + getData(rcuLen)[i] = std::sqrt(pos[0]*pos[0] + pos[1]*pos[1] + pos[2]*pos[2]); } } diff --git a/dependencies/ApplCommon/src/CMakeLists.txt b/dependencies/ApplCommon/src/CMakeLists.txt index 8452a492691de9d406abcdb865b0cc7216adee74..f4f0aac345e77001862f523a7f2eedd837ddd170 100644 --- a/dependencies/ApplCommon/src/CMakeLists.txt +++ b/dependencies/ApplCommon/src/CMakeLists.txt @@ -3,9 +3,7 @@ lofar_add_library(applcommon AntField.cc AntennaSets.cc - Observation.cc PosixTime.cc StationConfig.cc - StationDatatypes.cc StationInfo.cc) diff --git a/dependencies/ApplCommon/src/Observation.cc b/dependencies/ApplCommon/src/Observation.cc deleted file mode 100644 index 6e2c71b2e98d8bacd094854f29efbefc6358e13c..0000000000000000000000000000000000000000 --- a/dependencies/ApplCommon/src/Observation.cc +++ /dev/null @@ -1,963 +0,0 @@ -//# Observation.cc: class for easy access to observation definitions -//# -//# Copyright (C) 2006-2012 -//# ASTRON (Netherlands Institute for Radio Astronomy) -//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands -//# -//# This file is part of the LOFAR software suite. -//# The LOFAR software suite 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 3 of the License, or -//# (at your option) any later version. -//# -//# The LOFAR software suite 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 the LOFAR software suite. If not, see <http://www.gnu.org/licenses/>. -//# -//# $Id$ - -//# Always #include <lofar_config.h> first! -#include <lofar_config.h> - -//# Includes -#include <Common/LofarLogger.h> -#include <ApplCommon/PosixTime.h> -#include <Common/lofar_set.h> -#include <Common/lofar_string.h> -#include <Common/lofar_vector.h> -#include <Common/StreamUtil.h> -#include <Common/SystemUtil.h> -#include <Common/LofarBitModeInfo.h> -#include <ApplCommon/Observation.h> - -#include <Common/lofar_map.h> -#include <boost/date_time/posix_time/posix_time.hpp> -#include <boost/format.hpp> - -using boost::format; -using namespace boost::posix_time; - -namespace LOFAR { - -// -// Observation() -// -Observation::Observation() : - name(), - obsID(0), - startTime(0), - stopTime(0), - nyquistZone(0), - sampleClock(0), - splitterOn(false), - itsStnHasDualHBA(false) -{ } - -// -// Observation(ParameterSet*, [hasDualHBA])) -// -Observation::Observation(const ParameterSet* aParSet, - bool hasDualHBA, - unsigned nrBGPIOnodes) : - name(), - obsID(0), - startTime(0), - stopTime(0), - nyquistZone(0), - sampleClock(0), - bitsPerSample(0), - splitterOn(false), - itsStnHasDualHBA(hasDualHBA) -{ - // analyse ParameterSet. - string prefix = aParSet->locateModule("Observation") + "Observation."; - LOG_TRACE_VAR_STR("'Observation' located at: " << prefix); - - string olapprefix = aParSet->locateModule("OLAP") + "OLAP."; - LOG_TRACE_VAR_STR("'OLAP' located at: " << olapprefix); - - name = aParSet->getString(prefix+"name", ""); - obsID = aParSet->getInt32("_treeID", 0); - realPVSSdatapoint = aParSet->getString("_DPname","NOT_THE_REAL_DPNAME"); - - // Start and stop times - try { - if (aParSet->isDefined(prefix+"startTime")) { - startTime = LOFAR::to_time_t(time_from_string(aParSet->getString(prefix+"startTime"))); - } - } catch( boost::bad_lexical_cast ) { - THROW( Exception, prefix << "startTime cannot be parsed as a valid time string. Please use YYYY-MM-DD HH:MM:SS[.hhh]." ); - } - try { - if (aParSet->isDefined(prefix+"stopTime")) { - stopTime = LOFAR::to_time_t(time_from_string(aParSet->getString(prefix+"stopTime"))); - } - } catch( boost::bad_lexical_cast ) { - THROW( Exception, prefix << "stopTime cannot be parsed as a valid time string. Please use YYYY-MM-DD HH:MM:SS[.hhh]." ); - } - - // stationlist(s) - if (aParSet->isDefined(prefix+"VirtualInstrument.stationList")) { - stationList = aParSet->getString(prefix+"VirtualInstrument.stationList"); - stations = aParSet->getStringVector(prefix+"VirtualInstrument.stationList", true); // true:expandable - std::sort(stations.begin(), stations.end()); - } - - // miscellaneous - sampleClock = aParSet->getUint32(prefix+"sampleClock", 0); - filter = aParSet->getString(prefix+"bandFilter", ""); - antennaArray = aParSet->getString(prefix+"antennaArray", ""); - processType = aParSet->getString(prefix+"processType", ""); - processSubtype= aParSet->getString(prefix+"processSubtype", ""); - strategy = aParSet->getString(prefix+"strategy", ""); - - if (aParSet->isDefined(prefix+"nrBitsPerSample")) { - bitsPerSample = aParSet->getUint32(prefix+"nrBitsPerSample", 16); - } else { - // backward compatibility - LOG_WARN("Could not find Observation.nrBitsPerSample, using depricated OLAP.nrBitsPerSample"); - bitsPerSample = aParSet->getUint32(olapprefix+"nrBitsPerSample", 16); - } - - nyquistZone = nyquistzoneFromFilter(filter); - - // new way of specifying the receivers and choosing the antenna array. - antennaSet = aParSet->getString(prefix+"antennaSet", ""); - useLongBaselines = aParSet->getBool (prefix+"longBaselines", false); - - // auto select the right antennaArray when antennaSet variable is used. - if (!antennaSet.empty()) { - antennaArray = antennaSet.substr(0,3); // LBA or HBA - } - splitterOn = ((antennaSet.substr(0,8) == "HBA_ZERO") || (antennaSet.substr(0,7) == "HBA_ONE") || - (antennaSet.substr(0,8) == "HBA_DUAL")); - dualMode = (antennaSet.substr(0,8) == "HBA_DUAL"); - bool innerMode = (antennaSet.find("_INNER") != string::npos); - - // RCU information - RCUset.reset(); // clear RCUset by default. - if (aParSet->isDefined(prefix+"receiverList")) { - receiverList = aParSet->getString(prefix+"receiverList"); - vector<uint32> RCUnumbers (aParSet->getUint32Vector(prefix+"receiverList", true)); // true:expandable - for (uint i = 0; i < RCUnumbers.size();i++) { - RCUset.set(RCUnumbers[i]); // set mentioned receivers - } - } - - BGLNodeList = compactedArrayString(aParSet->getString(prefix+"VirtualInstrument.BGLNodeList","[]")); - storageNodeList = compactedArrayString(aParSet->getString(prefix+"VirtualInstrument.storageNodeList","[]")); - - // construct array with usable (-1) slots and unusable(999) slots. Unusable slots arise - // when nrSlotsInFrame differs from maxBeamletsPerRSP. - itsSlotTemplate.resize (maxBeamlets(bitsPerSample), -1); // assume all are usable. - nrSlotsInFrame = aParSet->getInt(prefix+"nrSlotsInFrame", maxBeamletsPerRSP(bitsPerSample)); - for (int rsp = 0; rsp < 4; rsp++) { - for (int bl = nrSlotsInFrame; bl < maxBeamletsPerRSP(bitsPerSample); bl++) { - itsSlotTemplate[rsp * maxBeamletsPerRSP(bitsPerSample) + bl] = 999; - } - } - - // determine if DataslotLists are available in this parset - itsHasDataslots = _hasDataSlots(aParSet); - if (itsHasDataslots) { - itsDataslotParset = aParSet->makeSubset(prefix+"Dataslots."); // save subset for later - } - else { // init old arrays. - itsDataslotParset = aParSet->makeSubset(prefix+"Beam", "Beam"); // save subset for later - beamlet2beams = itsSlotTemplate; - } - - // - // NOTE: THE DATAMODEL USED IN SAS IS NOT RIGHT. IT SUPPORTS ONLY 1 POINTING PER BEAM. - // THIS IS NO PROBLEM BECAUSE THAT IS WHAT WE AGREED. - // WITHIN OBSERVATION HOWEVER WE USE THE RIGHT DATAMODEL THAT IS ALMOST THE SAME AS - // THE BEAMSERVER USES. - // - - // NOTE: One of the nasty problems we solve in this class is the duplication of a beam when it - // is allocated on the HBA_DUAL antennaSet. For the user its one setting but for all software - // it are two beams, each on a different antennaField. When HBA_DUAL is used in this observation - // the corresponding beam(s) are added twice to the beam vectors, once on the HBA_ZERO antennaSet - // once in the HBA_ONE antennaSet. - - // loop over all digital beams - vector<int> BeamBeamlets; - int32 nrBeams = aParSet->getInt32(prefix+"nrBeams", 0); // theoretical number - while (nrBeams > 0 && !aParSet->isDefined(prefix+formatString("Beam[%d].angle1", nrBeams-1))) { // check reality - nrBeams--; - } - for (int32 beamIdx(0) ; beamIdx < nrBeams; beamIdx++) { - Beam newBeam; - string beamPrefix(prefix+formatString("Beam[%d].", beamIdx)); - newBeam.momID = aParSet->getInt (beamPrefix+"momID", 0); - newBeam.target = aParSet->getString (beamPrefix+"target", ""); - newBeam.subbands = aParSet->getInt32Vector(beamPrefix+"subbandList", vector<int32>(), true);// true:expand - newBeam.name = getBeamName(beamIdx); - newBeam.antennaSet = antennaSet; - if (dualMode) { - newBeam.antennaSet = string("HBA_ZERO") + (innerMode ? "_INNER" : ""); - if (hasDualHBA) { - newBeam.name += "_0"; - } - } - - // Only ONE pointing per beam. - Pointing newPt; - newPt.angle1 = aParSet->getDouble(beamPrefix+"angle1", 0.0); - newPt.angle2 = aParSet->getDouble(beamPrefix+"angle2", 0.0); - newPt.directionType = aParSet->getString(beamPrefix+"directionType", ""); - newPt.duration = aParSet->getInt (beamPrefix+"duration", 0); - newPt.startTime = startTime; // assume time of observation itself - try { - string timeStr = aParSet->getString(beamPrefix+"startTime",""); - if (!timeStr.empty() && timeStr != "0") { - newPt.startTime = LOFAR::to_time_t(time_from_string(timeStr)); - } - } catch (boost::bad_lexical_cast) { - LOG_ERROR_STR("Starttime of pointing of beam " << beamIdx << " not valid, using starttime of observation"); - } - newBeam.pointings.push_back(newPt); - - // Add TiedArrayBeam information - newBeam.nrTABs = aParSet->getInt (beamPrefix+"nrTiedArrayBeams", 0); - newBeam.nrTABrings = aParSet->getInt (beamPrefix+"nrTabRings", 0); - newBeam.TABringSize = aParSet->getDouble(beamPrefix+"tabRingSize", 0.0); - for (int32 tabIdx(0); tabIdx < newBeam.nrTABs; tabIdx++) { - TiedArrayBeam newTAB; - string tabPrefix(beamPrefix+formatString("TiedArrayBeam[%d].", tabIdx)); - newTAB.angle1 = aParSet->getDouble(tabPrefix+"angle1", 0.0); - newTAB.angle2 = aParSet->getDouble(tabPrefix+"angle2", 0.0); - newTAB.directionType = aParSet->getString(tabPrefix+"directionType", ""); - newTAB.dispersionMeasure = aParSet->getDouble(tabPrefix+"dispersionMeasure", 0.0); - newTAB.coherent = aParSet->getBool (tabPrefix+"coherent", false); - newBeam.TABs.push_back(newTAB); - } - - // Finally add the beam to the vector - beams.push_back(newBeam); - - // Duplicate beam on second HBA subfield when in HBA_DUAL mode. - if (dualMode && hasDualHBA) { - newBeam.name = getBeamName(beamIdx) + "_1"; - newBeam.antennaSet = string("HBA_ONE") + (innerMode ? "_INNER" : ""); - beams.push_back(newBeam); - } - - // finally update vector with beamnumbers -// if (_isStationName(myHostname(false))) { - int nrSubbands = newBeam.subbands.size(); - if (!itsHasDataslots) { // old situation - BeamBeamlets = aParSet->getInt32Vector(beamPrefix+"beamletList", vector<int32>(), true); // true:expandable - int nrBeamlets = BeamBeamlets.size(); - ASSERTSTR(nrBeamlets == nrSubbands, "Number of beamlets(" << nrBeamlets << ") != nr of subbands(" << nrSubbands << ") for Beam " << beamIdx); - for (int i = 0; i < nrBeamlets; ++i) { - if (beamlet2beams[BeamBeamlets[i]] != -1) { - stringstream os; - os << "beamlet2beams : "; writeVector(os, beamlet2beams, ",", "[", "]"); os << endl; - LOG_ERROR_STR(os.str()); - THROW (Exception, "beamlet " << i << "(" << BeamBeamlets[i] << ") of beam " << beamIdx << " clashes with beamlet of other beam"); - } - beamlet2beams[BeamBeamlets[i]] = beamIdx; - } // for all beamlets - } - else { // new situation - for (int i = 0; i < nrSubbands; ++i) { // Note nrBeamlets=nrSubbands - itsBeamSlotList.push_back(beamIdx); - } - } // itsHasDataslots -// } // on a station - } // for all digital beams - - // loop over al analogue beams - int32 nrAnaBeams = aParSet->getInt32(prefix+"nrAnaBeams", 0); // theoretical number - while (nrAnaBeams > 0 && !aParSet->isDefined(prefix+formatString("AnaBeam[%d].angle1", nrAnaBeams-1))) { // check reality - nrAnaBeams--; - } - for (int32 beamIdx(0) ; beamIdx < nrAnaBeams; beamIdx++) { - AnaBeam newBeam; - string beamPrefix(prefix+formatString("AnaBeam[%d].", beamIdx)); - newBeam.rank = aParSet->getInt (beamPrefix+"rank", 5); - newBeam.name = getAnaBeamName(); - newBeam.antennaSet = antennaSet; - if (dualMode) { - newBeam.antennaSet = string("HBA_ZERO") + (innerMode ? "_INNER" : ""); - if (hasDualHBA) { - newBeam.name += "_0"; - } - } - - // ONLY one pointing per beam. - Pointing newPt; - newPt.angle1 = aParSet->getDouble(beamPrefix+"angle1", 0.0); - newPt.angle2 = aParSet->getDouble(beamPrefix+"angle2", 0.0); - newPt.directionType = aParSet->getString(beamPrefix+"directionType", ""); - newPt.duration = aParSet->getInt (beamPrefix+"duration", 0); - newPt.startTime = startTime; // assume time of observation itself - try { - string timeStr = aParSet->getString(beamPrefix+"startTime",""); - if (!timeStr.empty() && timeStr != "0") { - newPt.startTime = LOFAR::to_time_t(time_from_string(timeStr)); - } - } catch (boost::bad_lexical_cast) { - LOG_ERROR_STR("Starttime of pointing of analogue beam " << beamIdx << " not valid, using starttime of observation"); - } - newBeam.pointings.push_back(newPt); - - // add beam to the analogue beam vector - anaBeams.push_back(newBeam); - - // Duplicate beam on second HBA subfield when in HBA_DUAL mode. - if (dualMode && hasDualHBA) { - newBeam.name = getBeamName(beamIdx) + "_1"; - newBeam.antennaSet = string("HBA_ONE") + (innerMode ? "_INNER" : ""); - anaBeams.push_back(newBeam); - } - } // for all analogue beams - - // loop over all data products and generate all data flows - if (!olapprefix.empty()) { // offline Pipelines don't have OLAP in the parset. - const char *dataProductNames[] = { "Beamformed", "Correlated" }; - unsigned dataProductPhases[] = { 3, 2 }; - unsigned dataProductNrs[] = { 2, 1 }; - size_t nrDataProducts = sizeof dataProductNames / sizeof dataProductNames[0]; - - const unsigned nrPsets = nrBGPIOnodes; - - // by default, use all psets - vector<unsigned> phaseTwoPsets; - if (aParSet->isDefined(olapprefix+"CNProc.phaseTwoPsets")) { - phaseTwoPsets = aParSet->getUint32Vector(olapprefix+"CNProc.phaseTwoPsets", true); - } - if (phaseTwoPsets.empty()) { - for (unsigned p = 0; p < nrPsets; p++) { - phaseTwoPsets.push_back(p); - } - } - - // by default, use all psets - vector<unsigned> phaseThreePsets; - if (aParSet->isDefined(olapprefix+"CNProc.phaseThreePsets")) { - phaseThreePsets = aParSet->getUint32Vector(olapprefix+"CNProc.phaseThreePsets", true); - } - if (phaseThreePsets.empty()) { - for (unsigned p = 0; p < nrPsets; p++) { - phaseThreePsets.push_back(p); - } - } - - // ========================================= - // Collapse CoherentStokes and IncoherentStokes nto Beamformed, as RTCP - // expects. - // ========================================= - // - bool flysEye = aParSet->getBool(olapprefix+"PencilInfo.flysEye", false); - - // Count #stations; HBA_DUAL core stations count twice - vector<string> stations = aParSet->getStringVector(prefix+"VirtualInstrument.stationList", true); - bool isHBAdual = aParSet->getString(prefix+"antennaSet").substr(0,8) == "HBA_DUAL"; - size_t nrStations = 0; - if (isHBAdual) { - for (size_t s = 0; s < stations.size(); ++s) { - if (stations[s].substr(0,2) == "CS") - nrStations += 2; - else - nrStations += 1; - } - } else { - nrStations = stations.size(); - } - - unsigned nrCoherentStokes = aParSet->getString(olapprefix+"CNProc_CoherentStokes.which", "").size(); - unsigned nrCoherentSubbandsPerFile = aParSet->getUint32(olapprefix+"CNProc_CoherentStokes.subbandsPerFile", 1024); - unsigned nrIncoherentStokes = aParSet->getString(olapprefix+"CNProc_IncoherentStokes.which", "").size(); - unsigned nrIncoherentSubbandsPerFile = aParSet->getUint32(olapprefix+"CNProc_IncoherentStokes.subbandsPerFile", 1024); - - // obtain file/location lists - vector<string> empty; - vector<string> bfFiles = aParSet->getStringVector(prefix+"DataProducts.Output_Beamformed.filenames", empty, true); - vector<string> bfLocations = aParSet->getStringVector(prefix+"DataProducts.Output_Beamformed.locations", empty, true); - vector<string> csFiles = aParSet->getStringVector(prefix+"DataProducts.Output_CoherentStokes.filenames", empty, true); - vector<string> csLocations = aParSet->getStringVector(prefix+"DataProducts.Output_CoherentStokes.locations", empty, true); - vector<string> isFiles = aParSet->getStringVector(prefix+"DataProducts.Output_IncoherentStokes.filenames", empty, true); - vector<string> isLocations = aParSet->getStringVector(prefix+"DataProducts.Output_IncoherentStokes.locations", empty, true); - - LOG_DEBUG_STR("nr bf files: " << bfFiles.size()); - LOG_DEBUG_STR("nr cs files: " << csFiles.size()); - LOG_DEBUG_STR("nr is files: " << isFiles.size()); - - // erase lists of not enabled outputs - if(!aParSet->getBool(prefix+"DataProducts.Output_Beamformed.enabled", false)) { - bfFiles.clear(); - bfLocations.clear(); - } - if(!aParSet->getBool(prefix+"DataProducts.Output_CoherentStokes.enabled", false)) { - csFiles.clear(); - csLocations.clear(); - } - if(!aParSet->getBool(prefix+"DataProducts.Output_IncoherentStokes.enabled", false)) { - isFiles.clear(); - isLocations.clear(); - } - - if (!csFiles.empty() || !isFiles.empty()) { - // ONLY Merge lists if not already done so (f.e. by RTCP/Run/LOFAR/Parset.py) - - // chose the right coherent stokes set - if(aParSet->getString(olapprefix+"CNProc_CoherentStokes.which", "") == "XXYY") { - csFiles = bfFiles; - csLocations = bfLocations; - } - - // erase the target list - bfFiles.clear(); - bfLocations.clear(); - - // set indices to scan the coherent and incoherent lists - size_t coherentIdx = 0; - size_t incoherentIdx = 0; - - // iterate over the beams and tied array beams to reconstruct the - // Beamformed lists. - if (csFiles.size() > 0 || isFiles.size() > 0 ) { - for (unsigned b = 0; b < beams.size(); ++b) { - Beam &beam = beams[b]; - - // skip duplicate beams in dual mode - if (beam.name.find("_1") != string::npos) - continue; - - size_t nrSubbands = beam.subbands.size(); - - // number of files we'll create per TAB - size_t nrCoherentFiles = (int)ceil(1.0 * nrSubbands / nrCoherentSubbandsPerFile) * nrCoherentStokes; - size_t nrIncoherentFiles = (int)ceil(1.0 * nrSubbands / nrIncoherentSubbandsPerFile) * nrIncoherentStokes; - - LOG_DEBUG_STR("beam " << b << " has " << nrCoherentFiles << " files/cs and " << nrIncoherentFiles << " files/is"); - - // process in defined order: 1. manual 2. rings 3. fly's eye - - // manual TABs - LOG_DEBUG_STR("beam " << b << " has " << beam.TABs.size() << " manual TABs"); - for (unsigned t = 0; t < beam.TABs.size(); ++t) { - TiedArrayBeam &tab = beam.TABs[t]; - - if (tab.coherent) { - for (unsigned f = 0; f < nrCoherentFiles; ++f) { - bfFiles.push_back(csFiles[coherentIdx]); - bfLocations.push_back(csLocations[coherentIdx]); - coherentIdx++; - } - } else { - for (unsigned f = 0; f < nrIncoherentFiles; ++f) { - bfFiles.push_back(isFiles[incoherentIdx]); - bfLocations.push_back(isLocations[incoherentIdx]); - incoherentIdx++; - } - } - - } - - // ring TABs - if (beam.nrTABrings > 0) { - // for (n-1) rings, we get 3n(n-1) + 1 tabs - size_t n = beam.nrTABrings + 1; - size_t nrRingTABs = 3 * n * (n-1) + 1; - - LOG_DEBUG_STR("beam " << b << " has " << nrRingTABs << " ring TABs"); - - for (unsigned t = 0; t < nrRingTABs; ++t) { - // ring TABs are always coherent - for (unsigned f = 0; f < nrCoherentFiles; ++f) { - bfFiles.push_back(csFiles[coherentIdx]); - bfLocations.push_back(csLocations[coherentIdx]); - coherentIdx++; - } - } - } - - // fly's eye - if (flysEye) { - LOG_DEBUG_STR("beam " << b << " has " << nrStations << " fly's eye TABs"); - for (unsigned t = 0; t < nrStations; ++t) { - // fly's eye TABs are always coherent - for (unsigned f = 0; f < nrCoherentFiles; ++f) { - bfFiles.push_back(csFiles[coherentIdx]); - bfLocations.push_back(csLocations[coherentIdx]); - coherentIdx++; - } - } - } - } - } - } - - std::map<unsigned, unsigned> filesPerIONode; - std::map<std::string, unsigned> filesPerStorage; - - for (size_t d = 0; d < nrDataProducts; d ++) { - // if beam formed (d==0), use calculated list - bool enabled = d == 0 ? bfFiles.size() > 0 : aParSet->getBool(prefix+str(format("DataProducts.Output_%s.enabled") % dataProductNames[d]), false); - - if (!enabled) - continue; - - // phase 2: files are ordered by beam, subband - // phase 3: files are ordered by beam, pencil, stokes, part - - // The .locations parset value contains the storage nodes which - // will store each file. - - // The I/O node will allocate the files in order depth-wise. - // That is, we determine the maximum number of files to output per - // pset, and then proceed to fill up the I/O nodes starting from - // the first pset. Each data product is treated individually. - - vector<string> filenames = d == 0 ? bfFiles : aParSet->getStringVector(prefix+str(format("DataProducts.Output_%s.filenames") % dataProductNames[d]), true); - vector<string> locations = d == 0 ? bfLocations : aParSet->getStringVector(prefix+str(format("DataProducts.Output_%s.locations") % dataProductNames[d]), true); - vector<unsigned> &psets = dataProductPhases[d] == 2 ? phaseTwoPsets : phaseThreePsets; - - ASSERTSTR(filenames.size() == locations.size(), "Parset provides " << filenames.size() << " filenames but only " << locations.size() << " locations."); - - unsigned numFiles = filenames.size(); - unsigned filesPerPset = (numFiles + psets.size() - 1) / psets.size(); - - for (size_t i = 0; i < filenames.size(); i++) { - StreamToStorage a; - - a.dataProduct = dataProductNames[d]; - a.dataProductNr = dataProductNrs[d]; - a.streamNr = i; - a.filename = filenames[i]; - a.sourcePset = psets[i / filesPerPset]; - - vector<string> locparts = StringUtil::split(locations[i],':'); - ASSERTSTR(locparts.size() == 2, "A DataProduct location must be of the format host:directory (but I found " << locations[i] << ")"); - - a.destStorageNode = locparts[0]; - a.destDirectory = locparts[1]; - - // use a static allocation for now, starting at 0 for each pset/locus node - a.adderNr = filesPerIONode[a.sourcePset]++; - a.writerNr = filesPerStorage[locparts[0]]++; - - streamsToStorage.push_back(a); - } // for filenames - } // for nrDataProducts - } -} - - -// -// ~Observation() -// -Observation::~Observation() -{ -} - -// -// conflicts (Observation& other) -// -// check if the given Observation conflicts with this one -bool Observation::conflicts(const Observation& other) const -{ - // if observations don't overlap they don't conflict per definition. - if ((other.stopTime <= startTime) || (other.startTime >= stopTime)) { - return (false); - } - - // Observation overlap, check clock - if (other.sampleClock != sampleClock) { - LOG_INFO_STR("Clock of observation " << obsID << " and " << other.obsID << " conflict"); - return (true); - } - - // Observation overlap, check bit mode - if (other.bitsPerSample != bitsPerSample) { - LOG_INFO_STR("Bit mode of observation " << obsID << " and " << other.obsID << " conflict"); - return (true); - } - - // Observation overlap, check splitters - if (other.splitterOn != splitterOn) { - LOG_INFO_STR("Splitters of observation " << obsID << " and " << other.obsID << " conflict"); - return (true); - } - - // if rcumode differs there may be no overlap in receivers. - if (other.filter != filter) { - RCUset_t resultSet(RCUset & other.RCUset); - if (resultSet.any()) { - LOG_INFO_STR("Conflicting use of receivers between observation " << obsID << - " and " << other.obsID); - LOG_DEBUG_STR("receiverConflict: " << resultSet); - return (true); - } - } - - // for now also check nr of slots in frame. In the future we might allow - // different slotsinFrame for each RSPboard but for now we treat it as a conflict. - if (nrSlotsInFrame != other.nrSlotsInFrame) { - LOG_INFO_STR("Conflict in nrSlotsInFrame: " << nrSlotsInFrame << "<->" << - other.nrSlotsInFrame << " for resp. observation " << obsID << - " and " << other.obsID); - return (true); - } - - // check beamlets overlap - vector<int> thisb2b = getBeamAllocation(); - vector<int> thatb2b = other.getBeamAllocation(); - int maxBeamlets = thisb2b.size(); - for (int bl = 0; bl < maxBeamlets; bl++) { - if (thisb2b[bl] != -1 && thatb2b[bl] != -1 && thisb2b[bl] != 999) { - LOG_INFO_STR("Conflict in beamlets between observation " << obsID << - " and " << other.obsID); - LOG_DEBUG_STR("First conflicting beamlet: " << bl); - return (true); - } - } - - return (false); // no conflicts -} - -// -// getRCUbitset(nrLBAs, nrHBAs, antennaSet): bitset -// -// Returns a bitset containing the RCU's requested by the observation. -// The can be te list specified in the receiverList or (when empty) just some -// standin dummmy purely based on the number of antennas. -// -bitset<MAX_RCUS> Observation::getRCUbitset(int nrLBAs, int nrHBAs, const string& anAntennaSet) -{ - // user defined set always overrules. - if (RCUset.any()) { - return (RCUset); - } - - // HBA's in Core stations sometimes use half of the rcus. - int nrRCUS = 2 * ((anAntennaSet.find("LBA") == 0) ? nrLBAs : nrHBAs); - - // Set up the RCUbits for this antennaSet. Remember that we don't care here which of the three inputs is used. - RCUset_t tmpRCUset(RCUset); - for (int rcu = 0; rcu < nrRCUS; rcu++) { // check all bits - tmpRCUset.set(rcu); - } - return (tmpRCUset); -} - -// -// getBeamAllocation(stationname) -// -// Return station specific beamlet2beam vector. -// -vector<int> Observation::getBeamAllocation(const string& stationName) const -{ - vector<int> b2b; - - // construct stationname if not given by user. - string station(stationName); - if (station.empty()) { - station = myHostname(false); - char lastChar(*(--(station.end()))); - if (lastChar == 'C' || lastChar == 'T') { - station.erase(station.length()-1, 1); // station.pop_back(); - } - } - if (!_isStationName(station)) { // called on a non-station machine? - return (b2b); // return an empty vector - } - - if (!itsHasDataslots) { - return (beamlet2beams); // return old mapping so it keeps working - } - - // is DSL for this station available? - string fieldName = getAntennaFieldName(itsStnHasDualHBA); - vector<int> RSPboardList; - vector<int> DataslotList; - - getDataSlotMapping(station, fieldName, RSPboardList, DataslotList); - - // initialize arrays - b2b = itsSlotTemplate; - - // fill with required information - for (int i = itsBeamSlotList.size()-1; i >= 0; --i) { - int idx = RSPboardList[i] * maxBeamletsPerRSP(bitsPerSample) + DataslotList[i]; - if (b2b[idx] != -1) { - THROW (Exception, "beamlet " << i << " of beam " << itsBeamSlotList[i] << " clashes with beamlet of other beam(" << b2b[idx] << ")"); - } - else { - b2b[idx] = itsBeamSlotList[i]; - } - } - - return (b2b); -} - -void Observation::getDataSlotMapping( const string &station, const string &fieldName, vector<int> &boards, vector<int> &slots ) const { - string dsl(str(format("%s%s.DataslotList") % station % fieldName)); - string rbl(str(format("%s%s.RSPBoardList") % station % fieldName)); - - vector<int> empty; - boards = itsDataslotParset.getIntVector(rbl,empty,true); - slots = itsDataslotParset.getIntVector(dsl,empty,true); - - if (boards.empty() || slots.empty()) { - // use default identity mapping if none specified - boards.clear(); - slots.clear(); - - for (size_t i = 0; i < itsBeamSlotList.size(); i++) { - boards.push_back(static_cast<int>(i / maxBeamletsPerRSP(bitsPerSample))); - slots.push_back(static_cast<int>(i % maxBeamletsPerRSP(bitsPerSample))); - } - } - - ASSERTSTR (boards.size() == slots.size(), "RSPBoardlist (" << boards << - ") differs size of DataslotList(" << slots << ") for station " << station); - ASSERTSTR (boards.size() == itsBeamSlotList.size(), boards.size() << - " dataslot allocations, but beams specify " << itsBeamSlotList.size() << " for station " << station); -} - -// -// getBeamlets(beamNr, [stationName]) -// -vector<int> Observation::getBeamlets (uint beamIdx, const string& stationName) const -{ - uint parsetIdx = (dualMode && itsStnHasDualHBA) ? beamIdx/2 : beamIdx; - string fieldName = getAntennaFieldName(itsStnHasDualHBA, beamIdx); - - // construct stationname if not given by user. - string station(stationName); - if (station.empty()) { - station = myHostname(false); - char lastChar(*(--(station.end()))); - if (lastChar == 'C' || lastChar == 'T') { - station.erase(station.length()-1, 1); // station.pop_back(); - } - } - - vector<int> result; - if (!_isStationName(station)) { // called on a non-station machine? - return (result); // return an empty vector - } - - if (!itsHasDataslots) { - // both fields use the same beamlet mapping - return (itsDataslotParset.getInt32Vector(str(format("Beam[%d].beamletList") % parsetIdx), vector<int32>(), true)); // true:expandable - } - -// is DSL for this station available? - // both fields have their own beamlet mapping - - vector<int> RSPboardList; - vector<int> DataslotList; - - getDataSlotMapping(station, fieldName, RSPboardList, DataslotList); - - uint nrEntries = itsBeamSlotList.size(); - for (uint i = 0; i < nrEntries; ++i) { - if (itsBeamSlotList[i] == parsetIdx) { - result.push_back(RSPboardList[i] * maxBeamletsPerRSP(bitsPerSample) + DataslotList[i]); - } - } - return (result); -} - - -// -// TEMP HACK TO GET THE ANTENNAFIELDNAME -// -// Except for the beamIdx dependancy we should look in the antennaSet file. -// -string Observation::getAntennaFieldName(bool hasSplitters, uint32 beamIdx) const -{ - string result; - if (antennaSet.empty()) { - result = antennaArray; - } - else { - result = antennaSet; - } - - if (result.find("LBA") == 0) { - return ("LBA"); - } - - if (!hasSplitters) { // no splitter, always use all HBA - return ("HBA"); - } - - // station has splitters - if (result.substr(0,8) == "HBA_ZERO") return ("HBA0"); - if (result.substr(0,7) == "HBA_ONE") return ("HBA1"); - if (result.substr(0,10)== "HBA_JOINED") return ("HBA"); - if (result.substr(0,8) == "HBA_DUAL") return (beamIdx % 2 == 0 ? "HBA0" : "HBA1"); - return ("HBA"); -} - -// -// getBeamName(beamidx): string -// -string Observation::getBeamName(uint32 beamIdx) const -{ - return (formatString("observation[%d]beam[%d]", obsID, beamIdx)); -} -// there can only be one analogue beam -string Observation::getAnaBeamName() const -{ - return (formatString("observation[%d]anabeam", obsID)); -} - - -// -// _isStationName(name) -// -bool Observation::_isStationName(const string& hostname) const -{ - // allow AA999, AA999C and AA999T - if (hostname.length() != 5 && hostname.length() != 6) - return (false); - - // We make a rough guess about the vality of the hostname. - // If we want to check more secure we have to implement all allowed stationnames - return (isalpha(hostname[0]) && isalpha(hostname[1]) && - isdigit(hostname[2]) && isdigit(hostname[3]) && isdigit(hostname[4])); -} - -// -// _hasDataSlots -// -bool Observation::_hasDataSlots(const ParameterSet* aPS) const -{ - return true; // JD RT HACK: We supply default mappings if the dataslots arent found after all - - ParameterSet::const_iterator iter = aPS->begin(); - ParameterSet::const_iterator end = aPS->end(); - while (iter != end) { - string::size_type pos(iter->first.find("Dataslots.")); - // if begin found, what is after it? - if (pos != string::npos && iter->first.find("Dataslots.DataslotInfo.") == string::npos) { - return _isStationName((iter->first.substr(pos+10,5))); - } - iter++; // try next line - } - - return (false); -} - -// -// nyquistzoneFromFilter(filtername) -// -uint32 Observation::nyquistzoneFromFilter(const string& filterName) -{ - // support of old names - if (filterName == "LBL_10_80") { return(1); } - if (filterName == "LBL_30_80") { return(1); } - if (filterName == "LBH_10_80") { return(1); } - if (filterName == "LBH_30_80") { return(1); } - if (filterName == "HB_100_190") { return(2); } - if (filterName == "HB_170_230") { return(3); } - if (filterName == "HB_210_240") { return(3); } - if (filterName == "LBA_30_80") { return(1); } - - // support of new names - if (filterName == "LBA_10_70") { return(1); } - if (filterName == "LBA_30_70") { return(1); } - if (filterName == "LBA_10_90") { return(1); } - if (filterName == "LBA_30_90") { return(1); } - if (filterName == "HBA_110_190") { return(2); } - if (filterName == "HBA_170_230") { return(3); } - if (filterName == "HBA_210_250") { return(3); } - - LOG_ERROR_STR ("filterselection value '" << filterName << - "' not recognized, using LBA_10_90"); - return (1); -} - -// -// print (os) -// -ostream& Observation::print (ostream& os) const -{ - os << endl; - os << "Observation : " << name << endl; - os << "ObsID : " << obsID << endl; - os << "starttime : " << to_simple_string(from_time_t(startTime)) << endl; - os << "stoptime : " << to_simple_string(from_time_t(stopTime)) << endl; - os << "stations : " << stations << endl; -// os << "stations : "; writeVector(os, stations, ",", "[", "]"); os << endl; - os << "antennaArray : " << antennaArray << endl; - os << "antenna set : " << antennaSet << endl; - os << "receiver set : " << RCUset << endl; - os << "sampleClock : " << sampleClock << endl; - os << "bits/sample : " << bitsPerSample << endl; - os << "filter : " << filter << endl; - os << "splitter : " << (splitterOn ? "ON" : "OFF") << endl; - os << "nyquistZone : " << nyquistZone << endl << endl; - - os << "(Receivers) : " << receiverList << endl; - os << "Stations : " << stationList << endl; - os << "BLG nodes : " << BGLNodeList << endl; - os << "Storage nodes: " << storageNodeList << endl << endl; - - os << "nrBeams : " << beams.size() << endl; - for (size_t b(0) ; b < beams.size(); b++) { - os << "Beam[" << b << "].name : " << beams[b].name << endl; - os << "Beam[" << b << "].target : " << beams[b].target << endl; - os << "Beam[" << b << "].antennaSet : " << beams[b].antennaSet << endl; - os << "Beam[" << b << "].momID : " << beams[b].momID << endl; - os << "Beam[" << b << "].subbandList: "; writeVector(os, beams[b].subbands, ",", "[", "]"); os << endl; - os << "Beam[" << b << "].beamletList: "; writeVector(os, getBeamlets(b), ",", "[", "]"); os << endl; - os << "nrPointings : " << beams[b].pointings.size() << endl; - for (size_t p = 0; p < beams[b].pointings.size(); ++p) { - const Pointing* pt = &(beams[b].pointings[p]); - os << formatString("Beam[%d].pointing[%d]: %f, %f, %s, %s\n", b, p, pt->angle1, pt->angle2, - pt->directionType.c_str(), to_simple_string(from_time_t(pt->startTime)).c_str()); - } - os << "nrTABs : " << beams[b].nrTABs << endl; - os << "nrTABrings : " << beams[b].nrTABrings << endl; - os << "TABringsize : " << beams[b].TABringSize << endl; - for (int t = 0; t < beams[b].nrTABs; ++t) { - const TiedArrayBeam* tab = &(beams[b].TABs[t]); - os << formatString ("Beam[%d].TAB[%d]: %f, %f, %s, %f, %scoherent\n", b, t, tab->angle1, tab->angle2, tab->directionType.c_str(), tab->dispersionMeasure, (tab->coherent ? "" : "in")); - } - } - os << "beamlet2beams : "; writeVector(os, getBeamAllocation(), ",", "[", "]"); os << endl; - - os << "nrAnaBeams : " << anaBeams.size() << endl; - for (size_t b(0) ; b < anaBeams.size(); b++) { - os << "AnaBeam[" << b << "].name : " << anaBeams[b].name << endl; - os << "AnaBeam[" << b << "].antennaSet: " << anaBeams[b].antennaSet << endl; - os << "AnaBeam[" << b << "].rank : " << anaBeams[b].rank << endl; - os << "nrPointings : " << anaBeams[b].pointings.size() << endl; - for (uint p = 0; p < beams[b].pointings.size(); ++p) { - const Pointing* pt = &(anaBeams[b].pointings[p]); - os << formatString("anaBeam[%d].pointing[%d]: %f, %f, %s\n", b, p, pt->angle1, pt->angle2, pt->directionType.c_str()); - } - } - - os << "nrStreamsToStorage: " << streamsToStorage.size() << endl; - for (size_t s(0) ; s < streamsToStorage.size(); s++) { - const StreamToStorage &str = streamsToStorage[s]; - - os << "streamsToStorage[" << s << "].dataProduct: " << str.dataProduct << endl; - os << "streamsToStorage[" << s << "].dataProductNr: " << str.dataProductNr << endl; - os << "streamsToStorage[" << s << "].streamNr: " << str.streamNr << endl; - os << "streamsToStorage[" << s << "].filename: " << str.filename << endl; - os << "streamsToStorage[" << s << "].sourcePset: " << str.sourcePset << endl; - os << "streamsToStorage[" << s << "].destStorageNode: " << str.destStorageNode << endl; - os << "streamsToStorage[" << s << "].destDirectory: " << str.destDirectory << endl; - os << "streamsToStorage[" << s << "].adderNr: " << str.adderNr << endl; - os << "streamsToStorage[" << s << "].writerNr: " << str.writerNr << endl; - } - - return (os); -} - - -} // namespace LOFAR diff --git a/dependencies/ApplCommon/src/StationDatatypes.cc b/dependencies/ApplCommon/src/StationDatatypes.cc deleted file mode 100644 index bea909f7176ef0e09cb0a5d825db7e2e3b33d621..0000000000000000000000000000000000000000 --- a/dependencies/ApplCommon/src/StationDatatypes.cc +++ /dev/null @@ -1,62 +0,0 @@ -//# StationDatatypes.cc: Several 'deployment' related functions -//# -//# Copyright (C) 2006 -//# ASTRON (Netherlands Institute for Radio Astronomy) -//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands -//# -//# This file is part of the LOFAR software suite. -//# The LOFAR software suite 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 3 of the License, or -//# (at your option) any later version. -//# -//# The LOFAR software suite 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 the LOFAR software suite. If not, see <http://www.gnu.org/licenses/>. -//# -//# $Id: StationDatatypes.cc 15652 2010-05-10 14:56:33Z loose $ - -//# Always #include <lofar_config.h> first! -#include <lofar_config.h> - -#include <ApplCommon/StationDatatypes.h> - -namespace LOFAR { - -// Antenna2RCUmask(antennaMask) -// Returns the corresponding RCUmask -RCUmask_t Antenna2RCUmask(const AntennaMask_t& am) -{ - RCUmask_t rm; - - for (int i = 0; i < MAX_ANTENNAS; ++i) { - if (am[i]) { - rm.set(2*i); - rm.set(2*i+1); - } - } - return (rm); -} - - -// RCU2AntennaMask(RCUmask) -// Returns the corresponding AntennaMask -AntennaMask_t RCU2AntennaMask(const RCUmask_t& rm) -{ - AntennaMask_t am; - - for (int i = 0; i < MAX_RCUS; i+=2) { - if (rm[i] || rm[i+1]) { - am.set(i/2); - } - } - - return (am); -} - - -} // namespace LOFAR diff --git a/dependencies/ApplCommon/src/StationInfo.cc b/dependencies/ApplCommon/src/StationInfo.cc index bcc93a192970a93005dd0eb4af012d609ad6beac..a0cb30c919e7a0d94c70a56236a09a284d4e3d48 100644 --- a/dependencies/ApplCommon/src/StationInfo.cc +++ b/dependencies/ApplCommon/src/StationInfo.cc @@ -23,7 +23,6 @@ //# Always #include <lofar_config.h> first! #include <lofar_config.h> -#include <Common/lofar_string.h> #include <Common/LofarTypes.h> #include <Common/ParameterSet.h> // indexValue #include <Common/StringUtil.h> @@ -37,7 +36,10 @@ # include <boost/regex.hpp> #endif +#include <string> + using namespace boost; +using std::string; namespace LOFAR { diff --git a/dependencies/ApplCommon/test/CMakeLists.txt b/dependencies/ApplCommon/test/CMakeLists.txt index d2f57bccdcf4adee3d662fc047f1bdad3b7962c5..2dc631ba27bf57f24737837798fee655a2cb1769 100644 --- a/dependencies/ApplCommon/test/CMakeLists.txt +++ b/dependencies/ApplCommon/test/CMakeLists.txt @@ -4,6 +4,4 @@ include(LofarCTest) lofar_add_test(tAntField tAntField.cc) lofar_add_test(tAntennaSet tAntennaSet.cc) -lofar_add_test(tObservation tObservation.cc) -lofar_add_executable(tHasDataslots tHasDataslots.cc) lofar_add_executable(tStationInfo tStationInfo.cc) diff --git a/dependencies/ApplCommon/test/tHasDataslots.cc b/dependencies/ApplCommon/test/tHasDataslots.cc deleted file mode 100644 index a16d066f8c8ba0987150aeadbb17565c6004f0e5..0000000000000000000000000000000000000000 --- a/dependencies/ApplCommon/test/tHasDataslots.cc +++ /dev/null @@ -1,86 +0,0 @@ -//# tHasDataslots.cc -//# -//# Copyright (C) 2012 -//# ASTRON (Netherlands Institute for Radio Astronomy) -//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands -//# -//# This file is part of the LOFAR software suite. -//# The LOFAR software suite 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 3 of the License, or -//# (at your option) any later version. -//# -//# The LOFAR software suite 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 the LOFAR software suite. If not, see <http://www.gnu.org/licenses/>. -//# -//# $Id: tObservation.cc 20220 2012-02-23 15:12:05Z overeem $ - -//# Always #include <lofar_config.h> first! -#include <lofar_config.h> - -//# Includes -#include <Common/LofarLogger.h> -#include <Common/ParameterSet.h> -#include <ApplCommon/Observation.h> - -using namespace LOFAR; - -// -// _isStationName(name) -// -bool _isStationName(const string& hostname) -{ -cout << hostname << endl; - // allow AA999, AA999C and AA999T - if (hostname.length() != 5 && hostname.length() != 6) - return (false); - - // We make a rough guess about the vality of the hostname. - // If we want to check more secure we have to implement all allowed stationnames - return (isalpha(hostname[0]) && isalpha(hostname[1]) && - isdigit(hostname[2]) && isdigit(hostname[3]) && isdigit(hostname[4])); -} - -// -// _hasDataSlots -// -bool _hasDataSlots(const ParameterSet* aPS) -{ - ParameterSet::const_iterator iter = aPS->begin(); - ParameterSet::const_iterator end = aPS->end(); - while (iter != end) { - string::size_type pos(iter->first.find("Dataslots.")); - // if begin found, what is after it? - if (pos != string::npos && iter->first.find("Dataslots.DataslotInfo.") == string::npos) { -cout << iter->first << endl; - return _isStationName((iter->first.substr(pos+10,5))); - } - iter++; // try next line - } - - return (false); -} - -int main (int argc, char* argv[]) -{ - INIT_LOGGER(argv[0]); - if (argc != 2) { - cerr << "Syntax: " << argv[0] << " parameterset" << endl; - return (1); - } - - try { - ParameterSet userPS(argv[1]); - cout << (_hasDataSlots(&userPS) ? "YES" : "NO") << endl; - } - catch (Exception& e) { - cout << "Exception: " << e.what() << endl; - return 1; - } - return 0; -} diff --git a/dependencies/ApplCommon/test/tObservation.cc b/dependencies/ApplCommon/test/tObservation.cc deleted file mode 100644 index 3b6041e177b5f5e565f1468eabf4fdee55668a72..0000000000000000000000000000000000000000 --- a/dependencies/ApplCommon/test/tObservation.cc +++ /dev/null @@ -1,198 +0,0 @@ -//# tObservation.cc -//# -//# Copyright (C) 2002-2004 -//# ASTRON (Netherlands Institute for Radio Astronomy) -//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands -//# -//# This file is part of the LOFAR software suite. -//# The LOFAR software suite 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 3 of the License, or -//# (at your option) any later version. -//# -//# The LOFAR software suite 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 the LOFAR software suite. If not, see <http://www.gnu.org/licenses/>. -//# -//# $Id$ - -//# Always #include <lofar_config.h> first! -#include <lofar_config.h> - -//# Includes -#include <Common/LofarLogger.h> -#include <Common/ParameterSet.h> -#include <Common/StreamUtil.h> -#include <ApplCommon/Observation.h> - -using namespace LOFAR; - -void showSTS(Observation::StreamToStorage sts) -{ - cout << formatString("DP[%d]:%s, Str[%d]:%s, Pset:%d, Node:%s, Dir: %s, Adder:%d, writer:%d\n", sts.dataProductNr, sts.dataProduct.c_str(), sts.streamNr, sts.filename.c_str(), sts.sourcePset, sts.destStorageNode.c_str(), sts.destDirectory.c_str(), sts.adderNr, sts.writerNr); -} - -int main (int argc, char* argv[]) -{ - INIT_LOGGER(argv[0]); - try { - if (argc == 2) { - ParameterSet userPS(argv[1]); - Observation someObs(&userPS, true); - cout << someObs; - cout << "getRCUbitset(96,48,'') = " << someObs.getRCUbitset(96,48,"") << endl; // Europe - cout << "getRCUbitset(96,96,'') = " << someObs.getRCUbitset(96,96,"") << endl; // Europe - cout << "getRCUbitset(96,48,LBA_XXX) = " << someObs.getRCUbitset(96,48,"LBA_XXX") << endl; // Core - cout << "getRCUbitset(96,96,LBA_XXX) = " << someObs.getRCUbitset(96,96,"LBA_XXX") << endl; // Core - cout << "getRCUbitset(96,48,HBA_XXX) = " << someObs.getRCUbitset(96,48,"HBA_XXX") << endl; // Core - cout << "getRCUbitset(96,96,HBA_XXX) = " << someObs.getRCUbitset(96,96,"HBA_XXX") << endl; // Core - vector<int> b2b = someObs.getBeamAllocation("CS002"); - cout << "BeamAlloc for CS002 : " << b2b << endl; - int nrStreams = someObs.streamsToStorage.size(); - for (int i = 0; i < nrStreams; i++) { - showSTS(someObs.streamsToStorage[i]); - } - return (0); - } - - cout << ">>>" << endl; // off - cout << "### READING AND SHOWING TWO PARSETS ###" << endl; - ParameterSet parSet2("tObservation.in_parset2"); - Observation dualObs(&parSet2, false); - cout << dualObs << endl; - - ParameterSet parSet1("tObservation.in_parset1"); - Observation obs1(&parSet1, false); - cout << obs1 << endl; - cout << "<<<" << endl; // on - - // add an extra beam - cout << "### ADDING AN EXTRA BEAM ###" << endl; - parSet1.replace("ObsSW.Observation.nrBeams", "2"); - parSet1.add("ObsSW.Observation.Beam[1].angle1", "0.23456789"); - parSet1.add("ObsSW.Observation.Beam[1].angle2", "0.123456789"); - parSet1.add("ObsSW.Observation.Beam[1].directionType", "AZEL"); - parSet1.add("ObsSW.Observation.Beam[1].subbandList", "[4,3,102]"); - parSet1.add("ObsSW.Observation.Beam[1].beamletList", "[15,16,18]"); - Observation obs2(&parSet1, false); - cout << obs2 << endl; - - // test storage node assignment - cout << "### ADDING NODE ASSIGNMENT ###" << endl; - parSet1.add("ObsSW.OLAP.CNProc.phaseOnePsets", "[]"); - parSet1.add("ObsSW.OLAP.CNProc.phaseTwoPsets", "[]"); - parSet1.add("ObsSW.OLAP.CNProc.phaseThreePsets", "[]"); - parSet1.add("ObsSW.Observation.DataProducts.Output_CoherentStokes.enabled", "true"); - parSet1.add("ObsSW.Observation.DataProducts.Output_CoherentStokes.filenames", "[beam0.h5,beam1.h5]"); - parSet1.add("ObsSW.Observation.DataProducts.Output_CoherentStokes.locations", "[/,/]"); - try { - Observation obs4(&parSet1, false); - cerr << "Expected a exception because 'locations' where specified wrong" << endl; - return (1); - } - catch (Exception& e) { - cout << "Exception on wrong specified locations works OK" << endl; - } - parSet1.replace("ObsSW.Observation.DataProducts.Output_CoherentStokes.locations", "[a:b,c:d]"); - - cout << ">>>" << endl; // off - cout << "### TESTING CONFLICT ROUTINE ###" << endl; - // test conflicts in clock - ParameterSet conflictPS1("tObservation.in_conflict1"); - Observation conflictObs1(&conflictPS1, false); - ASSERTSTR(obs2.conflicts(conflictObs1), "File 1 should have had a clock conflict"); - - // test conflicts in receivers - ParameterSet conflictPS2("tObservation.in_conflict2"); - Observation conflictObs2(&conflictPS2, false); - ASSERTSTR(obs2.conflicts(conflictObs2), "File 2 should have had a receiver conflict"); - - // test conflicts in beamlets -// ParameterSet conflictPS3("tObservation.in_conflict3"); -// Observation conflictObs3(&conflictPS3, false); -// ASSERTSTR(obs2.conflicts(conflictObs3), "File 3 should have had a beamlet conflict"); - - // test conflicts in nrSlotsPerFrame - ParameterSet conflictPS4("tObservation.in_conflict4"); - Observation conflictObs4(&conflictPS4, false); - ASSERTSTR(obs2.conflicts(conflictObs4), "File 4 should have had a nrSlotInFrame conflict"); - - // everything conflict except the time - ParameterSet conflictPS5("tObservation.in_conflict5"); - Observation conflictObs5(&conflictPS5, false); - ASSERTSTR(!obs2.conflicts(conflictObs5), "File 5 should NOT have had a conflict"); - cout << "No conflict found in file 5 which is oke." << endl; - - // test conflicts in bit mode - ParameterSet conflictPS6("tObservation.in_conflict6"); - Observation conflictObs6(&conflictPS6, false); - ASSERTSTR(obs2.conflicts(conflictObs6), "File 6 should have had a bit mode conflict"); - - cout << "<<<" << endl; // on - - // basic test on RCU bitsets - cout << "### SHOWING RCU BITSETS FOR ALL STATIONTYPES ###" << endl; - Observation obs3(&parSet1, false); - cout << "getRCUbitset(96,48,'') = " << obs3.getRCUbitset(96,48,"") << endl; // Europe - cout << "getRCUbitset(96,96,'') = " << obs3.getRCUbitset(96,96,"") << endl; // Europe - cout << "getRCUbitset(96,48,LBA_XXX) = " << obs3.getRCUbitset(96,48,"LBA_XXX") << endl; // Core - cout << "getRCUbitset(96,96,LBA_XXX) = " << obs3.getRCUbitset(96,96,"LBA_XXX") << endl; // Core - cout << "getRCUbitset(96,48,HBA_XXX) = " << obs3.getRCUbitset(96,48,"HBA_XXX") << endl; // Core - cout << "getRCUbitset(96,96,HBA_XXX) = " << obs3.getRCUbitset(96,96,"HBA_XXX") << endl; // Core - - // test translation of antennaSetname - obs3.antennaSet = "HBA_ZERO"; - cout << "HBA_ZERO(false) = " << obs3.getAntennaFieldName(false) << endl; - cout << "HBA_ZERO(true) = " << obs3.getAntennaFieldName(true) << endl; - obs3.antennaSet = "HBA_ONE"; - cout << "HBA_ONE(false) = " << obs3.getAntennaFieldName(false) << endl; - cout << "HBA_ONE(true) = " << obs3.getAntennaFieldName(true) << endl; - obs3.antennaSet = "HBA_DUAL"; - cout << "HBA_DUAL(false) = " << obs3.getAntennaFieldName(false) << endl; - cout << "HBA_DUAL(true) = " << obs3.getAntennaFieldName(true) << endl; - obs3.antennaSet = "HBA_JOINED"; - cout << "HBA_JOINED(false) = " << obs3.getAntennaFieldName(false) << endl; - cout << "HBA_JOINED(true) = " << obs3.getAntennaFieldName(true) << endl; - - obs3.antennaSet = "LBA_INNER"; - cout << "LBA_INNER(false) = " << obs3.getAntennaFieldName(false) << endl; - cout << "LBA_INNER(true) = " << obs3.getAntennaFieldName(true) << endl; - obs3.antennaSet = "LBA_OUTER"; - cout << "LBA_OUTER(false) = " << obs3.getAntennaFieldName(false) << endl; - cout << "LBA_OUTER(true) = " << obs3.getAntennaFieldName(true) << endl; - obs3.antennaSet = "LBA_X"; - cout << "LBA_X(false) = " << obs3.getAntennaFieldName(false) << endl; - cout << "LBA_X(true) = " << obs3.getAntennaFieldName(true) << endl; - - // test old syntax agains new syntax - cout << ">>>" << endl; // off - cout << "### SHOW DIFFERENT BETWEEN OLD AND NEW DATASLOT SYNTAX ###" << endl; - ParameterSet oldParset("tObservation.in_oldParset"); - Observation oldObs(&oldParset,true); - cout << "OLD SYNTAX" << endl; - cout << oldObs << endl; - - ParameterSet newParset("tObservation.in_newParset"); - Observation newObs(&newParset,true); - cout << "NEW SYNTAX" << endl; - cout << newObs << endl; - cout << "<<<" << endl; // on - - // These observations bugged before: - ParameterSet p103821("tObservation.in_parset_obs103821"); - Observation o103821(&p103821,true); - cout << "OBS 103821" << endl; - cout << o103821 << endl; - cout << "<<<" << endl; - - } - catch (Exception& e) { - cout << "Exception: " << e.what() << endl; - return 1; - } - return 0; -} diff --git a/dependencies/ApplCommon/test/tObservation.in_conflict1 b/dependencies/ApplCommon/test/tObservation.in_conflict1 deleted file mode 100644 index 07ae577f6dae074d562127748defb1f0c28f5759..0000000000000000000000000000000000000000 --- a/dependencies/ApplCommon/test/tObservation.in_conflict1 +++ /dev/null @@ -1,60 +0,0 @@ -# Clock is different, while time overlaps on all sides. -OLAP.nrBitsPerSample=16 -Clock160.channelWidth=610.3515625 -Clock160.samplesPerSecond=155648 -Clock160.subbandWidth=156.250 -Clock160.systemClock=160 -Clock200.channelWidth=762.939453125 -Clock200.samplesPerSecond=196608 -Clock200.subbandWidth=195.3125 -Clock200.systemClock=200 -ObsSW.Observation.Beam[0].angle1=6 -ObsSW.Observation.Beam[0].angle2=0.5 -ObsSW.Observation.Beam[0].directionType=J2000 -ObsSW.Observation.Beam[0].startTime= -ObsSW.Observation.Beam[0].duration=0 -ObsSW.Observation.Beam[0].beamletList=[0..3] -ObsSW.Observation.Beam[0].subbandList=[2..5] -ObsSW.Observation.MSNameMask=/data/L${YEAR}_${MSNUMBER}/SB${SUBBAND}.MS -ObsSW.Observation.ObsCtrl.StationCtrl._hostname=[CS016] -ObsSW.Observation.ObsCtrl._hostname=MCU001 -ObsSW.Observation.ObsCtrl.heartbeatInterval=10 -ObsSW.Observation.TBB.TBBsetting.C0=0 -ObsSW.Observation.TBB.TBBsetting.C1=0 -ObsSW.Observation.TBB.TBBsetting.C2=0 -ObsSW.Observation.TBB.TBBsetting.C3=0 -ObsSW.Observation.TBB.TBBsetting.RCUs=[] -ObsSW.Observation.TBB.TBBsetting.baselevel=2048 -ObsSW.Observation.TBB.TBBsetting.filter=128 -ObsSW.Observation.TBB.TBBsetting.operatingMode=1 -ObsSW.Observation.TBB.TBBsetting.startlevel=7 -ObsSW.Observation.TBB.TBBsetting.stoplevel=7 -ObsSW.Observation.TBB.TBBsetting.window=1K -ObsSW.Observation.VirtualInstrument.BGLNodeList=[bgl001,bgl002,bgl003] -ObsSW.Observation.VirtualInstrument.imageNodeList=[lioff005,lioff002,lioff003] -ObsSW.Observation.VirtualInstrument.partitionList=[R001_128_0,R001_128_1,R001_128_2,R001_128_3] -ObsSW.Observation.VirtualInstrument.stationList=[CS016,CS017,CS018] -ObsSW.Observation.VirtualInstrument.storageCapacity=760 -ObsSW.Observation.VirtualInstrument.storageNodeList=[list001,list002] -ObsSW.Observation.antennaArray= -ObsSW.Observation.antennaSet=HBA_JOINED -ObsSW.Observation.bandFilter=HB_210_240 -ObsSW.Observation.channelWidth=762.939453125 -ObsSW.Observation.channelsPerSubband=256 -ObsSW.Observation.claimPeriod=120 -ObsSW.Observation.clockMode=<<Clock200 -ObsSW.Observation.longBaselines=No -ObsSW.Observation.nrBeamformers=0 -ObsSW.Observation.nrBeams=1 -ObsSW.Observation.nrPolarisations=2 -ObsSW.Observation.nrSlotsInFrame=48 -ObsSW.Observation.preparePeriod=120 -ObsSW.Observation.receiverList=[0..11] -ObsSW.Observation.sampleClock=200 -ObsSW.Observation.samplesPerSecond=196608 -ObsSW.Observation.startTime=2008-Dec-16 15:20:00 -ObsSW.Observation.stopTime=2008-Dec-16 15:40:00 -ObsSW.Observation.subbandWidth=195.3125 -_DPname=LOFAR_ObsSW_TempObs0016 -_treeID=5026 -prefix=LOFAR. diff --git a/dependencies/ApplCommon/test/tObservation.in_conflict2 b/dependencies/ApplCommon/test/tObservation.in_conflict2 deleted file mode 100644 index 3f8da0d76dc87327f87581f67d3f29a9f9a98858..0000000000000000000000000000000000000000 --- a/dependencies/ApplCommon/test/tObservation.in_conflict2 +++ /dev/null @@ -1,59 +0,0 @@ -# Receivers conflict because time overlap and other rcumode -OLAP.nrBitsPerSample=16 -Clock160.channelWidth=610.3515625 -Clock160.samplesPerSecond=155648 -Clock160.subbandWidth=156.250 -Clock160.systemClock=160 -Clock200.channelWidth=762.939453125 -Clock200.samplesPerSecond=196608 -Clock200.subbandWidth=195.3125 -Clock200.systemClock=200 -ObsSW.Observation.Beam[0].angle1=6 -ObsSW.Observation.Beam[0].angle2=0.5 -ObsSW.Observation.Beam[0].angleTimes=0 -ObsSW.Observation.Beam[0].beamletList=[0..3] -ObsSW.Observation.Beam[0].directionType=J2000 -ObsSW.Observation.Beam[0].subbandList=[2..5] -ObsSW.Observation.MSNameMask=/data/L${YEAR}_${MSNUMBER}/SB${SUBBAND}.MS -ObsSW.Observation.ObsCtrl.StationCtrl._hostname=[CS016] -ObsSW.Observation.ObsCtrl._hostname=MCU001 -ObsSW.Observation.ObsCtrl.heartbeatInterval=10 -ObsSW.Observation.TBB.TBBsetting.C0=0 -ObsSW.Observation.TBB.TBBsetting.C1=0 -ObsSW.Observation.TBB.TBBsetting.C2=0 -ObsSW.Observation.TBB.TBBsetting.C3=0 -ObsSW.Observation.TBB.TBBsetting.RCUs=[] -ObsSW.Observation.TBB.TBBsetting.baselevel=2048 -ObsSW.Observation.TBB.TBBsetting.filter=128 -ObsSW.Observation.TBB.TBBsetting.operatingMode=1 -ObsSW.Observation.TBB.TBBsetting.startlevel=7 -ObsSW.Observation.TBB.TBBsetting.stoplevel=7 -ObsSW.Observation.TBB.TBBsetting.window=1K -ObsSW.Observation.VirtualInstrument.BGLNodeList=[bgl001,bgl002,bgl003] -ObsSW.Observation.VirtualInstrument.imageNodeList=[lioff005,lioff002,lioff003] -ObsSW.Observation.VirtualInstrument.partitionList=[R001_128_0,R001_128_1,R001_128_2,R001_128_3] -ObsSW.Observation.VirtualInstrument.stationList=[CS016,CS017,CS018] -ObsSW.Observation.VirtualInstrument.storageCapacity=760 -ObsSW.Observation.VirtualInstrument.storageNodeList=[list001,list002] -ObsSW.Observation.antennaArray=HBA -ObsSW.Observation.antennaSet= -ObsSW.Observation.bandFilter=LBL_10_80 -ObsSW.Observation.channelWidth=610.3515625 -ObsSW.Observation.channelsPerSubband=256 -ObsSW.Observation.claimPeriod=120 -ObsSW.Observation.clockMode=<<Clock160 -ObsSW.Observation.longBaselines=No -ObsSW.Observation.nrBeamformers=0 -ObsSW.Observation.nrBeams=1 -ObsSW.Observation.nrPolarisations=2 -ObsSW.Observation.nrSlotsInFrame=48 -ObsSW.Observation.preparePeriod=120 -ObsSW.Observation.receiverList=[8..31] -ObsSW.Observation.sampleClock=160 -ObsSW.Observation.samplesPerSecond=155648 -ObsSW.Observation.startTime=2008-Dec-16 15:10:00 -ObsSW.Observation.stopTime=2008-Dec-16 15:32:00 -ObsSW.Observation.subbandWidth=156.250 -_DPname=LOFAR_ObsSW_TempObs0016 -_treeID=5027 -prefix=LOFAR. diff --git a/dependencies/ApplCommon/test/tObservation.in_conflict3 b/dependencies/ApplCommon/test/tObservation.in_conflict3 deleted file mode 100644 index ae71c60d2031a539582126714b195a5550eafb8e..0000000000000000000000000000000000000000 --- a/dependencies/ApplCommon/test/tObservation.in_conflict3 +++ /dev/null @@ -1,59 +0,0 @@ -# beamlets overlap. -OLAP.nrBitsPerSample=16 -Clock160.channelWidth=610.3515625 -Clock160.samplesPerSecond=155648 -Clock160.subbandWidth=156.250 -Clock160.systemClock=160 -Clock200.channelWidth=762.939453125 -Clock200.samplesPerSecond=196608 -Clock200.subbandWidth=195.3125 -Clock200.systemClock=200 -ObsSW.Observation.Beam[0].angle1=6 -ObsSW.Observation.Beam[0].angle2=0.5 -ObsSW.Observation.Beam[0].angleTimes=0 -ObsSW.Observation.Beam[0].beamletList=[2..5] -ObsSW.Observation.Beam[0].directionType=J2000 -ObsSW.Observation.Beam[0].subbandList=[12..15] -ObsSW.Observation.MSNameMask=/data/L${YEAR}_${MSNUMBER}/SB${SUBBAND}.MS -ObsSW.Observation.ObsCtrl.StationCtrl._hostname=[CS016] -ObsSW.Observation.ObsCtrl._hostname=MCU001 -ObsSW.Observation.ObsCtrl.heartbeatInterval=10 -ObsSW.Observation.TBB.TBBsetting.C0=0 -ObsSW.Observation.TBB.TBBsetting.C1=0 -ObsSW.Observation.TBB.TBBsetting.C2=0 -ObsSW.Observation.TBB.TBBsetting.C3=0 -ObsSW.Observation.TBB.TBBsetting.RCUs=[] -ObsSW.Observation.TBB.TBBsetting.baselevel=2048 -ObsSW.Observation.TBB.TBBsetting.filter=128 -ObsSW.Observation.TBB.TBBsetting.operatingMode=1 -ObsSW.Observation.TBB.TBBsetting.startlevel=7 -ObsSW.Observation.TBB.TBBsetting.stoplevel=7 -ObsSW.Observation.TBB.TBBsetting.window=1K -ObsSW.Observation.VirtualInstrument.BGLNodeList=[bgl001,bgl002,bgl003] -ObsSW.Observation.VirtualInstrument.imageNodeList=[lioff005,lioff002,lioff003] -ObsSW.Observation.VirtualInstrument.partitionList=[R001_128_0,R001_128_1,R001_128_2,R001_128_3] -ObsSW.Observation.VirtualInstrument.stationList=[CS016,CS017,CS018] -ObsSW.Observation.VirtualInstrument.storageCapacity=760 -ObsSW.Observation.VirtualInstrument.storageNodeList=[list001,list002] -ObsSW.Observation.antennaArray=HBA -ObsSW.Observation.antennaSet= -ObsSW.Observation.bandFilter=HB_210_240 -ObsSW.Observation.channelWidth=610.3515625 -ObsSW.Observation.channelsPerSubband=256 -ObsSW.Observation.claimPeriod=120 -ObsSW.Observation.clockMode=<<Clock160 -ObsSW.Observation.longBaselines=No -ObsSW.Observation.nrBeamformers=0 -ObsSW.Observation.nrBeams=1 -ObsSW.Observation.nrPolarisations=2 -ObsSW.Observation.nrSlotsInFrame=48 -ObsSW.Observation.preparePeriod=120 -ObsSW.Observation.receiverList=[0..11] -ObsSW.Observation.sampleClock=160 -ObsSW.Observation.samplesPerSecond=155648 -ObsSW.Observation.startTime=2008-Dec-16 15:32:00 -ObsSW.Observation.stopTime=2008-Dec-16 15:54:00 -ObsSW.Observation.subbandWidth=156.250 -_DPname=LOFAR_ObsSW_TempObs0016 -_treeID=5028 -prefix=LOFAR. diff --git a/dependencies/ApplCommon/test/tObservation.in_conflict4 b/dependencies/ApplCommon/test/tObservation.in_conflict4 deleted file mode 100644 index 95ee1dafd1cf45e9f82ae1ab1e8a3726d49dc9d9..0000000000000000000000000000000000000000 --- a/dependencies/ApplCommon/test/tObservation.in_conflict4 +++ /dev/null @@ -1,58 +0,0 @@ -# Conflicts in nrSlotsPerFrame -Clock160.channelWidth=610.3515625 -Clock160.samplesPerSecond=155648 -Clock160.subbandWidth=156.250 -Clock160.systemClock=160 -Clock200.channelWidth=762.939453125 -Clock200.samplesPerSecond=196608 -Clock200.subbandWidth=195.3125 -Clock200.systemClock=200 -ObsSW.Observation.Beam[0].angle1=6 -ObsSW.Observation.Beam[0].angle2=0.5 -ObsSW.Observation.Beam[0].angleTimes=0 -ObsSW.Observation.Beam[0].beamletList=[40..43] -ObsSW.Observation.Beam[0].directionType=J2000 -ObsSW.Observation.Beam[0].subbandList=[2..5] -ObsSW.Observation.MSNameMask=/data/L${YEAR}_${MSNUMBER}/SB${SUBBAND}.MS -ObsSW.Observation.ObsCtrl.StationCtrl._hostname=[CS016] -ObsSW.Observation.ObsCtrl._hostname=MCU001 -ObsSW.Observation.ObsCtrl.heartbeatInterval=10 -ObsSW.Observation.TBB.TBBsetting.C0=0 -ObsSW.Observation.TBB.TBBsetting.C1=0 -ObsSW.Observation.TBB.TBBsetting.C2=0 -ObsSW.Observation.TBB.TBBsetting.C3=0 -ObsSW.Observation.TBB.TBBsetting.RCUs=[] -ObsSW.Observation.TBB.TBBsetting.baselevel=2048 -ObsSW.Observation.TBB.TBBsetting.filter=128 -ObsSW.Observation.TBB.TBBsetting.operatingMode=1 -ObsSW.Observation.TBB.TBBsetting.startlevel=7 -ObsSW.Observation.TBB.TBBsetting.stoplevel=7 -ObsSW.Observation.TBB.TBBsetting.window=1K -ObsSW.Observation.VirtualInstrument.BGLNodeList=[bgl001,bgl002,bgl003] -ObsSW.Observation.VirtualInstrument.imageNodeList=[lioff005,lioff002,lioff003] -ObsSW.Observation.VirtualInstrument.partitionList=[R001_128_0,R001_128_1,R001_128_2,R001_128_3] -ObsSW.Observation.VirtualInstrument.stationList=[CS016,CS017,CS018] -ObsSW.Observation.VirtualInstrument.storageCapacity=760 -ObsSW.Observation.VirtualInstrument.storageNodeList=[list001,list002] -ObsSW.Observation.antennaArray=HBA -ObsSW.Observation.antennaSet= -ObsSW.Observation.bandFilter=HB_210_240 -ObsSW.Observation.channelWidth=610.3515625 -ObsSW.Observation.channelsPerSubband=256 -ObsSW.Observation.claimPeriod=120 -ObsSW.Observation.clockMode=<<Clock160 -ObsSW.Observation.longBaselines=No -ObsSW.Observation.nrBeamformers=0 -ObsSW.Observation.nrBeams=1 -ObsSW.Observation.nrPolarisations=2 -ObsSW.Observation.nrSlotsInFrame=54 -ObsSW.Observation.preparePeriod=120 -ObsSW.Observation.receiverList=[0..11] -ObsSW.Observation.sampleClock=160 -ObsSW.Observation.samplesPerSecond=155648 -ObsSW.Observation.startTime=2008-Dec-16 15:30:00 -ObsSW.Observation.stopTime=2008-Dec-16 15:34:00 -ObsSW.Observation.subbandWidth=156.250 -_DPname=LOFAR_ObsSW_TempObs0016 -_treeID=5029 -prefix=LOFAR. diff --git a/dependencies/ApplCommon/test/tObservation.in_conflict5 b/dependencies/ApplCommon/test/tObservation.in_conflict5 deleted file mode 100644 index d1bc2a207dfddf4a900854f4d8e6aafd83554d61..0000000000000000000000000000000000000000 --- a/dependencies/ApplCommon/test/tObservation.in_conflict5 +++ /dev/null @@ -1,59 +0,0 @@ -# everything conflicts except for the observation period -OLAP.nrBitsPerSample=8 -Clock160.channelWidth=610.3515625 -Clock160.samplesPerSecond=155648 -Clock160.subbandWidth=156.250 -Clock160.systemClock=160 -Clock200.channelWidth=762.939453125 -Clock200.samplesPerSecond=196608 -Clock200.subbandWidth=195.3125 -Clock200.systemClock=200 -ObsSW.Observation.Beam[0].angle1=6 -ObsSW.Observation.Beam[0].angle2=0.5 -ObsSW.Observation.Beam[0].angleTimes=0 -ObsSW.Observation.Beam[0].beamletList=[10..13] -ObsSW.Observation.Beam[0].directionType=J2000 -ObsSW.Observation.Beam[0].subbandList=[32..35] -ObsSW.Observation.MSNameMask=/data/L${YEAR}_${MSNUMBER}/SB${SUBBAND}.MS -ObsSW.Observation.ObsCtrl.StationCtrl._hostname=[CS016] -ObsSW.Observation.ObsCtrl._hostname=MCU001 -ObsSW.Observation.ObsCtrl.heartbeatInterval=10 -ObsSW.Observation.TBB.TBBsetting.C0=0 -ObsSW.Observation.TBB.TBBsetting.C1=0 -ObsSW.Observation.TBB.TBBsetting.C2=0 -ObsSW.Observation.TBB.TBBsetting.C3=0 -ObsSW.Observation.TBB.TBBsetting.RCUs=[] -ObsSW.Observation.TBB.TBBsetting.baselevel=2048 -ObsSW.Observation.TBB.TBBsetting.filter=128 -ObsSW.Observation.TBB.TBBsetting.operatingMode=1 -ObsSW.Observation.TBB.TBBsetting.startlevel=7 -ObsSW.Observation.TBB.TBBsetting.stoplevel=7 -ObsSW.Observation.TBB.TBBsetting.window=1K -ObsSW.Observation.VirtualInstrument.BGLNodeList=[bgl001,bgl002,bgl003] -ObsSW.Observation.VirtualInstrument.imageNodeList=[lioff005,lioff002,lioff003] -ObsSW.Observation.VirtualInstrument.partitionList=[R001_128_0,R001_128_1,R001_128_2,R001_128_3] -ObsSW.Observation.VirtualInstrument.stationList=[CS016,CS017,CS018] -ObsSW.Observation.VirtualInstrument.storageCapacity=760 -ObsSW.Observation.VirtualInstrument.storageNodeList=[list001,list002] -ObsSW.Observation.antennaArray=HBA -ObsSW.Observation.antennaSet= -ObsSW.Observation.bandFilter=LBL_10_80 -ObsSW.Observation.channelWidth=762.939453125 -ObsSW.Observation.channelsPerSubband=256 -ObsSW.Observation.claimPeriod=120 -ObsSW.Observation.clockMode=<<Clock200 -ObsSW.Observation.longBaselines=No -ObsSW.Observation.nrBeamformers=0 -ObsSW.Observation.nrBeams=1 -ObsSW.Observation.nrPolarisations=2 -ObsSW.Observation.nrSlotsInFrame=54 -ObsSW.Observation.preparePeriod=120 -ObsSW.Observation.receiverList=[10..21] -ObsSW.Observation.sampleClock=200 -ObsSW.Observation.samplesPerSecond=196608 -ObsSW.Observation.startTime=2008-Dec-17 15:30:00 -ObsSW.Observation.stopTime=2008-Dec-17 15:34:00 -ObsSW.Observation.subbandWidth=195.3125 -_DPname=LOFAR_ObsSW_TempObs0016 -_treeID=5030 -prefix=LOFAR. diff --git a/dependencies/ApplCommon/test/tObservation.in_conflict6 b/dependencies/ApplCommon/test/tObservation.in_conflict6 deleted file mode 100644 index 0d61bdfdfa0adc62e8a6de45116fce3483496bcf..0000000000000000000000000000000000000000 --- a/dependencies/ApplCommon/test/tObservation.in_conflict6 +++ /dev/null @@ -1,59 +0,0 @@ -# Conflicts in nrBitsPerSample -OLAP.nrBitsPerSample=8 -Clock160.channelWidth=610.3515625 -Clock160.samplesPerSecond=155648 -Clock160.subbandWidth=156.250 -Clock160.systemClock=160 -Clock200.channelWidth=762.939453125 -Clock200.samplesPerSecond=196608 -Clock200.subbandWidth=195.3125 -Clock200.systemClock=200 -ObsSW.Observation.Beam[0].angle1=6 -ObsSW.Observation.Beam[0].angle2=0.5 -ObsSW.Observation.Beam[0].angleTimes=0 -ObsSW.Observation.Beam[0].beamletList=[40..43] -ObsSW.Observation.Beam[0].directionType=J2000 -ObsSW.Observation.Beam[0].subbandList=[2..5] -ObsSW.Observation.MSNameMask=/data/L${YEAR}_${MSNUMBER}/SB${SUBBAND}.MS -ObsSW.Observation.ObsCtrl.StationCtrl._hostname=[CS016] -ObsSW.Observation.ObsCtrl._hostname=MCU001 -ObsSW.Observation.ObsCtrl.heartbeatInterval=10 -ObsSW.Observation.TBB.TBBsetting.C0=0 -ObsSW.Observation.TBB.TBBsetting.C1=0 -ObsSW.Observation.TBB.TBBsetting.C2=0 -ObsSW.Observation.TBB.TBBsetting.C3=0 -ObsSW.Observation.TBB.TBBsetting.RCUs=[] -ObsSW.Observation.TBB.TBBsetting.baselevel=2048 -ObsSW.Observation.TBB.TBBsetting.filter=128 -ObsSW.Observation.TBB.TBBsetting.operatingMode=1 -ObsSW.Observation.TBB.TBBsetting.startlevel=7 -ObsSW.Observation.TBB.TBBsetting.stoplevel=7 -ObsSW.Observation.TBB.TBBsetting.window=1K -ObsSW.Observation.VirtualInstrument.BGLNodeList=[bgl001,bgl002,bgl003] -ObsSW.Observation.VirtualInstrument.imageNodeList=[lioff005,lioff002,lioff003] -ObsSW.Observation.VirtualInstrument.partitionList=[R001_128_0,R001_128_1,R001_128_2,R001_128_3] -ObsSW.Observation.VirtualInstrument.stationList=[CS016,CS017,CS018] -ObsSW.Observation.VirtualInstrument.storageCapacity=760 -ObsSW.Observation.VirtualInstrument.storageNodeList=[list001,list002] -ObsSW.Observation.antennaArray=HBA -ObsSW.Observation.antennaSet= -ObsSW.Observation.bandFilter=HB_210_240 -ObsSW.Observation.channelWidth=610.3515625 -ObsSW.Observation.channelsPerSubband=256 -ObsSW.Observation.claimPeriod=120 -ObsSW.Observation.clockMode=<<Clock160 -ObsSW.Observation.longBaselines=No -ObsSW.Observation.nrBeamformers=0 -ObsSW.Observation.nrBeams=1 -ObsSW.Observation.nrPolarisations=2 -ObsSW.Observation.nrSlotsInFrame=48 -ObsSW.Observation.preparePeriod=120 -ObsSW.Observation.receiverList=[0..11] -ObsSW.Observation.sampleClock=160 -ObsSW.Observation.samplesPerSecond=155648 -ObsSW.Observation.startTime=2008-Dec-16 15:30:00 -ObsSW.Observation.stopTime=2008-Dec-16 15:34:00 -ObsSW.Observation.subbandWidth=156.250 -_DPname=LOFAR_ObsSW_TempObs0016 -_treeID=5029 -prefix=LOFAR. diff --git a/dependencies/ApplCommon/test/tObservation.in_newParset b/dependencies/ApplCommon/test/tObservation.in_newParset deleted file mode 100644 index 6965201eb8a21111f20d0e47516387276c58c303..0000000000000000000000000000000000000000 --- a/dependencies/ApplCommon/test/tObservation.in_newParset +++ /dev/null @@ -1,68 +0,0 @@ -Clock160.channelWidth=610.3515625 -Clock160.samplesPerSecond=155648 -Clock160.subbandWidth=156.250 -Clock160.systemClock=160 -Clock200.channelWidth=762.939453125 -Clock200.samplesPerSecond=196608 -Clock200.subbandWidth=195.3125 -Clock200.systemClock=200 -ObsSW.Observation.Beam[0].angle1=6 -ObsSW.Observation.Beam[0].angle2=0.5 -ObsSW.Observation.Beam[0].directionType=J2000 -ObsSW.Observation.Beam[0].startTime= -ObsSW.Observation.Beam[0].duration=0 -ObsSW.Observation.Beam[0].subbandList=[2..5] -ObsSW.Observation.Beam[0].maximizeDuration=Missing -ObsSW.Observation.Beam[0].momID=0 -ObsSW.Observation.Beam[0].target= -ObsSW.Observation.Beam[1].angle1=1 -ObsSW.Observation.Beam[1].angle2=1.5 -ObsSW.Observation.Beam[1].directionType=J2000 -ObsSW.Observation.Beam[1].startTime= -ObsSW.Observation.Beam[1].duration=0 -ObsSW.Observation.Beam[1].subbandList=[20..25,40..44] -ObsSW.Observation.Beam[1].maximizeDuration=Missing -ObsSW.Observation.Beam[1].momID=0 -ObsSW.Observation.Beam[1].target= -ObsSW.Observation.VirtualInstrument.BGLNodeList=[bgl001,bgl002,bgl003] -ObsSW.Observation.VirtualInstrument.imageNodeList=[lioff005,lioff002,lioff003] -ObsSW.Observation.VirtualInstrument.partitionList=[R001_128_0,R001_128_1,R001_128_2,R001_128_3] -ObsSW.Observation.VirtualInstrument.stationList=[CS001,RS005,CS004] -ObsSW.Observation.VirtualInstrument.storageCapacity=760 -ObsSW.Observation.VirtualInstrument.storageNodeList=[list001,list002] -ObsSW.Observation.Dataslots.CS001HBA0.DataslotList=[45..47,0..11] -ObsSW.Observation.Dataslots.CS001HBA0.RSPBoardList=[3*0,12*1] -ObsSW.Observation.Dataslots.CS001HBA1.DataslotList=[45..47,0..11] -ObsSW.Observation.Dataslots.CS001HBA1.RSPBoardList=[3*0,12*1] -ObsSW.Observation.Dataslots.RS005HBA0.DataslotList=[0..3,45..47,0..7] -ObsSW.Observation.Dataslots.RS005HBA0.RSPBoardList=[7*0,8*1] -ObsSW.Observation.Dataslots.RS005HBA1.DataslotList=[0..3,45..47,0..7] -ObsSW.Observation.Dataslots.RS005HBA1.RSPBoardList=[7*0,8*1] -ObsSW.Observation.Dataslots.CS004HBA0.DataslotList=[0..14] -ObsSW.Observation.Dataslots.CS004HBA0.RSPBoardList=[15*0] -ObsSW.Observation.Dataslots.CS004HBA1.DataslotList=[0..14] -ObsSW.Observation.Dataslots.CS004HBA1.RSPBoardList=[15*0] -ObsSW.Observation.antennaArray=HBA -ObsSW.Observation.antennaSet=HBA_DUAL -ObsSW.Observation.bandFilter=HBA_210_250 -ObsSW.Observation.channelWidth=610.3515625 -ObsSW.Observation.channelsPerSubband=256 -ObsSW.Observation.claimPeriod=120 -ObsSW.Observation.clockMode=<<Clock160 -ObsSW.Observation.existingAntennaFields=["LBA","HBA","HBA0","HBA1"] -ObsSW.Observation.existingStations=["CS001","CS002","CS003","CS004","CS005","CS006","CS007","CS011","CS013","CS017","CS021","CS024","CS026","CS028","CS030","CS031","CS101","CS103","CS201","CS301","CS302","CS401","CS501","RS106","RS205","RS208","RS306","RS307","RS406","RS503","DE601","DE602","DE603","DE604","DE605","FR606","UK608"] -ObsSW.Observation.longBaselines=No -ObsSW.Observation.nrBeamformers=0 -ObsSW.Observation.nrBeams=2 -ObsSW.Observation.nrPolarisations=2 -ObsSW.Observation.nrSlotsInFrame=48 -ObsSW.Observation.preparePeriod=120 -ObsSW.Observation.receiverList=[0..11] -ObsSW.Observation.sampleClock=160 -ObsSW.Observation.samplesPerSecond=155648 -ObsSW.Observation.startTime=2008-Dec-16 15:30:00 -ObsSW.Observation.stopTime=2008-Dec-16 15:34:00 -ObsSW.Observation.subbandWidth=156.250 -_DPname=LOFAR_ObsSW_TempObs0016 -_treeID=5025 -prefix=LOFAR. diff --git a/dependencies/ApplCommon/test/tObservation.in_oldParset b/dependencies/ApplCommon/test/tObservation.in_oldParset deleted file mode 100644 index 5dd180ab73683786613a62c534bbd8e13192ceab..0000000000000000000000000000000000000000 --- a/dependencies/ApplCommon/test/tObservation.in_oldParset +++ /dev/null @@ -1,58 +0,0 @@ -Clock160.channelWidth=610.3515625 -Clock160.samplesPerSecond=155648 -Clock160.subbandWidth=156.250 -Clock160.systemClock=160 -Clock200.channelWidth=762.939453125 -Clock200.samplesPerSecond=196608 -Clock200.subbandWidth=195.3125 -Clock200.systemClock=200 -ObsSW.Observation.Beam[0].angle1=6 -ObsSW.Observation.Beam[0].angle2=0.5 -ObsSW.Observation.Beam[0].directionType=J2000 -ObsSW.Observation.Beam[0].startTime= -ObsSW.Observation.Beam[0].duration=0 -ObsSW.Observation.Beam[0].beamletList=[0..3] -ObsSW.Observation.Beam[0].subbandList=[2..5] -ObsSW.Observation.Beam[0].maximizeDuration=Missing -ObsSW.Observation.Beam[0].momID=0 -ObsSW.Observation.Beam[0].target= -ObsSW.Observation.Beam[1].angle1=1 -ObsSW.Observation.Beam[1].angle2=1.5 -ObsSW.Observation.Beam[1].directionType=J2000 -ObsSW.Observation.Beam[1].startTime= -ObsSW.Observation.Beam[1].duration=0 -ObsSW.Observation.Beam[1].beamletList=[45,46,47,61..68] -ObsSW.Observation.Beam[1].subbandList=[20..25,40..44] -ObsSW.Observation.Beam[1].maximizeDuration=Missing -ObsSW.Observation.Beam[1].momID=0 -ObsSW.Observation.Beam[1].target= -ObsSW.Observation.VirtualInstrument.BGLNodeList=[bgl001,bgl002,bgl003] -ObsSW.Observation.VirtualInstrument.imageNodeList=[lioff005,lioff002,lioff003] -ObsSW.Observation.VirtualInstrument.partitionList=[R001_128_0,R001_128_1,R001_128_2,R001_128_3] -ObsSW.Observation.VirtualInstrument.stationList=[CS001,RS005,CS004] -ObsSW.Observation.VirtualInstrument.storageCapacity=760 -ObsSW.Observation.VirtualInstrument.storageNodeList=[list001,list002] -ObsSW.Observation.antennaArray=HBA -ObsSW.Observation.antennaSet=HBA_DUAL -ObsSW.Observation.bandFilter=HBA_210_250 -ObsSW.Observation.channelWidth=610.3515625 -ObsSW.Observation.channelsPerSubband=256 -ObsSW.Observation.claimPeriod=120 -ObsSW.Observation.clockMode=<<Clock160 -ObsSW.Observation.existingAntennaFields=["LBA","HBA","HBA0","HBA1"] -ObsSW.Observation.existingStations=["CS001","CS002","CS003","CS004","CS005","CS006","CS007","CS011","CS013","CS017","CS021","CS024","CS026","CS028","CS030","CS031","CS101","CS103","CS201","CS301","CS302","CS401","CS501","RS106","RS205","RS208","RS306","RS307","RS406","RS503","DE601","DE602","DE603","DE604","DE605","FR606","UK608"] -ObsSW.Observation.longBaselines=No -ObsSW.Observation.nrBeamformers=0 -ObsSW.Observation.nrBeams=2 -ObsSW.Observation.nrPolarisations=2 -ObsSW.Observation.nrSlotsInFrame=48 -ObsSW.Observation.preparePeriod=120 -ObsSW.Observation.receiverList=[0..11] -ObsSW.Observation.sampleClock=160 -ObsSW.Observation.samplesPerSecond=155648 -ObsSW.Observation.startTime=2008-Dec-16 15:30:00 -ObsSW.Observation.stopTime=2008-Dec-16 15:34:00 -ObsSW.Observation.subbandWidth=156.250 -_DPname=LOFAR_ObsSW_TempObs0016 -_treeID=5025 -prefix=LOFAR. diff --git a/dependencies/ApplCommon/test/tObservation.in_parset1 b/dependencies/ApplCommon/test/tObservation.in_parset1 deleted file mode 100644 index c3018542a10a03a347f0e1faa53029f5463a8b7c..0000000000000000000000000000000000000000 --- a/dependencies/ApplCommon/test/tObservation.in_parset1 +++ /dev/null @@ -1,74 +0,0 @@ -ObsSW.OLAP.nrBitsPerSample=16 -Clock160.channelWidth=610.3515625 -Clock160.samplesPerSecond=155648 -Clock160.subbandWidth=156.250 -Clock160.systemClock=160 -Clock200.channelWidth=762.939453125 -Clock200.samplesPerSecond=196608 -Clock200.subbandWidth=195.3125 -Clock200.systemClock=200 -ObsSW.OLAP.CNProc_CoherentStokes.which = I -ObsSW.Observation.Beam[0].angle1=6 -ObsSW.Observation.Beam[0].angle2=0.5 -ObsSW.Observation.Beam[0].directionType=J2000 -ObsSW.Observation.Beam[0].startTime= -ObsSW.Observation.Beam[0].duration=0 -ObsSW.Observation.Beam[0].beamletList=[0..3] -ObsSW.Observation.Beam[0].subbandList=[2..5] -ObsSW.Observation.Beam[0].target=3C381 -ObsSW.Observation.Beam[0].maximizeDuration=true -ObsSW.Observation.Beam[0].nrTiedArrayBeams=2 -ObsSW.Observation.Beam[0].nrTabRings=0 -ObsSW.Observation.Beam[0].tabRingSize=0.023 -ObsSW.Observation.Beam[0].TiedArrayBeam[0].angle1=6.01 -ObsSW.Observation.Beam[0].TiedArrayBeam[0].angle2=0.51 -ObsSW.Observation.Beam[0].TiedArrayBeam[0].directionType=J2000 -ObsSW.Observation.Beam[0].TiedArrayBeam[0].dispersionMeasure=0 -ObsSW.Observation.Beam[0].TiedArrayBeam[0].coherent=true -ObsSW.Observation.Beam[0].TiedArrayBeam[1].angle1=5.99 -ObsSW.Observation.Beam[0].TiedArrayBeam[1].angle2=0.49 -ObsSW.Observation.Beam[0].TiedArrayBeam[1].directionType=J2000 -ObsSW.Observation.Beam[0].TiedArrayBeam[1].dispersionMeasure=20 -ObsSW.Observation.Beam[0].TiedArrayBeam[1].coherent=true -ObsSW.Observation.ObsCtrl.StationCtrl._hostname=[CS016] -ObsSW.Observation.ObsCtrl._hostname=MCU001 -ObsSW.Observation.ObsCtrl.heartbeatInterval=10 -ObsSW.Observation.TBB.TBBsetting.C0=0 -ObsSW.Observation.TBB.TBBsetting.C1=0 -ObsSW.Observation.TBB.TBBsetting.C2=0 -ObsSW.Observation.TBB.TBBsetting.C3=0 -ObsSW.Observation.TBB.TBBsetting.RCUs=[] -ObsSW.Observation.TBB.TBBsetting.baselevel=2048 -ObsSW.Observation.TBB.TBBsetting.filter=128 -ObsSW.Observation.TBB.TBBsetting.operatingMode=1 -ObsSW.Observation.TBB.TBBsetting.startlevel=7 -ObsSW.Observation.TBB.TBBsetting.stoplevel=7 -ObsSW.Observation.TBB.TBBsetting.window=1K -ObsSW.Observation.VirtualInstrument.BGLNodeList=[bgl001,bgl002,bgl003] -ObsSW.Observation.VirtualInstrument.imageNodeList=[lioff005,lioff002,lioff003] -ObsSW.Observation.VirtualInstrument.partitionList=[R001_128_0,R001_128_1,R001_128_2,R001_128_3] -ObsSW.Observation.VirtualInstrument.stationList=[CS016,CS017,CS018] -ObsSW.Observation.VirtualInstrument.storageCapacity=760 -ObsSW.Observation.VirtualInstrument.storageNodeList=[list001,list002] -ObsSW.Observation.antennaArray= -ObsSW.Observation.antennaSet=HBA_JOINED -ObsSW.Observation.bandFilter=HB_210_240 -ObsSW.Observation.channelWidth=610.3515625 -ObsSW.Observation.channelsPerSubband=256 -ObsSW.Observation.claimPeriod=120 -ObsSW.Observation.clockMode=<<Clock160 -ObsSW.Observation.longBaselines=No -ObsSW.Observation.nrBeamformers=0 -ObsSW.Observation.nrBeams=1 -ObsSW.Observation.nrPolarisations=2 -ObsSW.Observation.nrSlotsInFrame=48 -ObsSW.Observation.preparePeriod=120 -ObsSW.Observation.receiverList=[0..11] -ObsSW.Observation.sampleClock=160 -ObsSW.Observation.samplesPerSecond=155648 -ObsSW.Observation.startTime=2008-Dec-16 15:30:00 -ObsSW.Observation.stopTime=2008-Dec-16 15:34:00 -ObsSW.Observation.subbandWidth=156.250 -_DPname=LOFAR_ObsSW_TempObs0016 -_treeID=5025 -prefix=LOFAR. diff --git a/dependencies/ApplCommon/test/tObservation.in_parset2 b/dependencies/ApplCommon/test/tObservation.in_parset2 deleted file mode 100644 index fd4b044d33aa9ab6429047b3d33bd9a48bcb7a0a..0000000000000000000000000000000000000000 --- a/dependencies/ApplCommon/test/tObservation.in_parset2 +++ /dev/null @@ -1,72 +0,0 @@ -Clock160.channelWidth=610.3515625 -Clock160.samplesPerSecond=155648 -Clock160.subbandWidth=156.250 -Clock160.systemClock=160 -Clock200.channelWidth=762.939453125 -Clock200.samplesPerSecond=196608 -Clock200.subbandWidth=195.3125 -Clock200.systemClock=200 -ObsSW.Observation.Beam[0].angle1=6 -ObsSW.Observation.Beam[0].angle2=0.5 -ObsSW.Observation.Beam[0].directionType=J2000 -ObsSW.Observation.Beam[0].startTime= -ObsSW.Observation.Beam[0].duration=0 -ObsSW.Observation.Beam[0].beamletList=[0..3] -ObsSW.Observation.Beam[0].subbandList=[2..5] -ObsSW.Observation.Beam[0].target=3C381 -ObsSW.Observation.Beam[0].maximizeDuration=true -ObsSW.Observation.Beam[0].nrTiedArrayBeams=2 -ObsSW.Observation.Beam[0].nrTabRings=3 -ObsSW.Observation.Beam[0].tabRingSize=0.023 -ObsSW.Observation.Beam[0].TiedArrayBeam[0].angle1=6.01 -ObsSW.Observation.Beam[0].TiedArrayBeam[0].angle2=0.51 -ObsSW.Observation.Beam[0].TiedArrayBeam[0].directionType=J2000 -ObsSW.Observation.Beam[0].TiedArrayBeam[0].dispersionMeasure=0 -ObsSW.Observation.Beam[0].TiedArrayBeam[0].coherent=true -ObsSW.Observation.Beam[0].TiedArrayBeam[1].angle1=5.99 -ObsSW.Observation.Beam[0].TiedArrayBeam[1].angle2=0.49 -ObsSW.Observation.Beam[0].TiedArrayBeam[1].directionType=J2000 -ObsSW.Observation.Beam[0].TiedArrayBeam[1].dispersionMeasure=20 -ObsSW.Observation.Beam[0].TiedArrayBeam[1].coherent=false -ObsSW.Observation.ObsCtrl.StationCtrl._hostname=[CS016] -ObsSW.Observation.ObsCtrl._hostname=MCU001 -ObsSW.Observation.ObsCtrl.heartbeatInterval=10 -ObsSW.Observation.TBB.TBBsetting.C0=0 -ObsSW.Observation.TBB.TBBsetting.C1=0 -ObsSW.Observation.TBB.TBBsetting.C2=0 -ObsSW.Observation.TBB.TBBsetting.C3=0 -ObsSW.Observation.TBB.TBBsetting.RCUs=[] -ObsSW.Observation.TBB.TBBsetting.baselevel=2048 -ObsSW.Observation.TBB.TBBsetting.filter=128 -ObsSW.Observation.TBB.TBBsetting.operatingMode=1 -ObsSW.Observation.TBB.TBBsetting.startlevel=7 -ObsSW.Observation.TBB.TBBsetting.stoplevel=7 -ObsSW.Observation.TBB.TBBsetting.window=1K -ObsSW.Observation.VirtualInstrument.BGLNodeList=[bgl001,bgl002,bgl003] -ObsSW.Observation.VirtualInstrument.imageNodeList=[lioff005,lioff002,lioff003] -ObsSW.Observation.VirtualInstrument.partitionList=[R001_128_0,R001_128_1,R001_128_2,R001_128_3] -ObsSW.Observation.VirtualInstrument.stationList=[CS016,CS017,CS018] -ObsSW.Observation.VirtualInstrument.storageCapacity=760 -ObsSW.Observation.VirtualInstrument.storageNodeList=[list001,list002] -ObsSW.Observation.antennaArray= -ObsSW.Observation.antennaSet=HBA_DUAL -ObsSW.Observation.bandFilter=HB_210_240 -ObsSW.Observation.channelWidth=610.3515625 -ObsSW.Observation.channelsPerSubband=256 -ObsSW.Observation.claimPeriod=120 -ObsSW.Observation.clockMode=<<Clock160 -ObsSW.Observation.longBaselines=No -ObsSW.Observation.nrBeamformers=0 -ObsSW.Observation.nrBeams=1 -ObsSW.Observation.nrPolarisations=2 -ObsSW.Observation.nrSlotsInFrame=48 -ObsSW.Observation.preparePeriod=120 -ObsSW.Observation.receiverList=[0..11] -ObsSW.Observation.sampleClock=160 -ObsSW.Observation.samplesPerSecond=155648 -ObsSW.Observation.startTime=2008-Dec-16 15:30:00 -ObsSW.Observation.stopTime=2008-Dec-16 15:34:00 -ObsSW.Observation.subbandWidth=156.250 -_DPname=LOFAR_ObsSW_TempObs0016 -_treeID=5025 -prefix=LOFAR. diff --git a/dependencies/ApplCommon/test/tObservation.log_prop b/dependencies/ApplCommon/test/tObservation.log_prop deleted file mode 100644 index 9c2b179278b2e740552650793cb42c892cd5d6c1..0000000000000000000000000000000000000000 --- a/dependencies/ApplCommon/test/tObservation.log_prop +++ /dev/null @@ -1,10 +0,0 @@ -# Configure the rootLogger -log4cplus.rootLogger=DEBUG, STDOUT -#log4cplus.logger.TRC=TRACE3 - -# Define the STDOUT appender -log4cplus.appender.STDOUT=log4cplus::ConsoleAppender -log4cplus.appender.STDOUT.layout=log4cplus::PatternLayout -log4cplus.appender.STDOUT.layout.ConversionPattern=%-5p %c{3} - %m%n -log4cplus.appender.STDOUT.ImmediateFlush=true - diff --git a/dependencies/ApplCommon/test/tObservation.run b/dependencies/ApplCommon/test/tObservation.run deleted file mode 100755 index 1657ff5e7a94a43bac8342f45b59c73a35010345..0000000000000000000000000000000000000000 --- a/dependencies/ApplCommon/test/tObservation.run +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh -# -# This test can only be reliably run on rs005 (don't know why, but we just -# have to live with the fact). - -# Return SKIPPED (status 3) if we're not on rs005. -[ "$(hostname)" = "RS005C" ] || exit 3 - -# Run the test program -./tObservation diff --git a/dependencies/ApplCommon/test/tObservation.sh b/dependencies/ApplCommon/test/tObservation.sh deleted file mode 100755 index 50290ac9dce0c8205cd300e69c2e5539bce947c1..0000000000000000000000000000000000000000 --- a/dependencies/ApplCommon/test/tObservation.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -./runctest.sh tObservation diff --git a/dependencies/ApplCommon/test/tObservation.stdout b/dependencies/ApplCommon/test/tObservation.stdout deleted file mode 100644 index d346fd20921a6f92f697721b7dcda83ddaddfc73..0000000000000000000000000000000000000000 --- a/dependencies/ApplCommon/test/tObservation.stdout +++ /dev/null @@ -1,2478 +0,0 @@ ->>> -### READING AND SHOWING TWO PARSETS ### - -Observation : -ObsID : 5025 -starttime : 2008-Dec-16 15:30:00 -stoptime : 2008-Dec-16 15:34:00 -stations : [CS016,CS017,CS018] -antennaArray : HBA -antenna set : HBA_DUAL -receiver set : 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000111111111111 -sampleClock : 160 -bits/sample : 16 -filter : HB_210_240 -splitter : ON -nyquistZone : 3 - -(Receivers) : [0..11] -Stations : [CS016,CS017,CS018] -BLG nodes : [bgl001..bgl003] -Storage nodes: [list001,list002] - -nrBeams : 1 -Beam[0].name : observation[5025]beam[0] -Beam[0].target : 3C381 -Beam[0].antennaSet : HBA_ZERO -Beam[0].momID : 0 -Beam[0].subbandList: [2,3,4,5] -Beam[0].beamletList: [] -nrPointings : 1 -Beam[0].pointing[0]: 6.000000, 0.500000, J2000, 2008-Dec-16 15:30:00 -nrTABs : 2 -nrTABrings : 3 -TABringsize : 0.023 -Beam[0].TAB[0]: 6.010000, 0.510000, J2000, 0.000000, coherent -Beam[0].TAB[1]: 5.990000, 0.490000, J2000, 20.000000, incoherent -beamlet2beams : [] -nrAnaBeams : 0 -nrStreamsToStorage: 0 - - -Observation : -ObsID : 5025 -starttime : 2008-Dec-16 15:30:00 -stoptime : 2008-Dec-16 15:34:00 -stations : [CS016,CS017,CS018] -antennaArray : HBA -antenna set : HBA_JOINED -receiver set : 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000111111111111 -sampleClock : 160 -bits/sample : 16 -filter : HB_210_240 -splitter : OFF -nyquistZone : 3 - -(Receivers) : [0..11] -Stations : [CS016,CS017,CS018] -BLG nodes : [bgl001..bgl003] -Storage nodes: [list001,list002] - -nrBeams : 1 -Beam[0].name : observation[5025]beam[0] -Beam[0].target : 3C381 -Beam[0].antennaSet : HBA_JOINED -Beam[0].momID : 0 -Beam[0].subbandList: [2,3,4,5] -Beam[0].beamletList: [] -nrPointings : 1 -Beam[0].pointing[0]: 6.000000, 0.500000, J2000, 2008-Dec-16 15:30:00 -nrTABs : 2 -nrTABrings : 0 -TABringsize : 0.023 -Beam[0].TAB[0]: 6.010000, 0.510000, J2000, 0.000000, coherent -Beam[0].TAB[1]: 5.990000, 0.490000, J2000, 20.000000, coherent -beamlet2beams : [] -nrAnaBeams : 0 -nrStreamsToStorage: 0 - -<<< -### ADDING AN EXTRA BEAM ### - -Observation : -ObsID : 5025 -starttime : 2008-Dec-16 15:30:00 -stoptime : 2008-Dec-16 15:34:00 -stations : [CS016,CS017,CS018] -antennaArray : HBA -antenna set : HBA_JOINED -receiver set : 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000111111111111 -sampleClock : 160 -bits/sample : 16 -filter : HB_210_240 -splitter : OFF -nyquistZone : 3 - -(Receivers) : [0..11] -Stations : [CS016,CS017,CS018] -BLG nodes : [bgl001..bgl003] -Storage nodes: [list001,list002] - -nrBeams : 2 -Beam[0].name : observation[5025]beam[0] -Beam[0].target : 3C381 -Beam[0].antennaSet : HBA_JOINED -Beam[0].momID : 0 -Beam[0].subbandList: [2,3,4,5] -Beam[0].beamletList: [] -nrPointings : 1 -Beam[0].pointing[0]: 6.000000, 0.500000, J2000, 2008-Dec-16 15:30:00 -nrTABs : 2 -nrTABrings : 0 -TABringsize : 0.023 -Beam[0].TAB[0]: 6.010000, 0.510000, J2000, 0.000000, coherent -Beam[0].TAB[1]: 5.990000, 0.490000, J2000, 20.000000, coherent -Beam[1].name : observation[5025]beam[1] -Beam[1].target : -Beam[1].antennaSet : HBA_JOINED -Beam[1].momID : 0 -Beam[1].subbandList: [4,3,102] -Beam[1].beamletList: [] -nrPointings : 1 -Beam[1].pointing[0]: 0.234568, 0.123457, AZEL, 2008-Dec-16 15:30:00 -nrTABs : 0 -nrTABrings : 0 -TABringsize : 0 -beamlet2beams : [] -nrAnaBeams : 0 -nrStreamsToStorage: 0 - -### ADDING NODE ASSIGNMENT ### -Exception on wrong specified locations works OK ->>> -### TESTING CONFLICT ROUTINE ### -No conflict found in file 5 which is oke. -<<< -### SHOWING RCU BITSETS FOR ALL STATIONTYPES ### -getRCUbitset(96,48,'') = 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000111111111111 -getRCUbitset(96,96,'') = 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000111111111111 -getRCUbitset(96,48,LBA_XXX) = 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000111111111111 -getRCUbitset(96,96,LBA_XXX) = 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000111111111111 -getRCUbitset(96,48,HBA_XXX) = 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000111111111111 -getRCUbitset(96,96,HBA_XXX) = 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000111111111111 -HBA_ZERO(false) = HBA -HBA_ZERO(true) = HBA0 -HBA_ONE(false) = HBA -HBA_ONE(true) = HBA1 -HBA_DUAL(false) = HBA -HBA_DUAL(true) = HBA0 -HBA_JOINED(false) = HBA -HBA_JOINED(true) = HBA -LBA_INNER(false) = LBA -LBA_INNER(true) = LBA -LBA_OUTER(false) = LBA -LBA_OUTER(true) = LBA -LBA_X(false) = LBA -LBA_X(true) = LBA ->>> -### SHOW DIFFERENT BETWEEN OLD AND NEW DATASLOT SYNTAX ### -OLD SYNTAX - -Observation : -ObsID : 5025 -starttime : 2008-Dec-16 15:30:00 -stoptime : 2008-Dec-16 15:34:00 -stations : [CS001,CS004,RS005] -antennaArray : HBA -antenna set : HBA_DUAL -receiver set : 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000111111111111 -sampleClock : 160 -bits/sample : 16 -filter : HBA_210_250 -splitter : ON -nyquistZone : 3 - -(Receivers) : [0..11] -Stations : [CS001,RS005,CS004] -BLG nodes : [bgl001..bgl003] -Storage nodes: [list001,list002] - -nrBeams : 4 -Beam[0].name : observation[5025]beam[0]_0 -Beam[0].target : -Beam[0].antennaSet : HBA_ZERO -Beam[0].momID : 0 -Beam[0].subbandList: [2,3,4,5] -Beam[0].beamletList: [] -nrPointings : 1 -Beam[0].pointing[0]: 6.000000, 0.500000, J2000, 2008-Dec-16 15:30:00 -nrTABs : 0 -nrTABrings : 0 -TABringsize : 0 -Beam[1].name : observation[5025]beam[0]_1 -Beam[1].target : -Beam[1].antennaSet : HBA_ONE -Beam[1].momID : 0 -Beam[1].subbandList: [2,3,4,5] -Beam[1].beamletList: [] -nrPointings : 1 -Beam[1].pointing[0]: 6.000000, 0.500000, J2000, 2008-Dec-16 15:30:00 -nrTABs : 0 -nrTABrings : 0 -TABringsize : 0 -Beam[2].name : observation[5025]beam[1]_0 -Beam[2].target : -Beam[2].antennaSet : HBA_ZERO -Beam[2].momID : 0 -Beam[2].subbandList: [20,21,22,23,24,25,40,41,42,43,44] -Beam[2].beamletList: [] -nrPointings : 1 -Beam[2].pointing[0]: 1.000000, 1.500000, J2000, 2008-Dec-16 15:30:00 -nrTABs : 0 -nrTABrings : 0 -TABringsize : 0 -Beam[3].name : observation[5025]beam[1]_1 -Beam[3].target : -Beam[3].antennaSet : HBA_ONE -Beam[3].momID : 0 -Beam[3].subbandList: [20,21,22,23,24,25,40,41,42,43,44] -Beam[3].beamletList: [] -nrPointings : 1 -Beam[3].pointing[0]: 1.000000, 1.500000, J2000, 2008-Dec-16 15:30:00 -nrTABs : 0 -nrTABrings : 0 -TABringsize : 0 -beamlet2beams : [] -nrAnaBeams : 0 -nrStreamsToStorage: 0 - -NEW SYNTAX - -Observation : -ObsID : 5025 -starttime : 2008-Dec-16 15:30:00 -stoptime : 2008-Dec-16 15:34:00 -stations : [CS001,CS004,RS005] -antennaArray : HBA -antenna set : HBA_DUAL -receiver set : 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000111111111111 -sampleClock : 160 -bits/sample : 16 -filter : HBA_210_250 -splitter : ON -nyquistZone : 3 - -(Receivers) : [0..11] -Stations : [CS001,RS005,CS004] -BLG nodes : [bgl001..bgl003] -Storage nodes: [list001,list002] - -nrBeams : 4 -Beam[0].name : observation[5025]beam[0]_0 -Beam[0].target : -Beam[0].antennaSet : HBA_ZERO -Beam[0].momID : 0 -Beam[0].subbandList: [2,3,4,5] -Beam[0].beamletList: [] -nrPointings : 1 -Beam[0].pointing[0]: 6.000000, 0.500000, J2000, 2008-Dec-16 15:30:00 -nrTABs : 0 -nrTABrings : 0 -TABringsize : 0 -Beam[1].name : observation[5025]beam[0]_1 -Beam[1].target : -Beam[1].antennaSet : HBA_ONE -Beam[1].momID : 0 -Beam[1].subbandList: [2,3,4,5] -Beam[1].beamletList: [] -nrPointings : 1 -Beam[1].pointing[0]: 6.000000, 0.500000, J2000, 2008-Dec-16 15:30:00 -nrTABs : 0 -nrTABrings : 0 -TABringsize : 0 -Beam[2].name : observation[5025]beam[1]_0 -Beam[2].target : -Beam[2].antennaSet : HBA_ZERO -Beam[2].momID : 0 -Beam[2].subbandList: [20,21,22,23,24,25,40,41,42,43,44] -Beam[2].beamletList: [] -nrPointings : 1 -Beam[2].pointing[0]: 1.000000, 1.500000, J2000, 2008-Dec-16 15:30:00 -nrTABs : 0 -nrTABrings : 0 -TABringsize : 0 -Beam[3].name : observation[5025]beam[1]_1 -Beam[3].target : -Beam[3].antennaSet : HBA_ONE -Beam[3].momID : 0 -Beam[3].subbandList: [20,21,22,23,24,25,40,41,42,43,44] -Beam[3].beamletList: [] -nrPointings : 1 -Beam[3].pointing[0]: 1.000000, 1.500000, J2000, 2008-Dec-16 15:30:00 -nrTABs : 0 -nrTABrings : 0 -TABringsize : 0 -beamlet2beams : [] -nrAnaBeams : 0 -nrStreamsToStorage: 0 - -<<< -OBS 103821 - -Observation : -ObsID : 0 -starttime : 2013-Mar-19 09:04:00 -stoptime : 2013-Mar-19 10:04:00 -stations : [CS002,CS003,CS004,CS005,CS006,CS007] -antennaArray : HBA -antenna set : HBA_DUAL -receiver set : 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 -sampleClock : 200 -bits/sample : 8 -filter : HBA_110_190 -splitter : ON -nyquistZone : 2 - -(Receivers) : [] -Stations : [CS002,CS006,CS003,CS007,CS004,CS005] -BLG nodes : [] -Storage nodes: [] - -nrBeams : 6 -Beam[0].name : observation[0]beam[0]_0 -Beam[0].target : LOTAAS-P0236A-SAP0 -Beam[0].antennaSet : HBA_ZERO -Beam[0].momID : 227189 -Beam[0].subbandList: [100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,261] -Beam[0].beamletList: [] -nrPointings : 1 -Beam[0].pointing[0]: 5.718766, 0.300128, J2000, 2013-Mar-19 09:04:00 -nrTABs : 13 -nrTABrings : 4 -TABringsize : 0.0042799 -Beam[0].TAB[0]: 0.000000, 0.035002, J2000, 0.000000, coherent -Beam[0].TAB[1]: 0.017501, 0.030312, J2000, 0.000000, coherent -Beam[0].TAB[2]: 0.030312, 0.017501, J2000, 0.000000, coherent -Beam[0].TAB[3]: 0.035002, 0.000000, J2000, 0.000000, coherent -Beam[0].TAB[4]: 0.030312, -0.017501, J2000, 0.000000, coherent -Beam[0].TAB[5]: 0.017501, -0.030312, J2000, 0.000000, coherent -Beam[0].TAB[6]: 0.000000, -0.035002, J2000, 0.000000, coherent -Beam[0].TAB[7]: -0.017501, -0.030312, J2000, 0.000000, coherent -Beam[0].TAB[8]: -0.030312, -0.017501, J2000, 0.000000, coherent -Beam[0].TAB[9]: -0.035002, 0.000000, J2000, 0.000000, coherent -Beam[0].TAB[10]: -0.030312, 0.017501, J2000, 0.000000, coherent -Beam[0].TAB[11]: -0.017501, 0.030312, J2000, 0.000000, coherent -Beam[0].TAB[12]: 0.000000, 0.000000, J2000, 0.000000, incoherent -Beam[1].name : observation[0]beam[0]_1 -Beam[1].target : LOTAAS-P0236A-SAP0 -Beam[1].antennaSet : HBA_ONE -Beam[1].momID : 227189 -Beam[1].subbandList: [100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,261] -Beam[1].beamletList: [] -nrPointings : 1 -Beam[1].pointing[0]: 5.718766, 0.300128, J2000, 2013-Mar-19 09:04:00 -nrTABs : 13 -nrTABrings : 4 -TABringsize : 0.0042799 -Beam[1].TAB[0]: 0.000000, 0.035002, J2000, 0.000000, coherent -Beam[1].TAB[1]: 0.017501, 0.030312, J2000, 0.000000, coherent -Beam[1].TAB[2]: 0.030312, 0.017501, J2000, 0.000000, coherent -Beam[1].TAB[3]: 0.035002, 0.000000, J2000, 0.000000, coherent -Beam[1].TAB[4]: 0.030312, -0.017501, J2000, 0.000000, coherent -Beam[1].TAB[5]: 0.017501, -0.030312, J2000, 0.000000, coherent -Beam[1].TAB[6]: 0.000000, -0.035002, J2000, 0.000000, coherent -Beam[1].TAB[7]: -0.017501, -0.030312, J2000, 0.000000, coherent -Beam[1].TAB[8]: -0.030312, -0.017501, J2000, 0.000000, coherent -Beam[1].TAB[9]: -0.035002, 0.000000, J2000, 0.000000, coherent -Beam[1].TAB[10]: -0.030312, 0.017501, J2000, 0.000000, coherent -Beam[1].TAB[11]: -0.017501, 0.030312, J2000, 0.000000, coherent -Beam[1].TAB[12]: 0.000000, 0.000000, J2000, 0.000000, incoherent -Beam[2].name : observation[0]beam[1]_0 -Beam[2].target : LOTAAS-P0236A-SAP1 -Beam[2].antennaSet : HBA_ZERO -Beam[2].momID : 227190 -Beam[2].subbandList: [100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,261] -Beam[2].beamletList: [] -nrPointings : 1 -Beam[2].pointing[0]: 5.665004, 0.333475, J2000, 2013-Mar-19 09:04:00 -nrTABs : 13 -nrTABrings : 4 -TABringsize : 0.0042799 -Beam[2].TAB[0]: 0.000000, 0.035002, J2000, 0.000000, coherent -Beam[2].TAB[1]: 0.017501, 0.030312, J2000, 0.000000, coherent -Beam[2].TAB[2]: 0.030312, 0.017501, J2000, 0.000000, coherent -Beam[2].TAB[3]: 0.035002, 0.000000, J2000, 0.000000, coherent -Beam[2].TAB[4]: 0.030312, -0.017501, J2000, 0.000000, coherent -Beam[2].TAB[5]: 0.017501, -0.030312, J2000, 0.000000, coherent -Beam[2].TAB[6]: 0.000000, -0.035002, J2000, 0.000000, coherent -Beam[2].TAB[7]: -0.017501, -0.030312, J2000, 0.000000, coherent -Beam[2].TAB[8]: -0.030312, -0.017501, J2000, 0.000000, coherent -Beam[2].TAB[9]: -0.035002, 0.000000, J2000, 0.000000, coherent -Beam[2].TAB[10]: -0.030312, 0.017501, J2000, 0.000000, coherent -Beam[2].TAB[11]: -0.017501, 0.030312, J2000, 0.000000, coherent -Beam[2].TAB[12]: 0.000000, 0.000000, J2000, 0.000000, incoherent -Beam[3].name : observation[0]beam[1]_1 -Beam[3].target : LOTAAS-P0236A-SAP1 -Beam[3].antennaSet : HBA_ONE -Beam[3].momID : 227190 -Beam[3].subbandList: [100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,261] -Beam[3].beamletList: [] -nrPointings : 1 -Beam[3].pointing[0]: 5.665004, 0.333475, J2000, 2013-Mar-19 09:04:00 -nrTABs : 13 -nrTABrings : 4 -TABringsize : 0.0042799 -Beam[3].TAB[0]: 0.000000, 0.035002, J2000, 0.000000, coherent -Beam[3].TAB[1]: 0.017501, 0.030312, J2000, 0.000000, coherent -Beam[3].TAB[2]: 0.030312, 0.017501, J2000, 0.000000, coherent -Beam[3].TAB[3]: 0.035002, 0.000000, J2000, 0.000000, coherent -Beam[3].TAB[4]: 0.030312, -0.017501, J2000, 0.000000, coherent -Beam[3].TAB[5]: 0.017501, -0.030312, J2000, 0.000000, coherent -Beam[3].TAB[6]: 0.000000, -0.035002, J2000, 0.000000, coherent -Beam[3].TAB[7]: -0.017501, -0.030312, J2000, 0.000000, coherent -Beam[3].TAB[8]: -0.030312, -0.017501, J2000, 0.000000, coherent -Beam[3].TAB[9]: -0.035002, 0.000000, J2000, 0.000000, coherent -Beam[3].TAB[10]: -0.030312, 0.017501, J2000, 0.000000, coherent -Beam[3].TAB[11]: -0.017501, 0.030312, J2000, 0.000000, coherent -Beam[3].TAB[12]: 0.000000, 0.000000, J2000, 0.000000, incoherent -Beam[4].name : observation[0]beam[2]_0 -Beam[4].target : LOTAAS-P0236A-SAP2 -Beam[4].antennaSet : HBA_ZERO -Beam[4].momID : 227191 -Beam[4].subbandList: [100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,261] -Beam[4].beamletList: [] -nrPointings : 1 -Beam[4].pointing[0]: 5.665004, 0.266780, J2000, 2013-Mar-19 09:04:00 -nrTABs : 13 -nrTABrings : 4 -TABringsize : 0.0042799 -Beam[4].TAB[0]: 0.000000, 0.035002, J2000, 0.000000, coherent -Beam[4].TAB[1]: 0.017501, 0.030312, J2000, 0.000000, coherent -Beam[4].TAB[2]: 0.030312, 0.017501, J2000, 0.000000, coherent -Beam[4].TAB[3]: 0.035002, 0.000000, J2000, 0.000000, coherent -Beam[4].TAB[4]: 0.030312, -0.017501, J2000, 0.000000, coherent -Beam[4].TAB[5]: 0.017501, -0.030312, J2000, 0.000000, coherent -Beam[4].TAB[6]: 0.000000, -0.035002, J2000, 0.000000, coherent -Beam[4].TAB[7]: -0.017501, -0.030312, J2000, 0.000000, coherent -Beam[4].TAB[8]: -0.030312, -0.017501, J2000, 0.000000, coherent -Beam[4].TAB[9]: -0.035002, 0.000000, J2000, 0.000000, coherent -Beam[4].TAB[10]: -0.030312, 0.017501, J2000, 0.000000, coherent -Beam[4].TAB[11]: -0.017501, 0.030312, J2000, 0.000000, coherent -Beam[4].TAB[12]: 0.000000, 0.000000, J2000, 0.000000, incoherent -Beam[5].name : observation[0]beam[2]_1 -Beam[5].target : LOTAAS-P0236A-SAP2 -Beam[5].antennaSet : HBA_ONE -Beam[5].momID : 227191 -Beam[5].subbandList: [100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,261] -Beam[5].beamletList: [] -nrPointings : 1 -Beam[5].pointing[0]: 5.665004, 0.266780, J2000, 2013-Mar-19 09:04:00 -nrTABs : 13 -nrTABrings : 4 -TABringsize : 0.0042799 -Beam[5].TAB[0]: 0.000000, 0.035002, J2000, 0.000000, coherent -Beam[5].TAB[1]: 0.017501, 0.030312, J2000, 0.000000, coherent -Beam[5].TAB[2]: 0.030312, 0.017501, J2000, 0.000000, coherent -Beam[5].TAB[3]: 0.035002, 0.000000, J2000, 0.000000, coherent -Beam[5].TAB[4]: 0.030312, -0.017501, J2000, 0.000000, coherent -Beam[5].TAB[5]: 0.017501, -0.030312, J2000, 0.000000, coherent -Beam[5].TAB[6]: 0.000000, -0.035002, J2000, 0.000000, coherent -Beam[5].TAB[7]: -0.017501, -0.030312, J2000, 0.000000, coherent -Beam[5].TAB[8]: -0.030312, -0.017501, J2000, 0.000000, coherent -Beam[5].TAB[9]: -0.035002, 0.000000, J2000, 0.000000, coherent -Beam[5].TAB[10]: -0.030312, 0.017501, J2000, 0.000000, coherent -Beam[5].TAB[11]: -0.017501, 0.030312, J2000, 0.000000, coherent -Beam[5].TAB[12]: 0.000000, 0.000000, J2000, 0.000000, incoherent -beamlet2beams : [] -nrAnaBeams : 2 -AnaBeam[0].name : observation[0]anabeam_0 -AnaBeam[0].antennaSet: HBA_ZERO -AnaBeam[0].rank : 1 -nrPointings : 1 -anaBeam[0].pointing[0]: 5.718766, 0.300128, J2000 -AnaBeam[1].name : observation[0]beam[0]_1 -AnaBeam[1].antennaSet: HBA_ONE -AnaBeam[1].rank : 1 -nrPointings : 1 -anaBeam[1].pointing[0]: 5.718766, 0.300128, J2000 -nrStreamsToStorage: 222 -streamsToStorage[0].dataProduct: Beamformed -streamsToStorage[0].dataProductNr: 2 -streamsToStorage[0].streamNr: 0 -streamsToStorage[0].filename: L103821_SAP000_B000_S0_P000_bf.raw -streamsToStorage[0].sourcePset: 0 -streamsToStorage[0].destStorageNode: locus001 -streamsToStorage[0].destDirectory: /data/L103821/ -streamsToStorage[0].adderNr: 0 -streamsToStorage[0].writerNr: 0 -streamsToStorage[1].dataProduct: Beamformed -streamsToStorage[1].dataProductNr: 2 -streamsToStorage[1].streamNr: 1 -streamsToStorage[1].filename: L103821_SAP000_B001_S0_P000_bf.raw -streamsToStorage[1].sourcePset: 0 -streamsToStorage[1].destStorageNode: locus003 -streamsToStorage[1].destDirectory: /data/L103821/ -streamsToStorage[1].adderNr: 1 -streamsToStorage[1].writerNr: 0 -streamsToStorage[2].dataProduct: Beamformed -streamsToStorage[2].dataProductNr: 2 -streamsToStorage[2].streamNr: 2 -streamsToStorage[2].filename: L103821_SAP000_B002_S0_P000_bf.raw -streamsToStorage[2].sourcePset: 0 -streamsToStorage[2].destStorageNode: locus004 -streamsToStorage[2].destDirectory: /data/L103821/ -streamsToStorage[2].adderNr: 2 -streamsToStorage[2].writerNr: 0 -streamsToStorage[3].dataProduct: Beamformed -streamsToStorage[3].dataProductNr: 2 -streamsToStorage[3].streamNr: 3 -streamsToStorage[3].filename: L103821_SAP000_B003_S0_P000_bf.raw -streamsToStorage[3].sourcePset: 0 -streamsToStorage[3].destStorageNode: locus005 -streamsToStorage[3].destDirectory: /data/L103821/ -streamsToStorage[3].adderNr: 3 -streamsToStorage[3].writerNr: 0 -streamsToStorage[4].dataProduct: Beamformed -streamsToStorage[4].dataProductNr: 2 -streamsToStorage[4].streamNr: 4 -streamsToStorage[4].filename: L103821_SAP000_B004_S0_P000_bf.raw -streamsToStorage[4].sourcePset: 1 -streamsToStorage[4].destStorageNode: locus006 -streamsToStorage[4].destDirectory: /data/L103821/ -streamsToStorage[4].adderNr: 0 -streamsToStorage[4].writerNr: 0 -streamsToStorage[5].dataProduct: Beamformed -streamsToStorage[5].dataProductNr: 2 -streamsToStorage[5].streamNr: 5 -streamsToStorage[5].filename: L103821_SAP000_B005_S0_P000_bf.raw -streamsToStorage[5].sourcePset: 1 -streamsToStorage[5].destStorageNode: locus007 -streamsToStorage[5].destDirectory: /data/L103821/ -streamsToStorage[5].adderNr: 1 -streamsToStorage[5].writerNr: 0 -streamsToStorage[6].dataProduct: Beamformed -streamsToStorage[6].dataProductNr: 2 -streamsToStorage[6].streamNr: 6 -streamsToStorage[6].filename: L103821_SAP000_B006_S0_P000_bf.raw -streamsToStorage[6].sourcePset: 1 -streamsToStorage[6].destStorageNode: locus008 -streamsToStorage[6].destDirectory: /data/L103821/ -streamsToStorage[6].adderNr: 2 -streamsToStorage[6].writerNr: 0 -streamsToStorage[7].dataProduct: Beamformed -streamsToStorage[7].dataProductNr: 2 -streamsToStorage[7].streamNr: 7 -streamsToStorage[7].filename: L103821_SAP000_B007_S0_P000_bf.raw -streamsToStorage[7].sourcePset: 1 -streamsToStorage[7].destStorageNode: locus009 -streamsToStorage[7].destDirectory: /data/L103821/ -streamsToStorage[7].adderNr: 3 -streamsToStorage[7].writerNr: 0 -streamsToStorage[8].dataProduct: Beamformed -streamsToStorage[8].dataProductNr: 2 -streamsToStorage[8].streamNr: 8 -streamsToStorage[8].filename: L103821_SAP000_B008_S0_P000_bf.raw -streamsToStorage[8].sourcePset: 2 -streamsToStorage[8].destStorageNode: locus010 -streamsToStorage[8].destDirectory: /data/L103821/ -streamsToStorage[8].adderNr: 0 -streamsToStorage[8].writerNr: 0 -streamsToStorage[9].dataProduct: Beamformed -streamsToStorage[9].dataProductNr: 2 -streamsToStorage[9].streamNr: 9 -streamsToStorage[9].filename: L103821_SAP000_B009_S0_P000_bf.raw -streamsToStorage[9].sourcePset: 2 -streamsToStorage[9].destStorageNode: locus011 -streamsToStorage[9].destDirectory: /data/L103821/ -streamsToStorage[9].adderNr: 1 -streamsToStorage[9].writerNr: 0 -streamsToStorage[10].dataProduct: Beamformed -streamsToStorage[10].dataProductNr: 2 -streamsToStorage[10].streamNr: 10 -streamsToStorage[10].filename: L103821_SAP000_B010_S0_P000_bf.raw -streamsToStorage[10].sourcePset: 2 -streamsToStorage[10].destStorageNode: locus012 -streamsToStorage[10].destDirectory: /data/L103821/ -streamsToStorage[10].adderNr: 2 -streamsToStorage[10].writerNr: 0 -streamsToStorage[11].dataProduct: Beamformed -streamsToStorage[11].dataProductNr: 2 -streamsToStorage[11].streamNr: 11 -streamsToStorage[11].filename: L103821_SAP000_B011_S0_P000_bf.raw -streamsToStorage[11].sourcePset: 2 -streamsToStorage[11].destStorageNode: locus013 -streamsToStorage[11].destDirectory: /data/L103821/ -streamsToStorage[11].adderNr: 3 -streamsToStorage[11].writerNr: 0 -streamsToStorage[12].dataProduct: Beamformed -streamsToStorage[12].dataProductNr: 2 -streamsToStorage[12].streamNr: 12 -streamsToStorage[12].filename: L103821_SAP000_B012_S0_P000_bf.raw -streamsToStorage[12].sourcePset: 3 -streamsToStorage[12].destStorageNode: locus003 -streamsToStorage[12].destDirectory: /data/L103821/ -streamsToStorage[12].adderNr: 0 -streamsToStorage[12].writerNr: 1 -streamsToStorage[13].dataProduct: Beamformed -streamsToStorage[13].dataProductNr: 2 -streamsToStorage[13].streamNr: 13 -streamsToStorage[13].filename: L103821_SAP000_B013_S0_P000_bf.raw -streamsToStorage[13].sourcePset: 3 -streamsToStorage[13].destStorageNode: locus014 -streamsToStorage[13].destDirectory: /data/L103821/ -streamsToStorage[13].adderNr: 1 -streamsToStorage[13].writerNr: 0 -streamsToStorage[14].dataProduct: Beamformed -streamsToStorage[14].dataProductNr: 2 -streamsToStorage[14].streamNr: 14 -streamsToStorage[14].filename: L103821_SAP000_B014_S0_P000_bf.raw -streamsToStorage[14].sourcePset: 3 -streamsToStorage[14].destStorageNode: locus015 -streamsToStorage[14].destDirectory: /data/L103821/ -streamsToStorage[14].adderNr: 2 -streamsToStorage[14].writerNr: 0 -streamsToStorage[15].dataProduct: Beamformed -streamsToStorage[15].dataProductNr: 2 -streamsToStorage[15].streamNr: 15 -streamsToStorage[15].filename: L103821_SAP000_B015_S0_P000_bf.raw -streamsToStorage[15].sourcePset: 3 -streamsToStorage[15].destStorageNode: locus017 -streamsToStorage[15].destDirectory: /data/L103821/ -streamsToStorage[15].adderNr: 3 -streamsToStorage[15].writerNr: 0 -streamsToStorage[16].dataProduct: Beamformed -streamsToStorage[16].dataProductNr: 2 -streamsToStorage[16].streamNr: 16 -streamsToStorage[16].filename: L103821_SAP000_B016_S0_P000_bf.raw -streamsToStorage[16].sourcePset: 4 -streamsToStorage[16].destStorageNode: locus019 -streamsToStorage[16].destDirectory: /data/L103821/ -streamsToStorage[16].adderNr: 0 -streamsToStorage[16].writerNr: 0 -streamsToStorage[17].dataProduct: Beamformed -streamsToStorage[17].dataProductNr: 2 -streamsToStorage[17].streamNr: 17 -streamsToStorage[17].filename: L103821_SAP000_B017_S0_P000_bf.raw -streamsToStorage[17].sourcePset: 4 -streamsToStorage[17].destStorageNode: locus020 -streamsToStorage[17].destDirectory: /data/L103821/ -streamsToStorage[17].adderNr: 1 -streamsToStorage[17].writerNr: 0 -streamsToStorage[18].dataProduct: Beamformed -streamsToStorage[18].dataProductNr: 2 -streamsToStorage[18].streamNr: 18 -streamsToStorage[18].filename: L103821_SAP000_B018_S0_P000_bf.raw -streamsToStorage[18].sourcePset: 4 -streamsToStorage[18].destStorageNode: locus023 -streamsToStorage[18].destDirectory: /data/L103821/ -streamsToStorage[18].adderNr: 2 -streamsToStorage[18].writerNr: 0 -streamsToStorage[19].dataProduct: Beamformed -streamsToStorage[19].dataProductNr: 2 -streamsToStorage[19].streamNr: 19 -streamsToStorage[19].filename: L103821_SAP000_B019_S0_P000_bf.raw -streamsToStorage[19].sourcePset: 4 -streamsToStorage[19].destStorageNode: locus025 -streamsToStorage[19].destDirectory: /data/L103821/ -streamsToStorage[19].adderNr: 3 -streamsToStorage[19].writerNr: 0 -streamsToStorage[20].dataProduct: Beamformed -streamsToStorage[20].dataProductNr: 2 -streamsToStorage[20].streamNr: 20 -streamsToStorage[20].filename: L103821_SAP000_B020_S0_P000_bf.raw -streamsToStorage[20].sourcePset: 5 -streamsToStorage[20].destStorageNode: locus026 -streamsToStorage[20].destDirectory: /data/L103821/ -streamsToStorage[20].adderNr: 0 -streamsToStorage[20].writerNr: 0 -streamsToStorage[21].dataProduct: Beamformed -streamsToStorage[21].dataProductNr: 2 -streamsToStorage[21].streamNr: 21 -streamsToStorage[21].filename: L103821_SAP000_B021_S0_P000_bf.raw -streamsToStorage[21].sourcePset: 5 -streamsToStorage[21].destStorageNode: locus027 -streamsToStorage[21].destDirectory: /data/L103821/ -streamsToStorage[21].adderNr: 1 -streamsToStorage[21].writerNr: 0 -streamsToStorage[22].dataProduct: Beamformed -streamsToStorage[22].dataProductNr: 2 -streamsToStorage[22].streamNr: 22 -streamsToStorage[22].filename: L103821_SAP000_B022_S0_P000_bf.raw -streamsToStorage[22].sourcePset: 5 -streamsToStorage[22].destStorageNode: locus028 -streamsToStorage[22].destDirectory: /data/L103821/ -streamsToStorage[22].adderNr: 2 -streamsToStorage[22].writerNr: 0 -streamsToStorage[23].dataProduct: Beamformed -streamsToStorage[23].dataProductNr: 2 -streamsToStorage[23].streamNr: 23 -streamsToStorage[23].filename: L103821_SAP000_B023_S0_P000_bf.raw -streamsToStorage[23].sourcePset: 5 -streamsToStorage[23].destStorageNode: locus029 -streamsToStorage[23].destDirectory: /data/L103821/ -streamsToStorage[23].adderNr: 3 -streamsToStorage[23].writerNr: 0 -streamsToStorage[24].dataProduct: Beamformed -streamsToStorage[24].dataProductNr: 2 -streamsToStorage[24].streamNr: 24 -streamsToStorage[24].filename: L103821_SAP000_B024_S0_P000_bf.raw -streamsToStorage[24].sourcePset: 6 -streamsToStorage[24].destStorageNode: locus030 -streamsToStorage[24].destDirectory: /data/L103821/ -streamsToStorage[24].adderNr: 0 -streamsToStorage[24].writerNr: 0 -streamsToStorage[25].dataProduct: Beamformed -streamsToStorage[25].dataProductNr: 2 -streamsToStorage[25].streamNr: 25 -streamsToStorage[25].filename: L103821_SAP000_B025_S0_P000_bf.raw -streamsToStorage[25].sourcePset: 6 -streamsToStorage[25].destStorageNode: locus031 -streamsToStorage[25].destDirectory: /data/L103821/ -streamsToStorage[25].adderNr: 1 -streamsToStorage[25].writerNr: 0 -streamsToStorage[26].dataProduct: Beamformed -streamsToStorage[26].dataProductNr: 2 -streamsToStorage[26].streamNr: 26 -streamsToStorage[26].filename: L103821_SAP000_B026_S0_P000_bf.raw -streamsToStorage[26].sourcePset: 6 -streamsToStorage[26].destStorageNode: locus032 -streamsToStorage[26].destDirectory: /data/L103821/ -streamsToStorage[26].adderNr: 2 -streamsToStorage[26].writerNr: 0 -streamsToStorage[27].dataProduct: Beamformed -streamsToStorage[27].dataProductNr: 2 -streamsToStorage[27].streamNr: 27 -streamsToStorage[27].filename: L103821_SAP000_B027_S0_P000_bf.raw -streamsToStorage[27].sourcePset: 6 -streamsToStorage[27].destStorageNode: locus034 -streamsToStorage[27].destDirectory: /data/L103821/ -streamsToStorage[27].adderNr: 3 -streamsToStorage[27].writerNr: 0 -streamsToStorage[28].dataProduct: Beamformed -streamsToStorage[28].dataProductNr: 2 -streamsToStorage[28].streamNr: 28 -streamsToStorage[28].filename: L103821_SAP000_B028_S0_P000_bf.raw -streamsToStorage[28].sourcePset: 7 -streamsToStorage[28].destStorageNode: locus037 -streamsToStorage[28].destDirectory: /data/L103821/ -streamsToStorage[28].adderNr: 0 -streamsToStorage[28].writerNr: 0 -streamsToStorage[29].dataProduct: Beamformed -streamsToStorage[29].dataProductNr: 2 -streamsToStorage[29].streamNr: 29 -streamsToStorage[29].filename: L103821_SAP000_B029_S0_P000_bf.raw -streamsToStorage[29].sourcePset: 7 -streamsToStorage[29].destStorageNode: locus038 -streamsToStorage[29].destDirectory: /data/L103821/ -streamsToStorage[29].adderNr: 1 -streamsToStorage[29].writerNr: 0 -streamsToStorage[30].dataProduct: Beamformed -streamsToStorage[30].dataProductNr: 2 -streamsToStorage[30].streamNr: 30 -streamsToStorage[30].filename: L103821_SAP000_B030_S0_P000_bf.raw -streamsToStorage[30].sourcePset: 7 -streamsToStorage[30].destStorageNode: locus040 -streamsToStorage[30].destDirectory: /data/L103821/ -streamsToStorage[30].adderNr: 2 -streamsToStorage[30].writerNr: 0 -streamsToStorage[31].dataProduct: Beamformed -streamsToStorage[31].dataProductNr: 2 -streamsToStorage[31].streamNr: 31 -streamsToStorage[31].filename: L103821_SAP000_B031_S0_P000_bf.raw -streamsToStorage[31].sourcePset: 7 -streamsToStorage[31].destStorageNode: locus041 -streamsToStorage[31].destDirectory: /data/L103821/ -streamsToStorage[31].adderNr: 3 -streamsToStorage[31].writerNr: 0 -streamsToStorage[32].dataProduct: Beamformed -streamsToStorage[32].dataProductNr: 2 -streamsToStorage[32].streamNr: 32 -streamsToStorage[32].filename: L103821_SAP000_B032_S0_P000_bf.raw -streamsToStorage[32].sourcePset: 8 -streamsToStorage[32].destStorageNode: locus042 -streamsToStorage[32].destDirectory: /data/L103821/ -streamsToStorage[32].adderNr: 0 -streamsToStorage[32].writerNr: 0 -streamsToStorage[33].dataProduct: Beamformed -streamsToStorage[33].dataProductNr: 2 -streamsToStorage[33].streamNr: 33 -streamsToStorage[33].filename: L103821_SAP000_B033_S0_P000_bf.raw -streamsToStorage[33].sourcePset: 8 -streamsToStorage[33].destStorageNode: locus043 -streamsToStorage[33].destDirectory: /data/L103821/ -streamsToStorage[33].adderNr: 1 -streamsToStorage[33].writerNr: 0 -streamsToStorage[34].dataProduct: Beamformed -streamsToStorage[34].dataProductNr: 2 -streamsToStorage[34].streamNr: 34 -streamsToStorage[34].filename: L103821_SAP000_B034_S0_P000_bf.raw -streamsToStorage[34].sourcePset: 8 -streamsToStorage[34].destStorageNode: locus044 -streamsToStorage[34].destDirectory: /data/L103821/ -streamsToStorage[34].adderNr: 2 -streamsToStorage[34].writerNr: 0 -streamsToStorage[35].dataProduct: Beamformed -streamsToStorage[35].dataProductNr: 2 -streamsToStorage[35].streamNr: 35 -streamsToStorage[35].filename: L103821_SAP000_B035_S0_P000_bf.raw -streamsToStorage[35].sourcePset: 8 -streamsToStorage[35].destStorageNode: locus045 -streamsToStorage[35].destDirectory: /data/L103821/ -streamsToStorage[35].adderNr: 3 -streamsToStorage[35].writerNr: 0 -streamsToStorage[36].dataProduct: Beamformed -streamsToStorage[36].dataProductNr: 2 -streamsToStorage[36].streamNr: 36 -streamsToStorage[36].filename: L103821_SAP000_B036_S0_P000_bf.raw -streamsToStorage[36].sourcePset: 9 -streamsToStorage[36].destStorageNode: locus046 -streamsToStorage[36].destDirectory: /data/L103821/ -streamsToStorage[36].adderNr: 0 -streamsToStorage[36].writerNr: 0 -streamsToStorage[37].dataProduct: Beamformed -streamsToStorage[37].dataProductNr: 2 -streamsToStorage[37].streamNr: 37 -streamsToStorage[37].filename: L103821_SAP000_B037_S0_P000_bf.raw -streamsToStorage[37].sourcePset: 9 -streamsToStorage[37].destStorageNode: locus047 -streamsToStorage[37].destDirectory: /data/L103821/ -streamsToStorage[37].adderNr: 1 -streamsToStorage[37].writerNr: 0 -streamsToStorage[38].dataProduct: Beamformed -streamsToStorage[38].dataProductNr: 2 -streamsToStorage[38].streamNr: 38 -streamsToStorage[38].filename: L103821_SAP000_B038_S0_P000_bf.raw -streamsToStorage[38].sourcePset: 9 -streamsToStorage[38].destStorageNode: locus049 -streamsToStorage[38].destDirectory: /data/L103821/ -streamsToStorage[38].adderNr: 2 -streamsToStorage[38].writerNr: 0 -streamsToStorage[39].dataProduct: Beamformed -streamsToStorage[39].dataProductNr: 2 -streamsToStorage[39].streamNr: 39 -streamsToStorage[39].filename: L103821_SAP000_B039_S0_P000_bf.raw -streamsToStorage[39].sourcePset: 9 -streamsToStorage[39].destStorageNode: locus050 -streamsToStorage[39].destDirectory: /data/L103821/ -streamsToStorage[39].adderNr: 3 -streamsToStorage[39].writerNr: 0 -streamsToStorage[40].dataProduct: Beamformed -streamsToStorage[40].dataProductNr: 2 -streamsToStorage[40].streamNr: 40 -streamsToStorage[40].filename: L103821_SAP000_B040_S0_P000_bf.raw -streamsToStorage[40].sourcePset: 10 -streamsToStorage[40].destStorageNode: locus051 -streamsToStorage[40].destDirectory: /data/L103821/ -streamsToStorage[40].adderNr: 0 -streamsToStorage[40].writerNr: 0 -streamsToStorage[41].dataProduct: Beamformed -streamsToStorage[41].dataProductNr: 2 -streamsToStorage[41].streamNr: 41 -streamsToStorage[41].filename: L103821_SAP000_B041_S0_P000_bf.raw -streamsToStorage[41].sourcePset: 10 -streamsToStorage[41].destStorageNode: locus052 -streamsToStorage[41].destDirectory: /data/L103821/ -streamsToStorage[41].adderNr: 1 -streamsToStorage[41].writerNr: 0 -streamsToStorage[42].dataProduct: Beamformed -streamsToStorage[42].dataProductNr: 2 -streamsToStorage[42].streamNr: 42 -streamsToStorage[42].filename: L103821_SAP000_B042_S0_P000_bf.raw -streamsToStorage[42].sourcePset: 10 -streamsToStorage[42].destStorageNode: locus054 -streamsToStorage[42].destDirectory: /data/L103821/ -streamsToStorage[42].adderNr: 2 -streamsToStorage[42].writerNr: 0 -streamsToStorage[43].dataProduct: Beamformed -streamsToStorage[43].dataProductNr: 2 -streamsToStorage[43].streamNr: 43 -streamsToStorage[43].filename: L103821_SAP000_B043_S0_P000_bf.raw -streamsToStorage[43].sourcePset: 10 -streamsToStorage[43].destStorageNode: locus056 -streamsToStorage[43].destDirectory: /data/L103821/ -streamsToStorage[43].adderNr: 3 -streamsToStorage[43].writerNr: 0 -streamsToStorage[44].dataProduct: Beamformed -streamsToStorage[44].dataProductNr: 2 -streamsToStorage[44].streamNr: 44 -streamsToStorage[44].filename: L103821_SAP000_B044_S0_P000_bf.raw -streamsToStorage[44].sourcePset: 11 -streamsToStorage[44].destStorageNode: locus057 -streamsToStorage[44].destDirectory: /data/L103821/ -streamsToStorage[44].adderNr: 0 -streamsToStorage[44].writerNr: 0 -streamsToStorage[45].dataProduct: Beamformed -streamsToStorage[45].dataProductNr: 2 -streamsToStorage[45].streamNr: 45 -streamsToStorage[45].filename: L103821_SAP000_B045_S0_P000_bf.raw -streamsToStorage[45].sourcePset: 11 -streamsToStorage[45].destStorageNode: locus058 -streamsToStorage[45].destDirectory: /data/L103821/ -streamsToStorage[45].adderNr: 1 -streamsToStorage[45].writerNr: 0 -streamsToStorage[46].dataProduct: Beamformed -streamsToStorage[46].dataProductNr: 2 -streamsToStorage[46].streamNr: 46 -streamsToStorage[46].filename: L103821_SAP000_B046_S0_P000_bf.raw -streamsToStorage[46].sourcePset: 11 -streamsToStorage[46].destStorageNode: locus060 -streamsToStorage[46].destDirectory: /data/L103821/ -streamsToStorage[46].adderNr: 2 -streamsToStorage[46].writerNr: 0 -streamsToStorage[47].dataProduct: Beamformed -streamsToStorage[47].dataProductNr: 2 -streamsToStorage[47].streamNr: 47 -streamsToStorage[47].filename: L103821_SAP000_B047_S0_P000_bf.raw -streamsToStorage[47].sourcePset: 11 -streamsToStorage[47].destStorageNode: locus061 -streamsToStorage[47].destDirectory: /data/L103821/ -streamsToStorage[47].adderNr: 3 -streamsToStorage[47].writerNr: 0 -streamsToStorage[48].dataProduct: Beamformed -streamsToStorage[48].dataProductNr: 2 -streamsToStorage[48].streamNr: 48 -streamsToStorage[48].filename: L103821_SAP000_B048_S0_P000_bf.raw -streamsToStorage[48].sourcePset: 12 -streamsToStorage[48].destStorageNode: locus062 -streamsToStorage[48].destDirectory: /data/L103821/ -streamsToStorage[48].adderNr: 0 -streamsToStorage[48].writerNr: 0 -streamsToStorage[49].dataProduct: Beamformed -streamsToStorage[49].dataProductNr: 2 -streamsToStorage[49].streamNr: 49 -streamsToStorage[49].filename: L103821_SAP000_B049_S0_P000_bf.raw -streamsToStorage[49].sourcePset: 12 -streamsToStorage[49].destStorageNode: locus063 -streamsToStorage[49].destDirectory: /data/L103821/ -streamsToStorage[49].adderNr: 1 -streamsToStorage[49].writerNr: 0 -streamsToStorage[50].dataProduct: Beamformed -streamsToStorage[50].dataProductNr: 2 -streamsToStorage[50].streamNr: 50 -streamsToStorage[50].filename: L103821_SAP000_B050_S0_P000_bf.raw -streamsToStorage[50].sourcePset: 12 -streamsToStorage[50].destStorageNode: locus064 -streamsToStorage[50].destDirectory: /data/L103821/ -streamsToStorage[50].adderNr: 2 -streamsToStorage[50].writerNr: 0 -streamsToStorage[51].dataProduct: Beamformed -streamsToStorage[51].dataProductNr: 2 -streamsToStorage[51].streamNr: 51 -streamsToStorage[51].filename: L103821_SAP000_B051_S0_P000_bf.raw -streamsToStorage[51].sourcePset: 12 -streamsToStorage[51].destStorageNode: locus065 -streamsToStorage[51].destDirectory: /data/L103821/ -streamsToStorage[51].adderNr: 3 -streamsToStorage[51].writerNr: 0 -streamsToStorage[52].dataProduct: Beamformed -streamsToStorage[52].dataProductNr: 2 -streamsToStorage[52].streamNr: 52 -streamsToStorage[52].filename: L103821_SAP000_B052_S0_P000_bf.raw -streamsToStorage[52].sourcePset: 13 -streamsToStorage[52].destStorageNode: locus067 -streamsToStorage[52].destDirectory: /data/L103821/ -streamsToStorage[52].adderNr: 0 -streamsToStorage[52].writerNr: 0 -streamsToStorage[53].dataProduct: Beamformed -streamsToStorage[53].dataProductNr: 2 -streamsToStorage[53].streamNr: 53 -streamsToStorage[53].filename: L103821_SAP000_B053_S0_P000_bf.raw -streamsToStorage[53].sourcePset: 13 -streamsToStorage[53].destStorageNode: locus068 -streamsToStorage[53].destDirectory: /data/L103821/ -streamsToStorage[53].adderNr: 1 -streamsToStorage[53].writerNr: 0 -streamsToStorage[54].dataProduct: Beamformed -streamsToStorage[54].dataProductNr: 2 -streamsToStorage[54].streamNr: 54 -streamsToStorage[54].filename: L103821_SAP000_B054_S0_P000_bf.raw -streamsToStorage[54].sourcePset: 13 -streamsToStorage[54].destStorageNode: locus069 -streamsToStorage[54].destDirectory: /data/L103821/ -streamsToStorage[54].adderNr: 2 -streamsToStorage[54].writerNr: 0 -streamsToStorage[55].dataProduct: Beamformed -streamsToStorage[55].dataProductNr: 2 -streamsToStorage[55].streamNr: 55 -streamsToStorage[55].filename: L103821_SAP000_B055_S0_P000_bf.raw -streamsToStorage[55].sourcePset: 13 -streamsToStorage[55].destStorageNode: locus070 -streamsToStorage[55].destDirectory: /data/L103821/ -streamsToStorage[55].adderNr: 3 -streamsToStorage[55].writerNr: 0 -streamsToStorage[56].dataProduct: Beamformed -streamsToStorage[56].dataProductNr: 2 -streamsToStorage[56].streamNr: 56 -streamsToStorage[56].filename: L103821_SAP000_B056_S0_P000_bf.raw -streamsToStorage[56].sourcePset: 14 -streamsToStorage[56].destStorageNode: locus071 -streamsToStorage[56].destDirectory: /data/L103821/ -streamsToStorage[56].adderNr: 0 -streamsToStorage[56].writerNr: 0 -streamsToStorage[57].dataProduct: Beamformed -streamsToStorage[57].dataProductNr: 2 -streamsToStorage[57].streamNr: 57 -streamsToStorage[57].filename: L103821_SAP000_B057_S0_P000_bf.raw -streamsToStorage[57].sourcePset: 14 -streamsToStorage[57].destStorageNode: locus073 -streamsToStorage[57].destDirectory: /data/L103821/ -streamsToStorage[57].adderNr: 1 -streamsToStorage[57].writerNr: 0 -streamsToStorage[58].dataProduct: Beamformed -streamsToStorage[58].dataProductNr: 2 -streamsToStorage[58].streamNr: 58 -streamsToStorage[58].filename: L103821_SAP000_B058_S0_P000_bf.raw -streamsToStorage[58].sourcePset: 14 -streamsToStorage[58].destStorageNode: locus074 -streamsToStorage[58].destDirectory: /data/L103821/ -streamsToStorage[58].adderNr: 2 -streamsToStorage[58].writerNr: 0 -streamsToStorage[59].dataProduct: Beamformed -streamsToStorage[59].dataProductNr: 2 -streamsToStorage[59].streamNr: 59 -streamsToStorage[59].filename: L103821_SAP000_B059_S0_P000_bf.raw -streamsToStorage[59].sourcePset: 14 -streamsToStorage[59].destStorageNode: locus075 -streamsToStorage[59].destDirectory: /data/L103821/ -streamsToStorage[59].adderNr: 3 -streamsToStorage[59].writerNr: 0 -streamsToStorage[60].dataProduct: Beamformed -streamsToStorage[60].dataProductNr: 2 -streamsToStorage[60].streamNr: 60 -streamsToStorage[60].filename: L103821_SAP000_B060_S0_P000_bf.raw -streamsToStorage[60].sourcePset: 15 -streamsToStorage[60].destStorageNode: locus076 -streamsToStorage[60].destDirectory: /data/L103821/ -streamsToStorage[60].adderNr: 0 -streamsToStorage[60].writerNr: 0 -streamsToStorage[61].dataProduct: Beamformed -streamsToStorage[61].dataProductNr: 2 -streamsToStorage[61].streamNr: 61 -streamsToStorage[61].filename: L103821_SAP000_B061_S0_P000_bf.raw -streamsToStorage[61].sourcePset: 15 -streamsToStorage[61].destStorageNode: locus077 -streamsToStorage[61].destDirectory: /data/L103821/ -streamsToStorage[61].adderNr: 1 -streamsToStorage[61].writerNr: 0 -streamsToStorage[62].dataProduct: Beamformed -streamsToStorage[62].dataProductNr: 2 -streamsToStorage[62].streamNr: 62 -streamsToStorage[62].filename: L103821_SAP000_B062_S0_P000_bf.raw -streamsToStorage[62].sourcePset: 15 -streamsToStorage[62].destStorageNode: locus078 -streamsToStorage[62].destDirectory: /data/L103821/ -streamsToStorage[62].adderNr: 2 -streamsToStorage[62].writerNr: 0 -streamsToStorage[63].dataProduct: Beamformed -streamsToStorage[63].dataProductNr: 2 -streamsToStorage[63].streamNr: 63 -streamsToStorage[63].filename: L103821_SAP000_B063_S0_P000_bf.raw -streamsToStorage[63].sourcePset: 15 -streamsToStorage[63].destStorageNode: locus079 -streamsToStorage[63].destDirectory: /data/L103821/ -streamsToStorage[63].adderNr: 3 -streamsToStorage[63].writerNr: 0 -streamsToStorage[64].dataProduct: Beamformed -streamsToStorage[64].dataProductNr: 2 -streamsToStorage[64].streamNr: 64 -streamsToStorage[64].filename: L103821_SAP000_B064_S0_P000_bf.raw -streamsToStorage[64].sourcePset: 16 -streamsToStorage[64].destStorageNode: locus081 -streamsToStorage[64].destDirectory: /data/L103821/ -streamsToStorage[64].adderNr: 0 -streamsToStorage[64].writerNr: 0 -streamsToStorage[65].dataProduct: Beamformed -streamsToStorage[65].dataProductNr: 2 -streamsToStorage[65].streamNr: 65 -streamsToStorage[65].filename: L103821_SAP000_B065_S0_P000_bf.raw -streamsToStorage[65].sourcePset: 16 -streamsToStorage[65].destStorageNode: locus082 -streamsToStorage[65].destDirectory: /data/L103821/ -streamsToStorage[65].adderNr: 1 -streamsToStorage[65].writerNr: 0 -streamsToStorage[66].dataProduct: Beamformed -streamsToStorage[66].dataProductNr: 2 -streamsToStorage[66].streamNr: 66 -streamsToStorage[66].filename: L103821_SAP000_B066_S0_P000_bf.raw -streamsToStorage[66].sourcePset: 16 -streamsToStorage[66].destStorageNode: locus084 -streamsToStorage[66].destDirectory: /data/L103821/ -streamsToStorage[66].adderNr: 2 -streamsToStorage[66].writerNr: 0 -streamsToStorage[67].dataProduct: Beamformed -streamsToStorage[67].dataProductNr: 2 -streamsToStorage[67].streamNr: 67 -streamsToStorage[67].filename: L103821_SAP000_B067_S0_P000_bf.raw -streamsToStorage[67].sourcePset: 16 -streamsToStorage[67].destStorageNode: locus085 -streamsToStorage[67].destDirectory: /data/L103821/ -streamsToStorage[67].adderNr: 3 -streamsToStorage[67].writerNr: 0 -streamsToStorage[68].dataProduct: Beamformed -streamsToStorage[68].dataProductNr: 2 -streamsToStorage[68].streamNr: 68 -streamsToStorage[68].filename: L103821_SAP000_B068_S0_P000_bf.raw -streamsToStorage[68].sourcePset: 17 -streamsToStorage[68].destStorageNode: locus086 -streamsToStorage[68].destDirectory: /data/L103821/ -streamsToStorage[68].adderNr: 0 -streamsToStorage[68].writerNr: 0 -streamsToStorage[69].dataProduct: Beamformed -streamsToStorage[69].dataProductNr: 2 -streamsToStorage[69].streamNr: 69 -streamsToStorage[69].filename: L103821_SAP000_B069_S0_P000_bf.raw -streamsToStorage[69].sourcePset: 17 -streamsToStorage[69].destStorageNode: locus087 -streamsToStorage[69].destDirectory: /data/L103821/ -streamsToStorage[69].adderNr: 1 -streamsToStorage[69].writerNr: 0 -streamsToStorage[70].dataProduct: Beamformed -streamsToStorage[70].dataProductNr: 2 -streamsToStorage[70].streamNr: 70 -streamsToStorage[70].filename: L103821_SAP000_B070_S0_P000_bf.raw -streamsToStorage[70].sourcePset: 17 -streamsToStorage[70].destStorageNode: locus088 -streamsToStorage[70].destDirectory: /data/L103821/ -streamsToStorage[70].adderNr: 2 -streamsToStorage[70].writerNr: 0 -streamsToStorage[71].dataProduct: Beamformed -streamsToStorage[71].dataProductNr: 2 -streamsToStorage[71].streamNr: 71 -streamsToStorage[71].filename: L103821_SAP000_B071_S0_P000_bf.raw -streamsToStorage[71].sourcePset: 17 -streamsToStorage[71].destStorageNode: locus090 -streamsToStorage[71].destDirectory: /data/L103821/ -streamsToStorage[71].adderNr: 3 -streamsToStorage[71].writerNr: 0 -streamsToStorage[72].dataProduct: Beamformed -streamsToStorage[72].dataProductNr: 2 -streamsToStorage[72].streamNr: 72 -streamsToStorage[72].filename: L103821_SAP000_B072_S0_P000_bf.raw -streamsToStorage[72].sourcePset: 18 -streamsToStorage[72].destStorageNode: locus093 -streamsToStorage[72].destDirectory: /data/L103821/ -streamsToStorage[72].adderNr: 0 -streamsToStorage[72].writerNr: 0 -streamsToStorage[73].dataProduct: Beamformed -streamsToStorage[73].dataProductNr: 2 -streamsToStorage[73].streamNr: 73 -streamsToStorage[73].filename: L103821_SAP000_B073_S0_P000_bf.raw -streamsToStorage[73].sourcePset: 18 -streamsToStorage[73].destStorageNode: locus094 -streamsToStorage[73].destDirectory: /data/L103821/ -streamsToStorage[73].adderNr: 1 -streamsToStorage[73].writerNr: 0 -streamsToStorage[74].dataProduct: Beamformed -streamsToStorage[74].dataProductNr: 2 -streamsToStorage[74].streamNr: 74 -streamsToStorage[74].filename: L103821_SAP001_B000_S0_P000_bf.raw -streamsToStorage[74].sourcePset: 18 -streamsToStorage[74].destStorageNode: locus001 -streamsToStorage[74].destDirectory: /data/L103821/ -streamsToStorage[74].adderNr: 2 -streamsToStorage[74].writerNr: 1 -streamsToStorage[75].dataProduct: Beamformed -streamsToStorage[75].dataProductNr: 2 -streamsToStorage[75].streamNr: 75 -streamsToStorage[75].filename: L103821_SAP001_B001_S0_P000_bf.raw -streamsToStorage[75].sourcePset: 18 -streamsToStorage[75].destStorageNode: locus003 -streamsToStorage[75].destDirectory: /data/L103821/ -streamsToStorage[75].adderNr: 3 -streamsToStorage[75].writerNr: 2 -streamsToStorage[76].dataProduct: Beamformed -streamsToStorage[76].dataProductNr: 2 -streamsToStorage[76].streamNr: 76 -streamsToStorage[76].filename: L103821_SAP001_B002_S0_P000_bf.raw -streamsToStorage[76].sourcePset: 19 -streamsToStorage[76].destStorageNode: locus004 -streamsToStorage[76].destDirectory: /data/L103821/ -streamsToStorage[76].adderNr: 0 -streamsToStorage[76].writerNr: 1 -streamsToStorage[77].dataProduct: Beamformed -streamsToStorage[77].dataProductNr: 2 -streamsToStorage[77].streamNr: 77 -streamsToStorage[77].filename: L103821_SAP001_B003_S0_P000_bf.raw -streamsToStorage[77].sourcePset: 19 -streamsToStorage[77].destStorageNode: locus005 -streamsToStorage[77].destDirectory: /data/L103821/ -streamsToStorage[77].adderNr: 1 -streamsToStorage[77].writerNr: 1 -streamsToStorage[78].dataProduct: Beamformed -streamsToStorage[78].dataProductNr: 2 -streamsToStorage[78].streamNr: 78 -streamsToStorage[78].filename: L103821_SAP001_B004_S0_P000_bf.raw -streamsToStorage[78].sourcePset: 19 -streamsToStorage[78].destStorageNode: locus006 -streamsToStorage[78].destDirectory: /data/L103821/ -streamsToStorage[78].adderNr: 2 -streamsToStorage[78].writerNr: 1 -streamsToStorage[79].dataProduct: Beamformed -streamsToStorage[79].dataProductNr: 2 -streamsToStorage[79].streamNr: 79 -streamsToStorage[79].filename: L103821_SAP001_B005_S0_P000_bf.raw -streamsToStorage[79].sourcePset: 19 -streamsToStorage[79].destStorageNode: locus007 -streamsToStorage[79].destDirectory: /data/L103821/ -streamsToStorage[79].adderNr: 3 -streamsToStorage[79].writerNr: 1 -streamsToStorage[80].dataProduct: Beamformed -streamsToStorage[80].dataProductNr: 2 -streamsToStorage[80].streamNr: 80 -streamsToStorage[80].filename: L103821_SAP001_B006_S0_P000_bf.raw -streamsToStorage[80].sourcePset: 20 -streamsToStorage[80].destStorageNode: locus008 -streamsToStorage[80].destDirectory: /data/L103821/ -streamsToStorage[80].adderNr: 0 -streamsToStorage[80].writerNr: 1 -streamsToStorage[81].dataProduct: Beamformed -streamsToStorage[81].dataProductNr: 2 -streamsToStorage[81].streamNr: 81 -streamsToStorage[81].filename: L103821_SAP001_B007_S0_P000_bf.raw -streamsToStorage[81].sourcePset: 20 -streamsToStorage[81].destStorageNode: locus009 -streamsToStorage[81].destDirectory: /data/L103821/ -streamsToStorage[81].adderNr: 1 -streamsToStorage[81].writerNr: 1 -streamsToStorage[82].dataProduct: Beamformed -streamsToStorage[82].dataProductNr: 2 -streamsToStorage[82].streamNr: 82 -streamsToStorage[82].filename: L103821_SAP001_B008_S0_P000_bf.raw -streamsToStorage[82].sourcePset: 20 -streamsToStorage[82].destStorageNode: locus010 -streamsToStorage[82].destDirectory: /data/L103821/ -streamsToStorage[82].adderNr: 2 -streamsToStorage[82].writerNr: 1 -streamsToStorage[83].dataProduct: Beamformed -streamsToStorage[83].dataProductNr: 2 -streamsToStorage[83].streamNr: 83 -streamsToStorage[83].filename: L103821_SAP001_B009_S0_P000_bf.raw -streamsToStorage[83].sourcePset: 20 -streamsToStorage[83].destStorageNode: locus011 -streamsToStorage[83].destDirectory: /data/L103821/ -streamsToStorage[83].adderNr: 3 -streamsToStorage[83].writerNr: 1 -streamsToStorage[84].dataProduct: Beamformed -streamsToStorage[84].dataProductNr: 2 -streamsToStorage[84].streamNr: 84 -streamsToStorage[84].filename: L103821_SAP001_B010_S0_P000_bf.raw -streamsToStorage[84].sourcePset: 21 -streamsToStorage[84].destStorageNode: locus012 -streamsToStorage[84].destDirectory: /data/L103821/ -streamsToStorage[84].adderNr: 0 -streamsToStorage[84].writerNr: 1 -streamsToStorage[85].dataProduct: Beamformed -streamsToStorage[85].dataProductNr: 2 -streamsToStorage[85].streamNr: 85 -streamsToStorage[85].filename: L103821_SAP001_B011_S0_P000_bf.raw -streamsToStorage[85].sourcePset: 21 -streamsToStorage[85].destStorageNode: locus013 -streamsToStorage[85].destDirectory: /data/L103821/ -streamsToStorage[85].adderNr: 1 -streamsToStorage[85].writerNr: 1 -streamsToStorage[86].dataProduct: Beamformed -streamsToStorage[86].dataProductNr: 2 -streamsToStorage[86].streamNr: 86 -streamsToStorage[86].filename: L103821_SAP001_B012_S0_P000_bf.raw -streamsToStorage[86].sourcePset: 21 -streamsToStorage[86].destStorageNode: locus048 -streamsToStorage[86].destDirectory: /data/L103821/ -streamsToStorage[86].adderNr: 2 -streamsToStorage[86].writerNr: 0 -streamsToStorage[87].dataProduct: Beamformed -streamsToStorage[87].dataProductNr: 2 -streamsToStorage[87].streamNr: 87 -streamsToStorage[87].filename: L103821_SAP001_B013_S0_P000_bf.raw -streamsToStorage[87].sourcePset: 21 -streamsToStorage[87].destStorageNode: locus014 -streamsToStorage[87].destDirectory: /data/L103821/ -streamsToStorage[87].adderNr: 3 -streamsToStorage[87].writerNr: 1 -streamsToStorage[88].dataProduct: Beamformed -streamsToStorage[88].dataProductNr: 2 -streamsToStorage[88].streamNr: 88 -streamsToStorage[88].filename: L103821_SAP001_B014_S0_P000_bf.raw -streamsToStorage[88].sourcePset: 22 -streamsToStorage[88].destStorageNode: locus015 -streamsToStorage[88].destDirectory: /data/L103821/ -streamsToStorage[88].adderNr: 0 -streamsToStorage[88].writerNr: 1 -streamsToStorage[89].dataProduct: Beamformed -streamsToStorage[89].dataProductNr: 2 -streamsToStorage[89].streamNr: 89 -streamsToStorage[89].filename: L103821_SAP001_B015_S0_P000_bf.raw -streamsToStorage[89].sourcePset: 22 -streamsToStorage[89].destStorageNode: locus017 -streamsToStorage[89].destDirectory: /data/L103821/ -streamsToStorage[89].adderNr: 1 -streamsToStorage[89].writerNr: 1 -streamsToStorage[90].dataProduct: Beamformed -streamsToStorage[90].dataProductNr: 2 -streamsToStorage[90].streamNr: 90 -streamsToStorage[90].filename: L103821_SAP001_B016_S0_P000_bf.raw -streamsToStorage[90].sourcePset: 22 -streamsToStorage[90].destStorageNode: locus019 -streamsToStorage[90].destDirectory: /data/L103821/ -streamsToStorage[90].adderNr: 2 -streamsToStorage[90].writerNr: 1 -streamsToStorage[91].dataProduct: Beamformed -streamsToStorage[91].dataProductNr: 2 -streamsToStorage[91].streamNr: 91 -streamsToStorage[91].filename: L103821_SAP001_B017_S0_P000_bf.raw -streamsToStorage[91].sourcePset: 22 -streamsToStorage[91].destStorageNode: locus020 -streamsToStorage[91].destDirectory: /data/L103821/ -streamsToStorage[91].adderNr: 3 -streamsToStorage[91].writerNr: 1 -streamsToStorage[92].dataProduct: Beamformed -streamsToStorage[92].dataProductNr: 2 -streamsToStorage[92].streamNr: 92 -streamsToStorage[92].filename: L103821_SAP001_B018_S0_P000_bf.raw -streamsToStorage[92].sourcePset: 23 -streamsToStorage[92].destStorageNode: locus023 -streamsToStorage[92].destDirectory: /data/L103821/ -streamsToStorage[92].adderNr: 0 -streamsToStorage[92].writerNr: 1 -streamsToStorage[93].dataProduct: Beamformed -streamsToStorage[93].dataProductNr: 2 -streamsToStorage[93].streamNr: 93 -streamsToStorage[93].filename: L103821_SAP001_B019_S0_P000_bf.raw -streamsToStorage[93].sourcePset: 23 -streamsToStorage[93].destStorageNode: locus025 -streamsToStorage[93].destDirectory: /data/L103821/ -streamsToStorage[93].adderNr: 1 -streamsToStorage[93].writerNr: 1 -streamsToStorage[94].dataProduct: Beamformed -streamsToStorage[94].dataProductNr: 2 -streamsToStorage[94].streamNr: 94 -streamsToStorage[94].filename: L103821_SAP001_B020_S0_P000_bf.raw -streamsToStorage[94].sourcePset: 23 -streamsToStorage[94].destStorageNode: locus026 -streamsToStorage[94].destDirectory: /data/L103821/ -streamsToStorage[94].adderNr: 2 -streamsToStorage[94].writerNr: 1 -streamsToStorage[95].dataProduct: Beamformed -streamsToStorage[95].dataProductNr: 2 -streamsToStorage[95].streamNr: 95 -streamsToStorage[95].filename: L103821_SAP001_B021_S0_P000_bf.raw -streamsToStorage[95].sourcePset: 23 -streamsToStorage[95].destStorageNode: locus027 -streamsToStorage[95].destDirectory: /data/L103821/ -streamsToStorage[95].adderNr: 3 -streamsToStorage[95].writerNr: 1 -streamsToStorage[96].dataProduct: Beamformed -streamsToStorage[96].dataProductNr: 2 -streamsToStorage[96].streamNr: 96 -streamsToStorage[96].filename: L103821_SAP001_B022_S0_P000_bf.raw -streamsToStorage[96].sourcePset: 24 -streamsToStorage[96].destStorageNode: locus028 -streamsToStorage[96].destDirectory: /data/L103821/ -streamsToStorage[96].adderNr: 0 -streamsToStorage[96].writerNr: 1 -streamsToStorage[97].dataProduct: Beamformed -streamsToStorage[97].dataProductNr: 2 -streamsToStorage[97].streamNr: 97 -streamsToStorage[97].filename: L103821_SAP001_B023_S0_P000_bf.raw -streamsToStorage[97].sourcePset: 24 -streamsToStorage[97].destStorageNode: locus029 -streamsToStorage[97].destDirectory: /data/L103821/ -streamsToStorage[97].adderNr: 1 -streamsToStorage[97].writerNr: 1 -streamsToStorage[98].dataProduct: Beamformed -streamsToStorage[98].dataProductNr: 2 -streamsToStorage[98].streamNr: 98 -streamsToStorage[98].filename: L103821_SAP001_B024_S0_P000_bf.raw -streamsToStorage[98].sourcePset: 24 -streamsToStorage[98].destStorageNode: locus030 -streamsToStorage[98].destDirectory: /data/L103821/ -streamsToStorage[98].adderNr: 2 -streamsToStorage[98].writerNr: 1 -streamsToStorage[99].dataProduct: Beamformed -streamsToStorage[99].dataProductNr: 2 -streamsToStorage[99].streamNr: 99 -streamsToStorage[99].filename: L103821_SAP001_B025_S0_P000_bf.raw -streamsToStorage[99].sourcePset: 24 -streamsToStorage[99].destStorageNode: locus031 -streamsToStorage[99].destDirectory: /data/L103821/ -streamsToStorage[99].adderNr: 3 -streamsToStorage[99].writerNr: 1 -streamsToStorage[100].dataProduct: Beamformed -streamsToStorage[100].dataProductNr: 2 -streamsToStorage[100].streamNr: 100 -streamsToStorage[100].filename: L103821_SAP001_B026_S0_P000_bf.raw -streamsToStorage[100].sourcePset: 25 -streamsToStorage[100].destStorageNode: locus032 -streamsToStorage[100].destDirectory: /data/L103821/ -streamsToStorage[100].adderNr: 0 -streamsToStorage[100].writerNr: 1 -streamsToStorage[101].dataProduct: Beamformed -streamsToStorage[101].dataProductNr: 2 -streamsToStorage[101].streamNr: 101 -streamsToStorage[101].filename: L103821_SAP001_B027_S0_P000_bf.raw -streamsToStorage[101].sourcePset: 25 -streamsToStorage[101].destStorageNode: locus034 -streamsToStorage[101].destDirectory: /data/L103821/ -streamsToStorage[101].adderNr: 1 -streamsToStorage[101].writerNr: 1 -streamsToStorage[102].dataProduct: Beamformed -streamsToStorage[102].dataProductNr: 2 -streamsToStorage[102].streamNr: 102 -streamsToStorage[102].filename: L103821_SAP001_B028_S0_P000_bf.raw -streamsToStorage[102].sourcePset: 25 -streamsToStorage[102].destStorageNode: locus037 -streamsToStorage[102].destDirectory: /data/L103821/ -streamsToStorage[102].adderNr: 2 -streamsToStorage[102].writerNr: 1 -streamsToStorage[103].dataProduct: Beamformed -streamsToStorage[103].dataProductNr: 2 -streamsToStorage[103].streamNr: 103 -streamsToStorage[103].filename: L103821_SAP001_B029_S0_P000_bf.raw -streamsToStorage[103].sourcePset: 25 -streamsToStorage[103].destStorageNode: locus038 -streamsToStorage[103].destDirectory: /data/L103821/ -streamsToStorage[103].adderNr: 3 -streamsToStorage[103].writerNr: 1 -streamsToStorage[104].dataProduct: Beamformed -streamsToStorage[104].dataProductNr: 2 -streamsToStorage[104].streamNr: 104 -streamsToStorage[104].filename: L103821_SAP001_B030_S0_P000_bf.raw -streamsToStorage[104].sourcePset: 26 -streamsToStorage[104].destStorageNode: locus040 -streamsToStorage[104].destDirectory: /data/L103821/ -streamsToStorage[104].adderNr: 0 -streamsToStorage[104].writerNr: 1 -streamsToStorage[105].dataProduct: Beamformed -streamsToStorage[105].dataProductNr: 2 -streamsToStorage[105].streamNr: 105 -streamsToStorage[105].filename: L103821_SAP001_B031_S0_P000_bf.raw -streamsToStorage[105].sourcePset: 26 -streamsToStorage[105].destStorageNode: locus041 -streamsToStorage[105].destDirectory: /data/L103821/ -streamsToStorage[105].adderNr: 1 -streamsToStorage[105].writerNr: 1 -streamsToStorage[106].dataProduct: Beamformed -streamsToStorage[106].dataProductNr: 2 -streamsToStorage[106].streamNr: 106 -streamsToStorage[106].filename: L103821_SAP001_B032_S0_P000_bf.raw -streamsToStorage[106].sourcePset: 26 -streamsToStorage[106].destStorageNode: locus042 -streamsToStorage[106].destDirectory: /data/L103821/ -streamsToStorage[106].adderNr: 2 -streamsToStorage[106].writerNr: 1 -streamsToStorage[107].dataProduct: Beamformed -streamsToStorage[107].dataProductNr: 2 -streamsToStorage[107].streamNr: 107 -streamsToStorage[107].filename: L103821_SAP001_B033_S0_P000_bf.raw -streamsToStorage[107].sourcePset: 26 -streamsToStorage[107].destStorageNode: locus043 -streamsToStorage[107].destDirectory: /data/L103821/ -streamsToStorage[107].adderNr: 3 -streamsToStorage[107].writerNr: 1 -streamsToStorage[108].dataProduct: Beamformed -streamsToStorage[108].dataProductNr: 2 -streamsToStorage[108].streamNr: 108 -streamsToStorage[108].filename: L103821_SAP001_B034_S0_P000_bf.raw -streamsToStorage[108].sourcePset: 27 -streamsToStorage[108].destStorageNode: locus044 -streamsToStorage[108].destDirectory: /data/L103821/ -streamsToStorage[108].adderNr: 0 -streamsToStorage[108].writerNr: 1 -streamsToStorage[109].dataProduct: Beamformed -streamsToStorage[109].dataProductNr: 2 -streamsToStorage[109].streamNr: 109 -streamsToStorage[109].filename: L103821_SAP001_B035_S0_P000_bf.raw -streamsToStorage[109].sourcePset: 27 -streamsToStorage[109].destStorageNode: locus045 -streamsToStorage[109].destDirectory: /data/L103821/ -streamsToStorage[109].adderNr: 1 -streamsToStorage[109].writerNr: 1 -streamsToStorage[110].dataProduct: Beamformed -streamsToStorage[110].dataProductNr: 2 -streamsToStorage[110].streamNr: 110 -streamsToStorage[110].filename: L103821_SAP001_B036_S0_P000_bf.raw -streamsToStorage[110].sourcePset: 27 -streamsToStorage[110].destStorageNode: locus046 -streamsToStorage[110].destDirectory: /data/L103821/ -streamsToStorage[110].adderNr: 2 -streamsToStorage[110].writerNr: 1 -streamsToStorage[111].dataProduct: Beamformed -streamsToStorage[111].dataProductNr: 2 -streamsToStorage[111].streamNr: 111 -streamsToStorage[111].filename: L103821_SAP001_B037_S0_P000_bf.raw -streamsToStorage[111].sourcePset: 27 -streamsToStorage[111].destStorageNode: locus047 -streamsToStorage[111].destDirectory: /data/L103821/ -streamsToStorage[111].adderNr: 3 -streamsToStorage[111].writerNr: 1 -streamsToStorage[112].dataProduct: Beamformed -streamsToStorage[112].dataProductNr: 2 -streamsToStorage[112].streamNr: 112 -streamsToStorage[112].filename: L103821_SAP001_B038_S0_P000_bf.raw -streamsToStorage[112].sourcePset: 28 -streamsToStorage[112].destStorageNode: locus049 -streamsToStorage[112].destDirectory: /data/L103821/ -streamsToStorage[112].adderNr: 0 -streamsToStorage[112].writerNr: 1 -streamsToStorage[113].dataProduct: Beamformed -streamsToStorage[113].dataProductNr: 2 -streamsToStorage[113].streamNr: 113 -streamsToStorage[113].filename: L103821_SAP001_B039_S0_P000_bf.raw -streamsToStorage[113].sourcePset: 28 -streamsToStorage[113].destStorageNode: locus050 -streamsToStorage[113].destDirectory: /data/L103821/ -streamsToStorage[113].adderNr: 1 -streamsToStorage[113].writerNr: 1 -streamsToStorage[114].dataProduct: Beamformed -streamsToStorage[114].dataProductNr: 2 -streamsToStorage[114].streamNr: 114 -streamsToStorage[114].filename: L103821_SAP001_B040_S0_P000_bf.raw -streamsToStorage[114].sourcePset: 28 -streamsToStorage[114].destStorageNode: locus051 -streamsToStorage[114].destDirectory: /data/L103821/ -streamsToStorage[114].adderNr: 2 -streamsToStorage[114].writerNr: 1 -streamsToStorage[115].dataProduct: Beamformed -streamsToStorage[115].dataProductNr: 2 -streamsToStorage[115].streamNr: 115 -streamsToStorage[115].filename: L103821_SAP001_B041_S0_P000_bf.raw -streamsToStorage[115].sourcePset: 28 -streamsToStorage[115].destStorageNode: locus052 -streamsToStorage[115].destDirectory: /data/L103821/ -streamsToStorage[115].adderNr: 3 -streamsToStorage[115].writerNr: 1 -streamsToStorage[116].dataProduct: Beamformed -streamsToStorage[116].dataProductNr: 2 -streamsToStorage[116].streamNr: 116 -streamsToStorage[116].filename: L103821_SAP001_B042_S0_P000_bf.raw -streamsToStorage[116].sourcePset: 29 -streamsToStorage[116].destStorageNode: locus054 -streamsToStorage[116].destDirectory: /data/L103821/ -streamsToStorage[116].adderNr: 0 -streamsToStorage[116].writerNr: 1 -streamsToStorage[117].dataProduct: Beamformed -streamsToStorage[117].dataProductNr: 2 -streamsToStorage[117].streamNr: 117 -streamsToStorage[117].filename: L103821_SAP001_B043_S0_P000_bf.raw -streamsToStorage[117].sourcePset: 29 -streamsToStorage[117].destStorageNode: locus056 -streamsToStorage[117].destDirectory: /data/L103821/ -streamsToStorage[117].adderNr: 1 -streamsToStorage[117].writerNr: 1 -streamsToStorage[118].dataProduct: Beamformed -streamsToStorage[118].dataProductNr: 2 -streamsToStorage[118].streamNr: 118 -streamsToStorage[118].filename: L103821_SAP001_B044_S0_P000_bf.raw -streamsToStorage[118].sourcePset: 29 -streamsToStorage[118].destStorageNode: locus057 -streamsToStorage[118].destDirectory: /data/L103821/ -streamsToStorage[118].adderNr: 2 -streamsToStorage[118].writerNr: 1 -streamsToStorage[119].dataProduct: Beamformed -streamsToStorage[119].dataProductNr: 2 -streamsToStorage[119].streamNr: 119 -streamsToStorage[119].filename: L103821_SAP001_B045_S0_P000_bf.raw -streamsToStorage[119].sourcePset: 29 -streamsToStorage[119].destStorageNode: locus058 -streamsToStorage[119].destDirectory: /data/L103821/ -streamsToStorage[119].adderNr: 3 -streamsToStorage[119].writerNr: 1 -streamsToStorage[120].dataProduct: Beamformed -streamsToStorage[120].dataProductNr: 2 -streamsToStorage[120].streamNr: 120 -streamsToStorage[120].filename: L103821_SAP001_B046_S0_P000_bf.raw -streamsToStorage[120].sourcePset: 30 -streamsToStorage[120].destStorageNode: locus060 -streamsToStorage[120].destDirectory: /data/L103821/ -streamsToStorage[120].adderNr: 0 -streamsToStorage[120].writerNr: 1 -streamsToStorage[121].dataProduct: Beamformed -streamsToStorage[121].dataProductNr: 2 -streamsToStorage[121].streamNr: 121 -streamsToStorage[121].filename: L103821_SAP001_B047_S0_P000_bf.raw -streamsToStorage[121].sourcePset: 30 -streamsToStorage[121].destStorageNode: locus061 -streamsToStorage[121].destDirectory: /data/L103821/ -streamsToStorage[121].adderNr: 1 -streamsToStorage[121].writerNr: 1 -streamsToStorage[122].dataProduct: Beamformed -streamsToStorage[122].dataProductNr: 2 -streamsToStorage[122].streamNr: 122 -streamsToStorage[122].filename: L103821_SAP001_B048_S0_P000_bf.raw -streamsToStorage[122].sourcePset: 30 -streamsToStorage[122].destStorageNode: locus062 -streamsToStorage[122].destDirectory: /data/L103821/ -streamsToStorage[122].adderNr: 2 -streamsToStorage[122].writerNr: 1 -streamsToStorage[123].dataProduct: Beamformed -streamsToStorage[123].dataProductNr: 2 -streamsToStorage[123].streamNr: 123 -streamsToStorage[123].filename: L103821_SAP001_B049_S0_P000_bf.raw -streamsToStorage[123].sourcePset: 30 -streamsToStorage[123].destStorageNode: locus063 -streamsToStorage[123].destDirectory: /data/L103821/ -streamsToStorage[123].adderNr: 3 -streamsToStorage[123].writerNr: 1 -streamsToStorage[124].dataProduct: Beamformed -streamsToStorage[124].dataProductNr: 2 -streamsToStorage[124].streamNr: 124 -streamsToStorage[124].filename: L103821_SAP001_B050_S0_P000_bf.raw -streamsToStorage[124].sourcePset: 31 -streamsToStorage[124].destStorageNode: locus064 -streamsToStorage[124].destDirectory: /data/L103821/ -streamsToStorage[124].adderNr: 0 -streamsToStorage[124].writerNr: 1 -streamsToStorage[125].dataProduct: Beamformed -streamsToStorage[125].dataProductNr: 2 -streamsToStorage[125].streamNr: 125 -streamsToStorage[125].filename: L103821_SAP001_B051_S0_P000_bf.raw -streamsToStorage[125].sourcePset: 31 -streamsToStorage[125].destStorageNode: locus065 -streamsToStorage[125].destDirectory: /data/L103821/ -streamsToStorage[125].adderNr: 1 -streamsToStorage[125].writerNr: 1 -streamsToStorage[126].dataProduct: Beamformed -streamsToStorage[126].dataProductNr: 2 -streamsToStorage[126].streamNr: 126 -streamsToStorage[126].filename: L103821_SAP001_B052_S0_P000_bf.raw -streamsToStorage[126].sourcePset: 31 -streamsToStorage[126].destStorageNode: locus067 -streamsToStorage[126].destDirectory: /data/L103821/ -streamsToStorage[126].adderNr: 2 -streamsToStorage[126].writerNr: 1 -streamsToStorage[127].dataProduct: Beamformed -streamsToStorage[127].dataProductNr: 2 -streamsToStorage[127].streamNr: 127 -streamsToStorage[127].filename: L103821_SAP001_B053_S0_P000_bf.raw -streamsToStorage[127].sourcePset: 31 -streamsToStorage[127].destStorageNode: locus068 -streamsToStorage[127].destDirectory: /data/L103821/ -streamsToStorage[127].adderNr: 3 -streamsToStorage[127].writerNr: 1 -streamsToStorage[128].dataProduct: Beamformed -streamsToStorage[128].dataProductNr: 2 -streamsToStorage[128].streamNr: 128 -streamsToStorage[128].filename: L103821_SAP001_B054_S0_P000_bf.raw -streamsToStorage[128].sourcePset: 32 -streamsToStorage[128].destStorageNode: locus069 -streamsToStorage[128].destDirectory: /data/L103821/ -streamsToStorage[128].adderNr: 0 -streamsToStorage[128].writerNr: 1 -streamsToStorage[129].dataProduct: Beamformed -streamsToStorage[129].dataProductNr: 2 -streamsToStorage[129].streamNr: 129 -streamsToStorage[129].filename: L103821_SAP001_B055_S0_P000_bf.raw -streamsToStorage[129].sourcePset: 32 -streamsToStorage[129].destStorageNode: locus070 -streamsToStorage[129].destDirectory: /data/L103821/ -streamsToStorage[129].adderNr: 1 -streamsToStorage[129].writerNr: 1 -streamsToStorage[130].dataProduct: Beamformed -streamsToStorage[130].dataProductNr: 2 -streamsToStorage[130].streamNr: 130 -streamsToStorage[130].filename: L103821_SAP001_B056_S0_P000_bf.raw -streamsToStorage[130].sourcePset: 32 -streamsToStorage[130].destStorageNode: locus071 -streamsToStorage[130].destDirectory: /data/L103821/ -streamsToStorage[130].adderNr: 2 -streamsToStorage[130].writerNr: 1 -streamsToStorage[131].dataProduct: Beamformed -streamsToStorage[131].dataProductNr: 2 -streamsToStorage[131].streamNr: 131 -streamsToStorage[131].filename: L103821_SAP001_B057_S0_P000_bf.raw -streamsToStorage[131].sourcePset: 32 -streamsToStorage[131].destStorageNode: locus073 -streamsToStorage[131].destDirectory: /data/L103821/ -streamsToStorage[131].adderNr: 3 -streamsToStorage[131].writerNr: 1 -streamsToStorage[132].dataProduct: Beamformed -streamsToStorage[132].dataProductNr: 2 -streamsToStorage[132].streamNr: 132 -streamsToStorage[132].filename: L103821_SAP001_B058_S0_P000_bf.raw -streamsToStorage[132].sourcePset: 33 -streamsToStorage[132].destStorageNode: locus074 -streamsToStorage[132].destDirectory: /data/L103821/ -streamsToStorage[132].adderNr: 0 -streamsToStorage[132].writerNr: 1 -streamsToStorage[133].dataProduct: Beamformed -streamsToStorage[133].dataProductNr: 2 -streamsToStorage[133].streamNr: 133 -streamsToStorage[133].filename: L103821_SAP001_B059_S0_P000_bf.raw -streamsToStorage[133].sourcePset: 33 -streamsToStorage[133].destStorageNode: locus075 -streamsToStorage[133].destDirectory: /data/L103821/ -streamsToStorage[133].adderNr: 1 -streamsToStorage[133].writerNr: 1 -streamsToStorage[134].dataProduct: Beamformed -streamsToStorage[134].dataProductNr: 2 -streamsToStorage[134].streamNr: 134 -streamsToStorage[134].filename: L103821_SAP001_B060_S0_P000_bf.raw -streamsToStorage[134].sourcePset: 33 -streamsToStorage[134].destStorageNode: locus076 -streamsToStorage[134].destDirectory: /data/L103821/ -streamsToStorage[134].adderNr: 2 -streamsToStorage[134].writerNr: 1 -streamsToStorage[135].dataProduct: Beamformed -streamsToStorage[135].dataProductNr: 2 -streamsToStorage[135].streamNr: 135 -streamsToStorage[135].filename: L103821_SAP001_B061_S0_P000_bf.raw -streamsToStorage[135].sourcePset: 33 -streamsToStorage[135].destStorageNode: locus077 -streamsToStorage[135].destDirectory: /data/L103821/ -streamsToStorage[135].adderNr: 3 -streamsToStorage[135].writerNr: 1 -streamsToStorage[136].dataProduct: Beamformed -streamsToStorage[136].dataProductNr: 2 -streamsToStorage[136].streamNr: 136 -streamsToStorage[136].filename: L103821_SAP001_B062_S0_P000_bf.raw -streamsToStorage[136].sourcePset: 34 -streamsToStorage[136].destStorageNode: locus078 -streamsToStorage[136].destDirectory: /data/L103821/ -streamsToStorage[136].adderNr: 0 -streamsToStorage[136].writerNr: 1 -streamsToStorage[137].dataProduct: Beamformed -streamsToStorage[137].dataProductNr: 2 -streamsToStorage[137].streamNr: 137 -streamsToStorage[137].filename: L103821_SAP001_B063_S0_P000_bf.raw -streamsToStorage[137].sourcePset: 34 -streamsToStorage[137].destStorageNode: locus079 -streamsToStorage[137].destDirectory: /data/L103821/ -streamsToStorage[137].adderNr: 1 -streamsToStorage[137].writerNr: 1 -streamsToStorage[138].dataProduct: Beamformed -streamsToStorage[138].dataProductNr: 2 -streamsToStorage[138].streamNr: 138 -streamsToStorage[138].filename: L103821_SAP001_B064_S0_P000_bf.raw -streamsToStorage[138].sourcePset: 34 -streamsToStorage[138].destStorageNode: locus081 -streamsToStorage[138].destDirectory: /data/L103821/ -streamsToStorage[138].adderNr: 2 -streamsToStorage[138].writerNr: 1 -streamsToStorage[139].dataProduct: Beamformed -streamsToStorage[139].dataProductNr: 2 -streamsToStorage[139].streamNr: 139 -streamsToStorage[139].filename: L103821_SAP001_B065_S0_P000_bf.raw -streamsToStorage[139].sourcePset: 34 -streamsToStorage[139].destStorageNode: locus082 -streamsToStorage[139].destDirectory: /data/L103821/ -streamsToStorage[139].adderNr: 3 -streamsToStorage[139].writerNr: 1 -streamsToStorage[140].dataProduct: Beamformed -streamsToStorage[140].dataProductNr: 2 -streamsToStorage[140].streamNr: 140 -streamsToStorage[140].filename: L103821_SAP001_B066_S0_P000_bf.raw -streamsToStorage[140].sourcePset: 35 -streamsToStorage[140].destStorageNode: locus084 -streamsToStorage[140].destDirectory: /data/L103821/ -streamsToStorage[140].adderNr: 0 -streamsToStorage[140].writerNr: 1 -streamsToStorage[141].dataProduct: Beamformed -streamsToStorage[141].dataProductNr: 2 -streamsToStorage[141].streamNr: 141 -streamsToStorage[141].filename: L103821_SAP001_B067_S0_P000_bf.raw -streamsToStorage[141].sourcePset: 35 -streamsToStorage[141].destStorageNode: locus085 -streamsToStorage[141].destDirectory: /data/L103821/ -streamsToStorage[141].adderNr: 1 -streamsToStorage[141].writerNr: 1 -streamsToStorage[142].dataProduct: Beamformed -streamsToStorage[142].dataProductNr: 2 -streamsToStorage[142].streamNr: 142 -streamsToStorage[142].filename: L103821_SAP001_B068_S0_P000_bf.raw -streamsToStorage[142].sourcePset: 35 -streamsToStorage[142].destStorageNode: locus086 -streamsToStorage[142].destDirectory: /data/L103821/ -streamsToStorage[142].adderNr: 2 -streamsToStorage[142].writerNr: 1 -streamsToStorage[143].dataProduct: Beamformed -streamsToStorage[143].dataProductNr: 2 -streamsToStorage[143].streamNr: 143 -streamsToStorage[143].filename: L103821_SAP001_B069_S0_P000_bf.raw -streamsToStorage[143].sourcePset: 35 -streamsToStorage[143].destStorageNode: locus087 -streamsToStorage[143].destDirectory: /data/L103821/ -streamsToStorage[143].adderNr: 3 -streamsToStorage[143].writerNr: 1 -streamsToStorage[144].dataProduct: Beamformed -streamsToStorage[144].dataProductNr: 2 -streamsToStorage[144].streamNr: 144 -streamsToStorage[144].filename: L103821_SAP001_B070_S0_P000_bf.raw -streamsToStorage[144].sourcePset: 36 -streamsToStorage[144].destStorageNode: locus088 -streamsToStorage[144].destDirectory: /data/L103821/ -streamsToStorage[144].adderNr: 0 -streamsToStorage[144].writerNr: 1 -streamsToStorage[145].dataProduct: Beamformed -streamsToStorage[145].dataProductNr: 2 -streamsToStorage[145].streamNr: 145 -streamsToStorage[145].filename: L103821_SAP001_B071_S0_P000_bf.raw -streamsToStorage[145].sourcePset: 36 -streamsToStorage[145].destStorageNode: locus090 -streamsToStorage[145].destDirectory: /data/L103821/ -streamsToStorage[145].adderNr: 1 -streamsToStorage[145].writerNr: 1 -streamsToStorage[146].dataProduct: Beamformed -streamsToStorage[146].dataProductNr: 2 -streamsToStorage[146].streamNr: 146 -streamsToStorage[146].filename: L103821_SAP001_B072_S0_P000_bf.raw -streamsToStorage[146].sourcePset: 36 -streamsToStorage[146].destStorageNode: locus093 -streamsToStorage[146].destDirectory: /data/L103821/ -streamsToStorage[146].adderNr: 2 -streamsToStorage[146].writerNr: 1 -streamsToStorage[147].dataProduct: Beamformed -streamsToStorage[147].dataProductNr: 2 -streamsToStorage[147].streamNr: 147 -streamsToStorage[147].filename: L103821_SAP001_B073_S0_P000_bf.raw -streamsToStorage[147].sourcePset: 36 -streamsToStorage[147].destStorageNode: locus094 -streamsToStorage[147].destDirectory: /data/L103821/ -streamsToStorage[147].adderNr: 3 -streamsToStorage[147].writerNr: 1 -streamsToStorage[148].dataProduct: Beamformed -streamsToStorage[148].dataProductNr: 2 -streamsToStorage[148].streamNr: 148 -streamsToStorage[148].filename: L103821_SAP002_B000_S0_P000_bf.raw -streamsToStorage[148].sourcePset: 37 -streamsToStorage[148].destStorageNode: locus001 -streamsToStorage[148].destDirectory: /data/L103821/ -streamsToStorage[148].adderNr: 0 -streamsToStorage[148].writerNr: 2 -streamsToStorage[149].dataProduct: Beamformed -streamsToStorage[149].dataProductNr: 2 -streamsToStorage[149].streamNr: 149 -streamsToStorage[149].filename: L103821_SAP002_B001_S0_P000_bf.raw -streamsToStorage[149].sourcePset: 37 -streamsToStorage[149].destStorageNode: locus003 -streamsToStorage[149].destDirectory: /data/L103821/ -streamsToStorage[149].adderNr: 1 -streamsToStorage[149].writerNr: 3 -streamsToStorage[150].dataProduct: Beamformed -streamsToStorage[150].dataProductNr: 2 -streamsToStorage[150].streamNr: 150 -streamsToStorage[150].filename: L103821_SAP002_B002_S0_P000_bf.raw -streamsToStorage[150].sourcePset: 37 -streamsToStorage[150].destStorageNode: locus004 -streamsToStorage[150].destDirectory: /data/L103821/ -streamsToStorage[150].adderNr: 2 -streamsToStorage[150].writerNr: 2 -streamsToStorage[151].dataProduct: Beamformed -streamsToStorage[151].dataProductNr: 2 -streamsToStorage[151].streamNr: 151 -streamsToStorage[151].filename: L103821_SAP002_B003_S0_P000_bf.raw -streamsToStorage[151].sourcePset: 37 -streamsToStorage[151].destStorageNode: locus005 -streamsToStorage[151].destDirectory: /data/L103821/ -streamsToStorage[151].adderNr: 3 -streamsToStorage[151].writerNr: 2 -streamsToStorage[152].dataProduct: Beamformed -streamsToStorage[152].dataProductNr: 2 -streamsToStorage[152].streamNr: 152 -streamsToStorage[152].filename: L103821_SAP002_B004_S0_P000_bf.raw -streamsToStorage[152].sourcePset: 38 -streamsToStorage[152].destStorageNode: locus006 -streamsToStorage[152].destDirectory: /data/L103821/ -streamsToStorage[152].adderNr: 0 -streamsToStorage[152].writerNr: 2 -streamsToStorage[153].dataProduct: Beamformed -streamsToStorage[153].dataProductNr: 2 -streamsToStorage[153].streamNr: 153 -streamsToStorage[153].filename: L103821_SAP002_B005_S0_P000_bf.raw -streamsToStorage[153].sourcePset: 38 -streamsToStorage[153].destStorageNode: locus007 -streamsToStorage[153].destDirectory: /data/L103821/ -streamsToStorage[153].adderNr: 1 -streamsToStorage[153].writerNr: 2 -streamsToStorage[154].dataProduct: Beamformed -streamsToStorage[154].dataProductNr: 2 -streamsToStorage[154].streamNr: 154 -streamsToStorage[154].filename: L103821_SAP002_B006_S0_P000_bf.raw -streamsToStorage[154].sourcePset: 38 -streamsToStorage[154].destStorageNode: locus008 -streamsToStorage[154].destDirectory: /data/L103821/ -streamsToStorage[154].adderNr: 2 -streamsToStorage[154].writerNr: 2 -streamsToStorage[155].dataProduct: Beamformed -streamsToStorage[155].dataProductNr: 2 -streamsToStorage[155].streamNr: 155 -streamsToStorage[155].filename: L103821_SAP002_B007_S0_P000_bf.raw -streamsToStorage[155].sourcePset: 38 -streamsToStorage[155].destStorageNode: locus009 -streamsToStorage[155].destDirectory: /data/L103821/ -streamsToStorage[155].adderNr: 3 -streamsToStorage[155].writerNr: 2 -streamsToStorage[156].dataProduct: Beamformed -streamsToStorage[156].dataProductNr: 2 -streamsToStorage[156].streamNr: 156 -streamsToStorage[156].filename: L103821_SAP002_B008_S0_P000_bf.raw -streamsToStorage[156].sourcePset: 39 -streamsToStorage[156].destStorageNode: locus010 -streamsToStorage[156].destDirectory: /data/L103821/ -streamsToStorage[156].adderNr: 0 -streamsToStorage[156].writerNr: 2 -streamsToStorage[157].dataProduct: Beamformed -streamsToStorage[157].dataProductNr: 2 -streamsToStorage[157].streamNr: 157 -streamsToStorage[157].filename: L103821_SAP002_B009_S0_P000_bf.raw -streamsToStorage[157].sourcePset: 39 -streamsToStorage[157].destStorageNode: locus011 -streamsToStorage[157].destDirectory: /data/L103821/ -streamsToStorage[157].adderNr: 1 -streamsToStorage[157].writerNr: 2 -streamsToStorage[158].dataProduct: Beamformed -streamsToStorage[158].dataProductNr: 2 -streamsToStorage[158].streamNr: 158 -streamsToStorage[158].filename: L103821_SAP002_B010_S0_P000_bf.raw -streamsToStorage[158].sourcePset: 39 -streamsToStorage[158].destStorageNode: locus012 -streamsToStorage[158].destDirectory: /data/L103821/ -streamsToStorage[158].adderNr: 2 -streamsToStorage[158].writerNr: 2 -streamsToStorage[159].dataProduct: Beamformed -streamsToStorage[159].dataProductNr: 2 -streamsToStorage[159].streamNr: 159 -streamsToStorage[159].filename: L103821_SAP002_B011_S0_P000_bf.raw -streamsToStorage[159].sourcePset: 39 -streamsToStorage[159].destStorageNode: locus013 -streamsToStorage[159].destDirectory: /data/L103821/ -streamsToStorage[159].adderNr: 3 -streamsToStorage[159].writerNr: 2 -streamsToStorage[160].dataProduct: Beamformed -streamsToStorage[160].dataProductNr: 2 -streamsToStorage[160].streamNr: 160 -streamsToStorage[160].filename: L103821_SAP002_B012_S0_P000_bf.raw -streamsToStorage[160].sourcePset: 40 -streamsToStorage[160].destStorageNode: locus069 -streamsToStorage[160].destDirectory: /data/L103821/ -streamsToStorage[160].adderNr: 0 -streamsToStorage[160].writerNr: 2 -streamsToStorage[161].dataProduct: Beamformed -streamsToStorage[161].dataProductNr: 2 -streamsToStorage[161].streamNr: 161 -streamsToStorage[161].filename: L103821_SAP002_B013_S0_P000_bf.raw -streamsToStorage[161].sourcePset: 40 -streamsToStorage[161].destStorageNode: locus014 -streamsToStorage[161].destDirectory: /data/L103821/ -streamsToStorage[161].adderNr: 1 -streamsToStorage[161].writerNr: 2 -streamsToStorage[162].dataProduct: Beamformed -streamsToStorage[162].dataProductNr: 2 -streamsToStorage[162].streamNr: 162 -streamsToStorage[162].filename: L103821_SAP002_B014_S0_P000_bf.raw -streamsToStorage[162].sourcePset: 40 -streamsToStorage[162].destStorageNode: locus015 -streamsToStorage[162].destDirectory: /data/L103821/ -streamsToStorage[162].adderNr: 2 -streamsToStorage[162].writerNr: 2 -streamsToStorage[163].dataProduct: Beamformed -streamsToStorage[163].dataProductNr: 2 -streamsToStorage[163].streamNr: 163 -streamsToStorage[163].filename: L103821_SAP002_B015_S0_P000_bf.raw -streamsToStorage[163].sourcePset: 40 -streamsToStorage[163].destStorageNode: locus017 -streamsToStorage[163].destDirectory: /data/L103821/ -streamsToStorage[163].adderNr: 3 -streamsToStorage[163].writerNr: 2 -streamsToStorage[164].dataProduct: Beamformed -streamsToStorage[164].dataProductNr: 2 -streamsToStorage[164].streamNr: 164 -streamsToStorage[164].filename: L103821_SAP002_B016_S0_P000_bf.raw -streamsToStorage[164].sourcePset: 41 -streamsToStorage[164].destStorageNode: locus019 -streamsToStorage[164].destDirectory: /data/L103821/ -streamsToStorage[164].adderNr: 0 -streamsToStorage[164].writerNr: 2 -streamsToStorage[165].dataProduct: Beamformed -streamsToStorage[165].dataProductNr: 2 -streamsToStorage[165].streamNr: 165 -streamsToStorage[165].filename: L103821_SAP002_B017_S0_P000_bf.raw -streamsToStorage[165].sourcePset: 41 -streamsToStorage[165].destStorageNode: locus020 -streamsToStorage[165].destDirectory: /data/L103821/ -streamsToStorage[165].adderNr: 1 -streamsToStorage[165].writerNr: 2 -streamsToStorage[166].dataProduct: Beamformed -streamsToStorage[166].dataProductNr: 2 -streamsToStorage[166].streamNr: 166 -streamsToStorage[166].filename: L103821_SAP002_B018_S0_P000_bf.raw -streamsToStorage[166].sourcePset: 41 -streamsToStorage[166].destStorageNode: locus023 -streamsToStorage[166].destDirectory: /data/L103821/ -streamsToStorage[166].adderNr: 2 -streamsToStorage[166].writerNr: 2 -streamsToStorage[167].dataProduct: Beamformed -streamsToStorage[167].dataProductNr: 2 -streamsToStorage[167].streamNr: 167 -streamsToStorage[167].filename: L103821_SAP002_B019_S0_P000_bf.raw -streamsToStorage[167].sourcePset: 41 -streamsToStorage[167].destStorageNode: locus025 -streamsToStorage[167].destDirectory: /data/L103821/ -streamsToStorage[167].adderNr: 3 -streamsToStorage[167].writerNr: 2 -streamsToStorage[168].dataProduct: Beamformed -streamsToStorage[168].dataProductNr: 2 -streamsToStorage[168].streamNr: 168 -streamsToStorage[168].filename: L103821_SAP002_B020_S0_P000_bf.raw -streamsToStorage[168].sourcePset: 42 -streamsToStorage[168].destStorageNode: locus026 -streamsToStorage[168].destDirectory: /data/L103821/ -streamsToStorage[168].adderNr: 0 -streamsToStorage[168].writerNr: 2 -streamsToStorage[169].dataProduct: Beamformed -streamsToStorage[169].dataProductNr: 2 -streamsToStorage[169].streamNr: 169 -streamsToStorage[169].filename: L103821_SAP002_B021_S0_P000_bf.raw -streamsToStorage[169].sourcePset: 42 -streamsToStorage[169].destStorageNode: locus027 -streamsToStorage[169].destDirectory: /data/L103821/ -streamsToStorage[169].adderNr: 1 -streamsToStorage[169].writerNr: 2 -streamsToStorage[170].dataProduct: Beamformed -streamsToStorage[170].dataProductNr: 2 -streamsToStorage[170].streamNr: 170 -streamsToStorage[170].filename: L103821_SAP002_B022_S0_P000_bf.raw -streamsToStorage[170].sourcePset: 42 -streamsToStorage[170].destStorageNode: locus028 -streamsToStorage[170].destDirectory: /data/L103821/ -streamsToStorage[170].adderNr: 2 -streamsToStorage[170].writerNr: 2 -streamsToStorage[171].dataProduct: Beamformed -streamsToStorage[171].dataProductNr: 2 -streamsToStorage[171].streamNr: 171 -streamsToStorage[171].filename: L103821_SAP002_B023_S0_P000_bf.raw -streamsToStorage[171].sourcePset: 42 -streamsToStorage[171].destStorageNode: locus029 -streamsToStorage[171].destDirectory: /data/L103821/ -streamsToStorage[171].adderNr: 3 -streamsToStorage[171].writerNr: 2 -streamsToStorage[172].dataProduct: Beamformed -streamsToStorage[172].dataProductNr: 2 -streamsToStorage[172].streamNr: 172 -streamsToStorage[172].filename: L103821_SAP002_B024_S0_P000_bf.raw -streamsToStorage[172].sourcePset: 43 -streamsToStorage[172].destStorageNode: locus030 -streamsToStorage[172].destDirectory: /data/L103821/ -streamsToStorage[172].adderNr: 0 -streamsToStorage[172].writerNr: 2 -streamsToStorage[173].dataProduct: Beamformed -streamsToStorage[173].dataProductNr: 2 -streamsToStorage[173].streamNr: 173 -streamsToStorage[173].filename: L103821_SAP002_B025_S0_P000_bf.raw -streamsToStorage[173].sourcePset: 43 -streamsToStorage[173].destStorageNode: locus031 -streamsToStorage[173].destDirectory: /data/L103821/ -streamsToStorage[173].adderNr: 1 -streamsToStorage[173].writerNr: 2 -streamsToStorage[174].dataProduct: Beamformed -streamsToStorage[174].dataProductNr: 2 -streamsToStorage[174].streamNr: 174 -streamsToStorage[174].filename: L103821_SAP002_B026_S0_P000_bf.raw -streamsToStorage[174].sourcePset: 43 -streamsToStorage[174].destStorageNode: locus032 -streamsToStorage[174].destDirectory: /data/L103821/ -streamsToStorage[174].adderNr: 2 -streamsToStorage[174].writerNr: 2 -streamsToStorage[175].dataProduct: Beamformed -streamsToStorage[175].dataProductNr: 2 -streamsToStorage[175].streamNr: 175 -streamsToStorage[175].filename: L103821_SAP002_B027_S0_P000_bf.raw -streamsToStorage[175].sourcePset: 43 -streamsToStorage[175].destStorageNode: locus034 -streamsToStorage[175].destDirectory: /data/L103821/ -streamsToStorage[175].adderNr: 3 -streamsToStorage[175].writerNr: 2 -streamsToStorage[176].dataProduct: Beamformed -streamsToStorage[176].dataProductNr: 2 -streamsToStorage[176].streamNr: 176 -streamsToStorage[176].filename: L103821_SAP002_B028_S0_P000_bf.raw -streamsToStorage[176].sourcePset: 44 -streamsToStorage[176].destStorageNode: locus037 -streamsToStorage[176].destDirectory: /data/L103821/ -streamsToStorage[176].adderNr: 0 -streamsToStorage[176].writerNr: 2 -streamsToStorage[177].dataProduct: Beamformed -streamsToStorage[177].dataProductNr: 2 -streamsToStorage[177].streamNr: 177 -streamsToStorage[177].filename: L103821_SAP002_B029_S0_P000_bf.raw -streamsToStorage[177].sourcePset: 44 -streamsToStorage[177].destStorageNode: locus038 -streamsToStorage[177].destDirectory: /data/L103821/ -streamsToStorage[177].adderNr: 1 -streamsToStorage[177].writerNr: 2 -streamsToStorage[178].dataProduct: Beamformed -streamsToStorage[178].dataProductNr: 2 -streamsToStorage[178].streamNr: 178 -streamsToStorage[178].filename: L103821_SAP002_B030_S0_P000_bf.raw -streamsToStorage[178].sourcePset: 44 -streamsToStorage[178].destStorageNode: locus040 -streamsToStorage[178].destDirectory: /data/L103821/ -streamsToStorage[178].adderNr: 2 -streamsToStorage[178].writerNr: 2 -streamsToStorage[179].dataProduct: Beamformed -streamsToStorage[179].dataProductNr: 2 -streamsToStorage[179].streamNr: 179 -streamsToStorage[179].filename: L103821_SAP002_B031_S0_P000_bf.raw -streamsToStorage[179].sourcePset: 44 -streamsToStorage[179].destStorageNode: locus041 -streamsToStorage[179].destDirectory: /data/L103821/ -streamsToStorage[179].adderNr: 3 -streamsToStorage[179].writerNr: 2 -streamsToStorage[180].dataProduct: Beamformed -streamsToStorage[180].dataProductNr: 2 -streamsToStorage[180].streamNr: 180 -streamsToStorage[180].filename: L103821_SAP002_B032_S0_P000_bf.raw -streamsToStorage[180].sourcePset: 45 -streamsToStorage[180].destStorageNode: locus042 -streamsToStorage[180].destDirectory: /data/L103821/ -streamsToStorage[180].adderNr: 0 -streamsToStorage[180].writerNr: 2 -streamsToStorage[181].dataProduct: Beamformed -streamsToStorage[181].dataProductNr: 2 -streamsToStorage[181].streamNr: 181 -streamsToStorage[181].filename: L103821_SAP002_B033_S0_P000_bf.raw -streamsToStorage[181].sourcePset: 45 -streamsToStorage[181].destStorageNode: locus043 -streamsToStorage[181].destDirectory: /data/L103821/ -streamsToStorage[181].adderNr: 1 -streamsToStorage[181].writerNr: 2 -streamsToStorage[182].dataProduct: Beamformed -streamsToStorage[182].dataProductNr: 2 -streamsToStorage[182].streamNr: 182 -streamsToStorage[182].filename: L103821_SAP002_B034_S0_P000_bf.raw -streamsToStorage[182].sourcePset: 45 -streamsToStorage[182].destStorageNode: locus044 -streamsToStorage[182].destDirectory: /data/L103821/ -streamsToStorage[182].adderNr: 2 -streamsToStorage[182].writerNr: 2 -streamsToStorage[183].dataProduct: Beamformed -streamsToStorage[183].dataProductNr: 2 -streamsToStorage[183].streamNr: 183 -streamsToStorage[183].filename: L103821_SAP002_B035_S0_P000_bf.raw -streamsToStorage[183].sourcePset: 45 -streamsToStorage[183].destStorageNode: locus045 -streamsToStorage[183].destDirectory: /data/L103821/ -streamsToStorage[183].adderNr: 3 -streamsToStorage[183].writerNr: 2 -streamsToStorage[184].dataProduct: Beamformed -streamsToStorage[184].dataProductNr: 2 -streamsToStorage[184].streamNr: 184 -streamsToStorage[184].filename: L103821_SAP002_B036_S0_P000_bf.raw -streamsToStorage[184].sourcePset: 46 -streamsToStorage[184].destStorageNode: locus046 -streamsToStorage[184].destDirectory: /data/L103821/ -streamsToStorage[184].adderNr: 0 -streamsToStorage[184].writerNr: 2 -streamsToStorage[185].dataProduct: Beamformed -streamsToStorage[185].dataProductNr: 2 -streamsToStorage[185].streamNr: 185 -streamsToStorage[185].filename: L103821_SAP002_B037_S0_P000_bf.raw -streamsToStorage[185].sourcePset: 46 -streamsToStorage[185].destStorageNode: locus047 -streamsToStorage[185].destDirectory: /data/L103821/ -streamsToStorage[185].adderNr: 1 -streamsToStorage[185].writerNr: 2 -streamsToStorage[186].dataProduct: Beamformed -streamsToStorage[186].dataProductNr: 2 -streamsToStorage[186].streamNr: 186 -streamsToStorage[186].filename: L103821_SAP002_B038_S0_P000_bf.raw -streamsToStorage[186].sourcePset: 46 -streamsToStorage[186].destStorageNode: locus049 -streamsToStorage[186].destDirectory: /data/L103821/ -streamsToStorage[186].adderNr: 2 -streamsToStorage[186].writerNr: 2 -streamsToStorage[187].dataProduct: Beamformed -streamsToStorage[187].dataProductNr: 2 -streamsToStorage[187].streamNr: 187 -streamsToStorage[187].filename: L103821_SAP002_B039_S0_P000_bf.raw -streamsToStorage[187].sourcePset: 46 -streamsToStorage[187].destStorageNode: locus050 -streamsToStorage[187].destDirectory: /data/L103821/ -streamsToStorage[187].adderNr: 3 -streamsToStorage[187].writerNr: 2 -streamsToStorage[188].dataProduct: Beamformed -streamsToStorage[188].dataProductNr: 2 -streamsToStorage[188].streamNr: 188 -streamsToStorage[188].filename: L103821_SAP002_B040_S0_P000_bf.raw -streamsToStorage[188].sourcePset: 47 -streamsToStorage[188].destStorageNode: locus051 -streamsToStorage[188].destDirectory: /data/L103821/ -streamsToStorage[188].adderNr: 0 -streamsToStorage[188].writerNr: 2 -streamsToStorage[189].dataProduct: Beamformed -streamsToStorage[189].dataProductNr: 2 -streamsToStorage[189].streamNr: 189 -streamsToStorage[189].filename: L103821_SAP002_B041_S0_P000_bf.raw -streamsToStorage[189].sourcePset: 47 -streamsToStorage[189].destStorageNode: locus052 -streamsToStorage[189].destDirectory: /data/L103821/ -streamsToStorage[189].adderNr: 1 -streamsToStorage[189].writerNr: 2 -streamsToStorage[190].dataProduct: Beamformed -streamsToStorage[190].dataProductNr: 2 -streamsToStorage[190].streamNr: 190 -streamsToStorage[190].filename: L103821_SAP002_B042_S0_P000_bf.raw -streamsToStorage[190].sourcePset: 47 -streamsToStorage[190].destStorageNode: locus054 -streamsToStorage[190].destDirectory: /data/L103821/ -streamsToStorage[190].adderNr: 2 -streamsToStorage[190].writerNr: 2 -streamsToStorage[191].dataProduct: Beamformed -streamsToStorage[191].dataProductNr: 2 -streamsToStorage[191].streamNr: 191 -streamsToStorage[191].filename: L103821_SAP002_B043_S0_P000_bf.raw -streamsToStorage[191].sourcePset: 47 -streamsToStorage[191].destStorageNode: locus056 -streamsToStorage[191].destDirectory: /data/L103821/ -streamsToStorage[191].adderNr: 3 -streamsToStorage[191].writerNr: 2 -streamsToStorage[192].dataProduct: Beamformed -streamsToStorage[192].dataProductNr: 2 -streamsToStorage[192].streamNr: 192 -streamsToStorage[192].filename: L103821_SAP002_B044_S0_P000_bf.raw -streamsToStorage[192].sourcePset: 48 -streamsToStorage[192].destStorageNode: locus057 -streamsToStorage[192].destDirectory: /data/L103821/ -streamsToStorage[192].adderNr: 0 -streamsToStorage[192].writerNr: 2 -streamsToStorage[193].dataProduct: Beamformed -streamsToStorage[193].dataProductNr: 2 -streamsToStorage[193].streamNr: 193 -streamsToStorage[193].filename: L103821_SAP002_B045_S0_P000_bf.raw -streamsToStorage[193].sourcePset: 48 -streamsToStorage[193].destStorageNode: locus058 -streamsToStorage[193].destDirectory: /data/L103821/ -streamsToStorage[193].adderNr: 1 -streamsToStorage[193].writerNr: 2 -streamsToStorage[194].dataProduct: Beamformed -streamsToStorage[194].dataProductNr: 2 -streamsToStorage[194].streamNr: 194 -streamsToStorage[194].filename: L103821_SAP002_B046_S0_P000_bf.raw -streamsToStorage[194].sourcePset: 48 -streamsToStorage[194].destStorageNode: locus060 -streamsToStorage[194].destDirectory: /data/L103821/ -streamsToStorage[194].adderNr: 2 -streamsToStorage[194].writerNr: 2 -streamsToStorage[195].dataProduct: Beamformed -streamsToStorage[195].dataProductNr: 2 -streamsToStorage[195].streamNr: 195 -streamsToStorage[195].filename: L103821_SAP002_B047_S0_P000_bf.raw -streamsToStorage[195].sourcePset: 48 -streamsToStorage[195].destStorageNode: locus061 -streamsToStorage[195].destDirectory: /data/L103821/ -streamsToStorage[195].adderNr: 3 -streamsToStorage[195].writerNr: 2 -streamsToStorage[196].dataProduct: Beamformed -streamsToStorage[196].dataProductNr: 2 -streamsToStorage[196].streamNr: 196 -streamsToStorage[196].filename: L103821_SAP002_B048_S0_P000_bf.raw -streamsToStorage[196].sourcePset: 49 -streamsToStorage[196].destStorageNode: locus062 -streamsToStorage[196].destDirectory: /data/L103821/ -streamsToStorage[196].adderNr: 0 -streamsToStorage[196].writerNr: 2 -streamsToStorage[197].dataProduct: Beamformed -streamsToStorage[197].dataProductNr: 2 -streamsToStorage[197].streamNr: 197 -streamsToStorage[197].filename: L103821_SAP002_B049_S0_P000_bf.raw -streamsToStorage[197].sourcePset: 49 -streamsToStorage[197].destStorageNode: locus063 -streamsToStorage[197].destDirectory: /data/L103821/ -streamsToStorage[197].adderNr: 1 -streamsToStorage[197].writerNr: 2 -streamsToStorage[198].dataProduct: Beamformed -streamsToStorage[198].dataProductNr: 2 -streamsToStorage[198].streamNr: 198 -streamsToStorage[198].filename: L103821_SAP002_B050_S0_P000_bf.raw -streamsToStorage[198].sourcePset: 49 -streamsToStorage[198].destStorageNode: locus064 -streamsToStorage[198].destDirectory: /data/L103821/ -streamsToStorage[198].adderNr: 2 -streamsToStorage[198].writerNr: 2 -streamsToStorage[199].dataProduct: Beamformed -streamsToStorage[199].dataProductNr: 2 -streamsToStorage[199].streamNr: 199 -streamsToStorage[199].filename: L103821_SAP002_B051_S0_P000_bf.raw -streamsToStorage[199].sourcePset: 49 -streamsToStorage[199].destStorageNode: locus065 -streamsToStorage[199].destDirectory: /data/L103821/ -streamsToStorage[199].adderNr: 3 -streamsToStorage[199].writerNr: 2 -streamsToStorage[200].dataProduct: Beamformed -streamsToStorage[200].dataProductNr: 2 -streamsToStorage[200].streamNr: 200 -streamsToStorage[200].filename: L103821_SAP002_B052_S0_P000_bf.raw -streamsToStorage[200].sourcePset: 50 -streamsToStorage[200].destStorageNode: locus067 -streamsToStorage[200].destDirectory: /data/L103821/ -streamsToStorage[200].adderNr: 0 -streamsToStorage[200].writerNr: 2 -streamsToStorage[201].dataProduct: Beamformed -streamsToStorage[201].dataProductNr: 2 -streamsToStorage[201].streamNr: 201 -streamsToStorage[201].filename: L103821_SAP002_B053_S0_P000_bf.raw -streamsToStorage[201].sourcePset: 50 -streamsToStorage[201].destStorageNode: locus068 -streamsToStorage[201].destDirectory: /data/L103821/ -streamsToStorage[201].adderNr: 1 -streamsToStorage[201].writerNr: 2 -streamsToStorage[202].dataProduct: Beamformed -streamsToStorage[202].dataProductNr: 2 -streamsToStorage[202].streamNr: 202 -streamsToStorage[202].filename: L103821_SAP002_B054_S0_P000_bf.raw -streamsToStorage[202].sourcePset: 50 -streamsToStorage[202].destStorageNode: locus069 -streamsToStorage[202].destDirectory: /data/L103821/ -streamsToStorage[202].adderNr: 2 -streamsToStorage[202].writerNr: 3 -streamsToStorage[203].dataProduct: Beamformed -streamsToStorage[203].dataProductNr: 2 -streamsToStorage[203].streamNr: 203 -streamsToStorage[203].filename: L103821_SAP002_B055_S0_P000_bf.raw -streamsToStorage[203].sourcePset: 50 -streamsToStorage[203].destStorageNode: locus070 -streamsToStorage[203].destDirectory: /data/L103821/ -streamsToStorage[203].adderNr: 3 -streamsToStorage[203].writerNr: 2 -streamsToStorage[204].dataProduct: Beamformed -streamsToStorage[204].dataProductNr: 2 -streamsToStorage[204].streamNr: 204 -streamsToStorage[204].filename: L103821_SAP002_B056_S0_P000_bf.raw -streamsToStorage[204].sourcePset: 51 -streamsToStorage[204].destStorageNode: locus071 -streamsToStorage[204].destDirectory: /data/L103821/ -streamsToStorage[204].adderNr: 0 -streamsToStorage[204].writerNr: 2 -streamsToStorage[205].dataProduct: Beamformed -streamsToStorage[205].dataProductNr: 2 -streamsToStorage[205].streamNr: 205 -streamsToStorage[205].filename: L103821_SAP002_B057_S0_P000_bf.raw -streamsToStorage[205].sourcePset: 51 -streamsToStorage[205].destStorageNode: locus073 -streamsToStorage[205].destDirectory: /data/L103821/ -streamsToStorage[205].adderNr: 1 -streamsToStorage[205].writerNr: 2 -streamsToStorage[206].dataProduct: Beamformed -streamsToStorage[206].dataProductNr: 2 -streamsToStorage[206].streamNr: 206 -streamsToStorage[206].filename: L103821_SAP002_B058_S0_P000_bf.raw -streamsToStorage[206].sourcePset: 51 -streamsToStorage[206].destStorageNode: locus074 -streamsToStorage[206].destDirectory: /data/L103821/ -streamsToStorage[206].adderNr: 2 -streamsToStorage[206].writerNr: 2 -streamsToStorage[207].dataProduct: Beamformed -streamsToStorage[207].dataProductNr: 2 -streamsToStorage[207].streamNr: 207 -streamsToStorage[207].filename: L103821_SAP002_B059_S0_P000_bf.raw -streamsToStorage[207].sourcePset: 51 -streamsToStorage[207].destStorageNode: locus075 -streamsToStorage[207].destDirectory: /data/L103821/ -streamsToStorage[207].adderNr: 3 -streamsToStorage[207].writerNr: 2 -streamsToStorage[208].dataProduct: Beamformed -streamsToStorage[208].dataProductNr: 2 -streamsToStorage[208].streamNr: 208 -streamsToStorage[208].filename: L103821_SAP002_B060_S0_P000_bf.raw -streamsToStorage[208].sourcePset: 52 -streamsToStorage[208].destStorageNode: locus076 -streamsToStorage[208].destDirectory: /data/L103821/ -streamsToStorage[208].adderNr: 0 -streamsToStorage[208].writerNr: 2 -streamsToStorage[209].dataProduct: Beamformed -streamsToStorage[209].dataProductNr: 2 -streamsToStorage[209].streamNr: 209 -streamsToStorage[209].filename: L103821_SAP002_B061_S0_P000_bf.raw -streamsToStorage[209].sourcePset: 52 -streamsToStorage[209].destStorageNode: locus077 -streamsToStorage[209].destDirectory: /data/L103821/ -streamsToStorage[209].adderNr: 1 -streamsToStorage[209].writerNr: 2 -streamsToStorage[210].dataProduct: Beamformed -streamsToStorage[210].dataProductNr: 2 -streamsToStorage[210].streamNr: 210 -streamsToStorage[210].filename: L103821_SAP002_B062_S0_P000_bf.raw -streamsToStorage[210].sourcePset: 52 -streamsToStorage[210].destStorageNode: locus078 -streamsToStorage[210].destDirectory: /data/L103821/ -streamsToStorage[210].adderNr: 2 -streamsToStorage[210].writerNr: 2 -streamsToStorage[211].dataProduct: Beamformed -streamsToStorage[211].dataProductNr: 2 -streamsToStorage[211].streamNr: 211 -streamsToStorage[211].filename: L103821_SAP002_B063_S0_P000_bf.raw -streamsToStorage[211].sourcePset: 52 -streamsToStorage[211].destStorageNode: locus079 -streamsToStorage[211].destDirectory: /data/L103821/ -streamsToStorage[211].adderNr: 3 -streamsToStorage[211].writerNr: 2 -streamsToStorage[212].dataProduct: Beamformed -streamsToStorage[212].dataProductNr: 2 -streamsToStorage[212].streamNr: 212 -streamsToStorage[212].filename: L103821_SAP002_B064_S0_P000_bf.raw -streamsToStorage[212].sourcePset: 53 -streamsToStorage[212].destStorageNode: locus081 -streamsToStorage[212].destDirectory: /data/L103821/ -streamsToStorage[212].adderNr: 0 -streamsToStorage[212].writerNr: 2 -streamsToStorage[213].dataProduct: Beamformed -streamsToStorage[213].dataProductNr: 2 -streamsToStorage[213].streamNr: 213 -streamsToStorage[213].filename: L103821_SAP002_B065_S0_P000_bf.raw -streamsToStorage[213].sourcePset: 53 -streamsToStorage[213].destStorageNode: locus082 -streamsToStorage[213].destDirectory: /data/L103821/ -streamsToStorage[213].adderNr: 1 -streamsToStorage[213].writerNr: 2 -streamsToStorage[214].dataProduct: Beamformed -streamsToStorage[214].dataProductNr: 2 -streamsToStorage[214].streamNr: 214 -streamsToStorage[214].filename: L103821_SAP002_B066_S0_P000_bf.raw -streamsToStorage[214].sourcePset: 53 -streamsToStorage[214].destStorageNode: locus084 -streamsToStorage[214].destDirectory: /data/L103821/ -streamsToStorage[214].adderNr: 2 -streamsToStorage[214].writerNr: 2 -streamsToStorage[215].dataProduct: Beamformed -streamsToStorage[215].dataProductNr: 2 -streamsToStorage[215].streamNr: 215 -streamsToStorage[215].filename: L103821_SAP002_B067_S0_P000_bf.raw -streamsToStorage[215].sourcePset: 53 -streamsToStorage[215].destStorageNode: locus085 -streamsToStorage[215].destDirectory: /data/L103821/ -streamsToStorage[215].adderNr: 3 -streamsToStorage[215].writerNr: 2 -streamsToStorage[216].dataProduct: Beamformed -streamsToStorage[216].dataProductNr: 2 -streamsToStorage[216].streamNr: 216 -streamsToStorage[216].filename: L103821_SAP002_B068_S0_P000_bf.raw -streamsToStorage[216].sourcePset: 54 -streamsToStorage[216].destStorageNode: locus086 -streamsToStorage[216].destDirectory: /data/L103821/ -streamsToStorage[216].adderNr: 0 -streamsToStorage[216].writerNr: 2 -streamsToStorage[217].dataProduct: Beamformed -streamsToStorage[217].dataProductNr: 2 -streamsToStorage[217].streamNr: 217 -streamsToStorage[217].filename: L103821_SAP002_B069_S0_P000_bf.raw -streamsToStorage[217].sourcePset: 54 -streamsToStorage[217].destStorageNode: locus087 -streamsToStorage[217].destDirectory: /data/L103821/ -streamsToStorage[217].adderNr: 1 -streamsToStorage[217].writerNr: 2 -streamsToStorage[218].dataProduct: Beamformed -streamsToStorage[218].dataProductNr: 2 -streamsToStorage[218].streamNr: 218 -streamsToStorage[218].filename: L103821_SAP002_B070_S0_P000_bf.raw -streamsToStorage[218].sourcePset: 54 -streamsToStorage[218].destStorageNode: locus088 -streamsToStorage[218].destDirectory: /data/L103821/ -streamsToStorage[218].adderNr: 2 -streamsToStorage[218].writerNr: 2 -streamsToStorage[219].dataProduct: Beamformed -streamsToStorage[219].dataProductNr: 2 -streamsToStorage[219].streamNr: 219 -streamsToStorage[219].filename: L103821_SAP002_B071_S0_P000_bf.raw -streamsToStorage[219].sourcePset: 54 -streamsToStorage[219].destStorageNode: locus090 -streamsToStorage[219].destDirectory: /data/L103821/ -streamsToStorage[219].adderNr: 3 -streamsToStorage[219].writerNr: 2 -streamsToStorage[220].dataProduct: Beamformed -streamsToStorage[220].dataProductNr: 2 -streamsToStorage[220].streamNr: 220 -streamsToStorage[220].filename: L103821_SAP002_B072_S0_P000_bf.raw -streamsToStorage[220].sourcePset: 55 -streamsToStorage[220].destStorageNode: locus093 -streamsToStorage[220].destDirectory: /data/L103821/ -streamsToStorage[220].adderNr: 0 -streamsToStorage[220].writerNr: 2 -streamsToStorage[221].dataProduct: Beamformed -streamsToStorage[221].dataProductNr: 2 -streamsToStorage[221].streamNr: 221 -streamsToStorage[221].filename: L103821_SAP002_B073_S0_P000_bf.raw -streamsToStorage[221].sourcePset: 55 -streamsToStorage[221].destStorageNode: locus094 -streamsToStorage[221].destDirectory: /data/L103821/ -streamsToStorage[221].adderNr: 1 -streamsToStorage[221].writerNr: 2 - -<<< diff --git a/dependencies/Common/CMakeLists.txt b/dependencies/Common/CMakeLists.txt index 40d6cda18d53d232a034c2a5c62d54dde48199dd..fc931645bd568e3c623accd267d3c98881657c18 100644 --- a/dependencies/Common/CMakeLists.txt +++ b/dependencies/Common/CMakeLists.txt @@ -5,7 +5,6 @@ lofar_package(Common 3.3) include(LofarFindPackage) lofar_find_package(Casacore COMPONENTS casa) lofar_find_package(Boost REQUIRED) -lofar_find_package(Readline REQUIRED) add_subdirectory(include/Common) add_subdirectory(src) diff --git a/dependencies/Common/include/Common/CMakeLists.txt b/dependencies/Common/include/Common/CMakeLists.txt index 3d8fcd12950a56257dd05bf18eae6d46f9266f60..c4ea7215b8876ffdedc8196289f16d41a5dbf4da 100644 --- a/dependencies/Common/include/Common/CMakeLists.txt +++ b/dependencies/Common/include/Common/CMakeLists.txt @@ -14,90 +14,48 @@ install(FILES CasaLogSink.h CheckConfig.h compiler.h - ComplexBuiltinFP.h - ComplexBuiltinInt.h - ComplexC99.h - ComplexStdFP.h - ComplexStdInt.h - DataConvert.h + complex.h DataFormat.h Exception.h Exceptions.h FileLocator.h - hexdump.h InputParSet.h IOPriority.h i4complex.h KVpair.h - lofar_algorithm.h lofar_bitset.h LofarBitModeInfo.h LofarConstants.h - lofar_complex.h - lofar_deque.h lofar_fstream.h lofar_iomanip.h lofar_iosfwd.h lofar_iostream.h - lofar_list.h LofarLocators.h LofarLog4Cplus.h LofarLog4Cxx.h LofarLogCout.h LofarLogger.h - lofar_map.h - lofar_math.h - lofar_numeric.h - lofar_set.h - lofar_smartptr.h lofar_sstream.h - lofar_stack.h - lofar_string.h - lofar_thread.h - lofar_tribool.h lofar_typeinfo.h LofarTypedefs.h LofarTypes.h - lofar_vector.h - Mmap.h - Numeric.h + NewHandler.h NsTimestamp.h - ObjectFactory.h OpenMP.h ParameterRecord.h ParameterSet.h ParameterSetImpl.h ParameterValue.h PrettyUnits.h - Process.h - ReadLine.h - RunOnNode.h - Singleton.h - Stopwatch.h StreamUtil.h StringUtil.h SystemCallException.h SystemUtil.h Timer.h - TypeNames.h - TypeNames.tcc Version.h DESTINATION include/${PACKAGE_NAME} COMPONENT ${lower_package_name}) -install(FILES - Net/FdSet.h - Net/Socket.h - DESTINATION include/${PACKAGE_NAME}/Net - COMPONENT ${lower_package_name}) - -install(FILES - shmem/segbasemap.h - shmem/dlmalloc.h - shmem/shmem_alloc.h - DESTINATION include/${PACKAGE_NAME}/shmem - COMPONENT ${lower_package_name}) - install(FILES Thread/Barrier.h Thread/Cancellation.h diff --git a/dependencies/Common/include/Common/ComplexBuiltinFP.h b/dependencies/Common/include/Common/ComplexBuiltinFP.h deleted file mode 100644 index 0f96a8d52205917dabcabb9451398f0fd6049562..0000000000000000000000000000000000000000 --- a/dependencies/Common/include/Common/ComplexBuiltinFP.h +++ /dev/null @@ -1,121 +0,0 @@ -//# ComplexBuiltinFP.h: Wrapper for efficient C99 floating point complex types -//# -//# Copyright (C) 2005 -//# ASTRON (Netherlands Institute for Radio Astronomy) -//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands -//# -//# This file is part of the LOFAR software suite. -//# The LOFAR software suite 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 3 of the License, or -//# (at your option) any later version. -//# -//# The LOFAR software suite 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 the LOFAR software suite. If not, see <http://www.gnu.org/licenses/>. -//# -//# $Id$ - -#ifndef LOFAR_COMMON_COMPLEXBUILTINFP_H -#define LOFAR_COMMON_COMPLEXBUILTINFP_H - -// \file - - -#define LOFAR_FCOMPLEX LOFAR_BUILTIN_COMPLEXFP float -#define LOFAR_DCOMPLEX LOFAR_BUILTIN_COMPLEXFP double - -//# For C++ an include of complex.h includes backward/complex.h and -//# not /usr/include/complex.h. This is very unfortunate. -//# Hence we declare functions like sin ourselves in ComplexC99.h. -#include <Common/ComplexC99.h> -#include <Common/lofar_iostream.h> - - -namespace LOFAR { - namespace TYPES { - // Define the complex types. - typedef LOFAR_FCOMPLEX fcomplex; - typedef LOFAR_DCOMPLEX dcomplex; - } - - inline TYPES::fcomplex makefcomplex (float re, float im) - { return (re + im*1.i); } - inline TYPES::dcomplex makedcomplex (double re, double im) - { return (re + im*1.i); } - - // Functions operating on single precision complex numbers. - // <group> - inline float real (TYPES::fcomplex x) { return __real__(x); } - inline float imag (TYPES::fcomplex x) { return __imag__(x); } - inline TYPES::fcomplex conj (TYPES::fcomplex x) { return ~(x); } - inline TYPES::fcomplex sin (TYPES::fcomplex x) { return ::csinf(x); } - inline TYPES::fcomplex cos (TYPES::fcomplex x) { return ::ccosf(x); } - inline TYPES::fcomplex tan (TYPES::fcomplex x) { return ::ctanf(x); } - inline TYPES::fcomplex asin (TYPES::fcomplex x) { return ::casinf(x); } - inline TYPES::fcomplex acos (TYPES::fcomplex x) { return ::cacosf(x); } - inline TYPES::fcomplex atan (TYPES::fcomplex x) { return ::catanf(x); } - inline TYPES::fcomplex sinh (TYPES::fcomplex x) { return ::csinhf(x); } - inline TYPES::fcomplex cosh (TYPES::fcomplex x) { return ::ccoshf(x); } - inline TYPES::fcomplex tanh (TYPES::fcomplex x) { return ::ctanhf(x); } - inline TYPES::fcomplex asinh (TYPES::fcomplex x) { return ::casinhf(x); } - inline TYPES::fcomplex acosh (TYPES::fcomplex x) { return ::cacoshf(x); } - inline TYPES::fcomplex atanh (TYPES::fcomplex x) { return ::catanhf(x); } - inline TYPES::fcomplex sqrt (TYPES::fcomplex x) { return ::csqrtf(x); } - inline TYPES::fcomplex exp (TYPES::fcomplex x) { return ::cexpf(x); } - inline TYPES::fcomplex log (TYPES::fcomplex x) { return ::clogf(x); } - inline TYPES::fcomplex log10 (TYPES::fcomplex x) { return ::clog10f(x); } - inline float abs (TYPES::fcomplex x) { return ::cabsf(x); } - inline float arg (TYPES::fcomplex x) { return ::cargf(x); } - inline TYPES::fcomplex pow (TYPES::fcomplex x, TYPES::fcomplex exp) - { return ::cpowf(x,exp); } - // </group> - - // Functions operating on double precision complex numbers. - // <group> - inline double real (TYPES::dcomplex x) { return __real__(x); } - inline double imag (TYPES::dcomplex x) { return __imag__(x); } - inline TYPES::dcomplex conj (TYPES::dcomplex x) { return ~(x); } - inline TYPES::dcomplex sin (TYPES::dcomplex x) { return ::csin(x); } - inline TYPES::dcomplex cos (TYPES::dcomplex x) { return ::ccos(x); } - inline TYPES::dcomplex tan (TYPES::dcomplex x) { return ::ctan(x); } - inline TYPES::dcomplex asin (TYPES::dcomplex x) { return ::casin(x); } - inline TYPES::dcomplex acos (TYPES::dcomplex x) { return ::cacos(x); } - inline TYPES::dcomplex atan (TYPES::dcomplex x) { return ::catan(x); } - inline TYPES::dcomplex sinh (TYPES::dcomplex x) { return ::csinh(x); } - inline TYPES::dcomplex cosh (TYPES::dcomplex x) { return ::ccosh(x); } - inline TYPES::dcomplex tanh (TYPES::dcomplex x) { return ::ctanh(x); } - inline TYPES::dcomplex asinh (TYPES::dcomplex x) { return ::casinh(x); } - inline TYPES::dcomplex acosh (TYPES::dcomplex x) { return ::cacosh(x); } - inline TYPES::dcomplex atanh (TYPES::dcomplex x) { return ::catanh(x); } - inline TYPES::dcomplex sqrt (TYPES::dcomplex x) { return ::csqrt(x); } - inline TYPES::dcomplex exp (TYPES::dcomplex x) { return ::cexp(x); } -//# PVSS puts std::clog in the global namespace. -//# Hence in that case clog is not defined and cannot be used. -#ifndef HAVE_PVSS - inline TYPES::dcomplex log (TYPES::dcomplex x) { return ::clog(x); } -#endif - inline TYPES::dcomplex log10 (TYPES::dcomplex x) { return ::clog10(x); } - inline double abs (TYPES::dcomplex x) { return ::cabs(x); } - inline double arg (TYPES::dcomplex x) { return ::carg(x); } - inline TYPES::dcomplex pow (TYPES::dcomplex x, TYPES::dcomplex exp) - { return ::cpow(x,exp); } - // </group> - - // Show the complex numbers. - // <group> - inline ostream& operator<< (ostream& os, TYPES::fcomplex x) - { os << '(' << real(x) << ',' << imag(x) << ')'; return os; } - inline ostream& operator<< (ostream& os, TYPES::dcomplex x) - { os << '(' << real(x) << ',' << imag(x) << ')'; return os; } - // </group> -} - -#undef LOFAR_FCOMPLEX -#undef LOFAR_DCOMPLEX - -#endif diff --git a/dependencies/Common/include/Common/ComplexBuiltinInt.h b/dependencies/Common/include/Common/ComplexBuiltinInt.h deleted file mode 100644 index 3a944f9da774a0e5400436c50fdef87235875eda..0000000000000000000000000000000000000000 --- a/dependencies/Common/include/Common/ComplexBuiltinInt.h +++ /dev/null @@ -1,98 +0,0 @@ -//# ComplexBuiltinInt.h: Wrapper for efficient C99 integer complex types -//# -//# Copyright (C) 2005 -//# ASTRON (Netherlands Institute for Radio Astronomy) -//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands -//# -//# This file is part of the LOFAR software suite. -//# The LOFAR software suite 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 3 of the License, or -//# (at your option) any later version. -//# -//# The LOFAR software suite 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 the LOFAR software suite. If not, see <http://www.gnu.org/licenses/>. -//# -//# $Id$ - -#ifndef LOFAR_COMMON_COMPLEXBUILTININT_H -#define LOFAR_COMMON_COMPLEXBUILTININT_H - -// \file - - -#define LOFAR_I8COMPLEX LOFAR_BUILTIN_COMPLEXINT signed char -#define LOFAR_I16COMPLEX LOFAR_BUILTIN_COMPLEXINT short -#define LOFAR_U16COMPLEX LOFAR_BUILTIN_COMPLEXINT unsigned short - -//# Include the typedefs for (u)int16. -#include <Common/LofarTypedefs.h> -#include <ostream> - - -namespace LOFAR { - namespace TYPES { - // Define the complex types. - typedef LOFAR_I8COMPLEX i8complex; - typedef LOFAR_I16COMPLEX i16complex; - typedef LOFAR_U16COMPLEX u16complex; - } - - inline TYPES::i8complex makei8complex (TYPES::int8 re, TYPES::int8 im) - { return (re + im*1i); } - inline TYPES::i16complex makei16complex (TYPES::int16 re, TYPES::int16 im) - { return (re + im*1i); } - inline TYPES::u16complex makeu16complex (TYPES::uint16 re, TYPES::uint16 im) - { return (re + im*1i); } - - // Functions operating on int8 complex numbers. - // <group> - inline TYPES::int8 real (TYPES::i8complex x) - { return __real__(x); } - inline TYPES::int8 imag (TYPES::i8complex x) - { return __imag__(x); } - inline TYPES::i8complex conj (TYPES::i8complex x) - { return ~(x); } - // </group> - - // Functions operating on int16 complex numbers. - // <group> - inline TYPES::int16 real (TYPES::i16complex x) - { return __real__(x); } - inline TYPES::int16 imag (TYPES::i16complex x) - { return __imag__(x); } - inline TYPES::i16complex conj (TYPES::i16complex x) - { return ~(x); } - // </group> - - // Functions operating on uint16 complex numbers. - // <group> - inline TYPES::uint16 real (TYPES::u16complex x) - { return __real__(x); } - inline TYPES::uint16 imag (TYPES::u16complex x) - { return __imag__(x); } - inline TYPES::u16complex conj (TYPES::u16complex x) - { return ~(x); } - // </group> - - // Show the complex numbers. - // <group> - inline std::ostream& operator<< (std::ostream& os, TYPES::i8complex x) - { os << '(' << (int)real(x) << ',' << (int)imag(x) << ')'; return os; } - inline std::ostream& operator<< (std::ostream& os, TYPES::i16complex x) - { os << '(' << real(x) << ',' << imag(x) << ')'; return os; } - inline std::ostream& operator<< (std::ostream& os, TYPES::u16complex x) - { os << '(' << real(x) << ',' << imag(x) << ')'; return os; } - // </group> -} - -#undef LOFAR_I8COMPLEX -#undef LOFAR_I16COMPLEX -#undef LOFAR_U16COMPLEX - -#endif diff --git a/dependencies/Common/include/Common/ComplexC99.h b/dependencies/Common/include/Common/ComplexC99.h deleted file mode 100644 index da673ddc91701e3ff355505bfdce3fa17c241e35..0000000000000000000000000000000000000000 --- a/dependencies/Common/include/Common/ComplexC99.h +++ /dev/null @@ -1,78 +0,0 @@ -//# ComplexC99.h: Wrapper for declaration of C99 complex functions -//# -//# Copyright (C) 2005 -//# ASTRON (Netherlands Institute for Radio Astronomy) -//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands -//# -//# This file is part of the LOFAR software suite. -//# The LOFAR software suite 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 3 of the License, or -//# (at your option) any later version. -//# -//# The LOFAR software suite 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 the LOFAR software suite. If not, see <http://www.gnu.org/licenses/>. -//# -//# $Id$ - -#ifndef LOFAR_COMMON_COMPLEXC99 -#define LOFAR_COMMON_COMPLEXC99 - -// \file - -// An include of complex.h includes backward/complex.h and -// not /usr/include/complex.h. This is very unfortunate. -// Hence we declare functions like sin ourselves in this file. - -extern "C" { - LOFAR_DCOMPLEX csin (LOFAR_DCOMPLEX x); - LOFAR_DCOMPLEX ccos (LOFAR_DCOMPLEX x); - LOFAR_DCOMPLEX ctan (LOFAR_DCOMPLEX x); - LOFAR_DCOMPLEX casin (LOFAR_DCOMPLEX x); - LOFAR_DCOMPLEX cacos (LOFAR_DCOMPLEX x); - LOFAR_DCOMPLEX catan (LOFAR_DCOMPLEX x); - LOFAR_DCOMPLEX csinh (LOFAR_DCOMPLEX x); - LOFAR_DCOMPLEX ccosh (LOFAR_DCOMPLEX x); - LOFAR_DCOMPLEX ctanh (LOFAR_DCOMPLEX x); - LOFAR_DCOMPLEX casinh (LOFAR_DCOMPLEX x); - LOFAR_DCOMPLEX cacosh (LOFAR_DCOMPLEX x); - LOFAR_DCOMPLEX catanh (LOFAR_DCOMPLEX x); - LOFAR_DCOMPLEX csqrt (LOFAR_DCOMPLEX x); - LOFAR_DCOMPLEX cexp (LOFAR_DCOMPLEX x); - LOFAR_DCOMPLEX cpow (LOFAR_DCOMPLEX x, LOFAR_DCOMPLEX exp); -//# PVSS puts std::clog in the global namespace. -//# Hence do not define clog in that case. -#ifndef HAVE_PVSS - LOFAR_DCOMPLEX clog (LOFAR_DCOMPLEX x); -#endif - LOFAR_DCOMPLEX clog10 (LOFAR_DCOMPLEX x); - double cabs (LOFAR_DCOMPLEX x); - double carg (LOFAR_DCOMPLEX x); - - LOFAR_FCOMPLEX csinf (LOFAR_FCOMPLEX x); - LOFAR_FCOMPLEX ccosf (LOFAR_FCOMPLEX x); - LOFAR_FCOMPLEX ctanf (LOFAR_FCOMPLEX x); - LOFAR_FCOMPLEX casinf (LOFAR_FCOMPLEX x); - LOFAR_FCOMPLEX cacosf (LOFAR_FCOMPLEX x); - LOFAR_FCOMPLEX catanf (LOFAR_FCOMPLEX x); - LOFAR_FCOMPLEX csinhf (LOFAR_FCOMPLEX x); - LOFAR_FCOMPLEX ccoshf (LOFAR_FCOMPLEX x); - LOFAR_FCOMPLEX ctanhf (LOFAR_FCOMPLEX x); - LOFAR_FCOMPLEX casinhf (LOFAR_FCOMPLEX x); - LOFAR_FCOMPLEX cacoshf (LOFAR_FCOMPLEX x); - LOFAR_FCOMPLEX catanhf (LOFAR_FCOMPLEX x); - LOFAR_FCOMPLEX csqrtf (LOFAR_FCOMPLEX x); - LOFAR_FCOMPLEX cexpf (LOFAR_FCOMPLEX x); - LOFAR_FCOMPLEX cpowf (LOFAR_FCOMPLEX x, LOFAR_FCOMPLEX exp); - LOFAR_FCOMPLEX clogf (LOFAR_FCOMPLEX x); - LOFAR_FCOMPLEX clog10f (LOFAR_FCOMPLEX x); - float cabsf (LOFAR_FCOMPLEX x); - float cargf (LOFAR_FCOMPLEX x); -} - -#endif diff --git a/dependencies/Common/include/Common/ComplexStdFP.h b/dependencies/Common/include/Common/ComplexStdFP.h deleted file mode 100644 index fbfbb09cf9463cd4a5343ea8d4f6e2c74ab2a8b9..0000000000000000000000000000000000000000 --- a/dependencies/Common/include/Common/ComplexStdFP.h +++ /dev/null @@ -1,62 +0,0 @@ -//# ComplexStdFP.h: Use std::complex for floating point types -//# -//# Copyright (C) 2005 -//# ASTRON (Netherlands Institute for Radio Astronomy) -//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands -//# -//# This file is part of the LOFAR software suite. -//# The LOFAR software suite 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 3 of the License, or -//# (at your option) any later version. -//# -//# The LOFAR software suite 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 the LOFAR software suite. If not, see <http://www.gnu.org/licenses/>. -//# -//# $Id$ - -#ifndef LOFAR_COMMON_COMPLEXSTDFP_H -#define LOFAR_COMMON_COMPLEXSTDFP_H - -// \file - -#include <complex> - -namespace LOFAR { - - namespace TYPES { - typedef std::complex<float> fcomplex; - typedef std::complex<double> dcomplex; - } - - inline TYPES::fcomplex makefcomplex (float re, float im) - { return TYPES::fcomplex(re,im); } - inline TYPES::dcomplex makedcomplex (double re, double im) - { return TYPES::dcomplex(re,im); } - - using std::abs; - using std::arg; - using std::conj; - using std::cos; - using std::cosh; - using std::exp; - using std::imag; - using std::log; - using std::log10; - using std::norm; - using std::polar; - using std::pow; - using std::real; - using std::sin; - using std::sinh; - using std::sqrt; - using std::tan; - using std::tanh; -} - -#endif diff --git a/dependencies/Common/include/Common/ComplexStdInt.h b/dependencies/Common/include/Common/ComplexStdInt.h deleted file mode 100644 index 18aa3631aa9675711312a01724aed2c0ffa76de5..0000000000000000000000000000000000000000 --- a/dependencies/Common/include/Common/ComplexStdInt.h +++ /dev/null @@ -1,66 +0,0 @@ -//# ComplexStdInt.h: Use std::complex for integer types -//# -//# Copyright (C) 2005 -//# ASTRON (Netherlands Institute for Radio Astronomy) -//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands -//# -//# This file is part of the LOFAR software suite. -//# The LOFAR software suite 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 3 of the License, or -//# (at your option) any later version. -//# -//# The LOFAR software suite 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 the LOFAR software suite. If not, see <http://www.gnu.org/licenses/>. -//# -//# $Id$ - -#ifndef LOFAR_COMMON_COMPLEXSTDINT_H -#define LOFAR_COMMON_COMPLEXSTDINT_H - -// \file - -#include <complex> -#include <Common/LofarTypedefs.h> - -namespace LOFAR { - - namespace TYPES { - typedef std::complex<int8> i8complex; - typedef std::complex<int16> i16complex; - typedef std::complex<uint16> u16complex; - } - - inline TYPES::i8complex makei8complex (TYPES::int8 re, TYPES::int8 im) - { return TYPES::i8complex(re,im); } - inline TYPES::i16complex makei16complex (TYPES::uint16 re, TYPES::uint16 im) - { return TYPES::i16complex(re,im); } - inline TYPES::u16complex makeu16complex (TYPES::uint16 re, TYPES::uint16 im) - { return TYPES::u16complex(re,im); } - - using std::abs; - using std::arg; - using std::conj; - using std::cos; - using std::cosh; - using std::exp; - using std::imag; - using std::log; - using std::log10; - using std::norm; - using std::polar; - using std::pow; - using std::real; - using std::sin; - using std::sinh; - using std::sqrt; - using std::tan; - using std::tanh; -} - -#endif diff --git a/dependencies/Common/include/Common/DataConvert.h b/dependencies/Common/include/Common/DataConvert.h deleted file mode 100644 index 96beae0d18b9c01418666c62b3e2e782aba02d33..0000000000000000000000000000000000000000 --- a/dependencies/Common/include/Common/DataConvert.h +++ /dev/null @@ -1,402 +0,0 @@ -//# DataConvert.h: Global functions to convert data values -//# -//# Copyright (C) 2003 -//# ASTRON (Netherlands Institute for Radio Astronomy) -//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands -//# -//# This file is part of the LOFAR software suite. -//# The LOFAR software suite 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 3 of the License, or -//# (at your option) any later version. -//# -//# The LOFAR software suite 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 the LOFAR software suite. If not, see <http://www.gnu.org/licenses/>. -//# -//# $Id$ - -#ifndef LOFAR_COMMON_DATACONVERT_H -#define LOFAR_COMMON_DATACONVERT_H - -// \file -// Global functions to convert data values - -// Global functions to convert data values - -#include <Common/LofarTypes.h> -#include <Common/DataFormat.h> -#include <complex> - -//# If std::complex is used for the complex types, their functions are -//# template specialisations, so they need template<>. -#ifndef LOFAR_BUILTIN_COMPLEXINT -# define LFDC_TMPL_INT template<> -# else -# define LFDC_TMPL_INT -#endif -#ifndef LOFAR_BUILTIN_COMPLEXFP -# define LFDC_TMPL_FP template<> -# else -# define LFDC_TMPL_FP -#endif - -namespace LOFAR -{ -// \ingroup Common -// \addtogroup DataConvert Data conversion functions -// - // This file declares functions to convert data from one representation to - // another, in particular from little endian to big endian (or vice-versa). - // - // The functions are defined in a general way for each standard data type, - // so in principle every conceivable conversion could be done (for example, - // from the old VAX format to IEEE format). However, currently byte swap - // is the only conversion needed, so only that one is implemented. - // - // Furthermore it contains a function to convert bool values to bits - // and vice-versa. - // <group> - - // \name Convert the possible native types. - // These functions can be used in templates. - // <group> - void dataConvert (DataFormat, char* inout, uint nrval); - void dataConvert (DataFormat, int8* inout, uint nrval); - void dataConvert (DataFormat, uint8* inout, uint nrval); - void dataConvert (DataFormat, int16* inout, uint nrval); - void dataConvert (DataFormat, uint16* inout, uint nrval); - void dataConvert (DataFormat, int32* inout, uint nrval); - void dataConvert (DataFormat, uint32* inout, uint nrval); - void dataConvert (DataFormat, int64* inout, uint nrval); - void dataConvert (DataFormat, uint64* inout, uint nrval); - void dataConvert (DataFormat, float* inout, uint nrval); - void dataConvert (DataFormat, double* inout, uint nrval); - void dataConvert (DataFormat, i4complex *inout, uint nrval); - template<class T> void dataConvert (DataFormat, std::complex<T>* inout, - uint nrval); - LFDC_TMPL_INT void dataConvert (DataFormat, i16complex* inout, uint nrval); - LFDC_TMPL_INT void dataConvert (DataFormat, u16complex* inout, uint nrval); - LFDC_TMPL_FP void dataConvert (DataFormat, fcomplex* inout, uint nrval); - LFDC_TMPL_FP void dataConvert (DataFormat, dcomplex* inout, uint nrval); - // </group> - - // \name Convert char, int8, or uint8. - // Currently it simply returns the input. - // <group> - char dataConvert (DataFormat, char in); - int8 dataConvert (DataFormat, int8 in); - uint8 dataConvert (DataFormat, uint8 in); - // </group> - - // \name Convert 16 bit integers. - // <group> - int16 dataConvert (DataFormat, int16 in); - uint16 dataConvert (DataFormat, uint16 in); - void dataConvert16 (DataFormat, void* out, const void* in); - void dataConvert16 (DataFormat, void* inout); - void dataConvert16 (DataFormat, void* out, const void* in, uint nrval); - void dataConvert16 (DataFormat, void* inout, uint nrval); - // </group> - - // \name Convert 32 bit integers. - // <group> - int32 dataConvert (DataFormat, int32 in); - uint32 dataConvert (DataFormat, uint32 in); - void dataConvert32 (DataFormat, void* out, const void* in); - void dataConvert32 (DataFormat, void* inout); - void dataConvert32 (DataFormat, void* out, const void* in, uint nrval); - void dataConvert32 (DataFormat, void* inout, uint nrval); - // </group> - - // \name Convert 64 bit integers. - // <group> - int64 dataConvert (DataFormat, int64 in); - uint64 dataConvert (DataFormat, uint64 in); - void dataConvert64 (DataFormat, void* out, const void* in); - void dataConvert64 (DataFormat, void* inout); - void dataConvert64 (DataFormat, void* out, const void* in, uint nrval); - void dataConvert64 (DataFormat, void* inout, uint nrval); - // </group> - - // \name Convert 32 bit floats. - // <group> - void dataConvertFloat (DataFormat, void* out, const void* in); - void dataConvertFloat (DataFormat, void* inout); - void dataConvertFloat (DataFormat, void* out, const void* in, uint nrval); - void dataConvertFloat (DataFormat, void* inout, uint nrval); - // </group> - - // \name Convert 64 bit floats. - // <group> - void dataConvertDouble (DataFormat, void* out, const void* in); - void dataConvertDouble (DataFormat, void* inout); - void dataConvertDouble (DataFormat, void* out, const void* in, uint nrval); - void dataConvertDouble (DataFormat, void* inout, uint nrval); - // </group> - - // \name Swap bytes in 16 bit values. - // <group> - int16 byteSwap (int16 in); - uint16 byteSwap (uint16 in); - void byteSwap16 (void* out, const void* in); - void byteSwap16 (void* inout); - void byteSwap16 (void* out, const void* in, uint nrval); - void byteSwap16 (void* inout, uint nrval); - // </group> - - // \name Swap bytes in 32 bit values. - // <group> - int32 byteSwap (int32 in); - uint32 byteSwap (uint32 in); - void byteSwap32 (void* out, const void* in); - void byteSwap32 (void* inout); - void byteSwap32 (void* out, const void* in, uint nrval); - void byteSwap32 (void* inout, uint nrval); - // </group> - - // \name Swap bytes in 64 bit values. - // <group> - int64 byteSwap (int64 in); - uint64 byteSwap (uint64 in); - void byteSwap64 (void* out, const void* in); - void byteSwap64 (void* inout); - void byteSwap64 (void* out, const void* in, uint nrval); - void byteSwap64 (void* inout, uint nrval); - // </group> - - // Convert bools to bits. - // startbit gives to first bit to use in the to buffer. - // It returns the number of bytes used. - uint boolToBit (void* to, const void* from, uint nvalues, uint startbit=0); - - // Convert bits to bools. - // startbit gives to first bit to use in the from buffer. - // It returns the number of bytes used. - uint bitToBool (void* to, const void* from, uint nvalues, uint startbit=0); - - // </group> - -} // end namespace LOFAR - - -namespace LOFAR -{ - template<class T> - inline void dataConvert (DataFormat fmt, std::complex<T>* inout, uint nrval) - { dataConvert (fmt, (T*)inout, 2*nrval); } - - inline void dataConvert (DataFormat, char*, uint) - {} - inline void dataConvert (DataFormat, int8*, uint) - {} - inline void dataConvert (DataFormat, uint8*, uint) - {} - inline void dataConvert (DataFormat fmt, int16* inout, uint nrval) - { dataConvert16 (fmt, inout, nrval); } - inline void dataConvert (DataFormat fmt, uint16* inout, uint nrval) - { dataConvert16 (fmt, inout, nrval); } - inline void dataConvert (DataFormat fmt, int32* inout, uint nrval) - { dataConvert32 (fmt, inout, nrval); } - inline void dataConvert (DataFormat fmt, uint32* inout, uint nrval) - { dataConvert32 (fmt, inout, nrval); } - inline void dataConvert (DataFormat fmt, int64* inout, uint nrval) - { dataConvert64 (fmt, inout, nrval); } - inline void dataConvert (DataFormat fmt, uint64* inout, uint nrval) - { dataConvert64 (fmt, inout, nrval); } - inline void dataConvert (DataFormat fmt, float* inout, uint nrval) - { dataConvert32 (fmt, inout, nrval); } - inline void dataConvert (DataFormat fmt, double* inout, uint nrval) - { dataConvert64 (fmt, inout, nrval); } - inline void dataConvert (DataFormat, i4complex *, uint) - {} - inline void dataConvert (DataFormat fmt, std::complex<int16>* inout, uint nrval) - { dataConvert16 (fmt, inout, 2*nrval); } - LFDC_TMPL_INT inline void dataConvert (DataFormat fmt, i16complex* inout, uint nrval) - { dataConvert16 (fmt, inout, 2*nrval); } - LFDC_TMPL_INT inline void dataConvert (DataFormat fmt, u16complex* inout, uint nrval) - { dataConvert16 (fmt, inout, 2*nrval); } - LFDC_TMPL_FP inline void dataConvert (DataFormat fmt, fcomplex* inout, uint nrval) - { dataConvertFloat (fmt, inout, 2*nrval); } - LFDC_TMPL_FP inline void dataConvert (DataFormat fmt, dcomplex* inout, uint nrval) - { dataConvertDouble (fmt, inout, 2*nrval); } - - inline char dataConvert (DataFormat, char in) - { return in; } - inline int8 dataConvert (DataFormat, int8 in) - { return in; } - inline uint8 dataConvert (DataFormat, uint8 in) - { return in; } - - inline int16 dataConvert (DataFormat, int16 in) - { return byteSwap (in); } - inline uint16 dataConvert (DataFormat, uint16 in) - { return byteSwap (in); } - inline void dataConvert16 (DataFormat, void* out, const void* in) - { byteSwap16 (out, in); } - inline void dataConvert16 (DataFormat, void* inout) - { byteSwap16 (inout); } - inline void dataConvert16 (DataFormat, void* out, const void* in, uint nrval) - { byteSwap16 (out, in, nrval); } - inline void dataConvert16 (DataFormat, void* inout, uint nrval) - { byteSwap16 (inout, nrval); } - - inline int32 dataConvert (DataFormat, int32 in) - { return byteSwap (in); } - inline uint32 dataConvert (DataFormat, uint32 in) - { return byteSwap (in); } - inline void dataConvert32 (DataFormat, void* out, const void* in) - { byteSwap32 (out, in); } - inline void dataConvert32 (DataFormat, void* inout) - { byteSwap32 (inout); } - inline void dataConvert32 (DataFormat, void* out, const void* in, uint nrval) - { byteSwap32 (out, in, nrval); } - inline void dataConvert32 (DataFormat, void* inout, uint nrval) - { byteSwap32 (inout, nrval); } - - inline int64 dataConvert (DataFormat, int64 in) - { return byteSwap (in); } - inline uint64 dataConvert (DataFormat, uint64 in) - { return byteSwap (in); } - inline void dataConvert64 (DataFormat, void* out, const void* in) - { byteSwap64 (out, in); } - inline void dataConvert64 (DataFormat, void* inout) - { byteSwap64 (inout); } - inline void dataConvert64 (DataFormat, void* out, const void* in, uint nrval) - { byteSwap64 (out, in, nrval); } - inline void dataConvert64 (DataFormat, void* inout, uint nrval) - { byteSwap64 (inout, nrval); } - - inline void dataConvertFloat (DataFormat, void* out, const void* in) - { byteSwap32 (out, in); } - inline void dataConvertFloat (DataFormat, void* inout) - { byteSwap32 (inout); } - inline void dataConvertFloat (DataFormat, void* out, const void* in, uint nrval) - { byteSwap32 (out, in, nrval); } - inline void dataConvertFloat (DataFormat, void* inout, uint nrval) - { byteSwap32 (inout, nrval); } - - inline void dataConvertDouble (DataFormat, void* out, const void* in) - { byteSwap64 (out, in); } - inline void dataConvertDouble (DataFormat, void* inout) - { byteSwap64 (inout); } - inline void dataConvertDouble (DataFormat, void* out, const void* in, uint nrval) - { byteSwap64 (out, in, nrval); } - inline void dataConvertDouble (DataFormat, void* inout, uint nrval) - { byteSwap64 (inout, nrval); } - - - inline int16 byteSwap (int16 in) - { - int16 v; - byteSwap16 (&v, &in); - return v; - } - - inline uint16 byteSwap (uint16 in) - { - uint16 v; - byteSwap16 (&v, &in); - return v; - } - - inline void byteSwap16 (void* out, const void* in) - { - ((char*)(out))[0] = ((const char*)(in))[1]; - ((char*)(out))[1] = ((const char*)(in))[0]; - } - - inline void byteSwap16 (void* inout) - { - char v0 = ((const char*)(inout))[0]; - ((char*)(inout))[0] = ((const char*)(inout))[1]; - ((char*)(inout))[1] = v0; - } - - - inline int32 byteSwap (int32 in) - { - int32 v; - byteSwap32 (&v, &in); - return v; - } - - inline uint32 byteSwap (uint32 in) - { - uint32 v; - byteSwap32 (&v, &in); - return v; - } - - inline void byteSwap32 (void* out, const void* in) - { - ((char*)(out))[0] = ((const char*)(in))[3]; - ((char*)(out))[1] = ((const char*)(in))[2]; - ((char*)(out))[2] = ((const char*)(in))[1]; - ((char*)(out))[3] = ((const char*)(in))[0]; - } - - inline void byteSwap32 (void* inout) - { - char v0 = ((const char*)(inout))[0]; - char v1 = ((const char*)(inout))[1]; - ((char*)(inout))[0] = ((const char*)(inout))[3]; - ((char*)(inout))[1] = ((const char*)(inout))[2]; - ((char*)(inout))[2] = v1; - ((char*)(inout))[3] = v0; - } - - - inline int64 byteSwap (int64 in) - { - int64 v; - byteSwap64 (&v, &in); - return v; - } - - inline uint64 byteSwap (uint64 in) - { - uint64 v; - byteSwap64 (&v, &in); - return v; - } - - inline void byteSwap64 (void* out, const void* in) - { - ((char*)(out))[0] = ((const char*)(in))[7]; - ((char*)(out))[1] = ((const char*)(in))[6]; - ((char*)(out))[2] = ((const char*)(in))[5]; - ((char*)(out))[3] = ((const char*)(in))[4]; - ((char*)(out))[4] = ((const char*)(in))[3]; - ((char*)(out))[5] = ((const char*)(in))[2]; - ((char*)(out))[6] = ((const char*)(in))[1]; - ((char*)(out))[7] = ((const char*)(in))[0]; - } - - inline void byteSwap64 (void* inout) - { - char v0 = ((const char*)(inout))[0]; - char v1 = ((const char*)(inout))[1]; - char v2 = ((const char*)(inout))[2]; - char v3 = ((const char*)(inout))[3]; - ((char*)(inout))[0] = ((const char*)(inout))[7]; - ((char*)(inout))[1] = ((const char*)(inout))[6]; - ((char*)(inout))[2] = ((const char*)(inout))[5]; - ((char*)(inout))[3] = ((const char*)(inout))[4]; - ((char*)(inout))[4] = v3; - ((char*)(inout))[5] = v2; - ((char*)(inout))[6] = v1; - ((char*)(inout))[7] = v0; - } - -} // end namespace LOFAR - - -#undef LFDC_TMPL_FP -#undef LFDC_TMPL_INT - -#endif diff --git a/dependencies/Common/include/Common/FileLocator.h b/dependencies/Common/include/Common/FileLocator.h index 04f3e3abf933df30a87c85a25d29b93ab735c446..34901ace709f76b07c86b98d5179802d2ef4c481 100644 --- a/dependencies/Common/include/Common/FileLocator.h +++ b/dependencies/Common/include/Common/FileLocator.h @@ -28,10 +28,14 @@ //# Never #include <config.h> or #include <lofar_config.h> in a header file! //# Includes -#include <Common/lofar_string.h> -#include <Common/lofar_list.h> #include <sys/stat.h> +#include <string> +#include <list> + +using std::string; +using std::list; + namespace LOFAR { //# --- Forward Declarations --- diff --git a/dependencies/Common/include/Common/KVpair.h b/dependencies/Common/include/Common/KVpair.h index 15d8736a96e83328519eb676a5e74ef3d528fe26..6a22efbb8fad659f7d1af185da8caa909142c544 100644 --- a/dependencies/Common/include/Common/KVpair.h +++ b/dependencies/Common/include/Common/KVpair.h @@ -31,9 +31,10 @@ #include <ctime> #include <utility> #include <iosfwd> -#include <Common/lofar_string.h> #include <Common/LofarTypes.h> +using std::string; + namespace LOFAR { // \addtogroup Common diff --git a/dependencies/Common/include/Common/LofarLog4Cplus.h b/dependencies/Common/include/Common/LofarLog4Cplus.h index 649b19230ec04cc6c7eddb90e2e66ac3e8db05b3..e5bb7796291d8ef71b516dae8edab06899cbd3ea 100644 --- a/dependencies/Common/include/Common/LofarLog4Cplus.h +++ b/dependencies/Common/include/Common/LofarLog4Cplus.h @@ -30,9 +30,10 @@ #include <Common/CasaLogSink.h> #include <Common/lofar_iostream.h> #include <Common/lofar_sstream.h> -#include <Common/lofar_string.h> #include <Common/Thread/Cancellation.h> +using std::string; + #ifdef ENABLE_TRACER #include <Common/StringUtil.h> #endif diff --git a/dependencies/Common/include/Common/LofarLogCout.h b/dependencies/Common/include/Common/LofarLogCout.h index c7633313fd8078f74325f0d1b887548c40af22a7..a25267c39cd108ab821fb3ae2e504116508e9436 100644 --- a/dependencies/Common/include/Common/LofarLogCout.h +++ b/dependencies/Common/include/Common/LofarLogCout.h @@ -31,13 +31,16 @@ #include <Common/lofar_iostream.h> #include <Common/lofar_sstream.h> #include <Common/lofar_iomanip.h> -#include <Common/lofar_string.h> -#include <Common/lofar_map.h> #include <time.h> #include <sys/time.h> #include <cstdio> +#include <string> +#include <map> + +using std::string; +using std::map; //# This might be undefined if used by an external package like ASKAP. #ifndef AUTO_FUNCTION_NAME diff --git a/dependencies/Common/include/Common/LofarTypes.h b/dependencies/Common/include/Common/LofarTypes.h index 167b014764455f6a9082be9cb9bb504292a793e7..97fb2d9a97b361d0e999c543e6274fb76a696f95 100644 --- a/dependencies/Common/include/Common/LofarTypes.h +++ b/dependencies/Common/include/Common/LofarTypes.h @@ -27,7 +27,6 @@ // #include <Common/LofarTypedefs.h> -#include <Common/lofar_complex.h> //# Never #include <config.h> or #include <lofar_config.h> in a header file! //# Make sure we include <sys/types.h> or <qglobal.h> if availabe. These files diff --git a/dependencies/Common/include/Common/Mmap.h b/dependencies/Common/include/Common/Mmap.h deleted file mode 100644 index cb35b997197f8f734975b258b1b4dd1a858c90fa..0000000000000000000000000000000000000000 --- a/dependencies/Common/include/Common/Mmap.h +++ /dev/null @@ -1,56 +0,0 @@ -//# Mmap.h: class wrap the mmap and munmap system calls -//# Copyright (C) 2013 ASTRON (Netherlands Institute for Radio Astronomy) -//# P.O. Box 2, 7990 AA Dwingeloo, The Netherlands -//# -//# This file is part of the LOFAR software suite. -//# The LOFAR software suite 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 3 of the License, or -//# (at your option) any later version. -//# -//# The LOFAR software suite 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 the LOFAR software suite. If not, see <http://www.gnu.org/licenses/>. -//# -//# $Id$ - -#ifndef LOFAR_COMMON_MMAP_H -#define LOFAR_COMMON_MMAP_H - -// \file -// Class wrapping for the mmap and munmap system calls. - -#include <sys/mman.h> - -namespace LOFAR -{ - // \addtogroup Common - - // This class provides a wrapper around the mmap() and munmap() system calls. - // - // The most important restriction is that mappings reside on page granularity. - // Use sysconf(_SC_PAGE_SIZE) (or friends) (unistd.h) to retrieve the system's - // page size. Consult the OS man or info pages for more documentation. - class Mmap - { - public: - Mmap(void *addr/* = NULL*/, size_t length, int prot = PROT_READ, - int flags = MAP_PRIVATE, int fd = -1, off_t offset = 0); - - ~Mmap(); - - void* operator()() { return _ptr; } - - private: - void *_ptr; - size_t _len; - }; - -} // namespace LOFAR - -#endif - diff --git a/dependencies/Common/include/Common/Net/FdSet.h b/dependencies/Common/include/Common/Net/FdSet.h deleted file mode 100644 index d4063c8fa9a8db65fadbc94466b0bb1b437ffa5e..0000000000000000000000000000000000000000 --- a/dependencies/Common/include/Common/Net/FdSet.h +++ /dev/null @@ -1,87 +0,0 @@ -//# FdSet.h: C++ version of fd_set. -//# -//# Copyright (C) 2002-2004 -//# ASTRON (Netherlands Institute for Radio Astronomy) -//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands -//# -//# This file is part of the LOFAR software suite. -//# The LOFAR software suite 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 3 of the License, or -//# (at your option) any later version. -//# -//# The LOFAR software suite 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 the LOFAR software suite. If not, see <http://www.gnu.org/licenses/>. -//# -//# $Id$ - -#ifndef LOFAR_COMMON_FDSET_H -#define LOFAR_COMMON_FDSET_H - -// \file -// C++ version of fd_set, does some boring bookkeeping. - -//# Never #include <config.h> or #include <lofar_config.h> in a header file! -//# Includes -#include <sys/select.h> -#include <Common/LofarTypes.h> - -namespace LOFAR { -// \addtogroup Common -// @{ - -// C++ version of fd_set -class FdSet -{ -public: - FdSet(); - ~FdSet(); - - // set bit in fd_set. - void add (int32 fID); - - // clear bit in fd_set. - void remove(int32 fID); - - // clear whole fd_set. - void clear (); - - // Is bit fID set? - //# On some OS (e.g. OS-X Leopard) fd_set must be non-const!! - inline bool isSet (int32 fID) const - { return (FD_ISSET(fID, const_cast<fd_set*>(&itsSet))); } - - // Return a pointer to the fd_set. - inline fd_set* getSet() { return (&itsSet); } - - // Return number if highest fID added to the set. - inline int32 highest() const { return (itsHighest); } - - // Return number if lowest fID added to the set. - inline int32 lowest() const { return (itsLowest); } - - // Return number if bits set in the set. - inline int32 count() const { return (itsFdCount); } - - //# FdSet(const FdSet& that); // let compiler generate it. - - // Copying is allowed - FdSet& operator=(const FdSet& that); - -private: - //# Datamembers - fd_set itsSet; - int32 itsHighest; - int32 itsLowest; - int32 itsFdCount; -}; - -// @} addtogroup -} // namespace LOFAR - -#endif diff --git a/dependencies/Common/include/Common/Net/Socket.h b/dependencies/Common/include/Common/Net/Socket.h deleted file mode 100644 index ddb7e13824424539099753b5b5d3bca2f71873ae..0000000000000000000000000000000000000000 --- a/dependencies/Common/include/Common/Net/Socket.h +++ /dev/null @@ -1,402 +0,0 @@ -//# Socket.h: Class for connections over TCP/IP or UDP -//# -//# Copyright(C) 2002-2004 -//# ASTRON (Netherlands Institute for Radio Astronomy) -//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands -//# -//# This file is part of the LOFAR software suite. -//# The LOFAR software suite 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 3 of the License, or -//# (at your option) any later version. -//# -//# The LOFAR software suite 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 the LOFAR software suite. If not, see <http://www.gnu.org/licenses/>. -//# -//# $Id$ - -#ifndef LOFAR_COMMON_SOCKET_H -#define LOFAR_COMMON_SOCKET_H - -// \file -// Class for connections over TCP/IP or UDP - -#include <Common/lofar_string.h> -#include <Common/LofarTypes.h> - -#ifndef USE_NOSOCKETS - -#if defined(__sun) -#include <arpa/nameser.h> -#include <netinet/in.h> -// Note: should be uint32(=size_t), but in all TCP calls it is impl. as int32 -typedef int socklen_t; -#define INADDR_NONE ((in_addr_t) 0xffffffff) -#endif - -#if defined(__APPLE__) -#include <netinet/in.h> -#endif - -#include <resolv.h> -#include <sys/un.h> -#endif - -#include <errno.h> - - -namespace LOFAR -{ -// \ingroup Common -// \addtogroup Socket -// @{ - -// The Socket class gives you a service access point for communication on -// TCP/IP or UDP sockets. -class Socket { -public: - //# ---------- Construction and destruction ---------- - // Create a trivial Socket object, not yet connected to anything. - explicit Socket(const string& socketName = ""); - - // Create server socket and start listener on given port. - Socket(const string& socketname, - const string& service, - int32 proto = Socket::TCP, - int32 backlog = 5); - - // Create client socket and try to connect to given host and port. - Socket(const string& socketname, - const string& hostname, - const string& service, - int32 proto = Socket::TCP); - - ~Socket(); - - // \name Bind and connect - // Routines for binding and connecting the socket object to the TCP/UDP - // stack. - // <group> - int32 initServer(const string& service, - int32 proto = Socket::TCP, - int32 backlog = 5); - int32 initClient(const string& hostname, - const string& service, - int32 proto = Socket::TCP); - // </group> - - // Attempts to (re)connect to a server socket. - // waitMs: <0 blocking - // >=0 wait waitMs milliseconds for completion - // - // Returvalues: - // SK_OK Successful connected - // INPROGRESS Not connected within the given timelimit, still in progress - // CONNECT Some error occured, errnoSys() gives more info - // - int32 connect(int32 waitMs = -1); - - // Tries to (re)accept an incoming connection on a server socket. - // waitMs: <0 blocking - // >=0 wait waitMs milliseconds for completion - // - // Returvalues: - // !=0 Pointer to new created socket. - // 0 Some problem occured, use errcode() to get info: - // SK_OK Successful connected - // INV_OP (Listener)socket must be a server socket - // NOINIT (Listener)socket not initialized yet. - // INPROGRESS Not connected within the given timelimit, still in progress - // ACCEPT Some error occured, errnoSys() gives more info - // - Socket* accept(int32 waitMs = -1); - - // Close the socket. - int32 close(); - - // Shuts down the socket for receive and/or send - int32 shutdown(bool receive = true, bool send = true); - - // Sets the socket in blocking or non-blocking mode. All consequent reads - // and writes in the socket are performed in this mode. - // Default sockets are blocking. - int32 setBlocking(bool blocking = true); - - // Interrupts readblocking/writeblocking calls(for multithreaded sockets) - inline void interrupt(bool allowInterrupt = true); - - // Reads up to maxbytes from socket. When the socket is in blocking mode - // the read waits until nrBytes are received. In non-blocking mode only - // the available bytes are read. - // Returns the number of bytes read or a (negative) errornumber - // Returnvalue: < 0 error occured - // >=0 != nrBytes intr. occured or socket is nonblocking - // >=0 == nrBytes everthing went OK. - // - // Errors: SK_OK no error - // NOINIT socket not initialized yet. - // INCOMPLETE not all bytes are received yet. - // READERR Some generic error, errorSys() given more info - // PEERCLOSED Other sid has closed the connection. - int32 read(void* buf, int32 nrBytes); - - // Writes nrBytes bytes to the socket. - // Returns the number of bytes written or a (negative) errornumber - // Returnvalue: < 0 error occured - // >=0 != maxBytes intr. occured or socket is nonblocking - // >=0 == maxBytes everthing went OK. - // - // Errors: SK_OK no error - // NOINIT socket not initialized yet. - // INCOMPLETE not all bytes are written yet. - // WRITEERR Some generic error, errorSys() given more info - // PEERCLOSED Other sid has closed the connection. - int32 write(const void* buf, int32 nrBytes); - - // Does a blocking read \e independent of the current mode. - // Returnvalues and errors are identical to read(). - int32 readBlocking(void* buf, int32 nrBytes); - - // Does a blocking write \e independent of the current mode. - // Returnvalues and errors are identical to write(). - //# Is this uberhaupt possible in TCP/IP ???? - int32 writeBlocking(const void* buf, int32 nrBytes); - - //# --------------- Miscellaneous functions --------------- - // Points socket at SIGPIPE counter. - // When a read or write is done on the Socket the value of the sigpipe- - // Counter is checked for value-changes. When the value was changed - // during the read or write, the function returns with SIGPIPE and - // will not process the data. - // Such it is possible to implement a sigpipe-handler as long as this - // handler increments the sigpipeCounter everytime it handles some data. - inline void setSigpipeCounter(const volatile int32* counter); - - //# \name Datamember access functions - //# <group> - - // Get name of socket - inline const string& getName() const; - // Set name of socket - inline void setName(const string& value); - - // Get human readable reason for failure. - string errstr() const; - - // Socket errorcode - inline int32 errcode() const; - // System errorcode - inline int32 errnoSys() const; - // Socket ID (filedesc.) - inline int32 getSid() const; - // Protocoltype - inline int16 getType() const; - // Socket role - inline bool isServer() const; - // Connected to other side - inline bool isConnected() const; - // in blocking mode or not - inline bool isBlocking() const; - // Host connected to - inline const string& host() const; - // Port connected to - inline const string& port() const; - // Connected and no errors - inline bool ok() const; - //# </group> - - //# Additional Public Declarations - // Socket types. - typedef enum { - UDP, ///< UDP datagram socket - TCP, ///< TCP(stream) socket over network - UNIX, ///< unix socket(local) - LOCAL=UNIX - } SocketTypes; - - // Error codes - typedef enum { - SK_OK = 0, ///< Ok - SOCKET = -1, ///< Can't create socket - BIND = -2, ///< Can't bind local address - CONNECT = -3, ///< Can't connect to server - ACCEPT = -4, ///< Can't accept client socket - BADHOST = -5, ///< Bad server host name given - BADADDRTYPE = -6, ///< Bad address type - READERR = -7, ///< Read error - WRITERR = -8, ///< Write error - PEERCLOSED = -9, ///< Remote client closed connection - INCOMPLETE = -10, ///< Couldn't read/write whole message - INVOP = -11, ///< Invalid operation - SOCKOPT = -12, ///< sockopt() failure - PORT = -13, ///< wrong port/service specified - PROTOCOL = -14, ///< invalid protocol - LISTEN = -15, ///< listen() error - TIMEOUT = -16, ///< timeout - INPROGRESS = -17, ///< connect() in progress - NOMORECLI = -18, ///< No more clients - SHUTDOWN = -19, ///< shutdown() failure - CLOSE = -20, ///< close() failure - NOINIT = -21 ///< uninitialized socket - } ErrorCodes; - -protected: -#ifndef USE_NOSOCKETS - // Constructs a generic socket for an incoming connection on a server - // socket. - // @{ - Socket(int32 id, struct sockaddr_in &sa); - Socket(int32 id, struct sockaddr_un &sa); - // @} - - // Sets default socket options like reuse address, linger, etc. - int32 setDefaults(); - - // Tries to init the socket by resolving all parameters and allocating - // the real socket. - // @{ - int32 initUnixSocket(bool asServer); - int32 initTCPSocket (bool asServer); - int32 openTCPSocket (bool asServer); - // @} -#endif - // Saves given errorcode and system errorcode - inline int32 setErrno(int32 ErrorNr); - -private: - // Copying is not allowed - // @{ - Socket(const Socket& that); - Socket& operator=(const Socket& that); - // @} - - //# ---------- Data Members ---------- - - // Name of socket given by user - string itsSocketname; - // Own error number - int32 itsErrno; - // System error number - int32 itsSysErrno; - // File descriptor of the socket - int32 itsSocketID; - // Socket type - int16 itsType; - // Server or Client Socket - bool itsIsServer; - // Connected or not - bool itsIsConnected; - // Name of host at other side - string itsHost; - // Portnr of server - string itsPort; - // Interrupt read/write block call - bool itsAllowIntr; - // Socket is initialized - bool itsIsInitialized; - // Blocking mode or not - bool itsIsBlocking; - -#ifndef USE_NOSOCKETS - // Connected client address(TCP) - struct sockaddr_in itsTCPAddr; - // Connected client address(UNIX) - struct sockaddr_un itsUnixAddr; -#endif - int32 itsProtocolType; - - //# Support for sigpipes - const volatile int32* sigpipeCounter; - static int32 defaultSigpipeCounter; - -}; - -// @} - -//# --------------- Inline implementations --------------- - -inline bool Socket::ok() const -{ - return ((itsSocketID >= 0) && !itsErrno); -} - -inline const string& Socket::getName() const -{ - return (itsSocketname); -} - -inline void Socket::setName(const string& value) -{ - itsSocketname = value; -} - -inline int32 Socket::errcode() const -{ - return (itsErrno); -} - -inline int32 Socket::errnoSys() const -{ - return (itsSysErrno); -} - -inline int32 Socket::getSid() const -{ - return (itsSocketID); -} - -inline int16 Socket::getType() const -{ - return (itsType); -} - -inline bool Socket::isServer() const -{ - return (itsIsServer); -} - -inline bool Socket::isConnected() const -{ - return (itsIsConnected); -} - -inline bool Socket::isBlocking() const -{ - return (itsIsBlocking); -} - -inline const string& Socket::host() const -{ - return (itsHost); -} - -inline const string& Socket::port() const -{ - return (itsPort); -} - -inline int32 Socket::setErrno(int32 errorNr) -{ - itsSysErrno = errno; // save system errno - return (itsErrno = errorNr); // save and return given error -} - -inline void Socket::interrupt (bool intr) -{ - itsAllowIntr = intr; -} - -inline void Socket::setSigpipeCounter(const volatile int32 *counter) -{ - sigpipeCounter = counter; -} - -} // namespace LOFAR - -#endif - diff --git a/dependencies/Common/include/Common/Numeric.h b/dependencies/Common/include/Common/Numeric.h deleted file mode 100644 index 5746ecc413d36086ec91345eab822480a7a77c1b..0000000000000000000000000000000000000000 --- a/dependencies/Common/include/Common/Numeric.h +++ /dev/null @@ -1,128 +0,0 @@ -//# Numeric.h: compare floating point numbers. -//# -//# Copyright (C) 2002-2004 -//# ASTRON (Netherlands Institute for Radio Astronomy) -//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands -//# -//# This file is part of the LOFAR software suite. -//# The LOFAR software suite 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 3 of the License, or -//# (at your option) any later version. -//# -//# The LOFAR software suite 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 the LOFAR software suite. If not, see <http://www.gnu.org/licenses/>. -//# -//# $Id$ - -#ifndef LOFAR_COMMON_NUMERIC_H -#define LOFAR_COMMON_NUMERIC_H - -#include <Common/LofarTypes.h> - -//# Never #include <config.h> or #include <lofar_config.h> in a header file! - -// \file -// Compare floating point numbers. - -// \def USE_INFINITYCHECK -// Add check for infinity. You will need this check if you don't want infinity -// to be treated as "close to" \c FLT_MAX. -#define USE_INFINITYCHECK - -// \def USE_NANCHECK -// Add check for Not-a-Number. You will need this check if you want to make -// sure that two NANs are not treated as equal or "close to" one another; or -// if you want to use very large values for maxUlps. -#define USE_NANCHECK - -//# \def USE_SIGNCHECK -//# Add check for sign. You will need this check if you don't want a very small -//# positive number to compare as "close to" a very small negative number. -/* #define USE_SIGNCHECK */ -#undef USE_SIGNCHECK - -namespace LOFAR -{ - // \addtogroup Common - // @{ - - // Numeric operations. - // \attention These operations are only valid for machines that support the - // IEEE 754 floating-point standard. Unfortunately, there is no easy way to - // check this at compile-time. - class Numeric - { - private: - // termplate for masking one type with another - template <typename T, typename M> union maskUnion { - T value; - M mask; - }; - - public: - // Mask type used for floats is a (32-bit) int. - typedef uint32 floatMask_t; - // Mask type used for doubles is a (64-bit) long long. - typedef uint64 doubleMask_t; - - // @{ - // Classes to overlap floating point numbers with masks in a type-safe way - typedef maskUnion<float,floatMask_t> floatUnion_t; - typedef maskUnion<double,doubleMask_t> doubleUnion_t; - // @} - - // \return \c true if f < 0; otherwise \c false. - static bool isNegative(float f); - // \return \c true if d < 0; otherwise \c false. - static bool isNegative(double d); - - // \return \c true if \a f is neither inifinite nor "not-a-number" (NaN); - // otherwise \c false. - static bool isFinite(float f); - // \return \c true if \a d is neither inifinite nor "not-a-number" (NaN); - // otherwise \c false. - static bool isFinite(double d); - - // \return \c true if \a f is infinite; otherwise \c false. - static bool isInf(float f); - // \return \c true if \a d is infinite; otherwise \c false. - static bool isInf(double d); - - // \return \c true if \a f is "not-a-number" (NaN); otherwise \c false. - static bool isNan(float f); - // \return \c true if \a f is "not-a-number" (NaN); otherwise \c false. - static bool isNan(double d); - - // \name Compare - // Compare two numeric values. \a lhs and \a rhs are considered - // equal when the distance, measured in ULPs (Units in Last Place), between - // them is less than \a maxUlps. - //@{ - static bool compare(float lhs, float rhs, floatMask_t maxUlps = 8); - static bool compare(double lhs, double rhs, doubleMask_t maxUlps = 32); - // @} - - private: - - // @{ - // These constants are for IEEE754 floating point numbers. - static const floatMask_t floatNegativeMask = 0x80000000UL; - static const floatMask_t floatExponentMask = 0x7F800000UL; - static const floatMask_t floatMantissaMask = 0x007FFFFFUL; - - static const doubleMask_t doubleNegativeMask = 0x8000000000000000ULL; - static const doubleMask_t doubleExponentMask = 0x7FF0000000000000ULL; - static const doubleMask_t doubleMantissaMask = 0x000FFFFFFFFFFFFFULL; - // @} - - }; - -} // namespace LOFAR - -#endif diff --git a/dependencies/Common/include/Common/ObjectFactory.h b/dependencies/Common/include/Common/ObjectFactory.h deleted file mode 100644 index 2d6c6a107c54182ea81b885099639b70ffa21bce..0000000000000000000000000000000000000000 --- a/dependencies/Common/include/Common/ObjectFactory.h +++ /dev/null @@ -1,207 +0,0 @@ -//# ObjectFactory.h: Generic object factory -//# -//# Copyright (C) 2006 -//# ASTRON (Netherlands Institute for Radio Astronomy) -//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands -//# -//# This file is part of the LOFAR software suite. -//# The LOFAR software suite 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 3 of the License, or -//# (at your option) any later version. -//# -//# The LOFAR software suite 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 the LOFAR software suite. If not, see <http://www.gnu.org/licenses/>. -//# -//# $Id$ - -// \file -// Generic object factory. -// -// The implementation of this object factory was inspired by the article -// <em>Creating a Generic Object Factory</em>, written by Robert Geiman on -// GameDev.net -// (http://www.gamedev.net/reference/articles/article2097.asp). His -// implementation was taken as a starting point and adapted to work with the -// Boost.Preprocessor library. Some code refactoring was performed, and the -// code was made compliant with the %LOFAR coding standards. -// -// The structure of this header file may look intimidating at first; it -// performs almost magic. Keep in mind, though, that all \c BOOST_PP macros -// are simply used to generate repetitive code. In this case template -// specializations of the primary template -// \code -// template <typename Signature, typename TypeId> class ObjectFactory; -// \endcode -// where \c Signature is the signature of the class' constructor, and \c -// TypeId is the type of its unique id. These template specializations define -// object factories for classes with up to \c OBJECT_FACTORY_MAX_CTOR_ARG -// constructor arguments. -// -// The preprocessor constructs below were taken from "Appendix A: An -// Introduction to Preprocessor Metaprogramming" in the book <em>C++ Template -// Metaprogramming</em>, by David Abrahams and Aleksey Gurtovoy -- available -// online at http://boost-consulting.com/tmpbook/preprocessor.html - -#ifndef BOOST_PP_IS_ITERATING - -# ifndef LOFAR_COMMON_OBJECT_FACTORY_H -# define LOFAR_COMMON_OBJECT_FACTORY_H - -# include <Common/lofar_map.h> -# include <Common/lofar_vector.h> -# include <boost/preprocessor/repetition.hpp> -# include <boost/preprocessor/iteration/iterate.hpp> - -# ifndef OBJECT_FACTORY_MAX_CTOR_ARG -# define OBJECT_FACTORY_MAX_CTOR_ARG 8 -# endif - -namespace LOFAR -{ - // \addtogroup Common - // @{ - // Primary template. \c Signature is the signature of the class' - // constructor; \c TypeId is the type of its unique id. - template <typename Signature, typename TypeId> class ObjectFactory; - // @} -} - -# define BOOST_PP_ITERATION_LIMITS (0, OBJECT_FACTORY_MAX_CTOR_ARG) -# define BOOST_PP_FILENAME_1 <Common/ObjectFactory.h> -# include BOOST_PP_ITERATE() -# endif - -#else - -// \cond -# define n BOOST_PP_ITERATION() -// \endcond - -namespace LOFAR -{ - // \addtogroup Common - // @{ - - // Template specialization. - // Expansion of the \c BOOST_PP_ENUM macros leads to the generation of the - // following template specializations: - // \code - // template<typename Base, typename TypeId> - // class ObjectFactory<Base (), TypeId> - // \endcode - // \code - // template<typename Base, typename A0, typename TypeId> - // class ObjectFactory<Base (A0), TypeId> - // \endcode - // \code - // template<typename Base, typename A0, typename A1, typename TypeId> - // class ObjectFactory<Base (A0, A1), TypeId> - // \endcode - // etc. - // - // The number of specializations generated depends on the value of the - // preprocessor macro \c OBJECT_FACTORY_MAX_CTOR_ARG, which defines the - // maximum number of constructor arguments for the class \c Base. It - // defaults to 8. - // - template<typename Base BOOST_PP_ENUM_TRAILING_PARAMS(n, typename A), typename TypeId> - class ObjectFactory<Base* (BOOST_PP_ENUM_PARAMS(n, A)), TypeId> - { - private: - // Typedef for the function that creates an instance of a class that - // inherits from \c Base. - typedef Base* (*CreatorFunc)(BOOST_PP_ENUM_PARAMS(n, A)); - - // Map associating \c TypeId, used to uniquely identify a class, and \c - // CreatorFunc, a pointer to a function that creates an instance of this - // class. - typedef /*typename*/ map<TypeId, CreatorFunc> CreatorMap; - - public: - typedef typename CreatorMap::const_iterator const_iterator; - typedef typename CreatorMap::value_type value_type; - - // Register the class \c Derived using \a id as its unique identifier. The - // static method doCreate<Derived>() will be registered as the method for - // creating objects of type \c Derived. Registration will fail when \c - // itsCreatorMap already contains a key with value \a id. - // \return \c true is registration was successful; otherwise \c false. - // \note \c Derived must inherit from the class \c Base. - template<typename Derived> - bool registerClass(TypeId id) - { - return itsCreatorMap.insert(value_type(id, static_cast<CreatorFunc>(&doCreate<Derived>))).second; - } - - // Unregister the class identified by \a id. The class identified by \a id - // will be removed from \c itsCreatorMap. - // \return \c true if deregistration was successful; otherwise \c false. - bool unregisterClass(TypeId id) - { - return (itsCreatorMap.erase(id)); - } - - // Return a vector of TypeId containing the ID's of all registered - // classes. - vector<TypeId> registeredClassIds() - { - vector<TypeId> ids; - const_iterator end = itsCreatorMap.end(); - for (const_iterator it = itsCreatorMap.begin(); it != end; ++it) { - ids.push_back(it->first); - } - return ids; - } - - // Create a new class instance of the class identified by \a id. - // If \a id is not found in \c itsCreatorMap a null pointer is returned. - Base* create(TypeId id BOOST_PP_ENUM_TRAILING_BINARY_PARAMS(n, A, a)) - { - const_iterator iter = itsCreatorMap.find(id); - if (iter == itsCreatorMap.end()) return 0; - else return iter->second(BOOST_PP_ENUM_PARAMS(n, a)); - } - - // Return a \c const iterator for the first element in \c itsCreatorMap. - const_iterator begin() const - { - return itsCreatorMap.begin(); - } - - // Return a \c const iterator for the position after the last element in - // \c itsCreatorMap. - const_iterator end() const - { - return itsCreatorMap.end(); - } - - private: - - // Map binding the unique class id and its creator function. - CreatorMap itsCreatorMap; - - // Return a pointer to a new instance of class \c Derived. This is the - // method that's being registered as the creator function when a class of - // type \c Derived registers itself with the object factory. - // \note \c Derived must inherit from \c Base. - template<typename Derived> - static Base* doCreate(BOOST_PP_ENUM_BINARY_PARAMS(n, A, a)) - { - return new Derived (BOOST_PP_ENUM_PARAMS(n, a)); - } - - }; - - // @} - -} // namespace LOFAR - -# undef n - -#endif diff --git a/dependencies/Common/include/Common/ParameterSet.h b/dependencies/Common/include/Common/ParameterSet.h index d24a8570ceb3cde962f0d76cfd15fb500d0364e7..0bc00d2bc89a34af1abf5d4b77c1c6460153eda0 100644 --- a/dependencies/Common/include/Common/ParameterSet.h +++ b/dependencies/Common/include/Common/ParameterSet.h @@ -30,7 +30,10 @@ //# Includes #include <Common/ParameterSetImpl.h> #include <Common/KVpair.h> -#include <Common/lofar_smartptr.h> + +#include <memory> + +using std::shared_ptr; namespace LOFAR { diff --git a/dependencies/Common/include/Common/ParameterSetImpl.h b/dependencies/Common/include/Common/ParameterSetImpl.h index f0c02d33fc47fac63104c4f5c45754d65f3fc0b3..90bf252d4408532dc2ead06921324cddaec22300 100644 --- a/dependencies/Common/include/Common/ParameterSetImpl.h +++ b/dependencies/Common/include/Common/ParameterSetImpl.h @@ -30,15 +30,22 @@ //# Includes #include <Common/ParameterValue.h> #include <Common/LofarTypes.h> -#include <Common/lofar_map.h> -#include <Common/lofar_set.h> -#include <Common/lofar_string.h> -#include <Common/lofar_vector.h> #include <Common/lofar_iostream.h> #include <Common/lofar_sstream.h> #include <Common/StringUtil.h> #include <Common/Thread/Mutex.h> -#include <Common/lofar_smartptr.h> + +#include <map> +#include <string> +#include <vector> +#include <memory> +#include <set> + +using std::map; +using std::string; +using std::shared_ptr; +using std::vector; +using std::set; namespace LOFAR { diff --git a/dependencies/Common/include/Common/ParameterValue.h b/dependencies/Common/include/Common/ParameterValue.h index b2fd6fd3f57f47b47c5e1cdcd5e246c941916185..bf2508853970cb337c3baa20f88c9d5c10863947 100644 --- a/dependencies/Common/include/Common/ParameterValue.h +++ b/dependencies/Common/include/Common/ParameterValue.h @@ -29,10 +29,18 @@ //# Never #include <config.h> or #include <lofar_config.h> in a header file! //# Includes #include <Common/LofarTypes.h> -#include <Common/lofar_string.h> -#include <Common/lofar_vector.h> #include <Common/StringUtil.h> +#include <string> +#include <vector> +#include <istream> +#include <ostream> + +using std::string; +using std::vector; +using std::istream; +using std::ostream; + namespace LOFAR { // Forward declaration. diff --git a/dependencies/Common/include/Common/Process.h b/dependencies/Common/include/Common/Process.h deleted file mode 100644 index 12be1d513015840fc08631b50caa898d01ba5c08..0000000000000000000000000000000000000000 --- a/dependencies/Common/include/Common/Process.h +++ /dev/null @@ -1,104 +0,0 @@ -//# Process.h: class wrapping the OS fork method. -//# -//# Copyright (C) 2005 -//# ASTRON (Netherlands Institute for Radio Astronomy) -//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands -//# -//# This file is part of the LOFAR software suite. -//# The LOFAR software suite 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 3 of the License, or -//# (at your option) any later version. -//# -//# The LOFAR software suite 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 the LOFAR software suite. If not, see <http://www.gnu.org/licenses/>. -//# -//# $Id$ - -#ifndef LOFAR_COMMON_PROCESS_H -#define LOFAR_COMMON_PROCESS_H - -// \file -// Class wrapping the OS fork method. - -//# Never #include <config.h> or #include <lofar_config.h> in a header file! - -//# Includes -#include <sys/types.h> // for pid_t - -namespace LOFAR -{ - // \addtogroup Common - // @{ - - // This class provides a wrapper around the OS fork() method. Classes that - // support spawning can inherit (privately) from this class. Two virtual - // methods, parent() and child(), can be overridden by the derived class - // to implement class specific behaviour in the parent and child process - // respectively. - class Process - { - public: - // We need a virtual destructor, because this is an abstract base class. - virtual ~Process(); - - // Spawn the current process, using the sytem's fork() method. After - // spawning the process, spawn() will either call parent() or child(), - // depending on whether the current process is the parent or the child - // process. The parent() and child() method can be overridden by the - // user. - // - // If the parent process does not want to fetch the child's termination - // status you can specfiy \a avoidZombies = \c true. In that case, the - // spawned process will be made child of the \c init process, which will - // fetch the child's termination status. - // - // \return \c true if spawn succeeded, else \c false. - bool spawn(bool avoidZombies = false); - - // Return true if this is the parent process. - bool isParent() { return itsPid > 0; } - - // Return true if this is the child process. - bool isChild() { return itsPid == 0; } - - protected: - // Constructor - Process(); - - // This method will be called in the parent process, immediately after - // spawning. - virtual void parent(); - - // This method will be called in the child process, immediately after - // spawning. - virtual void child(); - - private: - // Copying is not allowed - Process(const Process& that); - Process& operator=(const Process& that); - - // Do the actual spawn. - // \return \c true on succes; \c false on failure. - bool doSpawn(bool avoidZombies); - - //# Datamembers - - // The process id that was returned by the invocation of ::fork(). If - // itsPid == 0, then this is the child process; if itsPid > 0, then - // this is the parent process; if itsPid < 0, it indicates an error. - pid_t itsPid; - - }; - - // @} - -} // namespace LOFAR - -#endif diff --git a/dependencies/Common/include/Common/ReadLine.h b/dependencies/Common/include/Common/ReadLine.h deleted file mode 100644 index 5c00f4082569c7db42573f971832335651ad6cca..0000000000000000000000000000000000000000 --- a/dependencies/Common/include/Common/ReadLine.h +++ /dev/null @@ -1,55 +0,0 @@ -//# ReadLine.h: read a line from stdin using readline or cin -//# -//# Copyright (C) 2009 -//# ASTRON (Netherlands Institute for Radio Astronomy) -//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands -//# -//# This file is part of the LOFAR software suite. -//# The LOFAR software suite 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 3 of the License, or -//# (at your option) any later version. -//# -//# The LOFAR software suite 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 the LOFAR software suite. If not, see <http://www.gnu.org/licenses/>. -//# -//# $Id$ - -#ifndef LOFAR_COMMON_READLINE_H -#define LOFAR_COMMON_READLINE_H - -// \file -// -// The functions in here read a line from stdin using readline. -// If readline is not found during configure, it reverts to reading from cin. -// -// By default file name completion can be used and command recall and editing. -// If context-sensitive completion is needed, the user should initialize -// readline explicitly. - -//# Includes -#include <Common/lofar_string.h> - -namespace LOFAR -{ - // Print a prompt, read a line, and add it to the history. - // False is returned if EOF is given. - // The resulting line is put in the argument \a line. - bool readLine (string& line, const string& prompt=string(), - bool addToHistory=true); - - // Same as readLine, but remove leading whitespace, skip empty lines, - // and optionally skip comment lines. - // The default comment character string is empty meaning that no test - // for comment lines is done. - bool readLineSkip (string& line, const string& prompt=string(), - const string& commentChars=string()); - -} // namespace LOFAR - -#endif diff --git a/dependencies/Common/include/Common/RunOnNode.h b/dependencies/Common/include/Common/RunOnNode.h deleted file mode 100644 index 0de6785dcd7a7406ff2b78a1bf117d3e7a6d88c3..0000000000000000000000000000000000000000 --- a/dependencies/Common/include/Common/RunOnNode.h +++ /dev/null @@ -1,88 +0,0 @@ -//# RunOnNode.h: -//# -//# Copyright (C) 2002-2004 -//# ASTRON (Netherlands Institute for Radio Astronomy) -//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands -//# -//# This file is part of the LOFAR software suite. -//# The LOFAR software suite 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 3 of the License, or -//# (at your option) any later version. -//# -//# The LOFAR software suite 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 the LOFAR software suite. If not, see <http://www.gnu.org/licenses/>. -//# -//# $Id$ - -#ifndef LOFAR_COMMON_RUNONNODE_H -#define LOFAR_COMMON_RUNONNODE_H - -// \file - -//# Never #include <config.h> or #include <lofar_config.h> in a header file! - -//# Includes -#include <Common/LofarLogger.h> - -namespace LOFAR -{ - //# Forward Declarations - - // \addtogroup Common - // @{ - - class RunOnNode - { - public: - RunOnNode(int procesid, int apllid=0); - void setProcessID(int processid); - void setApplID(int applid); - - bool mustExecute(int processid, int applid=0); - bool mustExecuteAppl(int processid); - - private: - static int itsProcessID; - static int itsApplID; - }; - - inline void RunOnNode::setProcessID(int processid) { - DBGASSERTSTR(processid>=0 , "processid value invallid"); - itsProcessID=processid; - } - - inline void RunOnNode::setApplID(int applid) { - DBGASSERTSTR(applid>=0 , "applid value invallid"); - itsApplID=applid; - } - - inline bool RunOnNode::mustExecute(int processid, int applid) { - bool result = ((itsProcessID == processid) && (itsApplID == applid)); - LOG_TRACE_COND_STR("mustExecute(" << processid << "," << applid << ") : " << result); - return result; - } - inline bool RunOnNode::mustExecuteAppl(int applid) { - bool result = (applid == itsApplID); - LOG_TRACE_COND_STR("mustExecuteAppl(" << applid << ") : " << result); - return result; - } - -#define SETNODE(processid, applid) RunOnNode itsRON(processid,applid) -//# todo: #define SETNODEPARM RunOnNode itsRON(param(...),param(...)) - -#define RUNINPROCESS(processid, applid) if(itsRON.mustExecute(processid,applid)) -#define RIP(processid,applid) if(itsRON.mustExecute(processid,applid)) -#define RUNINAPPL(applid) if(itsRON.mustExecuteAppl(applid)) -#define RIA(applid) if(itsRON.mustExecuteAppl(applid)) - - // @} - -} // namespace LOFAR - -#endif diff --git a/dependencies/Common/include/Common/Singleton.h b/dependencies/Common/include/Common/Singleton.h deleted file mode 100644 index e4cc3983ecfe8b6025e050c019682549703cd0a0..0000000000000000000000000000000000000000 --- a/dependencies/Common/include/Common/Singleton.h +++ /dev/null @@ -1,78 +0,0 @@ -//# Singleton.h: Implementation of a Meyers singleton class. -//# -//# Copyright (C) 2002-2004 -//# ASTRON (Netherlands Institute for Radio Astronomy) -//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands -//# -//# This file is part of the LOFAR software suite. -//# The LOFAR software suite 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 3 of the License, or -//# (at your option) any later version. -//# -//# The LOFAR software suite 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 the LOFAR software suite. If not, see <http://www.gnu.org/licenses/>. -//# -//# $Id$ - -#ifndef LOFAR_COMMON_SINGLETON_H -#define LOFAR_COMMON_SINGLETON_H - -// \file -// Implementation of a Meyers singleton class. - -//# Includes - -namespace LOFAR -{ - // \addtogroup Common - // @{ - - // Singleton implements the so-called Meyers singleton (see Item 26 in - // <em>More Effective C++</em>, by Scott Meyers). - // - // \attention The Meyers singleton is \e not thread-safe. So, you can only - // safely use this Singleton class <em>as long as</em> there is only one - // thread running. Note that, in general, the static initialization and - // destruction phases (i.e. before main() has started and after main() has - // finished), are single threaded. - // - // \attention The order of destruction of static objects is - // undetermined. This Singleton class therefore suffers from the so-called - // "Dead Reference Problem" - template<typename T> - class Singleton - { - public: - // Return a reference to the object \c T. The object \c T is created when - // instance() is called for the first time. - static T& instance(); - - private: - // @{ - // Do not allow construction, destruction, copy construction, and - // assignment by a third party. - Singleton(); - Singleton(const Singleton<T>&); - Singleton<T>& operator=(const Singleton<T>&); - ~Singleton(); - // @} - }; - - // @} - - template<typename T> - T& Singleton<T>::instance() - { - static T obj; - return obj; - } - -} // namespace LOFAR - -#endif diff --git a/dependencies/Common/include/Common/Stopwatch.h b/dependencies/Common/include/Common/Stopwatch.h deleted file mode 100644 index 8a6a48cd42091d94a76e6fce1fb3ed7729f19a87..0000000000000000000000000000000000000000 --- a/dependencies/Common/include/Common/Stopwatch.h +++ /dev/null @@ -1,127 +0,0 @@ -//# Stopwatch.h: timer class -//# -//# Copyright (C) 2002 -//# ASTRON (Netherlands Institute for Radio Astronomy) -//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands -//# -//# This file is part of the LOFAR software suite. -//# The LOFAR software suite 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 3 of the License, or -//# (at your option) any later version. -//# -//# The LOFAR software suite 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 the LOFAR software suite. If not, see <http://www.gnu.org/licenses/>. -//# -//# $Id$ - -#ifndef LOFAR_COMMON_STOPWATCH_H -#define LOFAR_COMMON_STOPWATCH_H - -// \file -// Timer class - -//# Includes -#include <sys/times.h> -#include <Common/lofar_string.h> - -namespace LOFAR -{ - - // This class functions as a timer. - // It can give the user, system and elapsed time spent. - - //##ModelId=3DB95464020D - class Stopwatch - { - private: - //##ModelId=3DB9546402F8 - struct tms tms; - //##ModelId=3DB9546402FA - clock_t tick; - //##ModelId=3DB9546402FB - clock_t last_tick; - - //##ModelId=3DB9546402FC - double fire_secs; - //##ModelId=3DB9546402FE - int namewidth; - - //##ModelId=3DB9546402FF - static double scale; // seconds per tick - //##ModelId=3DB954640301 - static struct tms dummy_tms; - - - public: - //##ModelId=3DB954640213 - typedef enum { USER=1,SYSTEM=2,REAL=4,ALL=7 } Components; - - // resets the stopwatch - //##ModelId=3DB954640302 - void reset () - { - tick = times(&tms); - last_tick = static_cast<clock_t>(tick + fire_secs/scale); - } - - //##ModelId=3DB954640304 - Stopwatch (double secs=0) - : fire_secs(secs),namewidth(8) - { reset(); } - - // returns elapsed time, and optionally resets stopwatch - //##ModelId=3DB954640306 - Stopwatch delta (bool do_reset=true); - - // converts to formatted string (user/system/real time) - // If nop is specified, also includes rate in ops/second - //##ModelId=3DB954640308 - string toString (long long nops=0,int opts=ALL,const char *format="%10.3f") const; - - // returns elapsed time as a string, and optionally resets stopwatch - //##ModelId=3DB95464030D - string sdelta (long long nops=0,bool do_reset=true,int opts=ALL) - { return delta(do_reset).toString(nops,opts); } - - // returns elapsed times in specific format - //##ModelId=3DB954640311 - string sdelta (const char *format,bool do_reset,int opts=ALL) - { return delta(do_reset).toString(0,opts,format); } - - // returns elapsed time as a string, and optionally resets stopwatch - // value is preceded by name, formatted with namewidth characters - //##ModelId=3DB954640315 - string dump (const string &name,long long nops=0,bool do_reset=true,int opts=ALL); - - // returns formatted headers for either of the two string forms - //##ModelId=3DB95464031A - static string header (long long nops=0); - - // gets/sets the name width - //##ModelId=3DB95464031D - int nameWidth () const { return namewidth; } - //##ModelId=3DB95464031F - void setNameWidth (int x) { namewidth = x; } - - // returns time components in seconds - //##ModelId=3DB954640321 - double user () const { return tms.tms_utime*scale; } - //##ModelId=3DB954640323 - double sys () const { return tms.tms_stime*scale; } - //##ModelId=3DB954640325 - double real () const { return tick*scale; } - - // returns elapsed time in seconds - //##ModelId=3DB954640327 - bool fired () const { return times(&dummy_tms) >= last_tick; }; - }; - -} // namespace LOFAR - -#endif diff --git a/dependencies/Common/include/Common/StreamUtil.h b/dependencies/Common/include/Common/StreamUtil.h index 8413612f4b6d9403149df71d10ebd67a35246514..67d2897c824a828fcea6d2f556d5b0cbff6bbd02 100644 --- a/dependencies/Common/include/Common/StreamUtil.h +++ b/dependencies/Common/include/Common/StreamUtil.h @@ -28,12 +28,16 @@ //# Includes #include <utility> +#include <string> +#include <vector> +#include <map> #include <Common/LofarTypes.h> -#include <Common/lofar_string.h> -#include <Common/lofar_vector.h> -#include <Common/lofar_map.h> #include <Common/lofar_iostream.h> +using std::string; +using std::vector; +using std::map; + namespace LOFAR { // Handles indentation of text lines. Every time an Indent object is diff --git a/dependencies/Common/include/Common/StringUtil.h b/dependencies/Common/include/Common/StringUtil.h index 13e5ebc85e4cf3a7b5596eafe2e7d8202ccdcb85..a88acb0e04c4a20470762bf686260190756e2982 100644 --- a/dependencies/Common/include/Common/StringUtil.h +++ b/dependencies/Common/include/Common/StringUtil.h @@ -28,11 +28,14 @@ //# Includes #include <Common/LofarTypes.h> -#include <Common/lofar_string.h> -#include <Common/lofar_vector.h> -#include <Common/lofar_algorithm.h> #include <Common/Exception.h> +#include <string> +#include <vector> + +using std::string; +using std::vector; + namespace LOFAR { diff --git a/dependencies/Common/include/Common/SystemUtil.h b/dependencies/Common/include/Common/SystemUtil.h index 96995bab9866a16130b6778c489b9c4c5c928302..02082d442407281cbc29c6e5c9bb15957c3c2933 100644 --- a/dependencies/Common/include/Common/SystemUtil.h +++ b/dependencies/Common/include/Common/SystemUtil.h @@ -28,7 +28,8 @@ //# Includes #include <Common/LofarTypes.h> -#include <Common/lofar_string.h> + +using std::string; namespace LOFAR { diff --git a/dependencies/Common/include/Common/TypeNames.h b/dependencies/Common/include/Common/TypeNames.h deleted file mode 100644 index 0d058d5bfe1b0e282c3bfa318ffa15a9d000f1fb..0000000000000000000000000000000000000000 --- a/dependencies/Common/include/Common/TypeNames.h +++ /dev/null @@ -1,82 +0,0 @@ -//# TypeNames.h: Return a string giving the type name to be stored in blobs -//# -//# Copyright (C) 2003 -//# ASTRON (Netherlands Institute for Radio Astronomy) -//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands -//# -//# This file is part of the LOFAR software suite. -//# The LOFAR software suite 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 3 of the License, or -//# (at your option) any later version. -//# -//# The LOFAR software suite 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 the LOFAR software suite. If not, see <http://www.gnu.org/licenses/>. -//# -//# $Id$ - -#ifndef LOFAR_COMMON_TYPENAMES_H -#define LOFAR_COMMON_TYPENAMES_H - -// \file -// Return a string giving the type name to be stored in blobs - -//# Includes -#include <Common/LofarTypes.h> -#include <Common/lofar_complex.h> -#include <complex> -#include <string> - -namespace LOFAR -{ - // \addtogroup TypeNames - // - // These global functions return the name of the basic types. - // They are meant to get the full id of a templated class when such an - // object is stored in a blob. - // As much as possible std::complex and builtin complex types get the same - // name, so they can be read back from a blob in both ways. - // <group> - - const std::string& typeName (const void*); - const std::string& typeName (const bool*); - const std::string& typeName (const char*); - const std::string& typeName (const int8*); - const std::string& typeName (const uint8*); - const std::string& typeName (const int16*); - const std::string& typeName (const uint16*); - const std::string& typeName (const int32*); - const std::string& typeName (const uint32*); - const std::string& typeName (const int64*); - const std::string& typeName (const uint64*); - const std::string& typeName (const float*); - const std::string& typeName (const double*); - const std::string& typeName (const i4complex*); - const std::string& typeName (const i16complex*); - const std::string& typeName (const u16complex*); - const std::string& typeName (const fcomplex*); - const std::string& typeName (const dcomplex*); -#ifdef LOFAR_BUILTIN_COMPLEXINT - const std::string& typeName (const std::complex<int16>*); - const std::string& typeName (const std::complex<uint16>*); -#endif -#ifdef LOFAR_BUILTIN_COMPLEXFP - const std::string& typeName (const std::complex<float>*); - const std::string& typeName (const std::complex<double>*); -#endif - template<typename T> const std::string& typeName (T const* const*); - -// </group> - -} - -// Include templated implementations. -#include <Common/TypeNames.tcc> - - -#endif diff --git a/dependencies/Common/include/Common/TypeNames.tcc b/dependencies/Common/include/Common/TypeNames.tcc deleted file mode 100644 index 862fcdb601e12d5cb3f03ab0d031802a34fa0a40..0000000000000000000000000000000000000000 --- a/dependencies/Common/include/Common/TypeNames.tcc +++ /dev/null @@ -1,40 +0,0 @@ -//# TypeNames.tcc: Return a string giving the type name to be stored in blobs -//# -//# Copyright (C) 2003 -//# ASTRON (Netherlands Institute for Radio Astronomy) -//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands -//# -//# This file is part of the LOFAR software suite. -//# The LOFAR software suite 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 3 of the License, or -//# (at your option) any later version. -//# -//# The LOFAR software suite 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 the LOFAR software suite. If not, see <http://www.gnu.org/licenses/>. -//# -//# $Id$ - - -#ifndef COMMON_TYPENAMES_TCC -#define COMMON_TYPENAMES_TCC - -//# Includes -#include <Common/TypeNames.h> - -namespace LOFAR -{ - template<typename T> - const std::string& typeName (T const* const*) - { - static std::string str ("array<" + typeName((const T*)0) + ">"); - return str; - } -} - -#endif diff --git a/dependencies/Common/include/Common/complex.h b/dependencies/Common/include/Common/complex.h new file mode 100644 index 0000000000000000000000000000000000000000..55ac7991e7997ea3fcba2a0e3ff5c7ec2166ee60 --- /dev/null +++ b/dependencies/Common/include/Common/complex.h @@ -0,0 +1,18 @@ +#ifndef LOFAR_COMMON_COMPLEX_H +#define LOFAR_COMMON_COMPLEX_H + +#include <complex> +#include <cstdint> +#include <Common/i4complex.h> + +namespace LOFAR { + typedef std::complex<float> fcomplex; + typedef std::complex<double> dcomplex; + + typedef std::complex<int8_t> i8complex; + typedef std::complex<int16_t> i16complex; + + using LOFAR::TYPES::i4complex; +} + +#endif diff --git a/dependencies/Common/include/Common/hexdump.h b/dependencies/Common/include/Common/hexdump.h deleted file mode 100644 index fb40cc129b6e7a57540d4e9270f3f33874ea337c..0000000000000000000000000000000000000000 --- a/dependencies/Common/include/Common/hexdump.h +++ /dev/null @@ -1,44 +0,0 @@ -//# hexdump.h: create hexdump of given datablock -//# -//# Copyright (C) 2002-2004 -//# ASTRON (Netherlands Institute for Radio Astronomy) -//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands -//# -//# This file is part of the LOFAR software suite. -//# The LOFAR software suite 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 3 of the License, or -//# (at your option) any later version. -//# -//# The LOFAR software suite 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 the LOFAR software suite. If not, see <http://www.gnu.org/licenses/>. -//# -//# $Id$ - -#ifndef LOFAR_COMMON_HEXDUMP_H -#define LOFAR_COMMON_HEXDUMP_H - -// \file -// Create hexdump of given datablock - -//# Never #include <config.h> or #include <lofar_config.h> in a header file! -#include <Common/LofarTypes.h> -#include <Common/lofar_string.h> - - -namespace LOFAR -{ - - void hexdump ( const void* buf, int32 nrBytes); - void hexdump (FILE* aFile, const void* buf, int32 nrBytes); - void hexdump (char* aChrPtr, const void* buf, int32 nrBytes); - void hexdump (string& aString, const void* buf, int32 nrBytes); - -} // namespace LOFAR - -#endif diff --git a/dependencies/Common/include/Common/lofar_algorithm.h b/dependencies/Common/include/Common/lofar_algorithm.h deleted file mode 100644 index 7b236f70e67078010386aa78a68f007d0d5e6374..0000000000000000000000000000000000000000 --- a/dependencies/Common/include/Common/lofar_algorithm.h +++ /dev/null @@ -1,101 +0,0 @@ -//# lofar_algorithm.h: -//# -//# Copyright (C) 2002 -//# ASTRON (Netherlands Institute for Radio Astronomy) -//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands -//# -//# This file is part of the LOFAR software suite. -//# The LOFAR software suite 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 3 of the License, or -//# (at your option) any later version. -//# -//# The LOFAR software suite 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 the LOFAR software suite. If not, see <http://www.gnu.org/licenses/>. -//# -//# $Id$ - -#ifndef LOFAR_COMMON_ALGORITHM_H -#define LOFAR_COMMON_ALGORITHM_H - -// \file - -#include <algorithm> - -namespace LOFAR -{ - using std::adjacent_find; - using std::binary_search; - using std::copy; - using std::copy_backward; - using std::count; - using std::count_if; - using std::equal; - using std::equal_range; - using std::fill; - using std::fill_n; - using std::find; - using std::find_end; - using std::find_first_of; - using std::find_if; - using std::for_each; - using std::generate; - using std::generate_n; - using std::includes; - using std::inplace_merge; - using std::iter_swap; - using std::lexicographical_compare; - using std::lower_bound; - using std::make_heap; - using std::max; - using std::max_element; - using std::merge; - using std::min; - using std::min_element; - using std::mismatch; - using std::next_permutation; - using std::nth_element; - using std::partial_sort; - using std::partial_sort_copy; - using std::partition; - using std::pop_heap; - using std::prev_permutation; - using std::push_heap; - using std::random_shuffle; - using std::remove; - using std::remove_copy; - using std::remove_copy_if; - using std::remove_if; - using std::replace; - using std::replace_copy; - using std::replace_copy_if; - using std::replace_if; - using std::reverse; - using std::reverse_copy; - using std::rotate; - using std::rotate_copy; - using std::search; - using std::search_n; - using std::set_difference; - using std::set_intersection; - using std::set_symmetric_difference; - using std::set_union; - using std::sort; - using std::sort_heap; - using std::stable_partition; - using std::stable_sort; - using std::swap; - using std::swap_ranges; - using std::transform; - using std::unique; - using std::unique_copy; - using std::upper_bound; -} - -#endif - diff --git a/dependencies/Common/include/Common/lofar_complex.h b/dependencies/Common/include/Common/lofar_complex.h deleted file mode 100644 index 8f6c48ffda722ec64db37fa2fb97c53b445514bc..0000000000000000000000000000000000000000 --- a/dependencies/Common/include/Common/lofar_complex.h +++ /dev/null @@ -1,215 +0,0 @@ -//# lofar_complex.h: -//# -//# Copyright (C) 2002 -//# ASTRON (Netherlands Institute for Radio Astronomy) -//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands -//# -//# This file is part of the LOFAR software suite. -//# The LOFAR software suite 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 3 of the License, or -//# (at your option) any later version. -//# -//# The LOFAR software suite 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 the LOFAR software suite. If not, see <http://www.gnu.org/licenses/>. -//# -//# $Id$ - -#ifndef LOFAR_COMMON_COMPLEX_H -#define LOFAR_COMMON_COMPLEX_H - -// \file - -//# Put sin, etc. in LOFAR namespace. -#include <Common/lofar_math.h> - -//# ICC supports builtin complex for floating point types only. -//# GCC supports it for both floating point and integer types. -//# Both use __complex__ as the complex type specifier. -//# Other compilers might use _Complex, so define LOFAR_BUILTIN_COMPLEX -//# as such to use it. -//# Note that ComplexBuiltin.h uses __real__ and __imag__. Maybe they -//# also need different names for _Complex. -//# Note: include StdInt and BuiltinFP in this order, otherwise the gcc -//# compiler complains that conj already exists in LOFAR namespace. -#if defined __INTEL_COMPILER -# define LOFAR_BUILTIN_COMPLEXFP __complex__ -# include <Common/ComplexStdInt.h> -# include <Common/ComplexBuiltinFP.h> - -#elif defined __GNUC__ && __GNUC__ < 4 && !defined __INSURE__ -# define LOFAR_BUILTIN_COMPLEXFP __complex__ -# define LOFAR_BUILTIN_COMPLEXINT __complex__ -# include <Common/ComplexBuiltinFP.h> -# include <Common/ComplexBuiltinInt.h> - -#else -# include <Common/ComplexStdFP.h> -# include <Common/ComplexStdInt.h> - -#endif - -#include <Common/i4complex.h> - -namespace LOFAR -{ - // Define complex types in LOFAR namespace. - using TYPES::i4complex; - using TYPES::i8complex; - using TYPES::i16complex; - using TYPES::u16complex; - using TYPES::fcomplex; - using TYPES::dcomplex; - - inline static i4complex makei4complex(const i4complex &z) { - return z; - } - - inline static i4complex makei4complex(const i8complex &z) { - return makei4complex(real(z) - .5, imag(z) - .5); - } - - inline static i4complex makei4complex(const i16complex &z) { - return makei4complex(real(z) - .5, imag(z) - .5); - } - - inline static i4complex makei4complex(const u16complex &z) { - return makei4complex(real(z) - .5, imag(z) - .5); - } - - inline static i4complex makei4complex(const fcomplex &z) { - return makei4complex(real(z), imag(z)); - } - - inline static i4complex makei4complex(const dcomplex &z) { - return makei4complex(real(z), imag(z)); - } - - inline static i8complex makei8complex(const i4complex &z) { - return makei8complex(TYPES::int8(real(z)), TYPES::int8(imag(z))); - } - - inline static i8complex makei8complex(const i8complex &z) { - return z; - } - - inline static i8complex makei8complex(const i16complex &z) { - return makei8complex(TYPES::int8(real(z)), TYPES::int8(imag(z))); - } - - inline static i8complex makei8complex(const u16complex &z) { - return makei8complex(real(z), imag(z)); - } - - inline static i8complex makei8complex(const fcomplex &z) { - return makei8complex(TYPES::int8(real(z)), TYPES::int8(imag(z))); - } - - inline static i8complex makei8complex(const dcomplex &z) { - return makei8complex(TYPES::int8(real(z)), TYPES::int8(imag(z))); - } - - inline static i16complex makei16complex(const i4complex &z) { - return makei16complex(TYPES::int16(real(z)), TYPES::int16(imag(z))); - } - - inline static i16complex makei16complex(const i8complex &z) { - return makei16complex(real(z), imag(z)); - } - - inline static i16complex makei16complex(const i16complex &z) { - return z; - } - - inline static i16complex makei16complex(const u16complex &z) { - return makei16complex(real(z), imag(z)); - } - - inline static i16complex makei16complex(const fcomplex &z) { - return makei16complex(TYPES::int16(real(z)), TYPES::int16(imag(z))); - } - - inline static i16complex makei16complex(const dcomplex &z) { - return makei16complex(TYPES::int16(real(z)), TYPES::int16(imag(z))); - } - - inline static u16complex makeu16complex(const i4complex &z) { - return makeu16complex(TYPES::uint16(real(z)), TYPES::uint16(imag(z))); - } - - inline static u16complex makeu16complex(const i8complex &z) { - return makeu16complex(real(z), imag(z)); - } - - inline static u16complex makeu16complex(const i16complex &z) { - return makeu16complex(real(z), imag(z)); - } - - inline static u16complex makeu16complex(const u16complex &z) { - return z; - } - - inline static u16complex makeu16complex(const fcomplex &z) { - return makeu16complex(TYPES::uint16(real(z)), TYPES::uint16(imag(z))); - } - - inline static u16complex makeu16complex(const dcomplex &z) { - return makeu16complex(TYPES::uint16(real(z)), TYPES::uint16(imag(z))); - } - - inline static fcomplex makefcomplex(const i4complex &z) { - return makefcomplex(float(real(z)), float(imag(z))); - } - - inline static fcomplex makefcomplex(const i8complex &z) { - return makefcomplex((float) real(z), (float) imag(z)); - } - - inline static fcomplex makefcomplex(const i16complex &z) { - return makefcomplex((float) real(z), (float) imag(z)); - } - - inline static fcomplex makefcomplex(const u16complex &z) { - return makefcomplex((float) real(z), (float) imag(z)); - } - - inline static fcomplex makefcomplex(const fcomplex &z) { - return z; - } - - inline static fcomplex makefcomplex(const dcomplex &z) { - return makefcomplex(float(real(z)), float(imag(z))); - } - - inline static dcomplex makedcomplex(const i4complex &z) { - return makedcomplex(real(z), imag(z)); - } - - inline static dcomplex makedcomplex(const i8complex &z) { - return makedcomplex((double) real(z), (double) imag(z)); - } - - inline static dcomplex makedcomplex(const i16complex &z) { - return makedcomplex((double) real(z), (double) imag(z)); - } - - inline static dcomplex makedcomplex(const u16complex &z) { - return makedcomplex((double) real(z), (double) imag(z)); - } - - inline static dcomplex makedcomplex(const fcomplex &z) { - return makedcomplex((double) real(z), (double) imag(z)); - } - - inline static dcomplex makedcomplex(const dcomplex &z) { - return z; - } -} - - -#endif diff --git a/dependencies/Common/include/Common/lofar_deque.h b/dependencies/Common/include/Common/lofar_deque.h deleted file mode 100644 index ff479bdf69103edfd25dbb9d4414dbd076f1f394..0000000000000000000000000000000000000000 --- a/dependencies/Common/include/Common/lofar_deque.h +++ /dev/null @@ -1,35 +0,0 @@ -//# lofar_deque.h: -//# -//# Copyright (C) 2002 -//# ASTRON (Netherlands Institute for Radio Astronomy) -//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands -//# -//# This file is part of the LOFAR software suite. -//# The LOFAR software suite 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 3 of the License, or -//# (at your option) any later version. -//# -//# The LOFAR software suite 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 the LOFAR software suite. If not, see <http://www.gnu.org/licenses/>. -//# -//# $Id$ - -#ifndef LOFAR_COMMON_DEQUE_H -#define LOFAR_COMMON_DEQUE_H - -// \file - -#include <deque> - -namespace LOFAR -{ - using std::deque; -} - -#endif diff --git a/dependencies/Common/include/Common/lofar_list.h b/dependencies/Common/include/Common/lofar_list.h deleted file mode 100644 index 5f4aa5dc1d3366dd5c47e162ab4ed321e5ce4eff..0000000000000000000000000000000000000000 --- a/dependencies/Common/include/Common/lofar_list.h +++ /dev/null @@ -1,35 +0,0 @@ -//# lofar_list.h: -//# -//# Copyright (C) 2002 -//# ASTRON (Netherlands Institute for Radio Astronomy) -//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands -//# -//# This file is part of the LOFAR software suite. -//# The LOFAR software suite 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 3 of the License, or -//# (at your option) any later version. -//# -//# The LOFAR software suite 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 the LOFAR software suite. If not, see <http://www.gnu.org/licenses/>. -//# -//# $Id$ - -#ifndef LOFAR_COMMON_LIST_H -#define LOFAR_COMMON_LIST_H - -// \file - -#include <list> - -namespace LOFAR -{ - using std::list; -} - -#endif diff --git a/dependencies/Common/include/Common/lofar_map.h b/dependencies/Common/include/Common/lofar_map.h deleted file mode 100644 index f518752874cb59169bfa657f51b9890512a75919..0000000000000000000000000000000000000000 --- a/dependencies/Common/include/Common/lofar_map.h +++ /dev/null @@ -1,38 +0,0 @@ -//# lofar_map.h: -//# -//# Copyright (C) 2002 -//# ASTRON (Netherlands Institute for Radio Astronomy) -//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands -//# -//# This file is part of the LOFAR software suite. -//# The LOFAR software suite 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 3 of the License, or -//# (at your option) any later version. -//# -//# The LOFAR software suite 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 the LOFAR software suite. If not, see <http://www.gnu.org/licenses/>. -//# -//# $Id$ - -#ifndef LOFAR_COMMON_MAP_H -#define LOFAR_COMMON_MAP_H - -// \file - -#include <map> - -namespace LOFAR -{ - using std::map; - using std::multimap; - using std::pair; - using std::make_pair; -} - -#endif diff --git a/dependencies/Common/include/Common/lofar_math.h b/dependencies/Common/include/Common/lofar_math.h deleted file mode 100644 index a0f8f3714680341e96492ff170afbdb25ef0eca7..0000000000000000000000000000000000000000 --- a/dependencies/Common/include/Common/lofar_math.h +++ /dev/null @@ -1,57 +0,0 @@ -//# lofar_math.h: -//# -//# Copyright (C) 2002 -//# ASTRON (Netherlands Institute for Radio Astronomy) -//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands -//# -//# This file is part of the LOFAR software suite. -//# The LOFAR software suite 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 3 of the License, or -//# (at your option) any later version. -//# -//# The LOFAR software suite 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 the LOFAR software suite. If not, see <http://www.gnu.org/licenses/>. -//# -//# $Id$ - -#ifndef LOFAR_COMMON_MATH_H -#define LOFAR_COMMON_MATH_H - -// \file - -#include <cmath> - -namespace LOFAR -{ - using std::abs; - using std::acos; - using std::asin; - using std::atan; - using std::atan2; - using std::ceil; - using std::cos; - using std::cosh; - using std::exp; - using std::fabs; - using std::floor; - using std::fmod; - using std::frexp; - using std::ldexp; - using std::log; - using std::log10; - using std::modf; - using std::pow; - using std::sin; - using std::sinh; - using std::sqrt; - using std::tan; - using std::tanh; -} - -#endif diff --git a/dependencies/Common/include/Common/lofar_numeric.h b/dependencies/Common/include/Common/lofar_numeric.h deleted file mode 100644 index 23b95a44ae7d72cf194b45f01c05d9dc53580c2e..0000000000000000000000000000000000000000 --- a/dependencies/Common/include/Common/lofar_numeric.h +++ /dev/null @@ -1,38 +0,0 @@ -//# lofar_numeric.h: -//# -//# Copyright (C) 2002 -//# ASTRON (Netherlands Institute for Radio Astronomy) -//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands -//# -//# This file is part of the LOFAR software suite. -//# The LOFAR software suite 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 3 of the License, or -//# (at your option) any later version. -//# -//# The LOFAR software suite 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 the LOFAR software suite. If not, see <http://www.gnu.org/licenses/>. -//# -//# $Id$ - -#ifndef LOFAR_COMMON_NUMERIC_H -#define LOFAR_COMMON_NUMERIC_H - -// \file - -#include <numeric> - -namespace LOFAR -{ - using std::accumulate; - using std::adjacent_difference; - using std::inner_product; - using std::partial_sum; -} - -#endif diff --git a/dependencies/Common/include/Common/lofar_set.h b/dependencies/Common/include/Common/lofar_set.h deleted file mode 100644 index 208363895a42d6aca782e8d5e8136bdc17f6844e..0000000000000000000000000000000000000000 --- a/dependencies/Common/include/Common/lofar_set.h +++ /dev/null @@ -1,38 +0,0 @@ -//# lofar_set.h: -//# -//# Copyright (C) 2002 -//# ASTRON (Netherlands Institute for Radio Astronomy) -//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands -//# -//# This file is part of the LOFAR software suite. -//# The LOFAR software suite 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 3 of the License, or -//# (at your option) any later version. -//# -//# The LOFAR software suite 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 the LOFAR software suite. If not, see <http://www.gnu.org/licenses/>. -//# -//# $Id$ - -#ifndef LOFAR_COMMON_SET_H -#define LOFAR_COMMON_SET_H - -// \file - -#include <set> - -namespace LOFAR -{ - using std::set; - using std::multiset; - using std::pair; - using std::make_pair; -} - -#endif diff --git a/dependencies/Common/include/Common/lofar_smartptr.h b/dependencies/Common/include/Common/lofar_smartptr.h deleted file mode 100644 index 8eed37e5940d83c7c2e08dfd60e41106a71e1902..0000000000000000000000000000000000000000 --- a/dependencies/Common/include/Common/lofar_smartptr.h +++ /dev/null @@ -1,45 +0,0 @@ -//# lofar_smartptr.h: namespace wrapper for Boost Smart Pointers -//# -//# Copyright (C) 2002 -//# ASTRON (Netherlands Institute for Radio Astronomy) -//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands -//# -//# This file is part of the LOFAR software suite. -//# The LOFAR software suite 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 3 of the License, or -//# (at your option) any later version. -//# -//# The LOFAR software suite 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 the LOFAR software suite. If not, see <http://www.gnu.org/licenses/>. -//# -//# $Id$ - -#ifndef LOFAR_COMMON_SMARTPTR_H -#define LOFAR_COMMON_SMARTPTR_H - -// \file -// namespace wrapper for Boost Smart Pointers - -#include <boost/smart_ptr.hpp> - -namespace LOFAR -{ - using boost::scoped_ptr; - using boost::scoped_array; - using boost::shared_ptr; - using boost::shared_array; - using boost::weak_ptr; - using boost::intrusive_ptr; - using boost::enable_shared_from_this; - using boost::static_pointer_cast; - using boost::const_pointer_cast; - using boost::dynamic_pointer_cast; -} - -#endif diff --git a/dependencies/Common/include/Common/lofar_stack.h b/dependencies/Common/include/Common/lofar_stack.h deleted file mode 100644 index 818bd400a1e9e376319a59941ecd55fe6fb9d618..0000000000000000000000000000000000000000 --- a/dependencies/Common/include/Common/lofar_stack.h +++ /dev/null @@ -1,36 +0,0 @@ -//# lofar_stack.h: -//# -//# Copyright (C) 2002 -//# ASTRON (Netherlands Institute for Radio Astronomy) -//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands -//# -//# This file is part of the LOFAR software suite. -//# The LOFAR software suite 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 3 of the License, or -//# (at your option) any later version. -//# -//# The LOFAR software suite 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 the LOFAR software suite. If not, see <http://www.gnu.org/licenses/>. -//# -//# $Id$ - -#ifndef LOFAR_COMMON_STACK_H -#define LOFAR_COMMON_STACK_H - -// \file - -#include <Common/lofar_deque.h> -#include <stack> - -namespace LOFAR -{ - using std::stack; -} - -#endif diff --git a/dependencies/Common/include/Common/lofar_string.h b/dependencies/Common/include/Common/lofar_string.h deleted file mode 100644 index 8ed87dc6e199b011e36b76c9db88c4d094ff3e93..0000000000000000000000000000000000000000 --- a/dependencies/Common/include/Common/lofar_string.h +++ /dev/null @@ -1,36 +0,0 @@ -//# lofar_string.h: -//# -//# Copyright (C) 2002 -//# ASTRON (Netherlands Institute for Radio Astronomy) -//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands -//# -//# This file is part of the LOFAR software suite. -//# The LOFAR software suite 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 3 of the License, or -//# (at your option) any later version. -//# -//# The LOFAR software suite 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 the LOFAR software suite. If not, see <http://www.gnu.org/licenses/>. -//# -//# $Id$ - -#ifndef LOFAR_COMMON_STRING_H -#define LOFAR_COMMON_STRING_H - -// \file - -#include <string> - -namespace LOFAR -{ - using std::string; - using std::getline; -} - -#endif diff --git a/dependencies/Common/include/Common/lofar_thread.h b/dependencies/Common/include/Common/lofar_thread.h deleted file mode 100644 index 90581dca7d96ca3a547cc490ce88d80501b837a4..0000000000000000000000000000000000000000 --- a/dependencies/Common/include/Common/lofar_thread.h +++ /dev/null @@ -1,57 +0,0 @@ -//# lofar_thread.h: namespace wrapper for Boost.Thread -//# -//# Copyright (C) 2002 -//# ASTRON (Netherlands Institute for Radio Astronomy) -//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands -//# -//# This file is part of the LOFAR software suite. -//# The LOFAR software suite 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 3 of the License, or -//# (at your option) any later version. -//# -//# The LOFAR software suite 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 the LOFAR software suite. If not, see <http://www.gnu.org/licenses/>. -//# -//# $Id$ - -#ifndef LOFAR_COMMON_THREAD_H -#define LOFAR_COMMON_THREAD_H - -// \file -// namespace wrapper for Boost.Thread - -#ifndef USE_THREADS -#error Threading support unavailable: it should be explicitly enabled \ -with USE_THREADS -#endif - -#include <boost/thread.hpp> - -namespace LOFAR -{ -// using boost::barrier; - using boost::condition; - using boost::lock_error; - using boost::thread_resource_error; - using boost::mutex; - using boost::try_mutex; - using boost::timed_mutex; - using boost::call_once; - using boost::recursive_mutex; - using boost::recursive_try_mutex; - using boost::recursive_timed_mutex; - using boost::thread; - using boost::thread_group; - using boost::xtime; - using boost::xtime_get; -} - -#define LOFAR_ONCE_INIT BOOST_ONCE_INIT - -#endif diff --git a/dependencies/Common/include/Common/lofar_tribool.h b/dependencies/Common/include/Common/lofar_tribool.h deleted file mode 100644 index 9a7ca161095bae55d5d9965380b3fad40dd3fa6c..0000000000000000000000000000000000000000 --- a/dependencies/Common/include/Common/lofar_tribool.h +++ /dev/null @@ -1,37 +0,0 @@ -//# lofar_tribool.h: namespace wrapper for Boost.Tribool -//# -//# Copyright (C) 2002 -//# ASTRON (Netherlands Institute for Radio Astronomy) -//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands -//# -//# This file is part of the LOFAR software suite. -//# The LOFAR software suite 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 3 of the License, or -//# (at your option) any later version. -//# -//# The LOFAR software suite 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 the LOFAR software suite. If not, see <http://www.gnu.org/licenses/>. -//# -//# $Id$ - -#ifndef LOFAR_COMMON_TRIBOOL_H -#define LOFAR_COMMON_TRIBOOL_H - -// \file -// namespace wrapper for Boost.Tribool - -#include <boost/logic/tribool.hpp> - -namespace LOFAR -{ - using boost::logic::tribool; - using boost::logic::indeterminate; -} - -#endif diff --git a/dependencies/Common/include/Common/lofar_vector.h b/dependencies/Common/include/Common/lofar_vector.h deleted file mode 100644 index b2d64ca35cbb7abf134cd1301764ebe9de49a6e2..0000000000000000000000000000000000000000 --- a/dependencies/Common/include/Common/lofar_vector.h +++ /dev/null @@ -1,35 +0,0 @@ -//# lofar_vector.h: -//# -//# Copyright (C) 2002 -//# ASTRON (Netherlands Institute for Radio Astronomy) -//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands -//# -//# This file is part of the LOFAR software suite. -//# The LOFAR software suite 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 3 of the License, or -//# (at your option) any later version. -//# -//# The LOFAR software suite 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 the LOFAR software suite. If not, see <http://www.gnu.org/licenses/>. -//# -//# $Id$ - -#ifndef LOFAR_COMMON_VECTOR_H -#define LOFAR_COMMON_VECTOR_H - -// \file - -#include <vector> - -namespace LOFAR -{ - using std::vector; -} - -#endif diff --git a/dependencies/Common/include/Common/shmem/dlmalloc.h b/dependencies/Common/include/Common/shmem/dlmalloc.h deleted file mode 100644 index 6c402d3b313a837aefb743ba86e1343a28a69353..0000000000000000000000000000000000000000 --- a/dependencies/Common/include/Common/shmem/dlmalloc.h +++ /dev/null @@ -1,708 +0,0 @@ -/** - \file - This is an adaptation of Doug Lea's malloc to be used for shared memory. - - Default header file for malloc-2.7.0, written by Doug Lea - and released to the public domain. Use, modify, and redistribute - this code without permission or acknowledgement in any way you wish. - Send questions, comments, complaints, performance data, etc to - dl@cs.oswego.edu. - - last update: Sun Feb 25 18:38:11 2001 Doug Lea (dl at gee) - - This header is for ANSI C/C++ only. You can set either of - the following \#defines before including: - - - If USE_DL_PREFIX is defined, it is assumed that malloc.c - was also compiled with this option, so all routines - have names starting with "dl". - - - If HAVE_USR_INCLUDE_MALLOC_H is defined, it is assumed that this - file will be \#included AFTER <malloc.h>. This is needed only if - your system defines a struct mallinfo that is incompatible with the - standard one declared here. Otherwise, you can include this file - INSTEAD of your system system <malloc.h>. At least on ANSI, all - declarations should be compatible with system versions -*/ - -#ifndef MALLOC_270_H -#define MALLOC_270_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include <stddef.h> /* for size_t */ - -/** - \ingroup Common - \addtogroup shmem - @{ -*/ - -/** - malloc(size_t n) - Returns a pointer to a newly allocated chunk of at least n bytes, or - null if no space is available. Additionally, on failure, errno is - set to ENOMEM on ANSI C systems. - - If n is zero, malloc returns a minimum-sized chunk. The minimum size - is 16 bytes on most 32bit systems, and either 24 or 32 bytes on - 64bit systems, depending on internal size and alignment restrictions. - - On most systems, size_t is an unsigned type. Calls with values of n - that appear "negative" when signed are interpreted as requests for - huge amounts of space, which will most often fail. - - The maximum allowed value of n differs across systems, but is in all - cases less (typically by 8K) than the maximum representable value of - a size_t. Requests greater than this value result in failure. -*/ - -#ifndef USE_DL_PREFIX -void* malloc(size_t); -#else -void* dlmalloc(size_t); -#endif - -/** - free(void* p) - Releases the chunk of memory pointed to by p, that had been previously - allocated using malloc or a related routine such as realloc. - It has no effect if p is null. It can have arbitrary (and bad!) - effects if p has already been freed or was not obtained via malloc. - - Unless disabled using mallopt, freeing very large spaces will, - when possible, automatically trigger operations that give - back unused memory to the system, thus reducing program footprint. -*/ -#ifndef USE_DL_PREFIX -void free(void*); -#else -void dlfree(void*); -#endif - -/** - calloc(size_t n_elements, size_t element_size); - Returns a pointer to n_elements * element_size bytes, with all locations - set to zero. -*/ -#ifndef USE_DL_PREFIX -void* calloc(size_t, size_t); -#else -void* dlcalloc(size_t, size_t); -#endif - -/** - realloc(void* p, size_t n) - Returns a pointer to a chunk of size n that contains the same data - as does chunk p up to the minimum of (n, p's size) bytes. - - The returned pointer may or may not be the same as p. The algorithm - prefers extending p when possible, otherwise it employs the - equivalent of a malloc-copy-free sequence. - - If p is null, realloc is equivalent to malloc. - - If space is not available, realloc returns null, errno is set (if on - ANSI) and p is NOT freed. - - if n is for fewer bytes than already held by p, the newly unused - space is lopped off and freed if possible. Unless the \#define - REALLOC_ZERO_BYTES_FREES is set, realloc with a size argument of - zero (re)allocates a minimum-sized chunk. - - Large chunks that were internally obtained via mmap will always - be reallocated using malloc-copy-free sequences unless - the system supports MREMAP (currently only linux). - - The old unix realloc convention of allowing the last-free'd chunk - to be used as an argument to realloc is not supported. -*/ - -#ifndef USE_DL_PREFIX -void* realloc(void*, size_t); -#else -void* dlrealloc(void*, size_t); -#endif - -/** - memalign(size_t alignment, size_t n); - Returns a pointer to a newly allocated chunk of n bytes, aligned - in accord with the alignment argument. - - The alignment argument should be a power of two. If the argument is - not a power of two, the nearest greater power is used. - 8-byte alignment is guaranteed by normal malloc calls, so don't - bother calling memalign with an argument of 8 or less. - - Overreliance on memalign is a sure way to fragment space. -*/ - -#ifndef USE_DL_PREFIX -void* memalign(size_t, size_t); -#else -void* dlmemalign(size_t, size_t); -#endif - - -/** - valloc(size_t n); - Allocates a page-aligned chunk of at least n bytes. - Equivalent to memalign(pagesize, n), where pagesize is the page - size of the system. If the pagesize is unknown, 4096 is used. -*/ - -#ifndef USE_DL_PREFIX -void* valloc(size_t); -#else -void* dlvalloc(size_t); -#endif - - -/** - independent_calloc(size_t n_elements, size_t element_size, void* chunks[]); - - independent_calloc is similar to calloc, but instead of returning a - single cleared space, it returns an array of pointers to n_elements - independent elements, each of which can hold contents of size - elem_size. Each element starts out cleared, and can be - independently freed, realloc'ed etc. The elements are guaranteed to - be adjacently allocated (this is not guaranteed to occur with - multiple callocs or mallocs), which may also improve cache locality - in some applications. - - The "chunks" argument is optional (i.e., may be null, which is - probably the most typical usage). If it is null, the returned array - is itself dynamically allocated and should also be freed when it is - no longer needed. Otherwise, the chunks array must be of at least - n_elements in length. It is filled in with the pointers to the - chunks. - - In either case, independent_calloc returns this pointer array, or - null if the allocation failed. If n_elements is zero and "chunks" - is null, it returns a chunk representing an array with zero elements - (which should be freed if not wanted). - - Each element must be individually freed when it is no longer - needed. If you'd like to instead be able to free all at once, you - should instead use regular calloc and assign pointers into this - space to represent elements. (In this case though, you cannot - independently free elements.) - - independent_calloc simplifies and speeds up implementations of many - kinds of pools. It may also be useful when constructing large data - structures that initially have a fixed number of fixed-sized nodes, - but the number is not known at compile time, and some of the nodes - may later need to be freed. For example: - - \code - struct Node { int item; struct Node* next; }; - - struct Node* build_list() { - struct Node** pool; - int n = read_number_of_nodes_needed(); - if (n <= 0) return 0; - pool = (struct Node**)(independent_calloc(n, sizeof(struct Node), 0); - if (pool == 0) return 0; // failure - // organize into a linked list... - struct Node* first = pool[0]; - for (i = 0; i < n-1; ++i) - pool[i]->next = pool[i+1]; - free(pool); // Can now free the array (or not, if it is needed later) - return first; - } - \endcode -*/ - -#ifndef USE_DL_PREFIX -void** independent_calloc(size_t, size_t, void**); -#else -void** dlindependent_calloc(size_t, size_t, void**); -#endif - -/** - independent_comalloc(size_t n_elements, size_t sizes[], void* chunks[]); - - independent_comalloc allocates, all at once, a set of n_elements - chunks with sizes indicated in the "sizes" array. It returns - an array of pointers to these elements, each of which can be - independently freed, realloc'ed etc. The elements are guaranteed to - be adjacently allocated (this is not guaranteed to occur with - multiple callocs or mallocs), which may also improve cache locality - in some applications. - - The "chunks" argument is optional (i.e., may be null). If it is null - the returned array is itself dynamically allocated and should also - be freed when it is no longer needed. Otherwise, the chunks array - must be of at least n_elements in length. It is filled in with the - pointers to the chunks. - - In either case, independent_comalloc returns this pointer array, or - null if the allocation failed. If n_elements is zero and chunks is - null, it returns a chunk representing an array with zero elements - (which should be freed if not wanted). - - Each element must be individually freed when it is no longer - needed. If you'd like to instead be able to free all at once, you - should instead use a single regular malloc, and assign pointers at - particular offsets in the aggregate space. (In this case though, you - cannot independently free elements.) - - independent_comallac differs from independent_calloc in that each - element may have a different size, and also that it does not - automatically clear elements. - - independent_comalloc can be used to speed up allocation in cases - where several structs or objects must always be allocated at the - same time. For example: - - \code - struct Head { ... } - struct Foot { ... } - - void send_message(char* msg) { - int msglen = strlen(msg); - size_t sizes[3] = { sizeof(struct Head), msglen, sizeof(struct Foot) }; - void* chunks[3]; - if (independent_comalloc(3, sizes, chunks) == 0) - die(); - struct Head* head = (struct Head*)(chunks[0]); - char* body = (char*)(chunks[1]); - struct Foot* foot = (struct Foot*)(chunks[2]); - // ... - } - \endcode - - In general though, independent_comalloc is worth using only for - larger values of n_elements. For small values, you probably won't - detect enough difference from series of malloc calls to bother. - - Overuse of independent_comalloc can increase overall memory usage, - since it cannot reuse existing noncontiguous small chunks that - might be available for some of the elements. -*/ - -#ifndef USE_DL_PREFIX -void** independent_comalloc(size_t, size_t*, void**); -#else -void** dlindependent_comalloc(size_t, size_t*, void**); -#endif - - -/** - pvalloc(size_t n); - Equivalent to valloc(minimum-page-that-holds(n)), that is, - round up n to nearest pagesize. - */ - -#ifndef USE_DL_PREFIX -void* pvalloc(size_t); -#else -void* dlpvalloc(size_t); -#endif - -/** - cfree(void* p); - Equivalent to free(p). - - cfree is needed/defined on some systems that pair it with calloc, - for odd historical reasons (such as: cfree is used in example - code in the first edition of K&R). -*/ - -#ifndef USE_DL_PREFIX -void cfree(void*); -#else -void dlcfree(void*); -#endif - - -/** - malloc_trim(size_t pad); - - If possible, gives memory back to the system (via negative - arguments to sbrk) if there is unused memory at the `high' end of - the malloc pool. You can call this after freeing large blocks of - memory to potentially reduce the system-level memory requirements - of a program. However, it cannot guarantee to reduce memory. Under - some allocation patterns, some large free blocks of memory will be - locked between two used chunks, so they cannot be given back to - the system. - - The `pad' argument to malloc_trim represents the amount of free - trailing space to leave untrimmed. If this argument is zero, - only the minimum amount of memory to maintain internal data - structures will be left (one page or less). Non-zero arguments - can be supplied to maintain enough trailing space to service - future expected allocations without having to re-obtain memory - from the system. - - Malloc_trim returns 1 if it actually released any memory, else 0. - On systems that do not support "negative sbrks", it will always - return 0. -*/ - -#ifndef USE_DL_PREFIX -int malloc_trim(size_t); -#else -int dlmalloc_trim(size_t); -#endif - - -/** - malloc_usable_size(void* p); - - Returns the number of bytes you can actually use in an allocated - chunk, which may be more than you requested (although often not) due - to alignment and minimum size constraints. You can use this many - bytes without worrying about overwriting other allocated - objects. This is not a particularly great programming practice. But - malloc_usable_size can be more useful in debugging and assertions, - for example: - - \code - p = malloc(n); - assert(malloc_usable_size(p) >= 256); - \endcode -*/ - -#ifndef USE_DL_PREFIX -size_t malloc_usable_size(void*); -#else -size_t dlmalloc_usable_size(void*); -#endif - - -/** - malloc_stats(); - Prints on stderr the amount of space obtained from the system (both - via sbrk and mmap), the maximum amount (which may be more than - current if malloc_trim and/or munmap got called), and the current - number of bytes allocated via malloc (or realloc, etc) but not yet - freed. Note that this is the number of bytes allocated, not the - number requested. It will be larger than the number requested - because of alignment and bookkeeping overhead. Because it includes - alignment wastage as being in use, this figure may be greater than - zero even when no user-level chunks are allocated. - - The reported current and maximum system memory can be inaccurate if - a program makes other calls to system memory allocation functions - (normally sbrk) outside of malloc. - - malloc_stats prints only the most commonly interesting statistics. - More information can be obtained by calling mallinfo. -*/ - -#ifndef USE_DL_PREFIX -void malloc_stats(); -#else -void dlmalloc_stats(); -#endif - -/** - mallinfo() - Returns (by copy) a struct containing various summary statistics: - - \verbatim - arena: current total non-mmapped bytes allocated from system - ordblks: the number of free chunks - smblks: the number of fastbin blocks (i.e., small chunks that - have been freed but not use resused or consolidated) - hblks: current number of mmapped regions - hblkhd: total bytes held in mmapped regions - usmblks: the maximum total allocated space. This will be greater - than current total if trimming has occurred. - fsmblks: total bytes held in fastbin blocks - uordblks: current total allocated space (normal or mmapped) - fordblks: total free space - keepcost: the maximum number of bytes that could ideally be released - back to system via malloc_trim. ("ideally" means that - it ignores page restrictions etc.) - \endverbatim - - The names of some of these fields don't bear much relation with - their contents because this struct was defined as standard in - SVID/XPG so reflects the malloc implementation that was then used - in SystemV Unix. - - The original SVID version of this struct, defined on most systems - with mallinfo, declares all fields as ints. But some others define - as unsigned long. If your system defines the fields using a type of - different width than listed here, you should \#include your system - version before including this file. The struct declaration is - suppressed if _MALLOC_H is defined (which is done in most system - malloc.h files). You can also suppress it by defining - HAVE_USR_INCLUDE_MALLOC_H. - - Because these fields are ints, but internal bookkeeping is done with - unsigned longs, the reported values may appear as negative, and may - wrap around zero and thus be inaccurate. -*/ - -#ifndef HAVE_USR_INCLUDE_MALLOC_H -#ifndef _MALLOC_H -struct mallinfo { - int arena; - int ordblks; - int smblks; - int hblks; - int hblkhd; - int usmblks; - int fsmblks; - int uordblks; - int fordblks; - int keepcost; -}; -#endif -#endif - -#ifndef USE_DL_PREFIX -struct mallinfo mallinfo(void); -#else -struct mallinfo mallinfo(void); -#endif - -/** - mallopt(int parameter_number, int parameter_value) - Sets tunable parameters The format is to provide a - (parameter-number, parameter-value) pair. mallopt then sets the - corresponding parameter to the argument value if it can (i.e., so - long as the value is meaningful), and returns 1 if successful else - 0. SVID/XPG defines four standard param numbers for mallopt, - normally defined in malloc.h. Only one of these (M_MXFAST) is used - in this malloc. The others (M_NLBLKS, M_GRAIN, M_KEEP) don't apply, - so setting them has no effect. But this malloc also supports four - other options in mallopt. See below for details. Briefly, supported - parameters are as follows (listed defaults are for "typical" - configurations). - - \verbatim - Symbol param # default allowed param values - M_MXFAST 1 64 0-80 (0 disables fastbins) - M_TRIM_THRESHOLD -1 128*1024 any (-1U disables trimming) - M_TOP_PAD -2 0 any - M_MMAP_THRESHOLD -3 128*1024 any (or 0 if no MMAP support) - M_MMAP_MAX -4 65536 any (0 disables use of mmap) - \endverbatim - -*/ - -#ifndef USE_DL_PREFIX -int mallopt(int, int); -#else -int dlmallopt(int, int); -#endif - -/** \name Descriptions of tuning options */ -/** @{ */ - -/** - M_MXFAST is the maximum request size used for "fastbins", special bins - that hold returned chunks without consolidating their spaces. This - enables future requests for chunks of the same size to be handled - very quickly, but can increase fragmentation, and thus increase the - overall memory footprint of a program. - - This malloc manages fastbins very conservatively yet still - efficiently, so fragmentation is rarely a problem for values less - than or equal to the default. The maximum supported value of MXFAST - is 80. You wouldn't want it any higher than this anyway. Fastbins - are designed especially for use with many small structs, objects or - strings -- the default handles structs/objects/arrays with sizes up - to 8 4byte fields, or small strings representing words, tokens, - etc. Using fastbins for larger objects normally worsens - fragmentation without improving speed. - - You can reduce M_MXFAST to 0 to disable all use of fastbins. This - causes the malloc algorithm to be a closer approximation of - fifo-best-fit in all cases, not just for larger requests, but will - generally cause it to be slower. -*/ - -#ifndef M_MXFAST -#define M_MXFAST 1 -#endif - -/** - M_TRIM_THRESHOLD is the maximum amount of unused top-most memory - to keep before releasing via malloc_trim in free(). - - Automatic trimming is mainly useful in long-lived programs. - Because trimming via sbrk can be slow on some systems, and can - sometimes be wasteful (in cases where programs immediately - afterward allocate more large chunks) the value should be high - enough so that your overall system performance would improve by - releasing this much memory. - - The trim threshold and the mmap control parameters (see below) - can be traded off with one another. Trimming and mmapping are - two different ways of releasing unused memory back to the - system. Between these two, it is often possible to keep - system-level demands of a long-lived program down to a bare - minimum. For example, in one test suite of sessions measuring - the XF86 X server on Linux, using a trim threshold of 128K and a - mmap threshold of 192K led to near-minimal long term resource - consumption. - - If you are using this malloc in a long-lived program, it should - pay to experiment with these values. As a rough guide, you - might set to a value close to the average size of a process - (program) running on your system. Releasing this much memory - would allow such a process to run in memory. Generally, it's - worth it to tune for trimming rather tham memory mapping when a - program undergoes phases where several large chunks are - allocated and released in ways that can reuse each other's - storage, perhaps mixed with phases where there are no such - chunks at all. And in well-behaved long-lived programs, - controlling release of large blocks via trimming versus mapping - is usually faster. - - However, in most programs, these parameters serve mainly as - protection against the system-level effects of carrying around - massive amounts of unneeded memory. Since frequent calls to - sbrk, mmap, and munmap otherwise degrade performance, the default - parameters are set to relatively high values that serve only as - safeguards. - - The trim value It must be greater than page size to have any useful - effect. To disable trimming completely, you can set to - (unsigned long)(-1) - - Trim settings interact with fastbin (MXFAST) settings: Unless - compiled with TRIM_FASTBINS defined, automatic trimming never takes - place upon freeing a chunk with size less than or equal to - MXFAST. Trimming is instead delayed until subsequent freeing of - larger chunks. However, you can still force an attempted trim by - calling malloc_trim. - - Also, trimming is not generally possible in cases where - the main arena is obtained via mmap. - - Note that the trick some people use of mallocing a huge space and - then freeing it at program startup, in an attempt to reserve system - memory, doesn't have the intended effect under automatic trimming, - since that memory will immediately be returned to the system. -*/ - -#define M_TRIM_THRESHOLD -1 - -/** - M_TOP_PAD is the amount of extra `padding' space to allocate or - retain whenever sbrk is called. It is used in two ways internally: - - - When sbrk is called to extend the top of the arena to satisfy - a new malloc request, this much padding is added to the sbrk - request. - - - When malloc_trim is called automatically from free(), - it is used as the `pad' argument. - - In both cases, the actual amount of padding is rounded - so that the end of the arena is always a system page boundary. - - The main reason for using padding is to avoid calling sbrk so - often. Having even a small pad greatly reduces the likelihood - that nearly every malloc request during program start-up (or - after trimming) will invoke sbrk, which needlessly wastes - time. - - Automatic rounding-up to page-size units is normally sufficient - to avoid measurable overhead, so the default is 0. However, in - systems where sbrk is relatively slow, it can pay to increase - this value, at the expense of carrying around more memory than - the program needs. -*/ - -#define M_TOP_PAD -2 - - -/** - M_MMAP_THRESHOLD is the request size threshold for using mmap() - to service a request. Requests of at least this size that cannot - be allocated using already-existing space will be serviced via mmap. - (If enough normal freed space already exists it is used instead.) - - Using mmap segregates relatively large chunks of memory so that - they can be individually obtained and released from the host - system. A request serviced through mmap is never reused by any - other request (at least not directly; the system may just so - happen to remap successive requests to the same locations). - - Segregating space in this way has the benefits that: - - -# Mmapped space can ALWAYS be individually released back - to the system, which helps keep the system level memory - demands of a long-lived program low. - -# Mapped memory can never become `locked' between - other chunks, as can happen with normally allocated chunks, which - means that even trimming via malloc_trim would not release them. - -# On some systems with "holes" in address spaces, mmap can obtain - memory that sbrk cannot. - - However, it has the disadvantages that: - - -# The space cannot be reclaimed, consolidated, and then - used to service later requests, as happens with normal chunks. - -# It can lead to more wastage because of mmap page alignment - requirements - -# It causes malloc performance to be more dependent on host - system memory management support routines. - - The advantages of mmap nearly always outweigh disadvantages for - "large" chunks, but the value of "large" varies across systems. The - default is an empirically derived value that works well in most - systems. -*/ - -#define M_MMAP_THRESHOLD -3 - -/** - M_MMAP_MAX is the maximum number of requests to simultaneously - service using mmap. This parameter exists because - some systems have a limited number of internal tables for - use by mmap, and using more than a few of them may degrade - performance. - - The default is set to a value that serves only as a safeguard. - Setting to 0 disables use of mmap for servicing large requests. If - mmap is not supported on a system, the default value is 0, and - attempts to set it to non-zero values in mallopt will fail. -*/ - -#define M_MMAP_MAX -4 - -/** @} */ - -/** \name Unused SVID2/XPG mallopt options, listed for completeness */ -/** @{ */ - -#ifndef M_NBLKS -#define M_NLBLKS 2 /**< UNUSED in this malloc */ -#endif -#ifndef M_GRAIN -#define M_GRAIN 3 /**< UNUSED in this malloc */ -#endif -#ifndef M_KEEP -#define M_KEEP 4 /**< UNUSED in this malloc */ -#endif - -/** @} */ - -#ifndef __cplusplus -/* - Some malloc.h's declare alloca, even though it is not part of malloc. -*/ - -#ifndef _ALLOCA_H -extern void* alloca(size_t); -#endif -#endif - -/** @} */ /* end of doxygen group shmem */ - -#ifdef __cplusplus -}; /* end of extern "C" */ -#endif - -#endif /* MALLOC_270_H */ diff --git a/dependencies/Common/include/Common/shmem/segbasemap.h b/dependencies/Common/include/Common/shmem/segbasemap.h deleted file mode 100644 index 311a4603306acb0742107a3f415f6150ae6334cb..0000000000000000000000000000000000000000 --- a/dependencies/Common/include/Common/shmem/segbasemap.h +++ /dev/null @@ -1,41 +0,0 @@ -//# segbasemap.h -//# -//# Copyright (C) 2002 -//# ASTRON (Netherlands Institute for Radio Astronomy) -//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands -//# -//# This file is part of the LOFAR software suite. -//# The LOFAR software suite 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 3 of the License, or -//# (at your option) any later version. -//# -//# The LOFAR software suite 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 the LOFAR software suite. If not, see <http://www.gnu.org/licenses/>. -//# -//# $Id$ - -#ifndef _SEGBASEMAP_H -#define _SEGBASEMAP_H - -/** \file - */ - -#ifdef __cplusplus -extern "C" { -#endif - -void* shmbrk(int size); -void* shm_segbasemap_find(void* address); -void shm_segbasemap_add (void* base); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/dependencies/Common/include/Common/shmem/shmem_alloc.h b/dependencies/Common/include/Common/shmem/shmem_alloc.h deleted file mode 100644 index eb60798e4ea583f0a6bd1f4240bd827152aae533..0000000000000000000000000000000000000000 --- a/dependencies/Common/include/Common/shmem/shmem_alloc.h +++ /dev/null @@ -1,112 +0,0 @@ -//# shmem_alloc.h -//# -//# Copyright (C) 2002 -//# ASTRON (Netherlands Institute for Radio Astronomy) -//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands -//# -//# This file is part of the LOFAR software suite. -//# The LOFAR software suite 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 3 of the License, or -//# (at your option) any later version. -//# -//# The LOFAR software suite 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 the LOFAR software suite. If not, see <http://www.gnu.org/licenses/>. -//# -//# $Id$ - -#ifndef LOFAR_COMMON_SHMEM_ALLOC_H_ -#define LOFAR_COMMON_SHMEM_ALLOC_H_ - -/** \file - */ - -#ifdef HAVE_USR_INCLUDE_MALLOC_H -#include <malloc.h> -#endif - -#include <Common/shmem/dlmalloc.h> -#include <stddef.h> - -#ifdef HAVE_ATOMIC_H - -// use atomic operations that are also used in linux kernel -// make sure it also works on SMP machines -#define __SMP__ -#include <asm/atomic.h> - -#else - -#include <sys/types.h> -#include <unistd.h> - -#endif - -/** - \ingroup Common - \addtogroup shmem - @{ -*/ - -#define shmem_calloc dlcalloc -#define shmem_free dlfree -#define shmem_cfree dlcfree -#define shmem_malloc dlmalloc -#define shmem_memalign dlmemalign -#define shmem_realloc dlrealloc -#define shmem_valloc dlvalloc -#define shmem_pvalloc dlpvalloc -#define shmem_mallinfo dlmallinfo -#define shmem_mallopt dlmallopt -#define shmem_malloc_trim dlmalloc_trim -#define shmem_malloc_stats dlmalloc_stats -#define shmem_usable_size dlmalloc_usable_size -#define shmem_independent_calloc dlindependent_calloc -#define shmem_independent_comalloc dlindependent_comalloc - -#ifdef __cplusplus -extern "C" -{ -#endif - -/** \name Shared memory operations */ -/** @{ */ -void shmem_init(void); -int shmem_id(void* address); -size_t shmem_offset(void* address); -void* shmem_connect(int shmid, size_t offset); -void shmem_disconnect(void* segment, size_t offset); -/** @} */ - -/** Semaphore typedef */ -#ifdef HAVE_ATOMIC_H -typedef atomic_t shmem_cond_t; -#else -typedef struct -{ - pid_t owner; - bool thetry[2]; - int turn; - int count; -} shmem_cond_t; -#endif - -/** \name Semaphore operations */ -/** @{ */ -void shmem_cond_init(volatile shmem_cond_t* condition); -void shmem_cond_signal(volatile shmem_cond_t* condition); -void shmem_cond_wait(volatile shmem_cond_t* condition); -/** @} */ - -/** @} */ /* end doxygen group shmem */ - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/dependencies/Common/src/CMakeLists.txt b/dependencies/Common/src/CMakeLists.txt index 3c5f212d0d4334996c14be5cbede744972e7024f..8bff187084926e84bb757d7851b1d05b605704ff 100644 --- a/dependencies/Common/src/CMakeLists.txt +++ b/dependencies/Common/src/CMakeLists.txt @@ -3,32 +3,23 @@ set(common_LIB_SRCS Allocator.cc CasaLogSink.cc - DataConvert.cc Exception.cc FileLocator.cc - hexdump.cc + InputParSet.cc KVpair.cc lofar_bitset.cc - Mmap.cc NewHandler.cc - Numeric.cc NsTimestamp.cc ParameterRecord.cc ParameterSet.cc ParameterSetImpl.cc ParameterValue.cc - InputParSet.cc PrettyUnits.cc - Process.cc - ReadLine.cc - RunOnNode.cc - Stopwatch.cc StreamUtil.cc StringUtil.cc SystemCallException.cc SystemUtil.cc Timer.cc - TypeNames.cc Thread/Cancellation.cc Thread/Thread.cc) @@ -52,28 +43,6 @@ if(HAVE_BACKTRACE) SymbolTable.cc) endif(HAVE_BACKTRACE) -if(HAVE_SHMEM) - set(shmem_LIB_SRCS - shmem/segbasemap.cc - shmem/dlmalloc.c - shmem/shmem_alloc.cc) - set(shmem_COMPILE_FLAGS - -DUSE_PUBLIC_MALLOC_WRAPPERS - -DUSE_DL_PREFIX - -DHAVE_MMAP=0 - -DMORECORE=shmbrk - -DMORECORE_CONTIGUOUS=0 - -DMORECORE_CANNOT_TRIM=1 - -DSHMEM_ALLOC) - if(EXISTS "/usr/include/malloc.h") - set(shmem_COMPILE_FLAGS ${shmem_COMPILE_FLAGS} -DHAVE_USR_INCLUDE_MALLOC_H) - endif() - lofar_join_arguments(shmem_COMPILE_FLAGS) - set_source_files_properties(${shmem_LIB_SRCS} - PROPERTIES COMPILE_FLAGS ${shmem_COMPILE_FLAGS}) - list(APPEND common_LIB_SRCS ${shmem_LIB_SRCS}) -endif(HAVE_SHMEM) - lofar_add_library(common ${common_LIB_SRCS}) foreach(prog ${common_PROGRAMS}) diff --git a/dependencies/Common/src/DataConvert.cc b/dependencies/Common/src/DataConvert.cc deleted file mode 100644 index 569f6287e7aaf32f23a90a8b91d0fdb150abab13..0000000000000000000000000000000000000000 --- a/dependencies/Common/src/DataConvert.cc +++ /dev/null @@ -1,162 +0,0 @@ -//# DataConvert.cc: Global functions to convert data values -//# -//# Copyright (C) 2003 -//# ASTRON (Netherlands Institute for Radio Astronomy) -//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands -//# -//# This file is part of the LOFAR software suite. -//# The LOFAR software suite 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 3 of the License, or -//# (at your option) any later version. -//# -//# The LOFAR software suite 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 the LOFAR software suite. If not, see <http://www.gnu.org/licenses/>. -//# -//# $Id$ - -//# Always #include <lofar_config.h> first! -#include <lofar_config.h> - -#include <Common/DataConvert.h> - -void LOFAR::byteSwap16 (void* val, uint nrval) -{ - char* v = (char*)val; - for (uint i=0; i<nrval; i++) { - LOFAR::byteSwap16 (v); - v += 2; - } -} - -void LOFAR::byteSwap16 (void* out, const void* in, uint nrval) -{ - char* vout = (char*)out; - const char* vin = (const char*)in; - for (uint i=0; i<nrval; i++) { - LOFAR::byteSwap16 (vout, vin); - vout += 2; - vin += 2; - } -} - -void LOFAR::byteSwap32 (void* val, uint nrval) -{ - char* v = (char*)val; - for (uint i=0; i<nrval; i++) { - LOFAR::byteSwap32 (v); - v += 4; - } -} - -void LOFAR::byteSwap32 (void* out, const void* in, uint nrval) -{ - char* vout = (char*)out; - const char* vin = (const char*)in; - for (uint i=0; i<nrval; i++) { - LOFAR::byteSwap32 (vout, vin); - vout += 4; - vin += 4; - } -} - -void LOFAR::byteSwap64 (void* val, uint nrval) -{ - char* v = (char*)val; - for (uint i=0; i<nrval; i++) { - LOFAR::byteSwap64 (v); - v += 8; - } -} - -void LOFAR::byteSwap64 (void* out, const void* in, uint nrval) -{ - char* vout = (char*)out; - const char* vin = (const char*)in; - for (uint i=0; i<nrval; i++) { - LOFAR::byteSwap64 (vout, vin); - vout += 8; - vin += 8; - } -} - -uint LOFAR::boolToBit (void* to, const void* from, uint nvalues, uint startbit) -{ - if (nvalues == 0) { - return 0; - } - const bool* data = (const bool*)from; - unsigned char* bits = (unsigned char*)to + startbit/8; - startbit %= 8; - //# Fill as many bytes as needed. - uint nbytes = (nvalues + startbit + 7) / 8; - uint i,j; - uint index = 0; - { - unsigned char mask = 1; - mask <<= startbit; - unsigned char& ch = bits[0]; - //# Take care of correct number of bits in first byte. - uint nbits = (nvalues-index < 8-startbit ? nvalues-index : 8-startbit); - for (j=0; j<nbits; j++) { - if (data[index++]) { - ch |= mask; - } else { - ch &= ~mask; - } - mask <<= 1; - } - } - for (i=1; i<nbytes; ++i) { - unsigned char mask = 1; - unsigned char& ch = bits[i]; - ch = 0; - //# Take care of correct number of bits in last byte. - uint nbits = (nvalues-index < 8 ? nvalues-index : 8); - for (j=0; j<nbits; j++) { - if (data[index++]) { - ch |= mask; - } - mask <<= 1; - } - } - return nbytes; -} - -uint LOFAR::bitToBool (void* to, const void* from, uint nvalues, uint startbit) -{ - bool* data = (bool*)to; - const unsigned char* bits = (const unsigned char*)from + startbit/8; - startbit %= 8; - //# Fill as many bytes as needed. - uint nbytes = (nvalues + startbit + 7) / 8; - uint i,j; - uint index = 0; - { - unsigned char mask = 1; - mask <<= startbit; - const unsigned char ch = bits[0]; - //# Take care of correct number of bits in first byte. - uint nbits = (nvalues-index < 8-startbit ? nvalues-index : 8-startbit); - for (j=0; j<nbits; j++) { - data[index++] = ((ch & mask) != 0); - mask <<= 1; - } - } - for (i=1; i<nbytes; ++i) { - unsigned char mask = 1; - const unsigned char ch = bits[i]; - //# Take care of correct number of bits in last byte. - uint nbits = (nvalues-index < 8 ? nvalues-index : 8); - for (j=0; j<nbits; j++) { - data[index++] = ((ch & mask) != 0); - mask <<= 1; - } - } - return nbytes; -} diff --git a/dependencies/Common/src/Mmap.cc b/dependencies/Common/src/Mmap.cc deleted file mode 100644 index 419bef5bebbe587982de25ca745f166f18e8c188..0000000000000000000000000000000000000000 --- a/dependencies/Common/src/Mmap.cc +++ /dev/null @@ -1,53 +0,0 @@ -//# Mmap.cc: class to wrap the mmap and munmap system calls -//# Copyright (C) 2013, 2015 ASTRON (Netherlands Institute for Radio Astronomy) -//# P.O. Box 2, 7990 AA Dwingeloo, The Netherlands -//# -//# This file is part of the LOFAR software suite. -//# The LOFAR software suite 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 3 of the License, or -//# (at your option) any later version. -//# -//# The LOFAR software suite 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 the LOFAR software suite. If not, see <http://www.gnu.org/licenses/>. -//# -//# $Id$ - -//# Always #include <lofar_config.h> first! -#include <lofar_config.h> - -#include <Common/Mmap.h> - -#include <Common/SystemCallException.h> -#include <Common/LofarLogger.h> - -namespace LOFAR -{ - - Mmap::Mmap(void *addr, size_t length, int prot, int flags, int fd, - off_t offset) : - _len(length) - { - if (flags & MAP_ANON) { - fd = -1; // portability - } - _ptr = ::mmap(addr, length, prot, flags, fd, offset); - if (_ptr == MAP_FAILED) { - THROW_SYSCALL("mmap"); - } - } - - Mmap::~Mmap() - { - if (::munmap(_ptr, _len) == -1) { - LOG_WARN("munmap() failed"); // do not throw in a destructor - } - } - -} // namespace LOFAR - diff --git a/dependencies/Common/src/Numeric.cc b/dependencies/Common/src/Numeric.cc deleted file mode 100644 index 5bd60dadf7d5895049a1dab39cb33c0c336c278c..0000000000000000000000000000000000000000 --- a/dependencies/Common/src/Numeric.cc +++ /dev/null @@ -1,176 +0,0 @@ -//# Numeric.cc: -//# -//# Copyright (C) 2002-2004 -//# ASTRON (Netherlands Institute for Radio Astronomy) -//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands -//# -//# This file is part of the LOFAR software suite. -//# The LOFAR software suite 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 3 of the License, or -//# (at your option) any later version. -//# -//# The LOFAR software suite 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 the LOFAR software suite. If not, see <http://www.gnu.org/licenses/>. -//# -//# $Id$ - -//# Always #include <lofar_config.h> first! -#include <lofar_config.h> - -//# Includes -#include <Common/Numeric.h> -#include <cstdlib> - -namespace LOFAR -{ - bool Numeric::isFinite(float f) - { - floatUnion_t mask = { f }; - return (mask.mask & floatExponentMask) != floatExponentMask; - } - - bool Numeric::isFinite(double d) - { - doubleUnion_t mask = { d }; - return (mask.mask & doubleExponentMask) != doubleExponentMask; - } - - bool Numeric::isNegative(float f) - { - floatUnion_t mask = { f }; - return (mask.mask & floatNegativeMask) == floatNegativeMask; - } - - bool Numeric::isNegative(double d) - { - doubleUnion_t mask = { d }; - return (mask.mask & doubleNegativeMask) == doubleNegativeMask; - } - - bool Numeric::isInf(float f) - { - floatUnion_t mask = { f }; - return !isFinite(f) && (mask.mask & floatMantissaMask) == 0L; - } - - bool Numeric::isInf(double d) - { - doubleUnion_t mask = { d }; - return !isFinite(d) && (mask.mask & doubleMantissaMask) == 0LL; - } - - bool Numeric::isNan(float f) - { - floatUnion_t mask = { f }; - return !isFinite(f) && (mask.mask & floatMantissaMask) != 0L; - } - - bool Numeric::isNan(double d) - { - doubleUnion_t mask = { d }; - return !isFinite(d) && (mask.mask & doubleMantissaMask) != 0LL; - } - - - bool Numeric::compare(float lhs, float rhs, floatMask_t maxUlps) - { - -#ifdef USE_INFINITYCHECK - // If either \a lhs or \a rhs is infinite, then return true if they're - // exactly equal, i.e. they have the same sign. - if (isInf(lhs) || isInf(rhs)) return lhs == rhs; -#endif - -#ifdef USE_NANCHECK - // Consider \a lhs and \a rhs unequal when either is NaN. - if (isNan(lhs) || isNan(rhs)) return false; -#endif - -#ifdef USE_SIGNCHECK - // Consider \a lhs and \a rhs unequal when they have a different - // sign, even if they both are very close to zero. - // \note The check for equality is needed because zero and negative zero - // have different signs but are equal to each other. - if (isNegative(lhs) != isNegative(rhs)) return lhs == rhs; -#endif - - floatUnion_t mlhs = { lhs }; - floatUnion_t mrhs = { rhs }; - floatMask_t ilhs = mlhs.mask; - floatMask_t irhs = mrhs.mask; - - // Make \a ilhs and \a irhs lexicographically ordered as twos-complement - // long. - if (isNegative(lhs)) - ilhs = ~ilhs + 1; - else - ilhs += floatNegativeMask; - - if (isNegative(rhs)) - irhs = ~irhs + 1; - else - irhs += floatNegativeMask; - - // If \a ilhs and \a irhs are less than \a maxUlps apart, then \a lhs and - // \a rhs are considered equal. - if (ilhs < irhs) - return irhs - ilhs <= maxUlps; - else - return ilhs - irhs <= maxUlps; - } - - - bool Numeric::compare(double lhs, double rhs, doubleMask_t maxUlps) - { - -#ifdef USE_INFINITYCHECK - // If either \a lhs or \a rhs is infinite, then return true if they're - // exactly equal, i.e. they have the same sign. - if (isInf(lhs) || isInf(rhs)) return lhs == rhs; -#endif - -#ifdef USE_NANCHECK - // Consider \a lhs and \a rhs unequal when either is NaN. - if (isNan(lhs) || isNan(rhs)) return false; -#endif - -#ifdef USE_SIGNCHECK - // Consider \a lhs and \a rhs unequal when they have a different - // sign, even if they both are very close to zero. - // \note The check for equality is needed because zero and negative zero - // have different signs but are equal to each other. - if (isNegative(lhs) != isNegative(rhs)) return lhs == rhs; -#endif - - doubleUnion_t mlhs = { lhs }; - doubleUnion_t mrhs = { rhs }; - doubleMask_t ilhs = mlhs.mask; - doubleMask_t irhs = mrhs.mask; - - // Make \a ilhs and \a irhs lexicographically ordered - if (isNegative(lhs)) - ilhs = ~ilhs + 1; - else - ilhs += doubleNegativeMask; - - if (isNegative(rhs)) - irhs = ~irhs + 1; - else - irhs += doubleNegativeMask; - - // If \a ilhs and \a irhs are less than \a maxUlps apart, then \a lhs and - // \a rhs are considered equal. - if (ilhs < irhs) - return irhs - ilhs <= maxUlps; - else - return ilhs - irhs <= maxUlps; - } - - -} // namespace LOFAR diff --git a/dependencies/Common/src/Process.cc b/dependencies/Common/src/Process.cc deleted file mode 100644 index eb65c9c4f07a101ace26e70c5e9ce6bc6dba0cc6..0000000000000000000000000000000000000000 --- a/dependencies/Common/src/Process.cc +++ /dev/null @@ -1,110 +0,0 @@ -//# Process.cc: class wrapping the OS fork method. -//# -//# Copyright (C) 2005 -//# ASTRON (Netherlands Institute for Radio Astronomy) -//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands -//# -//# This file is part of the LOFAR software suite. -//# The LOFAR software suite 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 3 of the License, or -//# (at your option) any later version. -//# -//# The LOFAR software suite 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 the LOFAR software suite. If not, see <http://www.gnu.org/licenses/>. -//# -//# $Id$ - -//# Always #include <lofar_config.h> first! -#include <lofar_config.h> - -//# Includes -#include <Common/Process.h> -#include <Common/LofarLogger.h> -#include <unistd.h> // for fork(), and getpid() -#include <sys/wait.h> // for waitpid() -#include <sys/types.h> -#include <cerrno> // for errno -#include <cstring> // for strerror() -#include <cstdlib> // for exit() - -using namespace std; - -namespace LOFAR -{ - - Process::Process() : - itsPid(getpid()) - { - } - - - Process::~Process() - { - } - - - bool Process::spawn(bool avoidZombies) - { - LOG_TRACE_FLOW(AUTO_FUNCTION_NAME); - if (doSpawn(avoidZombies)) { - if (isChild()) child(); - else if (isParent()) parent(); - return true; - } - else { - LOG_ERROR_STR("Failed to fork child process - " << strerror(errno)); - return false; - } - } - - - void Process::parent() - { - LOG_TRACE_FLOW(AUTO_FUNCTION_NAME); - } - - - void Process::child() - { - LOG_TRACE_FLOW(AUTO_FUNCTION_NAME); - } - - - bool Process::doSpawn(bool avoidZombies) - { - if (!avoidZombies) { - itsPid = ::fork(); - return (itsPid >= 0); - } - else { - // This algorithm is adapted from an example in the Stevens book - // "Advanced Programming in the Unix Environment". It creates an - // orphan process that's inherited by the init process; init cleans up - // when the orphan process terminates. - pid_t pid = ::fork(); - - if (pid == 0) { - // The child process forks again to create a grandchild. - itsPid = ::fork(); - switch(itsPid) { - case -1: // fork failed - return false; - case 0: // grandchild returns 0 - return true; - default: // child terminates, orphaning grandchild - exit(0); - } - } - // Parent process waits for child to terminate - return (pid >= 0 && waitpid(pid, 0, 0) == pid); - } - } - - -} // namespace LOFAR diff --git a/dependencies/Common/src/ReadLine.cc b/dependencies/Common/src/ReadLine.cc deleted file mode 100644 index 75de0414c489e43c488587ca6ac1504338f8c6e8..0000000000000000000000000000000000000000 --- a/dependencies/Common/src/ReadLine.cc +++ /dev/null @@ -1,85 +0,0 @@ -//# ReadLine.cc: read a line from stdin using readline or cin -//# -//# Copyright (C) 2009 -//# ASTRON (Netherlands Institute for Radio Astronomy) -//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands -//# -//# This file is part of the LOFAR software suite. -//# The LOFAR software suite 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 3 of the License, or -//# (at your option) any later version. -//# -//# The LOFAR software suite 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 the LOFAR software suite. If not, see <http://www.gnu.org/licenses/>. -//# -//# $Id$ - -#include <lofar_config.h> -#include <Common/ReadLine.h> -#include <Common/StringUtil.h> -#include <Common/lofar_iostream.h> -#ifdef HAVE_READLINE -# include <readline/readline.h> -# include <readline/history.h> -#endif - -namespace LOFAR -{ -#ifdef HAVE_READLINE - bool readLine (string& line, const string& prompt, bool addToHistory) - { - char* str = readline(prompt.c_str()); - if (!str) return false; - line = string(str); - free(str); - if (addToHistory) add_history (line.c_str()); - return true; - } -#else - bool readLine (string& line, const string& prompt, bool) - { - if (!prompt.empty()) cerr << prompt; - getline (cin, line); - return (bool)cin; - } -#endif - - bool readLineSkip (string& line, const string& prompt, - const string& commentChars) - { - bool fnd = false; - while (!fnd && readLine (line, prompt, false)) { - // Skip leading and trailing whitespace. - uint st = lskipws (line, 0, line.size()); - uint end = rskipws (line, st, line.size()); - uint sz = end-st; - if (sz > 0) { - // non-empty line. - if (commentChars.empty() || commentChars.size() > sz) { - // Do not test for comment - fnd = true; - } else { - for (uint i=0; i<commentChars.size(); ++i) { - if (commentChars[i] != line[st+i]) { - // non-comment - line = line.substr(st, sz); - fnd = true; - break; - } - } - } - } - } -#ifdef HAVE_READLINE - add_history (line.c_str()); -#endif - return fnd; - } - -} // namespace LOFAR diff --git a/dependencies/Common/src/RunOnNode.cc b/dependencies/Common/src/RunOnNode.cc deleted file mode 100644 index d0180bef99093c9f7a35690cfe3cd4339deffe0b..0000000000000000000000000000000000000000 --- a/dependencies/Common/src/RunOnNode.cc +++ /dev/null @@ -1,40 +0,0 @@ -//# RunOnNode.cc: -//# -//# Copyright (C) 2002-2004 -//# ASTRON (Netherlands Institute for Radio Astronomy) -//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands -//# -//# This file is part of the LOFAR software suite. -//# The LOFAR software suite 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 3 of the License, or -//# (at your option) any later version. -//# -//# The LOFAR software suite 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 the LOFAR software suite. If not, see <http://www.gnu.org/licenses/>. -//# -//# $Id$ - -//# Always #include <lofar_config.h> first! -#include <lofar_config.h> - -#include <Common/RunOnNode.h> - -namespace LOFAR -{ - -int RunOnNode::itsProcessID=0; -int RunOnNode::itsApplID=0; - - RunOnNode::RunOnNode(int processid, int applid) { - itsProcessID = processid; - itsApplID = applid; - } - - -} // namespace LOFAR diff --git a/dependencies/Common/src/Stopwatch.cc b/dependencies/Common/src/Stopwatch.cc deleted file mode 100644 index 4e2b253263db685f7774cd731804f39e1fbbd50d..0000000000000000000000000000000000000000 --- a/dependencies/Common/src/Stopwatch.cc +++ /dev/null @@ -1,108 +0,0 @@ -//# Stopwatch.cc: timer class -//# -//# Copyright (C) 2002 -//# ASTRON (Netherlands Institute for Radio Astronomy) -//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands -//# -//# This file is part of the LOFAR software suite. -//# The LOFAR software suite 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 3 of the License, or -//# (at your option) any later version. -//# -//# The LOFAR software suite 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 the LOFAR software suite. If not, see <http://www.gnu.org/licenses/>. -//# -//# $Id$ - -//# Always #include <lofar_config.h> first! -#include <lofar_config.h> - -#include <Common/Stopwatch.h> - -#include <unistd.h> -#include <cmath> -#include <cstdio> - -namespace LOFAR -{ - - //##ModelId=3DB9546402FF - double Stopwatch::scale = 1.0/sysconf(_SC_CLK_TCK); - //##ModelId=3DB954640301 - struct tms Stopwatch::dummy_tms; - - //##ModelId=3DB954640306 - Stopwatch Stopwatch::delta (bool do_reset) - { - Stopwatch prev = *this; - Stopwatch now(fire_secs); - now.namewidth = namewidth; - prev.tick = now.tick - prev.tick; - prev.tms.tms_utime = now.tms.tms_utime - prev.tms.tms_utime; - prev.tms.tms_stime = now.tms.tms_stime - prev.tms.tms_stime; - prev.tms.tms_cutime = now.tms.tms_cutime - prev.tms.tms_cutime; - prev.tms.tms_cstime = now.tms.tms_cstime - prev.tms.tms_cstime; - if( do_reset ) - *this = now; - return prev; - } - - //##ModelId=3DB954640308 - string Stopwatch::toString (long long nops,int opts,const char * format) const - { - string out1,out2; - char str[256]; - double ut = user(), st = sys(), rt = real(); - if( opts&USER ) - { - snprintf(str,sizeof str,format,ut); out1 += str; - if( nops ) { - snprintf(str,sizeof str,"%12lld",(long long)(nops/(ut+st)+0.5)); out2 += str; - } - } - if( opts&SYSTEM ) - { - snprintf(str,sizeof str,format,st); out1 += str; - } - if( opts&REAL ) - { - snprintf(str,sizeof str,format,rt); out1 += str; - if( nops ) { - snprintf(str,sizeof str,"%12lld",(long long)(nops/rt+0.5)); out2 += str; - } - } - if( nops ) - { snprintf(str,sizeof str,"%12lld",nops); out2 += str; } - return out1+out2; - } - - //##ModelId=3DB954640315 - string Stopwatch::dump (const string &name,long long nops,bool do_reset,int opts) - { - char* str = new char[namewidth+32]; - snprintf(str,namewidth+32,"%-*.*s:",namewidth,namewidth,name.c_str()); - string sstr(str); - delete [] str; - return sstr + sdelta(nops,do_reset,opts); - } - - //##ModelId=3DB95464031A - string Stopwatch::header (long long nops) - { - static char hdr[2][80]; - snprintf(hdr[0],sizeof hdr[0],"%10s%10s%10s","user","sys","real"); - snprintf(hdr[1],sizeof hdr[1],"%10s%10s%10s%12s%12s%12s","t/user","t/sys","t/real","p/cpusec","p/sec","count"); - - if( nops ) - return hdr[1]; - else - return hdr[0]; - } - -} // namespace LOFAR diff --git a/dependencies/Common/src/StringUtil.cc b/dependencies/Common/src/StringUtil.cc index 290b6b2993fb2e8a4421466cbf4a06926995ec4f..223080ee01b741613b19efd2fdde089d5c47adbf 100644 --- a/dependencies/Common/src/StringUtil.cc +++ b/dependencies/Common/src/StringUtil.cc @@ -28,7 +28,6 @@ #include <Common/StringUtil.h> #include <Common/lofar_iostream.h> #include <Common/lofar_iomanip.h> -#include <Common/lofar_map.h> #include <cstring> #include <cstdarg> #include <cstdio> diff --git a/dependencies/Common/src/TypeNames.cc b/dependencies/Common/src/TypeNames.cc deleted file mode 100644 index c1f84a1bcfb54a72e97f92f017ff2551cecd1ac8..0000000000000000000000000000000000000000 --- a/dependencies/Common/src/TypeNames.cc +++ /dev/null @@ -1,166 +0,0 @@ -//# TypeNames.cc: Return a string giving the type name to be stored in blobs -//# -//# Copyright (C) 2003 -//# ASTRON (Netherlands Institute for Radio Astronomy) -//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands -//# -//# This file is part of the LOFAR software suite. -//# The LOFAR software suite 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 3 of the License, or -//# (at your option) any later version. -//# -//# The LOFAR software suite 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 the LOFAR software suite. If not, see <http://www.gnu.org/licenses/>. -//# -//# $Id$ - -//# Always #include <lofar_config.h> first! -#include <lofar_config.h> - - -//# Includes -#include <Common/TypeNames.h> - -namespace LOFAR -{ - const std::string& typeName (const void*) - { - static std::string str ("unknown"); - return str; - } - - const std::string& typeName (const bool*) - { - static std::string str ("bool"); - return str; - } - - const std::string& typeName (const char*) - { - static std::string str ("char"); - return str; - } - - const std::string& typeName (const int8*) - { - // This is also char (for backward compatibility). - static std::string str ("char"); - return str; - } - - const std::string& typeName (const uint8*) - { - static std::string str ("uchar"); - return str; - } - - const std::string& typeName (const int16*) - { - static std::string str ("int16"); - return str; - } - - const std::string& typeName (const uint16*) - { - static std::string str ("uint16"); - return str; - } - - const std::string& typeName (const int32*) - { - static std::string str ("int32"); - return str; - } - - const std::string& typeName (const uint32*) - { - static std::string str ("uint32"); - return str; - } - - const std::string& typeName (const int64*) - { - static std::string str ("int64"); - return str; - } - - const std::string& typeName (const uint64*) - { - static std::string str ("uint64"); - return str; - } - - const std::string& typeName (const float*) - { - static std::string str ("float"); - return str; - } - - const std::string& typeName (const double*) - { - static std::string str ("double"); - return str; - } - - const std::string& typeName (const i4complex*) - { - static std::string str ("i4complex"); - return str; - } - - const std::string& typeName (const i16complex*) - { - static std::string str ("i16complex"); - return str; - } - - const std::string& typeName (const u16complex*) - { - static std::string str ("u16complex"); - return str; - } - - const std::string& typeName (const fcomplex*) - { - static std::string str ("fcomplex"); - return str; - } - - const std::string& typeName (const dcomplex*) - { - static std::string str ("dcomplex"); - return str; - } - -#ifdef LOFAR_BUILTIN_COMPLEXINT - const std::string& typeName (const std::complex<int16>*) - { - static std::string str ("i16complex"); - return str; - } - const std::string& typeName (const std::complex<uint16>*) - { - static std::string str ("u16complex"); - return str; - } -#endif - -#ifdef LOFAR_BUILTIN_COMPLEXFP - const std::string& typeName (const std::complex<float>*) - { - static std::string str ("fcomplex"); - return str; - } - const std::string& typeName (const std::complex<double>*) - { - static std::string str ("dcomplex"); - return str; - } -#endif -} diff --git a/dependencies/Common/src/hexdump.cc b/dependencies/Common/src/hexdump.cc deleted file mode 100644 index d251972ff17147d2858ae00d6caff1282e15c569..0000000000000000000000000000000000000000 --- a/dependencies/Common/src/hexdump.cc +++ /dev/null @@ -1,118 +0,0 @@ -//# Hexdump.cc: Produces hexdump of data block -//# -//# Copyright (C) 2002-2004 -//# ASTRON (Netherlands Institute for Radio Astronomy) -//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands -//# -//# This file is part of the LOFAR software suite. -//# The LOFAR software suite 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 3 of the License, or -//# (at your option) any later version. -//# -//# The LOFAR software suite 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 the LOFAR software suite. If not, see <http://www.gnu.org/licenses/>. -//# -//# $Id$ - -//# Always #include <lofar_config.h> first! -#include <lofar_config.h> - -#include <Common/hexdump.h> -#include <Common/StringUtil.h> -#include <cstdio> - -using namespace LOFAR; - -namespace LOFAR -{ - -// Define hexdump modes -enum { HdmString, HdmFile, HdmCppString }; - -// -// internalHexdump(buf, nrBytes, mode) -// -void internalHexdump (void* device, - const void* buf, - int32 nrBytes, - int32 mode) -{ -#define BTS_P_LINE 16 -#define HALF_LINE (BTS_P_LINE/2) - - char hex[(3*BTS_P_LINE)+4], chars[BTS_P_LINE+1]; - - const unsigned char *ch = (const unsigned char*)buf; - - for (int32 left = 0; left < nrBytes; left += BTS_P_LINE) { - for (int32 i = 0; i < BTS_P_LINE; i++, ch++) { - if (left + i < nrBytes) { - // add bytes code to hex and char string - sprintf(hex+(i*3)+(i/HALF_LINE),"%02x ",(int)*ch); - chars[i] = (*ch>=32 && *ch<=127) ? *ch : '.'; - } - else { - sprintf(hex+(i*3)+(i/HALF_LINE), " "); - chars[i] = ' '; - } - } - hex [3*BTS_P_LINE+2] = '\0'; - chars [BTS_P_LINE] = '\0'; - // show result - switch (mode) { - case HdmFile: - fprintf (static_cast<FILE*>(device), "%04X: %s%s\n", left, hex, chars); - break; - case HdmString: - sprintf (static_cast<char*>(device), "%04X: %s%s\n", left, hex, chars); - device = static_cast<char*>(device) + (6+(3*BTS_P_LINE)+2+BTS_P_LINE+1); - break; - case HdmCppString: - static_cast<string*>(device)->append(formatString("%04X: %s%s\n", left, hex, chars)); - break; - } - - chars[0] = '\0'; - } -} - -// -// hexdump(buf, nrBytes) to standard out -// -void hexdump (const void *buf, int32 nrBytes) -{ - internalHexdump(stdout, buf, nrBytes, HdmFile); -} - -// -// hexdump(file, buf, nrBytes) -// -void hexdump (FILE* aFile, const void *buf, int32 nrBytes) -{ - internalHexdump(aFile, buf, nrBytes, HdmFile); -} - -// -// hexdump(string, buf, nrBytes) -// -void hexdump (char* aString, const void *buf, int32 nrBytes) -{ - internalHexdump(aString, buf, nrBytes, HdmString); -} - -// -// hexdump(string&, buf, nrBytes) -// -void hexdump (string& aString, const void *buf, int32 nrBytes) -{ - internalHexdump(&aString, buf, nrBytes, HdmCppString); -} - - -} // namespace LOFAR diff --git a/dependencies/Common/src/shmem/dlmalloc.c b/dependencies/Common/src/shmem/dlmalloc.c deleted file mode 100644 index 1c8ad616c0753153c921b79e13b4b7622c7502b5..0000000000000000000000000000000000000000 --- a/dependencies/Common/src/shmem/dlmalloc.c +++ /dev/null @@ -1,5481 +0,0 @@ -/* - This is an adaptation of Doug Lea's malloc to be used for shared memory. - - - This is a version (aka dlmalloc) of malloc/free/realloc written by - Doug Lea and released to the public domain. Use, modify, and - redistribute this code without permission or acknowledgement in any - way you wish. Send questions, comments, complaints, performance - data, etc to dl@cs.oswego.edu - -* VERSION 2.7.0 Sun Mar 11 14:14:06 2001 Doug Lea (dl at gee) - - Note: There may be an updated version of this malloc obtainable at - ftp://gee.cs.oswego.edu/pub/misc/malloc.c - Check before installing! - -* Quickstart - - This library is all in one file to simplify the most common usage: - ftp it, compile it (-O), and link it into another program. All - of the compile-time options default to reasonable values for use on - most unix platforms. Compile -DWIN32 for reasonable defaults on windows. - You might later want to step through various compile-time and dynamic - tuning options. - - For convenience, an include file for code using this malloc is at: - ftp://gee.cs.oswego.edu/pub/misc/malloc-2.7.0.h - You don't really need this .h file unless you call functions not - defined in your system include files. The .h file contains only the - excerpts from this file needed for using this malloc on ANSI C/C++ - systems, so long as you haven't changed compile-time options about - naming and tuning parameters. If you do, then you can create your - own malloc.h that does include all settings by cutting at the point - indicated below. - -* Why use this malloc? - - This is not the fastest, most space-conserving, most portable, or - most tunable malloc ever written. However it is among the fastest - while also being among the most space-conserving, portable and tunable. - Consistent balance across these factors results in a good general-purpose - allocator for malloc-intensive programs. - - The main properties of the algorithms are: - * For large (>= 512 bytes) requests, it is a pure best-fit allocator, - with ties normally decided via FIFO (i.e. least recently used). - * For small (<= 64 bytes by default) requests, it is a caching - allocator, that maintains pools of quickly recycled chunks. - * In between, and for combinations of large and small requests, it does - the best it can trying to meet both goals at once. - * For very large requests (>= 128KB by default), it relies on system - memory mapping facilities, if supported. - - For a longer but slightly out of date high-level description, see - http://gee.cs.oswego.edu/dl/html/malloc.html - - You may already by default be using a C library containing a malloc - that is based on some version of this malloc (for example in - linux). You might still want to use the one in this file in order to - customize settings or to avoid overheads associated with library - versions. - -* Contents, described in more detail in "description of public routines" below. - - Standard (ANSI/SVID/...) functions: - malloc(size_t n); - calloc(size_t n_elements, size_t element_size); - free(Void_t* p); - realloc(Void_t* p, size_t n); - memalign(size_t alignment, size_t n); - valloc(size_t n); - mallinfo() - mallopt(int parameter_number, int parameter_value) - - Additional functions: - independent_calloc(size_t n_elements, size_t size, Void_t* chunks[]); - independent_comalloc(size_t n_elements, size_t sizes[], Void_t* chunks[]); - pvalloc(size_t n); - cfree(Void_t* p); - malloc_trim(size_t pad); - malloc_usable_size(Void_t* p); - malloc_stats(); - -* Vital statistics: - - Supported pointer representation: 4 or 8 bytes - Supported size_t representation: 4 or 8 bytes - Note that size_t is allowed to be 4 bytes even if pointers are 8. - You can adjust this by defining INTERNAL_SIZE_T - - Alignment: 2 * sizeof(size_t) (default) - (i.e., 8 byte alignment with 4byte size_t). This suffices for - nearly all current machines and C compilers. However, you can - define MALLOC_ALIGNMENT to be wider than this if necessary. - - Minimum overhead per allocated chunk: 4 or 8 bytes - Each malloced chunk has a hidden word of overhead holding size - and status information. - - Minimum allocated size: 4-byte ptrs: 16 bytes (including 4 overhead) - 8-byte ptrs: 24/32 bytes (including, 4/8 overhead) - - When a chunk is freed, 12 (for 4byte ptrs) or 20 (for 8 byte - ptrs but 4 byte size) or 24 (for 8/8) additional bytes are - needed; 4 (8) for a trailing size field and 8 (16) bytes for - free list pointers. Thus, the minimum allocatable size is - 16/24/32 bytes. - - Even a request for zero bytes (i.e., malloc(0)) returns a - pointer to something of the minimum allocatable size. - - The maximum overhead wastage (i.e., number of extra bytes - allocated than were requested in malloc) is less than or equal - to the minimum size, except for requests >= mmap_threshold that - are serviced via mmap(), where the worst case wastage is 2 * - sizeof(size_t) bytes plus the remainder from a system page (the - minimal mmap unit); typically 4096 or 8192 bytes. - - Maximum allocated size: 4-byte size_t: 2^32 minus about two pages - 8-byte size_t: 2^64 minus about two pages - - It is assumed that (possibly signed) size_t values suffice to - represent chunk sizes. `Possibly signed' is due to the fact - that `size_t' may be defined on a system as either a signed or - an unsigned type. The ISO C standard says that it must be - unsigned, but a few systems are known not to adhere to this. - Additionally, even when size_t is unsigned, sbrk (which is by - default used to obtain memory from system) accepts signed - arguments, and may not be able to handle size_t-wide arguments - with negative sign bit. Generally, values that would - appear as negative after accounting for overhead and alignment - are supported only via mmap(), which does not have this - limitation. - - Requests for sizes outside the allowed range will perform an optional - failure action and then return null. (Requests may also - also fail because a system is out of memory.) - - Thread-safety: NOT thread-safe unless USE_MALLOC_LOCK defined - - When USE_MALLOC_LOCK is defined, wrappers are created to - surround every public call with either a pthread mutex or - a win32 spinlock (depending on WIN32). This is not - especially fast, and can be a major bottleneck. - It is designed only to provide minimal protection - in concurrent environments, and to provide a basis for - extensions. If you are using malloc in a concurrent program, - you would be far better off obtaining ptmalloc, which is - derived from a version of this malloc, and is well-tuned for - concurrent programs. (See http://www.malloc.de) - - Compliance: I believe it is compliant with the 1997 Single Unix Specification - (See http://www.opennc.org). Also SVID/XPG, ANSI C, and probably - others as well. - -* Synopsis of compile-time options: - - People have reported using previous versions of this malloc on all - versions of Unix, sometimes by tweaking some of the defines - below. It has been tested most extensively on Solaris and - Linux. It is also reported to work on WIN32 platforms. - People also report using it in stand-alone embedded systems. - - The implementation is in straight, hand-tuned ANSI C. It is not - at all modular. (Sorry!) It uses a lot of macros. To be at all - usable, this code should be compiled using an optimizing compiler - (for example gcc -O3) that can simplify expressions and control - paths. (FAQ: some macros import variables as arguments rather than - declare locals because people reported that some debuggers - otherwise get confused.) - - OPTION DEFAULT VALUE - - Compilation Environment options: - - __STD_C derived from C compiler defines - WIN32 NOT defined - HAVE_MEMCPY defined - USE_MEMCPY 1 if HAVE_MEMCPY is defined - HAVE_MMAP defined as 1 - MMAP_CLEARS 1 - HAVE_MREMAP 0 unless linux defined - malloc_getpagesize derived from system #includes, or 4096 if not - HAVE_USR_INCLUDE_MALLOC_H NOT defined - LACKS_UNISTD_H NOT defined unless WIN32 - LACKS_SYS_PARAM_H NOT defined unless WIN32 - LACKS_SYS_MMAN_H NOT defined unless WIN32 - - Changing default word sizes: - - INTERNAL_SIZE_T size_t - MALLOC_ALIGNMENT 2 * sizeof(INTERNAL_SIZE_T) - - Configuration and functionality options: - - USE_DL_PREFIX NOT defined - USE_PUBLIC_MALLOC_WRAPPERS NOT defined - USE_MALLOC_LOCK NOT defined - DEBUG NOT defined - REALLOC_ZERO_BYTES_FREES NOT defined - MALLOC_FAILURE_ACTION errno = ENOMEM, if __STD_C defined, else no-op - TRIM_FASTBINS 0 - - Options for customizing MORECORE: - - MORECORE sbrk - MORECORE_CONTIGUOUS 1 - MORECORE_CANNOT_TRIM NOT defined - MMAP_AS_MORECORE_SIZE (1024 * 1024) - - Tuning options that are also dynamically changeable via mallopt: - - DEFAULT_MXFAST 64 - DEFAULT_TRIM_THRESHOLD 128 * 1024 - DEFAULT_TOP_PAD 0 - DEFAULT_MMAP_THRESHOLD 128 * 1024 - DEFAULT_MMAP_MAX 65536 - - There are several other #defined constants and macros that you - probably don't want to touch unless you are extending or adapting malloc. -*/ - -/* - WIN32 sets up defaults for MS environment and compilers. - Otherwise defaults are for unix. -*/ - -#ifdef SHMEM_ALLOC -#include "Common/shmem/segbasemap.h" -#endif - -/* #define WIN32 */ - -#ifdef WIN32 - -#define WIN32_LEAN_AND_MEAN -#include <windows.h> - -/* Win32 doesn't supply or need the following headers */ -#define LACKS_UNISTD_H -#define LACKS_SYS_PARAM_H -#define LACKS_SYS_MMAN_H - -/* Use the supplied emulation of sbrk */ -#define MORECORE sbrk -#define MORECORE_CONTIGUOUS 1 -#define MORECORE_FAILURE ((void*)(-1)) - -/* Use the supplied emulation of mmap and munmap */ -#define HAVE_MMAP 1 -#define MUNMAP_FAILURE (-1) -#define MMAP_CLEARS 1 - -/* These values don't really matter in windows mmap emulation */ -#define MAP_PRIVATE 1 -#define MAP_ANONYMOUS 2 -#define PROT_READ 1 -#define PROT_WRITE 2 - -/* Emulation functions defined at the end of this file */ - -/* If USE_MALLOC_LOCK, use supplied critical-section-based lock functions */ -#ifdef USE_MALLOC_LOCK -static int slwait(int *sl); -static int slrelease(int *sl); -#endif - -static long getpagesize(void); -static long getregionsize(void); -static void *sbrk(long size); -static void *mmap(void *ptr, long size, long prot, long type, long handle, long arg); -static long munmap(void *ptr, long size); - -static void vminfo (unsigned long *free, unsigned long *reserved, unsigned long *committed); -static int cpuinfo (int whole, unsigned long *kernel, unsigned long *user); - -#endif - -/* - __STD_C should be nonzero if using ANSI-standard C compiler, a C++ - compiler, or a C compiler sufficiently close to ANSI to get away - with it. -*/ - -#ifndef __STD_C -#if defined(__STDC__) || defined(_cplusplus) -#define __STD_C 1 -#else -#define __STD_C 0 -#endif -#endif /*__STD_C*/ - - -/* - Void_t* is the pointer type that malloc should say it returns -*/ - -#ifndef Void_t -#if (__STD_C || defined(WIN32)) -#define Void_t void -#else -#define Void_t char -#endif -#endif /*Void_t*/ - -#if __STD_C -#include <stddef.h> /* for size_t */ -#else -#include <sys/types.h> -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -/* define LACKS_UNISTD_H if your system does not have a <unistd.h>. */ - -/* #define LACKS_UNISTD_H */ - -#ifndef LACKS_UNISTD_H -#include <unistd.h> -#endif - -/* define LACKS_SYS_PARAM_H if your system does not have a <sys/param.h>. */ - -/* #define LACKS_SYS_PARAM_H */ - - -#include <stdio.h> /* needed for malloc_stats */ -#include <errno.h> /* needed for optional MALLOC_FAILURE_ACTION */ - - -/* - Debugging: - - Because freed chunks may be overwritten with bookkeeping fields, this - malloc will often die when freed memory is overwritten by user - programs. This can be very effective (albeit in an annoying way) - in helping track down dangling pointers. - - If you compile with -DDEBUG, a number of assertion checks are - enabled that will catch more memory errors. You probably won't be - able to make much sense of the actual assertion errors, but they - should help you locate incorrectly overwritten memory. The - checking is fairly extensive, and will slow down execution - noticeably. Calling malloc_stats or mallinfo with DEBUG set will - attempt to check every non-mmapped allocated and free chunk in the - course of computing the summmaries. (By nature, mmapped regions - cannot be checked very much automatically.) - - Setting DEBUG may also be helpful if you are trying to modify - this code. The assertions in the check routines spell out in more - detail the assumptions and invariants underlying the algorithms. - - Setting DEBUG does NOT provide an automated mechanism for checking - that all accesses to malloced memory stay within their - bounds. However, there are several add-ons and adaptations of this - or other mallocs available that do this. -*/ - -#if DEBUG -#include <assert.h> -#else -#define assert(x) ((void)0) -#endif - - -/* - INTERNAL_SIZE_T is the word-size used for internal bookkeeping - of chunk sizes. - - The default version is the same as size_t. - - While not strictly necessary, it is best to define this as an - unsigned type, even if size_t is a signed type. This may avoid some - artificial size limitations on some systems. - - On a 64-bit machine, you may be able to reduce malloc overhead by - defining INTERNAL_SIZE_T to be a 32 bit `unsigned int' at the - expense of not being able to handle more than 2^32 of malloced - space. If this limitation is acceptable, you are encouraged to set - this unless you are on a platform requiring 16byte alignments. In - this case the alignment requirements turn out to negate any - potential advantages of decreasing size_t word size. - - Implementors: Beware of the possible combinations of: - - INTERNAL_SIZE_T might be signed or unsigned, might be 32 or 64 bits, - and might be the same width as int or as long - - size_t might have different width and signedness as INTERNAL_SIZE_T - - int and long might be 32 or 64 bits, and might be the same width - To deal with this, most comparisons and difference computations - among INTERNAL_SIZE_Ts should cast them to unsigned long, being - aware of the fact that casting an unsigned int to a wider long does - not sign-extend. (This also makes checking for negative numbers - awkward.) Some of these casts result in harmless compiler warnings - on some systems. -*/ - -#ifndef INTERNAL_SIZE_T -#define INTERNAL_SIZE_T size_t -#endif - -/* The corresponding word size */ -#define SIZE_SZ (sizeof(INTERNAL_SIZE_T)) - - -/* - MALLOC_ALIGNMENT is the minimum alignment for malloc'ed chunks. - It must be a power of two at least 2 * SIZE_SZ, even on machines - for which smaller alignments would suffice. It may be defined as - larger than this though. Note however that code and data structures - are optimized for the case of 8-byte alignment. -*/ - - -#ifndef MALLOC_ALIGNMENT -#define MALLOC_ALIGNMENT (2 * SIZE_SZ) -#endif - -/* The corresponding bit mask value */ -#define MALLOC_ALIGN_MASK (MALLOC_ALIGNMENT - 1) - - - -/* - REALLOC_ZERO_BYTES_FREES should be set if a call to - realloc with zero bytes should be the same as a call to free. - Some people think it should. Otherwise, since this malloc - returns a unique pointer for malloc(0), so does realloc(p, 0). -*/ - -/* #define REALLOC_ZERO_BYTES_FREES */ - -/* - TRIM_FASTBINS controls whether free() of a very small chunk can - immediately lead to trimming. Setting to true (1) can reduce memory - footprint, but will almost always slow down programs that use a lot - of small chunks. - - Define this only if you are willing to give up some speed to more - aggressively reduce system-level memory footprint when releasing - memory in programs that use many small chunks. You can get - essentially the same effect by setting MXFAST to 0, but this can - lead to even greater slowdowns in programs using many small chunks. - TRIM_FASTBINS is an in-between compile-time option, that disables - only those chunks bordering topmost memory from being placed in - fastbins. -*/ - -#ifndef TRIM_FASTBINS -#define TRIM_FASTBINS 0 -#endif - - -/* - USE_DL_PREFIX will prefix all public routines with the string 'dl'. - This is necessary when you only want to use this malloc in one part - of a program, using your regular system malloc elsewhere. -*/ - -/* #define USE_DL_PREFIX */ - - -/* - USE_MALLOC_LOCK causes wrapper functions to surround each - callable routine with pthread mutex lock/unlock. - - USE_MALLOC_LOCK forces USE_PUBLIC_MALLOC_WRAPPERS to be defined -*/ - - -/* #define USE_MALLOC_LOCK */ - - -/* - If USE_PUBLIC_MALLOC_WRAPPERS is defined, every public routine is - actually a wrapper function that first calls MALLOC_PREACTION, then - calls the internal routine, and follows it with - MALLOC_POSTACTION. This is needed for locking, but you can also use - this, without USE_MALLOC_LOCK, for purposes of interception, - instrumentation, etc. It is a sad fact that using wrappers often - noticeably degrades performance of malloc-intensive programs. -*/ - -#ifdef USE_MALLOC_LOCK -#define USE_PUBLIC_MALLOC_WRAPPERS -#else -/* #define USE_PUBLIC_MALLOC_WRAPPERS */ -#endif - - -/* - Two-phase name translation. - All of the actual routines are given mangled names. - When wrappers are used, they become the public callable versions. - When DL_PREFIX is used, the callable names are prefixed. -*/ - -#ifndef USE_PUBLIC_MALLOC_WRAPPERS -#define cALLOc public_cALLOc -#define fREe public_fREe -#define cFREe public_cFREe -#define mALLOc public_mALLOc -#define mEMALIGn public_mEMALIGn -#define rEALLOc public_rEALLOc -#define vALLOc public_vALLOc -#define pVALLOc public_pVALLOc -#define mALLINFo public_mALLINFo -#define mALLOPt public_mALLOPt -#define mTRIm public_mTRIm -#define mSTATs public_mSTATs -#define mUSABLe public_mUSABLe -#define iCALLOc public_iCALLOc -#define iCOMALLOc public_iCOMALLOc -#endif - -#ifdef USE_DL_PREFIX -#define public_cALLOc dlcalloc -#define public_fREe dlfree -#define public_cFREe dlcfree -#define public_mALLOc dlmalloc -#define public_mEMALIGn dlmemalign -#define public_rEALLOc dlrealloc -#define public_vALLOc dlvalloc -#define public_pVALLOc dlpvalloc -#define public_mALLINFo dlmallinfo -#define public_mALLOPt dlmallopt -#define public_mTRIm dlmalloc_trim -#define public_mSTATs dlmalloc_stats -#define public_mUSABLe dlmalloc_usable_size -#define public_iCALLOc dlindependent_calloc -#define public_iCOMALLOc dlindependent_comalloc -#else /* USE_DL_PREFIX */ -#define public_cALLOc calloc -#define public_fREe free -#define public_cFREe cfree -#define public_mALLOc malloc -#define public_mEMALIGn memalign -#define public_rEALLOc realloc -#define public_vALLOc valloc -#define public_pVALLOc pvalloc -#define public_mALLINFo mallinfo -#define public_mALLOPt mallopt -#define public_mTRIm malloc_trim -#define public_mSTATs malloc_stats -#define public_mUSABLe malloc_usable_size -#define public_iCALLOc independent_calloc -#define public_iCOMALLOc independent_comalloc -#endif /* USE_DL_PREFIX */ - - -/* - HAVE_MEMCPY should be defined if you are not otherwise using - ANSI STD C, but still have memcpy and memset in your C library - and want to use them in calloc and realloc. Otherwise simple - macro versions are defined below. - - USE_MEMCPY should be defined as 1 if you actually want to - have memset and memcpy called. People report that the macro - versions are faster than libc versions on some systems. - - Even if USE_MEMCPY is set to 1, loops to copy/clear small chunks - (of <= 36 bytes) are manually unrolled in realloc and calloc. -*/ - -#define HAVE_MEMCPY - -#ifndef USE_MEMCPY -#ifdef HAVE_MEMCPY -#define USE_MEMCPY 1 -#else -#define USE_MEMCPY 0 -#endif -#endif - - -#if (__STD_C || defined(HAVE_MEMCPY)) - -#ifdef WIN32 -/* On Win32 memset and memcpy are already declared in windows.h */ -#else -#if __STD_C -void* memset(void*, int, size_t); -void* memcpy(void*, const void*, size_t); -#else -Void_t* memset(); -Void_t* memcpy(); -#endif -#endif -#endif - -/* - MALLOC_FAILURE_ACTION is the action to take before "return 0" when - malloc fails to be able to return memory, either because memory is - exhausted or because of illegal arguments. - - By default, sets errno if running on STD_C platform, else does nothing. -*/ - -#ifndef MALLOC_FAILURE_ACTION -#if __STD_C -#define MALLOC_FAILURE_ACTION \ - errno = ENOMEM; - -#else -#define MALLOC_FAILURE_ACTION -#endif -#endif - -/* - MORECORE-related declarations. By default, rely on sbrk -*/ - - -#ifdef LACKS_UNISTD_H -#if !defined(__FreeBSD__) && !defined(__OpenBSD__) && !defined(__NetBSD__) -#if __STD_C -extern Void_t* sbrk(ptrdiff_t); -#else -extern Void_t* sbrk(); -#endif -#endif -#endif - -/* - MORECORE is the name of the routine to call to obtain more memory - from the system. See below for general guidance on writing - alternative MORECORE functions, as well as a version for WIN32 and a - sample version for pre-OSX macos. -*/ - -#ifndef MORECORE -#define MORECORE sbrk -#endif - -/* - MORECORE_FAILURE is the value returned upon failure of MORECORE - as well as mmap. Since it cannot be an otherwise valid memory address, - and must reflect values of standard sys calls, you probably ought not - try to redefine it. -*/ - -#ifndef MORECORE_FAILURE -#define MORECORE_FAILURE (-1) -#endif - -/* - If MORECORE_CONTIGUOUS is true, take advantage of fact that - consecutive calls to MORECORE with positive arguments always return - contiguous increasing addresses. This is true of unix sbrk. Even - if not defined, when regions happen to be contiguous, malloc will - permit allocations spanning regions obtained from different - calls. But defining this when applicable enables some stronger - consistency checks and space efficiencies. -*/ - -#ifndef MORECORE_CONTIGUOUS -#define MORECORE_CONTIGUOUS 1 -#endif - -/* - Define MORECORE_CANNOT_TRIM if your version of MORECORE - cannot release space back to the system when given negative - arguments. This is generally necessary only if you are using - a hand-crafted MORECORE function that cannot handle negative arguments. -*/ - -/* #define MORECORE_CANNOT_TRIM */ - - -/* - Define HAVE_MMAP as true to optionally make malloc() use mmap() to - allocate very large blocks. These will be returned to the - operating system immediately after a free(). Also, if mmap - is available, it is used as a backup strategy in cases where - MORECORE fails to provide space from system. - - This malloc is best tuned to work with mmap for large requests. - If you do not have mmap, operations involving very large chunks (1MB - or so) may be slower than you'd like. -*/ - -#ifndef HAVE_MMAP -#define HAVE_MMAP 1 - -/* - Standard unix mmap using /dev/zero clears memory so calloc doesn't - need to. -*/ - -#ifndef MMAP_CLEARS -#define MMAP_CLEARS 1 -#endif - -#else /* no mmap */ -#ifndef MMAP_CLEARS -#define MMAP_CLEARS 0 -#endif -#endif - - -/* - MMAP_AS_MORECORE_SIZE is the minimum mmap size argument to use if - sbrk fails, and mmap is used as a backup (which is done only if - HAVE_MMAP). The value must be a multiple of page size. This - backup strategy generally applies only when systems have "holes" in - address space, so sbrk cannot perform contiguous expansion, but - there is still space available on system. On systems for which - this is known to be useful (i.e. most linux kernels), this occurs - only when programs allocate huge amounts of memory. Between this, - and the fact that mmap regions tend to be limited, the size should - be large, to avoid too many mmap calls and thus avoid running out - of kernel resources. -*/ - -#ifndef MMAP_AS_MORECORE_SIZE -#define MMAP_AS_MORECORE_SIZE (1024 * 1024) -#endif - -/* - Define HAVE_MREMAP to make realloc() use mremap() to re-allocate - large blocks. This is currently only possible on Linux with - kernel versions newer than 1.3.77. -*/ - -#ifndef HAVE_MREMAP -#ifdef linux -#define HAVE_MREMAP 1 -#else -#define HAVE_MREMAP 0 -#endif - -#endif /* HAVE_MMAP */ - - -/* - The system page size. To the extent possible, this malloc manages - memory from the system in page-size units. Note that this value is - cached during initialization into a field of malloc_state. So even - if malloc_getpagesize is a function, it is only called once. - - The following mechanics for getpagesize were adapted from bsd/gnu - getpagesize.h. If none of the system-probes here apply, a value of - 4096 is used, which should be OK: If they don't apply, then using - the actual value probably doesn't impact performance. -*/ - - -#ifndef malloc_getpagesize - -#ifndef LACKS_UNISTD_H -# include <unistd.h> -#endif - -# ifdef _SC_PAGESIZE /* some SVR4 systems omit an underscore */ -# ifndef _SC_PAGE_SIZE -# define _SC_PAGE_SIZE _SC_PAGESIZE -# endif -# endif - -# ifdef _SC_PAGE_SIZE -# define malloc_getpagesize sysconf(_SC_PAGE_SIZE) -# else -# if defined(BSD) || defined(DGUX) || defined(HAVE_GETPAGESIZE) - extern size_t getpagesize(); -# define malloc_getpagesize getpagesize() -# else -# ifdef WIN32 /* use supplied emulation of getpagesize */ -# define malloc_getpagesize getpagesize() -# else -# ifndef LACKS_SYS_PARAM_H -# include <sys/param.h> -# endif -# ifdef EXEC_PAGESIZE -# define malloc_getpagesize EXEC_PAGESIZE -# else -# ifdef NBPG -# ifndef CLSIZE -# define malloc_getpagesize NBPG -# else -# define malloc_getpagesize (NBPG * CLSIZE) -# endif -# else -# ifdef NBPC -# define malloc_getpagesize NBPC -# else -# ifdef PAGESIZE -# define malloc_getpagesize PAGESIZE -# else /* just guess */ -# define malloc_getpagesize (4096) -# endif -# endif -# endif -# endif -# endif -# endif -# endif -#endif - -/* - This version of malloc supports the standard SVID/XPG mallinfo - routine that returns a struct containing usage properties and - statistics. It should work on any SVID/XPG compliant system that has - a /usr/include/malloc.h defining struct mallinfo. (If you'd like to - install such a thing yourself, cut out the preliminary declarations - as described above and below and save them in a malloc.h file. But - there's no compelling reason to bother to do this.) - - The main declaration needed is the mallinfo struct that is returned - (by-copy) by mallinfo(). The SVID/XPG malloinfo struct contains a - bunch of field that are not even meaningful in this version of - malloc. These fields are are instead filled by mallinfo() with - other numbers that might be of interest. - - HAVE_USR_INCLUDE_MALLOC_H should be set if you have a - /usr/include/malloc.h file that includes a declaration of struct - mallinfo. If so, it is included; else an SVID2/XPG2 compliant - version is declared below. These must be precisely the same for - mallinfo() to work. The original SVID version of this struct, - defined on most systems with mallinfo, declares all fields as - ints. But some others define as unsigned long. If your system - defines the fields using a type of different width than listed here, - you must #include your system version and #define - HAVE_USR_INCLUDE_MALLOC_H. -*/ - -/* #define HAVE_USR_INCLUDE_MALLOC_H */ - -#ifdef HAVE_USR_INCLUDE_MALLOC_H -#include "/usr/include/malloc.h" -#else - -/* SVID2/XPG mallinfo structure */ - -struct mallinfo { - int arena; /* non-mmapped space allocated from system */ - int ordblks; /* number of free chunks */ - int smblks; /* number of fastbin blocks */ - int hblks; /* number of mmapped regions */ - int hblkhd; /* space in mmapped regions */ - int usmblks; /* maximum total allocated space */ - int fsmblks; /* space available in freed fastbin blocks */ - int uordblks; /* total allocated space */ - int fordblks; /* total free space */ - int keepcost; /* top-most, releasable (via malloc_trim) space */ -}; - -/* - SVID/XPG defines four standard parameter numbers for mallopt, - normally defined in malloc.h. Only one of these (M_MXFAST) is used - in this malloc. The others (M_NLBLKS, M_GRAIN, M_KEEP) don't apply, - so setting them has no effect. But this malloc also supports other - options in mallopt described below. -*/ -#endif - - -/* ---------- description of public routines ------------ */ - -/* - malloc(size_t n) - Returns a pointer to a newly allocated chunk of at least n bytes, or null - if no space is available. Additionally, on failure, errno is - set to ENOMEM on ANSI C systems. - - If n is zero, malloc returns a minumum-sized chunk. (The minimum - size is 16 bytes on most 32bit systems, and 24 or 32 bytes on 64bit - systems.) On most systems, size_t is an unsigned type, so calls - with negative arguments are interpreted as requests for huge amounts - of space, which will often fail. The maximum supported value of n - differs across systems, but is in all cases less than the maximum - representable value of a size_t. -*/ -#if __STD_C -Void_t* public_mALLOc(size_t); -#else -Void_t* public_mALLOc(); -#endif - -/* - free(Void_t* p) - Releases the chunk of memory pointed to by p, that had been previously - allocated using malloc or a related routine such as realloc. - It has no effect if p is null. It can have arbitrary (i.e., bad!) - effects if p has already been freed. - - Unless disabled (using mallopt), freeing very large spaces will - when possible, automatically trigger operations that give - back unused memory to the system, thus reducing program footprint. -*/ -#if __STD_C -void public_fREe(Void_t*); -#else -void public_fREe(); -#endif - -/* - calloc(size_t n_elements, size_t element_size); - Returns a pointer to n_elements * element_size bytes, with all locations - set to zero. -*/ -#if __STD_C -Void_t* public_cALLOc(size_t, size_t); -#else -Void_t* public_cALLOc(); -#endif - -/* - realloc(Void_t* p, size_t n) - Returns a pointer to a chunk of size n that contains the same data - as does chunk p up to the minimum of (n, p's size) bytes, or null - if no space is available. - - The returned pointer may or may not be the same as p. The algorithm - prefers extending p when possible, otherwise it employs the - equivalent of a malloc-copy-free sequence. - - If p is null, realloc is equivalent to malloc. - - If space is not available, realloc returns null, errno is set (if on - ANSI) and p is NOT freed. - - if n is for fewer bytes than already held by p, the newly unused - space is lopped off and freed if possible. Unless the #define - REALLOC_ZERO_BYTES_FREES is set, realloc with a size argument of - zero (re)allocates a minimum-sized chunk. - - Large chunks that were internally obtained via mmap will always - be reallocated using malloc-copy-free sequences unless - the system supports MREMAP (currently only linux). - - The old unix realloc convention of allowing the last-free'd chunk - to be used as an argument to realloc is not supported. -*/ -#if __STD_C -Void_t* public_rEALLOc(Void_t*, size_t); -#else -Void_t* public_rEALLOc(); -#endif - -/* - memalign(size_t alignment, size_t n); - Returns a pointer to a newly allocated chunk of n bytes, aligned - in accord with the alignment argument. - - The alignment argument should be a power of two. If the argument is - not a power of two, the nearest greater power is used. - 8-byte alignment is guaranteed by normal malloc calls, so don't - bother calling memalign with an argument of 8 or less. - - Overreliance on memalign is a sure way to fragment space. -*/ -#if __STD_C -Void_t* public_mEMALIGn(size_t, size_t); -#else -Void_t* public_mEMALIGn(); -#endif - -/* - valloc(size_t n); - Equivalent to memalign(pagesize, n), where pagesize is the page - size of the system. If the pagesize is unknown, 4096 is used. -*/ -#if __STD_C -Void_t* public_vALLOc(size_t); -#else -Void_t* public_vALLOc(); -#endif - - - -/* - mallopt(int parameter_number, int parameter_value) - Sets tunable parameters The format is to provide a - (parameter-number, parameter-value) pair. mallopt then sets the - corresponding parameter to the argument value if it can (i.e., so - long as the value is meaningful), and returns 1 if successful else - 0. SVID/XPG/ANSI defines four standard param numbers for mallopt, - normally defined in malloc.h. Only one of these (M_MXFAST) is used - in this malloc. The others (M_NLBLKS, M_GRAIN, M_KEEP) don't apply, - so setting them has no effect. But this malloc also supports four - other options in mallopt. See below for details. Briefly, supported - parameters are as follows (listed defaults are for "typical" - configurations). - - Symbol param # default allowed param values - M_MXFAST 1 64 0-80 (0 disables fastbins) - M_TRIM_THRESHOLD -1 128*1024 any (-1U disables trimming) - M_TOP_PAD -2 0 any - M_MMAP_THRESHOLD -3 128*1024 any (or 0 if no MMAP support) - M_MMAP_MAX -4 65536 any (0 disables use of mmap) -*/ -#if __STD_C -int public_mALLOPt(int, int); -#else -int public_mALLOPt(); -#endif - - -/* - mallinfo() - Returns (by copy) a struct containing various summary statistics: - - arena: current total non-mmapped bytes allocated from system - ordblks: the number of free chunks - smblks: the number of fastbin blocks (i.e., small chunks that - have been freed but not use resused or consolidated) - hblks: current number of mmapped regions - hblkhd: total bytes held in mmapped regions - usmblks: the maximum total allocated space. This will be greater - than current total if trimming has occurred. - fsmblks: total bytes held in fastbin blocks - uordblks: current total allocated space (normal or mmapped) - fordblks: total free space - keepcost: the maximum number of bytes that could ideally be released - back to system via malloc_trim. ("ideally" means that - it ignores page restrictions etc.) - - Because these fields are ints, but internal bookkeeping may - be kept as longs, the reported values may wrap around zero and - thus be inaccurate. -*/ -#if __STD_C -struct mallinfo public_mALLINFo(void); -#else -struct mallinfo public_mALLINFo(); -#endif - -/* - independent_calloc(size_t n_elements, size_t element_size, Void_t* chunks[]); - - independent_calloc is similar to calloc, but instead of returning a - single cleared space, it returns an array of pointers to n_elements - independent elements that can hold contents of size elem_size, each - of which starts out cleared, and can be independently freed, - realloc'ed etc. The elements are guaranteed to be adjacently - allocated (this is not guaranteed to occur with multiple callocs or - mallocs), which may also improve cache locality in some - applications. - - The "chunks" argument is optional (i.e., may be null, which is - probably the most typical usage). If it is null, the returned array - is itself dynamically allocated and should also be freed when it is - no longer needed. Otherwise, the chunks array must be of at least - n_elements in length. It is filled in with the pointers to the - chunks. - - In either case, independent_calloc returns this pointer array, or - null if the allocation failed. If n_elements is zero and "chunks" - is null, it returns a chunk representing an array with zero elements - (which should be freed if not wanted). - - Each element must be individually freed when it is no longer - needed. If you'd like to instead be able to free all at once, you - should instead use regular calloc and assign pointers into this - space to represent elements. (In this case though, you cannot - independently free elements.) - - independent_calloc simplifies and speeds up implementations of many - kinds of pools. It may also be useful when constructing large data - structures that initially have a fixed number of fixed-sized nodes, - but the number is not known at compile time, and some of the nodes - may later need to be freed. For example: - - struct Node { int item; struct Node* next; }; - - struct Node* build_list() { - struct Node** pool; - int n = read_number_of_nodes_needed(); - if (n <= 0) return 0; - pool = (struct Node**)(independent_calloc(n, sizeof(struct Node), 0); - if (pool == 0) die(); - // organize into a linked list... - struct Node* first = pool[0]; - for (i = 0; i < n-1; ++i) - pool[i]->next = pool[i+1]; - free(pool); // Can now free the array (or not, if it is needed later) - return first; - } -*/ -#if __STD_C -Void_t** public_iCALLOc(size_t, size_t, Void_t**); -#else -Void_t** public_iCALLOc(); -#endif - -/* - independent_comalloc(size_t n_elements, size_t sizes[], Void_t* chunks[]); - - independent_comalloc allocates, all at once, a set of n_elements - chunks with sizes indicated in the "sizes" array. It returns - an array of pointers to these elements, each of which can be - independently freed, realloc'ed etc. The elements are guaranteed to - be adjacently allocated (this is not guaranteed to occur with - multiple callocs or mallocs), which may also improve cache locality - in some applications. - - The "chunks" argument is optional (i.e., may be null). If it is null - the returned array is itself dynamically allocated and should also - be freed when it is no longer needed. Otherwise, the chunks array - must be of at least n_elements in length. It is filled in with the - pointers to the chunks. - - In either case, independent_comalloc returns this pointer array, or - null if the allocation failed. If n_elements is zero and chunks is - null, it returns a chunk representing an array with zero elements - (which should be freed if not wanted). - - Each element must be individually freed when it is no longer - needed. If you'd like to instead be able to free all at once, you - should instead use a single regular malloc, and assign pointers at - particular offsets in the aggregate space. (In this case though, you - cannot independently free elements.) - - independent_comallac differs from independent_calloc in that each - element may have a different size, and also that it does not - automatically clear elements. - - independent_comalloc can be used to speed up allocation in cases - where several structs or objects must always be allocated at the - same time. For example: - - struct Head { ... } - struct Foot { ... } - - void send_message(char* msg) { - int msglen = strlen(msg); - size_t sizes[3] = { sizeof(struct Head), msglen, sizeof(struct Foot) }; - void* chunks[3]; - if (independent_comalloc(3, sizes, chunks) == 0) - die(); - struct Head* head = (struct Head*)(chunks[0]); - char* body = (char*)(chunks[1]); - struct Foot* foot = (struct Foot*)(chunks[2]); - // ... - } - - In general though, independent_comalloc is worth using only for - larger values of n_elements. For small values, you probably won't - detect enough difference from series of malloc calls to bother. - - Overuse of independent_comalloc can increase overall memory usage, - since it cannot reuse existing noncontiguous small chunks that - might be available for some of the elements. -*/ -#if __STD_C -Void_t** public_iCOMALLOc(size_t, size_t*, Void_t**); -#else -Void_t** public_iCOMALLOc(); -#endif - - -/* - pvalloc(size_t n); - Equivalent to valloc(minimum-page-that-holds(n)), that is, - round up n to nearest pagesize. - */ -#if __STD_C -Void_t* public_pVALLOc(size_t); -#else -Void_t* public_pVALLOc(); -#endif - -/* - cfree(Void_t* p); - Equivalent to free(p). - - cfree is needed/defined on some systems that pair it with calloc, - for odd historical reasons (such as: cfree is used in example - code in the first edition of K&R). -*/ -#if __STD_C -void public_cFREe(Void_t*); -#else -void public_cFREe(); -#endif - -/* - malloc_trim(size_t pad); - - If possible, gives memory back to the system (via negative - arguments to sbrk) if there is unused memory at the `high' end of - the malloc pool. You can call this after freeing large blocks of - memory to potentially reduce the system-level memory requirements - of a program. However, it cannot guarantee to reduce memory. Under - some allocation patterns, some large free blocks of memory will be - locked between two used chunks, so they cannot be given back to - the system. - - The `pad' argument to malloc_trim represents the amount of free - trailing space to leave untrimmed. If this argument is zero, - only the minimum amount of memory to maintain internal data - structures will be left (one page or less). Non-zero arguments - can be supplied to maintain enough trailing space to service - future expected allocations without having to re-obtain memory - from the system. - - Malloc_trim returns 1 if it actually released any memory, else 0. - On systems that do not support "negative sbrks", it will always - rreturn 0. -*/ -#if __STD_C -int public_mTRIm(size_t); -#else -int public_mTRIm(); -#endif - -/* - malloc_usable_size(Void_t* p); - - Returns the number of bytes you can actually use in - an allocated chunk, which may be more than you requested (although - often not) due to alignment and minimum size constraints. - You can use this many bytes without worrying about - overwriting other allocated objects. This is not a particularly great - programming practice. malloc_usable_size can be more useful in - debugging and assertions, for example: - - p = malloc(n); - assert(malloc_usable_size(p) >= 256); - -*/ -#if __STD_C -size_t public_mUSABLe(Void_t*); -#else -size_t public_mUSABLe(); -#endif - -/* - malloc_stats(); - Prints on stderr the amount of space obtained from the system (both - via sbrk and mmap), the maximum amount (which may be more than - current if malloc_trim and/or munmap got called), and the current - number of bytes allocated via malloc (or realloc, etc) but not yet - freed. Note that this is the number of bytes allocated, not the - number requested. It will be larger than the number requested - because of alignment and bookkeeping overhead. Because it includes - alignment wastage as being in use, this figure may be greater than - zero even when no user-level chunks are allocated. - - The reported current and maximum system memory can be inaccurate if - a program makes other calls to system memory allocation functions - (normally sbrk) outside of malloc. - - malloc_stats prints only the most commonly interesting statistics. - More information can be obtained by calling mallinfo. - -*/ -#if __STD_C -void public_mSTATs(); -#else -void public_mSTATs(); -#endif - -/* mallopt tuning options */ - -/* - M_MXFAST is the maximum request size used for "fastbins", special bins - that hold returned chunks without consolidating their spaces. This - enables future requests for chunks of the same size to be handled - very quickly, but can increase fragmentation, and thus increase the - overall memory footprint of a program. - - This malloc manages fastbins very conservatively yet still - efficiently, so fragmentation is rarely a problem for values less - than or equal to the default. The maximum supported value of MXFAST - is 80. You wouldn't want it any higher than this anyway. Fastbins - are designed especially for use with many small structs, objects or - strings -- the default handles structs/objects/arrays with sizes up - to 8 4byte fields, or small strings representing words, tokens, - etc. Using fastbins for larger objects normally worsens - fragmentation without improving speed. - - M_MXFAST is set in REQUEST size units. It is internally used in - chunksize units, which adds padding and alignment. You can reduce - M_MXFAST to 0 to disable all use of fastbins. This causes the malloc - algorithm to be a closer approximation of fifo-best-fit in all cases, - not just for larger requests, but will generally cause it to be - slower. -*/ - - -/* M_MXFAST is a standard SVID/XPG tuning option, usually listed in malloc.h */ -#ifndef M_MXFAST -#define M_MXFAST 1 -#endif - -#ifndef DEFAULT_MXFAST -#define DEFAULT_MXFAST 64 -#endif - - -/* - M_TRIM_THRESHOLD is the maximum amount of unused top-most memory - to keep before releasing via malloc_trim in free(). - - Automatic trimming is mainly useful in long-lived programs. - Because trimming via sbrk can be slow on some systems, and can - sometimes be wasteful (in cases where programs immediately - afterward allocate more large chunks) the value should be high - enough so that your overall system performance would improve by - releasing this much memory. - - The trim threshold and the mmap control parameters (see below) - can be traded off with one another. Trimming and mmapping are - two different ways of releasing unused memory back to the - system. Between these two, it is often possible to keep - system-level demands of a long-lived program down to a bare - minimum. For example, in one test suite of sessions measuring - the XF86 X server on Linux, using a trim threshold of 128K and a - mmap threshold of 192K led to near-minimal long term resource - consumption. - - If you are using this malloc in a long-lived program, it should - pay to experiment with these values. As a rough guide, you - might set to a value close to the average size of a process - (program) running on your system. Releasing this much memory - would allow such a process to run in memory. Generally, it's - worth it to tune for trimming rather tham memory mapping when a - program undergoes phases where several large chunks are - allocated and released in ways that can reuse each other's - storage, perhaps mixed with phases where there are no such - chunks at all. And in well-behaved long-lived programs, - controlling release of large blocks via trimming versus mapping - is usually faster. - - However, in most programs, these parameters serve mainly as - protection against the system-level effects of carrying around - massive amounts of unneeded memory. Since frequent calls to - sbrk, mmap, and munmap otherwise degrade performance, the default - parameters are set to relatively high values that serve only as - safeguards. - - The trim value It must be greater than page size to have any useful - effect. To disable trimming completely, you can set to - (unsigned long)(-1) - - Trim settings interact with fastbin (MXFAST) settings: Unless - TRIM_FASTBINS is defined, automatic trimming never takes place upon - freeing a chunk with size less than or equal to MXFAST. Trimming is - instead delayed until subsequent freeing of larger chunks. However, - you can still force an attempted trim by calling malloc_trim. - - Also, trimming is not generally possible in cases where - the main arena is obtained via mmap. - - Note that the trick some people use of mallocing a huge space and - then freeing it at program startup, in an attempt to reserve system - memory, doesn't have the intended effect under automatic trimming, - since that memory will immediately be returned to the system. -*/ - -#define M_TRIM_THRESHOLD -1 - -#ifndef DEFAULT_TRIM_THRESHOLD -#define DEFAULT_TRIM_THRESHOLD (128 * 1024) -#endif - -/* - M_TOP_PAD is the amount of extra `padding' space to allocate or - retain whenever sbrk is called. It is used in two ways internally: - - * When sbrk is called to extend the top of the arena to satisfy - a new malloc request, this much padding is added to the sbrk - request. - - * When malloc_trim is called automatically from free(), - it is used as the `pad' argument. - - In both cases, the actual amount of padding is rounded - so that the end of the arena is always a system page boundary. - - The main reason for using padding is to avoid calling sbrk so - often. Having even a small pad greatly reduces the likelihood - that nearly every malloc request during program start-up (or - after trimming) will invoke sbrk, which needlessly wastes - time. - - Automatic rounding-up to page-size units is normally sufficient - to avoid measurable overhead, so the default is 0. However, in - systems where sbrk is relatively slow, it can pay to increase - this value, at the expense of carrying around more memory than - the program needs. -*/ - -#define M_TOP_PAD -2 - -#ifndef DEFAULT_TOP_PAD -#define DEFAULT_TOP_PAD (0) -#endif - -/* - M_MMAP_THRESHOLD is the request size threshold for using mmap() - to service a request. Requests of at least this size that cannot - be allocated using already-existing space will be serviced via mmap. - (If enough normal freed space already exists it is used instead.) - - Using mmap segregates relatively large chunks of memory so that - they can be individually obtained and released from the host - system. A request serviced through mmap is never reused by any - other request (at least not directly; the system may just so - happen to remap successive requests to the same locations). - - Segregating space in this way has the benefits that: - - 1. Mmapped space can ALWAYS be individually released back - to the system, which helps keep the system level memory - demands of a long-lived program low. - 2. Mapped memory can never become `locked' between - other chunks, as can happen with normally allocated chunks, which - means that even trimming via malloc_trim would not release them. - 3. On some systems with "holes" in address spaces, mmap can obtain - memory that sbrk cannot. - - However, it has the disadvantages that: - - 1. The space cannot be reclaimed, consolidated, and then - used to service later requests, as happens with normal chunks. - 2. It can lead to more wastage because of mmap page alignment - requirements - 3. It causes malloc performance to be more dependent on host - system memory management support routines which may vary in - implementation quality and may impose arbitrary - limitations. Generally, servicing a request via normal - malloc steps is faster than going through a system's mmap. - - The advantages of mmap nearly always outweigh disadvantages for - "large" chunks, but the value of "large" varies across systems. The - default is an empirically derived value that works well in most - systems. -*/ - -#define M_MMAP_THRESHOLD -3 - -#ifndef DEFAULT_MMAP_THRESHOLD -#define DEFAULT_MMAP_THRESHOLD (128 * 1024) -#endif - -/* - M_MMAP_MAX is the maximum number of requests to simultaneously - service using mmap. This parameter exists because -. Some systems have a limited number of internal tables for - use by mmap, and using more than a few of them may degrade - performance. - - The default is set to a value that serves only as a safeguard. - Setting to 0 disables use of mmap for servicing large requests. If - HAVE_MMAP is not set, the default value is 0, and attempts to set it - to non-zero values in mallopt will fail. -*/ - -#define M_MMAP_MAX -4 - -#ifndef DEFAULT_MMAP_MAX -#if HAVE_MMAP -#define DEFAULT_MMAP_MAX (65536) -#else -#define DEFAULT_MMAP_MAX (0) -#endif -#endif - -#ifdef __cplusplus -}; /* end of extern "C" */ -#endif - -/* - ======================================================================== - To make a fully customizable malloc.h header file, cut everything - above this line, put into file malloc.h, edit to suit, and #include it - on the next line, as well as in programs that use this malloc. - ======================================================================== -*/ - -/* #include "malloc.h" */ - -/* --------------------- public wrappers ---------------------- */ - -#ifdef USE_PUBLIC_MALLOC_WRAPPERS - -/* Declare all routines as internal */ -#if __STD_C -static Void_t* mALLOc(size_t); -static void fREe(Void_t*); -static Void_t* rEALLOc(Void_t*, size_t); -static Void_t* mEMALIGn(size_t, size_t); -static Void_t* vALLOc(size_t); -static Void_t* pVALLOc(size_t); -static Void_t* cALLOc(size_t, size_t); -static Void_t** iCALLOc(size_t, size_t, Void_t**); -static Void_t** iCOMALLOc(size_t, size_t*, Void_t**); -static void cFREe(Void_t*); -static int mTRIm(size_t); -static size_t mUSABLe(Void_t*); -static void mSTATs(); -static int mALLOPt(int, int); -static struct mallinfo mALLINFo(void); -#else -static Void_t* mALLOc(); -static void fREe(); -static Void_t* rEALLOc(); -static Void_t* mEMALIGn(); -static Void_t* vALLOc(); -static Void_t* pVALLOc(); -static Void_t* cALLOc(); -static Void_t** iCALLOc(); -static Void_t** iCOMALLOc(); -static void cFREe(); -static int mTRIm(); -static size_t mUSABLe(); -static void mSTATs(); -static int mALLOPt(); -static struct mallinfo mALLINFo(); -#endif - -/* - MALLOC_PREACTION and MALLOC_POSTACTION should be - defined to return 0 on success, and nonzero on failure. - The return value of MALLOC_POSTACTION is currently ignored - in wrapper functions since there is no reasonable default - action to take on failure. -*/ - - -#ifdef USE_MALLOC_LOCK - -#ifdef WIN32 - -static int mALLOC_MUTEx; -#define MALLOC_PREACTION slwait(&mALLOC_MUTEx) -#define MALLOC_POSTACTION slrelease(&mALLOC_MUTEx) - -#else - -#include <pthread.h> - -static pthread_mutex_t mALLOC_MUTEx = PTHREAD_MUTEX_INITIALIZER; - -#define MALLOC_PREACTION pthread_mutex_lock(&mALLOC_MUTEx) -#define MALLOC_POSTACTION pthread_mutex_unlock(&mALLOC_MUTEx) - -#endif /* USE_MALLOC_LOCK */ - -#else - -/* Substitute anything you like for these */ - -#define MALLOC_PREACTION (0) -#define MALLOC_POSTACTION (0) - -#endif - -Void_t* public_mALLOc(size_t bytes) { - Void_t* m; - if (MALLOC_PREACTION != 0) { - return 0; - } - m = mALLOc(bytes); - if (MALLOC_POSTACTION != 0) { - } - return m; -} - -void public_fREe(Void_t* m) { - if (MALLOC_PREACTION != 0) { - return; - } - fREe(m); - if (MALLOC_POSTACTION != 0) { - } -} - -Void_t* public_rEALLOc(Void_t* m, size_t bytes) { - if (MALLOC_PREACTION != 0) { - return 0; - } - m = rEALLOc(m, bytes); - if (MALLOC_POSTACTION != 0) { - } - return m; -} - -Void_t* public_mEMALIGn(size_t alignment, size_t bytes) { - Void_t* m; - if (MALLOC_PREACTION != 0) { - return 0; - } - m = mEMALIGn(alignment, bytes); - if (MALLOC_POSTACTION != 0) { - } - return m; -} - -Void_t* public_vALLOc(size_t bytes) { - Void_t* m; - if (MALLOC_PREACTION != 0) { - return 0; - } - m = vALLOc(bytes); - if (MALLOC_POSTACTION != 0) { - } - return m; -} - -Void_t* public_pVALLOc(size_t bytes) { - Void_t* m; - if (MALLOC_PREACTION != 0) { - return 0; - } - m = pVALLOc(bytes); - if (MALLOC_POSTACTION != 0) { - } - return m; -} - -Void_t* public_cALLOc(size_t n, size_t elem_size) { - Void_t* m; - if (MALLOC_PREACTION != 0) { - return 0; - } - m = cALLOc(n, elem_size); - if (MALLOC_POSTACTION != 0) { - } - return m; -} - - -Void_t** public_iCALLOc(size_t n, size_t elem_size, Void_t** chunks) { - Void_t** m; - if (MALLOC_PREACTION != 0) { - return 0; - } - m = iCALLOc(n, elem_size, chunks); - if (MALLOC_POSTACTION != 0) { - } - return m; -} - -Void_t** public_iCOMALLOc(size_t n, size_t sizes[], Void_t** chunks) { - Void_t** m; - if (MALLOC_PREACTION != 0) { - return 0; - } - m = iCOMALLOc(n, sizes, chunks); - if (MALLOC_POSTACTION != 0) { - } - return m; -} - -void public_cFREe(Void_t* m) { - if (MALLOC_PREACTION != 0) { - return; - } - cFREe(m); - if (MALLOC_POSTACTION != 0) { - } -} - -int public_mTRIm(size_t s) { - int result; - if (MALLOC_PREACTION != 0) { - return 0; - } - result = mTRIm(s); - if (MALLOC_POSTACTION != 0) { - } - return result; -} - -size_t public_mUSABLe(Void_t* m) { - size_t result; - if (MALLOC_PREACTION != 0) { - return 0; - } - result = mUSABLe(m); - if (MALLOC_POSTACTION != 0) { - } - return result; -} - -void public_mSTATs() { - if (MALLOC_PREACTION != 0) { - return; - } - mSTATs(); - if (MALLOC_POSTACTION != 0) { - } -} - -struct mallinfo public_mALLINFo() { - struct mallinfo m; - if (MALLOC_PREACTION != 0) { - struct mallinfo nm = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - return nm; - } - m = mALLINFo(); - if (MALLOC_POSTACTION != 0) { - } - return m; -} - -int public_mALLOPt(int p, int v) { - int result; - if (MALLOC_PREACTION != 0) { - return 0; - } - result = mALLOPt(p, v); - if (MALLOC_POSTACTION != 0) { - } - return result; -} - -#endif - - - -/* ------------- Optional versions of memcopy ---------------- */ - - -#if USE_MEMCPY - -/* - Note: memcpy is ONLY invoked with non-overlapping regions, - so the (usually slower) memmove is not needed. -*/ - -#define MALLOC_COPY(dest, src, nbytes) memcpy(dest, src, nbytes) -#define MALLOC_ZERO(dest, nbytes) memset(dest, 0, nbytes) - -#else /* !USE_MEMCPY */ - -/* Use Duff's device for good zeroing/copying performance. */ - -#define MALLOC_ZERO(charp, nbytes) \ -do { \ - INTERNAL_SIZE_T* mzp = (INTERNAL_SIZE_T*)(charp); \ - unsigned long mctmp = (nbytes)/sizeof(INTERNAL_SIZE_T); \ - long mcn; \ - if (mctmp < 8) mcn = 0; else { mcn = (mctmp-1)/8; mctmp %= 8; } \ - switch (mctmp) { \ - case 0: for(;;) { *mzp++ = 0; \ - case 7: *mzp++ = 0; \ - case 6: *mzp++ = 0; \ - case 5: *mzp++ = 0; \ - case 4: *mzp++ = 0; \ - case 3: *mzp++ = 0; \ - case 2: *mzp++ = 0; \ - case 1: *mzp++ = 0; if(mcn <= 0) break; mcn--; } \ - } \ -} while(0) - -#define MALLOC_COPY(dest,src,nbytes) \ -do { \ - INTERNAL_SIZE_T* mcsrc = (INTERNAL_SIZE_T*) src; \ - INTERNAL_SIZE_T* mcdst = (INTERNAL_SIZE_T*) dest; \ - unsigned long mctmp = (nbytes)/sizeof(INTERNAL_SIZE_T); \ - long mcn; \ - if (mctmp < 8) mcn = 0; else { mcn = (mctmp-1)/8; mctmp %= 8; } \ - switch (mctmp) { \ - case 0: for(;;) { *mcdst++ = *mcsrc++; \ - case 7: *mcdst++ = *mcsrc++; \ - case 6: *mcdst++ = *mcsrc++; \ - case 5: *mcdst++ = *mcsrc++; \ - case 4: *mcdst++ = *mcsrc++; \ - case 3: *mcdst++ = *mcsrc++; \ - case 2: *mcdst++ = *mcsrc++; \ - case 1: *mcdst++ = *mcsrc++; if(mcn <= 0) break; mcn--; } \ - } \ -} while(0) - -#endif - -/* ------------------ MMAP support ------------------ */ - - -#if HAVE_MMAP - -#include <fcntl.h> -#ifndef LACKS_SYS_MMAN_H -#include <sys/mman.h> -#endif - -#if !defined(MAP_ANONYMOUS) && defined(MAP_ANON) -#define MAP_ANONYMOUS MAP_ANON -#endif - -/* - Nearly all versions of mmap support MAP_ANONYMOUS, - so the following is unlikely to be needed, but is - supplied just in case. -*/ - -#ifndef MAP_ANONYMOUS - -static int dev_zero_fd = -1; /* Cached file descriptor for /dev/zero. */ - -#define MMAP(addr, size, prot, flags) ((dev_zero_fd < 0) ? \ - (dev_zero_fd = open("/dev/zero", O_RDWR), \ - mmap((addr), (size), (prot), (flags), dev_zero_fd, 0)) : \ - mmap((addr), (size), (prot), (flags), dev_zero_fd, 0)) - -#else - -#define MMAP(addr, size, prot, flags) \ - (mmap((addr), (size), (prot), (flags)|MAP_ANONYMOUS, -1, 0)) - -#endif - - -#endif /* HAVE_MMAP */ - - -/* - ----------------------- Chunk representations ----------------------- -*/ - - -/* - This struct declaration is misleading (but accurate and necessary). - It declares a "view" into memory allowing access to necessary - fields at known offsets from a given base. See explanation below. -*/ - -struct malloc_chunk { - - INTERNAL_SIZE_T prev_size; /* Size of previous chunk (if free). */ - INTERNAL_SIZE_T size; /* Size in bytes, including overhead. */ - - struct malloc_chunk* fd; /* double links -- used only if free. */ - struct malloc_chunk* bk; -}; - - -typedef struct malloc_chunk* mchunkptr; - -/* - malloc_chunk details: - - (The following includes lightly edited explanations by Colin Plumb.) - - Chunks of memory are maintained using a `boundary tag' method as - described in e.g., Knuth or Standish. (See the paper by Paul - Wilson ftp://ftp.cs.utexas.edu/pub/garbage/allocsrv.ps for a - survey of such techniques.) Sizes of free chunks are stored both - in the front of each chunk and at the end. This makes - consolidating fragmented chunks into bigger chunks very fast. The - size fields also hold bits representing whether chunks are free or - in use. - - An allocated chunk looks like this: - - - chunk-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | Size of previous chunk, if allocated | | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | Size of chunk, in bytes |P| - mem-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | User data starts here... . - . . - . (malloc_usable_space() bytes) . - . | -nextchunk-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | Size of chunk | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - - - Where "chunk" is the front of the chunk for the purpose of most of - the malloc code, but "mem" is the pointer that is returned to the - user. "Nextchunk" is the beginning of the next contiguous chunk. - - Chunks always begin on even word boundries, so the mem portion - (which is returned to the user) is also on an even word boundary, and - thus at least double-word aligned. - - Free chunks are stored in circular doubly-linked lists, and look like this: - - chunk-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | Size of previous chunk | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - `head:' | Size of chunk, in bytes |P| - mem-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | Forward pointer to next chunk in list | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | Back pointer to previous chunk in list | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | Unused space (may be 0 bytes long) . - . . - . | -nextchunk-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - `foot:' | Size of chunk, in bytes | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - - The P (PREV_INUSE) bit, stored in the unused low-order bit of the - chunk size (which is always a multiple of two words), is an in-use - bit for the *previous* chunk. If that bit is *clear*, then the - word before the current chunk size contains the previous chunk - size, and can be used to find the front of the previous chunk. - The very first chunk allocated always has this bit set, - preventing access to non-existent (or non-owned) memory. If - prev_inuse is set for any given chunk, then you CANNOT determine - the size of the previous chunk, and might even get a memory - addressing fault when trying to do so. - - Note that the `foot' of the current chunk is actually represented - as the prev_size of the NEXT chunk. This makes it easier to - deal with alignments etc but can be very confusing when trying - to extend or adapt this code. - - The two exceptions to all this are - - 1. The special chunk `top' doesn't bother using the - trailing size field since there is no next contiguous chunk - that would have to index off it. After initialization, `top' - is forced to always exist. If it would become less than - MINSIZE bytes long, it is replenished. - - 2. Chunks allocated via mmap, which have the second-lowest-order - bit (IS_MMAPPED) set in their size fields. Because they are - allocated one-by-one, each must contain its own trailing size field. - -*/ - -/* - ---------- Size and alignment checks and conversions ---------- -*/ - -/* conversion from malloc headers to user pointers, and back */ - -#ifndef SHMEM_ALLOC -#define chunk2mem(p) ((Void_t*)((char*)(p) + 2*SIZE_SZ)) -#define mem2chunk(mem) ((mchunkptr)((char*)(mem) - 2*SIZE_SZ)) -#else -#define SHMEM_ALLOC_INSERT_SEGMENT_ADDRESS(p) \ -{ \ - char* sp; \ - sp = (char*)p + (2*sizeof(INTERNAL_SIZE_T)); \ - *(void**)sp=(void*)shm_segbasemap_find((void*)p); \ -} - -#define chunk2mem(p) ((Void_t*)((char*)(p) + 4*SIZE_SZ)) -#define mem2chunk(mem) ((mchunkptr)((char*)(mem) - 4*SIZE_SZ)) -#endif - -/* The smallest possible chunk */ -#ifndef SHMEM_ALLOC -#define MIN_CHUNK_SIZE (sizeof(struct malloc_chunk)) -#else -#define MIN_CHUNK_SIZE (sizeof(struct malloc_chunk)+(2*SIZE_SZ)) -#endif - -/* The smallest size we can malloc is an aligned minimal chunk */ - -#define MINSIZE \ - (unsigned long)(((MIN_CHUNK_SIZE+MALLOC_ALIGN_MASK) & ~MALLOC_ALIGN_MASK)) - -/* Check if m has acceptable alignment */ - -#define aligned_OK(m) (((unsigned long)((m)) & (MALLOC_ALIGN_MASK)) == 0) - - -/* - Check if a request is so large that it would wrap around zero when - padded and aligned. To simplify some other code, the bound is made - low enough so that adding MINSIZE will also not wrap around sero. -*/ - -#define REQUEST_OUT_OF_RANGE(req) \ - ((unsigned long)(req) >= \ - (unsigned long)(INTERNAL_SIZE_T)(-2 * MINSIZE)) - -/* pad request bytes into a usable size -- internal version */ - -#ifndef SHMEM_ALLOC -#define request2size(req) \ - (((req) + SIZE_SZ + MALLOC_ALIGN_MASK < MINSIZE) ? \ - MINSIZE : \ - ((req) + SIZE_SZ + MALLOC_ALIGN_MASK) & ~MALLOC_ALIGN_MASK) -#else -#define request2size(req) \ - (((req) + (3*SIZE_SZ) + MALLOC_ALIGN_MASK < MINSIZE) ? \ - MINSIZE : \ - ((req) + (3*SIZE_SZ) + MALLOC_ALIGN_MASK) & ~MALLOC_ALIGN_MASK) -#endif - -/* Same, except also perform argument check */ - -#define checked_request2size(req, sz) \ - if (REQUEST_OUT_OF_RANGE(req)) { \ - MALLOC_FAILURE_ACTION; \ - return 0; \ - } \ - (sz) = request2size(req); - -/* - --------------- Physical chunk operations --------------- -*/ - - -/* size field is or'ed with PREV_INUSE when previous adjacent chunk in use */ -#define PREV_INUSE 0x1 - -/* extract inuse bit of previous chunk */ -#define prev_inuse(p) ((p)->size & PREV_INUSE) - - -/* size field is or'ed with IS_MMAPPED if the chunk was obtained with mmap() */ -#define IS_MMAPPED 0x2 - -/* check for mmap()'ed chunk */ -#define chunk_is_mmapped(p) ((p)->size & IS_MMAPPED) - -/* - Bits to mask off when extracting size - - Note: IS_MMAPPED is intentionally not masked off from size field in - macros for which mmapped chunks should never be seen. This should - cause helpful core dumps to occur if it is tried by accident by - people extending or adapting this malloc. -*/ -#define SIZE_BITS (PREV_INUSE|IS_MMAPPED) - -/* Get size, ignoring use bits */ -#define chunksize(p) ((p)->size & ~(SIZE_BITS)) - - -/* Ptr to next physical malloc_chunk. */ -#define next_chunk(p) ((mchunkptr)( ((char*)(p)) + ((p)->size & ~PREV_INUSE) )) - -/* Ptr to previous physical malloc_chunk */ -#define prev_chunk(p) ((mchunkptr)( ((char*)(p)) - ((p)->prev_size) )) - -/* Treat space at ptr + offset as a chunk */ -#define chunk_at_offset(p, s) ((mchunkptr)(((char*)(p)) + (s))) - -/* extract p's inuse bit */ -#define inuse(p)\ -((((mchunkptr)(((char*)(p))+((p)->size & ~PREV_INUSE)))->size) & PREV_INUSE) - -/* set/clear chunk as being inuse without otherwise disturbing */ -#define set_inuse(p)\ -((mchunkptr)(((char*)(p)) + ((p)->size & ~PREV_INUSE)))->size |= PREV_INUSE - -#define clear_inuse(p)\ -((mchunkptr)(((char*)(p)) + ((p)->size & ~PREV_INUSE)))->size &= ~(PREV_INUSE) - - -/* check/set/clear inuse bits in known places */ -#define inuse_bit_at_offset(p, s)\ - (((mchunkptr)(((char*)(p)) + (s)))->size & PREV_INUSE) - -#define set_inuse_bit_at_offset(p, s)\ - (((mchunkptr)(((char*)(p)) + (s)))->size |= PREV_INUSE) - -#define clear_inuse_bit_at_offset(p, s)\ - (((mchunkptr)(((char*)(p)) + (s)))->size &= ~(PREV_INUSE)) - - -/* Set size at head, without disturbing its use bit */ -#define set_head_size(p, s) ((p)->size = (((p)->size & PREV_INUSE) | (s))) - -/* Set size/use field */ -#define set_head(p, s) ((p)->size = (s)) - -/* Set size at footer (only when chunk is not in use) */ -#define set_foot(p, s) (((mchunkptr)((char*)(p) + (s)))->prev_size = (s)) - - -/* - -------------------- Internal data structures -------------------- - - All internal state is held in an instance of malloc_state defined - below. There are no other static variables, except in two optional - cases: - * If USE_MALLOC_LOCK is defined, the mALLOC_MUTEx declared above. - * If HAVE_MMAP is true, but mmap doesn't support - MAP_ANONYMOUS, a dummy file descriptor for mmap. - - Beware of lots of tricks that minimize the total bookkeeping space - requirements. The result is a little over 1K bytes (for 4byte - pointers and size_t.) -*/ - -/* - Bins - - An array of bin headers for free chunks. Each bin is doubly - linked. The bins are approximately proportionally (log) spaced. - There are a lot of these bins (128). This may look excessive, but - works very well in practice. Most bins hold sizes that are - unusual as malloc request sizes, but are more usual for fragments - and consolidated sets of chunks, which is what these bins hold, so - they can be found quickly. All procedures maintain the invariant - that no consolidated chunk physically borders another one, so each - chunk in a list is known to be preceeded and followed by either - inuse chunks or the ends of memory. - - Chunks in bins are kept in size order, with ties going to the - approximately least recently used chunk. Ordering isn't needed - for the small bins, which all contain the same-sized chunks, but - facilitates best-fit allocation for larger chunks. These lists - are just sequential. Keeping them in order almost never requires - enough traversal to warrant using fancier ordered data - structures. - - Chunks of the same size are linked with the most - recently freed at the front, and allocations are taken from the - back. This results in LRU (FIFO) allocation order, which tends - to give each chunk an equal opportunity to be consolidated with - adjacent freed chunks, resulting in larger free chunks and less - fragmentation. - - To simplify use in double-linked lists, each bin header acts - as a malloc_chunk. This avoids special-casing for headers. - But to conserve space and improve locality, we allocate - only the fd/bk pointers of bins, and then use repositioning tricks - to treat these as the fields of a malloc_chunk*. -*/ - -typedef struct malloc_chunk* mbinptr; - -/* addressing -- note that bin_at(0) does not exist */ -#define bin_at(m, i) ((mbinptr)((char*)&((m)->bins[(i)<<1]) - (SIZE_SZ<<1))) - -/* analog of ++bin */ -#define next_bin(b) ((mbinptr)((char*)(b) + (sizeof(mchunkptr)<<1))) - -/* Reminders about list directionality within bins */ -#define first(b) ((b)->fd) -#define last(b) ((b)->bk) - -/* Take a chunk off a bin list */ -#define unlink(P, BK, FD) { \ - FD = P->fd; \ - BK = P->bk; \ - FD->bk = BK; \ - BK->fd = FD; \ -} - -/* - Indexing - - Bins for sizes < 512 bytes contain chunks of all the same size, spaced - 8 bytes apart. Larger bins are approximately logarithmically spaced: - - 64 bins of size 8 - 32 bins of size 64 - 16 bins of size 512 - 8 bins of size 4096 - 4 bins of size 32768 - 2 bins of size 262144 - 1 bin of size what's left - - There is actually a little bit of slop in the numbers in bin_index - for the sake of speed. This makes no difference elsewhere. - - The bins top out around 1MB because we expect to service large - requests via mmap. -*/ - -#define NBINS 128 -#define NSMALLBINS 64 -#define SMALLBIN_WIDTH 8 -#define MIN_LARGE_SIZE 512 - -#define in_smallbin_range(sz) \ - ((unsigned long)(sz) < (unsigned long)MIN_LARGE_SIZE) - -#define smallbin_index(sz) (((unsigned)(sz)) >> 3) - -#define largebin_index(sz) \ -(((((unsigned long)(sz)) >> 6) <= 32)? 56 + (((unsigned long)(sz)) >> 6): \ - ((((unsigned long)(sz)) >> 9) <= 20)? 91 + (((unsigned long)(sz)) >> 9): \ - ((((unsigned long)(sz)) >> 12) <= 10)? 110 + (((unsigned long)(sz)) >> 12): \ - ((((unsigned long)(sz)) >> 15) <= 4)? 119 + (((unsigned long)(sz)) >> 15): \ - ((((unsigned long)(sz)) >> 18) <= 2)? 124 + (((unsigned long)(sz)) >> 18): \ - 126) - -#define bin_index(sz) \ - ((in_smallbin_range(sz)) ? smallbin_index(sz) : largebin_index(sz)) - - -/* - Unsorted chunks - - All remainders from chunk splits, as well as all returned chunks, - are first placed in the "unsorted" bin. They are then placed - in regular bins after malloc gives them ONE chance to be used before - binning. So, basically, the unsorted_chunks list acts as a queue, - with chunks being placed on it in free (and malloc_consolidate), - and taken off (to be either used or placed in bins) in malloc. -*/ - -/* The otherwise unindexable 1-bin is used to hold unsorted chunks. */ -#define unsorted_chunks(M) (bin_at(M, 1)) - -/* - Top - - The top-most available chunk (i.e., the one bordering the end of - available memory) is treated specially. It is never included in - any bin, is used only if no other chunk is available, and is - released back to the system if it is very large (see - M_TRIM_THRESHOLD). Because top initially - points to its own bin with initial zero size, thus forcing - extension on the first malloc request, we avoid having any special - code in malloc to check whether it even exists yet. But we still - need to do so when getting memory from system, so we make - initial_top treat the bin as a legal but unusable chunk during the - interval between initialization and the first call to - sYSMALLOc. (This is somewhat delicate, since it relies on - the 2 preceding words to be zero during this interval as well.) -*/ - -/* Conveniently, the unsorted bin can be used as dummy top on first call */ -#define initial_top(M) (unsorted_chunks(M)) - -/* - Binmap - - To help compensate for the large number of bins, a one-level index - structure is used for bin-by-bin searching. `binmap' is a - bitvector recording whether bins are definitely empty so they can - be skipped over during during traversals. The bits are NOT always - cleared as soon as bins are empty, but instead only - when they are noticed to be empty during traversal in malloc. -*/ - -/* Conservatively use 32 bits per map word, even if on 64bit system */ -#define BINMAPSHIFT 5 -#define BITSPERMAP (1U << BINMAPSHIFT) -#define BINMAPSIZE (NBINS / BITSPERMAP) - -#define idx2block(i) ((i) >> BINMAPSHIFT) -#define idx2bit(i) ((1U << ((i) & ((1U << BINMAPSHIFT)-1)))) - -#define mark_bin(m,i) ((m)->binmap[idx2block(i)] |= idx2bit(i)) -#define unmark_bin(m,i) ((m)->binmap[idx2block(i)] &= ~(idx2bit(i))) -#define get_binmap(m,i) ((m)->binmap[idx2block(i)] & idx2bit(i)) - -/* - Fastbins - - An array of lists holding recently freed small chunks. Fastbins - are not doubly linked. It is faster to single-link them, and - since chunks are never removed from the middles of these lists, - double linking is not necessary. Also, unlike regular bins, they - are not even processed in FIFO order (they use faster LIFO) since - ordering doesn't much matter in the transient contexts in which - fastbins are normally used. - - Chunks in fastbins keep their inuse bit set, so they cannot - be consolidated with other free chunks. malloc_consolidate - releases all chunks in fastbins and consolidates them with - other free chunks. -*/ - -typedef struct malloc_chunk* mfastbinptr; - -/* offset 2 to use otherwise unindexable first 2 bins */ -#define fastbin_index(sz) ((int)(((unsigned int)(sz)) >> 3) - 2) - -/* The maximum fastbin request size we support */ -#define MAX_FAST_SIZE 80 - -#define NFASTBINS (fastbin_index(request2size(MAX_FAST_SIZE))+1) - -/* - FASTBIN_CONSOLIDATION_THRESHOLD is the size of a chunk in free() - that triggers automatic consolidation of possibly-surrounding - fastbin chunks. This is a heuristic, so the exact value should not - matter too much. It is defined at half the default trim threshold as a - compromise heuristic to only attempt consolidation if it is likely - to lead to trimming. However, it is not dynamically tunable, since - consolidation reduces fragmentation surrounding loarge chunks even - if trimming is not used. -*/ - -#define FASTBIN_CONSOLIDATION_THRESHOLD (65536UL) - -/* - Since the lowest 2 bits in max_fast don't matter in size comparisons, - they are used as flags. -*/ - -/* - FASTCHUNKS_BIT held in max_fast indicates that there are probably - some fastbin chunks. It is set true on entering a chunk into any - fastbin, and cleared only in malloc_consolidate. - - The truth value is inverted so that have_fastchunks will be true - upon startup (since statics are zero-filled), simplifying - initialization checks. -*/ - -#define FASTCHUNKS_BIT (1U) - -#define have_fastchunks(M) (((M)->max_fast & FASTCHUNKS_BIT) == 0) -#define clear_fastchunks(M) ((M)->max_fast |= FASTCHUNKS_BIT) -#define set_fastchunks(M) ((M)->max_fast &= ~FASTCHUNKS_BIT) - -/* - NONCONTIGUOUS_BIT indicates that MORECORE does not return contiguous - regions. Otherwise, contiguity is exploited in merging together, - when possible, results from consecutive MORECORE calls. - - The initial value comes from MORECORE_CONTIGUOUS, but is - changed dynamically if mmap is ever used as an sbrk substitute. -*/ - -#define NONCONTIGUOUS_BIT (2U) - -#define contiguous(M) (((M)->max_fast & NONCONTIGUOUS_BIT) == 0) -#define noncontiguous(M) (((M)->max_fast & NONCONTIGUOUS_BIT) != 0) -#define set_noncontiguous(M) ((M)->max_fast |= NONCONTIGUOUS_BIT) -#define set_contiguous(M) ((M)->max_fast &= ~NONCONTIGUOUS_BIT) - -/* - Set value of max_fast. - Use impossibly small value if 0. - Precondition: there are no existing fastbin chunks. - Setting the value clears fastchunk bit but preserves noncontiguous bit. -*/ - -#define set_max_fast(M, s) \ - (M)->max_fast = (((s) == 0)? SMALLBIN_WIDTH: request2size(s)) | \ - FASTCHUNKS_BIT | \ - ((M)->max_fast & NONCONTIGUOUS_BIT) - - -/* - ----------- Internal state representation and initialization ----------- -*/ - -struct malloc_state { - - /* The maximum chunk size to be eligible for fastbin */ - INTERNAL_SIZE_T max_fast; /* low 2 bits used as flags */ - - /* Fastbins */ - mfastbinptr fastbins[NFASTBINS]; - - /* Base of the topmost chunk -- not otherwise kept in a bin */ - mchunkptr top; - - /* The remainder from the most recent split of a small request */ - mchunkptr last_remainder; - - /* Normal bins packed as described above */ - mchunkptr bins[NBINS * 2]; - - /* Bitmap of bins */ - unsigned int binmap[BINMAPSIZE]; - - /* Tunable parameters */ - unsigned long trim_threshold; - INTERNAL_SIZE_T top_pad; - INTERNAL_SIZE_T mmap_threshold; - - /* Memory map support */ - int n_mmaps; - int n_mmaps_max; - int max_n_mmaps; - - /* Cache malloc_getpagesize */ - unsigned int pagesize; - - /* Statistics */ - INTERNAL_SIZE_T mmapped_mem; - INTERNAL_SIZE_T sbrked_mem; - INTERNAL_SIZE_T max_sbrked_mem; - INTERNAL_SIZE_T max_mmapped_mem; - INTERNAL_SIZE_T max_total_mem; -}; - -typedef struct malloc_state *mstate_shm; - -/* - There is exactly one instance of this struct in this malloc. - If you are adapting this malloc in a way that does NOT use a static - malloc_state, you MUST explicitly zero-fill it before using. This - malloc relies on the property that malloc_state is initialized to - all zeroes (as is true of C statics). -*/ - -static struct malloc_state av_; /* never directly referenced */ - -/* - All uses of av_ are via get_malloc_state(). - At most one "call" to get_malloc_state is made per invocation of - the public versions of malloc and free, but other routines - that in turn invoke malloc and/or free may call more then once. - Also, it is called in check* routines if DEBUG is set. -*/ - -#define get_malloc_state() (&(av_)) - -/* - Initialize a malloc_state struct. - - This is called only from within malloc_consolidate, which needs - be called in the same contexts anyway. It is never called directly - outside of malloc_consolidate because some optimizing compilers try - to inline it at all call points, which turns out not to be an - optimization at all. (Inlining it in malloc_consolidate is fine though.) -*/ - -#if __STD_C -static void malloc_init_state(mstate_shm av) -#else -static void malloc_init_state(av) mstate_shm av; -#endif -{ - int i; - mbinptr bin; - - /* Establish circular links for normal bins */ - for (i = 1; i < NBINS; ++i) { - bin = bin_at(av,i); - bin->fd = bin->bk = bin; - } - - av->top_pad = DEFAULT_TOP_PAD; - av->n_mmaps_max = DEFAULT_MMAP_MAX; - av->mmap_threshold = DEFAULT_MMAP_THRESHOLD; - av->trim_threshold = DEFAULT_TRIM_THRESHOLD; - -#if !MORECORE_CONTIGUOUS - set_noncontiguous(av); -#endif - - set_max_fast(av, DEFAULT_MXFAST); - - av->top = initial_top(av); - av->pagesize = malloc_getpagesize; -} - -/* - Other internal utilities operating on mstates -*/ - -#if __STD_C -static Void_t* sYSMALLOc(INTERNAL_SIZE_T, mstate_shm); -#ifndef MORECORE_CANNOT_TRIM -static int sYSTRIm(size_t, mstate_shm); -#endif -static void malloc_consolidate(mstate_shm); -static Void_t** iALLOc(size_t, size_t*, int, Void_t**); -#else -static Void_t* sYSMALLOc(); -#ifndef MORECORE_CANNOT_TRIM -static int sYSTRIm(); -#endif -static void malloc_consolidate(); -static Void_t** iALLOc(); -#endif - -/* - Debugging support - - These routines make a number of assertions about the states - of data structures that should be true at all times. If any - are not true, it's very likely that a user program has somehow - trashed memory. (It's also possible that there is a coding error - in malloc. In which case, please report it!) -*/ - -#if ! DEBUG - -#define check_chunk(P) -#define check_free_chunk(P) -#define check_inuse_chunk(P) -#define check_remalloced_chunk(P,N) -#define check_malloced_chunk(P,N) -#define check_malloc_state() - -#else -#define check_chunk(P) do_check_chunk(P) -#define check_free_chunk(P) do_check_free_chunk(P) -#define check_inuse_chunk(P) do_check_inuse_chunk(P) -#define check_remalloced_chunk(P,N) do_check_remalloced_chunk(P,N) -#define check_malloced_chunk(P,N) do_check_malloced_chunk(P,N) -#define check_malloc_state() do_check_malloc_state() - -/* - Properties of all chunks -*/ - -#if __STD_C -static void do_check_chunk(mchunkptr p) -#else -static void do_check_chunk(p) mchunkptr p; -#endif -{ - mstate_shm av = get_malloc_state(); - unsigned long sz = chunksize(p); - /* min and max possible addresses assuming contiguous allocation */ - char* max_address = (char*)(av->top) + chunksize(av->top); - char* min_address = max_address - av->sbrked_mem; - - if (!chunk_is_mmapped(p)) { - - /* Has legal address ... */ - if (p != av->top) { - if (contiguous(av)) { - assert(((char*)p) >= min_address); - assert(((char*)p + sz) <= ((char*)(av->top))); - } - } - else { - /* top size is always at least MINSIZE */ - assert((unsigned long)(sz) >= MINSIZE); - /* top predecessor always marked inuse */ - assert(prev_inuse(p)); - } - - } - else { -#if HAVE_MMAP - /* address is outside main heap */ - if (contiguous(av) && av->top != initial_top(av)) { - assert(((char*)p) < min_address || ((char*)p) > max_address); - } - /* chunk is page-aligned */ - assert(((p->prev_size + sz) & (av->pagesize-1)) == 0); - /* mem is aligned */ - assert(aligned_OK(chunk2mem(p))); -#else - /* force an appropriate assert violation if debug set */ - assert(!chunk_is_mmapped(p)); -#endif - } -} - -/* - Properties of free chunks -*/ - -#if __STD_C -static void do_check_free_chunk(mchunkptr p) -#else -static void do_check_free_chunk(p) mchunkptr p; -#endif -{ - mstate_shm av = get_malloc_state(); - - INTERNAL_SIZE_T sz = p->size & ~PREV_INUSE; - mchunkptr next = chunk_at_offset(p, sz); - - do_check_chunk(p); - - /* Chunk must claim to be free ... */ - assert(!inuse(p)); - assert (!chunk_is_mmapped(p)); - - /* Unless a special marker, must have OK fields */ - if ((unsigned long)(sz) >= MINSIZE) - { - assert((sz & MALLOC_ALIGN_MASK) == 0); - assert(aligned_OK(chunk2mem(p))); - /* ... matching footer field */ - assert(next->prev_size == sz); - /* ... and is fully consolidated */ - assert(prev_inuse(p)); - assert (next == av->top || inuse(next)); - - /* ... and has minimally sane links */ - assert(p->fd->bk == p); - assert(p->bk->fd == p); - } - else /* markers are always of size SIZE_SZ */ - assert(sz == SIZE_SZ); -} - -/* - Properties of inuse chunks -*/ - -#if __STD_C -static void do_check_inuse_chunk(mchunkptr p) -#else -static void do_check_inuse_chunk(p) mchunkptr p; -#endif -{ - mstate_shm av = get_malloc_state(); - mchunkptr next; - do_check_chunk(p); - - if (chunk_is_mmapped(p)) - return; /* mmapped chunks have no next/prev */ - - /* Check whether it claims to be in use ... */ - assert(inuse(p)); - - next = next_chunk(p); - - /* ... and is surrounded by OK chunks. - Since more things can be checked with free chunks than inuse ones, - if an inuse chunk borders them and debug is on, it's worth doing them. - */ - if (!prev_inuse(p)) { - /* Note that we cannot even look at prev unless it is not inuse */ - mchunkptr prv = prev_chunk(p); - assert(next_chunk(prv) == p); - do_check_free_chunk(prv); - } - - if (next == av->top) { - assert(prev_inuse(next)); - assert(chunksize(next) >= MINSIZE); - } - else if (!inuse(next)) - do_check_free_chunk(next); -} - -/* - Properties of chunks recycled from fastbins -*/ - -#if __STD_C -static void do_check_remalloced_chunk(mchunkptr p, INTERNAL_SIZE_T s) -#else -static void do_check_remalloced_chunk(p, s) mchunkptr p; INTERNAL_SIZE_T s; -#endif -{ - INTERNAL_SIZE_T sz = p->size & ~PREV_INUSE; - - do_check_inuse_chunk(p); - - /* Legal size ... */ - assert((sz & MALLOC_ALIGN_MASK) == 0); - assert((unsigned long)(sz) >= MINSIZE); - /* ... and alignment */ - assert(aligned_OK(chunk2mem(p))); - /* chunk is less than MINSIZE more than request */ - assert((long)(sz) - (long)(s) >= 0); - assert((long)(sz) - (long)(s + MINSIZE) < 0); -} - -/* - Properties of nonrecycled chunks at the point they are malloced -*/ - -#if __STD_C -static void do_check_malloced_chunk(mchunkptr p, INTERNAL_SIZE_T s) -#else -static void do_check_malloced_chunk(p, s) mchunkptr p; INTERNAL_SIZE_T s; -#endif -{ - /* same as recycled case ... */ - do_check_remalloced_chunk(p, s); - - /* - ... plus, must obey implementation invariant that prev_inuse is - always true of any allocated chunk; i.e., that each allocated - chunk borders either a previously allocated and still in-use - chunk, or the base of its memory arena. This is ensured - by making all allocations from the the `lowest' part of any found - chunk. This does not necessarily hold however for chunks - recycled via fastbins. - */ - - assert(prev_inuse(p)); -} - - -/* - Properties of malloc_state. - - This may be useful for debugging malloc, as well as detecting user - programmer errors that somehow write into malloc_state. - - If you are extending or experimenting with this malloc, you can - probably figure out how to hack this routine to print out or - display chunk addresses, sizes, bins, and other instrumentation. -*/ - -static void do_check_malloc_state() -{ - mstate_shm av = get_malloc_state(); - int i; - mchunkptr p; - mchunkptr q; - mbinptr b; - unsigned int binbit; - int empty; - unsigned int idx; - INTERNAL_SIZE_T size; - unsigned long total = 0; - int max_fast_bin; - - /* internal size_t must be no wider than pointer type */ - assert(sizeof(INTERNAL_SIZE_T) <= sizeof(char*)); - - /* alignment is a power of 2 */ - assert((MALLOC_ALIGNMENT & (MALLOC_ALIGNMENT-1)) == 0); - - /* cannot run remaining checks until fully initialized */ - if (av->top == 0 || av->top == initial_top(av)) - return; - - /* pagesize is a power of 2 */ - assert((av->pagesize & (av->pagesize-1)) == 0); - - /* properties of fastbins */ - - /* max_fast is in allowed range */ - assert((av->max_fast & ~1) <= request2size(MAX_FAST_SIZE)); - - max_fast_bin = fastbin_index(av->max_fast); - - for (i = 0; i < NFASTBINS; ++i) { - p = av->fastbins[i]; - - /* all bins past max_fast are empty */ - if (i > max_fast_bin) - assert(p == 0); - - while (p != 0) { - /* each chunk claims to be inuse */ - do_check_inuse_chunk(p); - total += chunksize(p); - /* chunk belongs in this bin */ - assert(fastbin_index(chunksize(p)) == i); - p = p->fd; - } - } - - if (total != 0) - assert(have_fastchunks(av)); - else if (!have_fastchunks(av)) - assert(total == 0); - - /* check normal bins */ - for (i = 1; i < NBINS; ++i) { - b = bin_at(av,i); - - /* binmap is accurate (except for bin 1 == unsorted_chunks) */ - if (i >= 2) { - binbit = get_binmap(av,i); - empty = last(b) == b; - if (!binbit) - assert(empty); - else if (!empty) - assert(binbit); - } - - for (p = last(b); p != b; p = p->bk) { - /* each chunk claims to be free */ - do_check_free_chunk(p); - size = chunksize(p); - total += size; - if (i >= 2) { - /* chunk belongs in bin */ - idx = bin_index(size); - assert(idx == i); - /* lists are sorted */ - assert(p->bk == b || - (unsigned long)chunksize(p->bk) >= (unsigned long)chunksize(p)); - } - /* chunk is followed by a legal chain of inuse chunks */ - for (q = next_chunk(p); - (q != av->top && inuse(q) && - (unsigned long)(chunksize(q)) >= MINSIZE); - q = next_chunk(q)) - do_check_inuse_chunk(q); - } - } - - /* top chunk is OK */ - check_chunk(av->top); - - /* sanity checks for statistics */ - - assert(total <= (unsigned long)(av->max_total_mem)); - assert(av->n_mmaps >= 0); - assert(av->n_mmaps <= av->n_mmaps_max); - assert(av->n_mmaps <= av->max_n_mmaps); - - assert((unsigned long)(av->sbrked_mem) <= - (unsigned long)(av->max_sbrked_mem)); - - assert((unsigned long)(av->mmapped_mem) <= - (unsigned long)(av->max_mmapped_mem)); - - assert((unsigned long)(av->max_total_mem) >= - (unsigned long)(av->mmapped_mem) + (unsigned long)(av->sbrked_mem)); -} -#endif - - -/* ----------- Routines dealing with system allocation -------------- */ - -/* - sysmalloc handles malloc cases requiring more memory from the system. - On entry, it is assumed that av->top does not have enough - space to service request for nb bytes, thus requiring that av->top - be extended or replaced. -*/ - -#if __STD_C -static Void_t* sYSMALLOc(INTERNAL_SIZE_T nb, mstate_shm av) -#else -static Void_t* sYSMALLOc(nb, av) INTERNAL_SIZE_T nb; mstate_shm av; -#endif -{ - mchunkptr old_top; /* incoming value of av->top */ - INTERNAL_SIZE_T old_size; /* its size */ - char* old_end; /* its end address */ - - long size; /* arg to first MORECORE or mmap call */ - char* brk; /* return value from MORECORE */ - - long correction; /* arg to 2nd MORECORE call */ - char* snd_brk; /* 2nd return val */ - - INTERNAL_SIZE_T front_misalign; /* unusable bytes at front of new space */ - INTERNAL_SIZE_T end_misalign; /* partial page left at end of new space */ - char* aligned_brk; /* aligned offset into brk */ - - mchunkptr p; /* the allocated/returned chunk */ - mchunkptr remainder; /* remainder from allocation */ - unsigned long remainder_size; /* its size */ - - unsigned long sum; /* for updating stats */ - - size_t pagemask = av->pagesize - 1; - -#if HAVE_MMAP - - /* - If have mmap, and the request size meets the mmap threshold, and - the system supports mmap, and there are few enough currently - allocated mmapped regions, try to directly map this request - rather than expanding top. - */ - - if ((unsigned long)(nb) >= (unsigned long)(av->mmap_threshold) && - (av->n_mmaps < av->n_mmaps_max)) { - - char* mm; /* return value from mmap call*/ - - /* - Round up size to nearest page. For mmapped chunks, the overhead - is one SIZE_SZ unit larger than for normal chunks, because there - is no following chunk whose prev_size field could be used. - */ - size = (nb + SIZE_SZ + MALLOC_ALIGN_MASK + pagemask) & ~pagemask; - - /* Don't try if size wraps around 0 */ - if ((unsigned long)(size) > (unsigned long)(nb)) { - - mm = (char*)(MMAP(0, size, PROT_READ|PROT_WRITE, MAP_PRIVATE)); - - if (mm != (char*)(MORECORE_FAILURE)) { - - /* - The offset to the start of the mmapped region is stored - in the prev_size field of the chunk. This allows us to adjust - returned start address to meet alignment requirements here - and in memalign(), and still be able to compute proper - address argument for later munmap in free() and realloc(). - */ - - front_misalign = (INTERNAL_SIZE_T)chunk2mem(mm) & MALLOC_ALIGN_MASK; - if (front_misalign > 0) { - correction = MALLOC_ALIGNMENT - front_misalign; - p = (mchunkptr)(mm + correction); - p->prev_size = correction; - set_head(p, (size - correction) |IS_MMAPPED); - } - else { - p = (mchunkptr)mm; - set_head(p, size|IS_MMAPPED); - } - - /* update statistics */ - - if (++av->n_mmaps > av->max_n_mmaps) - av->max_n_mmaps = av->n_mmaps; - - sum = av->mmapped_mem += size; - if (sum > (unsigned long)(av->max_mmapped_mem)) - av->max_mmapped_mem = sum; - sum += av->sbrked_mem; - if (sum > (unsigned long)(av->max_total_mem)) - av->max_total_mem = sum; - - check_chunk(p); - - return chunk2mem(p); - } - } - } -#endif - - /* Record incoming configuration of top */ - - old_top = av->top; - old_size = chunksize(old_top); - old_end = (char*)(chunk_at_offset(old_top, old_size)); - - brk = snd_brk = (char*)(MORECORE_FAILURE); - - /* - If not the first time through, we require old_size to be - at least MINSIZE and to have prev_inuse set. - */ - - assert((old_top == initial_top(av) && old_size == 0) || - ((unsigned long) (old_size) >= MINSIZE && - prev_inuse(old_top))); - - /* Precondition: not enough current space to satisfy nb request */ - assert((unsigned long)(old_size) < (unsigned long)(nb + MINSIZE)); - - /* Precondition: all fastbins are consolidated */ - assert(!have_fastchunks(av)); - - - /* Request enough space for nb + pad + overhead */ - - size = nb + av->top_pad + MINSIZE; - - /* - If contiguous, we can subtract out existing space that we hope to - combine with new space. We add it back later only if - we don't actually get contiguous space. - */ - - if (contiguous(av)) - size -= old_size; - - /* - Round to a multiple of page size. - If MORECORE is not contiguous, this ensures that we only call it - with whole-page arguments. And if MORECORE is contiguous and - this is not first time through, this preserves page-alignment of - previous calls. Otherwise, we correct to page-align below. - */ - - size = (size + pagemask) & ~pagemask; - size *= 4; - - /* - Don't try to call MORECORE if argument is so big as to appear - negative. Note that since mmap takes size_t arg, it may succeed - below even if we cannot call MORECORE. - */ - - if (size > 0) - { - brk = (char*)(MORECORE(size)); - } - - /* - If have mmap, try using it as a backup when MORECORE fails or - cannot be used. This is worth doing on systems that have "holes" in - address space, so sbrk cannot extend to give contiguous space, but - space is available elsewhere. Note that we ignore mmap max count - and threshold limits, since the space will not be used as a - segregated mmap region. - */ - -#if HAVE_MMAP - if (brk == (char*)(MORECORE_FAILURE)) { - - /* Cannot merge with old top, so add its size back in */ - if (contiguous(av)) - size = (size + old_size + pagemask) & ~pagemask; - - /* If we are relying on mmap as backup, then use larger units */ - if ((unsigned long)(size) < (unsigned long)(MMAP_AS_MORECORE_SIZE)) - size = MMAP_AS_MORECORE_SIZE; - - /* Don't try if size wraps around 0 */ - if ((unsigned long)(size) > (unsigned long)(nb)) { - - brk = (char*)(MMAP(0, size, PROT_READ|PROT_WRITE, MAP_PRIVATE)); - - if (brk != (char*)(MORECORE_FAILURE)) { - - /* We do not need, and cannot use, another sbrk call to find end */ - snd_brk = brk + size; - - /* - Record that we no longer have a contiguous sbrk region. - After the first time mmap is used as backup, we do not - ever rely on contiguous space since this could incorrectly - bridge regions. - */ - set_noncontiguous(av); - } - } - } -#endif - - if (brk != (char*)(MORECORE_FAILURE)) { - av->sbrked_mem += size; - - /* - If MORECORE extends previous space, we can likewise extend top size. - */ - - if (brk == old_end && snd_brk == (char*)(MORECORE_FAILURE)) { - set_head(old_top, (size + old_size) | PREV_INUSE); - } - - /* - Otherwise, make adjustments: - - * If the first time through or noncontiguous, we need to call sbrk - just to find out where the end of memory lies. - - * We need to ensure that all returned chunks from malloc will meet - MALLOC_ALIGNMENT - - * If there was an intervening foreign sbrk, we need to adjust sbrk - request size to account for fact that we will not be able to - combine new space with existing space in old_top. - - * Almost all systems internally allocate whole pages at a time, in - which case we might as well use the whole last page of request. - So we allocate enough more memory to hit a page boundary now, - which in turn causes future contiguous calls to page-align. - */ - - else { - front_misalign = 0; - end_misalign = 0; - correction = 0; - aligned_brk = brk; - - /* handle contiguous cases */ - if (contiguous(av)) { - - /* Guarantee alignment of first new chunk made from this space */ - - front_misalign = (INTERNAL_SIZE_T)chunk2mem(brk) & MALLOC_ALIGN_MASK; - if (front_misalign > 0) { - - /* - Skip over some bytes to arrive at an aligned position. - We don't need to specially mark these wasted front bytes. - They will never be accessed anyway because - prev_inuse of av->top (and any chunk created from its start) - is always true after initialization. - */ - - correction = MALLOC_ALIGNMENT - front_misalign; - aligned_brk += correction; - } - - /* - If this isn't adjacent to existing space, then we will not - be able to merge with old_top space, so must add to 2nd request. - */ - - correction += old_size; - - /* Extend the end address to hit a page boundary */ - end_misalign = (INTERNAL_SIZE_T)(brk + size + correction); - correction += ((end_misalign + pagemask) & ~pagemask) - end_misalign; - - assert(correction >= 0); - - snd_brk = (char*)(MORECORE(correction)); - - /* - If can't allocate correction, try to at least find out current - brk. It might be enough to proceed without failing. - - Note that if second sbrk did NOT fail, we assume that space - is contiguous with first sbrk. This is a safe assumption unless - program is multithreaded but doesn't use locks and a foreign sbrk - occurred between our first and second calls. - */ - - if (snd_brk == (char*)(MORECORE_FAILURE)) { - correction = 0; - snd_brk = (char*)(MORECORE(0)); - } - } - - /* handle non-contiguous cases */ - else { - /* MORECORE/mmap must correctly align */ - assert(((unsigned long)chunk2mem(brk) & MALLOC_ALIGN_MASK) == 0); - - /* Find out current end of memory */ - if (snd_brk == (char*)(MORECORE_FAILURE)) { - snd_brk = (char*)(MORECORE(0)); - } - } - - /* Adjust top based on results of second sbrk */ - if (snd_brk != (char*)(MORECORE_FAILURE)) { - av->top = (mchunkptr)aligned_brk; - set_head(av->top, (snd_brk - aligned_brk + correction) | PREV_INUSE); - av->sbrked_mem += correction; - - /* - If not the first time through, we either have a - gap due to foreign sbrk or a non-contiguous region. Insert a - double fencepost at old_top to prevent consolidation with space - we don't own. These fenceposts are artificial chunks that are - marked as inuse and are in any case too small to use. We need - two to make sizes and alignments work out. - */ - - if (old_size != 0) { - /* - Shrink old_top to insert fenceposts, keeping size a - multiple of MALLOC_ALIGNMENT. We know there is at least - enough space in old_top to do this. - */ - old_size = (old_size - 3*SIZE_SZ) & ~MALLOC_ALIGN_MASK; - set_head(old_top, old_size | PREV_INUSE); - - /* - Note that the following assignments completely overwrite - old_top when old_size was previously MINSIZE. This is - intentional. We need the fencepost, even if old_top otherwise gets - lost. - */ - chunk_at_offset(old_top, old_size )->size = - SIZE_SZ|PREV_INUSE; - - chunk_at_offset(old_top, old_size + SIZE_SZ)->size = - SIZE_SZ|PREV_INUSE; - - /* If possible, release the rest. */ - if (old_size >= MINSIZE) { - fREe(chunk2mem(old_top)); - } - - } - } - } - - /* Update statistics */ - sum = av->sbrked_mem; - if (sum > (unsigned long)(av->max_sbrked_mem)) - av->max_sbrked_mem = sum; - - sum += av->mmapped_mem; - if (sum > (unsigned long)(av->max_total_mem)) - av->max_total_mem = sum; - - check_malloc_state(); - - /* finally, do the allocation */ - p = av->top; - size = chunksize(p); - - /* check that one of the above allocation paths succeeded */ - if ((unsigned long)(size) >= (unsigned long)(nb + MINSIZE)) { - remainder_size = size - nb; - remainder = chunk_at_offset(p, nb); - av->top = remainder; - set_head(p, nb | PREV_INUSE); - set_head(remainder, remainder_size | PREV_INUSE); - check_malloced_chunk(p, nb); -#ifdef SHMEM_ALLOC - SHMEM_ALLOC_INSERT_SEGMENT_ADDRESS(p); -#endif - return chunk2mem(p); - } - } - - /* catch all failure paths */ - MALLOC_FAILURE_ACTION; - return 0; -} - - -#ifndef MORECORE_CANNOT_TRIM -/* - sYSTRIm is an inverse of sorts to sYSMALLOc. It gives memory back - to the system (via negative arguments to sbrk) if there is unused - memory at the `high' end of the malloc pool. It is called - automatically by free() when top space exceeds the trim - threshold. It is also called by the public malloc_trim routine. It - returns 1 if it actually released any memory, else 0. -*/ - -#if __STD_C -static int sYSTRIm(size_t pad, mstate_shm av) -#else -static int sYSTRIm(pad, av) size_t pad; mstate_shm av; -#endif -{ - long top_size; /* Amount of top-most memory */ - long extra; /* Amount to release */ - long released; /* Amount actually released */ - char* current_brk; /* address returned by pre-check sbrk call */ - char* new_brk; /* address returned by post-check sbrk call */ - size_t pagesz; - - pagesz = av->pagesize; - top_size = chunksize(av->top); - - /* Release in pagesize units, keeping at least one page */ - extra = ((top_size - pad - MINSIZE + (pagesz-1)) / pagesz - 1) * pagesz; - - if (extra > 0) { - - /* - Only proceed if end of memory is where we last set it. - This avoids problems if there were foreign sbrk calls. - */ - current_brk = (char*)(MORECORE(0)); - if (current_brk == (char*)(av->top) + top_size) { - - /* - Attempt to release memory. We ignore MORECORE return value, - and instead call again to find out where new end of memory is. - This avoids problems if first call releases less than we asked, - of if failure somehow altered brk value. (We could still - encounter problems if it altered brk in some very bad way, - but the only thing we can do is adjust anyway, which will cause - some downstream failure.) - */ - - MORECORE(-extra); - new_brk = (char*)(MORECORE(0)); - - if (new_brk != (char*)MORECORE_FAILURE) { - released = (long)(current_brk - new_brk); - - if (released != 0) { - /* Success. Adjust top. */ - av->sbrked_mem -= released; - set_head(av->top, (top_size - released) | PREV_INUSE); - check_malloc_state(); - return 1; - } - } - } - } - return 0; -} -#endif - -/* - ------------------------------ malloc ------------------------------ -*/ - -#if __STD_C -Void_t* mALLOc(size_t bytes) -#else - Void_t* mALLOc(bytes) size_t bytes; -#endif -{ - mstate_shm av = get_malloc_state(); - - INTERNAL_SIZE_T nb; /* normalized request size */ - unsigned int idx; /* associated bin index */ - mbinptr bin; /* associated bin */ - mfastbinptr* fb; /* associated fastbin */ - - mchunkptr victim; /* inspected/selected chunk */ - INTERNAL_SIZE_T size; /* its size */ - int victim_index; /* its bin index */ - - mchunkptr remainder; /* remainder from a split */ - unsigned long remainder_size; /* its size */ - - unsigned int block; /* bit map traverser */ - unsigned int bit; /* bit map traverser */ - unsigned int map; /* current word of binmap */ - - mchunkptr fwd; /* misc temp for linking */ - mchunkptr bck; /* misc temp for linking */ - - /* - Convert request size to internal form by adding SIZE_SZ bytes - overhead plus possibly more to obtain necessary alignment and/or - to obtain a size of at least MINSIZE, the smallest allocatable - size. Also, checked_request2size traps (returning 0) request sizes - that are so large that they wrap around zero when padded and - aligned. - */ - - checked_request2size(bytes, nb); - - /* - If the size qualifies as a fastbin, first check corresponding bin. - This code is safe to execute even if av is not yet initialized, so we - can try it without checking, which saves some time on this fast path. - */ - - if ((unsigned long)(nb) <= (unsigned long)(av->max_fast)) { - fb = &(av->fastbins[(fastbin_index(nb))]); - if ( (victim = *fb) != 0) { - *fb = victim->fd; - check_remalloced_chunk(victim, nb); -#ifdef SHMEM_ALLOC - SHMEM_ALLOC_INSERT_SEGMENT_ADDRESS(victim); -#endif - return chunk2mem(victim); - } - } - - /* - If a small request, check regular bin. Since these "smallbins" - hold one size each, no searching within bins is necessary. - (For a large request, we need to wait until unsorted chunks are - processed to find best fit. But for small ones, fits are exact - anyway, so we can check now, which is faster.) - */ - - if (in_smallbin_range(nb)) { - idx = smallbin_index(nb); - bin = bin_at(av,idx); - - if ( (victim = last(bin)) != bin) { - if (victim == 0) /* initialization check */ - malloc_consolidate(av); - else { - bck = victim->bk; - set_inuse_bit_at_offset(victim, nb); - bin->bk = bck; - bck->fd = bin; - - check_malloced_chunk(victim, nb); -#ifdef SHMEM_ALLOC - SHMEM_ALLOC_INSERT_SEGMENT_ADDRESS(victim); -#endif - return chunk2mem(victim); - } - } - } - - /* - If this is a large request, consolidate fastbins before continuing. - While it might look excessive to kill all fastbins before - even seeing if there is space available, this avoids - fragmentation problems normally associated with fastbins. - Also, in practice, programs tend to have runs of either small or - large requests, but less often mixtures, so consolidation is not - invoked all that often in most programs. And the programs that - it is called frequently in otherwise tend to fragment. - */ - - else { - idx = largebin_index(nb); - if (have_fastchunks(av)) - malloc_consolidate(av); - } - - /* - Process recently freed or remaindered chunks, taking one only if - it is exact fit, or, if this a small request, the chunk is remainder from - the most recent non-exact fit. Place other traversed chunks in - bins. Note that this step is the only place in any routine where - chunks are placed in bins. - - The outer loop here is needed because we might not realize until - near the end of malloc that we should have consolidated, so must - do so and retry. This happens at most once, and only when we would - otherwise need to expand memory to service a "small" request. - */ - - for(;;) { - - while ( (victim = unsorted_chunks(av)->bk) != unsorted_chunks(av)) { - bck = victim->bk; - size = chunksize(victim); - - /* - If a small request, try to use last remainder if it is the - only chunk in unsorted bin. This helps promote locality for - runs of consecutive small requests. This is the only - exception to best-fit, and applies only when there is - no exact fit for a small chunk. - */ - - if (in_smallbin_range(nb) && - bck == unsorted_chunks(av) && - victim == av->last_remainder && - (unsigned long)(size) > (unsigned long)(nb + MINSIZE)) { - - /* split and reattach remainder */ - remainder_size = size - nb; - remainder = chunk_at_offset(victim, nb); - unsorted_chunks(av)->bk = unsorted_chunks(av)->fd = remainder; - av->last_remainder = remainder; - remainder->bk = remainder->fd = unsorted_chunks(av); - - set_head(victim, nb | PREV_INUSE); - set_head(remainder, remainder_size | PREV_INUSE); - set_foot(remainder, remainder_size); - - check_malloced_chunk(victim, nb); -#ifdef SHMEM_ALLOC - SHMEM_ALLOC_INSERT_SEGMENT_ADDRESS(victim); -#endif - return chunk2mem(victim); - } - - /* remove from unsorted list */ - unsorted_chunks(av)->bk = bck; - bck->fd = unsorted_chunks(av); - - /* Take now instead of binning if exact fit */ - - if (size == nb) { - set_inuse_bit_at_offset(victim, size); - check_malloced_chunk(victim, nb); -#ifdef SHMEM_ALLOC - SHMEM_ALLOC_INSERT_SEGMENT_ADDRESS(victim); -#endif - return chunk2mem(victim); - } - - /* place chunk in bin */ - - if (in_smallbin_range(size)) { - victim_index = smallbin_index(size); - bck = bin_at(av, victim_index); - fwd = bck->fd; - } - else { - victim_index = largebin_index(size); - bck = bin_at(av, victim_index); - fwd = bck->fd; - - /* maintain large bins in sorted order */ - if (fwd != bck) { - size |= PREV_INUSE; /* Or with inuse bit to speed comparisons */ - /* if smaller than smallest, bypass loop below */ - if ((unsigned long)(size) <= (unsigned long)(bck->bk->size)) { - fwd = bck; - bck = bck->bk; - } - else { - while ((unsigned long)(size) < (unsigned long)(fwd->size)) - fwd = fwd->fd; - bck = fwd->bk; - } - } - } - - mark_bin(av, victim_index); - victim->bk = bck; - victim->fd = fwd; - fwd->bk = victim; - bck->fd = victim; - } - - /* - If a large request, scan through the chunks of current bin in - sorted order to find smallest that fits. This is the only step - where an unbounded number of chunks might be scanned without doing - anything useful with them. However the lists tend to be short. - */ - - if (!in_smallbin_range(nb)) { - bin = bin_at(av, idx); - - /* skip scan if empty or largest chunk is too small */ - if ((victim = last(bin)) != bin && - (unsigned long)(first(bin)->size) >= (unsigned long)(nb)) { - - while (((unsigned long)(size = chunksize(victim)) < - (unsigned long)(nb))) - victim = victim->bk; - - remainder_size = size - nb; - unlink(victim, bck, fwd); - - /* Exhaust */ - if (remainder_size < MINSIZE) { - set_inuse_bit_at_offset(victim, size); - check_malloced_chunk(victim, nb); -#ifdef SHMEM_ALLOC - SHMEM_ALLOC_INSERT_SEGMENT_ADDRESS(victim); -#endif - return chunk2mem(victim); - } - /* Split */ - else { - remainder = chunk_at_offset(victim, nb); - unsorted_chunks(av)->bk = unsorted_chunks(av)->fd = remainder; - remainder->bk = remainder->fd = unsorted_chunks(av); - set_head(victim, nb | PREV_INUSE); - set_head(remainder, remainder_size | PREV_INUSE); - set_foot(remainder, remainder_size); - check_malloced_chunk(victim, nb); -#ifdef SHMEM_ALLOC - SHMEM_ALLOC_INSERT_SEGMENT_ADDRESS(victim); -#endif - return chunk2mem(victim); - } - } - } - - /* - Search for a chunk by scanning bins, starting with next largest - bin. This search is strictly by best-fit; i.e., the smallest - (with ties going to approximately the least recently used) chunk - that fits is selected. - - The bitmap avoids needing to check that most blocks are nonempty. - The particular case of skipping all bins during warm-up phases - when no chunks have been returned yet is faster than it might look. - */ - - ++idx; - bin = bin_at(av,idx); - block = idx2block(idx); - map = av->binmap[block]; - bit = idx2bit(idx); - - for (;;) { - - /* Skip rest of block if there are no more set bits in this block. */ - if (bit > map || bit == 0) { - do { - if (++block >= BINMAPSIZE) /* out of bins */ - goto use_top; - } while ( (map = av->binmap[block]) == 0); - - bin = bin_at(av, (block << BINMAPSHIFT)); - bit = 1; - } - - /* Advance to bin with set bit. There must be one. */ - while ((bit & map) == 0) { - bin = next_bin(bin); - bit <<= 1; - assert(bit != 0); - } - - /* Inspect the bin. It is likely to be non-empty */ - victim = last(bin); - - /* If a false alarm (empty bin), clear the bit. */ - if (victim == bin) { - av->binmap[block] = map &= ~bit; /* Write through */ - bin = next_bin(bin); - bit <<= 1; - } - - else { - size = chunksize(victim); - - /* We know the first chunk in this bin is big enough to use. */ - assert((unsigned long)(size) >= (unsigned long)(nb)); - - remainder_size = size - nb; - - /* unlink */ - bck = victim->bk; - bin->bk = bck; - bck->fd = bin; - - /* Exhaust */ - if (remainder_size < MINSIZE) { - set_inuse_bit_at_offset(victim, size); - check_malloced_chunk(victim, nb); -#ifdef SHMEM_ALLOC - SHMEM_ALLOC_INSERT_SEGMENT_ADDRESS(victim); -#endif - return chunk2mem(victim); - } - - /* Split */ - else { - remainder = chunk_at_offset(victim, nb); - - unsorted_chunks(av)->bk = unsorted_chunks(av)->fd = remainder; - remainder->bk = remainder->fd = unsorted_chunks(av); - /* advertise as last remainder */ - if (in_smallbin_range(nb)) - av->last_remainder = remainder; - - set_head(victim, nb | PREV_INUSE); - set_head(remainder, remainder_size | PREV_INUSE); - set_foot(remainder, remainder_size); - check_malloced_chunk(victim, nb); -#ifdef SHMEM_ALLOC - SHMEM_ALLOC_INSERT_SEGMENT_ADDRESS(victim); -#endif - return chunk2mem(victim); - } - } - } - - use_top: - /* - If large enough, split off the chunk bordering the end of memory - (held in av->top). Note that this is in accord with the best-fit - search rule. In effect, av->top is treated as larger (and thus - less well fitting) than any other available chunk since it can - be extended to be as large as necessary (up to system - limitations). - - We require that av->top always exists (i.e., has size >= - MINSIZE) after initialization, so if it would otherwise be - exhuasted by current request, it is replenished. (The main - reason for ensuring it exists is that we may need MINSIZE space - to put in fenceposts in sysmalloc.) - */ - - victim = av->top; - size = chunksize(victim); - - if ((unsigned long)(size) >= (unsigned long)(nb + MINSIZE)) { - remainder_size = size - nb; - remainder = chunk_at_offset(victim, nb); - av->top = remainder; - set_head(victim, nb | PREV_INUSE); - set_head(remainder, remainder_size | PREV_INUSE); - - check_malloced_chunk(victim, nb); -#ifdef SHMEM_ALLOC - SHMEM_ALLOC_INSERT_SEGMENT_ADDRESS(victim); -#endif - return chunk2mem(victim); - } - - /* - If there is space available in fastbins, consolidate and retry, - to possibly avoid expanding memory. This can occur only if nb is - in smallbin range so we didn't consolidate upon entry. - */ - - else if (have_fastchunks(av)) { - assert(in_smallbin_range(nb)); - malloc_consolidate(av); - idx = smallbin_index(nb); /* restore original bin index */ - } - - /* - Otherwise, relay to handle system-dependent cases - */ - else - return sYSMALLOc(nb, av); - } -} - -/* - ------------------------------ free ------------------------------ -*/ - -#if __STD_C -void fREe(Void_t* mem) -#else -void fREe(mem) Void_t* mem; -#endif -{ - mstate_shm av = get_malloc_state(); - - mchunkptr p; /* chunk corresponding to mem */ - INTERNAL_SIZE_T size; /* its size */ - mfastbinptr* fb; /* associated fastbin */ - mchunkptr nextchunk; /* next contiguous chunk */ - INTERNAL_SIZE_T nextsize; /* its size */ - int nextinuse; /* true if nextchunk is used */ - INTERNAL_SIZE_T prevsize; /* size of previous contiguous chunk */ - mchunkptr bck; /* misc temp for linking */ - mchunkptr fwd; /* misc temp for linking */ - - - /* free(0) has no effect */ - if (mem != 0) { - p = mem2chunk(mem); - size = chunksize(p); - - check_inuse_chunk(p); - - /* - If eligible, place chunk on a fastbin so it can be found - and used quickly in malloc. - */ - - if ((unsigned long)(size) <= (unsigned long)(av->max_fast) - -#if TRIM_FASTBINS - /* - If TRIM_FASTBINS set, don't place chunks - bordering top into fastbins - */ - && (chunk_at_offset(p, size) != av->top) -#endif - ) { - - set_fastchunks(av); - fb = &(av->fastbins[fastbin_index(size)]); - p->fd = *fb; - *fb = p; - } - - /* - Consolidate other non-mmapped chunks as they arrive. - */ - - else if (!chunk_is_mmapped(p)) { - nextchunk = chunk_at_offset(p, size); - nextsize = chunksize(nextchunk); - - /* consolidate backward */ - if (!prev_inuse(p)) { - prevsize = p->prev_size; - size += prevsize; - p = chunk_at_offset(p, -((long) prevsize)); - unlink(p, bck, fwd); - } - - if (nextchunk != av->top) { - /* get and clear inuse bit */ - nextinuse = inuse_bit_at_offset(nextchunk, nextsize); - set_head(nextchunk, nextsize); - - /* consolidate forward */ - if (!nextinuse) { - unlink(nextchunk, bck, fwd); - size += nextsize; - } - - /* - Place the chunk in unsorted chunk list. Chunks are - not placed into regular bins until after they have - been given one chance to be used in malloc. - */ - - bck = unsorted_chunks(av); - fwd = bck->fd; - p->bk = bck; - p->fd = fwd; - bck->fd = p; - fwd->bk = p; - - set_head(p, size | PREV_INUSE); - set_foot(p, size); - - check_free_chunk(p); - } - - /* - If the chunk borders the current high end of memory, - consolidate into top - */ - - else { - size += nextsize; - set_head(p, size | PREV_INUSE); - av->top = p; - check_chunk(p); - } - - /* - If freeing a large space, consolidate possibly-surrounding - chunks. Then, if the total unused topmost memory exceeds trim - threshold, ask malloc_trim to reduce top. - - Unless max_fast is 0, we don't know if there are fastbins - bordering top, so we cannot tell for sure whether threshold - has been reached unless fastbins are consolidated. But we - don't want to consolidate on each free. As a compromise, - consolidation is performed if FASTBIN_CONSOLIDATION_THRESHOLD - is reached. - */ - - if ((unsigned long)(size) >= FASTBIN_CONSOLIDATION_THRESHOLD) { - if (have_fastchunks(av)) - malloc_consolidate(av); - -#ifndef MORECORE_CANNOT_TRIM - if ((unsigned long)(chunksize(av->top)) >= - (unsigned long)(av->trim_threshold)) - sYSTRIm(av->top_pad, av); -#endif - } - - } - /* - If the chunk was allocated via mmap, release via munmap() - Note that if HAVE_MMAP is false but chunk_is_mmapped is - true, then user must have overwritten memory. There's nothing - we can do to catch this error unless DEBUG is set, in which case - check_inuse_chunk (above) will have triggered error. - */ - - else { -#if HAVE_MMAP - int ret; - INTERNAL_SIZE_T offset = p->prev_size; - av->n_mmaps--; - av->mmapped_mem -= (size + offset); - ret = munmap((char*)p - offset, size + offset); - /* munmap returns non-zero on failure */ - assert(ret == 0); -#endif - } - } -} - -/* - ------------------------- malloc_consolidate ------------------------- - - malloc_consolidate is a specialized version of free() that tears - down chunks held in fastbins. Free itself cannot be used for this - purpose since, among other things, it might place chunks back onto - fastbins. So, instead, we need to use a minor variant of the same - code. - - Also, because this routine needs to be called the first time through - malloc anyway, it turns out to be the perfect place to trigger - initialization code. -*/ - -#if __STD_C -static void malloc_consolidate(mstate_shm av) -#else -static void malloc_consolidate(av) mstate_shm av; -#endif -{ - mfastbinptr* fb; /* current fastbin being consolidated */ - mfastbinptr* maxfb; /* last fastbin (for loop control) */ - mchunkptr p; /* current chunk being consolidated */ - mchunkptr nextp; /* next chunk to consolidate */ - mchunkptr unsorted_bin; /* bin header */ - mchunkptr first_unsorted; /* chunk to link to */ - - /* These have same use as in free() */ - mchunkptr nextchunk; - INTERNAL_SIZE_T size; - INTERNAL_SIZE_T nextsize; - INTERNAL_SIZE_T prevsize; - int nextinuse; - mchunkptr bck; - mchunkptr fwd; - - /* - If max_fast is 0, we know that av hasn't - yet been initialized, in which case do so below - */ - - if (av->max_fast != 0) { - clear_fastchunks(av); - - unsorted_bin = unsorted_chunks(av); - - /* - Remove each chunk from fast bin and consolidate it, placing it - then in unsorted bin. Among other reasons for doing this, - placing in unsorted bin avoids needing to calculate actual bins - until malloc is sure that chunks aren't immediately going to be - reused anyway. - */ - - maxfb = &(av->fastbins[fastbin_index(av->max_fast)]); - fb = &(av->fastbins[0]); - do { - if ( (p = *fb) != 0) { - *fb = 0; - - do { - check_inuse_chunk(p); - nextp = p->fd; - - /* Slightly streamlined version of consolidation code in free() */ - size = p->size & ~PREV_INUSE; - nextchunk = chunk_at_offset(p, size); - nextsize = chunksize(nextchunk); - - if (!prev_inuse(p)) { - prevsize = p->prev_size; - size += prevsize; - p = chunk_at_offset(p, -((long) prevsize)); - unlink(p, bck, fwd); - } - - if (nextchunk != av->top) { - nextinuse = inuse_bit_at_offset(nextchunk, nextsize); - set_head(nextchunk, nextsize); - - if (!nextinuse) { - size += nextsize; - unlink(nextchunk, bck, fwd); - } - - first_unsorted = unsorted_bin->fd; - unsorted_bin->fd = p; - first_unsorted->bk = p; - - set_head(p, size | PREV_INUSE); - p->bk = unsorted_bin; - p->fd = first_unsorted; - set_foot(p, size); - } - - else { - size += nextsize; - set_head(p, size | PREV_INUSE); - av->top = p; - } - - } while ( (p = nextp) != 0); - - } - } while (fb++ != maxfb); - } - else { - malloc_init_state(av); - check_malloc_state(); - } -} - -/* - ------------------------------ realloc ------------------------------ -*/ - - -#if __STD_C -Void_t* rEALLOc(Void_t* oldmem, size_t bytes) -#else -Void_t* rEALLOc(oldmem, bytes) Void_t* oldmem; size_t bytes; -#endif -{ - mstate_shm av = get_malloc_state(); - - INTERNAL_SIZE_T nb; /* padded request size */ - - mchunkptr oldp; /* chunk corresponding to oldmem */ - INTERNAL_SIZE_T oldsize; /* its size */ - - mchunkptr newp; /* chunk to return */ - INTERNAL_SIZE_T newsize; /* its size */ - Void_t* newmem; /* corresponding user mem */ - - mchunkptr next; /* next contiguous chunk after oldp */ - - mchunkptr remainder; /* extra space at end of newp */ - unsigned long remainder_size; /* its size */ - - mchunkptr bck; /* misc temp for linking */ - mchunkptr fwd; /* misc temp for linking */ - - unsigned long copysize; /* bytes to copy */ - unsigned int ncopies; /* INTERNAL_SIZE_T words to copy */ - INTERNAL_SIZE_T* s; /* copy source */ - INTERNAL_SIZE_T* d; /* copy destination */ - - -#ifdef REALLOC_ZERO_BYTES_FREES - if (bytes == 0) { - fREe(oldmem); - return 0; - } -#endif - - /* realloc of null is supposed to be same as malloc */ - if (oldmem == 0) return mALLOc(bytes); - - checked_request2size(bytes, nb); - - oldp = mem2chunk(oldmem); - oldsize = chunksize(oldp); - - check_inuse_chunk(oldp); - - if (!chunk_is_mmapped(oldp)) { - - if ((unsigned long)(oldsize) >= (unsigned long)(nb)) { - /* already big enough; split below */ - newp = oldp; - newsize = oldsize; - } - - else { - next = chunk_at_offset(oldp, oldsize); - - /* Try to expand forward into top */ - if (next == av->top && - (unsigned long)(newsize = oldsize + chunksize(next)) >= - (unsigned long)(nb + MINSIZE)) { - set_head_size(oldp, nb); - av->top = chunk_at_offset(oldp, nb); - set_head(av->top, (newsize - nb) | PREV_INUSE); -#ifdef SHMEM_ALLOC - SHMEM_ALLOC_INSERT_SEGMENT_ADDRESS(oldp); -#endif - return chunk2mem(oldp); - } - - /* Try to expand forward into next chunk; split off remainder below */ - else if (next != av->top && - !inuse(next) && - (unsigned long)(newsize = oldsize + chunksize(next)) >= - (unsigned long)(nb)) { - newp = oldp; - unlink(next, bck, fwd); - } - - /* allocate, copy, free */ - else { - newmem = mALLOc(nb - MALLOC_ALIGN_MASK); - if (newmem == 0) - return 0; /* propagate failure */ - - newp = mem2chunk(newmem); - newsize = chunksize(newp); - - /* - Avoid copy if newp is next chunk after oldp. - */ - if (newp == next) { - newsize += oldsize; - newp = oldp; - } - else { - /* - Unroll copy of <= 36 bytes (72 if 8byte sizes) - We know that contents have an odd number of - INTERNAL_SIZE_T-sized words; minimally 3. - */ - - copysize = oldsize - SIZE_SZ; - s = (INTERNAL_SIZE_T*)(oldmem); - d = (INTERNAL_SIZE_T*)(newmem); - ncopies = copysize / sizeof(INTERNAL_SIZE_T); - assert(ncopies >= 3); - - if (ncopies > 9) - MALLOC_COPY(d, s, copysize); - - else { - *(d+0) = *(s+0); - *(d+1) = *(s+1); - *(d+2) = *(s+2); - if (ncopies > 4) { - *(d+3) = *(s+3); - *(d+4) = *(s+4); - if (ncopies > 6) { - *(d+5) = *(s+5); - *(d+6) = *(s+6); - if (ncopies > 8) { - *(d+7) = *(s+7); - *(d+8) = *(s+8); - } - } - } - } - - fREe(oldmem); - check_inuse_chunk(newp); -#ifdef SHMEM_ALLOC - SHMEM_ALLOC_INSERT_SEGMENT_ADDRESS(newp); -#endif - return chunk2mem(newp); - } - } - } - - /* If possible, free extra space in old or extended chunk */ - - assert((unsigned long)(newsize) >= (unsigned long)(nb)); - - remainder_size = newsize - nb; - - if (remainder_size < MINSIZE) { /* not enough extra to split off */ - set_head_size(newp, newsize); - set_inuse_bit_at_offset(newp, newsize); - } - else { /* split remainder */ - remainder = chunk_at_offset(newp, nb); - set_head_size(newp, nb); - set_head(remainder, remainder_size | PREV_INUSE); - /* Mark remainder as inuse so free() won't complain */ - set_inuse_bit_at_offset(remainder, remainder_size); - fREe(chunk2mem(remainder)); - } - - check_inuse_chunk(newp); -#ifdef SHMEM_ALLOC - SHMEM_ALLOC_INSERT_SEGMENT_ADDRESS(newp); -#endif - return chunk2mem(newp); - } - - /* - Handle mmap cases - */ - - else { -#if HAVE_MMAP - -#if HAVE_MREMAP - INTERNAL_SIZE_T offset = oldp->prev_size; - size_t pagemask = av->pagesize - 1; - char *cp; - unsigned long sum; - - /* Note the extra SIZE_SZ overhead */ - newsize = (nb + offset + SIZE_SZ + pagemask) & ~pagemask; - - /* don't need to remap if still within same page */ - if (oldsize == newsize - offset) - return oldmem; - - cp = (char*)mremap((char*)oldp - offset, oldsize + offset, newsize, 1); - - if (cp != (char*)MORECORE_FAILURE) { - - newp = (mchunkptr)(cp + offset); - set_head(newp, (newsize - offset)|IS_MMAPPED); - - assert(aligned_OK(chunk2mem(newp))); - assert((newp->prev_size == offset)); - - /* update statistics */ - sum = av->mmapped_mem += newsize - oldsize; - if (sum > (unsigned long)(av->max_mmapped_mem)) - av->max_mmapped_mem = sum; - sum += av->sbrked_mem; - if (sum > (unsigned long)(av->max_total_mem)) - av->max_total_mem = sum; -#ifdef SHMEM_ALLOC - SHMEM_ALLOC_INSERT_SEGMENT_ADDRESS(newp); -#endif - return chunk2mem(newp); - } -#endif - - /* Note the extra SIZE_SZ overhead. */ - if ((unsigned long)(oldsize) >= (unsigned long)(nb + SIZE_SZ)) - newmem = oldmem; /* do nothing */ - else { - /* Must alloc, copy, free. */ - newmem = mALLOc(nb - MALLOC_ALIGN_MASK); - if (newmem != 0) { - MALLOC_COPY(newmem, oldmem, oldsize - 2*SIZE_SZ); - fREe(oldmem); - } - } - return newmem; - -#else - /* If !HAVE_MMAP, but chunk_is_mmapped, user must have overwritten mem */ - check_malloc_state(); - MALLOC_FAILURE_ACTION; - return 0; -#endif - } -} - -/* - ------------------------------ memalign ------------------------------ -*/ - -#if __STD_C -Void_t* mEMALIGn(size_t alignment, size_t bytes) -#else -Void_t* mEMALIGn(alignment, bytes) size_t alignment; size_t bytes; -#endif -{ - INTERNAL_SIZE_T nb; /* padded request size */ - char* m; /* memory returned by malloc call */ - mchunkptr p; /* corresponding chunk */ - char* brk; /* alignment point within p */ - mchunkptr newp; /* chunk to return */ - INTERNAL_SIZE_T newsize; /* its size */ - INTERNAL_SIZE_T leadsize; /* leading space before alignment point */ - mchunkptr remainder; /* spare room at end to split off */ - unsigned long remainder_size; /* its size */ - INTERNAL_SIZE_T size; - - /* If need less alignment than we give anyway, just relay to malloc */ - - if (alignment <= MALLOC_ALIGNMENT) return mALLOc(bytes); - - /* Otherwise, ensure that it is at least a minimum chunk size */ - - if (alignment < MINSIZE) alignment = MINSIZE; - - /* Make sure alignment is power of 2 (in case MINSIZE is not). */ - if ((alignment & (alignment - 1)) != 0) { - size_t a = MALLOC_ALIGNMENT * 2; - while ((unsigned long)a < (unsigned long)alignment) a <<= 1; - alignment = a; - } - - checked_request2size(bytes, nb); - - /* - Strategy: find a spot within that chunk that meets the alignment - request, and then possibly free the leading and trailing space. - */ - - - /* Call malloc with worst case padding to hit alignment. */ - - m = (char*)(mALLOc(nb + alignment + MINSIZE)); - - if (m == 0) return 0; /* propagate failure */ - - p = mem2chunk(m); - - if ((((unsigned long)(m)) % alignment) != 0) { /* misaligned */ - - /* - Find an aligned spot inside chunk. Since we need to give back - leading space in a chunk of at least MINSIZE, if the first - calculation places us at a spot with less than MINSIZE leader, - we can move to the next aligned spot -- we've allocated enough - total room so that this is always possible. - */ - - brk = (char*)mem2chunk(((unsigned long)(m + alignment - 1)) & - -((signed long) alignment)); - if ((unsigned long)(brk - (char*)(p)) < MINSIZE) - brk += alignment; - - newp = (mchunkptr)brk; - leadsize = brk - (char*)(p); - newsize = chunksize(p) - leadsize; - - /* For mmapped chunks, just adjust offset */ - if (chunk_is_mmapped(p)) { - newp->prev_size = p->prev_size + leadsize; - set_head(newp, newsize|IS_MMAPPED); - return chunk2mem(newp); - } - - /* Otherwise, give back leader, use the rest */ - set_head(newp, newsize | PREV_INUSE); - set_inuse_bit_at_offset(newp, newsize); - set_head_size(p, leadsize); - fREe(chunk2mem(p)); - p = newp; - - assert (newsize >= nb && - (((unsigned long)(chunk2mem(p))) % alignment) == 0); - } - - /* Also give back spare room at the end */ - if (!chunk_is_mmapped(p)) { - size = chunksize(p); - if ((unsigned long)(size) > (unsigned long)(nb + MINSIZE)) { - remainder_size = size - nb; - remainder = chunk_at_offset(p, nb); - set_head(remainder, remainder_size | PREV_INUSE); - set_head_size(p, nb); - fREe(chunk2mem(remainder)); - } - } - - check_inuse_chunk(p); - return chunk2mem(p); -} - -/* - ------------------------------ calloc ------------------------------ -*/ - -#if __STD_C -Void_t* cALLOc(size_t n_elements, size_t elem_size) -#else -Void_t* cALLOc(n_elements, elem_size) size_t n_elements; size_t elem_size; -#endif -{ - mchunkptr p; - unsigned long clearsize; - unsigned long nclears; - INTERNAL_SIZE_T* d; - - Void_t* mem = mALLOc(n_elements * elem_size); - - if (mem != 0) { - p = mem2chunk(mem); - -#if MMAP_CLEARS - if (!chunk_is_mmapped(p)) /* don't need to clear mmapped space */ -#endif - { - /* - Unroll clear of <= 36 bytes (72 if 8byte sizes) - We know that contents have an odd number of - INTERNAL_SIZE_T-sized words; minimally 3. - */ - - d = (INTERNAL_SIZE_T*)mem; - clearsize = chunksize(p) - SIZE_SZ; - nclears = clearsize / sizeof(INTERNAL_SIZE_T); - assert(nclears >= 3); - - if (nclears > 9) - MALLOC_ZERO(d, clearsize); - - else { - *(d+0) = 0; - *(d+1) = 0; - *(d+2) = 0; - if (nclears > 4) { - *(d+3) = 0; - *(d+4) = 0; - if (nclears > 6) { - *(d+5) = 0; - *(d+6) = 0; - if (nclears > 8) { - *(d+7) = 0; - *(d+8) = 0; - } - } - } - } - } - } - return mem; -} - -/* - ------------------------------ cfree ------------------------------ -*/ - -#if __STD_C -void cFREe(Void_t *mem) -#else -void cFREe(mem) Void_t *mem; -#endif -{ - fREe(mem); -} - -/* - ------------------------- independent_calloc ------------------------- -*/ - -#if __STD_C -Void_t** iCALLOc(size_t n_elements, size_t elem_size, Void_t* chunks[]) -#else -Void_t** iCALLOc(n_elements, elem_size, chunks) size_t n_elements; size_t elem_size; Void_t* chunks[]; -#endif -{ - size_t sz = elem_size; /* serves as 1-element array */ - /* opts arg of 3 means all elements are same size, and should be cleared */ - return iALLOc(n_elements, &sz, 3, chunks); -} - -/* - ------------------------- independent_comalloc ------------------------- -*/ - -#if __STD_C -Void_t** iCOMALLOc(size_t n_elements, size_t sizes[], Void_t* chunks[]) -#else -Void_t** iCOMALLOc(n_elements, sizes, chunks) size_t n_elements; size_t sizes[]; Void_t* chunks[]; -#endif -{ - return iALLOc(n_elements, sizes, 0, chunks); -} - - -/* - ------------------------------ ialloc ------------------------------ - ialloc provides common support for independent_X routines, handling all of - the combinations that can result. - - The opts arg has: - bit 0 set if all elements are same size (using sizes[0]) - bit 1 set if elements should be zeroed -*/ - - -#if __STD_C -static Void_t** iALLOc(size_t n_elements, - size_t* sizes, - int opts, - Void_t* chunks[]) -#else -static Void_t** iALLOc(n_elements, sizes, opts, chunks) size_t n_elements; size_t* sizes; int opts; Void_t* chunks[]; -#endif -{ - mstate_shm av = get_malloc_state(); - INTERNAL_SIZE_T element_size; /* chunksize of each element, if all same */ - INTERNAL_SIZE_T contents_size; /* total size of elements */ - INTERNAL_SIZE_T array_size; /* request size of pointer array */ - Void_t* mem; /* malloced aggregate space */ - mchunkptr p; /* corresponding chunk */ - INTERNAL_SIZE_T remainder_size; /* remaining bytes while splitting */ - Void_t** marray; /* either "chunks" or malloced ptr array */ - mchunkptr array_chunk; /* chunk for malloced ptr array */ - int mmx; /* to disable mmap */ - INTERNAL_SIZE_T size; - size_t i; - - /* Ensure initialization/consolidation */ - if (have_fastchunks(av)) malloc_consolidate(av); - - /* compute array length, if needed */ - if (chunks != 0) { - if (n_elements == 0) - return chunks; /* nothing to do */ - marray = chunks; - array_size = 0; - } - else { - /* if empty req, must still return chunk representing empty array */ - if (n_elements == 0) - return (Void_t**) mALLOc(0); - marray = 0; - array_size = request2size(n_elements * (sizeof(Void_t*))); - } - - /* compute total element size */ - if (opts & 0x1) { /* all-same-size */ - element_size = request2size(*sizes); - contents_size = n_elements * element_size; - } - else { /* add up all the sizes */ - element_size = 0; - contents_size = 0; - for (i = 0; i != n_elements; ++i) - contents_size += request2size(sizes[i]); - } - - /* subtract out alignment bytes from total to minimize overallocation */ - size = contents_size + array_size - MALLOC_ALIGN_MASK; - - /* - Allocate the aggregate chunk. - But first disable mmap so malloc won't use it, since - we would not be able to later free/realloc space internal - to a segregated mmap region. - */ - mmx = av->n_mmaps_max; /* disable mmap */ - av->n_mmaps_max = 0; - mem = mALLOc(size); - av->n_mmaps_max = mmx; /* reset mmap */ - if (mem == 0) - return 0; - - p = mem2chunk(mem); - assert(!chunk_is_mmapped(p)); - remainder_size = chunksize(p); - - if (opts & 0x2) { /* optionally clear the elements */ - MALLOC_ZERO(mem, remainder_size - SIZE_SZ - array_size); - } - - /* If not provided, allocate the pointer array as final part of chunk */ - if (marray == 0) { - array_chunk = chunk_at_offset(p, contents_size); - marray = (Void_t**) (chunk2mem(array_chunk)); - set_head(array_chunk, (remainder_size - contents_size) | PREV_INUSE); - remainder_size = contents_size; - } - - /* split out elements */ - for (i = 0; ; ++i) { - marray[i] = chunk2mem(p); - if (i != n_elements-1) { - if (element_size != 0) - size = element_size; - else - size = request2size(sizes[i]); - remainder_size -= size; - set_head(p, size | PREV_INUSE); - p = chunk_at_offset(p, size); - } - else { /* the final element absorbs any overallocation slop */ - set_head(p, remainder_size | PREV_INUSE); - break; - } - } - -#if DEBUG - if (marray != chunks) { - /* final element must have exactly exhausted chunk */ - if (element_size != 0) - assert(remainder_size == element_size); - else - assert(remainder_size == request2size(sizes[i])); - check_inuse_chunk(mem2chunk(marray)); - } - - for (i = 0; i != n_elements; ++i) - check_inuse_chunk(mem2chunk(marray[i])); -#endif - - return marray; -} - - -/* - ------------------------------ valloc ------------------------------ -*/ - -#if __STD_C -Void_t* vALLOc(size_t bytes) -#else -Void_t* vALLOc(bytes) size_t bytes; -#endif -{ - /* Ensure initialization/consolidation */ - mstate_shm av = get_malloc_state(); - if (have_fastchunks(av)) malloc_consolidate(av); - return mEMALIGn(av->pagesize, bytes); -} - -/* - ------------------------------ pvalloc ------------------------------ -*/ - - -#if __STD_C -Void_t* pVALLOc(size_t bytes) -#else -Void_t* pVALLOc(bytes) size_t bytes; -#endif -{ - mstate_shm av = get_malloc_state(); - size_t pagesz; - - /* Ensure initialization/consolidation */ - if (have_fastchunks(av)) malloc_consolidate(av); - pagesz = av->pagesize; - return mEMALIGn(pagesz, (bytes + pagesz - 1) & ~(pagesz - 1)); -} - - -/* - ------------------------------ malloc_trim ------------------------------ -*/ - -#if __STD_C -int mTRIm(size_t pad) -#else -int mTRIm(pad) size_t pad; -#endif -{ - mstate_shm av = get_malloc_state(); - /* Ensure initialization/consolidation */ - malloc_consolidate(av); - -#ifndef MORECORE_CANNOT_TRIM - return sYSTRIm(pad, av); -#else - (void)pad; // suppress unused parameter warning - return 0; -#endif -} - - -/* - ------------------------- malloc_usable_size ------------------------- -*/ - -#if __STD_C -size_t mUSABLe(Void_t* mem) -#else -size_t mUSABLe(mem) Void_t* mem; -#endif -{ - mchunkptr p; - if (mem != 0) { - p = mem2chunk(mem); - if (chunk_is_mmapped(p)) - return chunksize(p) - 2*SIZE_SZ; - else if (inuse(p)) - return chunksize(p) - SIZE_SZ; - } - return 0; -} - -/* - ------------------------------ mallinfo ------------------------------ -*/ - -struct mallinfo mALLINFo() -{ - mstate_shm av = get_malloc_state(); - struct mallinfo mi; - int i; - mbinptr b; - mchunkptr p; - INTERNAL_SIZE_T avail; - INTERNAL_SIZE_T fastavail; - int nblocks; - int nfastblocks; - - /* Ensure initialization */ - if (av->top == 0) malloc_consolidate(av); - - check_malloc_state(); - - /* Account for top */ - avail = chunksize(av->top); - nblocks = 1; /* top always exists */ - - /* traverse fastbins */ - nfastblocks = 0; - fastavail = 0; - - for (i = 0; i < NFASTBINS; ++i) { - for (p = av->fastbins[i]; p != 0; p = p->fd) { - ++nfastblocks; - fastavail += chunksize(p); - } - } - - avail += fastavail; - - /* traverse regular bins */ - for (i = 1; i < NBINS; ++i) { - b = bin_at(av, i); - for (p = last(b); p != b; p = p->bk) { - ++nblocks; - avail += chunksize(p); - } - } - - mi.smblks = nfastblocks; - mi.ordblks = nblocks; - mi.fordblks = avail; - mi.uordblks = av->sbrked_mem - avail; - mi.arena = av->sbrked_mem; - mi.hblks = av->n_mmaps; - mi.hblkhd = av->mmapped_mem; - mi.fsmblks = fastavail; - mi.keepcost = chunksize(av->top); - mi.usmblks = av->max_total_mem; - return mi; -} - -/* - ------------------------------ malloc_stats ------------------------------ -*/ - -void mSTATs() -{ - struct mallinfo mi = mALLINFo(); - -#ifdef WIN32 - { - unsigned long free, reserved, committed; - vminfo (&free, &reserved, &committed); - fprintf(stderr, "free bytes = %10lu\n", - free); - fprintf(stderr, "reserved bytes = %10lu\n", - reserved); - fprintf(stderr, "committed bytes = %10lu\n", - committed); - } -#endif - - - fprintf(stderr, "max system bytes = %10lu\n", - (unsigned long)(mi.usmblks)); - fprintf(stderr, "system bytes = %10lu\n", - (unsigned long)(mi.arena + mi.hblkhd)); - fprintf(stderr, "in use bytes = %10lu\n", - (unsigned long)(mi.uordblks + mi.hblkhd)); - - -#ifdef WIN32 - { - unsigned long kernel, user; - if (cpuinfo (TRUE, &kernel, &user)) { - fprintf(stderr, "kernel ms = %10lu\n", - kernel); - fprintf(stderr, "user ms = %10lu\n", - user); - } - } -#endif -} - - -/* - ------------------------------ mallopt ------------------------------ -*/ - -#if __STD_C -int mALLOPt(int param_number, int value) -#else -int mALLOPt(param_number, value) int param_number; int value; -#endif -{ - mstate_shm av = get_malloc_state(); - /* Ensure initialization/consolidation */ - malloc_consolidate(av); - - switch(param_number) { - case M_MXFAST: - if (value >= 0 && value <= MAX_FAST_SIZE) { - set_max_fast(av, value); - return 1; - } - else - return 0; - - case M_TRIM_THRESHOLD: - av->trim_threshold = value; - return 1; - - case M_TOP_PAD: - av->top_pad = value; - return 1; - - case M_MMAP_THRESHOLD: - av->mmap_threshold = value; - return 1; - - case M_MMAP_MAX: -#if !HAVE_MMAP - if (value != 0) - return 0; -#endif - av->n_mmaps_max = value; - return 1; - - default: - return 0; - } -} - - -/* - -------------------- Alternative MORECORE functions -------------------- -*/ - - -/* - General Requirements for MORECORE. - - The MORECORE function must have the following properties: - - If MORECORE_CONTIGUOUS is false: - - * MORECORE must allocate in multiples of pagesize. It will - only be called with arguments that are multiples of pagesize. - - * MORECORE(0) must return an address that is at least - MALLOC_ALIGNMENT aligned. (Page-aligning always suffices.) - - else (i.e. If MORECORE_CONTIGUOUS is true): - - * Consecutive calls to MORECORE with positive arguments - return increasing addresses, indicating that space has been - contiguously extended. - - * MORECORE need not allocate in multiples of pagesize. - Calls to MORECORE need not have args of multiples of pagesize. - - * MORECORE need not page-align. - - In either case: - - * MORECORE may allocate more memory than requested. (Or even less, - but this will generally result in a malloc failure.) - - * MORECORE must not allocate memory when given argument zero, but - instead return one past the end address of memory from previous - nonzero call. This malloc does NOT call MORECORE(0) - until at least one call with positive arguments is made, so - the initial value returned is not important. - - * Even though consecutive calls to MORECORE need not return contiguous - addresses, it must be OK for malloc'ed chunks to span multiple - regions in those cases where they do happen to be contiguous. - - * MORECORE need not handle negative arguments -- it may instead - just return MORECORE_FAILURE when given negative arguments. - Negative arguments are always multiples of pagesize. MORECORE - must not misinterpret negative args as large positive unsigned - args. You can suppress all such calls from even occurring by defining - MORECORE_CANNOT_TRIM, - - There is some variation across systems about the type of the - argument to sbrk/MORECORE. If size_t is unsigned, then it cannot - actually be size_t, because sbrk supports negative args, so it is - normally the signed type of the same width as size_t (sometimes - declared as "intptr_t", and sometimes "ptrdiff_t"). It doesn't much - matter though. Internally, we use "long" as arguments, which should - work across all reasonable possibilities. - - Additionally, if MORECORE ever returns failure for a positive - request, and HAVE_MMAP is true, then mmap is used as a noncontiguous - system allocator. This is a useful backup strategy for systems with - holes in address spaces -- in this case sbrk cannot contiguously - expand the heap, but mmap may be able to map noncontiguous space. - - If you'd like mmap to ALWAYS be used, you can define MORECORE to be - a function that always returns MORECORE_FAILURE. - - If you are using this malloc with something other than sbrk (or its - emulation) to supply memory regions, you probably want to set - MORECORE_CONTIGUOUS as false. As an example, here is a custom - allocator kindly contributed for pre-OSX macOS. It uses virtually - but not necessarily physically contiguous non-paged memory (locked - in, present and won't get swapped out). You can use it by - uncommenting this section, adding some #includes, and setting up the - appropriate defines above: - - #define MORECORE osMoreCore - #define MORECORE_CONTIGUOUS 0 - - There is also a shutdown routine that should somehow be called for - cleanup upon program exit. - - #define MAX_POOL_ENTRIES 100 - #define MINIMUM_MORECORE_SIZE (64 * 1024) - static int next_os_pool; - void *our_os_pools[MAX_POOL_ENTRIES]; - - void *osMoreCore(int size) - { - void *ptr = 0; - static void *sbrk_top = 0; - - if (size > 0) - { - if (size < MINIMUM_MORECORE_SIZE) - size = MINIMUM_MORECORE_SIZE; - if (CurrentExecutionLevel() == kTaskLevel) - ptr = PoolAllocateResident(size + RM_PAGE_SIZE, 0); - if (ptr == 0) - { - return (void *) MORECORE_FAILURE; - } - // save ptrs so they can be freed during cleanup - our_os_pools[next_os_pool] = ptr; - next_os_pool++; - ptr = (void *) ((((unsigned long) ptr) + RM_PAGE_MASK) & ~RM_PAGE_MASK); - sbrk_top = (char *) ptr + size; - return ptr; - } - else if (size < 0) - { - // we don't currently support shrink behavior - return (void *) MORECORE_FAILURE; - } - else - { - return sbrk_top; - } - } - - // cleanup any allocated memory pools - // called as last thing before shutting down driver - - void osCleanupMem(void) - { - void **ptr; - - for (ptr = our_os_pools; ptr < &our_os_pools[MAX_POOL_ENTRIES]; ptr++) - if (*ptr) - { - PoolDeallocate(*ptr); - *ptr = 0; - } - } - -*/ - - -/* - -------------------------------------------------------------- - - Emulation of sbrk for win32. - Donated by J. Walter <Walter@GeNeSys-e.de>. - For additional information about this code, and malloc on Win32, see - http://www.genesys-e.de/jwalter/ -*/ - - -#ifdef WIN32 - -#ifdef _DEBUG -/* #define TRACE */ -#endif - -/* Support for USE_MALLOC_LOCK */ -#ifdef USE_MALLOC_LOCK - -/* Wait for spin lock */ -static int slwait (int *sl) { - while (InterlockedCompareExchange ((void **) sl, (void *) 1, (void *) 0) != 0) - Sleep (0); - return 0; -} - -/* Release spin lock */ -static int slrelease (int *sl) { - InterlockedExchange (sl, 0); - return 0; -} - -#ifdef NEEDED -/* Spin lock for emulation code */ -static int g_sl; -#endif - -#endif /* USE_MALLOC_LOCK */ - -/* getpagesize for windows */ -static long getpagesize (void) { - static long g_pagesize = 0; - if (! g_pagesize) { - SYSTEM_INFO system_info; - GetSystemInfo (&system_info); - g_pagesize = system_info.dwPageSize; - } - return g_pagesize; -} -static long getregionsize (void) { - static long g_regionsize = 0; - if (! g_regionsize) { - SYSTEM_INFO system_info; - GetSystemInfo (&system_info); - g_regionsize = system_info.dwAllocationGranularity; - } - return g_regionsize; -} - -/* A region list entry */ -typedef struct _region_list_entry { - void *top_allocated; - void *top_committed; - void *top_reserved; - long reserve_size; - struct _region_list_entry *previous; -} region_list_entry; - -/* Allocate and link a region entry in the region list */ -static int region_list_append (region_list_entry **last, void *base_reserved, long reserve_size) { - region_list_entry *next = HeapAlloc (GetProcessHeap (), 0, sizeof (region_list_entry)); - if (! next) - return FALSE; - next->top_allocated = (char *) base_reserved; - next->top_committed = (char *) base_reserved; - next->top_reserved = (char *) base_reserved + reserve_size; - next->reserve_size = reserve_size; - next->previous = *last; - *last = next; - return TRUE; -} -/* Free and unlink the last region entry from the region list */ -static int region_list_remove (region_list_entry **last) { - region_list_entry *previous = (*last)->previous; - if (! HeapFree (GetProcessHeap (), sizeof (region_list_entry), *last)) - return FALSE; - *last = previous; - return TRUE; -} - -#define CEIL(size,to) (((size)+(to)-1)&~((to)-1)) -#define FLOOR(size,to) ((size)&~((to)-1)) - -#define SBRK_SCALE 0 -/* #define SBRK_SCALE 1 */ -/* #define SBRK_SCALE 2 */ -/* #define SBRK_SCALE 4 */ - -/* sbrk for windows */ -static void *sbrk (long size) { - static long g_pagesize, g_my_pagesize; - static long g_regionsize, g_my_regionsize; - static region_list_entry *g_last; - void *result = (void *) MORECORE_FAILURE; -#ifdef TRACE - printf ("sbrk %ld\n", size); -#endif -#if defined (USE_MALLOC_LOCK) && defined (NEEDED) - /* Wait for spin lock */ - slwait (&g_sl); -#endif - /* First time initialization */ - if (! g_pagesize) { - g_pagesize = getpagesize (); - g_my_pagesize = g_pagesize << SBRK_SCALE; - } - if (! g_regionsize) { - g_regionsize = getregionsize (); - g_my_regionsize = g_regionsize << SBRK_SCALE; - } - if (! g_last) { - if (! region_list_append (&g_last, 0, 0)) - goto sbrk_exit; - } - /* Assert invariants */ - assert (g_last); - assert ((char *) g_last->top_reserved - g_last->reserve_size <= (char *) g_last->top_allocated && - g_last->top_allocated <= g_last->top_committed); - assert ((char *) g_last->top_reserved - g_last->reserve_size <= (char *) g_last->top_committed && - g_last->top_committed <= g_last->top_reserved && - (unsigned) g_last->top_committed % g_pagesize == 0); - assert ((unsigned) g_last->top_reserved % g_regionsize == 0); - assert ((unsigned) g_last->reserve_size % g_regionsize == 0); - /* Allocation requested? */ - if (size >= 0) { - /* Allocation size is the requested size */ - long allocate_size = size; - /* Compute the size to commit */ - long to_commit = (char *) g_last->top_allocated + allocate_size - (char *) g_last->top_committed; - /* Do we reach the commit limit? */ - if (to_commit > 0) { - /* Round size to commit */ - long commit_size = CEIL (to_commit, g_my_pagesize); - /* Compute the size to reserve */ - long to_reserve = (char *) g_last->top_committed + commit_size - (char *) g_last->top_reserved; - /* Do we reach the reserve limit? */ - if (to_reserve > 0) { - /* Compute the remaining size to commit in the current region */ - long remaining_commit_size = (char *) g_last->top_reserved - (char *) g_last->top_committed; - if (remaining_commit_size > 0) { - /* Assert preconditions */ - assert ((unsigned) g_last->top_committed % g_pagesize == 0); - assert (0 < remaining_commit_size && remaining_commit_size % g_pagesize == 0); { - /* Commit this */ - void *base_committed = VirtualAlloc (g_last->top_committed, remaining_commit_size, - MEM_COMMIT, PAGE_READWRITE); - /* Check returned pointer for consistency */ - if (base_committed != g_last->top_committed) - goto sbrk_exit; - /* Assert postconditions */ - assert ((unsigned) base_committed % g_pagesize == 0); -#ifdef TRACE - printf ("Commit %p %ld\n", base_committed, remaining_commit_size); -#endif - /* Adjust the regions commit top */ - g_last->top_committed = (char *) base_committed + remaining_commit_size; - } - } { - /* Now we are going to search and reserve. */ - int contiguous = -1; - int found = FALSE; - MEMORY_BASIC_INFORMATION memory_info; - void *base_reserved; - long reserve_size; - do { - /* Assume contiguous memory */ - contiguous = TRUE; - /* Round size to reserve */ - reserve_size = CEIL (to_reserve, g_my_regionsize); - /* Start with the current region's top */ - memory_info.BaseAddress = g_last->top_reserved; - /* Assert preconditions */ - assert ((unsigned) memory_info.BaseAddress % g_pagesize == 0); - assert (0 < reserve_size && reserve_size % g_regionsize == 0); - while (VirtualQuery (memory_info.BaseAddress, &memory_info, sizeof (memory_info))) { - /* Assert postconditions */ - assert ((unsigned) memory_info.BaseAddress % g_pagesize == 0); -#ifdef TRACE - printf ("Query %p %ld %s\n", memory_info.BaseAddress, (long) memory_info.RegionSize, - memory_info.State == MEM_FREE ? "FREE": - (memory_info.State == MEM_RESERVE ? "RESERVED": - (memory_info.State == MEM_COMMIT ? "COMMITTED": "?"))); -#endif - /* Region is free, well aligned and big enough: we are done */ - if (memory_info.State == MEM_FREE && - (unsigned) memory_info.BaseAddress % g_regionsize == 0 && - memory_info.RegionSize >= (unsigned) reserve_size) { - found = TRUE; - break; - } - /* From now on we can't get contiguous memory! */ - contiguous = FALSE; - /* Recompute size to reserve */ - reserve_size = CEIL (allocate_size, g_my_regionsize); - memory_info.BaseAddress = (char *) memory_info.BaseAddress + memory_info.RegionSize; - /* Assert preconditions */ - assert ((unsigned) memory_info.BaseAddress % g_pagesize == 0); - assert (0 < reserve_size && reserve_size % g_regionsize == 0); - } - /* Search failed? */ - if (! found) - goto sbrk_exit; - /* Assert preconditions */ - assert ((unsigned) memory_info.BaseAddress % g_regionsize == 0); - assert (0 < reserve_size && reserve_size % g_regionsize == 0); - /* Try to reserve this */ - base_reserved = VirtualAlloc (memory_info.BaseAddress, reserve_size, - MEM_RESERVE, PAGE_NOACCESS); - if (! base_reserved) { - int rc = GetLastError (); - if (rc != ERROR_INVALID_ADDRESS) - goto sbrk_exit; - } - /* A null pointer signals (hopefully) a race condition with another thread. */ - /* In this case, we try again. */ - } while (! base_reserved); - /* Check returned pointer for consistency */ - if (memory_info.BaseAddress && base_reserved != memory_info.BaseAddress) - goto sbrk_exit; - /* Assert postconditions */ - assert ((unsigned) base_reserved % g_regionsize == 0); -#ifdef TRACE - printf ("Reserve %p %ld\n", base_reserved, reserve_size); -#endif - /* Did we get contiguous memory? */ - if (contiguous) { - long start_size = (char *) g_last->top_committed - (char *) g_last->top_allocated; - /* Adjust allocation size */ - allocate_size -= start_size; - /* Adjust the regions allocation top */ - g_last->top_allocated = g_last->top_committed; - /* Recompute the size to commit */ - to_commit = (char *) g_last->top_allocated + allocate_size - (char *) g_last->top_committed; - /* Round size to commit */ - commit_size = CEIL (to_commit, g_my_pagesize); - } - /* Append the new region to the list */ - if (! region_list_append (&g_last, base_reserved, reserve_size)) - goto sbrk_exit; - /* Didn't we get contiguous memory? */ - if (! contiguous) { - /* Recompute the size to commit */ - to_commit = (char *) g_last->top_allocated + allocate_size - (char *) g_last->top_committed; - /* Round size to commit */ - commit_size = CEIL (to_commit, g_my_pagesize); - } - } - } - /* Assert preconditions */ - assert ((unsigned) g_last->top_committed % g_pagesize == 0); - assert (0 < commit_size && commit_size % g_pagesize == 0); { - /* Commit this */ - void *base_committed = VirtualAlloc (g_last->top_committed, commit_size, - MEM_COMMIT, PAGE_READWRITE); - /* Check returned pointer for consistency */ - if (base_committed != g_last->top_committed) - goto sbrk_exit; - /* Assert postconditions */ - assert ((unsigned) base_committed % g_pagesize == 0); -#ifdef TRACE - printf ("Commit %p %ld\n", base_committed, commit_size); -#endif - /* Adjust the regions commit top */ - g_last->top_committed = (char *) base_committed + commit_size; - } - } - /* Adjust the regions allocation top */ - g_last->top_allocated = (char *) g_last->top_allocated + allocate_size; - result = (char *) g_last->top_allocated - size; - /* Deallocation requested? */ - } else if (size < 0) { - long deallocate_size = - size; - /* As long as we have a region to release */ - while ((char *) g_last->top_allocated - deallocate_size < (char *) g_last->top_reserved - g_last->reserve_size) { - /* Get the size to release */ - long release_size = g_last->reserve_size; - /* Get the base address */ - void *base_reserved = (char *) g_last->top_reserved - release_size; - /* Assert preconditions */ - assert ((unsigned) base_reserved % g_regionsize == 0); - assert (0 < release_size && release_size % g_regionsize == 0); { - /* Release this */ - int rc = VirtualFree (base_reserved, 0, - MEM_RELEASE); - /* Check returned code for consistency */ - if (! rc) - goto sbrk_exit; -#ifdef TRACE - printf ("Release %p %ld\n", base_reserved, release_size); -#endif - } - /* Adjust deallocation size */ - deallocate_size -= (char *) g_last->top_allocated - (char *) base_reserved; - /* Remove the old region from the list */ - if (! region_list_remove (&g_last)) - goto sbrk_exit; - } { - /* Compute the size to decommit */ - long to_decommit = (char *) g_last->top_committed - ((char *) g_last->top_allocated - deallocate_size); - if (to_decommit >= g_my_pagesize) { - /* Compute the size to decommit */ - long decommit_size = FLOOR (to_decommit, g_my_pagesize); - /* Compute the base address */ - void *base_committed = (char *) g_last->top_committed - decommit_size; - /* Assert preconditions */ - assert ((unsigned) base_committed % g_pagesize == 0); - assert (0 < decommit_size && decommit_size % g_pagesize == 0); { - /* Decommit this */ - int rc = VirtualFree ((char *) base_committed, decommit_size, - MEM_DECOMMIT); - /* Check returned code for consistency */ - if (! rc) - goto sbrk_exit; -#ifdef TRACE - printf ("Decommit %p %ld\n", base_committed, decommit_size); -#endif - } - /* Adjust deallocation size and regions commit and allocate top */ - deallocate_size -= (char *) g_last->top_allocated - (char *) base_committed; - g_last->top_committed = base_committed; - g_last->top_allocated = base_committed; - } - } - /* Adjust regions allocate top */ - g_last->top_allocated = (char *) g_last->top_allocated - deallocate_size; - /* Check for underflow */ - if ((char *) g_last->top_reserved - g_last->reserve_size > (char *) g_last->top_allocated || - g_last->top_allocated > g_last->top_committed) { - /* Adjust regions allocate top */ - g_last->top_allocated = (char *) g_last->top_reserved - g_last->reserve_size; - goto sbrk_exit; - } - result = g_last->top_allocated; - } - /* Assert invariants */ - assert (g_last); - assert ((char *) g_last->top_reserved - g_last->reserve_size <= (char *) g_last->top_allocated && - g_last->top_allocated <= g_last->top_committed); - assert ((char *) g_last->top_reserved - g_last->reserve_size <= (char *) g_last->top_committed && - g_last->top_committed <= g_last->top_reserved && - (unsigned) g_last->top_committed % g_pagesize == 0); - assert ((unsigned) g_last->top_reserved % g_regionsize == 0); - assert ((unsigned) g_last->reserve_size % g_regionsize == 0); - -sbrk_exit: -#if defined (USE_MALLOC_LOCK) && defined (NEEDED) - /* Release spin lock */ - slrelease (&g_sl); -#endif - return result; -} - -/* mmap for windows */ -static void *mmap (void *ptr, long size, long prot, long type, long handle, long arg) { - static long g_pagesize; - static long g_regionsize; -#ifdef TRACE - printf ("mmap %ld\n", size); -#endif -#if defined (USE_MALLOC_LOCK) && defined (NEEDED) - /* Wait for spin lock */ - slwait (&g_sl); -#endif - /* First time initialization */ - if (! g_pagesize) - g_pagesize = getpagesize (); - if (! g_regionsize) - g_regionsize = getregionsize (); - /* Assert preconditions */ - assert ((unsigned) ptr % g_regionsize == 0); - assert (size % g_pagesize == 0); - /* Allocate this */ - ptr = VirtualAlloc (ptr, size, - MEM_RESERVE | MEM_COMMIT | MEM_TOP_DOWN, PAGE_READWRITE); - if (! ptr) { - ptr = (void *) MORECORE_FAILURE; - goto mmap_exit; - } - /* Assert postconditions */ - assert ((unsigned) ptr % g_regionsize == 0); -#ifdef TRACE - printf ("Commit %p %ld\n", ptr, size); -#endif -mmap_exit: -#if defined (USE_MALLOC_LOCK) && defined (NEEDED) - /* Release spin lock */ - slrelease (&g_sl); -#endif - return ptr; -} - -/* munmap for windows */ -static long munmap (void *ptr, long size) { - static long g_pagesize; - static long g_regionsize; - int rc = MUNMAP_FAILURE; -#ifdef TRACE - printf ("munmap %p %ld\n", ptr, size); -#endif -#if defined (USE_MALLOC_LOCK) && defined (NEEDED) - /* Wait for spin lock */ - slwait (&g_sl); -#endif - /* First time initialization */ - if (! g_pagesize) - g_pagesize = getpagesize (); - if (! g_regionsize) - g_regionsize = getregionsize (); - /* Assert preconditions */ - assert ((unsigned) ptr % g_regionsize == 0); - assert (size % g_pagesize == 0); - /* Free this */ - if (! VirtualFree (ptr, 0, - MEM_RELEASE)) - goto munmap_exit; - rc = 0; -#ifdef TRACE - printf ("Release %p %ld\n", ptr, size); -#endif -munmap_exit: -#if defined (USE_MALLOC_LOCK) && defined (NEEDED) - /* Release spin lock */ - slrelease (&g_sl); -#endif - return rc; -} - -static void vminfo (unsigned long *free, unsigned long *reserved, unsigned long *committed) { - MEMORY_BASIC_INFORMATION memory_info; - memory_info.BaseAddress = 0; - *free = *reserved = *committed = 0; - while (VirtualQuery (memory_info.BaseAddress, &memory_info, sizeof (memory_info))) { - switch (memory_info.State) { - case MEM_FREE: - *free += memory_info.RegionSize; - break; - case MEM_RESERVE: - *reserved += memory_info.RegionSize; - break; - case MEM_COMMIT: - *committed += memory_info.RegionSize; - break; - } - memory_info.BaseAddress = (char *) memory_info.BaseAddress + memory_info.RegionSize; - } -} - -static int cpuinfo (int whole, unsigned long *kernel, unsigned long *user) { - if (whole) { - __int64 creation64, exit64, kernel64, user64; - int rc = GetProcessTimes (GetCurrentProcess (), - (FILETIME *) &creation64, - (FILETIME *) &exit64, - (FILETIME *) &kernel64, - (FILETIME *) &user64); - if (! rc) { - *kernel = 0; - *user = 0; - return FALSE; - } - *kernel = (unsigned long) (kernel64 / 10000); - *user = (unsigned long) (user64 / 10000); - return TRUE; - } else { - __int64 creation64, exit64, kernel64, user64; - int rc = GetThreadTimes (GetCurrentThread (), - (FILETIME *) &creation64, - (FILETIME *) &exit64, - (FILETIME *) &kernel64, - (FILETIME *) &user64); - if (! rc) { - *kernel = 0; - *user = 0; - return FALSE; - } - *kernel = (unsigned long) (kernel64 / 10000); - *user = (unsigned long) (user64 / 10000); - return TRUE; - } -} - -#endif /* WIN32 */ - -/* ------------------------------------------------------------ -History: - - V2.7.0 Sun Mar 11 14:14:06 2001 Doug Lea (dl at gee) - * Introduce independent_comalloc and independent_calloc. - Thanks to Michael Pachos for motivation and help. - * Make optional .h file available - * Allow > 2GB requests on 32bit systems. - * new WIN32 sbrk, mmap, munmap, lock code from <Walter@GeNeSys-e.de>. - Thanks also to Andreas Mueller <a.mueller at paradatec.de>, - and Anonymous. - * Allow override of MALLOC_ALIGNMENT (Thanks to Ruud Waij for - helping test this.) - * memalign: check alignment arg - * realloc: don't try to shift chunks backwards, since this - leads to more fragmentation in some programs and doesn't - seem to help in any others. - * Collect all cases in malloc requiring system memory into sYSMALLOc - * Use mmap as backup to sbrk - * Place all internal state in malloc_state - * Introduce fastbins (although similar to 2.5.1) - * Many minor tunings and cosmetic improvements - * Introduce USE_PUBLIC_MALLOC_WRAPPERS, USE_MALLOC_LOCK - * Introduce MALLOC_FAILURE_ACTION, MORECORE_CONTIGUOUS - Thanks to Tony E. Bennett <tbennett@nvidia.com> and others. - * Include errno.h to support default failure action. - - V2.6.6 Sun Dec 5 07:42:19 1999 Doug Lea (dl at gee) - * return null for negative arguments - * Added Several WIN32 cleanups from Martin C. Fong <mcfong at yahoo.com> - * Add 'LACKS_SYS_PARAM_H' for those systems without 'sys/param.h' - (e.g. WIN32 platforms) - * Cleanup header file inclusion for WIN32 platforms - * Cleanup code to avoid Microsoft Visual C++ compiler complaints - * Add 'USE_DL_PREFIX' to quickly allow co-existence with existing - memory allocation routines - * Set 'malloc_getpagesize' for WIN32 platforms (needs more work) - * Use 'assert' rather than 'ASSERT' in WIN32 code to conform to - usage of 'assert' in non-WIN32 code - * Improve WIN32 'sbrk()' emulation's 'findRegion()' routine to - avoid infinite loop - * Always call 'fREe()' rather than 'free()' - - V2.6.5 Wed Jun 17 15:57:31 1998 Doug Lea (dl at gee) - * Fixed ordering problem with boundary-stamping - - V2.6.3 Sun May 19 08:17:58 1996 Doug Lea (dl at gee) - * Added pvalloc, as recommended by H.J. Liu - * Added 64bit pointer support mainly from Wolfram Gloger - * Added anonymously donated WIN32 sbrk emulation - * Malloc, calloc, getpagesize: add optimizations from Raymond Nijssen - * malloc_extend_top: fix mask error that caused wastage after - foreign sbrks - * Add linux mremap support code from HJ Liu - - V2.6.2 Tue Dec 5 06:52:55 1995 Doug Lea (dl at gee) - * Integrated most documentation with the code. - * Add support for mmap, with help from - Wolfram Gloger (Gloger@lrz.uni-muenchen.de). - * Use last_remainder in more cases. - * Pack bins using idea from colin@nyx10.cs.du.edu - * Use ordered bins instead of best-fit threshhold - * Eliminate block-local decls to simplify tracing and debugging. - * Support another case of realloc via move into top - * Fix error occuring when initial sbrk_base not word-aligned. - * Rely on page size for units instead of SBRK_UNIT to - avoid surprises about sbrk alignment conventions. - * Add mallinfo, mallopt. Thanks to Raymond Nijssen - (raymond@es.ele.tue.nl) for the suggestion. - * Add `pad' argument to malloc_trim and top_pad mallopt parameter. - * More precautions for cases where other routines call sbrk, - courtesy of Wolfram Gloger (Gloger@lrz.uni-muenchen.de). - * Added macros etc., allowing use in linux libc from - H.J. Lu (hjl@gnu.ai.mit.edu) - * Inverted this history list - - V2.6.1 Sat Dec 2 14:10:57 1995 Doug Lea (dl at gee) - * Re-tuned and fixed to behave more nicely with V2.6.0 changes. - * Removed all preallocation code since under current scheme - the work required to undo bad preallocations exceeds - the work saved in good cases for most test programs. - * No longer use return list or unconsolidated bins since - no scheme using them consistently outperforms those that don't - given above changes. - * Use best fit for very large chunks to prevent some worst-cases. - * Added some support for debugging - - V2.6.0 Sat Nov 4 07:05:23 1995 Doug Lea (dl at gee) - * Removed footers when chunks are in use. Thanks to - Paul Wilson (wilson@cs.texas.edu) for the suggestion. - - V2.5.4 Wed Nov 1 07:54:51 1995 Doug Lea (dl at gee) - * Added malloc_trim, with help from Wolfram Gloger - (wmglo@Dent.MED.Uni-Muenchen.DE). - - V2.5.3 Tue Apr 26 10:16:01 1994 Doug Lea (dl at g) - - V2.5.2 Tue Apr 5 16:20:40 1994 Doug Lea (dl at g) - * realloc: try to expand in both directions - * malloc: swap order of clean-bin strategy; - * realloc: only conditionally expand backwards - * Try not to scavenge used bins - * Use bin counts as a guide to preallocation - * Occasionally bin return list chunks in first scan - * Add a few optimizations from colin@nyx10.cs.du.edu - - V2.5.1 Sat Aug 14 15:40:43 1993 Doug Lea (dl at g) - * faster bin computation & slightly different binning - * merged all consolidations to one part of malloc proper - (eliminating old malloc_find_space & malloc_clean_bin) - * Scan 2 returns chunks (not just 1) - * Propagate failure in realloc if malloc returns 0 - * Add stuff to allow compilation on non-ANSI compilers - from kpv@research.att.com - - V2.5 Sat Aug 7 07:41:59 1993 Doug Lea (dl at g.oswego.edu) - * removed potential for odd address access in prev_chunk - * removed dependency on getpagesize.h - * misc cosmetics and a bit more internal documentation - * anticosmetics: mangled names in macros to evade debugger strangeness - * tested on sparc, hp-700, dec-mips, rs6000 - with gcc & native cc (hp, dec only) allowing - Detlefs & Zorn comparison study (in SIGPLAN Notices.) - - Trial version Fri Aug 28 13:14:29 1992 Doug Lea (dl at g.oswego.edu) - * Based loosely on libg++-1.2X malloc. (It retains some of the overall - structure of old version, but most details differ.) - -*/ diff --git a/dependencies/Common/src/shmem/segbasemap.cc b/dependencies/Common/src/shmem/segbasemap.cc deleted file mode 100644 index b613617c61dc63c3e1b24ff33f531f98363ac1d5..0000000000000000000000000000000000000000 --- a/dependencies/Common/src/shmem/segbasemap.cc +++ /dev/null @@ -1,73 +0,0 @@ -//# segbasemap.cc -//# -//# Copyright (C) 2002-2004 -//# ASTRON (Netherlands Institute for Radio Astronomy) -//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands -//# -//# This file is part of the LOFAR software suite. -//# The LOFAR software suite 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 3 of the License, or -//# (at your option) any later version. -//# -//# The LOFAR software suite 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 the LOFAR software suite. If not, see <http://www.gnu.org/licenses/>. -//# -//# $Id$ - -//# Always #include <lofar_config.h> first! -#include <lofar_config.h> - -#include <Common/shmem/segbasemap.h> -#include <Common/lofar_map.h> -#include <stdio.h> -#include <stdlib.h> - -using LOFAR::map; - -/* sorted list of segment base addresses */ -static map<void*, void*> segbase; - -/** - * ~shm_segbasemap_find - * - * Find the base address of the segment in which this address lies - * - */ -void* shm_segbasemap_find(void* address) -{ - map<void*, void*>::const_iterator it; - void* prev_base_address = 0; - void* base_address = 0; - - if (segbase.begin() == segbase.end()) - { - fprintf(stderr, "shm_segbasemap_find: map empty!"); - exit(1); - } - - for (it = segbase.begin(); it != segbase.end(); ++it) - { - if (address < it->first) break; - prev_base_address = it->first; - base_address = prev_base_address; - } - - return base_address; -} - -/** - * ~shm_segbasemap_add - * - * Add the segment base address to the segbase map. - */ -void shm_segbasemap_add(void* base) -{ - segbase[base] = base; -} - diff --git a/dependencies/Common/src/shmem/shmem_alloc.cc b/dependencies/Common/src/shmem/shmem_alloc.cc deleted file mode 100644 index 26ccff122696e27be544882f437dc04f6c99822f..0000000000000000000000000000000000000000 --- a/dependencies/Common/src/shmem/shmem_alloc.cc +++ /dev/null @@ -1,465 +0,0 @@ -//# shmem_alloc.cc -//# -//# Copyright (C) 2002 -//# ASTRON (Netherlands Institute for Radio Astronomy) -//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands -//# -//# This file is part of the LOFAR software suite. -//# The LOFAR software suite 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 3 of the License, or -//# (at your option) any later version. -//# -//# The LOFAR software suite 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 the LOFAR software suite. If not, see <http://www.gnu.org/licenses/>. -//# -//# $Id$ - -//# Always #include <lofar_config.h> first! -#include <lofar_config.h> - -#include <Common/shmem/shmem_alloc.h> -#include <Common/shmem/segbasemap.h> -#include <stdlib.h> -#include <sys/types.h> -#include <sys/ipc.h> -#include <sys/shm.h> -#include <sys/sem.h> -#include <sys/wait.h> -#include <assert.h> -#include <stdio.h> -#include <signal.h> -#include <sched.h> -#include <unistd.h> -#include <Common/lofar_map.h> - -using LOFAR::map; - -#if not(defined(_LIBCPP_VERSION)) -// needs to be defined -union semun { - int val; -}; -#endif - -/* definitions */ -#define SHMID_REGISTRY_INITIAL_SIZE 32 -#define MORECORE_FAILURE (-1) - -/* local typedefs */ - -typedef struct -{ - int id; - char* segment_address; - int size; -} t_shmem_chunk; - -typedef struct -{ - int used; - int size; - t_shmem_chunk* chunks; -} t_shmid_registry; - -typedef struct -{ - int shmid; -} t_shmem_segment_header; - -/* module private variables */ -static t_shmid_registry shmid_registry = { 0, 0, NULL }; -static pid_t shmem_mypid = 0; - -/* segment attachment cache */ -static map<int, char*> segcache; - -/* local prototypes */ -static void shmid_registry_add(t_shmid_registry* sr, - int id, void* segment_address, int size); -static void* shmid_registry_get_next_address(t_shmid_registry* sr); -static void shmid_registry_clean(void); -static void shmem_signal_handler(int sig); - -/** - * ~shmbrk - * - * Replacement of sbrk to allocate a chunk of shared memory. - * - */ -void* shmbrk(int size) -{ - int shmid; - char* segment_address = (char*)MORECORE_FAILURE; - t_shmem_segment_header* hdr = (t_shmem_segment_header*)NULL; - - assert(size >= 0); - - if (size > 0) - { - /* get a shared memory segment of the requested size */ - shmid = shmget(IPC_PRIVATE, size, SHM_R | SHM_W | IPC_CREAT | IPC_EXCL); - - if (shmid != -1) - { - /* attach to the new segment */ - if ((segment_address = (char*)shmat(shmid, 0, 0)) == (char*)-1) - { - /* could not attach, remove segment, ignore return value */ - (void)shmctl(shmid, IPC_RMID, 0); - segment_address = (char*)MORECORE_FAILURE; - } - else - { - /* add to the shmid_registry */ - shm_segbasemap_add(segment_address); - shmid_registry_add(&shmid_registry, - shmid, segment_address, size); - } - } - - if ((void*)MORECORE_FAILURE == segment_address) - { - perror("shmbrk"); - } - else - { - /* - * Put shmid in first four bytes of segment and - * increment address with 2 * sizeof(size_t) for correct - * alignment although this is more than needed. This is - * needed to be able to find out in which segment - * allocation has occured. - */ - hdr = (t_shmem_segment_header*)segment_address; - hdr->shmid = shmid; - - assert(sizeof(t_shmem_segment_header) <= 2*sizeof(size_t)); - segment_address += 2*sizeof(size_t); - } - } - else if (size == 0) - { - /* If size == 0 then return address just after previously - * returned address. dlmalloc uses this to determine size - * of previously allocated chunk. - */ - segment_address = (char*)shmid_registry_get_next_address(&shmid_registry); - } - -#if 0 - printf("shmbrk(%d) = %p\n", size, segment_address); -#endif - - return (void*)segment_address; -} - -/** - * ~shmem_init - * - * Initialize shmid_registry - * - */ -void shmem_init(void) -{ - shmid_registry.used = 0; - shmid_registry.size = SHMID_REGISTRY_INITIAL_SIZE; - shmid_registry.chunks = - (t_shmem_chunk*)malloc(SHMID_REGISTRY_INITIAL_SIZE*sizeof(t_shmem_chunk)); - - atexit(&shmid_registry_clean); - - signal(SIGINT, shmem_signal_handler); - signal(SIGQUIT, shmem_signal_handler); - signal(SIGSEGV, shmem_signal_handler); - - /* remember my pid */ - shmem_mypid = getpid(); -} - -/** - * ~shmem_id - * - * Obtain the shmid for the allocated block of memory at - * address. This is done by first finding the base address - * of the shared memory segment in which this block is allocated - * and then finding the shmid stored at that address. - * - */ -int shmem_id(void* address) -{ - t_shmem_segment_header* hdrptr = NULL; - char* segment_address_ptr = NULL; - - assert(NULL != address); - - segment_address_ptr = (char*)address - (2*sizeof(size_t)); - hdrptr = (t_shmem_segment_header*)(*(void**)segment_address_ptr); - - return hdrptr->shmid; -} - -/** - * ~shmem_offset - * - * Get offset of this malloced block within the segment - * in which it is allocated. - * - */ -size_t shmem_offset(void* address) -{ - char* segment_address_ptr = NULL; - - assert(NULL != address); - - segment_address_ptr = (char*)address - (2*sizeof(size_t)); - - return ((char*)address - (char*)(*(void**)segment_address_ptr)); -} - -/** - * ~shmem_connect - * - * Connect to an existing shared memory segment at - * a specific offset. - * - */ -void* shmem_connect(int shmid, size_t offset) -{ - char* segment = NULL; - - // find in cache - if (segcache.end() != segcache.find(shmid)) - { - // found! - segment = segcache[shmid]; - } - else - { - if ((segment = (char*)shmat(shmid, 0, SHM_R | SHM_W)) == (void*)-1) - { - perror("shmem_connect"); - segment = NULL; - } - else - { - // add to cache - segcache[shmid] = segment; - } - } - - return (segment?segment+offset:segment); -} - -/** - * ~shmem_disconnect - * - * Disconnect from shared memory segment. - * - */ -void shmem_disconnect(void* segment, size_t offset) -{ - if (shmdt((char*)segment - offset) < 0) - { - perror("shmem_disconnect"); - } -} - -/** - * ~shmid_registry_add - * - * Add a shmid to the shmid registry which keeps track of all - * shmid's to allow cleanup at program exit. - * - */ -static void shmid_registry_add(t_shmid_registry* sr, - int id, void* segment_address, int size) -{ - assert((NULL != sr) && (sr->size > 0)); - if (sr->used >= sr->size) - { - /* need to enlarge the registry, lets double size */ - sr->size *= 2; - sr->chunks = (t_shmem_chunk*)realloc(sr->chunks, - sr->size*sizeof(t_shmem_chunk)); - } - - sr->chunks[sr->used].id = id; - sr->chunks[sr->used].segment_address = (char*)segment_address; - sr->chunks[sr->used].size = size; - sr->used++; -} - -/** - * ~shmid_registry_get_next_address - * - * return base address of current chunk incremented by size - * - */ -static void* shmid_registry_get_next_address(t_shmid_registry* sr) -{ - char* address = (char*)MORECORE_FAILURE; - - if (NULL != sr->chunks) - { - address = ( sr->chunks[sr->used-1].segment_address - + sr->chunks[sr->used-1].size); - } - - return (void*)address; -} - -/** - * ~shmid_registry_clean - * - * Clean up all shared memory segments that have been allocated. - */ -static void shmid_registry_clean(void) -{ - int i; - t_shmem_chunk* chunks = shmid_registry.chunks; - - if (NULL == chunks) return; - - for (i = 0; i < shmid_registry.used; i++) - { - if (shmctl(chunks[i].id, IPC_RMID, 0) == -1) - { - perror("IPC_RMID failure"); - } - } - - shmid_registry.used = 0; - shmid_registry.size = 0; - free(shmid_registry.chunks); - shmid_registry.chunks = NULL; -} - -/** - * ~shmem_signal_handler - * - * This function is called when a signal is received - * and the shared memory segments need to be cleaned up. - * - */ -static void shmem_signal_handler(int sig) -{ - // keep compiler happy - (void)sig; - - shmid_registry_clean(); - exit(1); -} - -#ifndef HAVE_ATOMIC_H -/** - * ~_shmem_lock - * - * Mutex lock routine needed in shmem_cond functions. - * (Gary Peterson algorithm 1979) - * - **/ -static void _shmem_lock(volatile shmem_cond_t* condition) -{ - if (condition->owner == shmem_mypid) - { - condition->thetry[0] = true; - condition->turn = 0; - while ((condition->turn == 0) && condition->thetry[1]) sched_yield(); - } - else - { - condition->thetry[1] = true; - condition->turn = 1; - while ((condition->turn == 1) && condition->thetry[0]) sched_yield(); - } -} - -/** - * ~_shmem_unlock - * - * Mutex unlock routine needed in shmem_cond functions. - * (Gary Peterson algorithm 1979) - * - **/ -static void _shmem_unlock(volatile shmem_cond_t* condition) -{ - if (condition->owner == shmem_mypid) - { - condition->thetry[0] = false; - } - else - { - condition->thetry[1] = false; - } -} -#endif - -/** - * ~shmem_cond_init - * - * Initialize a semaphore (locked) - * - **/ -void shmem_cond_init(volatile shmem_cond_t* condition) -{ -#ifdef HAVE_ATOMIC_H - atomic_set(condition, 0); -#else - condition->owner = shmem_mypid; - condition->thetry[0] = false; - condition->thetry[1] = false; - condition->turn = -1; - - condition->count = 0; -#endif -} - -/** - * ~shmem_cond_signal - * - * Signal on the semaphore (unlock) - * - */ -void shmem_cond_signal(volatile shmem_cond_t* condition) -{ -#ifdef HAVE_ATOMIC_H - atomic_inc(condition); -#else - _shmem_lock(condition); - condition->count++; - _shmem_unlock(condition); -#endif -} - -/** - * ~shmem_cond_wait - * - * Wait on a semaphore (until unlocked) - * - */ -void shmem_cond_wait(volatile shmem_cond_t* condition) -{ -#ifdef HAVE_ATOMIC_H - while (atomic_read(condition) <= 0) sched_yield(); - atomic_dec(condition); -#else - int count = 1; - do { - if (count <= 0) sched_yield(); - _shmem_lock(condition); - count = condition->count; - _shmem_unlock(condition); - } while (count <= 0); - - _shmem_lock(condition); - condition->count--; - _shmem_unlock(condition); -#endif -} - diff --git a/dependencies/Common/test/CMakeLists.txt b/dependencies/Common/test/CMakeLists.txt index c7bad59bd028fd68c932c44f59c361705b8ea64e..1cb9792308f5a90cbc7a7272021ecb2134666f52 100644 --- a/dependencies/Common/test/CMakeLists.txt +++ b/dependencies/Common/test/CMakeLists.txt @@ -7,23 +7,13 @@ lofar_add_test(tBoostBitset tBoostBitset.cc) lofar_add_test(testLogger testLogger.cc) lofar_add_test(tCasaLogSink tCasaLogSink.cc) lofar_add_test(tAllocator tAllocator.cc) -lofar_add_test(tDataConvert tDataConvert.cc) lofar_add_test(tLofarTypedefs tLofarTypedefs.cc) -lofar_add_test(tTypeNames tTypeNames.cc) lofar_add_test(tFileLocator tFileLocator.cc) lofar_add_test(tStringUtil tStringUtil.cc) lofar_add_test(tStreamUtil tStreamUtil.cc) -lofar_add_test(tHexdump tHexdump.cc) -lofar_add_test(tComplex tComplex.cc) -lofar_add_test(tProcess tProcess.cc) -lofar_add_test(tRunOnNode tRunOnNode.cc) lofar_add_test(tTimer tTimer.cc) -lofar_add_test(tMmap tMmap.cc) -lofar_add_test(tNumeric tNumeric.cc) lofar_add_test(tNsTimestamp tNsTimestamp.cc) lofar_add_test(tKVpair tKVpair.cc) -lofar_add_test(tSingleton tSingleton.cc) -lofar_add_test(tObjectFactory tObjectFactory.cc Shapes.cc Coordinates.cc) lofar_add_test(tSystemUtil tSystemUtil.cc) lofar_add_test(tPrettyUnits tPrettyUnits.cc) lofar_add_test(tParameterValue tParameterValue.cc) @@ -31,10 +21,8 @@ lofar_add_test(tParameterRecord tParameterRecord.cc) lofar_add_test(tParameterSet tParameterSet.cc) lofar_add_test(tParameterSetMT tParameterSetMT.cc) lofar_add_test(tParameterSetPerf tParameterSetPerf.cc) -lofar_add_test(tInputParSet tInputParSet.cc) lofar_add_test(tgetparsetvalue DEPENDS getparsetvalue) #lofar_add_test(tBacktrace tBacktrace.cc) -lofar_add_test(tReadLine tReadLine.cc) lofar_add_test(tThread tThread.cc) lofar_add_test(tMutex tMutex.cc) lofar_add_test(tCondition tCondition.cc) diff --git a/dependencies/Common/test/Coordinates.cc b/dependencies/Common/test/Coordinates.cc deleted file mode 100644 index e5730af3310318e4145971b0a2877ad2d0e3a84f..0000000000000000000000000000000000000000 --- a/dependencies/Common/test/Coordinates.cc +++ /dev/null @@ -1,70 +0,0 @@ -//# Coordinates.cc: Implementation of Coordinates used by ObjectFactory test -//# program. -//# -//# Copyright (C) 2006 -//# ASTRON (Netherlands Institute for Radio Astronomy) -//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands -//# -//# This file is part of the LOFAR software suite. -//# The LOFAR software suite 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 3 of the License, or -//# (at your option) any later version. -//# -//# The LOFAR software suite 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 the LOFAR software suite. If not, see <http://www.gnu.org/licenses/>. -//# -//# $Id$ - -//# Always #include <lofar_config.h> first! -#include <lofar_config.h> - -//# Includes -#include "Coordinates.h" -#include <Common/lofar_iostream.h> - -namespace LOFAR -{ - // Use an anonymous namespace. This ensures that variables declared inside - // it get there own private storage area and are only visible in this - // compilation unit. - namespace - { - // Forces the classes to be registered during static initialization. - // We don't care about the resturn value; maybe we should ;-) - bool dummy = - CoordinateFactory::instance().registerClass<Cartesian>("Cartesian") - && CoordinateFactory::instance().registerClass<Cylindrical>("Cylindrical") - && CoordinateFactory::instance().registerClass<Spherical>("Spherical"); - } - - void Cartesian::print(ostream& os) const - { - os << "Cartesian: (x, y, z) = (" - << itsX << ", " << itsY << ", " << itsZ << ")"; - } - - void Cylindrical::print(ostream& os) const - { - os << "Cylindrical: (r, theta, z) = (" - << itsR << ", " << itsTheta << ", " << itsZ << ")"; - } - - void Spherical::print(ostream& os) const - { - os << "Spherical: (r, theta, phi) = (" - << itsR << ", " << itsTheta << ", " << itsPhi << ")"; - } - - ostream& operator<<(ostream& os, const Coordinate& s) - { - s.print(os); - return os; - } - -} diff --git a/dependencies/Common/test/Coordinates.h b/dependencies/Common/test/Coordinates.h deleted file mode 100644 index ba0104ae8b3cfa47477b065f0bbdeab213360dee..0000000000000000000000000000000000000000 --- a/dependencies/Common/test/Coordinates.h +++ /dev/null @@ -1,82 +0,0 @@ -//# Coordinates.h: Declaration of Coordinates used by ObjectFactory test -//# program. -//# -//# Copyright (C) 2006 -//# ASTRON (Netherlands Institute for Radio Astronomy) -//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands -//# -//# This file is part of the LOFAR software suite. -//# The LOFAR software suite 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 3 of the License, or -//# (at your option) any later version. -//# -//# The LOFAR software suite 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 the LOFAR software suite. If not, see <http://www.gnu.org/licenses/>. -//# -//# $Id$ - -#ifndef LOFAR_COMMON_TEST_COORDINATES_H -#define LOFAR_COMMON_TEST_COORDINATES_H - -#include <Common/lofar_iosfwd.h> -#include <Common/lofar_string.h> -#include <Common/Singleton.h> -#include <Common/ObjectFactory.h> - -namespace LOFAR -{ - // Forward declarations - class Coordinate; - typedef Singleton< ObjectFactory<Coordinate*(double, double, double), string> > CoordinateFactory; - - // Base class of coordinates used by the ObjectFactory - class Coordinate - { - public: - virtual ~Coordinate() {} - virtual void print(ostream& os) const = 0; - }; - - // Cartesian coordinates - class Cartesian : public Coordinate - { - public: - Cartesian(double x, double y, double z) : - itsX(x), itsY(y), itsZ(z) {} - virtual void print(ostream& os) const; - private: - double itsX, itsY, itsZ; - }; - - // Cylindrical coordinates - class Cylindrical : public Coordinate - { - public: - Cylindrical(double r, double theta, double z) : - itsR(r), itsTheta(theta), itsZ(z) {} - virtual void print(ostream& os) const; - private: - double itsR, itsTheta, itsZ; - }; - - // Spherical coordinates - class Spherical : public Coordinate - { - public: - Spherical(double r, double theta, double phi) : - itsR(r), itsTheta(theta), itsPhi(phi) {} - virtual void print(ostream& os) const; - private: - double itsR, itsTheta, itsPhi; - }; - - ostream& operator<<(ostream& os, const Coordinate& s); -} - -#endif diff --git a/dependencies/Common/test/Shapes.cc b/dependencies/Common/test/Shapes.cc deleted file mode 100644 index 26a815120031f96f2eea2bf402168bb3f8c8008f..0000000000000000000000000000000000000000 --- a/dependencies/Common/test/Shapes.cc +++ /dev/null @@ -1,72 +0,0 @@ -//# Shapes.cc: Implementation of Shapes used by ObjectFactory test program. -//# -//# Copyright (C) 2006 -//# ASTRON (Netherlands Institute for Radio Astronomy) -//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands -//# -//# This file is part of the LOFAR software suite. -//# The LOFAR software suite 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 3 of the License, or -//# (at your option) any later version. -//# -//# The LOFAR software suite 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 the LOFAR software suite. If not, see <http://www.gnu.org/licenses/>. -//# -//# $Id$ - -//# Always #include <lofar_config.h> first! -#include <lofar_config.h> - -//# Includes -#include "Shapes.h" -#include <Common/lofar_iostream.h> - -namespace LOFAR -{ - // Use an anonymous namespace. This ensures that variables declared inside - // it get there own private storage area and are only visible in this - // compilation unit. - namespace - { - // Forces the classes to be registered during static initialization. - // We don't care about the resturn value; maybe we should ;-) - bool dummy = - ShapeFactory::instance().registerClass<Rectangle> ("Rectangle") - && ShapeFactory::instance().registerClass<Square> ("Square") - && ShapeFactory::instance().registerClass<Ellipse>("Ellipse") - && ShapeFactory::instance().registerClass<Circle> ("Circle"); - } - - void Rectangle::print(ostream& os) const - { - os << "Rectangle"; - } - - void Square::print(ostream& os) const - { - os << "Square"; - } - - void Ellipse::print(ostream& os) const - { - os << "Ellipse"; - } - - void Circle::print(ostream& os) const - { - os << "Circle"; - } - - ostream& operator<<(ostream& os, const Shape& s) - { - s.print(os); - return os; - } - -} diff --git a/dependencies/Common/test/Shapes.h b/dependencies/Common/test/Shapes.h deleted file mode 100644 index 6701c4cd66c84dfcf2b0901e65d7ca9702ae231d..0000000000000000000000000000000000000000 --- a/dependencies/Common/test/Shapes.h +++ /dev/null @@ -1,78 +0,0 @@ -//# Shapes.h: Declaration of Shapes used by ObjectFactory test program. -//# -//# Copyright (C) 2006 -//# ASTRON (Netherlands Institute for Radio Astronomy) -//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands -//# -//# This file is part of the LOFAR software suite. -//# The LOFAR software suite 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 3 of the License, or -//# (at your option) any later version. -//# -//# The LOFAR software suite 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 the LOFAR software suite. If not, see <http://www.gnu.org/licenses/>. -//# -//# $Id$ - -#ifndef LOFAR_COMMON_TEST_SHAPES_H -#define LOFAR_COMMON_TEST_SHAPES_H - -#include <Common/lofar_iosfwd.h> -#include <Common/lofar_string.h> -#include <Common/Singleton.h> -#include <Common/ObjectFactory.h> - -namespace LOFAR -{ - // Forward declarations - class Shape; -// template <typename T> class Singleton; -// template <typename Signature, typename TypeId> class ObjectFactory; - typedef Singleton< ObjectFactory<Shape*(), string> > ShapeFactory; - - // Base class of shapes used by the ObjectFactory - class Shape - { - public: - virtual ~Shape() {} - virtual void print(ostream& os) const = 0; - }; - - // Rectangle - class Rectangle : public Shape - { - public: - virtual void print(ostream& os) const; - }; - - // Square - class Square : public Rectangle - { - public: - virtual void print(ostream& os) const; - }; - - // Ellipse - class Ellipse : public Shape - { - public: - virtual void print(ostream& os) const; - }; - - // Circle - class Circle : public Ellipse - { - public: - virtual void print(ostream& os) const; - }; - - ostream& operator<<(ostream& os, const Shape& s); -} - -#endif diff --git a/dependencies/Common/test/tComplex.cc b/dependencies/Common/test/tComplex.cc deleted file mode 100644 index 72e2ec1c50843453b3546bf55b4d505db235b0ae..0000000000000000000000000000000000000000 --- a/dependencies/Common/test/tComplex.cc +++ /dev/null @@ -1,467 +0,0 @@ -//# tComplex.cc: Test program for complex performance -//# -//# Copyright (C) 2005 -//# ASTRON (Netherlands Institute for Radio Astronomy) -//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands -//# -//# This file is part of the LOFAR software suite. -//# The LOFAR software suite 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 3 of the License, or -//# (at your option) any later version. -//# -//# The LOFAR software suite 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 the LOFAR software suite. If not, see <http://www.gnu.org/licenses/>. -//# -//# $Id$ - -//# Always #include <lofar_config.h> first! -#include <lofar_config.h> - -#include <Common/lofar_complex.h> -#include <complex> -#include <Common/Timer.h> - -#if defined __SSE2__ -#include <xmmintrin.h> -#include <emmintrin.h> -#endif - -using namespace std; -using namespace LOFAR; -using namespace LOFAR::TYPES; - - -inline complex<double> makedblcomplex(double re, double im) - { return complex<double>(re,im); } -#define MAKEDBLCOMPLEX(re,im) complex<double>(re,im) - - -// Define a class holding the builtin complex type. -class mdcomplex -{ -public: - mdcomplex() : itsValue(makedcomplex(0,0)) {} - mdcomplex(double re, double im) : itsValue(makedcomplex(re,im)) {} - // Should be - // mdcomplex(dcomplex val): itsValue(val) {} - // but that causes an internal compiler error on bgfen0 - mdcomplex(dcomplex val) { itsValue = val; } - mdcomplex operator* (const mdcomplex that) {return mdcomplex(itsValue*that.itsValue);} - friend mdcomplex conj (const mdcomplex that) {return mdcomplex(LOFAR::conj(that.itsValue));} -private: - dcomplex itsValue; -}; - - -// Check if the complex operations give correct results. -void check() -{ - { - complex<double> c1(1,2), c2(3,4); - cout << c1 << c2 << endl; - cout << c1*c2 << c1+c2 << c1-c2 << conj(c1*c2) << c1/c2 << endl; - cout << sin(c1) << endl; - } - { - dcomplex c1a (makedcomplex(1,2)); - dcomplex c1b (makedcomplex(4,5)); - dcomplex c1c = makedcomplex(6,7); - dcomplex c1d (makedcomplex(7,8)); - cout << c1a << c1b << c1c << c1d << endl; - complex<double> cc1(1,2); - complex<double> cc2(makedblcomplex(3,4)); - dcomplex c1 = *(dcomplex*)(&cc1); - dcomplex c2 = *(dcomplex*)(&cc2); - // dcomplex c2 = 3+4i; - cout << c1 << c2 << endl; - dcomplex cc; - cc = LOFAR::conj(c1*c2); - cout << c1*c2 << c1+c2 << c1-c2 << cc << c1/c2 << endl; - cout << sin(c1) << endl; - - u16complex u1a (makeu16complex(10,20)); - cout << u1a << endl; - } -} - -void* allocDCArray (double*& ptr, int nrdc) -{ - // Allocate an array of complex of doubles, - // Take care it is aligned on 16 byte boundary (for the SSE instructions). - ptr = new double[2*nrdc+1]; - double* ptr1 = ptr; - // Make sure data is on 16-byte boundary. - if ((ptrdiff_t)(ptr1) & 0x000F) ptr1++; - return ptr1; -} - -void* allocDCArray (double*& ptr, int nrdc, complex<double> v) -{ - double* ptr1 = static_cast<double*>(allocDCArray(ptr, nrdc)); - for (int i=0; i<2*nrdc; i+=2) { - ptr1[i] = real(v); - ptr1[i+1] = imag(v); - } - return ptr1; -} - -void freeDCArray (double* ptr) -{ - delete [] ptr; -} - -void checkDCArray (const void* ptr, int nrdc, complex<double> v) -{ - const complex<double>* arr = static_cast<const complex<double>*>(ptr); - for (int i=0; i<nrdc; ++i) { - if (arr[i] != v) { - cout << i << " found=" << arr[i] << " expected=" << v << endl; - } - } -} - -int main (int argc, const char* argv[]) -{ - check(); - int nriter = 1; - int nrval = 1001; - if (argc > 1) { - istringstream istr(argv[1]); - istr >> nriter; - } - if (argc > 2) { - istringstream istr(argv[2]); - istr >> nrval; - } - cout << "nriter=" << nriter << " nrval=" << nrval << endl; - cout << ">>>" << endl; - - const complex<double> v1(1,2); - const complex<double> v2(3,4); - { - // Test filling of std::complex using macro. - complex<double>* arr1 = new complex<double>[nrval]; - { - NSTimer timer("std::complex fi"); - timer.start(); - for (int j=0; j<nriter; ++j) { - for (int i=0; i<nrval; ++i) { - arr1[i] = MAKEDBLCOMPLEX(i,i); - } - } - timer.stop(); - timer.print (cout); - } - delete[] arr1; - } - { - // Test filling of std::complex using inline function. - complex<double>* arr1 = new complex<double>[nrval]; - { - NSTimer timer("std::complex ff"); - timer.start(); - for (int j=0; j<nriter; ++j) { - for (int i=0; i<nrval; ++i) { - arr1[i] = makedblcomplex (i,i); - } - } - timer.stop(); - timer.print (cout); - } - delete[] arr1; - } - { - // Test filling of builtin complex using macro. - dcomplex* arr1 = new dcomplex[nrval]; - { - NSTimer timer("dcomplex mfill "); - timer.start(); - for (int j=0; j<nriter; ++j) { - for (int i=0; i<nrval; ++i) { - arr1[i] = makedcomplex (i,i); - } - } - timer.stop(); - timer.print (cout); - } - delete[] arr1; - } - { - // Test filling of dcomplex (usually builtin) using inline function. - dcomplex* arr1 = new dcomplex[nrval]; - { - NSTimer timer("dcomplex ffill "); - timer.start(); - for (int j=0; j<nriter; ++j) { - for (int i=0; i<nrval; ++i) { - arr1[i] = makedcomplex (i,i); - } - } - timer.stop(); - timer.print (cout); - } - delete[] arr1; - } - { - // Test multiplication of std::complex. - typedef complex<double> MyComplex; - double *ptr1, *ptr2, *ptr3; - MyComplex* arr1 = static_cast<MyComplex*>(allocDCArray(ptr1, nrval, v1)); - MyComplex* arr2 = static_cast<MyComplex*>(allocDCArray(ptr2, nrval, v2)); - MyComplex* arr3 = static_cast<MyComplex*>(allocDCArray(ptr3, nrval)); - { - NSTimer timer("std::complex * "); - timer.start(); - for (int j=0; j<nriter; ++j) { - for (int i=0; i<nrval; ++i) { - arr3[i] = arr1[i] * arr2[i]; - } - } - timer.stop(); - timer.print (cout); - checkDCArray (arr3, nrval, v1*v2); - } - { - NSTimer timer("std::complex *~"); - timer.start(); - for (int j=0; j<nriter; ++j) { - for (int i=0; i<nrval; ++i) { - arr3[i] = arr1[i] * conj(arr2[i]); - } - } - timer.stop(); - timer.print (cout); - checkDCArray (arr3, nrval, v1*conj(v2)); - } - freeDCArray (ptr1); - freeDCArray (ptr2); - freeDCArray (ptr3); - } - { - // Test multiplication of a complex built on top of builtin complex.. - typedef mdcomplex MyComplex; - double *ptr1, *ptr2, *ptr3; - MyComplex* arr1 = static_cast<MyComplex*>(allocDCArray(ptr1, nrval, v1)); - MyComplex* arr2 = static_cast<MyComplex*>(allocDCArray(ptr2, nrval, v2)); - MyComplex* arr3 = static_cast<MyComplex*>(allocDCArray(ptr3, nrval)); - { - NSTimer timer("mdcomplex * "); - timer.start(); - for (int j=0; j<nriter; ++j) { - for (int i=0; i<nrval; ++i) { - arr3[i] = arr1[i] * arr2[i]; - } - } - timer.stop(); - timer.print (cout); - checkDCArray (arr3, nrval, v1*v2); - } -// { -// NSTimer timer("mdcomplex *~ "); -// timer.start(); -// for (int j=0; j<nriter; ++j) { -// for (int i=0; i<nrval; ++i) { -// arr3[i] = arr1[i] * conj(arr2[i])); -// } -// } -// timer.stop(); -// timer.print (cout); -// } - freeDCArray (ptr1); - freeDCArray (ptr2); - freeDCArray (ptr3); - } -#ifdef LOFAR_BUILTIN_COMPLEXFP - { - // Test multiplication of builtin complex. - typedef __complex__ double MyComplex; - double *ptr1, *ptr2, *ptr3; - MyComplex* arr1 = static_cast<MyComplex*>(allocDCArray(ptr1, nrval, v1)); - MyComplex* arr2 = static_cast<MyComplex*>(allocDCArray(ptr2, nrval, v2)); - MyComplex* arr3 = static_cast<MyComplex*>(allocDCArray(ptr3, nrval)); - { - NSTimer timer("_Complex * "); - timer.start(); - for (int j=0; j<nriter; ++j) { - for (int i=0; i<nrval; ++i) { - arr3[i] = arr1[i] * arr2[i]; - } - } - timer.stop(); - timer.print (cout); - checkDCArray (arr3, nrval, v1*v2); - } - { - NSTimer timer("_Complex *~ "); - timer.start(); - for (int j=0; j<nriter; ++j) { - for (int i=0; i<nrval; ++i) { - arr3[i] = arr1[i] * ~arr2[i]; - } - } - timer.stop(); - timer.print (cout); - checkDCArray (arr3, nrval, v1*conj(v2)); - } - freeDCArray (ptr1); - freeDCArray (ptr2); - freeDCArray (ptr3); - } -#endif - { - // Test multiplication of dcomplex. - typedef dcomplex MyComplex; - double *ptr1, *ptr2, *ptr3; - MyComplex* arr1 = static_cast<MyComplex*>(allocDCArray(ptr1, nrval, v1)); - MyComplex* arr2 = static_cast<MyComplex*>(allocDCArray(ptr2, nrval, v2)); - MyComplex* arr3 = static_cast<MyComplex*>(allocDCArray(ptr3, nrval)); - { - NSTimer timer("dcomplex * "); - timer.start(); - for (int j=0; j<nriter; ++j) { - for (int i=0; i<nrval; ++i) { - arr3[i] = arr1[i] * arr2[i]; - } - } - timer.stop(); - timer.print (cout); - checkDCArray (arr3, nrval, v1*v2); - } - { - NSTimer timer("dcomplex *~ "); - timer.start(); - for (int j=0; j<nriter; ++j) { - for (int i=0; i<nrval; ++i) { - arr3[i] = arr1[i] * LOFAR::conj(arr2[i]); - } - } - timer.stop(); - timer.print (cout); - checkDCArray (arr3, nrval, v1*conj(v2)); - } - freeDCArray (ptr1); - freeDCArray (ptr2); - freeDCArray (ptr3); - } - { - double* arr1r = new double[nrval]; - double* arr1i = new double[nrval]; - double* arr2r = new double[nrval]; - double* arr2i = new double[nrval]; - double* arr3r = new double[nrval]; - double* arr3i = new double[nrval]; - for (int i=0; i<nrval; ++i) { - arr1r[i] = real(v1); - arr1i[i] = imag(v1); - arr2r[i] = real(v2); - arr2i[i] = imag(v2); - } - { - NSTimer timer("real,imag * "); - timer.start(); - for (int j=0; j<nriter; ++j) { - for (int i=0; i<nrval; ++i) { - arr3r[i] = arr1r[i] * arr2r[i] - arr1i[i] * arr2i[i]; - arr3i[i] = arr1i[i] * arr2r[i] + arr1r[i] * arr2i[i]; - } - } - timer.stop(); - timer.print (cout); - complex<double> v(arr3r[0], arr3i[0]); - checkDCArray (&v, 1, v1*v2); - } - { - NSTimer timer("real,imag *~ "); - timer.start(); - for (int j=0; j<nriter; ++j) { - for (int i=0; i<nrval; ++i) { - arr3r[i] = arr1r[i] * arr2r[i] + arr1i[i] * arr2i[i]; - arr3i[i] = arr1i[i] * arr2r[i] - arr1r[i] * arr2i[i]; - } - } - timer.stop(); - timer.print (cout); - complex<double> v(arr3r[0], arr3i[0]); - checkDCArray (&v, 1, v1*conj(v2)); - } - delete [] arr1r; - delete [] arr1i; - delete [] arr2r; - delete [] arr2i; - delete [] arr3r; - delete [] arr3i; - } -#if defined __SSE2__ - { - typedef dcomplex MyComplex; - double *ptr1, *ptr2, *ptr3; - MyComplex* arr1 = static_cast<MyComplex*>(allocDCArray(ptr1, nrval, v1)); - MyComplex* arr2 = static_cast<MyComplex*>(allocDCArray(ptr2, nrval, v2)); - MyComplex* arr3 = static_cast<MyComplex*>(allocDCArray(ptr3, nrval)); - { - NSTimer timer("_Complex * SSE "); - timer.start(); - for (int j=0; j<nriter; ++j) { - __m128d *src1 = (__m128d *) arr1; - __m128d *src2 = (__m128d *) arr2; - __m128d *dest = (__m128d *) arr3; - size_t count = nrval - 1; - for (size_t i = 0; i < count; i += 2) { - __m128d ar = _mm_unpacklo_pd(src1[i], src1[i+1]); - __m128d ai = _mm_unpackhi_pd(src1[i], src1[i+1]); - __m128d br = _mm_unpacklo_pd(src2[i], src2[i+1]); - __m128d bi = _mm_unpackhi_pd(src2[i], src2[i+1]); - __m128d cr = _mm_sub_pd(_mm_mul_pd(ar, br), _mm_mul_pd(ai, bi)); - __m128d ci = _mm_add_pd(_mm_mul_pd(ar, bi), _mm_mul_pd(ai, br)); - dest[i] = _mm_unpacklo_pd(cr,ci); - dest[i+1] = _mm_unpackhi_pd(cr,ci); - } - if ((count & 1) == 0) { // uneven array length - arr3[count] = arr1[count] * arr2[count]; - } - } - timer.stop(); - timer.print (cout); - checkDCArray (arr3, nrval, v1*v2); - } - { - NSTimer timer("_Complex *~ SSE"); - timer.start(); - for (int j=0; j<nriter; ++j) { - __m128d *src1 = (__m128d *) arr1; - __m128d *src2 = (__m128d *) arr2; - __m128d *dest = (__m128d *) arr3; - size_t count = nrval - 1; - for (size_t i = 0; i < count; i += 2) { - __m128d ar = _mm_unpacklo_pd(src1[i], src1[i+1]); - __m128d ai = _mm_unpackhi_pd(src1[i], src1[i+1]); - __m128d br = _mm_unpacklo_pd(src2[i], src2[i+1]); - __m128d bi = _mm_unpackhi_pd(src2[i], src2[i+1]); - __m128d cr = _mm_add_pd(_mm_mul_pd(ar, br), _mm_mul_pd(ai, bi)); - __m128d ci = _mm_sub_pd(_mm_mul_pd(br, ai), _mm_mul_pd(bi, ar)); - dest[i] = _mm_unpacklo_pd(cr,ci); - dest[i+1] = _mm_unpackhi_pd(cr,ci); - } - if ((count & 1) == 0) { // uneven array length - arr3[count] = arr1[count] * conj(arr2[count]); - } - } - timer.stop(); - timer.print (cout); - checkDCArray (arr3, nrval, v1*conj(v2)); - } - freeDCArray (ptr1); - freeDCArray (ptr2); - freeDCArray (ptr3); - } -#endif - - cout << "<<<" << endl; - return 0; -} diff --git a/dependencies/Common/test/tComplex.sh b/dependencies/Common/test/tComplex.sh deleted file mode 100755 index 306fc2379a8293734dd7a519145b0b414d099656..0000000000000000000000000000000000000000 --- a/dependencies/Common/test/tComplex.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -./runctest.sh tComplex diff --git a/dependencies/Common/test/tComplex.stdout b/dependencies/Common/test/tComplex.stdout deleted file mode 100644 index 8f157a6ba351f8981ac6c7bb45d6be0ea5495f6c..0000000000000000000000000000000000000000 --- a/dependencies/Common/test/tComplex.stdout +++ /dev/null @@ -1,24 +0,0 @@ -(1,2)(3,4) -(-5,10)(4,6)(-2,-2)(-5,-10)(0.44,0.08) -(3.16578,1.9596) -(1,2)(4,5)(6,7)(7,8) -(1,2)(3,4) -(-5,10)(4,6)(-2,-2)(-5,-10)(0.44,0.08) -(3.16578,1.9596) -(10,20) -nriter=1 nrval=1001 ->>> -std::complex fi : avg = 49 us, total = 49 us, count = 1 -std::complex ff : avg = 76.7 us, total = 76.7 us, count = 1 -dcomplex mfill : avg = 12.5 us, total = 12.5 us, count = 1 -dcomplex ffill : avg = 56.6 us, total = 56.6 us, count = 1 -std::complex * : avg = 144 us, total = 144 us, count = 1 -std::complex *~ : avg = 234 us, total = 234 us, count = 1 -mdcomplex * : avg = 101 us, total = 101 us, count = 1 -_Complex * : avg = 13.7 us, total = 13.7 us, count = 1 -_Complex *~ : avg = 36.1 us, total = 36.1 us, count = 1 -dcomplex * : avg = 15.3 us, total = 15.3 us, count = 1 -dcomplex *~ : avg = 71.6 us, total = 71.6 us, count = 1 -real,imag * : avg = 28 us, total = 28 us, count = 1 -real,imag *~ : avg = 26.9 us, total = 26.9 us, count = 1 -<<< diff --git a/dependencies/Common/test/tDataConvert.cc b/dependencies/Common/test/tDataConvert.cc deleted file mode 100644 index 8cb3c2402fa347bbda0839372724016983b5bdc1..0000000000000000000000000000000000000000 --- a/dependencies/Common/test/tDataConvert.cc +++ /dev/null @@ -1,235 +0,0 @@ -//# tDataConvert.cc: Test program for DataConvert functions -//# -//# Copyright (C) 2003 -//# ASTRON (Netherlands Institute for Radio Astronomy) -//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands -//# -//# This file is part of the LOFAR software suite. -//# The LOFAR software suite 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 3 of the License, or -//# (at your option) any later version. -//# -//# The LOFAR software suite 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 the LOFAR software suite. If not, see <http://www.gnu.org/licenses/>. -//# -//# $Id$ - -//# Always #include <lofar_config.h> first! -#include <lofar_config.h> - - -#include <Common/DataConvert.h> -#include <Common/LofarLogger.h> -#include <iomanip> - -using namespace LOFAR; - -int main() -{ - try { - INIT_LOGGER("tDataConvert"); - { - // Swap 2 byte integer and check if correct. - // Double swapping should give the original. - uint16 v1 = 0xbecd; - uint16 v2 = v1; - ASSERT (byteSwap(byteSwap(v1)) == v2); - byteSwap16 (&v2, &v1, 1); - ASSERT (v2 == 0xcdbe); - } - { - // Swap 4 byte integer and check if correct. - // Double swapping should give the original. - uint32 v1 = 0xbecd0256; - uint32 v2 = v1; - ASSERT (byteSwap(byteSwap(v1)) == v2); - byteSwap32 (&v2, &v1, 1); - ASSERT (v2 == 0x5602cdbe); - byteSwap16 (&v2, &v1, 2); - ASSERT (v2 == 0xcdbe5602); - } - { - // Swap 8 byte integer and check if correct. - // Double swapping should give the original. - uint64 v1 = 0xbecd025613890574ULL; - uint64 v2 = v1; - ASSERT (byteSwap(byteSwap(v1)) == v2); - byteSwap64 (&v2, &v1, 1); - ASSERT (v2 == 0x740589135602cdbeULL); - byteSwap32 (&v2, &v1, 2); - ASSERT (v2 == 0x5602cdbe74058913ULL); - } - { - // Swap 2 byte integers in a vector. - // Double swapping should give the original. - uint16 v1[3]; - v1[0]=0x0123; v1[1]=0x4567; v1[2]=0x89ab; - uint16 v2[3]; - byteSwap16 (v2, v1, 3); - ASSERT (v2[0] == 0x2301); - ASSERT (v2[1] == 0x6745); - ASSERT (v2[2] == 0xab89); - byteSwap16 (v2, 3); - ASSERT (v2[0] == v1[0]); - ASSERT (v2[1] == v1[1]); - ASSERT (v2[2] == v1[2]); - } - { - // Swap 4 byte integers in a vector. - // Double swapping should give the original. - uint32 v1[3]; - v1[0]=0x01233210; v1[1]=0x45677654; v1[2]=0x89abba98; - uint32 v2[3]; - byteSwap32 (v2, v1, 3); - ASSERT (v2[0] == 0x10322301); - ASSERT (v2[1] == 0x54766745); - ASSERT (v2[2] == 0x98baab89); - byteSwap32 (v2, 3); - ASSERT (v2[0] == v1[0]); - ASSERT (v2[1] == v1[1]); - ASSERT (v2[2] == v1[2]); - } - { - // Swap 8 byte integers in a vector. - // Double swapping should give the original. - uint64 v1[3]; - v1[0]=0x0123321045677654ULL; v1[1]=0x1234567887654321ULL; - v1[2]=0x89abcdeffedcba98ULL; - uint64 v2[3]; - byteSwap64 (v2, v1, 3); - ASSERT (v2[0] == 0x5476674510322301ULL); - ASSERT (v2[1] == 0x2143658778563412ULL); - ASSERT (v2[2] == 0x98badcfeefcdab89ULL); - byteSwap64 (v2, 3); - ASSERT (v2[0] == v1[0]); - ASSERT (v2[1] == v1[1]); - ASSERT (v2[2] == v1[2]); - } - { - // Swap (possibly) builtin complex numbers. - // Double swapping should give the original. - u16complex v[2]; - v[0] = makeu16complex(1, 3); - v[1] = makeu16complex(22, 44); - dataConvert (LittleEndian, v, 2); - dataConvert (LittleEndian, v, 2); - ASSERT (v[0] == makeu16complex(1, 3)); - ASSERT (v[1] == makeu16complex(22, 44)); - } - { - // Swap (possibly) builtin complex numbers. - // Double swapping should give the original. - fcomplex v[2]; - v[0] = makefcomplex(-1.2, 3.4); - v[1] = makefcomplex(22.11, -44.33); - dataConvert (LittleEndian, v, 2); - dataConvert (LittleEndian, v, 2); - ASSERT (v[0] == makefcomplex(-1.2, 3.4)); - ASSERT (v[1] == makefcomplex(22.11, -44.33)); - } - { - // Swap (possibly) builtin complex numbers. - // Double swapping should give the original. - dcomplex v[2]; - v[0] = makedcomplex(-1.2, 3.4); - v[1] = makedcomplex(22.11, -44.33); - dataConvert (LittleEndian, v, 2); - dataConvert (LittleEndian, v, 2); - ASSERT (v[0] == makedcomplex(-1.2, 3.4)); - ASSERT (v[1] == makedcomplex(22.11, -44.33)); - } - { - // Swap std complex numbers. - // Double swapping should give the original. - std::complex<uint16> v[2]; - v[0] = std::complex<uint16>(1, 3); - v[1] = std::complex<uint16>(22, 44); - dataConvert (BigEndian, v, 2); - dataConvert (BigEndian, v, 2); - ASSERT (v[0] == std::complex<uint16>(1, 3)); - ASSERT (v[1] == std::complex<uint16>(22, 44)); - } - { - // Swap std complex numbers. - // Double swapping should give the original. - std::complex<float> v[2]; - v[0] = std::complex<float>(-1.2, 3.4); - v[1] = std::complex<float>(22.11, -44.33); - dataConvert (BigEndian, v, 2); - dataConvert (BigEndian, v, 2); - ASSERT (v[0] == std::complex<float>(-1.2, 3.4)); - ASSERT (v[1] == std::complex<float>(22.11, -44.33)); - } - { - // Swap std complex numbers. - // Double swapping should give the original. - std::complex<double> v[2]; - v[0] = std::complex<double>(-1.2, 3.4); - v[1] = std::complex<double>(22.11, -44.33); - dataConvert (BigEndian, v, 2); - dataConvert (BigEndian, v, 2); - ASSERT (v[0] == std::complex<double>(-1.2, 3.4)); - ASSERT (v[1] == std::complex<double>(22.11, -44.33)); - } - { - bool bufb[50]; - bool bufb2[100]; - uchar bufc[20]; - for (int i=0; i<20; i++) { - bufc[i] = 0; - } - for (int i=0; i<50; i++) { - bufb[i] = (i%3 == 0); - } - int nrb = boolToBit (bufc, bufb, 50); - for (int i=0; i<nrb; i++) { - cout << ushort(bufc[i]) << ' '; - } - cout << endl; - int nrb2 = bitToBool (bufb2, bufc, 50); - ASSERT (nrb2 == nrb); - for (int i=0; i<50; i++) { - ASSERT (bufb2[i] == bufb[i]); - } - nrb2 = bitToBool (bufb2, bufc, 50-1, 1); - ASSERT (nrb2 == nrb); - for (int i=0; i<50-1; i++) { - ASSERT (bufb2[i] == bufb[i+1]); - } - nrb2 = bitToBool (bufb2, bufc, 40-2, 2); - ASSERT (nrb2 == nrb-2); - for (int i=0; i<40-2; i++) { - ASSERT (bufb2[i] == bufb[i+2]); - } - nrb = boolToBit (bufc, bufb, 50, 25); - for (int i=0; i<nrb+3; i++) { - cout << ushort(bufc[i]) << ' '; - } - cout << endl; - nrb2 = bitToBool (bufb2, bufc, 50+25, 0); - ASSERT (nrb2 == nrb+3); - ASSERT (bufb2[0]); - for (int i=0; i<50; i++) { - ASSERT (bufb2[i+25] == bufb[i]); - } - bufc[0] = 8; bufc[1]=4; - bitToBool (bufb, bufc, 16, 0); - for (int i=0; i<16; i++) { - cout << bufb[i] << ' '; - } - cout << endl; - - } - } catch (std::exception& x) { - std::cout << "Unexpected exception: " << x.what() << std::endl; - return 1; - } - std::cout << "OK" << std::endl; - return 0; -} diff --git a/dependencies/Common/test/tDataConvert.sh b/dependencies/Common/test/tDataConvert.sh deleted file mode 100755 index d3583efe47078388c47f3e588c560e0cc9dc1167..0000000000000000000000000000000000000000 --- a/dependencies/Common/test/tDataConvert.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -./runctest.sh tDataConvert diff --git a/dependencies/Common/test/tDataConvert.stdout b/dependencies/Common/test/tDataConvert.stdout deleted file mode 100644 index 91359411319b0a58a597df63be95f7ac6bc4a064..0000000000000000000000000000000000000000 --- a/dependencies/Common/test/tDataConvert.stdout +++ /dev/null @@ -1,4 +0,0 @@ -73 146 36 73 146 36 1 -73 146 36 147 36 73 146 36 73 2 -0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 -OK diff --git a/dependencies/Common/test/tHexdump.cc b/dependencies/Common/test/tHexdump.cc deleted file mode 100644 index 517e301d8848157748e21536a8da0b8dbc7ecb4d..0000000000000000000000000000000000000000 --- a/dependencies/Common/test/tHexdump.cc +++ /dev/null @@ -1,73 +0,0 @@ -//# testHexdump.cc: Program to test the hexdump functions -//# -//# Copyright (C) 2004 -//# ASTRON (Netherlands Institute for Radio Astronomy) -//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands -//# -//# This file is part of the LOFAR software suite. -//# The LOFAR software suite 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 3 of the License, or -//# (at your option) any later version. -//# -//# The LOFAR software suite 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 the LOFAR software suite. If not, see <http://www.gnu.org/licenses/>. -//# -//# $Id$ - -//# Always #include <lofar_config.h> first! -#include <lofar_config.h> - -#include <Common/LofarLogger.h> // contains the API of the LofarLogger -#include <Common/hexdump.h> -#include <Common/StringUtil.h> -#include <cstring> -#include <cstdio> - -using namespace LOFAR; - - -int main (int, char *argv[]) { - - // Read in the log-environment configuration - // We should always start with this. - INIT_LOGGER("tHexdump"); - - // Show operator were are on the air - LOG_INFO (formatString("Program %s has started", argv[0])); - - LOG_INFO ("testing hexdump(stdout, ...)"); - char stdoutTest [80]; - strcpy (stdoutTest, "this should appear on standard out"); - hexdump (stdoutTest, strlen(stdoutTest)); - - LOG_INFO ("testing hexdump(FILE*, ...)"); - char fileTest [80]; - strcpy (fileTest,"this should appear in the file tHexdump_tmp.txt"); - FILE* fd = fopen("./tHexdump_tmp.txt", "w"); - hexdump(fd, fileTest, strlen(fileTest)); - fclose(fd); - - LOG_INFO ("testing hexdump(char*, ...)"); - char charPtrTest [80]; - char hexdumpInfo [380]; // approx 4.8 * input string size - strcpy(charPtrTest, "this should appear in the given string"); - hexdump(hexdumpInfo, charPtrTest, strlen(charPtrTest)); - cout << hexdumpInfo << endl; - - LOG_INFO ("testing hexdump(string, ...)"); - string hexdumpString; - char stringTest [80]; - strcpy(stringTest, "this should appear in the C++ string"); - hexdump(hexdumpString, stringTest, strlen(stringTest)); - cout << hexdumpString << endl; - - LOG_INFO("Normal termination of program"); - return (0); -} - diff --git a/dependencies/Common/test/tHexdump.log_prop b/dependencies/Common/test/tHexdump.log_prop deleted file mode 100644 index 1377b2bd6625e77cbac3c087905f54b0d663cda3..0000000000000000000000000000000000000000 --- a/dependencies/Common/test/tHexdump.log_prop +++ /dev/null @@ -1,12 +0,0 @@ -# Property file to be use with the demo program testLogger. - -# Configure the rootLogger -log4cplus.rootLogger=DEBUG, STDOUT -# Define the STDOUT appender -log4cplus.appender.STDOUT=log4cplus::ConsoleAppender -log4cplus.appender.STDOUT.layout=log4cplus::PatternLayout -log4cplus.appender.STDOUT.layout.ConversionPattern=>>> %-5p %c{3} - %m%n<<<%n - -# Define foo at level TRACE4 -#log4cplus.logger.TRC.foo=TRACE4 - diff --git a/dependencies/Common/test/tHexdump.run b/dependencies/Common/test/tHexdump.run deleted file mode 100755 index fe7fd6480bfc6754e4fdffe715911b2ad56061a3..0000000000000000000000000000000000000000 --- a/dependencies/Common/test/tHexdump.run +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/sh - -./tHexdump -STATUS=$? -cat tHexdump_tmp.txt -exit $STATUS - diff --git a/dependencies/Common/test/tHexdump.sh b/dependencies/Common/test/tHexdump.sh deleted file mode 100755 index 10957beb3154f2a349e046c1184b51c43b28305e..0000000000000000000000000000000000000000 --- a/dependencies/Common/test/tHexdump.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -./runctest.sh tHexdump diff --git a/dependencies/Common/test/tHexdump.stdout b/dependencies/Common/test/tHexdump.stdout deleted file mode 100644 index 27313e48157f52aa01b5e426e8bf6db37fe33112..0000000000000000000000000000000000000000 --- a/dependencies/Common/test/tHexdump.stdout +++ /dev/null @@ -1,14 +0,0 @@ -0000: 74 68 69 73 20 73 68 6f 75 6c 64 20 61 70 70 65 this should appe -0010: 61 72 20 6f 6e 20 73 74 61 6e 64 61 72 64 20 6f ar on standard o -0020: 75 74 ut -0000: 74 68 69 73 20 73 68 6f 75 6c 64 20 61 70 70 65 this should appe -0010: 61 72 20 69 6e 20 74 68 65 20 67 69 76 65 6e 20 ar in the given -0020: 73 74 72 69 6e 67 string - -0000: 74 68 69 73 20 73 68 6f 75 6c 64 20 61 70 70 65 this should appe -0010: 61 72 20 69 6e 20 74 68 65 20 43 2b 2b 20 73 74 ar in the C++ st -0020: 72 69 6e 67 ring - -0000: 74 68 69 73 20 73 68 6f 75 6c 64 20 61 70 70 65 this should appe -0010: 61 72 20 69 6e 20 74 68 65 20 20 66 69 6c 65 20 ar in the file -0020: 74 48 65 78 64 75 6d 70 5f 74 6d 70 2e 74 78 74 tHexdump_tmp.txt diff --git a/dependencies/Common/test/tInputParSet.cc b/dependencies/Common/test/tInputParSet.cc deleted file mode 100644 index bb00706b7ffebb8f5e325944bba4cd10925ab4aa..0000000000000000000000000000000000000000 --- a/dependencies/Common/test/tInputParSet.cc +++ /dev/null @@ -1,98 +0,0 @@ -//# tInputParSet.cc: Test program for class InutParSet -//# -//# Copyright (C) 2011 -//# ASTRON (Netherlands Institute for Radio Astronomy) -//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands -//# -//# This file is part of the LOFAR software suite. -//# The LOFAR software suite 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 3 of the License, or -//# (at your option) any later version. -//# -//# The LOFAR software suite 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 the LOFAR software suite. If not, see <http://www.gnu.org/licenses/>. -//# -//# $Id$ - -#include <lofar_config.h> -#include <Common/InputParSet.h> -#include <Common/StreamUtil.h> - -using namespace LOFAR; - -void testInput (int argc, char* argv[]) -{ - InputParSet inputs; - // define the input structure - inputs.setVersion("2012Jun11-GvD"); - inputs.create ("ms", "", - "Name of input MeasurementSet", - "string"); - inputs.create ("image", "", - "Name of output image file (default is <msname-stokes-mode-nchan>.img)", - "string"); - inputs.create ("nscales", "5", - "Scales for MultiScale Clean", - "int"); - inputs.create ("noise", "1.0", - "Noise (in Jy) for briggsabs weighting", - "float"); - inputs.create ("nonoise", "", - "Noise (in Jy) for briggsabs weighting", - "float"); - inputs.create ("spwid", "0", - "spectral window id(s) to be used", - "int vector"); - inputs.create ("fixed", "False", - "Keep clean model fixed", - "bool"); - inputs.create ("uservector", "1.1, 3.4", - "user-defined scales for MultiScale clean", - "float vector"); - - // Fill the input structure from the command line. - inputs.readArguments (argc, argv); - - // Get the input specification. - bool fixed = inputs.getBool("fixed"); - int nscales = inputs.getInt("nscales"); - double noise = inputs.getDouble("noise"); - double nnoise= inputs.getDouble("nonoise"); - string ms = inputs.getString("ms"); - string image = inputs.getString("image"); - vector<int> spwid(inputs.getIntVector("spwid")); - vector<double> uservector(inputs.getDoubleVector("uservector")); - - cout << "fixed=" << fixed << endl; - cout << "nscales=" << nscales << endl; - cout << "noise=" << noise << endl; - cout << "nonoise=" << nnoise << endl; - cout << "ms=" << ms << endl; - cout << "image=" << image << endl; - cout << "spwid=" << spwid << endl; - cout << "uservector=" << uservector << endl; -} - -int main (int argc, char* argv[]) -{ - try { - // The file tInputParSet.in contains more than 1 parameter, so the - // tInputParSet.run in casacore style has more than 1 parameter. -#ifndef HAVE_AIPSPP - if (argc > 2) { - return 0; - } -#endif - testInput (argc, argv); - } catch (std::exception& x) { - cout << "Unexpected exception: " << x.what() << endl; - return 1; - } - return 0; -} diff --git a/dependencies/Common/test/tInputParSet.in b/dependencies/Common/test/tInputParSet.in deleted file mode 100644 index ce323d1a346e5f557c1d8216f19407b6254012ee..0000000000000000000000000000000000000000 --- a/dependencies/Common/test/tInputParSet.in +++ /dev/null @@ -1,3 +0,0 @@ -# xx -image=1.5xx -spwid=5 diff --git a/dependencies/Common/test/tInputParSet.run b/dependencies/Common/test/tInputParSet.run deleted file mode 100755 index 2fe5ab734b07c53d71cec67abb421e8aeff1b186..0000000000000000000000000000000000000000 --- a/dependencies/Common/test/tInputParSet.run +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/sh - -# Run it with the LOFAR parset style. -tInputParSet tInputParSet.in - -# Run it with the casacore Input style. -tInputParSet `grep -v '#' tInputParSet.in` diff --git a/dependencies/Common/test/tInputParSet.sh b/dependencies/Common/test/tInputParSet.sh deleted file mode 100755 index aad832bac0f5e594a7e91fe22de236cb8451cefe..0000000000000000000000000000000000000000 --- a/dependencies/Common/test/tInputParSet.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -./runctest.sh tInputParSet diff --git a/dependencies/Common/test/tMmap.cc b/dependencies/Common/test/tMmap.cc deleted file mode 100644 index cb5cce5893bfa9224819b201a5763f123e7415ef..0000000000000000000000000000000000000000 --- a/dependencies/Common/test/tMmap.cc +++ /dev/null @@ -1,127 +0,0 @@ -//# tMmap.cc: Test Mmap class wrapping the mmap/munmap syscalls -//# -//# Copyright (C) 2013 -//# ASTRON (Netherlands Institute for Radio Astronomy) -//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands -//# -//# This file is part of the LOFAR software suite. -//# The LOFAR software suite 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 3 of the License, or -//# (at your option) any later version. -//# -//# The LOFAR software suite 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 the LOFAR software suite. If not, see <http://www.gnu.org/licenses/>. -//# -//# $Id$ - -#include <lofar_config.h> - -#include <Common/Mmap.h> - -#include <unistd.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <fcntl.h> -#include <cerrno> -#include <cstring> -#include <iostream> - -#include <Common/SystemCallException.h> - -using namespace std; - -int main() -{ - cout << "Mmap Tests: start" << endl; - - long pageSize = ::sysconf(_SC_PAGE_SIZE); - if (pageSize == -1) { - cerr << "Error: failed to obtain system's page size" << endl; - return 1; - } - cout << "Page size on this system is " << pageSize << " bytes" << endl; - - // test read-write anon mapping - { - cout << "Mmap Test 1/3" << endl; - - size_t mappingSize = (16 * 1024 + pageSize) & ~(pageSize - 1); - LOFAR::Mmap mmap(NULL, mappingSize, PROT_READ | PROT_WRITE, - MAP_PRIVATE | MAP_ANON, -1, 0); - cout << "Mmap worked, trying to write, then read back" << endl; - - unsigned nerrors = 0; // to limit potential error cerr spam - const int testVal = 0x17; // must fit in a byte - unsigned char* p = (unsigned char*)mmap(); - memset(p, testVal, mappingSize); - for (size_t i = 0; i < mappingSize; i++) { - if (p[i] != testVal) { - if (++nerrors == 10) { - return 1; - } - cerr << "Error: failed to read back written value at byte " << i << ": read '" << (unsigned)p[i] << "' instead of '" << testVal << "'" << endl; - } - } - // munmap triggered here, but does not throw on error unfort... - } - - // test read-only file mapping - { - cout << "Mmap Test 2/3" << endl; - - // input file is expected to contain 64kB of bytevals 0, 1, ..., 110, 0, 1, ..., 110, ..... - const char inputFilename[] = "tMmap.in"; - int fd = ::open(inputFilename, O_RDONLY); - if (fd == -1) { - int enr = errno; - cerr << "Failed to open input file '" << inputFilename << "': " << strerror(enr) << endl; - return 1; - } - - size_t mappingSize = 2 * pageSize; - size_t offset = pageSize; - LOFAR::Mmap mmap(NULL, mappingSize, PROT_READ, MAP_PRIVATE, fd, offset); - cout << "Mmap worked, trying to read from file through mapping" << endl; - - unsigned nerrors = 0; // to limit potential error cerr spam - unsigned char* p = (unsigned char*)mmap(); - for (size_t i = 0; i < mappingSize; i++) { - if (p[i] % 111 != (i + offset) % 111) { - if (++nerrors == 10) { - return 1; - } - cerr << "Error: failed to read expected value at byte " << i << " from file through mapping: read '" << (unsigned)p[i] << "' instead of '" << (i + offset) % 111 << "'" << endl; - } - } - if ( ::close(fd) != 0) { - cerr << "failed to close input file '" << inputFilename << "'" << endl; - return 1; // normally, would not be fatal, but this is a test, so bail - } - - // munmap triggered here, but does not throw on error unfort... - } - - // test some obviously incorrect mmap attempt that must throw - cout << "Mmap test 3/3" << endl; - try { - const size_t unalignedSize = 16 * pageSize + 1; - const int badfd = 1001; - LOFAR::Mmap mmap(NULL, unalignedSize, PROT_READ, MAP_PRIVATE, badfd, pageSize-1); - - // should not have been reached - cerr << "Error: erroneous mmap should have thrown, but it did not" << endl; - return 1; - } catch (LOFAR::SystemCallException& exc) { - cerr << "Caught expected SystemCallException" << endl; - } - - cout << "Mmap Tests: all tests succeeded" << endl; - return 0; -} - diff --git a/dependencies/Common/test/tMmap.in b/dependencies/Common/test/tMmap.in deleted file mode 100644 index 49992f913c8bb014fe2a4acb949fcfa26ee59e5c..0000000000000000000000000000000000000000 Binary files a/dependencies/Common/test/tMmap.in and /dev/null differ diff --git a/dependencies/Common/test/tMmap.sh b/dependencies/Common/test/tMmap.sh deleted file mode 100755 index 59855d8761d43808efa92ae7add2c932e7f683da..0000000000000000000000000000000000000000 --- a/dependencies/Common/test/tMmap.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -./runctest.sh tMmap diff --git a/dependencies/Common/test/tNsTimestamp.cc b/dependencies/Common/test/tNsTimestamp.cc index a3f767b0cf3d82e8cbb32f9c861f8f961d1100e2..2275cded5173abf6af6eae0764dce8178bab405b 100644 --- a/dependencies/Common/test/tNsTimestamp.cc +++ b/dependencies/Common/test/tNsTimestamp.cc @@ -27,8 +27,6 @@ #include <Common/StringUtil.h> #include <Common/LofarLogger.h> #include <Common/lofar_bitset.h> -#include <Common/lofar_map.h> -#include <Common/hexdump.h> #include <Common/NsTimestamp.h> #include <cassert> #include <cstdlib> diff --git a/dependencies/Common/test/tNumeric.cc b/dependencies/Common/test/tNumeric.cc deleted file mode 100644 index c004813a7772a34528a8b39b15066679885d7448..0000000000000000000000000000000000000000 --- a/dependencies/Common/test/tNumeric.cc +++ /dev/null @@ -1,410 +0,0 @@ -//# tNumeric.cc: test program for the Numeric class -//# -//# Copyright (C) 2002-2004 -//# ASTRON (Netherlands Institute for Radio Astronomy) -//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands -//# -//# This file is part of the LOFAR software suite. -//# The LOFAR software suite 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 3 of the License, or -//# (at your option) any later version. -//# -//# The LOFAR software suite 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 the LOFAR software suite. If not, see <http://www.gnu.org/licenses/>. -//# -//# $Id$ - -//# Always #include <lofar_config.h> first! -#include <lofar_config.h> - -//# Includes -#include <Common/Numeric.h> -#include <Common/LofarLogger.h> -#include <Common/lofar_iomanip.h> -#include <Common/lofar_iostream.h> -#include <limits> -#include <cmath> - -using namespace LOFAR; -using namespace std; - -#define initNumbers(T) \ - LOG_INFO("initNumbers("#T")"); \ - typedef Numeric::T##Mask_t mask_t; \ - typedef Numeric::T##Union_t union_t; \ - mask_t negmask = mask_t(1) << (8*sizeof(T)-1); \ - ASSERT(sizeof(T) == sizeof(mask_t)); \ - T zero(0), one(1), two(2); \ - /* Create a negative zero */ \ - union_t negativeZero_u; \ - negativeZero_u.mask = negmask; \ - T negativeZero(negativeZero_u.value); \ - /* Create an infinity */ \ - T inf(one/zero); \ - /* Create a NaN */ \ - T nan(zero/zero); \ - /* Create a number of different NANs - they should */ \ - /* all be the same on Intel chips. */ \ - T nan1(inf-inf); \ - T nan2(inf/inf); \ - T nan3(inf*zero); \ - T nan4(sqrt(-one)); \ - /* Copy one of the NANs and modify its representation. */ \ - /* This will still give a NAN, just a different one. */ \ - union_t nan5_u = { nan1 }; \ - nan5_u.mask += 1; \ - T nan5(nan5_u.value); \ - /* Create number nearest to 2 (1 ULP below) */ \ - union_t nearestTwo_u = { two }; \ - nearestTwo_u.mask -= 1; \ - T nearestTwo(nearestTwo_u.value); \ - /* Create a number near to 2 (sizeof(T) ULPs below) */ \ - union_t nearTwo_u = { two }; \ - nearTwo_u.mask -= sizeof(T); \ - T nearTwo(nearTwo_u.value); \ - /* Create a number not so near to 2 (sizeof(T)^2 ULPs below) */ \ - union_t notNearTwo_u = { two }; \ - notNearTwo_u.mask -= sizeof(T)*sizeof(T); \ - T notNearTwo(notNearTwo_u.value); \ - /* Create a denormal by starting with zero and */ \ - /* incrementing the integer representation. */ \ - union_t smallestDenormal_u = { zero }; \ - smallestDenormal_u.mask += 1; \ - T smallestDenormal(smallestDenormal_u.value); - -#define printNumber(x) \ -{ int p(2*sizeof(x)+1); \ - union_t u = { x }; \ - LOG_INFO_STR(setprecision(p) << left << setw(17) << #x << " = " \ - << setw(p+6) << x << " (" << hex << showbase \ - << setw(p+1) << u.mask << dec << ")"); \ -} - -#define showNumbers(T) \ -{ LOG_INFO("showNumbers("#T")"); \ - printNumber(zero); \ - printNumber(one); \ - printNumber(two); \ - printNumber(negativeZero); \ - printNumber(nan); \ - printNumber(nan1); \ - printNumber(nan2); \ - printNumber(nan3); \ - printNumber(nan4); \ - printNumber(nan5); \ - printNumber(nearestTwo); \ - printNumber(nearTwo); \ - printNumber(notNearTwo); \ - printNumber(smallestDenormal); \ -} - -#define testNegative(T) \ -{ LOG_INFO("testNegative("#T")"); \ - ASSERT(!Numeric::isNegative(zero)); \ - ASSERT(Numeric::isNegative(negativeZero)); \ - ASSERT(!Numeric::isNegative(one)); \ - ASSERT(Numeric::isNegative(-one)); \ - ASSERT(!Numeric::isNegative(inf)); \ - ASSERT(Numeric::isNegative(-inf)); \ -} - -#define testFinite(T) \ -{ LOG_INFO("testFinite("#T")"); \ - ASSERT(Numeric::isFinite(zero)); \ - ASSERT(Numeric::isFinite(negativeZero)); \ - ASSERT(Numeric::isFinite(one)); \ - ASSERT(Numeric::isFinite(-one)); \ - ASSERT(!Numeric::isFinite(inf)); \ - ASSERT(!Numeric::isFinite(-inf)); \ - ASSERT(!Numeric::isFinite(nan)); \ - ASSERT(!Numeric::isFinite(nan1)); \ - ASSERT(!Numeric::isFinite(nan2)); \ - ASSERT(!Numeric::isFinite(nan3)); \ - ASSERT(!Numeric::isFinite(nan4)); \ - ASSERT(!Numeric::isFinite(nan5)); \ -} - -#define testInf(T) \ -{ LOG_INFO("testInf("#T")"); \ - ASSERT(!Numeric::isInf(zero)); \ - ASSERT(!Numeric::isInf(one)); \ - ASSERT(!Numeric::isInf(-one)); \ - ASSERT(Numeric::isInf(inf)); \ - ASSERT(Numeric::isInf(-inf)); \ - ASSERT(!Numeric::isInf(nan)); \ - ASSERT(!Numeric::isInf(nan1)); \ - ASSERT(!Numeric::isInf(nan2)); \ - ASSERT(!Numeric::isInf(nan3)); \ - ASSERT(!Numeric::isInf(nan4)); \ - ASSERT(!Numeric::isInf(nan5)); \ - ASSERT(one/inf == 0); \ - ASSERT(one/(-inf) == 0); \ - ASSERT((-one)/inf == 0); \ - ASSERT((-one)/(-inf) == 0); \ - ASSERT(Numeric::isInf(inf*inf)); \ - ASSERT(Numeric::isInf(inf*(-inf))); \ - ASSERT(Numeric::isInf((-inf)*inf)); \ - ASSERT(Numeric::isInf((-inf)*(-inf))); \ - ASSERT(Numeric::isInf(inf+inf)); \ - ASSERT(Numeric::isInf((-inf)+(-inf))); \ -} - -#define testNan(T) \ -{ LOG_INFO("testNan("#T")"); \ - ASSERT(!Numeric::isNan(zero)); \ - ASSERT(!Numeric::isNan(one)); \ - ASSERT(!Numeric::isNan(-one)); \ - ASSERT(!Numeric::isNan(inf)); \ - ASSERT(!Numeric::isNan(-inf)); \ - ASSERT(Numeric::isNan(zero/zero)); \ - ASSERT(Numeric::isNan(zero/negativeZero)); \ - ASSERT(Numeric::isNan(negativeZero/zero)); \ - ASSERT(Numeric::isNan(negativeZero/negativeZero)); \ - ASSERT(Numeric::isNan(inf-inf)); \ - ASSERT(Numeric::isNan(inf/inf)); \ - ASSERT(Numeric::isNan(inf/(-inf))); \ - ASSERT(Numeric::isNan((-inf)/inf)); \ - ASSERT(Numeric::isNan((-inf)/(-inf))); \ - ASSERT(Numeric::isNan(inf*zero)); \ - ASSERT(Numeric::isNan((-inf)*zero)); \ - ASSERT(Numeric::isNan(inf*negativeZero)); \ - ASSERT(Numeric::isNan((-inf)*negativeZero)); \ -} - -#define testCompare(T) \ -{ LOG_INFO("testCompare("#T")"); \ - \ - /* The first set of tests check things that any self-respecting */ \ - /* comparison function should agree upon. */ \ - \ - /* Make sure that zero and negativeZero compare as equal. */ \ - ASSERT(Numeric::compare(zero, negativeZero, mask_t(0))); \ - \ - /* Make sure that nearby numbers compare as equal. */ \ - ASSERT(Numeric::compare(two, nearestTwo)); \ - \ - /* Make sure that slightly more distant numbers compare as equal. */ \ - ASSERT(Numeric::compare(two, nearTwo)); \ - \ - /* Make sure the results are the same with parameters reversed. */ \ - ASSERT(Numeric::compare(nearTwo, two)); \ - \ - /* Make sure that even more distant numbers don't compare as equal. */ \ - ASSERT(!Numeric::compare(two, notNearTwo)); \ - \ - /* The next set of tests check things where the correct answer isn't */ \ - /* as obvious or important. Some of these tests check for cases that */ \ - /* are rare or can easily be avoided. Some of them check for cases */ \ - /* where the behavior of the 2sComplement function is arguably better */ \ - /* than the behavior of the fussier Final function. */ \ - \ - /* Test wrapping from inf to -inf; maxUlps is larger than mantissa. */ \ - /* I.e. maxUlps = 1 << 23 for floats, and 1 << 52 for doubles; */ \ - /* or as formula: maxUlps = 1 << 8*(sizeof(T)-1)-(2*sizeof(T)/3)+1 */ \ - mask_t maxUlps = (mask_t)1 << (8*(sizeof(T)-1)-(2*sizeof(T)/3)+1); \ - LOG_DEBUG_STR("maxUlps = " << hex << showbase << maxUlps); \ - ASSERT(!Numeric::compare(inf, -inf, maxUlps)); \ - \ - /* Test whether max floating point value and infinity */ \ - /* (representationally adjacent) compare as unequal. */ \ - ASSERT(!Numeric::compare(numeric_limits<T>::max(), inf)); \ - \ - /* Test whether a NAN compares as unequal to itself. */ \ - ASSERT(!Numeric::compare(nan, nan)); \ - \ - /* Test whether a NAN compares as unequal to a different NAN. */ \ - ASSERT(!Numeric::compare(nan2, nan3)); \ - \ - /* Test whether tiny numbers of opposite signs compare as equal. */ \ - ASSERT(Numeric::compare(smallestDenormal, -smallestDenormal)); \ -} - -#define testAll(T) \ -{ initNumbers(T); \ - showNumbers(T); \ - testNegative(T); \ - testFinite(T); \ - testInf(T); \ - testNan(T); \ - testCompare(T); \ -} - -void testFloat() -{ - float zero(0.0); - float one(1.0); - float two(2.0); - float none(zero-one); - float pinf(one/zero); - float ninf(none/zero); - float nan(pinf/pinf); - union { - long ione; - float fone; - } u = { 1 }; - float pdmin(u.fone); // smallest denormalized float - float ndmin(-pdmin); - - ASSERT(!Numeric::isNegative(zero)); - ASSERT(Numeric::isFinite(zero)); - ASSERT(!Numeric::isInf(zero)); - ASSERT(!Numeric::isNan(zero)); - - ASSERT(!Numeric::isNegative(one)); - ASSERT(Numeric::isFinite(one)); - ASSERT(!Numeric::isInf(one)); - ASSERT(!Numeric::isNan(one)); - - ASSERT(Numeric::isNegative(none)); - ASSERT(Numeric::isFinite(none)); - ASSERT(!Numeric::isInf(none)); - ASSERT(!Numeric::isNan(none)); - - ASSERT(!Numeric::isNegative(pinf)); - ASSERT(!Numeric::isFinite(pinf)); - ASSERT(Numeric::isInf(pinf)); - ASSERT(!Numeric::isNan(pinf)); - - ASSERT(Numeric::isNegative(ninf)); - ASSERT(!Numeric::isFinite(ninf)); - ASSERT(Numeric::isInf(ninf)); - ASSERT(!Numeric::isNan(ninf)); - - ASSERT(!Numeric::isFinite(nan)); - ASSERT(!Numeric::isInf(nan)); - ASSERT(Numeric::isNan(nan)); - - ASSERT(one/pinf == 0); - ASSERT(one/ninf == 0); - ASSERT(none/pinf == 0); - ASSERT(none/ninf == 0); - - ASSERT(Numeric::isInf(pinf*pinf)); - ASSERT(Numeric::isInf(pinf*ninf)); - ASSERT(Numeric::isInf(ninf*pinf)); - ASSERT(Numeric::isInf(ninf*ninf)); - - ASSERT(Numeric::isInf(one/zero)); - ASSERT(Numeric::isInf(none/zero)); - - ASSERT(Numeric::isInf(pinf+pinf)); - ASSERT(Numeric::isInf(ninf+ninf)); - - ASSERT(Numeric::isNan(zero/zero)); - ASSERT(Numeric::isNan(zero/(-zero))); - ASSERT(Numeric::isNan((-zero)/zero)); - ASSERT(Numeric::isNan((-zero)/(-zero))); - - ASSERT(Numeric::isNan(pinf-pinf)); - ASSERT(Numeric::isNan(ninf-ninf)); - - ASSERT(Numeric::isNan(pinf/pinf)); - ASSERT(Numeric::isNan(pinf/ninf)); - ASSERT(Numeric::isNan(ninf/pinf)); - ASSERT(Numeric::isNan(ninf/ninf)); - - ASSERT(Numeric::isNan(pinf*zero)); - ASSERT(Numeric::isNan(ninf*zero)); - - ASSERT(!Numeric::compare(pdmin, ndmin)); - ASSERT(Numeric::compare(pdmin, ndmin, 2)); - - ASSERT(!Numeric::compare(one, two)); - // distance between one and two in ULPs is 0x800000L - ASSERT(Numeric::compare(one, two, 0x800000L)); - ASSERT(!Numeric::compare(one, two, 0x7FFFFFL)); -} - -void testDouble() -{ - double zero(0.0); - double one(1.0); - double none(zero-one); - double pinf(one/zero); - double ninf(none/zero); - double nan(pinf/pinf); - - ASSERT(!Numeric::isNegative(zero)); - ASSERT(Numeric::isFinite(zero)); - ASSERT(!Numeric::isInf(zero)); - ASSERT(!Numeric::isNan(zero)); - - ASSERT(!Numeric::isNegative(one)); - ASSERT(Numeric::isFinite(one)); - ASSERT(!Numeric::isInf(one)); - ASSERT(!Numeric::isNan(one)); - - ASSERT(Numeric::isNegative(none)); - ASSERT(Numeric::isFinite(none)); - ASSERT(!Numeric::isInf(none)); - ASSERT(!Numeric::isNan(none)); - - ASSERT(!Numeric::isNegative(pinf)); - ASSERT(!Numeric::isFinite(pinf)); - ASSERT(Numeric::isInf(pinf)); - ASSERT(!Numeric::isNan(pinf)); - - ASSERT(Numeric::isNegative(ninf)); - ASSERT(!Numeric::isFinite(ninf)); - ASSERT(Numeric::isInf(ninf)); - ASSERT(!Numeric::isNan(ninf)); - - ASSERT(!Numeric::isFinite(nan)); - ASSERT(!Numeric::isInf(nan)); - ASSERT(Numeric::isNan(nan)); - - ASSERT(one/pinf == 0); - ASSERT(one/ninf == 0); - ASSERT(none/pinf == 0); - ASSERT(none/ninf == 0); - - ASSERT(Numeric::isInf(pinf*pinf)); - ASSERT(Numeric::isInf(pinf*ninf)); - ASSERT(Numeric::isInf(ninf*pinf)); - ASSERT(Numeric::isInf(ninf*ninf)); - - ASSERT(Numeric::isInf(one/zero)); - ASSERT(Numeric::isInf(none/zero)); - - ASSERT(Numeric::isInf(pinf+pinf)); - ASSERT(Numeric::isInf(ninf+ninf)); - - ASSERT(Numeric::isNan(zero/zero)); - ASSERT(Numeric::isNan(zero/(-zero))); - ASSERT(Numeric::isNan((-zero)/zero)); - ASSERT(Numeric::isNan((-zero)/(-zero))); - - ASSERT(Numeric::isNan(pinf-pinf)); - ASSERT(Numeric::isNan(ninf-ninf)); - - ASSERT(Numeric::isNan(pinf/pinf)); - ASSERT(Numeric::isNan(pinf/ninf)); - ASSERT(Numeric::isNan(ninf/pinf)); - ASSERT(Numeric::isNan(ninf/ninf)); - - ASSERT(Numeric::isNan(pinf*zero)); - ASSERT(Numeric::isNan(ninf*zero)); -} - - -int main(int /*argc*/, const char* argv[]) -{ - INIT_LOGGER(argv[0]); - LOG_INFO("Starting up ..."); - try { - testAll(float); - testAll(double); - } - catch (Exception& e) { - LOG_ERROR_STR(e); - return 1; - } - LOG_INFO("Program terminated successfully"); - return 0; -} diff --git a/dependencies/Common/test/tNumeric.sh b/dependencies/Common/test/tNumeric.sh deleted file mode 100755 index 6a2ac1ce4950f8a46230614dd8563b40833fae58..0000000000000000000000000000000000000000 --- a/dependencies/Common/test/tNumeric.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -./runctest.sh tNumeric diff --git a/dependencies/Common/test/tObjectFactory.cc b/dependencies/Common/test/tObjectFactory.cc deleted file mode 100644 index a389efbbd10334ec90014cf10019f4786d46f421..0000000000000000000000000000000000000000 --- a/dependencies/Common/test/tObjectFactory.cc +++ /dev/null @@ -1,88 +0,0 @@ -//# tObjectFactory.cc: Test program for the ObjectFactory class. -//# -//# Copyright (C) 2006 -//# ASTRON (Netherlands Institute for Radio Astronomy) -//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands -//# -//# This file is part of the LOFAR software suite. -//# The LOFAR software suite 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 3 of the License, or -//# (at your option) any later version. -//# -//# The LOFAR software suite 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 the LOFAR software suite. If not, see <http://www.gnu.org/licenses/>. -//# -//# $Id$ - -//# Always #include <lofar_config.h> first! -#include <lofar_config.h> - -//# Includes -#include "Shapes.h" -#include "Coordinates.h" -#include <Common/StreamUtil.h> -#include <memory> - -using namespace LOFAR; -using namespace std; - -void doShapes() -{ - cout << "Registered classes: " - << ShapeFactory::instance().registeredClassIds() - << endl; - { - unique_ptr<Shape> shape(ShapeFactory::instance().create("Rectangle")); - cout << *shape << endl; - } - { - unique_ptr<Shape> shape(ShapeFactory::instance().create("Square")); - cout << *shape << endl; - } - { - unique_ptr<Shape> shape(ShapeFactory::instance().create("Ellipse")); - cout << *shape << endl; - } - { - unique_ptr<Shape> shape(ShapeFactory::instance().create("Circle")); - cout << *shape << endl; - } -} - -void doCoordinates() -{ - cout << "Registered classes: " - << CoordinateFactory::instance().registeredClassIds() - << endl; - { - unique_ptr<Coordinate> coord(CoordinateFactory::instance(). - create("Cartesian", 2.4, 3.6, 4.8)); - cout << *coord << endl; - } - { - unique_ptr<Coordinate> coord(CoordinateFactory::instance(). - create("Cylindrical", 0.6, 1.2, 2.4)); - cout << *coord << endl; - } - { - unique_ptr<Coordinate> coord(CoordinateFactory::instance(). - create("Spherical", 0.3, 0.15, 9.6)); - cout << *coord << endl; - } -} - -int main() -{ - cout << endl << "** Shapes **" << endl; - doShapes(); - cout << endl << "** Coordinates **" << endl; - doCoordinates(); - cout << endl; - return 0; -} diff --git a/dependencies/Common/test/tObjectFactory.sh b/dependencies/Common/test/tObjectFactory.sh deleted file mode 100755 index 8da13dee282c8ecf982ba02939d88a6910132c33..0000000000000000000000000000000000000000 --- a/dependencies/Common/test/tObjectFactory.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -./runctest.sh -stdout tObjectFactory diff --git a/dependencies/Common/test/tObjectFactory.stdout b/dependencies/Common/test/tObjectFactory.stdout deleted file mode 100644 index 8d87321e10d80e17ff368a7d4f1b84a8b198b1b5..0000000000000000000000000000000000000000 --- a/dependencies/Common/test/tObjectFactory.stdout +++ /dev/null @@ -1,14 +0,0 @@ - -** Shapes ** -Registered classes: [Circle,Ellipse,Rectangle,Square] -Rectangle -Square -Ellipse -Circle - -** Coordinates ** -Registered classes: [Cartesian,Cylindrical,Spherical] -Cartesian: (x, y, z) = (2.4, 3.6, 4.8) -Cylindrical: (r, theta, z) = (0.6, 1.2, 2.4) -Spherical: (r, theta, phi) = (0.3, 0.15, 9.6) - diff --git a/dependencies/Common/test/tProcess.cc b/dependencies/Common/test/tProcess.cc deleted file mode 100644 index 5c5cbc8781e6d124b07dd6e8c2cbf3462bc5dde1..0000000000000000000000000000000000000000 --- a/dependencies/Common/test/tProcess.cc +++ /dev/null @@ -1,100 +0,0 @@ -//# tProcess.cc: one line description -//# -//# Copyright (C) 2005 -//# ASTRON (Netherlands Institute for Radio Astronomy) -//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands -//# -//# This file is part of the LOFAR software suite. -//# The LOFAR software suite 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 3 of the License, or -//# (at your option) any later version. -//# -//# The LOFAR software suite 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 the LOFAR software suite. If not, see <http://www.gnu.org/licenses/>. -//# -//# $Id$ - -//# Always #include <lofar_config.h> first! -#include <lofar_config.h> - -//# Includes -#include <Common/Process.h> -#include <Common/LofarLogger.h> -#include <cerrno> -#include <cstdlib> // for exit() and system() -#include <cstring> // for strerror() -#include <unistd.h> // for getpid() and sleep() -#include <libgen.h> // for basename() - -using namespace std; -using namespace LOFAR; - - -class MyProcess : public Process -{ - virtual void parent() - { - LOG_TRACE_FLOW_STR(AUTO_FUNCTION_NAME << ": pid = " << getpid()); - } - - virtual void child() - { - LOG_TRACE_FLOW_STR(AUTO_FUNCTION_NAME << ": pid = " << getpid() - << "; ppid = " << getppid()); - LOG_TRACE_STAT_STR(AUTO_FUNCTION_NAME - << ": going to sleep for 2 seconds ..."); - sleep(2); - LOG_TRACE_STAT_STR(AUTO_FUNCTION_NAME - << ": pid #" << getpid() << " exiting ..."); - exit(0); - } -}; - - -int main (int /*argc*/, char* argv[]) -{ - string prog(basename(argv[0])); - INIT_LOGGER (prog.c_str()); - - try { - MyProcess proc; - LOG_TRACE_FLOW_STR(AUTO_FUNCTION_NAME - << ": create a zombie process ..."); - proc.spawn(); - - LOG_TRACE_FLOW_STR(AUTO_FUNCTION_NAME - << ": sleeping for 1 second ..."); - sleep(1); - - LOG_TRACE_FLOW_STR(AUTO_FUNCTION_NAME - << ": create a non-zombie process ..."); - proc.spawn(true); - - } - catch (Exception& e) { - LOG_FATAL_STR(e); - return 1; - } - - LOG_TRACE_FLOW_STR(AUTO_FUNCTION_NAME - << ": server is going to sleep for 4 seconds now ..."); - sleep(4); - - LOG_TRACE_FLOW_STR(AUTO_FUNCTION_NAME - << ": server woke up" - << ", checking state of child processes ..."); - string cmd = "ps -C " + prog + " --no-header -ostate -ocomm -ostate | grep '" - + prog + " ' | sed -e 's/ tProcess.*//'" ; - if (system(cmd.c_str()) == -1) { - LOG_FATAL_STR("system() command failed: " << strerror(errno)); - return 1; - } - - return 0; -} diff --git a/dependencies/Common/test/tProcess.log_prop b/dependencies/Common/test/tProcess.log_prop deleted file mode 100644 index 7b412c34db385108f1c4282feb346fdf7dc82b32..0000000000000000000000000000000000000000 --- a/dependencies/Common/test/tProcess.log_prop +++ /dev/null @@ -1,5 +0,0 @@ -log4cplus.rootLogger=TRACE, TESTOUT -log4cplus.logger.TRC=TRACE5 -log4cplus.appender.TESTOUT=log4cplus::ConsoleAppender -log4cplus.appender.TESTOUT.layout=log4cplus::PatternLayout -log4cplus.appender.TESTOUT.layout.ConversionPattern=%-5p %c{3} - %m%n diff --git a/dependencies/Common/test/tProcess.run b/dependencies/Common/test/tProcess.run deleted file mode 100755 index 2c1f0d96292355542e68bbc5f35511be2008a7d9..0000000000000000000000000000000000000000 --- a/dependencies/Common/test/tProcess.run +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh - -# Skip the test until the problem with differences in output of `ps' -# on different machines has been fixed (see Bug #903). -exit 3 diff --git a/dependencies/Common/test/tProcess.sh b/dependencies/Common/test/tProcess.sh deleted file mode 100755 index 0028f4392df6713e4bad4c987cd28066f55741d4..0000000000000000000000000000000000000000 --- a/dependencies/Common/test/tProcess.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -./runctest.sh -stdout tProcess diff --git a/dependencies/Common/test/tProcess.stdout b/dependencies/Common/test/tProcess.stdout deleted file mode 100644 index d2fdf9d567eac3bd25ebf384ee94e64318b40d44..0000000000000000000000000000000000000000 --- a/dependencies/Common/test/tProcess.stdout +++ /dev/null @@ -1,2 +0,0 @@ -S -Z diff --git a/dependencies/Common/test/tReadLine.cc b/dependencies/Common/test/tReadLine.cc deleted file mode 100644 index 2027bd43565f78c2d5996e8aad56343532d49953..0000000000000000000000000000000000000000 --- a/dependencies/Common/test/tReadLine.cc +++ /dev/null @@ -1,46 +0,0 @@ -//# tReadLine.cc: Test program for the readLine functions -//# -//# Copyright (C) 2009 -//# ASTRON (Netherlands Institute for Radio Astronomy) -//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands -//# -//# This file is part of the LOFAR software suite. -//# The LOFAR software suite 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 3 of the License, or -//# (at your option) any later version. -//# -//# The LOFAR software suite 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 the LOFAR software suite. If not, see <http://www.gnu.org/licenses/>. -//# -//# $Id$ - -#include <lofar_config.h> -#include <Common/ReadLine.h> -#include <Common/lofar_iostream.h> -#include <Common/lofar_fstream.h> - -using namespace LOFAR; - -int main (int argc, char* argv[]) -{ - // Note that GNU readline writes on stdout. - // Therefore output is written into a file which is handled in tReadLine.run. - ofstream ostr("tReadLine_tmp.stdout"); - string line; - if (argc <= 1) { - while (readLine(line)) { - ostr << line << endl; - } - } else { - while (readLineSkip(line, "> ", argv[1])) { - ostr << line << endl; - } - } - return 0; -} diff --git a/dependencies/Common/test/tReadLine.in b/dependencies/Common/test/tReadLine.in deleted file mode 100644 index 3d6bf36858f1fad05a5472a28efe313b36f5d891..0000000000000000000000000000000000000000 --- a/dependencies/Common/test/tReadLine.in +++ /dev/null @@ -1,7 +0,0 @@ -string1 - - - str - // aa -// - / aa diff --git a/dependencies/Common/test/tReadLine.run b/dependencies/Common/test/tReadLine.run deleted file mode 100755 index fb4bebb4afd97dc6733666c0bd5570ba0d6131b4..0000000000000000000000000000000000000000 --- a/dependencies/Common/test/tReadLine.run +++ /dev/null @@ -1,16 +0,0 @@ -#! /bin/sh - -# Note that GNU readline writes on stdout. -# Therefore tReadLine writes its output a file which is handled here. - -echo "without skip:" -tReadLine < tReadLine.in > /dev/null -cat tReadLine_tmp.stdout -echo -echo "without comment skip:" -tReadLine "" < tReadLine.in > /dev/null -cat tReadLine_tmp.stdout -echo -echo "with comment skip:" -tReadLine "//" < tReadLine.in > /dev/null -cat tReadLine_tmp.stdout diff --git a/dependencies/Common/test/tReadLine.sh b/dependencies/Common/test/tReadLine.sh deleted file mode 100755 index a6a8c6553864a9c207144fabf20371a3234ce676..0000000000000000000000000000000000000000 --- a/dependencies/Common/test/tReadLine.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -./runctest.sh tReadLine diff --git a/dependencies/Common/test/tReadLine.stdout b/dependencies/Common/test/tReadLine.stdout deleted file mode 100644 index 5818abd214732a509f794b35c03d0b01360239a5..0000000000000000000000000000000000000000 --- a/dependencies/Common/test/tReadLine.stdout +++ /dev/null @@ -1,20 +0,0 @@ -without skip: -string1 - - - str - // aa -// - / aa - -without comment skip: -string1 - str - // aa -// - / aa - -with comment skip: -string1 -str -/ aa diff --git a/dependencies/Common/test/tRunOnNode.cc b/dependencies/Common/test/tRunOnNode.cc deleted file mode 100644 index 2661e540e6eb26cfc277bce7e769292ba4c6f025..0000000000000000000000000000000000000000 --- a/dependencies/Common/test/tRunOnNode.cc +++ /dev/null @@ -1,51 +0,0 @@ -//# testRunOnNode.cc: Program to test the interface to the LofarLogger. -//# -//# Copyright (C) 2004 -//# ASTRON (Netherlands Institute for Radio Astronomy) -//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands -//# -//# This file is part of the LOFAR software suite. -//# The LOFAR software suite 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 3 of the License, or -//# (at your option) any later version. -//# -//# The LOFAR software suite 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 the LOFAR software suite. If not, see <http://www.gnu.org/licenses/>. -//# -//# $Id$ - -//# Always #include <lofar_config.h> first! -#include <lofar_config.h> - -#include <Common/RunOnNode.h> -#include <Common/lofar_iostream.h> - -using namespace LOFAR; - -int main (int, const char**) { - - cout << "Program started" << endl; - - cout << "Initialise RunOnNode; tell this process to be (0,0)" << endl; - SETNODE(0,0); - - cout << "Check for conditional execution" << endl; - RUNINPROCESS(0,0) cout << "Executing code for (0,0)" << endl; - RUNINPROCESS(3,7) cout << "ERROR: Executing code for (3,7)" << endl; - -// todo:test reset of node (not implemented yet) -// cout << "Now re-init to (3,7)" << endl; -// SETNODE(3,7); -// cout << "Check for conditional execution" << endl; -// RUNINPROCESS(0,0) cout << "ERROR: Executing code for (0,0)" << endl; -// RUNINPROCESS(3,7) cout << "Executing code for (3,7)" << endl; - - -} - diff --git a/dependencies/Common/test/tRunOnNode.log_prop b/dependencies/Common/test/tRunOnNode.log_prop deleted file mode 100644 index 0ea5ae250165827faa16dafdc22b590996f28db9..0000000000000000000000000000000000000000 --- a/dependencies/Common/test/tRunOnNode.log_prop +++ /dev/null @@ -1,12 +0,0 @@ -# Property file to be use with the demo program testLogger. - -# Configure the rootLogger -log4cplus.rootLogger=DEBUG, STDOUT -# Define the STDOUT appender -log4cplus.appender.STDOUT=log4cplus::ConsoleAppender -log4cplus.appender.STDOUT.layout=log4cplus::PatternLayout -log4cplus.appender.STDOUT.layout.ConversionPattern=%-5p [%x]%c{3} - %m%n - -# Define foo at level TRACE4 -#log4cplus.logger.TRC.foo=TRACE4 - diff --git a/dependencies/Common/test/tRunOnNode.sh b/dependencies/Common/test/tRunOnNode.sh deleted file mode 100755 index 21c4054032ae007bca5ceb3b98647bb1a76ab8b4..0000000000000000000000000000000000000000 --- a/dependencies/Common/test/tRunOnNode.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -./runctest.sh tRunOnNode diff --git a/dependencies/Common/test/tRunOnNode.stdout b/dependencies/Common/test/tRunOnNode.stdout deleted file mode 100644 index b19f799da55e90d6df3b9d0d78e858f8cf30cfc6..0000000000000000000000000000000000000000 --- a/dependencies/Common/test/tRunOnNode.stdout +++ /dev/null @@ -1,4 +0,0 @@ -Program started -Initialise RunOnNode; tell this process to be (0,0) -Check for conditional execution -Executing code for (0,0) diff --git a/dependencies/Common/test/tSingleton.cc b/dependencies/Common/test/tSingleton.cc deleted file mode 100644 index afd243036ecfd56d2f88326b95bed76ce933eba1..0000000000000000000000000000000000000000 --- a/dependencies/Common/test/tSingleton.cc +++ /dev/null @@ -1,62 +0,0 @@ -//# tSingleton.cc: Test program for the Meyers singleton class. -//# -//# Copyright (C) 2002-2004 -//# ASTRON (Netherlands Institute for Radio Astronomy) -//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands -//# -//# This file is part of the LOFAR software suite. -//# The LOFAR software suite 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 3 of the License, or -//# (at your option) any later version. -//# -//# The LOFAR software suite 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 the LOFAR software suite. If not, see <http://www.gnu.org/licenses/>. -//# -//# $Id$ - -//# Always #include <lofar_config.h> first! -#include <lofar_config.h> - -//# Includes -#include <Common/Singleton.h> -#include <Common/lofar_iostream.h> -#include <Common/LofarLogger.h> - -namespace LOFAR -{ - template<typename T> - class Unique - { - private: - friend class Singleton<Unique>; - Unique() { LOG_TRACE_FLOW(AUTO_FUNCTION_NAME); } - ~Unique() { LOG_TRACE_FLOW(AUTO_FUNCTION_NAME); } - }; -} - -using namespace LOFAR; - -int main() -{ - INIT_LOGGER("tSingleton"); - LOG_INFO("Starting up..."); - - Unique<int>& ui1 = Singleton< Unique<int> >::instance(); - Unique<int>& ui2 = Singleton< Unique<int> >::instance(); - Unique<double>& ud1 = Singleton< Unique<double> >::instance(); - Unique<double>& ud2 = Singleton< Unique<double> >::instance(); - - ASSERT((void*)&ui1 == (void*)&ui2); - ASSERT((void*)&ud1 == (void*)&ud2); - ASSERT((void*)&ui1 != (void*)&ud1); - ASSERT((void*)&ui2 != (void*)&ud2); - - LOG_INFO("Program terminated successfully"); - return 0; -} diff --git a/dependencies/Common/test/tSingleton.sh b/dependencies/Common/test/tSingleton.sh deleted file mode 100755 index a4dab74b2ee57e5e0c975afc10cc6374c763e748..0000000000000000000000000000000000000000 --- a/dependencies/Common/test/tSingleton.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -./runctest.sh tSingleton diff --git a/dependencies/Common/test/tStreamUtil.cc b/dependencies/Common/test/tStreamUtil.cc index f6d43867b4e1541cd03453185f6b518ed8d30fc0..f5dcb528220aa87f6c284caf81a90610bb3f428f 100644 --- a/dependencies/Common/test/tStreamUtil.cc +++ b/dependencies/Common/test/tStreamUtil.cc @@ -25,10 +25,14 @@ #include <Common/StreamUtil.h> #include <Common/LofarLogger.h> -#include <Common/lofar_vector.h> -#include <Common/lofar_map.h> -#include <Common/lofar_string.h> +#include <vector> +#include <map> #include <cstring> +#include <string> + +using std::string; +using std::vector; +using std::map; using namespace LOFAR; diff --git a/dependencies/Common/test/tStringUtil.cc b/dependencies/Common/test/tStringUtil.cc index 490f92458d4aaad889e88c6302de39826cb30cdf..aa63e6fca7c273fdd27cbaca7c983ca2f619dfa1 100644 --- a/dependencies/Common/test/tStringUtil.cc +++ b/dependencies/Common/test/tStringUtil.cc @@ -26,11 +26,13 @@ #include <Common/StringUtil.h> #include <Common/LofarLogger.h> #include <Common/Timer.h> -#include <Common/lofar_set.h> #include <Common/lofar_iostream.h> #include <cmath> #include <cstring> #include <limits> +#include <set> + +using std::set; using namespace LOFAR; using namespace std; diff --git a/dependencies/Common/test/tSystemUtil.cc b/dependencies/Common/test/tSystemUtil.cc index a42b7d9038aef695ed4e872cfab09dd3f8df2520..54bd0e9cf171b559e5b0048d59501d9013e3f609 100644 --- a/dependencies/Common/test/tSystemUtil.cc +++ b/dependencies/Common/test/tSystemUtil.cc @@ -26,7 +26,6 @@ #include <Common/LofarLogger.h> #include <Common/StringUtil.h> #include <Common/SystemUtil.h> -#include <Common/hexdump.h> #include <Common/lofar_iostream.h> #include <Common/lofar_iomanip.h> #include <netinet/in.h> @@ -72,7 +71,6 @@ void testIP() string dump; CHECK_STR(address != 0, formatString("My IPV4 address is : %08lX", ntohl(address))); - hexdump (dump, (char*) &address, sizeof(address)); LOG_INFO(dump); } diff --git a/dependencies/Common/test/tTypeNames.cc b/dependencies/Common/test/tTypeNames.cc deleted file mode 100644 index ece797234fc84dff3ed1664c0514dda61a259864..0000000000000000000000000000000000000000 --- a/dependencies/Common/test/tTypeNames.cc +++ /dev/null @@ -1,75 +0,0 @@ -//# tTypeNames.cc: Test program for the TypeNames functions -//# -//# Copyright (C) 2009 -//# ASTRON (Netherlands Institute for Radio Astronomy) -//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands -//# -//# This file is part of the LOFAR software suite. -//# The LOFAR software suite 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 3 of the License, or -//# (at your option) any later version. -//# -//# The LOFAR software suite 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 the LOFAR software suite. If not, see <http://www.gnu.org/licenses/>. -//# -//# $Id$ - -//# Always #include <lofar_config.h> first! -#include <lofar_config.h> - -//# Includes -#include <Common/TypeNames.h> -#include <Common/lofar_iostream.h> -#include <Common/LofarLogger.h> -#include <stdexcept> - -using namespace LOFAR; - -int main() -{ - try { - void* vp = 0; - bool* bp = 0; - char* cp = 0; - uchar* ucp = 0; - int8* i8p = 0; - uint8* u8p = 0; - int16* i16p = 0; - uint16* u16p = 0; - int32* i32p = 0; - uint32* u32p = 0; - int64* i64p = 0; - uint64* u64p = 0; - float* fp = 0; - double* dp = 0; - fcomplex* fcp = 0; - dcomplex* dcp = 0; - ASSERT (typeName(vp) == "unknown"); - ASSERT (typeName(bp) == "bool"); - ASSERT (typeName(cp) == "char"); - ASSERT (typeName(ucp) == "uchar"); - ASSERT (typeName(i8p) == "char"); - ASSERT (typeName(u8p) == "uchar"); - ASSERT (typeName(i16p) == "int16"); - ASSERT (typeName(u16p) == "uint16"); - ASSERT (typeName(i32p) == "int32"); - ASSERT (typeName(u32p) == "uint32"); - ASSERT (typeName(i64p) == "int64"); - ASSERT (typeName(u64p) == "uint64"); - ASSERT (typeName(fp) == "float"); - ASSERT (typeName(dp) == "double"); - ASSERT (typeName(fcp) == "fcomplex"); - ASSERT (typeName(dcp) == "dcomplex"); - ASSERT (typeName(&fp) == "array<float>"); - } catch (std::exception& x) { - cout << x.what() << endl; - return 1; - } - return 0; -} diff --git a/dependencies/Common/test/tTypeNames.sh b/dependencies/Common/test/tTypeNames.sh deleted file mode 100755 index 47aaa3c43987fc4329cf557f4373cecdbc567ea9..0000000000000000000000000000000000000000 --- a/dependencies/Common/test/tTypeNames.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -./runctest.sh tTypeNames diff --git a/dependencies/LofarStMan/include/LofarStMan/LofarColumn.h b/dependencies/LofarStMan/include/LofarStMan/LofarColumn.h index 9ea782857c693686604913d9b306a9576b1b546d..01e56714de8b6857c4980d6987201eb9c26d71ab 100644 --- a/dependencies/LofarStMan/include/LofarStMan/LofarColumn.h +++ b/dependencies/LofarStMan/include/LofarStMan/LofarColumn.h @@ -25,7 +25,6 @@ //# Includes #include <LofarStMan/LofarStMan.h> -#include <Common/lofar_vector.h> #include <casacore/tables/DataMan/StManColumn.h> #include <casacore/measures/Measures/MeasFrame.h> #include <casacore/measures/Measures/MDirection.h> @@ -34,6 +33,9 @@ #include <casacore/casa/Arrays/IPosition.h> #include <casacore/casa/Containers/Block.h> #include <casacore/casa/OS/Conversion.h> +#include <vector> + +using std::vector; namespace LOFAR { diff --git a/dependencies/LofarStMan/include/LofarStMan/LofarStMan.h b/dependencies/LofarStMan/include/LofarStMan/LofarStMan.h index 4befb110f61cec02becb6dc767562e2aae427794..f961c4fbe7903a7ee17db5bba6226b9a0f25942b 100644 --- a/dependencies/LofarStMan/include/LofarStMan/LofarStMan.h +++ b/dependencies/LofarStMan/include/LofarStMan/LofarStMan.h @@ -29,7 +29,10 @@ #include <casacore/casa/Containers/Block.h> #include <casacore/casa/Containers/Record.h> #include <Common/LofarTypes.h> -#include <Common/lofar_vector.h> + +#include <vector> + +using std::vector; namespace LOFAR { diff --git a/dependencies/MSLofar/include/MSLofar/BeamTables.h b/dependencies/MSLofar/include/MSLofar/BeamTables.h index 83520bad1a47e077f242c76631dc947fa4214955..bd81e2fdf362cb7327b561fcfc72742bb0c28c8b 100644 --- a/dependencies/MSLofar/include/MSLofar/BeamTables.h +++ b/dependencies/MSLofar/include/MSLofar/BeamTables.h @@ -28,11 +28,16 @@ #include <ApplCommon/AntField.h> #include <ApplCommon/AntennaSets.h> -#include <Common/lofar_string.h> -#include <Common/lofar_vector.h> -#include <Common/lofar_map.h> #include <casacore/casa/Arrays.h> +#include <string> +#include <vector> +#include <map> + +using std::string; +using std::vector; +using std::map; + namespace LOFAR { //# Forward Declarations. diff --git a/dependencies/MSLofar/include/MSLofar/FailedTileInfo.h b/dependencies/MSLofar/include/MSLofar/FailedTileInfo.h index 7a552cbed9cc9bb0542dc87cd1fafa42ff78262b..13e9324c37c208757a8d3748029ca4027762b2cc 100644 --- a/dependencies/MSLofar/include/MSLofar/FailedTileInfo.h +++ b/dependencies/MSLofar/include/MSLofar/FailedTileInfo.h @@ -26,9 +26,14 @@ #include <casacore/casa/Quanta/MVEpoch.h> #include <casacore/casa/Arrays/Matrix.h> -#include <Common/lofar_vector.h> -#include <Common/lofar_map.h> -#include <Common/lofar_string.h> +#include <vector> +#include <string> +#include <map> + +using std::vector; +using std::string; +using std::map; + namespace LOFAR { diff --git a/dependencies/MSLofar/src/FailedTileInfo.cc b/dependencies/MSLofar/src/FailedTileInfo.cc index 264f306e630053657f42a6d5d452f953615ce207..39330994c22f0cb5348e90409e76dc72135190ae 100644 --- a/dependencies/MSLofar/src/FailedTileInfo.cc +++ b/dependencies/MSLofar/src/FailedTileInfo.cc @@ -35,10 +35,16 @@ #include <Common/StreamUtil.h> #include <Common/LofarLogger.h> #include <Common/LofarTypes.h> -#include <Common/lofar_vector.h> -#include <Common/lofar_map.h> #include <Common/lofar_iostream.h> +#include <vector> +#include <string> +#include <map> + +using std::vector; +using std::string; +using std::map; + using namespace casacore; namespace LOFAR { diff --git a/dependencies/MessageBus/src/Message.cc b/dependencies/MessageBus/src/Message.cc index 8650e2545ed2c73ba69cb7fec5fdf515118c86dc..3cd8c92468da18f03425ea500fb3167270a46da2 100644 --- a/dependencies/MessageBus/src/Message.cc +++ b/dependencies/MessageBus/src/Message.cc @@ -25,7 +25,6 @@ //# Includes #include <Common/LofarLogger.h> -#include <Common/lofar_string.h> #include <Common/StringUtil.h> #include <MessageBus/Message.h> @@ -34,6 +33,9 @@ #endif #include <time.h> +#include <string> + +using std::string; namespace LOFAR { using namespace StringUtil; diff --git a/dependencies/OTDB/doc/otdb.md b/dependencies/OTDB/doc/otdb.md deleted file mode 100644 index 70296cf402f7db98d921691a51144fb236a967e6..0000000000000000000000000000000000000000 --- a/dependencies/OTDB/doc/otdb.md +++ /dev/null @@ -1,92 +0,0 @@ -# OTDB {#otdb} - -# Software Module OTDB - -## GENERAL - -### Description -The otdb package contains the Observation Tree Database (OTDB). -- *What does it do?* -- *Why is it needed?* - -### Author/Owner - -- Arno Schoenmakers schoenmakers@astron.nl (?) - -### Overview -- *Add a diagram* -- *Add a link to the overview diagram* -- *Add a link in the overview diagram to link back to this documentation*. - -- - - - -## DEVELOPMENT - -### Analyses -*Add non-technical information and functional considerations here, like user requirements and links to minutes of -meetings with stakeholders.* - -### Design -*Add technical considerations and design choices here* - -### Source Code -- [Source](https://git.astron.nl/ro/lofar/-/tree/master/SAS/OTDB/) -- *Add a link to (generated?) source code documentation.* - -### Testing -- *How do you run unit tests?* -- *How do you run integration tests?* -- *Add a link to Jenkins jobs (if available)* - -### Build & Deploy -- *Add a link to general instructions or describe specifics here.* -- *Add a link to Jenkins jobs (if available)* - -- - - - -## OPERATIONS - -### Configuration -- *Where is the configuration file?* -- *What are the configuration options?* - -### Log Files -- *Where are the log files?* - -### Runtime -- *Where does it run? (which user@machine)* -- *How do I run it? (user documentation? examples? commandline parameters?)* -- *Other considerations? (what happens elsewhere when I start or stop it?)* - -### Interfaces (API) -- *Describe interfaces to other applications (REST API? http requests? Messagebus?)* -- *Other communication (user? import/export?)* - -### Files/Databases -- *Which databases are used?* -- *Which files are used?* - -### Dependencies -- *To/from other applications?* -- *Files?* -- *Network locations?* -- *Other?* - -### Security -- *Special privileges needed?* -- *User login?* -- *Certificates needed?* -- *Other considerations?* - -- - - - -## ADDITIONAL INFORMATION - -### User Documentation - -*e.g. Please refer to URL X for the User Documentation* - -### Operations Documentation - -*e.g. Please refer to URL X for Operations Documentation* - diff --git a/dependencies/OTDB/include/OTDB/Converter.h b/dependencies/OTDB/include/OTDB/Converter.h index 66a233369fe0b8af05395f71880b6f103751b873..76a55f5af336a8357a3d6f2e60d1e545d040800d 100644 --- a/dependencies/OTDB/include/OTDB/Converter.h +++ b/dependencies/OTDB/include/OTDB/Converter.h @@ -28,9 +28,12 @@ //# Never #include <config.h> or #include <lofar_config.h> in a header file! //# Includes -#include <Common/lofar_map.h> -#include <Common/lofar_string.h> #include <Common/LofarTypes.h> +#include <map> +#include <string> + +using std::map; +using std::string; namespace LOFAR { namespace OTDB { diff --git a/dependencies/OTDB/include/OTDB/OTDBconnection.h b/dependencies/OTDB/include/OTDB/OTDBconnection.h index 878ef8ce06621f79186dd96edfeb6d71afe15e5c..6228214f4ca4723c56b3d801b0788a8e2a8de79a 100644 --- a/dependencies/OTDB/include/OTDB/OTDBconnection.h +++ b/dependencies/OTDB/include/OTDB/OTDBconnection.h @@ -31,9 +31,12 @@ #include <OTDB/OTDBtree.h> #include <OTDB/TreeState.h> #include <OTDB/DefaultTemplate.h> -#include <Common/lofar_vector.h> -#include <Common/lofar_map.h> #include <pqxx/connection> +#include <vector> +#include <map> + +using std::vector; +using std::map; namespace LOFAR { namespace OTDB { diff --git a/dependencies/OTDB/include/OTDB/OTDBtree.h b/dependencies/OTDB/include/OTDB/OTDBtree.h index 378ec7153a085b3453e1514b0e5770d1304d9b51..bc5cd3d8509aec354eb817375afcb33ea0d4a498 100644 --- a/dependencies/OTDB/include/OTDB/OTDBtree.h +++ b/dependencies/OTDB/include/OTDB/OTDBtree.h @@ -30,9 +30,13 @@ //# Includes #include <OTDB/OTDBconstants.h> #include <OTDB/OTDBtypes.h> -#include <Common/lofar_string.h> #include <boost/date_time/posix_time/ptime.hpp> #include <pqxx/result> +#include <string> +#include <ostream> + +using std::string; +using std::ostream; namespace LOFAR { namespace OTDB { diff --git a/dependencies/OTDB/include/OTDB/TreeMaintenance.h b/dependencies/OTDB/include/OTDB/TreeMaintenance.h index e1d0c80ff1f677ea847b7ddae41f11f2038e6109..d72b6a6e74d57277fd52d9d5096e0f5b0cc5788e 100644 --- a/dependencies/OTDB/include/OTDB/TreeMaintenance.h +++ b/dependencies/OTDB/include/OTDB/TreeMaintenance.h @@ -29,7 +29,9 @@ //# Never #include <config.h> or #include <lofar_config.h> in a header file! //# Includes #include <OTDB/OTDBconnection.h> -#include <Common/lofar_vector.h> +#include <vector> + +using std::vector; namespace LOFAR { namespace OTDB { diff --git a/dependencies/OTDB/include/OTDB/wSpaceSplit.h b/dependencies/OTDB/include/OTDB/wSpaceSplit.h index d0ba6e179e5dcc87ad91a78a1c3e4d5599e66ef4..6fe5f42d57b4feb084aa9dbd025d73730b4fbae2 100644 --- a/dependencies/OTDB/include/OTDB/wSpaceSplit.h +++ b/dependencies/OTDB/include/OTDB/wSpaceSplit.h @@ -29,8 +29,11 @@ //# Never #include <config.h> or #include <lofar_config.h> in a header file! //# Includes #include <Common/LofarTypes.h> -#include <Common/lofar_vector.h> -#include <Common/lofar_string.h> +#include <vector> +#include <string> + +using std::vector; +using std::string; namespace LOFAR { namespace OTDB { diff --git a/dependencies/OTDB/sql/CMakeLists.txt b/dependencies/OTDB/sql/CMakeLists.txt deleted file mode 100644 index f0fc84bd9f7cbf247298fcfd1a8009b9f4e44196..0000000000000000000000000000000000000000 --- a/dependencies/OTDB/sql/CMakeLists.txt +++ /dev/null @@ -1,13 +0,0 @@ -# $Id$ - -lofar_package(OTDB_SQL 1.0) - -lofar_add_sbin_scripts(fresh_database) - -file(GLOB otdb_sql_files - *.sql) -install(FILES - ${otdb_sql_files} - update_all_functions.sh - DESTINATION sbin/sql) - diff --git a/dependencies/OTDB/sql/README! b/dependencies/OTDB/sql/README! deleted file mode 100644 index a361c44cbc5a2ef63ea8aa8ecc9119dcba3b3b9c..0000000000000000000000000000000000000000 --- a/dependencies/OTDB/sql/README! +++ /dev/null @@ -1,3 +0,0 @@ -This version needs a getStations) function - -please execute (with \i) the upgrade_OTDB.sql script to upgrade an existing database to the new format. diff --git a/dependencies/OTDB/sql/addComponentToVT_func.sql b/dependencies/OTDB/sql/addComponentToVT_func.sql deleted file mode 100644 index 4a982fff4e3de2cd76c20b81e48ee29312e6cda6..0000000000000000000000000000000000000000 --- a/dependencies/OTDB/sql/addComponentToVT_func.sql +++ /dev/null @@ -1,187 +0,0 @@ --- --- addComponentToVT.sql: create a VIC template from the component database --- --- Copyright (C) 2005 --- ASTRON (Netherlands Foundation for Research in Astronomy) --- P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, softwaresupport@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$ --- - - --- --- helper function --- instanciateVTleafNode(orgNodeID, newTreeID, newParentID, newName, instances):newNodeID --- --- Constructs a VT node from the given VC nodeID. --- --- Authorisation: none --- --- Tables: VICnodedef read --- VICtemplate insert --- --- Types: none --- -CREATE OR REPLACE FUNCTION instanciateVTleafNode(INT4, INT4, INT4, VARCHAR(150), INT2) - RETURNS INT4 AS $$ - -- $Id$ - DECLARE - vNode RECORD; - vNewNodeID VICtemplate.nodeID%TYPE; - - BEGIN - SELECT nodeID, constraints - INTO vNode - FROM VICnodeDef - WHERE nodeID = $1; - - vNewNodeID := nextval('VICtemplateID'); - INSERT - INTO VICtemplate(treeID, nodeID, parentID, originID, - name, leaf, instances, limits) - VALUES ($2, vNewNodeID, $3, vNode.nodeID, - $4, false, $5, vNode.constraints); - -- note: nodeId and index are defaulted. - - PERFORM instanciateVTparams($1, $2, vNewNodeID); - - RETURN vNewNodeID; - END; -$$ LANGUAGE plpgsql; - - --- addComponentToVT(authToken, orgNodeID, newTreeID, newParentID, newName): newNodeID --- --- Add the given component under the given parentNode of a template --- tree. --- --- Authorisation: none --- --- Tables: VICnodedef read --- VICparamdef read --- VICtemplate insert --- --- Types: none --- -CREATE OR REPLACE FUNCTION addComponentToVT(INT4, INT4, INT4, INT4, VARCHAR(150)) - RETURNS INT4 AS $$ - -- $Id$ - DECLARE - vFunction CONSTANT INT2 := 1; - TTtemplate CONSTANT INT2 := 20; - vIsAuth BOOLEAN; - vAuthToken ALIAS FOR $1; - vTreeType OTDBtree.treeType%TYPE; - vLeaf BOOLEAN; - vNewNodeID VICtemplate.nodeID%TYPE; - vNodeName VICtemplate.name%TYPE; - vVersion VICnodedef.version%TYPE; - vParentRefID VICtemplate.originID%TYPE; - vDummy VICparamDef.paramID%TYPE; - vInstances INT2; - vNewName VARCHAR(150); - - BEGIN - -- check authorisation(authToken, treeID, func, dummy) - vIsAuth := FALSE; - SELECT isAuthorized(vAuthToken, $3, vFunction, 0) - INTO vIsAuth; - IF NOT vIsAuth THEN - RAISE EXCEPTION 'Not authorized'; - END IF; - - -- check tree type - SELECT treeType - INTO vTreeType - FROM OTDBtree - WHERE treeID = $3; - IF NOT FOUND THEN - RAISE EXCEPTION 'Tree % does not exist', $3; - END IF; - IF vTreeType <> TTtemplate THEN - RAISE EXCEPTION 'Tree % is not a template tree', $3; - END IF; - - -- check if parent node exist when not adding top node - IF $4 <> 0 THEN - SELECT leaf - INTO vLeaf - FROM VICtemplate - WHERE treeID = $3 - AND nodeID = $4; - IF NOT FOUND THEN - RAISE EXCEPTION 'Node % does not exist in tree %', $4, $3; - END IF; - IF vLeaf = TRUE THEN - RAISE EXCEPTION 'Node % is a parameter, not a node.', $4; - END IF; - END IF; - - -- check if orgNode exists - SELECT name, version - INTO vNodeName, vVersion - FROM VICnodeDef - WHERE nodeid = $2; - IF NOT FOUND THEN - RAISE EXCEPTION 'Original node not found in components.'; - END IF; - - -- check if this node may be a child from the parent. - BEGIN - IF $4 <> 0 THEN - -- first get definition of parent - SELECT originID - INTO vParentRefID - FROM VICtemplate - WHERE nodeID = $4; - -- we assume it exists, because it was added before! - - -- note: limits contains `instances` default. - SELECT paramid,CAST(limits AS INT2) - INTO vDummy,vInstances - FROM VICparamDef - WHERE nodeID = vParentRefID - AND name = childNodeName(vNodeName, vVersion); - IF NOT FOUND THEN - RAISE EXCEPTION 'Node % cannot be a child from parent %', - vNodeName, $4; - END IF; - ELSE -- $4 == 0: top node - SELECT CAST(limits AS INT2) - INTO vInstances - FROM VICparamDef - WHERE name = childNodeName(vNodeName, vVersion); - END IF; - EXCEPTION -- catch possible exception of cast - WHEN invalid_text_representation THEN - vInstances := 1; - END; - - -- if no newname was specified use existing one - IF length($5) < 2 THEN - vNewName = vNodeName; - ELSE - vNewName = $5; - END IF; - - -- finally copy the node (orgNode, tree, parent, newname) - vNewNodeID := instanciateVTleafNode($2, $3, $4, vNewName, vInstances); - - RETURN vNewNodeID; - END; -$$ LANGUAGE plpgsql; - diff --git a/dependencies/OTDB/sql/addKVT_func.sql b/dependencies/OTDB/sql/addKVT_func.sql deleted file mode 100644 index 9e38f06c5d4433e5e0af6254a826b4d7de829d06..0000000000000000000000000000000000000000 --- a/dependencies/OTDB/sql/addKVT_func.sql +++ /dev/null @@ -1,101 +0,0 @@ --- --- addKVT.sql: Add a parametervalue to the KVT tables --- --- Copyright (C) 2005 --- ASTRON (Netherlands Foundation for Research in Astronomy) --- P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, softwaresupport@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$ --- - --- --- addKVT (fullname, value, timestr) --- --- Expected timeformat YYYY Mon DD HH24:MI:SS.MS --- --- Add the given KVT triple to the KVT tables. --- --- Authorisation: no --- --- Tables: pickvt insert --- vickvt insert --- picparamref read --- --- Types: none --- -CREATE OR REPLACE FUNCTION addKVT (INT, VARCHAR(150), VARCHAR(150), VARCHAR(20)) - RETURNS BOOLEAN AS ' - -- $Id$ - DECLARE - vParRefID PICparamref.paramID%TYPE; - vTreeType OTDBtree.treetype%TYPE; - vTime timestamp := NULL; - vLastValue TEXT; - TThierarchy CONSTANT INT2 := 30; - - BEGIN - -- convert timestamp - IF LENGTH($4) > 0 THEN - vTime := to_timestamp($4, \'YYYY-Mon-DD HH24:MI:SS.US\'); - END IF; - IF vTime IS NULL THEN - vTime := now(); - END IF; - - -- Is it a PIC param? - vParRefID := 0; - SELECT paramid - INTO vParRefID - FROM PICparamRef - WHERE PVSSname = $2 - LIMIT 1; - - IF FOUND THEN - -- its a PIC parameter - IF $3::integer <= 10 THEN - -- plain ON/OFF only register if last one was a serious problem - vLastValue := 100; - SELECT value - INTO vLastValue - FROM PICkvt - WHERE paramID = vParRefID - ORDER BY time DESC - LIMIT 1; - IF vLastValue::integer <= 10 THEN - RETURN FALSE; - END IF; - END IF; - INSERT INTO PICkvt(paramID, value, time) - VALUES (vParRefID, $3, vTime); - RETURN TRUE; - END IF; - - -- it is probably a VIC parameter, just store on name. - SELECT treetype - INTO vTreeType - FROM otdbtree - WHERE treeid=$1; - IF vTreeType = TThierarchy THEN - INSERT INTO VICkvt (treeid, paramName, value, time) - VALUES ($1, $2, $3, vTime); - -- ELSE its a PIC kvt without an entry in the PIC - END IF; - - RETURN TRUE; - END; -' LANGUAGE plpgsql; - diff --git a/dependencies/OTDB/sql/addPICparam_func.sql b/dependencies/OTDB/sql/addPICparam_func.sql deleted file mode 100644 index c826879bb41c2e0bb5816ab7b264777fa9ff0182..0000000000000000000000000000000000000000 --- a/dependencies/OTDB/sql/addPICparam_func.sql +++ /dev/null @@ -1,146 +0,0 @@ --- --- addPICparam.sql: Add a parameter to an PIC tree. --- --- Copyright (C) 2005 --- ASTRON (Netherlands Foundation for Research in Astronomy) --- P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, softwaresupport@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$ --- - --- --- addPICparam (treeID, PVSSname, parType) --- --- Adds the given parameter to the given hierarchical tree. Assures that --- the parameter is also known in the reference table. --- --- Authorisation: no --- --- Tables: --- PICparamref insert --- PicHierarchy insert --- --- Types: none --- -CREATE OR REPLACE FUNCTION addPICparam (INT4, VARCHAR(150), INT2) - RETURNS INT4 AS ' - -- $Id$ - DECLARE - vParRefID PICparamref.paramID%TYPE; - vNodeID PIChierarchy.nodeID%TYPE; - vParentID PIChierarchy.parentID%TYPE; - vParType param_type.id%TYPE; - vFullname VARCHAR(150); - vNodename VARCHAR(150); - vBasename VARCHAR(150); - vParamIndex INT2; - vFieldnr INT4; - vLeaf BOOLEAN; - - BEGIN - -- convert pvss-type to param-type - SELECT m.id - INTO vParType - FROM param_type m, pvss_type s - WHERE s.id = $3 and s.name = m.name; - IF NOT FOUND THEN - RAISE EXCEPTION \'Parametertype %d can not be converted\', $3; - END IF; - - -- be sure NODE exists in reference table. - -- name has format like xxx:aaa.bbb.ccc.ddd or xxx:aaa.bbb.ccc.ddd_eee - vNodename := rtrim($2, \'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890_\'); -- xxx:aaa_bbb_ccc. - vNodename := rtrim(vNodename, \'.\'); -- xxx:aaa.bbb.ccc - vFullname := $2; -- xxx:aaa.bbb.ccc.ddd_eee - IF length(vNodename) > 0 THEN - SELECT paramID - INTO vParRefID - FROM PICparamRef - WHERE PVSSname = vNodename - LIMIT 1; - IF NOT FOUND THEN - -- node not yet in reference table, add it. - INSERT INTO PICparamRef(PVSSname, par_type) - VALUES (vNodename, 0); -- type=node - END IF; - END IF; - - -- be sure PARAMETER exists in reference table. - vParRefID := 0; - SELECT paramID - INTO vParRefID - FROM PICparamRef - WHERE PVSSname = vFullname - LIMIT 1; - IF NOT FOUND THEN - -- param not yet in reference table, add it. - -- TODO: add other fields also. - INSERT INTO PICparamRef(PVSSname, par_type) - VALUES (vFullname, vParType); - -- and retrieve its ID --- SELECT paramID --- INTO vParRefID --- FROM PICparamRef --- WHERE PVSSname = vFullname; - END IF; - - -- add record to the PIC hierachical tree - vBasename := \'\'; - vFieldnr := 1; - vParentID := 0; - vNodeID := 0; - vParamIndex := -1; -- TODO - LOOP - vNodename := split_part(vFullname, \'.\', vFieldnr); - EXIT WHEN length(vNodename) <= 0; - IF vFieldnr != 1 THEN - vBasename := vBasename || \'.\'; - END IF; - vBasename := vBasename || vNodename; - - SELECT nodeID, paramRefID - INTO vNodeID, vParRefID - FROM PIChierarchy - WHERE treeID = $1 - AND parentID = vParentID - AND name = vBasename; - IF NOT FOUND THEN - vNodeID := nextval(\'PIChierarchID\'); - IF length(split_part(vFullname, \'.\', vFieldnr+1)) <= 0 THEN - vLeaf := TRUE; - ELSE - vLeaf := FALSE; - END IF; - -- get id of original parameter - SELECT paramID - INTO vParRefID - FROM PICparamRef - WHERE PVSSname = vBasename; - INSERT INTO PIChierarchy(treeID, nodeID, parentID, - paramRefID, name, index, leaf) - VALUES ($1, vNodeID, vParentID, - vParRefID, vBasename, vParamIndex, vLeaf); - END IF; - - vFieldnr := vFieldnr + 1; - vParentID:= vNodeID; - END LOOP; - - RETURN vNodeID; - END; -' LANGUAGE plpgsql; - diff --git a/dependencies/OTDB/sql/addTreeState_func.sql b/dependencies/OTDB/sql/addTreeState_func.sql deleted file mode 100644 index 4ada8a77b1173f8f5ba3b0767b8fdd933c02d49f..0000000000000000000000000000000000000000 --- a/dependencies/OTDB/sql/addTreeState_func.sql +++ /dev/null @@ -1,58 +0,0 @@ --- --- addTreeState.sql: Add a state change to the history --- --- Copyright (C) 2005 --- ASTRON (Netherlands Foundation for Research in Astronomy) --- P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, softwaresupport@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$ --- - --- --- addTreeState (treeID, momID, newState, userID, timestr) --- --- Expected timeformat YYYY Mon DD HH24:MI:SS.MS --- --- Authorisation: no --- --- Tables: StateHistory insert --- user read --- --- Types: none --- -CREATE OR REPLACE FUNCTION addTreeState (INT4, INT4, INT2, INT4, VARCHAR(20)) - RETURNS VOID AS ' - -- $Id$ - DECLARE - vTime timestamp := NULL; - - BEGIN - -- convert timestamp - IF LENGTH($5) > 0 THEN - vTime := to_timestamp($5, \'YYYY-Mon-DD HH24:MI:SS.US\'); - END IF; - IF vTime IS NULL THEN - vTime := now(); - END IF; - - -- add value - INSERT INTO StateHistory(treeID, momID, state, userID, timestamp) - VALUES ($1, $2, $3, $4, vTime); - RETURN; - END; -' LANGUAGE plpgsql; - diff --git a/dependencies/OTDB/sql/assignProcessType_func.sql b/dependencies/OTDB/sql/assignProcessType_func.sql deleted file mode 100644 index 3687a84bbf30bd4c5322f9035995d66467f8c8fb..0000000000000000000000000000000000000000 --- a/dependencies/OTDB/sql/assignProcessType_func.sql +++ /dev/null @@ -1,204 +0,0 @@ --- --- assignProcessType.sql: Assign processType, processSubtype and category to a tree. --- --- Copyright (C) 2011 --- ASTRON (Netherlands Foundation for Research in Astronomy) --- P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, softwaresupport@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:$ --- - - --- --- assignProcessType (auth, treeID, processType, processSubtype, strategy) --- --- Assign the given values to the tree, make sure that the combination is unique for defaultTemplates. --- --- Authorisation: none --- --- Tables: otdbtree write --- otdbuser read --- --- Types: none --- -CREATE OR REPLACE FUNCTION assignProcessType(INT4, INT4, VARCHAR(20), VARCHAR(50), VARCHAR(30)) - RETURNS BOOLEAN AS $$ - -- $Id: addComponentToVT_func.sql 19935 2012-01-25 09:06:14Z mol $ - DECLARE - TTtemplate CONSTANT INT2 := 20; - vFunction CONSTANT INT2 := 1; - vTreeType OTDBtree.treetype%TYPE; - vName OTDBtree.name%TYPE; - vIsAuth BOOLEAN; - vDummy OTDBtree.treeID%TYPE; - vNodeID INTEGER; - vRecord RECORD; - aAuthToken ALIAS FOR $1; - aTreeID ALIAS FOR $2; - aProcessType ALIAS FOR $3; - aProcessSubtype ALIAS FOR $4; - aStrategy ALIAS FOR $5; - - BEGIN - -- check authorisation(authToken, tree, func, parameter) - vIsAuth := FALSE; - SELECT isAuthorized(aAuthToken, aTreeID, vFunction, 0) - INTO vIsAuth; - IF NOT vIsAuth THEN - RAISE EXCEPTION 'Not authorized to assign the processType to tree %', aTreeID; - END IF; - - -- get treetype - SELECT treetype, name - INTO vTreeType, vName - FROM OTDBtree - WHERE treeID = aTreeID; - IF NOT FOUND THEN - RAISE EXCEPTION 'Tree % does not exist', aTreeID; - END IF; - - -- not applicable for PIC trees. - IF vTreeType != TTtemplate THEN - RAISE EXCEPTION 'Process(sub)Types can only be assigned to (default) templates.'; - END IF; - - -- check for double defaulttemplate entries - IF vName IS NOT NULL AND aProcessType != '' THEN - SELECT treeID - INTO vDummy - FROM OTDBtree - WHERE processType = aProcessType - AND processSubtype = aProcessSubtype - AND strategy = aStrategy - AND name IS NOT NULL; - IF FOUND AND vDummy != aTreeID THEN - RAISE EXCEPTION 'There is already a defaultTemplate with the values %, %, %', - aProcessType, aProcessSubtype, aStrategy; - END IF; - END IF; - - -- check if combination is allowed --- SELECT * --- INTO vRecord --- FROM processTypes --- WHERE processType = aProcessType --- AND processSubtype = aProcessSubtype --- AND strategy = aStrategy; --- IF NOT FOUND THEN --- RAISE EXCEPTION 'The combination of %, %, % for processType, processSubtype and strategy is not allowed', --- aProcessType, aProcessSubtype, aStrategy; --- END IF; - - -- finally update the metadata info - UPDATE OTDBtree - SET processType = aProcessType, - processSubtype = aProcessSubtype, - strategy = aStrategy - WHERE treeID = aTreeID; - - RETURN TRUE; - END; -$$ LANGUAGE plpgsql; - --- --- INTERNAL FUNCTION --- Copy the processTypes from one tree to another. --- --- Authorisation: none --- --- Tables: otdbtree write --- --- Types: none --- -CREATE OR REPLACE FUNCTION copyProcessType(INT4, INT4) - RETURNS BOOLEAN AS $$ - -- $Id: addComponentToVT_func.sql 19935 2012-01-25 09:06:14Z mol $ - DECLARE - vProcessType OTDBtree.processType%TYPE; - vProcessSubtype OTDBtree.processSubtype%TYPE; - vStrategy OTDBtree.strategy%TYPE; - vResult BOOLEAN; - aOrgTreeID ALIAS FOR $1; - aDestTreeID ALIAS FOR $2; - - BEGIN - -- get treetype - SELECT processType, processSubtype, strategy - INTO vProcessType, vProcessSubtype, vStrategy - FROM OTDBtree - WHERE treeID = aOrgTreeID; - IF NOT FOUND THEN - RAISE EXCEPTION 'Tree % does not exist', aTreeID; - END IF; - - -- update the metadata info - UPDATE OTDBtree - SET processType = vProcessType, - processSubtype = vProcessSubtype, - strategy = vStrategy - WHERE treeID = aDestTreeID; - - RETURN TRUE; - END; -$$ LANGUAGE plpgsql; - --- --- INTERNAL FUNCTION --- --- exportProcessType(treeID, prefixLen) --- --- Return the processType values as a linefeed separated key-value list --- --- Authorisation: none --- --- Tables: otdbtree read --- --- Types: none --- -CREATE OR REPLACE FUNCTION exportProcessType(INT4, INT4) - RETURNS TEXT AS $$ - -- $Id: addComponentToVT_func.sql 19935 2012-01-25 09:06:14Z mol $ - DECLARE - vResult TEXT := ''; - vPrefix TEXT; - vProcessType OTDBtree.processType%TYPE; - vProcessSubtype OTDBtree.processSubtype%TYPE; - vStrategy OTDBtree.strategy%TYPE; - aTreeID ALIAS FOR $1; - aPrefixLen ALIAS FOR $2; - - BEGIN - -- get processInfo - SELECT processType, processSubtype, strategy - INTO vProcessType, vProcessSubtype, vStrategy - FROM OTDBtree - WHERE treeID = aTreeID; - IF NOT FOUND THEN - RAISE EXCEPTION 'Tree % does not exist', aTreeID; - END IF; - - SELECT substr(name, aPrefixLen) - INTO vPrefix - FROM getVHitemList(aTreeID, '%.Observation'); - vResult := vResult || vPrefix || '.processType=' || vProcessType || chr(10); - vResult := vResult || vPrefix || '.processSubtype=' || vProcessSubtype || chr(10); - vResult := vResult || vPrefix || '.strategy=' || vStrategy || chr(10); - - RETURN vResult; - END; -$$ LANGUAGE plpgsql; - diff --git a/dependencies/OTDB/sql/buildTemplateTree_func.sql b/dependencies/OTDB/sql/buildTemplateTree_func.sql deleted file mode 100644 index bfc9a1b4b59a47490f65351be6fb8b0ed231d801..0000000000000000000000000000000000000000 --- a/dependencies/OTDB/sql/buildTemplateTree_func.sql +++ /dev/null @@ -1,244 +0,0 @@ --- --- buildTemplateTree.sql: create a VIC template from the component database --- --- Copyright (C) 2005 --- ASTRON (Netherlands Foundation for Research in Astronomy) --- P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, softwaresupport@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$ --- - - --- --- helper function --- instanciateVTparams(orgNodeID, newTreeID, newNodeID) --- --- Gives the newNodeID in the newTreeID the same parameters as the orgNode. --- Note: new node must already exist. --- --- Authorisation: none --- --- Tables: VICparamdef read --- VICtemplate insert --- --- Types: none --- -CREATE OR REPLACE FUNCTION instanciateVTparams(INT4, INT4, INT4) - RETURNS VOID AS $$ - -- $Id$ - DECLARE - vParam RECORD; - dfltValue VARCHAR(200); - - BEGIN ---RAISE WARNING 'params:%,%,%', $1, $2, $3; - FOR vParam IN - SELECT paramID, name, limits, par_type - FROM VICparamDef - WHERE nodeID = $1 - AND name NOT like '#%' - LOOP - IF vParam.par_type >= 300 THEN -- popup parameter? leave limits fiels empty. - dfltValue := substring(vParam.limits from '[a-zA-Z0-9+-/_.,<>]+;([a-zA-Z0-9+-/_.,<>]+)'); - IF dfltValue IS NULL THEN - dfltValue := ''; - END IF; ---RAISE WARNING 'X:%,%', vParam.name, dfltValue; - INSERT - INTO VICtemplate(treeID, parentID, originID, name, instances, limits) - VALUES ($2, $3, vParam.paramID, vParam.name, 1, dfltValue); - -- note: nodeId, index and leaf are defaulted. - ELSE - INSERT - INTO VICtemplate(treeID, parentID, originID, name, instances, limits) - VALUES ($2, $3, vParam.paramID, vParam.name, 1, vParam.limits); - -- note: nodeId, index and leaf are defaulted. - END IF; - END LOOP; - RETURN; - END; -$$ LANGUAGE plpgsql; - --- --- helper function --- instanciateVTleafNode(orgNodeID, newTreeID, newParentID):newNodeID --- --- Constructs a VT node from the given VC nodeID. --- --- Authorisation: none --- --- Tables: VICnodedef read --- VICtemplate insert --- --- Types: none --- -CREATE OR REPLACE FUNCTION instanciateVTleafNode(INT4, INT4, INT4) - RETURNS INT4 AS $$ - -- $Id$ - DECLARE - vNode RECORD; - vNewNodeID VICtemplate.nodeID%TYPE; - vInstances INT2; - - BEGIN ---RAISE WARNING 'leafNode:%,%,%', $1, $2, $3; - SELECT nodeID, name, version, constraints - INTO vNode - FROM VICnodeDef - WHERE nodeID = $1; - ---RAISE WARNING 'leafNode:%,%,%', $1, vNode.name, vNode.version; - BEGIN - SELECT CAST(limits AS INT2) - INTO vInstances - FROM VICparamdef - WHERE name = childNodeName(vNode.name, vNode.version); - IF NOT FOUND THEN - vInstances := 1; - END IF; - EXCEPTION - WHEN invalid_text_representation THEN - vInstances := 1; - END; - - vNewNodeID := nextval('VICtemplateID'); - INSERT - INTO VICtemplate(treeID, nodeID, parentID, originID, name, leaf, instances, limits) - VALUES ($2, vNewNodeID, $3, vNode.nodeID, strippedNodeName(vNode.name), false, 1, vNode.constraints); - -- note: nodeId and index are defaulted. - - PERFORM instanciateVTparams($1, $2, vNewNodeID); - - RETURN vNewNodeID; - END; -$$ LANGUAGE plpgsql; - - --- helper function --- instanciateVTsubTree(orgNodeID, newTreeID, newParentID): newNodeID --- --- Duplicates a subtree starting at node orgNode to VT tree newTreeID --- under node newParentID. --- Recursive routine. --- --- Authorisation: none --- --- Tables: VICnodedef read --- VICparamdef read --- VICtemplate insert --- --- Types: none --- -CREATE OR REPLACE FUNCTION instanciateVTsubTree(INT4, INT4, INT4) - RETURNS INT4 AS $$ - -- $Id$ - DECLARE - vNode RECORD; - vNodeID VICnodeDef.nodeID%TYPE; - vNewNodeID VICtemplate.nodeID%TYPE; - vDummy VICtemplate.nodeID%TYPE; - vVersionNr INT4; - - BEGIN ---RAISE WARNING 'subTree:%,%,%', $1, $2, $3; - - -- copy node itself - vNewNodeID := instanciateVTleafNode($1, $2, $3); - - -- loop through children - FOR vNode IN - SELECT name - FROM VICparamDef - WHERE nodeID = $1 - AND name like '#%' - LOOP - vVersionNr := getVersionNr(vNode.name); - vNode.name := cleanNodeName(vNode.name); ---RAISE WARNING 'subTree2:%,%', vVersionNr, vNode.name; - -- translate name and versionnumber into node - SELECT nodeID - INTO vNodeID - FROM VICnodeDef - WHERE name = vNode.name - AND version = vVersionNr; - vDummy := instanciateVTsubTree(vNodeID, $2, vNewNodeID); - END LOOP; - - RETURN vNewNodeID; - END; -$$ LANGUAGE plpgsql; - - --- --- instanciateVTtree (authToken, componentID, classif):newTreeID --- --- Creates a full VT tree from the given top component --- --- Authorisation: yes --- --- Tables: VICnodedef read --- VICparamdef read --- VICtemplate insert --- OTDBtree insert --- --- Types: none --- -CREATE OR REPLACE FUNCTION instanciateVTtree(INT4, INT4, INT2) - RETURNS INT4 AS $$ - -- $Id$ - DECLARE - vFunction CONSTANT INT2 := 1; - TTtemplate CONSTANT INT2 := 20; - TSbeingspec CONSTANT INT2 := 100; - vIsAuth BOOLEAN; - vOrgNodeID VICtemplate.nodeID%TYPE; - vNewNodeID VICtemplate.nodeID%TYPE; - vNewTreeID OTDBtree.treeID%TYPE; - vAuthToken ALIAS FOR $1; - - BEGIN - -- check authorisation(authToken, treeID, func, dummy) - vIsAuth := FALSE; - SELECT isAuthorized(vAuthToken, 0, vFunction, 0) - INTO vIsAuth; - IF NOT vIsAuth THEN - RAISE EXCEPTION 'Not authorized'; - END IF; - - -- create a new tree(auth, ..., classif, treetype, campaign) - SELECT newTree($1, 0, 0, $3, TTtemplate, TSbeingspec, 0) - INTO vNewTreeID; - IF vNewTreeID = 0 THEN - RAISE EXCEPTION 'Tree can not be created'; - END IF; - - -- get topNode - SELECT nodeID - INTO vOrgNodeID - FROM VICnodeDef - WHERE nodeID = $2; - IF NOT FOUND THEN - RAISE EXCEPTION 'Component % is unknown', $2; - END IF; - - -- recursively instanciate the tree - vNewNodeID := instanciateVTsubTree($2, vNewTreeID, 0); - - RETURN vNewTreeID; - END; -$$ LANGUAGE plpgsql; - diff --git a/dependencies/OTDB/sql/campaignAPI.sql b/dependencies/OTDB/sql/campaignAPI.sql deleted file mode 100644 index 7611bbf10f3a939ad0763b711f6bac53da514da5..0000000000000000000000000000000000000000 --- a/dependencies/OTDB/sql/campaignAPI.sql +++ /dev/null @@ -1,221 +0,0 @@ --- --- getCampaign.sql: gets the topnode of the tree --- --- Copyright (C) 2010 --- ASTRON (Netherlands Foundation for Research in Astronomy) --- P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, softwaresupport@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: getNode_func.sql 6634 2005-10-07 10:20:03Z overeem $ --- - --- --- getCampaign(campaignID) --- --- Gets a campaign by its internal ID --- --- Authorisation: no --- --- Tables: campaign read --- --- Types: campaign --- -CREATE OR REPLACE FUNCTION getCampaign(INT4) - RETURNS campaignInfo AS ' - -- $Id: addComponentToVT_func.sql 19935 2012-01-25 09:06:14Z mol $ - DECLARE - vCampaign RECORD; - - BEGIN - SELECT ID, name, title, PI, CO_I, contact - INTO vCampaign - FROM campaign - WHERE ID = $1; - IF NOT FOUND THEN - RAISE EXCEPTION \'Campaign % does not exist\', $1; - END IF; - - RETURN vCampaign; - END; -' LANGUAGE plpgsql; - --- --- getCampaign(campaignname) --- --- Gets a campaign by its name --- --- Authorisation: no --- --- Tables: campaign read --- --- Types: campaign --- -CREATE OR REPLACE FUNCTION getCampaign(VARCHAR(20)) - RETURNS campaignInfo AS ' - -- $Id: addComponentToVT_func.sql 19935 2012-01-25 09:06:14Z mol $ - DECLARE - vCampaign RECORD; - - BEGIN - SELECT ID, name, title, PI, CO_I, contact - INTO vCampaign - FROM campaign - WHERE name = $1; - IF NOT FOUND THEN - RAISE EXCEPTION \'Campaign % does not exist\', $1; - END IF; - - RETURN vCampaign; - END; -' LANGUAGE plpgsql; - --- --- getCampaignList () --- --- Get a list of campaign. --- --- Authorisation: none --- --- Tables: campaign read --- --- Types: campaign --- -CREATE OR REPLACE FUNCTION getCampaignList() - RETURNS SETOF campaignInfo AS ' - -- $Id: addComponentToVT_func.sql 19935 2012-01-25 09:06:14Z mol $ - DECLARE - vRecord RECORD; - - BEGIN - FOR vRecord IN - SELECT ID, name, title, PI, CO_I, contact - FROM campaign - ORDER BY ID ASC - LOOP - RETURN NEXT vRecord; - END LOOP; - RETURN; - END -' LANGUAGE plpgsql; - --- --- saveCampaign (ID, name, title, PI, CO_I, contact) --- --- Saves the new values to the database --- --- Authorisation: no --- --- Tables: campaign insert/update --- --- Types: none --- -CREATE OR REPLACE FUNCTION saveCampaign(INT4, VARCHAR(30), VARCHAR(100), VARCHAR(80), VARCHAR(80), VARCHAR(120)) - RETURNS INT4 AS ' - -- $Id: addComponentToVT_func.sql 19935 2012-01-25 09:06:14Z mol $ - DECLARE - vID campaign.ID%TYPE; - - BEGIN - -- check if node exists - IF $1 = 0 THEN - SELECT ID - INTO vID - FROM campaign - WHERE name = $2; - ELSE - SELECT ID - INTO vID - FROM campaign - WHERE ID = $1; - END IF; - IF (NOT FOUND) THEN - -- create new node - vID := nextval(\'campaignID\'); - INSERT INTO campaign (id, name, title, PI, CO_I, contact) - VALUES (vID, $2, $3, $4, $5, $6); - ELSE - -- update node - UPDATE campaign - SET name = $2, - title = $3, - PI = $4, - CO_I = $5, - contact = $6 - WHERE ID = vID; - END IF; - - IF NOT FOUND THEN - RAISE EXCEPTION \'Node % could not be saved\', $4; - RETURN 0; - END IF; - - RETURN vID; - END; -' LANGUAGE plpgsql; - --- --- exportCampaign(treeID, prefixLen)) --- --- Return the campaign as a linefeed separated key-value list --- --- Authorisation: none --- --- Tables: campaign read --- --- Types: none --- -CREATE OR REPLACE FUNCTION exportCampaign(INT4, INT4) - RETURNS TEXT AS $$ - -- $Id: addComponentToVT_func.sql 19935 2012-01-25 09:06:14Z mol $ - DECLARE - vResult TEXT := ''; - vPrefix TEXT; - vRecord RECORD; - vCID campaign.id%TYPE; - aTreeID ALIAS FOR $1; - aPrefixLen ALIAS FOR $2; - - BEGIN - SELECT campaign - INTO vCID - FROM otdbtree - WHERE treeID = aTreeID; - IF NOT FOUND THEN - RAISE WARNING 'Tree % not found', $1; - RETURN vResult; - END IF; - - SELECT * - INTO vRecord - FROM campaign - WHERE ID = vCID; - IF NOT FOUND THEN - RAISE WARNING 'Campaign % not found', vCID; - RETURN vResult; - END IF; - - SELECT substr(name,$2) - INTO vPrefix - FROM getVHitemList($1, '%.Observation'); - vResult := vResult || vPrefix || '.Campaign.name="' || vRecord.name || '"' || chr(10); - vResult := vResult || vPrefix || '.Campaign.title="' || vRecord.title || '"' || chr(10); - vResult := vResult || vPrefix || '.Campaign.PI="' || vRecord.PI || '"' || chr(10); - vResult := vResult || vPrefix || '.Campaign.CO_I="' || vRecord.CO_I || '"' || chr(10); - vResult := vResult || vPrefix || '.Campaign.contact="' || vRecord.contact || '"' || chr(10); - RETURN vResult; - END -$$ LANGUAGE plpgsql; - diff --git a/dependencies/OTDB/sql/classify_func.sql b/dependencies/OTDB/sql/classify_func.sql deleted file mode 100644 index 209248c70f8a51d1808c039eade573adde8fda3b..0000000000000000000000000000000000000000 --- a/dependencies/OTDB/sql/classify_func.sql +++ /dev/null @@ -1,99 +0,0 @@ --- --- classify.sql: function for classifying a tree. --- --- Copyright (C) 2005 --- ASTRON (Netherlands Foundation for Research in Astronomy) --- P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, softwaresupport@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$ --- - --- --- classify (authToken, treeID, classification) --- --- Checks is the classification is legal before assigning it. --- --- Authorisation: yes --- --- Tables: otdbtree update --- --- Types: none --- -CREATE OR REPLACE FUNCTION classify(INT4, INT4, INT2) - RETURNS BOOLEAN AS ' - -- $Id$ - DECLARE - vFunction INT2 := 1; - vTreeID OTDBtree.treeID%TYPE; - vClassif OTDBtree.classif%TYPE; - vTreeType OTDBtree.treetype%TYPE; - vIsAuth BOOLEAN; - vAuthToken ALIAS FOR $1; - TThardware CONSTANT INT2 := 10; - TSactive CONSTANT INT2 := 600; - - BEGIN - -- check authorisation(authToken, treeID, func, classification) - vIsAuth := FALSE; - SELECT isAuthorized(vAuthToken, $2, vFunction, $3::int4) - INTO vIsAuth; - IF NOT vIsAuth THEN - RAISE EXCEPTION \'Not authorized.\'; - RETURN FALSE; - END IF; - - -- check classification - SELECT id - INTO vClassif - FROM classification - WHERE id = $3; - IF NOT FOUND THEN - RAISE EXCEPTION \'Classification % does not exist\', $3; - RETURN FALSE; - END IF; - - -- get current treetype. - -- Note: tree existance is checked during auth.check - SELECT treetype - INTO vTreeType - FROM OTDBtree - WHERE treeID = $2; - - -- changing PIC tree to operational? - -- restriction: only 1 PIC may be active of each classification - IF vTreeType = TThardware THEN - SELECT treeid - INTO vTreeID -- dummy - FROM OTDBtree - WHERE treetype = TThardware - AND classif = $3 - AND state = TSactive; - IF FOUND THEN - RAISE EXCEPTION \'Already an active hardware tree with same classification.\'; - RETURN FALSE; - END IF; - END IF; - - -- Finally update tree - UPDATE OTDBtree - SET classif = $3 - WHERE treeid = $2; - - RETURN TRUE; - END; -' LANGUAGE plpgsql; - diff --git a/dependencies/OTDB/sql/copyTree_func.sql b/dependencies/OTDB/sql/copyTree_func.sql deleted file mode 100644 index 66015bb08174c8e6f9e175741aba4f9fe5b54057..0000000000000000000000000000000000000000 --- a/dependencies/OTDB/sql/copyTree_func.sql +++ /dev/null @@ -1,125 +0,0 @@ --- --- copyTree.sql: Copy a complete tree --- --- Copyright (C) 2005 --- ASTRON (Netherlands Foundation for Research in Astronomy) --- P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, softwaresupport@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$ --- - --- --- copyTree (authToken, orgTree) --- --- Copy a complete tree --- --- Authorisation: yes --- --- Tables: otdbtree insert --- VICtemplate insert [optional] --- VIChierarchy insert [optional] --- PIChierarchy insert [optional] --- --- Types: none --- -CREATE OR REPLACE FUNCTION copyTree(INT4, INT4) - RETURNS INT4 AS $$ - -- $Id$ - DECLARE - vFunction INT2 := 1; - TThardware CONSTANT INT2 := 10; - TTtemplate CONSTANT INT2 := 20; - vNewTreeID OTDBtree.treeID%TYPE; - vCreatorID OTDBtree.creator%TYPE; - vIsAuth BOOLEAN; - vDummy BOOLEAN; - vOldTree RECORD; - vTopNode VICtemplate.nodeid%TYPE; - vNewTopNode VICtemplate.nodeid%TYPE; - vAuthToken ALIAS FOR $1; - - BEGIN - -- check authorisation(authToken, treeID, func, -) - vIsAuth := FALSE; - SELECT isAuthorized(vAuthToken, $2, vFunction, 0) - INTO vIsAuth; - IF NOT vIsAuth THEN - RETURN 0; - END IF; - - -- authorized. Resolve creator - SELECT whoIs(vAuthToken) - INTO vCreatorID; - - -- Get info from old tree and check type - SELECT * - INTO vOldTree - FROM OTDBtree - WHERE treeid = $2; - IF vOldTree.treetype = TThardware THEN - RAISE EXCEPTION 'PIC trees cannot be copied'; - END IF; - - -- make new tree entry, dont copy momID - vNewTreeID := 0; - SELECT newTree(vAuthToken, $2, 0, vOldTree.classif, - vOldTree.treetype, vOldTree.state, - vOldTree.campaign) - INTO vNewTreeID; - IF vNewTreeID = 0 THEN - RAISE EXCEPTION 'Creating of new treeEntry failed'; - END IF; - - -- also copy the timestamps - UPDATE OTDBTree - SET starttime = vOldTree.starttime, - stoptime = vOldTree.stoptime - WHERE treeID = vNewTreeID; - - -- copy tree - IF vOldTree.treetype = TTtemplate THEN - SELECT nodeID - INTO vTopNode - FROM VICtemplate - WHERE treeID = vOldTree.treeID - AND parentID = 0; - IF NOT FOUND THEN - RAISE EXCEPTION 'Tree to be copied is empty!'; - END IF; - - vNewTopNode := copyVTsubTree(vTopNode, vNewTreeID, 0); - ELSE - SELECT nodeID - INTO vTopNode - FROM VIChierarchy - WHERE treeID = vOldTree.treeID - AND parentID = 0; - IF NOT FOUND THEN - RAISE EXCEPTION 'Tree to be copied is empty!'; - END IF; - - vNewTopNode := copyVHsubTree(vTopNode, vNewTreeID, 0); - END IF; - - -- finally copy processTypes - SELECT copyProcessType($2, vNewTreeID) - INTO vDummy; - - RETURN vNewTreeID; - END; -$$ LANGUAGE plpgsql; - diff --git a/dependencies/OTDB/sql/copyVHtree_func.sql b/dependencies/OTDB/sql/copyVHtree_func.sql deleted file mode 100644 index ea003f7bcece81ead0c2ea9d737eb8743e8c0a9d..0000000000000000000000000000000000000000 --- a/dependencies/OTDB/sql/copyVHtree_func.sql +++ /dev/null @@ -1,142 +0,0 @@ --- --- copyVHtree.sql: copies a complete VH tree. --- --- Copyright (C) 2005 --- ASTRON (Netherlands Foundation for Research in Astronomy) --- P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, softwaresupport@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$ --- - --- --- helper function --- copyVHparams(orgNodeID, newTreeID, newNodeID) --- --- Gives the newNodeID in the newTreeID the same parameters as the orgNode. --- Note: new node must already exist. --- --- Authorisation: none --- --- Tables: VIChierarchy read --- VIChierarchy insert --- --- Types: none --- -CREATE OR REPLACE FUNCTION copyVHparams(INT4, INT4, INT4) - RETURNS VOID AS ' - -- $Id$ - DECLARE - vParam RECORD; - - BEGIN - FOR vParam IN - SELECT paramRefID, name, index, leaf, value - FROM VIChierarchy - WHERE parentID = $1 - AND leaf = TRUE - LOOP - INSERT INTO VIChierarchy (treeID, parentID, paramRefID, - name, index, leaf, value) - VALUES ($2, $3, vParam.paramRefID, - vParam.name, vParam.index, vParam.leaf, vParam.value); - -- note: nodeId is defaulted. - END LOOP; - RETURN; - END; -' LANGUAGE plpgsql; - --- --- helper function --- copyVHleafNode(orgNodeID, newTreeID, newParentID):newNodeID --- --- Duplicates a complete VH node to the VH tree --- --- Authorisation: none --- --- Tables: VIChierarchy read --- VIChierarchy insert --- --- Types: none --- -CREATE OR REPLACE FUNCTION copyVHleafNode(INT4, INT4, INT4) - RETURNS INT4 AS ' - -- $Id$ - DECLARE - vRow RECORD; - vNewNodeID VIChierarchy.nodeID%TYPE; - - BEGIN - SELECT paramRefID, name, index, leaf, value - INTO vRow - FROM VIChierarchy - WHERE nodeID = $1; --- IF NOT FOUND THEN --- RAISE EXCEPTION \'node % does not exist\', $1; --- END IF; - - vNewNodeID := NEXTVAL(\'VIChierarchID\'); - - INSERT INTO VIChierarchy (treeID, nodeID, parentID, paramRefID, - name, index, leaf, value) - VALUES ($2, vNewNodeID, $3, vRow.paramRefID, - vRow.name, vRow.index, vRow.leaf, vRow.value); - - PERFORM copyVHparams($1, $2, vNewNodeID); - - RETURN vNewNodeID; - END; -' LANGUAGE plpgsql; - --- --- recursive helper function --- copyVHsubTree (topNodeID, newTreeID, newParentID) --- --- Makes a key-value list of a (sub)tree in usenet format. --- --- Authorisation: no --- --- Tables: VIChierarchy read --- Tables: VIChierarchy insert --- --- Types: none --- -CREATE OR REPLACE FUNCTION copyVHsubTree(INT4, INT4, INT4) - RETURNS INT4 AS ' - -- $Id$ - DECLARE - vNewNodeID VIChierarchy.nodeID%TYPE; - vDummy VIChierarchy.nodeID%TYPE; - vRow RECORD; - - BEGIN - -- copy node itself - vNewNodeID := copyVHleafNode($1, $2, $3); - - -- call myself for all the children - FOR vRow IN - SELECT nodeID - FROM VIChierarchy - WHERE parentID = $1 - AND leaf = FALSE - LOOP - vDummy := copyVHsubTree(vRow.nodeID, $2, vNewNodeID); - END LOOP; - - RETURN vNewNodeID; - END; -' LANGUAGE plpgsql; - diff --git a/dependencies/OTDB/sql/copyVTtree_func.sql b/dependencies/OTDB/sql/copyVTtree_func.sql deleted file mode 100644 index 2f903e64a6c9195f46335da6ccf77ea1ba317d2c..0000000000000000000000000000000000000000 --- a/dependencies/OTDB/sql/copyVTtree_func.sql +++ /dev/null @@ -1,152 +0,0 @@ --- --- copyVTtree.sql: create a full VIC tree from a template. --- --- Copyright (C) 2005 --- ASTRON (Netherlands Foundation for Research in Astronomy) --- P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, softwaresupport@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$ --- - - --- --- helper function --- copyVTparams(orgNodeID, newTreeID, newNodeID) --- --- Gives the newNodeID in the newTreeID the same parameters as the orgNode. --- Note: new node must already exist. --- --- Authorisation: none --- --- Tables: VICtemplate read --- VICtemplate insert --- --- Types: none --- -CREATE OR REPLACE FUNCTION copyVTparams(INT4, INT4, INT4) - RETURNS VOID AS ' - -- $Id$ - DECLARE - vParam RECORD; - - BEGIN - FOR vParam IN - SELECT originID, name, limits - FROM VICtemplate - WHERE parentID = $1 - AND leaf = TRUE - LOOP - INSERT - INTO VICtemplate(treeID, parentID, originid, - name, index, leaf, - instances, limits) - VALUES ($2, $3, vParam.originID, - vParam.name, 1::int2, TRUE, - 1::int2, vParam.limits); - -- note: nodeId is defaulted. - END LOOP; - RETURN; - END; -' LANGUAGE plpgsql; - --- --- helper function --- copyVTleafNode(orgNodeID, newTreeID, newParentID):newNodeID --- --- Duplicates a complete VT node to the VT tree --- --- Authorisation: none --- --- Tables: VICtemplate read --- VICtemplate insert --- --- Types: none --- -CREATE OR REPLACE FUNCTION copyVTleafNode(INT4, INT4, INT4) - RETURNS INT4 AS ' - -- $Id$ - DECLARE - vNode RECORD; - vNewNodeID VICtemplate.nodeID%TYPE; - - BEGIN - SELECT * - INTO vNode - FROM VICtemplate - WHERE nodeID = $1; - IF NOT FOUND THEN - RAISE EXCEPTION \'node % does not exist\', $1; - END IF; - - vNewNodeID := NEXTVAL(\'VICtemplateID\'); - - INSERT - INTO VICtemplate (treeID, nodeID, parentID, - originID, name, index, - leaf, instances, limits) - VALUES ($2, vNewNodeID, $3, - vNode.originID, vNode.name, vNode.index, - vNode.leaf, vNode.instances, vNode.limits); - - PERFORM copyVTparams($1, $2, vNewNodeID); - - RETURN vNewNodeID; - END; -' LANGUAGE plpgsql; - --- --- helper function --- copyVTsubTree(orgNodeID, newTreeID, newParentID): newNodeID --- --- Duplicates a subtree starting at node orgNode to VT tree newTreeID --- under node newParentID. --- Recursive routine. --- --- Authorisation: none --- --- Tables: VICtemplate read --- VICtemplate insert --- --- Types: none --- -CREATE OR REPLACE FUNCTION copyVTsubTree(INT4, INT4, INT4) - RETURNS INT4 AS ' - -- $Id$ - DECLARE - vNewNodeID VICtemplate.nodeID%TYPE; - vDummy VICtemplate.nodeID%TYPE; - vVTnode RECORD; - - BEGIN - -- copy node itself - vNewNodeID := copyVTleafNode($1, $2, $3); - - -- dive into the childen - FOR vVTnode IN - SELECT nodeID - FROM VICtemplate - WHERE parentID = $1 - AND leaf = FALSE - LOOP - vDummy := copyVTsubTree(vVTnode.nodeID, $2, vNewNodeID); - END LOOP; - - RETURN vNewNodeID; - END; -' LANGUAGE plpgsql; - - diff --git a/dependencies/OTDB/sql/create_OTDB.sql b/dependencies/OTDB/sql/create_OTDB.sql deleted file mode 100644 index 8083f15ff607197d0126d7aff9e33eee1645f049..0000000000000000000000000000000000000000 --- a/dependencies/OTDB/sql/create_OTDB.sql +++ /dev/null @@ -1,95 +0,0 @@ --- execute this file with: --- psql -f create_OTDB.sql -h rs005 -U postgres otdbtest --- -\i create_base_tables.sql -\i create_security.sql -\i create_tree_table.sql -\i create_types.sql - -\i create_log_system.sql -\i security_func.sql -\i misc_func.sql - --- State history -\i setTreeState_func.sql -\i addTreeState_func.sql -\i getStateList_func.sql -\i getStateChanges_func.sql - --- OTDBConnection -\i getTreeList_func.sql -\i getTreeInfo_func.sql -\i assignProcessType_func.sql -\i newTree_func.sql -\i getExecutableTrees_func.sql -\i getTreeGroup_func.sql -\i getTreesInPeriod_func.sql -\i getModifiedTrees_func.sql - --- PICtree -\i create_PIC_tables.sql -\i addPICparam_func.sql -\i getPICparamDef_func.sql -\i getPICitemList_func.sql -\i searchPICinPeriod_func.sql -\i getBrokenHardware_func.sql -\i getStations_func.sql - --- Events and Actions -\i create_event_action.sql - --- VICcomponent -\i create_VIC_tables.sql -\i saveVCnode_func.sql -\i saveVICparamDef_func.sql -\i getVICnodeDef_func.sql -\i getVCNodeList_func.sql -\i getVCparams_func.sql -\i buildTemplateTree_func.sql -\i addComponentToVT_func.sql -\i isTopComponent_func.sql -\i deleteVCnode_func.sql - --- VICtemplate -\i hVICsearchParamID_func.sql -\i getVICparamDef_func.sql -\i dupVTnode_func.sql -\i updateVTnode_func.sql -\i deleteVTnode_func.sql -\i getVTitemList_func.sql -\i getVTitem_func.sql -\i getVTchildren_func.sql -\i instanciateTree_func.sql - --- VIChierarchy -\i getVHitemList_func.sql -\i exportTree_func.sql -\i exportResultTree_func.sql -\i exportMetadata_func.sql -\i searchVHinPeriod_func.sql -\i setSchedule_func.sql - --- multi treetype -\i getTopNode_func.sql -\i getNode_func.sql -\i copyVHtree_func.sql -\i copyVTtree_func.sql -\i copyTree_func.sql -\i deleteTree_func.sql -\i addKVT_func.sql -\i classify_func.sql -\i setMomInfo_func.sql -\i setDescription_func.sql -\i getMomID2treeID_func.sql -\i create_rules.sql - --- campaign -\i campaignAPI.sql - --- SchedulerInfo -\i getSchedulerInfo_func.sql -\i saveSchedulerInfo_func.sql -\i getAllTaskID_func.sql - --- default templates -\i getDefaultTemplates_func.sql diff --git a/dependencies/OTDB/sql/create_PIC_tables.sql b/dependencies/OTDB/sql/create_PIC_tables.sql deleted file mode 100644 index 732edb89e4f2f1d852113b38d38ac55925ae280b..0000000000000000000000000000000000000000 --- a/dependencies/OTDB/sql/create_PIC_tables.sql +++ /dev/null @@ -1,116 +0,0 @@ --- --- create_PIC_tables.sql: creates all PIC tables --- --- Copyright (C) 2005 --- ASTRON (Netherlands Foundation for Research in Astronomy) --- P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, softwaresupport@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$ --- - --- --- There are three PIC tables: --- PICparamref: this is a flat table containing the full PVSS names. --- each parameter is exactly ONCE is this table, independant --- in how many trees the parameters are used. --- PIChierarchy: this table contains the hierarchy from the PIC trees. --- The table is mainly used for support for the Observation --- Tree Browser so that the VIC and the PIC can be used in the --- same way. --- PICkvt: This table contains the key-value-timestamp values of the PIC --- parameters. These values are added to the database continuesly, --- independant if there are observations running of not. --- --- Needs the tables: --- param_type, unit, OTDBtree - -DROP TABLE IF EXISTS PIChierarchy CASCADE; -DROP TABLE IF EXISTS PICkvt CASCADE; -DROP TABLE IF EXISTS PICparamref CASCADE; -DROP SEQUENCE IF EXISTS PICparamrefID; -DROP SEQUENCE IF EXISTS PIChierarchID; -DROP INDEX IF EXISTS PIChierarchy_treeid_nodeid_indx; -DROP INDEX IF EXISTS pic_kvt_id; -DROP INDEX IF EXISTS pic_kvt_id_time_indx; -DROP INDEX IF EXISTS pic_kvt_time; - --- --- The PIC reference table is the representation of the master PIC --- tree from PVSS. The tree is completely flat, the hierarchy is in --- the naming convention of the parameters. --- --- Table is filled from an export of the master PIC from PVSS. --- -CREATE SEQUENCE PICparamrefID; - -CREATE TABLE PICparamref ( - -- $Id$ - paramID INT4 NOT NULL DEFAULT nextval('PICparamrefID'), - PVSSname VARCHAR(150) NOT NULL, - par_type INT2 REFERENCES param_type(ID), - unit INT2 DEFAULT 0 REFERENCES unit(ID), - pruning INT2 DEFAULT 10, - description TEXT, - - CONSTRAINT paramID_uniq PRIMARY KEY(paramID), - CONSTRAINT paramname_uniq UNIQUE(PVSSname) -) WITHOUT OIDS; - - --- --- When a new master PIC file is loaded into the PICparamref a new tree --- in the PIChierarchy table is created simultaneously. --- The hierachy stored in this table is derived the naming convention --- used for the PVSSnames. --- -CREATE SEQUENCE PIChierarchID; - -CREATE TABLE PIChierarchy ( - -- $Id$ - treeID INT4 NOT NULL REFERENCES OTDBtree(treeID), - nodeID INT4 NOT NULL DEFAULT nextval('PIChierarchID'), - parentID INT4 NOT NULL, -- REFERENCES PIChierachy(nodeID), - paramRefID INT4 NOT NULL REFERENCES PICparamref(paramID), - name VARCHAR(150) NOT NULL, - index INT2 NOT NULL DEFAULT -1, - leaf BOOLEAN DEFAULT TRUE, - - CONSTRAINT param_uniq_in_tree PRIMARY KEY(treeID, nodeID) -) WITHOUT OIDS; - --- Index: pichierarchy_treeid_nodeid_indx ---CREATE UNIQUE INDEX PIChierarchy_treeid_nodeid_indx ON PIChierarchy(treeid, nodeid); - --- --- PIC Key Values Time sets. --- --- Stores the updates from the PIC values. --- Note: the PIC KVTs do NOT have a reference to a PIC tree --- because in simultaneous observations different PIC reference trees --- can be used. A change in value is important for all observations. -CREATE TABLE PICkvt ( - -- $Id$ - paramID INT4 NOT NULL REFERENCES PICparamref(paramID), - value TEXT NOT NULL, - time TIMESTAMP DEFAULT now(), - - CONSTRAINT pickvt_uniq PRIMARY KEY(paramID, time) -) WITHOUT OIDS; - -CREATE INDEX PIC_kvt_id ON PICkvt(paramID); -CREATE INDEX PIC_kvt_time ON PICkvt(time); ---CREATE UNIQUE INDEX PIC_kvt_id_time_indx ON pickvt(paramid, "time"); diff --git a/dependencies/OTDB/sql/create_VIC_tables.sql b/dependencies/OTDB/sql/create_VIC_tables.sql deleted file mode 100644 index b0267841271bc834b8295962517739c3231ebb8b..0000000000000000000000000000000000000000 --- a/dependencies/OTDB/sql/create_VIC_tables.sql +++ /dev/null @@ -1,231 +0,0 @@ --- --- create_VIC_tables.sql: creates all VIC tables --- --- Copyright (C) 2005 --- ASTRON (Netherlands Foundation for Research in Astronomy) --- P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, softwaresupport@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$ --- - --- --- There are five VIC tables: --- VICnodedef: defines the loose nodes (components) of a tree. --- VICparamref: defines the parameters of a node. --- VICtemplate: contains the 'folded' trees. These trees are edited by the --- astronimer and instrument scientist. --- VIChierarchy: this table contains the full hierarchical VIC trees used --- by the scheduler and MAC. --- VICkvt: This table contains the key-value-timestamp values of the VIC --- parameters. These values are added to the database during --- observations. KVT from shared applications are logged by --- parametername others are logged with parameterID. --- --- Needs the tables: --- OTDBtree, classification, param_type, unit, treestate - -DROP TABLE IF EXISTS VICnodedef CASCADE; -DROP TABLE IF EXISTS VICparamdef CASCADE; -DROP TABLE IF EXISTS VICtemplate CASCADE; -DROP TABLE IF EXISTS VIChierarchy CASCADE; -DROP TABLE IF EXISTS VICkvt CASCADE; - -DROP SEQUENCE IF EXISTS VICnodedefID; -DROP SEQUENCE IF EXISTS VICparamdefID; -DROP SEQUENCE IF EXISTS VICtemplateID; -DROP SEQUENCE IF EXISTS VIChierarchID; - -DROP INDEX IF EXISTS Vnodedef_node_indx; - -DROP INDEX IF EXISTS VTempl_nodeid_indx; -DROP INDEX IF EXISTS VTempl_parent_index_leaf_indx; -DROP INDEX IF EXISTS VTempl_parentid_indx; -DROP INDEX IF EXISTS VTempl_parentid_leaf_name; -DROP INDEX IF EXISTS VTempl_parentid_name_index_indx; -DROP INDEX IF EXISTS VTempl_treeid_nodeid_indx; -DROP INDEX IF EXISTS VTempl_treeid_parentid_indx; - -DROP INDEX IF EXISTS VIChierarchy_parentid_indx; -DROP INDEX IF EXISTS VIChierarchy_treeid_nodeid_indx; - --- --- The VIC node Definition table contains the definitions from --- the node architecture. Note that a node is nothing more than a --- container for parameters. The relation with the children nodes --- are also stored as parameters of the node: --- name of the parameter is #<name of the childnode> --- --- Table is filled by reading in definitionfiles from the developers. --- -CREATE SEQUENCE VICnodedefID; - -CREATE TABLE VICnodedef ( - -- $Id$ - nodeID INT4 NOT NULL DEFAULT nextval('VICnodedefID'), - name VARCHAR(150) NOT NULL, - version INT4 NOT NULL DEFAULT 010000, - classif INT2 NOT NULL REFERENCES classification(ID), - constraints TEXT, -- interpreted by OTDB - description TEXT, - - CONSTRAINT Vnodedef_PK PRIMARY KEY (nodeID), - CONSTRAINT Vnodedef_node_uniq UNIQUE(nodeID), - CONSTRAINT Vnodedef_name_uniq UNIQUE(name, version, classif) -) WITHOUT OIDS; - --- Index: Vnodedef_node_indx - -CREATE UNIQUE INDEX Vnodedef_node_indx ON VICnodedef(nodeID); - --- --- The VIC parameter Definition table contains the definitions from --- the parameters from a node. --- --- Table is filled by reading in definitionfiles from the developers. --- -CREATE SEQUENCE VICparamdefID; - -CREATE TABLE VICparamdef ( - -- $Id$ - paramID INT4 NOT NULL DEFAULT nextval('VICparamdefID'), - nodeID INT4 NOT NULL REFERENCES VICnodedef(nodeID), - name VARCHAR(150) NOT NULL, - par_type INT2 REFERENCES param_type(ID), - unit INT2 REFERENCES unit(ID), - pruning INT2 DEFAULT 10, - validmoment INT2, -- REFERENCES treeState(ID) - RTmod BOOLEAN DEFAULT FALSE, - limits TEXT, -- interpreted by GUI: range, enum, default - description TEXT, - - CONSTRAINT VparamID_uniq UNIQUE(paramID), - CONSTRAINT Vparamname_uniq UNIQUE(nodeID,name) -) WITHOUT OIDS; - - --- --- The VIC template table containts the 'folded' trees that are used during --- the define fase of the tree. --- --- Note: When index = -1 the node is a 'master' node defining the number of --- nodes of that type that are available in the variable 'instances'. --- When index != -1 the record specifies one specific node the instances --- variable is 1 in that case. --- --- Note2: When leaf = false the record is a node and the limits field contains --- the max number of childs the node can have. When leaf = true the record --- defines a parameter, the limit field is than used as parameter value. --- (= initial startup value for the parameter). --- -CREATE SEQUENCE VICtemplateID; - -CREATE TABLE VICtemplate ( - -- $Id$ - treeID INT4 NOT NULL REFERENCES OTDBtree(treeID), - nodeID INT4 NOT NULL DEFAULT nextval('VICtemplateID'), - parentID INT4 NOT NULL, -- REFERENCES VICtemplate(nodeID), - originID INT4 NOT NULL DEFAULT 0, -- REF VICnode or VICparam - name VARCHAR(150) NOT NULL, - index INT2 NOT NULL DEFAULT -1, - leaf BOOLEAN DEFAULT TRUE, - instances INT2 NOT NULL DEFAULT 1, - limits TEXT, -- interpreted by GUI: range, enum, default - - CONSTRAINT VTempl_PK PRIMARY KEY (treeID, nodeID), - CONSTRAINT VTemplNode_uniqin_tree UNIQUE(treeID, nodeID) -) WITHOUT OIDS; - --- Index: VTempl_nodeid_indx - -CREATE INDEX VTempl_nodeid_indx ON VICTemplate(nodeID); - --- Index: VTempl_parent_index_leaf_indx - -CREATE INDEX VTempl_parent_index_leaf_indx ON VICTemplate(parentid, "index", leaf); - --- Index: VTempl_parentid_indx - -CREATE INDEX VTempl_parentid_indx ON VICTemplate(parentid); - --- Index: VTempl_parentid_leaf_name - -CREATE INDEX VTempl_parentid_leaf_name ON VICTemplate(parentid, leaf, name); - --- Index: VTempl_parentid_name_index_indx - -CREATE INDEX VTempl_parentid_name_index_indx ON VICTemplate(parentid, name, "index"); - --- Index: VTempl_treeid_nodeid_indx - -CREATE UNIQUE INDEX VTempl_treeid_nodeid_indx ON VICTemplate(treeid, nodeid); - --- Index: VTempl_treeid_parentid_indx - -CREATE INDEX VTempl_treeid_parentid_indx ON VICTemplate(treeid, parentid); - --- --- The VIChierarchy table contains complete VIC trees, the structure is --- similar to the structure of the PIChierarchy table. --- The VIChierachy trees are created from a VICtemplate tree by a script. --- -CREATE SEQUENCE VIChierarchID; - -CREATE TABLE VIChierarchy ( - -- $Id$ - treeID INT4 NOT NULL REFERENCES OTDBtree(treeID), - nodeID INT4 NOT NULL DEFAULT nextval('VIChierarchID'), - parentID INT4 NOT NULL, -- REFERENCES VIChierachy(nodeID), - paramRefID INT4 NOT NULL, -- REFERENCES VICparamref(paramID), - name VARCHAR(150) NOT NULL, - index INT2 NOT NULL DEFAULT -1, - leaf BOOLEAN DEFAULT TRUE, - value TEXT, -- empty for nodes, filled for params - - CONSTRAINT VIChierarchy_PK PRIMARY KEY (treeid, nodeid), - CONSTRAINT Vparam_uniq_in_tree UNIQUE(treeID, nodeID) -) WITHOUT OIDS; - --- Index: vichierarchy_parentid_indx - -CREATE INDEX VIChierarchy_parentid_indx ON VIChierarchy(parentID); - --- Index: vichierarcky_treeid_nodeid_indx - -CREATE UNIQUE INDEX VIChierarchy_treeid_nodeid_indx ON VIChierarchy( treeid, nodeid); - --- --- VIC Key Values Time sets. --- --- Stores the updates from the VIC values. --- Note: parameter updates of shared applications are stored by name --- because there is not 1 unique paramID assigned to it. --- For other parameter updates the name is translated to a paramID and the --- parametername is set to NULL. --- -CREATE TABLE VICkvt ( - -- $Id$ - treeID INT4 NOT NULL REFERENCES OTDBtree(treeID), - paramName VARCHAR(150) DEFAULT NULL, -- for shared applications - value TEXT NOT NULL, - time TIMESTAMP DEFAULT now(), - - CONSTRAINT vickvt_uniq UNIQUE(treeID, paramName, time) -) WITHOUT OIDS; - -CREATE INDEX VIC_kvt_name ON VICkvt(paramName); -CREATE INDEX VIC_kvt_time ON VICkvt(time); - diff --git a/dependencies/OTDB/sql/create_base_tables.sql b/dependencies/OTDB/sql/create_base_tables.sql deleted file mode 100644 index 455c46062a91dc1db193430cb0c6113498c77d91..0000000000000000000000000000000000000000 --- a/dependencies/OTDB/sql/create_base_tables.sql +++ /dev/null @@ -1,344 +0,0 @@ --- --- create_base_tables.sql: Creates the 'lookup' tables for OTDB --- --- Copyright (C) 2005 --- ASTRON (Netherlands Foundation for Research in Astronomy) --- P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, softwaresupport@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$ --- -DROP TABLE IF EXISTS classification CASCADE; -DROP TABLE IF EXISTS constr_type CASCADE; -DROP TABLE IF EXISTS param_type CASCADE; -DROP TABLE IF EXISTS pvss_type CASCADE; -DROP TABLE IF EXISTS validation CASCADE; -DROP TABLE IF EXISTS unit CASCADE; -DROP TABLE IF EXISTS treetype CASCADE; -DROP TABLE IF EXISTS treestate CASCADE; - -DROP SEQUENCE IF EXISTS campaignID; -DROP TABLE IF EXISTS campaign CASCADE; -DROP TABLE IF EXISTS operator CASCADE; - --- --- Classification table --- --- Assigns a level of 'maturity' to a node or tree --- -CREATE TABLE classification ( - -- $Id$ - ID INT2 NOT NULL, - name VARCHAR(15) NOT NULL, - - CONSTRAINT class_id_uniq UNIQUE (ID), - CONSTRAINT class_name_uniq UNIQUE (name) -) WITHOUT OIDS; -INSERT INTO classification VALUES (1, 'development'); -INSERT INTO classification VALUES (2, 'test'); -INSERT INTO classification VALUES (3, 'operational'); -INSERT INTO classification VALUES (4, 'example'); - --- --- Constraint table --- --- Defines the ways the node+parameter constraints can be checked. --- -CREATE TABLE constr_type ( - -- $Id$ - ID INT2 NOT NULL, - name VARCHAR(10) NOT NULL, - - CONSTRAINT constr_type_uniq UNIQUE (ID), - CONSTRAINT constr_name_uniq UNIQUE (name) -) WITHOUT OIDS; -INSERT INTO constr_type VALUES (0, 'none'); -INSERT INTO constr_type VALUES (1, 'shell'); -INSERT INTO constr_type VALUES (2, 'python'); -INSERT INTO constr_type VALUES (3, 'exec'); - --- --- Parameter type --- --- Assigns a type to a parameter. The type is only ment for the UI --- so that it can check the values that are entered. --- -CREATE TABLE param_type ( - -- $Id$ - ID INT2 NOT NULL, - name VARCHAR(5) NOT NULL, - - CONSTRAINT param_type_uniq UNIQUE (ID), - CONSTRAINT param_name_uniq UNIQUE (name) -) WITHOUT OIDS; -INSERT INTO param_type VALUES ( 0, 'node'); -INSERT INTO param_type VALUES (101, 'bool'); -INSERT INTO param_type VALUES (102, 'int'); -INSERT INTO param_type VALUES (103, 'uint'); -INSERT INTO param_type VALUES (104, 'long'); -INSERT INTO param_type VALUES (105, 'ulng'); -INSERT INTO param_type VALUES (106, 'flt'); -INSERT INTO param_type VALUES (107, 'dbl'); -INSERT INTO param_type VALUES (108, 'icpx'); -INSERT INTO param_type VALUES (109, 'lcpx'); -INSERT INTO param_type VALUES (110, 'fcpx'); -INSERT INTO param_type VALUES (111, 'dcpx'); -INSERT INTO param_type VALUES (112, 'text'); -INSERT INTO param_type VALUES (113, 'bin'); -INSERT INTO param_type VALUES (114, 'time'); -INSERT INTO param_type VALUES (115, 'date'); -INSERT INTO param_type VALUES (201, 'vbool'); -INSERT INTO param_type VALUES (202, 'vint'); -INSERT INTO param_type VALUES (203, 'vuint'); -INSERT INTO param_type VALUES (204, 'vlong'); -INSERT INTO param_type VALUES (205, 'vulng'); -INSERT INTO param_type VALUES (206, 'vflt'); -INSERT INTO param_type VALUES (207, 'vdbl'); -INSERT INTO param_type VALUES (208, 'vicpx'); -INSERT INTO param_type VALUES (209, 'vlcpx'); -INSERT INTO param_type VALUES (210, 'vfcpx'); -INSERT INTO param_type VALUES (211, 'vdcpx'); -INSERT INTO param_type VALUES (212, 'vtext'); -INSERT INTO param_type VALUES (214, 'vtime'); -INSERT INTO param_type VALUES (215, 'vdate'); -INSERT INTO param_type VALUES (300, 'pnode'); -INSERT INTO param_type VALUES (301, 'pbool'); -INSERT INTO param_type VALUES (302, 'pint'); -INSERT INTO param_type VALUES (303, 'puint'); -INSERT INTO param_type VALUES (304, 'plong'); -INSERT INTO param_type VALUES (305, 'pulng'); -INSERT INTO param_type VALUES (306, 'pflt'); -INSERT INTO param_type VALUES (307, 'pdbl'); -INSERT INTO param_type VALUES (308, 'picpx'); -INSERT INTO param_type VALUES (309, 'plcpx'); -INSERT INTO param_type VALUES (310, 'pfcpx'); -INSERT INTO param_type VALUES (311, 'pdcpx'); -INSERT INTO param_type VALUES (312, 'ptext'); -INSERT INTO param_type VALUES (314, 'ptime'); -INSERT INTO param_type VALUES (315, 'pdate'); - --- --- PVSS type --- --- Assigns a name to the typeIDs of PVSS. The names should exist --- in the param_type table. --- -CREATE TABLE pvss_type ( - -- $Id$ - ID INT2 NOT NULL, - name VARCHAR(5) NOT NULL REFERENCES param_type(name), - - CONSTRAINT pvss_type_uniq UNIQUE (ID) -) WITHOUT OIDS; --- PVSS values -INSERT INTO pvss_type VALUES ( 4, 'vuint'); -INSERT INTO pvss_type VALUES ( 5, 'vint'); -INSERT INTO pvss_type VALUES ( 6, 'vflt'); -INSERT INTO pvss_type VALUES ( 9, 'vtext'); -INSERT INTO pvss_type VALUES (20, 'int'); -INSERT INTO pvss_type VALUES (21, 'int'); -INSERT INTO pvss_type VALUES (22, 'flt'); -INSERT INTO pvss_type VALUES (23, 'bool'); -INSERT INTO pvss_type VALUES (25, 'text'); - --- --- Validation table --- --- Defines the validation moments in the lifecycle of a tree. --- On such a moment all parameters labeled with that value must --- meet the constraint criteria. --- The validation values are passed to the constraint scripts. --- --- TODO: Check contents of the table. --- -CREATE TABLE validation ( - -- $Id$ - ID INT2 NOT NULL, - name VARCHAR(10) NOT NULL, - - CONSTRAINT validation_id_uniq UNIQUE (ID), - CONSTRAINT validation_name_uniq UNIQUE (name) -) WITHOUT OIDS; -INSERT INTO validation VALUES (0, 'never'); -INSERT INTO validation VALUES (1, 'request'); -INSERT INTO validation VALUES (2, 'time'); -INSERT INTO validation VALUES (3, 'resource'); - --- --- Unit table --- --- The table defines the unit-information that should be displayed in --- the UI when a parameter is displayed for input. --- --- TODO: Extend table with a lot more records. --- -CREATE TABLE unit ( - -- $Id$ - ID INT2 NOT NULL, - name VARCHAR(10) NOT NULL, - label VARCHAR(5), - format VARCHAR(15), - scalable BOOL DEFAULT FALSE, - - CONSTRAINT unit_id_uniq UNIQUE (ID), - CONSTRAINT unit_name_uniq UNIQUE (name) -) WITHOUT OIDS; -INSERT INTO unit values (0, '-', '', '', false); -INSERT INTO unit values (1, 'ampere', 'A', '', true); -INSERT INTO unit values (2, 'm/s', 'm/s', '', false); -INSERT INTO unit values (3, 'dB', 'dB', '', false); -INSERT INTO unit values (4, 'time4', '', '99:99', false); -INSERT INTO unit values (5, 'time6', '', '99:99:99', false); -INSERT INTO unit values (6, 'RAM', 'MB', '', true); -INSERT INTO unit values (7, 'DISK', 'GB', '', true); -INSERT INTO unit values (8, 'GFLOP', 'GFLOP', '', false); -INSERT INTO unit values (9, 'MB/s', 'MB/s', '', true); -INSERT INTO unit values (10, 'Hz', 'Hz', '', true); -INSERT INTO unit values (11, 'kHz', 'kHz', '', true); -INSERT INTO unit values (12, 'MHz', 'MHz', '', true); -INSERT INTO unit values (13, 'period', 's|m|h', '', false); -INSERT INTO unit values (14, 'seconds', 'sec', '', false); -INSERT INTO unit values (15, 'degrees', 'deg', '', false); - --- --- Treetype table --- --- Define the kind of tree the information refers to. -CREATE TABLE treetype ( - -- $Id$ - ID INT2 NOT NULL, - name VARCHAR(10) NOT NULL, - - CONSTRAINT typeID_uniq UNIQUE(ID), - CONSTRAINT typename_uniq UNIQUE(name) -)WITHOUT OIDS; -INSERT INTO treetype VALUES (10, 'hardware'); -INSERT INTO treetype VALUES (20, 'VItemplate'); -INSERT INTO treetype VALUES (30, 'VHtree'); - --- --- Treetype table --- --- Define states for trees that indicate the phase of the --- lifecycle the tree is in. -CREATE TABLE treestate ( - -- $Id$ - ID INT2 NOT NULL, - name VARCHAR(20) NOT NULL, - - CONSTRAINT stateid_uniq UNIQUE(ID), - CONSTRAINT statename_uniq UNIQUE(name) -)WITHOUT OIDS; -INSERT INTO treestate VALUES ( 0, 'idle'); -INSERT INTO treestate VALUES (100, 'described'); -INSERT INTO treestate VALUES (200, 'prepared'); -INSERT INTO treestate VALUES (300, 'approved'); -INSERT INTO treestate VALUES (320, 'on_hold'); -INSERT INTO treestate VALUES (335, 'conflict'); -INSERT INTO treestate VALUES (350, 'prescheduled'); -INSERT INTO treestate VALUES (400, 'scheduled'); -INSERT INTO treestate VALUES (500, 'queued'); -INSERT INTO treestate VALUES (600, 'active'); -INSERT INTO treestate VALUES (900, 'completing'); -INSERT INTO treestate VALUES (1000, 'finished'); -INSERT INTO treestate VALUES (1100, 'aborted'); -INSERT INTO treestate VALUES (1150, 'error'); -INSERT INTO treestate VALUES (1200, 'obsolete'); - --- --- Campaign table --- --- Used for assigning observation(tree)s to a campaign. --- --- TODO: Remove records with ID's other than 0. --- -CREATE SEQUENCE campaignID; -CREATE TABLE campaign ( - -- $Id$ - ID INT2 NOT NULL DEFAULT NEXTVAL('campaignID'), - name VARCHAR(30) NOT NULL, - title VARCHAR(100) NOT NULL, - PI VARCHAR(80) NOT NULL, - CO_I VARCHAR(80) DEFAULT '', - contact VARCHAR(120) DEFAULT '', - - CONSTRAINT campaign_id_uniq UNIQUE(ID), - CONSTRAINT campaign_name_uniq UNIQUE(name) -) WITHOUT OIDS; -INSERT INTO campaign(id, name, title, PI) VALUES (0, 'no campaign', 'not related to a campaign/project', 'unknown'); - --- --- Operator table --- --- Names and ID of the operater allowed to manage the trees. --- -CREATE TABLE operator ( - -- $Id$ - ID INT4 NOT NULL, - name VARCHAR(30) NOT NULL, - telephone VARCHAR(10) NOT NULL, - - CONSTRAINT operator_id_uniq UNIQUE (ID), - CONSTRAINT operator_name_uniq UNIQUE (name) -) WITHOUT OIDS; -INSERT INTO operator VALUES (1, 'eucalypta', '0612345678'); -INSERT INTO operator VALUES (2, 'gargamel', '0123456789'); - --- --- otdb_admin table --- --- Internal administration. Tables always has 1 record! --- NEVER DROP THIS TABLE! --- -CREATE TABLE otdb_admin ( - treestatusevent timestamp(6) -) WITHOUT OIDS; -INSERT INTO otdb_admin VALUES(now()); - --- --- ProcessType table --- --- All allowed combinations of processType, processSubtype and strategy --- ---DROP TABLE IF EXISTS processTypes; ---CREATE TABLE processTypes ( --- processType VARCHAR(20) NOT NULL DEFAULT '', --- processSubtype VARCHAR(50) NOT NULL DEFAULT '', --- strategy VARCHAR(30) NOT NULL DEFAULT '', --- CONSTRAINT combi_uniq UNIQUE (processType,processSubtype,strategy) ---) WITHOUT OIDS; --- NOTE: unfortunately indexes do not work on NULL values - ---INSERT INTO processTypes VALUES (''); ---INSERT INTO processTypes VALUES ('Observation', '[Interferometer]'); ---INSERT INTO processTypes VALUES ('Observation', '[TransientBufferBoard]'); ---INSERT INTO processTypes VALUES ('Observation', '[CoherentStokes]'); ---INSERT INTO processTypes VALUES ('Observation', '[IncoherentStokes]'); ---INSERT INTO processTypes VALUES ('Observation', '[Interferometer, TransientBufferBoard]'); ---INSERT INTO processTypes VALUES ('Pipeline', '[CompressionPipeline]'); ---INSERT INTO processTypes VALUES ('Pipeline', '[CalibrationPipeline]'); ---INSERT INTO processTypes VALUES ('Pipeline', '[SimpleImagePipeline]'); ---INSERT INTO processTypes VALUES ('Pipeline', '[TransientPipeline]'); ---INSERT INTO processTypes VALUES ('Pipeline', '[RMSynthesisPipeline]'); ---INSERT INTO processTypes VALUES ('Pipeline', '[TBBCosmicRayPipeline]'); ---INSERT INTO processTypes VALUES ('Pipeline', '[TBBTransientPipeline]'); ---INSERT INTO processTypes VALUES ('Pipeline', '[KnownPulsarPipeline]'); ---INSERT INTO processTypes VALUES ('Pipeline', '[PulsarSearchPipeline]'); ---INSERT INTO processTypes VALUES ('Pipeline', '[BFCosmicRayPipeline]'); ---INSERT INTO processTypes VALUES ('System', '[Ingest]'); ---INSERT INTO processTypes VALUES ('System', '[CleanUp]'); ---INSERT INTO processTypes VALUES ('Maintenance'); ---INSERT INTO processTypes VALUES ('Reservation'); diff --git a/dependencies/OTDB/sql/create_event_action.sql b/dependencies/OTDB/sql/create_event_action.sql deleted file mode 100644 index 1d1b2ec324fee144db83e1d9184d6cb9e89a5efc..0000000000000000000000000000000000000000 --- a/dependencies/OTDB/sql/create_event_action.sql +++ /dev/null @@ -1,121 +0,0 @@ --- --- create_event_action.sql: Creates the event and action tables. --- --- Copyright (C) 2005 --- ASTRON (Netherlands Foundation for Research in Astronomy) --- P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, softwaresupport@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$ --- - - --- creates the OTDB event and action tables - -DROP TABLE IF EXISTS OTDBevent CASCADE; -DROP TABLE IF EXISTS OTDBaction CASCADE; -DROP TABLE IF EXISTS eventStatus CASCADE; -DROP TABLE IF EXISTS actionStatus CASCADE; -DROP SEQUENCE IF EXISTS OTDBeventID; -DROP SEQUENCE IF EXISTS OTDBactionID; - - --- --- Event status table --- --- Defines the status values of an event --- Note: the values are single-bit values so that they can be ORed --- --- TODO: Check if table contents is complete --- -CREATE TABLE eventStatus ( - -- $Id$ - status INT2 NOT NULL, - name VARCHAR(20) NOT NULL, - - CONSTRAINT event_status_uniq UNIQUE (status) -) WITHOUT OIDS; -INSERT INTO eventStatus VALUES ( 1, 'idle'); -INSERT INTO eventStatus VALUES ( 2, 'busy'); -INSERT INTO eventStatus VALUES ( 4, 'suspicious'); -INSERT INTO eventStatus VALUES ( 8, 'defect'); -INSERT INTO eventStatus VALUES ( 16, 'off-line'); -INSERT INTO eventStatus VALUES ( 32, 'maintenance'); - - --- --- Action status table --- --- Defines the status values of an action --- Note: the values are single-bit values so that they can be ORed --- --- TODO: Check if table contents is complete --- -CREATE TABLE actionStatus ( - -- $Id$ - status INT2 NOT NULL, - name VARCHAR(20) NOT NULL, - - CONSTRAINT action_status_uniq UNIQUE (status) -) WITHOUT OIDS; -INSERT INTO actionStatus VALUES ( 1, 'none'); -INSERT INTO actionStatus VALUES ( 2, 'assigned'); -INSERT INTO actionStatus VALUES ( 4, 'to be defined'); -INSERT INTO actionStatus VALUES ( 8, 'confirmed defect'); -INSERT INTO actionStatus VALUES ( 16, 'off-line request'); -INSERT INTO actionStatus VALUES ( 32, 'closed'); - - --- --- Event table --- --- Defines the event table --- -CREATE SEQUENCE OTDBeventID; - -CREATE TABLE OTDBevent ( - -- $Id$ - eventID INT4 NOT NULL DEFAULT nextval('OTDBeventID'), - nodename VARCHAR(80) NOT NULL, - status INT2 NOT NULL REFERENCES eventStatus(status), - eventTime timestamp DEFAULT now(), - - CONSTRAINT eventID_uniq UNIQUE(eventID) -- for reference by action -) WITHOUT OIDS; - --- example --- INSERT INTO OTDBevent (nodename, status) VALUES ('LOFAR_LCU1_RACK2_CPU3', 4); - - --- --- Action table --- --- Defines the action table --- -CREATE SEQUENCE OTDBactionID; - -CREATE TABLE OTDBaction ( - -- $Id$ - actionID INT4 NOT NULL DEFAULT nextval('OTDBactionID'), - eventID INT4 NOT NULL REFERENCES OTDBevent(eventID), - userID INT4 NOT NULL REFERENCES OTDBuser(userID), - status INT2 NOT NULL REFERENCES actionStatus(status), - eventTime timestamp DEFAULT now(), - description TEXT - -) WITHOUT OIDS; - - diff --git a/dependencies/OTDB/sql/create_log_system.sql b/dependencies/OTDB/sql/create_log_system.sql deleted file mode 100644 index 89737bc54fb09e75eddb00f224d3d3a511268ccf..0000000000000000000000000000000000000000 --- a/dependencies/OTDB/sql/create_log_system.sql +++ /dev/null @@ -1,48 +0,0 @@ --- --- create_log_system.sql: Creates a simple logsystem for debug purposes. --- --- Copyright (C) 2005 --- ASTRON (Netherlands Foundation for Research in Astronomy) --- P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, softwaresupport@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$ --- - -DROP TABLE IF EXISTS log CASCADE; - -CREATE TABLE log ( - -- $Id$ - msg TEXT -) WITH OIDS; - -CREATE OR REPLACE FUNCTION logmsg(TEXT) - RETURNS VOID AS ' - -- $Id$ - BEGIN - INSERT INTO log VALUES ($1); - RETURN; - END; -' language plpgsql; - -CREATE OR REPLACE FUNCTION clearlog() - RETURNS VOID AS ' - -- $Id$ - BEGIN - DELETE FROM log; - RETURN; - END; -' language plpgsql; diff --git a/dependencies/OTDB/sql/create_rules.sql b/dependencies/OTDB/sql/create_rules.sql deleted file mode 100644 index 6b6ca99770970f0ff8e9afa1f646b4636f6bf1fe..0000000000000000000000000000000000000000 --- a/dependencies/OTDB/sql/create_rules.sql +++ /dev/null @@ -1,39 +0,0 @@ --- --- create_rules.sql: Define update rules --- --- Copyright (C) 2012 --- ASTRON (Netherlands Foundation for Research in Astronomy) --- P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, softwaresupport@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: create_types.sql 18624 2011-07-27 15:34:51Z schoenmakers $ --- - --- --- Creates a rule for updating the modificationDate of the OTDBtree table. --- - -DROP RULE IF EXISTS ruleUpdateVIC on vichierarchy; -DROP RULE IF EXISTS ruleUpdateTemplate on victemplate; - -CREATE RULE ruleUpdateVIC AS ON UPDATE - TO vichierarchy WHERE NEW.value <> OLD.value - DO ALSO UPDATE otdbtree SET modificationDate = now() WHERE treeID = OLD.treeID; - -CREATE RULE ruleUpdateTemplate AS ON UPDATE - TO victemplate WHERE NEW.limits <> OLD.limits - DO ALSO UPDATE otdbtree SET modificationDate = now() WHERE treeID = OLD.treeID; - diff --git a/dependencies/OTDB/sql/create_security.sql b/dependencies/OTDB/sql/create_security.sql deleted file mode 100644 index 03b22168cd1bd24c67f085cff1f76f4fef41a990..0000000000000000000000000000000000000000 --- a/dependencies/OTDB/sql/create_security.sql +++ /dev/null @@ -1,72 +0,0 @@ --- --- create_security.sql: Creates the security related tables. --- --- Copyright (C) 2005 --- ASTRON (Netherlands Foundation for Research in Astronomy) --- P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, softwaresupport@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$ --- - --- --- TODO: Develop management system for easy maintaining this info. --- Possibly introduce usergroups as well. --- - -DROP TABLE IF EXISTS OTDBaccess CASCADE; -DROP TABLE IF EXISTS OTDBuser CASCADE; -DROP SEQUENCE IF EXISTS OTDBuserID; - --- --- The OTDBuser table contains some admistrative info about the user. --- -CREATE SEQUENCE OTDBuserID; - -CREATE TABLE OTDBuser ( - -- $Id$ - userID INT4 NOT NULL DEFAULT nextval('OTDBuserID'), - username VARCHAR(20) NOT NULL, - password VARCHAR(20) NOT NULL, - role VARCHAR(30), - lastlogin timestamp, - - CONSTRAINT userID_uniq UNIQUE(userID), -- for references - CONSTRAINT username_uniq UNIQUE(username) -) WITHOUT OIDS; - --- --- create one default (super)user that can be used during development. --- --- TODO: Remove this user. --- -INSERT INTO OTDBuser (username, password, role) - VALUES ('paulus', 'boskabouter', 'developer'); - - - --- --- The access table contains which users may call what functions with --- what arguments --- -CREATE TABLE OTDBaccess ( - -- $Id$ - userID INT4 NOT NULL REFERENCES OTDBuser(userID), - task INT4 NOT NULL DEFAULT 0, - value INT4 NOT NULL DEFAULT 0 -) WITHOUT OIDS; - - diff --git a/dependencies/OTDB/sql/create_tree_table.sql b/dependencies/OTDB/sql/create_tree_table.sql deleted file mode 100644 index fefee8dd14a371bf4f7009e5792848e9057015e5..0000000000000000000000000000000000000000 --- a/dependencies/OTDB/sql/create_tree_table.sql +++ /dev/null @@ -1,107 +0,0 @@ --- --- create_tree_table.sql: Create the tree table (the root to all info) --- --- Copyright (C) 2005 --- ASTRON (Netherlands Foundation for Research in Astronomy) --- P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, softwaresupport@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$ --- - --- --- Creates the OTDBtree table. This table is like the base tables used --- by the rest of the tables. --- --- Needs the tables: --- classification --- treetype --- operator --- campaign --- -DROP TABLE IF EXISTS OTDBtree CASCADE; -DROP SEQUENCE IF EXISTS OTDBtreeID; -DROP SEQUENCE IF EXISTS OTDBgroupID; -DROP TABLE IF EXISTS StateHistory CASCADE; -DROP INDEX IF EXISTS otdbtree_treeid_indx; -DROP INDEX IF EXISTS statehist_creation_idx; - -CREATE SEQUENCE OTDBtreeID START 1; --- Create a new start number based on current time. To prevent overlap in treeid's --- The subtraction is to end up with a number of order 100,000 -SELECT setval('OTDBtreeID',(select (EXTRACT(EPOCH FROM NOW())/60-23000000) :: bigint),false); - -CREATE SEQUENCE OTDBgroupID START 1; - -CREATE TABLE OTDBtree ( - -- $Id$ - -- required info - treeID INT4 NOT NULL DEFAULT nextval('OTDBtreeID'), - momID INT4 NOT NULL DEFAULT 0, - originID INT4 NOT NULL, - groupID INT4 NOT NULL DEFAULT 0, - classif INT2 NOT NULL REFERENCES classification(ID), - treetype INT2 NOT NULL REFERENCES treetype(ID), - state INT2 NOT NULL REFERENCES treestate(ID), - creator INT4 NOT NULL REFERENCES operator(ID), - d_creation TIMESTAMP(0) DEFAULT now(), - - -- optional info - campaign INT2 REFERENCES campaign(ID), - starttime TIMESTAMP(0), - stoptime TIMESTAMP(0), - owner INT4 REFERENCES operator(ID), - description TEXT, - name VARCHAR(32), -- for default templates only - - -- categorisation - processType VARCHAR(20) DEFAULT '', - processSubtype VARCHAR(50) DEFAULT '', - strategy VARCHAR(30) DEFAULT '', - - -- modifier - modificationDate TIMESTAMP(0) DEFAULT now(), - - -- contraints - CONSTRAINT tree_uniq UNIQUE (treeID), - CONSTRAINT tree_PK PRIMARY KEY (treeid) - -) WITHOUT OIDS; - -CREATE OR REPLACE FUNCTION newGroupID() - -- $Id$ - RETURNS INT4 AS $$ - BEGIN - RETURN nextval('OTDBgroupID'); - END; -$$ LANGUAGE plpgsql; - --- Index: otdbtree_treeid_indx - -CREATE INDEX otdbtree_treeid_indx ON otdbtree(treeid); - -CREATE TABLE StateHistory ( - -- $Id$ - treeID INT4 NOT NULL, - momID INT4 NOT NULL, - state INT2 NOT NULL, - userID INT4 NOT NULL REFERENCES operator(ID), - timestamp TIMESTAMP(0) DEFAULT now(), - creation TIMESTAMP(6) DEFAULT now() -) WITHOUT OIDS; - -CREATE INDEX statehist_creation_idx ON statehistory(creation); - diff --git a/dependencies/OTDB/sql/create_types.sql b/dependencies/OTDB/sql/create_types.sql deleted file mode 100644 index 049eded2fd901c754b80468c90196756e1689923..0000000000000000000000000000000000000000 --- a/dependencies/OTDB/sql/create_types.sql +++ /dev/null @@ -1,146 +0,0 @@ --- --- create_types.sql: Define the SQL equivalents of the C++ types. --- --- Copyright (C) 2005 --- ASTRON (Netherlands Foundation for Research in Astronomy) --- P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, softwaresupport@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$ --- - --- --- Creates the general types equal to the types in OTDBtypes.h --- - -DROP TYPE IF EXISTS treeInfo CASCADE; -DROP TYPE IF EXISTS stateInfo CASCADE; -DROP TYPE IF EXISTS OTDBnode CASCADE; -DROP TYPE IF EXISTS OTDBparamDef CASCADE; -DROP TYPE IF EXISTS OTDBvalue CASCADE; -DROP TYPE IF EXISTS OTDBnodeDef CASCADE; -DROP TYPE IF EXISTS campaignInfo CASCADE; - -CREATE TYPE treeInfo AS ( - -- $Id$ - treeID INT4, -- OTDBtree.treeID%TYPE, - momID INT4, - groupID INT4, - classification INT2, -- classification.ID%TYPE, - creator VARCHAR(20), -- OTDBuser.username%TYPE, - creationDate timestamp(0), - modificationDate timestamp(0), - type INT2, -- treetype.ID%TYPE, - state INT2, -- treestate.ID%TYPE, - originalTree INT4, -- OTDBtree.treeID%TYPE, - campaign VARCHAR(30), -- campaign.name%TYPE, - starttime timestamp(0), - stoptime timestamp(0), - processType VARCHAR(20), - processSubtype VARCHAR(50), - strategy VARCHAR(30), - description TEXT -); - -CREATE TYPE stateInfo AS ( - -- $Id$ - treeID INT4, -- OTDBtree.treeID%TYPE, - momID INT4, -- OTDBtree.momID%TYPE, - state INT2, -- treestate.ID%TYPE, - username VARCHAR(20), -- OTDBuser.username%TYPE, - modtime timestamp(0) -); - -CREATE TYPE OTDBnode AS ( - -- $Id$ - nodeID INT4, - parentID INT4, - paramDefID INT4, - name VARCHAR(150), - index SMALLINT, - leaf BOOLEAN, - instances INT2, -- only filled for VIC template - limits TEXT, -- only filled for VIC template - description TEXT -- only filled for VIC template -); - --- make constructor for OTDBnode -CREATE OR REPLACE FUNCTION makeOTDBnode(INT4,INT4,INT4,VARCHAR(150),INT2,BOOLEAN,INT2,TEXT,TEXT) - RETURNS OTDBnode AS $$ - -- $Id$ - DECLARE - vResult RECORD; - - BEGIN - SELECT $1,$2,$3,$4,$5,$6,$7,$8,$9 INTO vResult; - RETURN vResult; - END; -$$ LANGUAGE plpgsql; - - -CREATE TYPE OTDBparamDef AS ( - -- $Id$ - paramID INT4, - nodeID INT4, - name VARCHAR(150), - par_type INT2, -- param_type.ID%TYPE, - unit INT2, - pruning INT2, - valmoment INT2, - RTmod BOOLEAN, - limits TEXT, - description TEXT -); - - -CREATE TYPE OTDBvalue AS ( - -- $Id$ - paramID INT4, - name VARCHAR(150), - value TEXT, - time timestamp -); - - -CREATE TYPE OTDBnodeDef AS ( - -- $Id$ - nodeID INT4, - name VARCHAR(150), - version INT4, - classif INT2, - constraints TEXT, - description TEXT -); - -CREATE TYPE campaignInfo AS ( - -- $Id$ - ID INT2, - name VARCHAR(30), - title VARCHAR(100), - PI VARCHAR(80), - CO_I VARCHAR(80), - contact VARCHAR(120) -); - -CREATE TYPE templateInfo AS ( - -- $Id$ - treeID INT4, - name VARCHAR(32), - processType VARCHAR(20), - processSubtype VARCHAR(50), - strategy VARCHAR(30) -); - diff --git a/dependencies/OTDB/sql/deleteTree_func.sql b/dependencies/OTDB/sql/deleteTree_func.sql deleted file mode 100644 index 0068a4c91c6b42313aac21246c7629db9c630972..0000000000000000000000000000000000000000 --- a/dependencies/OTDB/sql/deleteTree_func.sql +++ /dev/null @@ -1,95 +0,0 @@ --- --- deleteTree.sql: Delete a complete tree --- --- Copyright (C) 2005 --- ASTRON (Netherlands Foundation for Research in Astronomy) --- P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, softwaresupport@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$ --- - --- --- deleteTree (authToken, treeID) --- --- Delete a complete tree --- --- Authorisation: yes --- --- Tables: otdbtree delete --- VICtemplate delete [optional] --- VIChierarchy delete [optional] --- PIChierarchy delete [optional] --- --- Types: none --- -CREATE OR REPLACE FUNCTION deleteTree(INT4, INT4) - RETURNS VOID AS $$ - -- $Id$ - DECLARE - vFunction INT2 := 1; - TThardware CONSTANT INT2 := 10; - TTtemplate CONSTANT INT2 := 20; - TSactive CONSTANT INT2 := 600; - vOldTree RECORD; - vIsAuth BOOLEAN; - vAuthToken ALIAS FOR $1; - - BEGIN - -- check authorisation(authToken, treeID, func, -) - vIsAuth := FALSE; - SELECT isAuthorized(vAuthToken, $2, vFunction, 0) - INTO vIsAuth; - IF NOT vIsAuth THEN - RAISE EXCEPTION 'Not authorized'; - END IF; - - -- Get info from old tree and check type - SELECT * - INTO vOldTree - FROM OTDBtree - WHERE treeID = $2; - IF vOldTree.state = TSactive THEN - RAISE EXCEPTION 'Active trees may not be deleted'; - END IF; - - -- delete state history - DELETE FROM StateHistory - WHERE treeID = $2; - - -- make sure that there are not kvt's left that refer to this tree - DELETE FROM VICkvt - WHERE treeID = $2; - - -- delete tree - IF vOldTree.treetype = TThardware THEN - DELETE FROM PIChierarchy - WHERE treeID = $2; - ELSIF vOldTree.treetype = TTtemplate THEN - DELETE FROM VICtemplate - WHERE treeID = $2; - ELSE - DELETE FROM VIChierarchy - WHERE treeID = $2; - END IF; - - -- Finally delete tree entry - DELETE FROM OTDBtree - WHERE treeID = $2; - - RETURN; - END; -$$ LANGUAGE plpgsql; diff --git a/dependencies/OTDB/sql/deleteVCnode_func.sql b/dependencies/OTDB/sql/deleteVCnode_func.sql deleted file mode 100644 index 9f4fd433de46c505efb97731c7e02b82213dd866..0000000000000000000000000000000000000000 --- a/dependencies/OTDB/sql/deleteVCnode_func.sql +++ /dev/null @@ -1,102 +0,0 @@ --- --- deleteVCnode.sql: function for deleting a (subtree) of VICtemplate nodes. --- --- Copyright (C) 2005 --- ASTRON (Netherlands Foundation for Research in Astronomy) --- P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, softwaresupport@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$ --- - --- --- removeVCNode (authToken, nodeID) --- --- Removes a node record including its parameters --- --- Authorisation: yes --- --- Tables: VICnodedef delete --- VICparamdef delete --- victemplate search --- vichierarchy search --- --- Types: none --- -CREATE OR REPLACE FUNCTION removeVCnode(INT4, INT4) - RETURNS BOOLEAN AS ' - -- $Id$ - DECLARE - vFunction INT2 := 1; - vIsAuth BOOLEAN; - vCount INT4; - vAuthToken ALIAS FOR $1; - - BEGIN - -- check authorisation(authToken, treeID, func, -) - vIsAuth := FALSE; - SELECT isAuthorized(vAuthToken, 0, vFunction, 0) - INTO vIsAuth; - IF NOT vIsAuth THEN - RAISE EXCEPTION \'Not authorized\'; - RETURN FALSE; - END IF; - - -- check usage of nodes - SELECT count(t.nodeid) from victemplate t, vicnodedef n - INTO vCount - WHERE n.nodeID=$2 AND t.originID = n.nodeID AND t.leaf = false; - IF vCount <> 0 THEN - RAISE EXCEPTION \'There are template trees that use this component\'; - RETURN FALSE; - END IF; - - SELECT count(h.paramrefid) from vichierarchy h, vicnodedef n - INTO vCount - WHERE n.nodeID=$2 AND h.paramRefID = n.nodeID AND h.leaf = false; - IF vCount <> 0 THEN - RAISE EXCEPTION \'There are runtime trees that use this component\'; - RETURN FALSE; - END IF; - - -- check usage of params - SELECT count(t.nodeid) from victemplate t, vicparamdef p - INTO vCount - WHERE p.nodeid=$2 and t.originID = p.paramID AND t.leaf = true; - IF vCount <> 0 THEN - RAISE EXCEPTION \'There are template trees that use its parameters\'; - RETURN FALSE; - END IF; - - SELECT count(h.paramrefid) from vichierarchy h, vicparamdef p - INTO vCount - WHERE p.nodeid=$2 and h.paramRefID = p.paramID AND h.leaf = true; - IF vCount <> 0 THEN - RAISE EXCEPTION \'There are runtime trees that use its parameters \'; - RETURN FALSE; - END IF; - - -- finally remove parameters and node - DELETE FROM vicparamdef - WHERE nodeID=$2; - - DELETE FROM vicnodedef - WHERE nodeID=$2; - - RETURN TRUE; - END; -' LANGUAGE plpgsql; - diff --git a/dependencies/OTDB/sql/deleteVTnode_func.sql b/dependencies/OTDB/sql/deleteVTnode_func.sql deleted file mode 100644 index 81d4c7aa0e8d10a3f3afdb570a130352ba8d6580..0000000000000000000000000000000000000000 --- a/dependencies/OTDB/sql/deleteVTnode_func.sql +++ /dev/null @@ -1,133 +0,0 @@ --- --- deleteVTnode.sql: function for deleting a (subtree) of VICtemplate nodes. --- --- Copyright (C) 2005 --- ASTRON (Netherlands Foundation for Research in Astronomy) --- P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, softwaresupport@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$ --- - --- helper function --- removeVTparameters(nodeID) --- --- Removes the parameters from the given node. --- --- Tables: VICtemplate delete --- -CREATE OR REPLACE FUNCTION removeVTparameters(INT4) - RETURNS VOID AS ' - -- $Id$ - BEGIN - DELETE - FROM VICtemplate - WHERE parentID = $1 - AND leaf = TRUE; - RETURN; - END; -' LANGUAGE plpgsql; - --- helper function --- removeVTleafNode(nodeID) --- --- Removes a VICtemplate leaf node inclusive the parameters --- --- Tables: VICtemplate delete --- -CREATE OR REPLACE FUNCTION removeVTleafNode(INT4) - RETURNS VOID AS ' - -- $Id$ - BEGIN - -- remove parameters - PERFORM removeVTparameters($1); - - -- remove node itself - DELETE - FROM VICtemplate - WHERE nodeID = $1; - - RETURN; - END; -' LANGUAGE plpgsql; - --- recursive helper function --- removeVTsubTree(nodeID) --- --- remove a complete VICtemplate subtree --- --- Tables: VICtemplate delete --- -CREATE OR REPLACE FUNCTION removeVTsubTree(INT4) - RETURNS VOID AS ' - -- $Id$ - DECLARE - vChild RECORD; - - BEGIN - -- for all its children - FOR vChild IN - SELECT nodeID - FROM VICtemplate - WHERE parentID = $1 - AND leaf = FALSE - LOOP - PERFORM removeVTsubTree(vChild.nodeID); - END LOOP; - - PERFORM removeVTleafNode($1); - - RETURN; - END; -' LANGUAGE plpgsql; - --- --- removeNode (authToken, treeID, nodeID) --- --- Removes a node record including its parameters and childnodes --- --- Authorisation: yes --- --- Tables: VICtemplate delete --- OTDBtree select --- --- Types: none --- -CREATE OR REPLACE FUNCTION removeVTnode(INT4, INT4, INT4) - RETURNS BOOLEAN AS ' - -- $Id$ - DECLARE - vFunction INT2 := 1; - vIsAuth BOOLEAN; - vAuthToken ALIAS FOR $1; - - BEGIN - -- check authorisation(authToken, treeID, func, -) - vIsAuth := FALSE; - SELECT isAuthorized(vAuthToken, $2, vFunction, 0) - INTO vIsAuth; - IF NOT vIsAuth THEN - RAISE EXCEPTION \'Not authorized\'; - RETURN FALSE; - END IF; - - -- remove node (its subtree) - PERFORM removeVTsubTree($3); - - RETURN TRUE; - END; -' LANGUAGE plpgsql; - diff --git a/dependencies/OTDB/sql/dupVTnode_func.sql b/dependencies/OTDB/sql/dupVTnode_func.sql deleted file mode 100644 index 60cf069df7555b1709850453ecc110e4cd7acbe3..0000000000000000000000000000000000000000 --- a/dependencies/OTDB/sql/dupVTnode_func.sql +++ /dev/null @@ -1,208 +0,0 @@ --- --- dupVTnode.sql: function for creating a copy of a node in a VIC template tree --- --- Copyright (C) 2005 --- ASTRON (Netherlands Foundation for Research in Astronomy) --- P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, softwaresupport@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$ --- - --- helper function --- attachVTparameters(orgNodeID, NewNodeID) --- --- Gives the newNode the same parameters as the orgNode. --- --- Tables: VICtemplate insert --- -CREATE OR REPLACE FUNCTION attachVTparameters(INT4, INT4) - RETURNS VOID AS ' - -- $Id$ - DECLARE - vParam RECORD; - - BEGIN - -- get childs of originNode - FOR vParam IN - SELECT * - FROM VICtemplate - WHERE parentID = $1 - AND leaf = TRUE - LOOP - -- note: nodeid is generated automatically - INSERT INTO VICtemplate (treeid, parentid, originid, - name, index, leaf, - instances, limits) - VALUES (vParam.treeID, $2, vParam.originID, - vParam.name, vParam.index, vParam.leaf, - vParam.instances, vParam.limits); - END LOOP; - RETURN; - END; -' LANGUAGE plpgsql; - --- helper function --- dupVTleafNode(orgNodeID , newParentId, newIndex) --- --- duplicates a VICtemplate leaf node inclusive the parameters --- --- Tables: VICtemplate insert --- -CREATE OR REPLACE FUNCTION dupVTleafNode(INT4, INT4, INT2) - RETURNS INT4 AS ' - -- $Id$ - DECLARE - vNodeID INT4; - vOrgNode RECORD; - - BEGIN - -- get fields of original node - SELECT * - INTO vOrgNode - FROM VICtemplate - WHERE nodeID = $1; - IF NOT FOUND THEN - RAISE EXCEPTION \'Node % does not exist, cannot duplicate it\', $1; - RETURN 0; - END IF; - - -- check that parent exists - -- ... TODO or not ... - - -- check that duplicate does not exist yet. - -- ... check it or not ... - SELECT nodeID - INTO vNodeID -- dummy - FROM VICtemplate - WHERE parentID = $2 - AND name = vOrgNode.name - AND index = $3; - IF FOUND THEN - RAISE EXCEPTION \'Node % with index % already exists\', - vOrgNode.name, $3; - RETURN 0; - END IF; - - -- dedicated nodes (index>=0) can only exist once - IF $3 >= 0 THEN - vOrgNode.instances := 1; - END IF; - - -- add node itself - vNodeID := nextval(\'VICtemplateID\'); - INSERT INTO - VICtemplate (treeid, nodeID, - parentID, originID, - name, index, leaf, - instances, limits) - VALUES (vOrgNode.treeID, vNodeID, - $2, vOrgNode.originID, - vOrgNode.name, $3, vOrgNode.leaf, - vOrgNode.instances, vOrgNode.limits); - - -- and add its parameters - PERFORM attachVTparameters($1, vNodeID); - RETURN vNodeID; - END; -' LANGUAGE plpgsql; - --- helper function --- dupVTsubTree(orgNodeID, newParentID, newIndex) --- --- duplicates a VICtemplate leaf node inclusive the parameters --- --- Tables: VICtemplate insert --- -CREATE OR REPLACE FUNCTION dupVTsubTree(INT4, INT4, INT2) - RETURNS INT4 AS ' - -- $Id$ - DECLARE - vNodeID INT4; - vChild RECORD; - vDummy INT4; --- vIndex INT2; - - BEGIN - -- duplicate node and its own parameters - -- dupVTleafNode(orgNodeID , newParentId, newIndex) - vNodeID := dupVTleafNode($1, $2, $3); - - -- for all its children - FOR vChild IN - SELECT nodeID, index - FROM VICtemplate - WHERE parentID = $1 - AND leaf = FALSE - LOOP - vDummy := dupVTsubTree(vChild.nodeID, vNodeID, vChild.index); - END LOOP; - - RETURN vNodeID; - END; -' LANGUAGE plpgsql; - --- --- dupVTnode (authToken, treeID, nodeID, index) --- --- Creates a new node record including its parameters and childnodes --- and returns the nodeID of this new node. --- --- Authorisation: yes --- --- Tables: VICtemplate insert --- OTDBtree select --- --- Types: none --- -CREATE OR REPLACE FUNCTION dupVTnode(INT4, INT4, INT4, INT2) - RETURNS INT4 AS ' - -- $Id$ - DECLARE - vFunction INT2 := 1; - vIsAuth BOOLEAN; - vParentID VICtemplate.parentID%TYPE; - vNewNodeID INT4; - vAuthToken ALIAS FOR $1; - - BEGIN - -- check authorisation(authToken, treeID, func, -) - vIsAuth := FALSE; - SELECT isAuthorized(vAuthToken, $2, vFunction, 0) - INTO vIsAuth; - IF NOT vIsAuth THEN - RAISE EXCEPTION \'Not authorized\'; - RETURN $3; - END IF; - - -- get ParentID of node to duplicate - SELECT parentID - INTO vParentID - FROM VICtemplate - WHERE nodeID = $3; - IF NOT FOUND THEN - RAISE EXCEPTION \'Node with id % does not exist!\', $3; - RETURN 0; - END IF; - - -- duplicate node and its own parameters - -- dupVTsubTree(orgNodeID, newParentID, newIndex) - vNewNodeID := dupVTsubTree($3, vParentID, $4); - - RETURN vNewNodeID; - END; -' LANGUAGE plpgsql; - diff --git a/dependencies/OTDB/sql/exportMetadata_func.sql b/dependencies/OTDB/sql/exportMetadata_func.sql deleted file mode 100644 index a9a9e4b222a3cda7ebec8923656fddeb6215de18..0000000000000000000000000000000000000000 --- a/dependencies/OTDB/sql/exportMetadata_func.sql +++ /dev/null @@ -1,57 +0,0 @@ --- --- exportMetadata.sql: makes an usenet format export of all Metadata info from a tree --- --- Copyright (C) 2013 --- ASTRON (Netherlands Foundation for Research in Astronomy) --- P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, softwaresupport@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: exportTree_func.sql 20032 2012-02-07 07:10:34Z overeem $ --- - --- --- exportMetadata (treeID) --- --- Makes a key-value list of all kvt values of a VIC tree --- --- Authorisation: no --- --- Tables: VICkvt read --- --- Types: none --- -CREATE OR REPLACE FUNCTION exportMetadata(INT4) - RETURNS TEXT AS $$ - -- $Id: addComponentToVT_func.sql 19935 2012-01-25 09:06:14Z mol $ - DECLARE - vResult TEXT; - vRecord RECORD; - vTreeID ALIAS FOR $1; - - BEGIN - vResult := ''; - FOR vRecord IN - SELECT treeid,paramname,value,time - FROM VICkvt - WHERE treeID = vTreeID - ORDER BY paramname, time ASC - LOOP - vResult := vResult || vRecord.paramname || '=' || vRecord.value || chr(10); - END LOOP; - RETURN vResult; - END; -$$ LANGUAGE plpgsql; - diff --git a/dependencies/OTDB/sql/exportResultTree_func.sql b/dependencies/OTDB/sql/exportResultTree_func.sql deleted file mode 100644 index bc031f2333c8fbe847aa0cc6396de46c6681e7fc..0000000000000000000000000000000000000000 --- a/dependencies/OTDB/sql/exportResultTree_func.sql +++ /dev/null @@ -1,141 +0,0 @@ --- --- exportResultTree.sql: makes an usenet format export of a (sub)tree. --- --- Copyright (C) 2005 --- ASTRON (Netherlands Foundation for Research in Astronomy) --- P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, softwaresupport@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: exportTree_func.sql 20032 2012-02-07 07:10:34Z overeem $ --- - --- --- recursive helper function --- exportMDSubTree (treeID, topNodeID, prefixlength) --- --- Makes a key-value list of a (sub)tree in usenet format. --- --- Authorisation: no --- --- Tables: VIChierarchy read --- --- Types: none --- -CREATE OR REPLACE FUNCTION exportMDSubTree(INT4, INT4, INT4) - RETURNS TEXT AS $$ - -- $Id: addComponentToVT_func.sql 19935 2012-01-25 09:06:14Z mol $ - DECLARE - vResult TEXT := ''; - vRow RECORD; - vValue TEXT; - vLastTable VARCHAR(50) := ''; - vDefinition TEXT := ''; - - BEGIN - -- first dump own parameters - FOR vRow IN - SELECT name, value - FROM VIChierarchy - WHERE treeID = $1 - AND parentID = $2 - AND leaf = true - ORDER BY name - LOOP - SELECT value INTO vValue FROM VICkvt WHERE treeID=$1 AND paramname=vRow.name ORDER BY time DESC LIMIT 1; - IF FOUND THEN - vRow.value := vValue; ---RAISE WARNING 'MDPARAM: % = %', vRow.name, vValue; - END IF; - vResult := vResult || substr(vRow.name,$3) || '=' || vRow.value || chr(10); - END LOOP; - - -- call myself for all the children - FOR vRow IN --- SELECT nodeID, name, recordID, tablename - SELECT nodeID, name - FROM VIChierarchy - WHERE treeID = $1 - AND parentID = $2 - AND leaf = false - ORDER BY name - LOOP ---RAISE WARNING 'NODE: %, %, %', vRow.nodeID, vRow.name, vRow.tablename; --- IF vRow.tablename != '' THEN --- -- export definition before first record --- SELECT value INTO vValue FROM VICkvt WHERE treeID=$1 AND paramname=vRow.name ORDER BY time DESC LIMIT 1; --- IF NOT FOUND THEN --- EXECUTE 'SELECT * FROM export' || vRow.tablename || '(' || vRow.recordID || ')' INTO vValue; --- END IF; --- vResult := vResult || substr(vRow.name,$3) || '=' || vValue || chr(10); --- END IF; - vResult := vResult || exportMDSubTree($1, vRow.nodeID, $3); - END LOOP; - - RETURN vResult; - END; -$$ LANGUAGE plpgsql; - --- --- exportResultTree (authToken, treeID, topNodeID) --- --- Makes a key-value list of a (sub)tree in usenet format. --- --- Authorisation: yes --- --- Tables: VIChierarchy read --- --- Types: none --- -CREATE OR REPLACE FUNCTION exportResultTree(INT4, INT4, INT4) - RETURNS TEXT AS $$ - -- $Id: addComponentToVT_func.sql 19935 2012-01-25 09:06:14Z mol $ - DECLARE - vFunction INT2 := 1; - vIsAuth BOOLEAN; - vResult TEXT; - vName VIChierarchy.name%TYPE; - vParent VICtemplate.parentid%TYPE; - vPrefixLen INTEGER; - vAuthToken ALIAS FOR $1; - - BEGIN - -- check authorisation(authToken, treeID, func, treetype) - vIsAuth := FALSE; - SELECT isAuthorized(vAuthToken, $2, vFunction, 0) - INTO vIsAuth; - IF NOT vIsAuth THEN - RAISE EXCEPTION 'Not authorized'; - END IF; - - -- get name of topNode - SELECT name - INTO vName - FROM VIChierarchy - WHERE treeID = $2 - AND nodeID = $3; - IF NOT FOUND THEN - RAISE EXCEPTION 'Node % is not a node in VIC tree %', $3, $2; - END IF; - - vPrefixLen = length(vName); - vResult := 'prefix=' || vName || '.' || chr(10); - - -- construct entries for all nodes from here on. - vResult := vResult || exportMDSubTree($2, $3, vPrefixLen+2) || exportProcessType($2, vPrefixLen+2) || exportCampaign($2, vPrefixLen+2); - RETURN vResult; - END; -$$ LANGUAGE plpgsql; - diff --git a/dependencies/OTDB/sql/exportTree_func.sql b/dependencies/OTDB/sql/exportTree_func.sql deleted file mode 100644 index 461721ee6798ac6d482a20511d815d621a7be294..0000000000000000000000000000000000000000 --- a/dependencies/OTDB/sql/exportTree_func.sql +++ /dev/null @@ -1,339 +0,0 @@ --- --- exportTree.sql: makes an usenet format export of a (sub)tree. --- --- Copyright (C) 2005 --- ASTRON (Netherlands Foundation for Research in Astronomy) --- P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, softwaresupport@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$ --- - --- exportIDs(treeID, prefixLen) --- --- Return all the IDs that are attached to this tree (sas/mom/origin) --- --- Authorisation: none --- --- Tables: otdbtree read --- --- Types: none --- -CREATE OR REPLACE FUNCTION exportIDs(INT4, INT4) - RETURNS TEXT AS $$ - -- $Id$ - DECLARE - vResult TEXT := ''; - vPrefix TEXT; - vTreeID OTDBtree.treeID%TYPE; - vMoMID OTDBtree.momID%TYPE; - vOriginID OTDBtree.originID%TYPE; - aTreeID ALIAS FOR $1; - aPrefixLen ALIAS FOR $2; - - BEGIN - -- get processInfo - SELECT treeid, momid, originid - INTO vTreeID, vMoMID, vOriginID - FROM OTDBtree - WHERE treeID = aTreeID; - IF NOT FOUND THEN - RAISE EXCEPTION 'Tree % does not exist', aTreeID; - END IF; - - SELECT substr(name, aPrefixLen) - INTO vPrefix - FROM getVHitemList(aTreeID, '%.Observation'); - vResult := vResult || vPrefix || '.otdbID=' || vTreeID || chr(10); - vResult := vResult || vPrefix || '.momID=' || vMoMID || chr(10); - vResult := vResult || vPrefix || '.originID=' || vOriginID || chr(10); - - RETURN vResult; - END; -$$ LANGUAGE plpgsql; - --- --- recursive helper function --- fullTemplateNodeName (treeID, nodeID, lastPart) --- --- Follow a template node UPWARDS to construct its full name --- --- Authorisation: no --- --- Tables: VICtemplate read --- --- Types: none --- -CREATE OR REPLACE FUNCTION fullTemplateNodeName(INT4, INT4, TEXT) - RETURNS TEXT AS $$ - -- $Id$ - DECLARE - vResult TEXT; - vName VICtemplate.name%TYPE; - vParentID VICtemplate.parentID%TYPE; - - BEGIN - vResult := $3; - IF $2 != 0 THEN - SELECT name, parentID - INTO vName, vParentID - FROM VICtemplate - WHERE treeID = $1 - AND nodeID = $2; - IF NOT FOUND THEN - RAISE EXCEPTION 'Node % does not exist in tree %', $2, $1; - END IF; - vResult := fullTemplateNodeName($1, vParentID, vName || '.' || vResult); - END IF; - - RETURN vResult; - END; -$$ LANGUAGE plpgsql; - --- --- recursive helper function --- exportTemplateSubTree (treeID, topNodeID, prefix) --- --- Makes a key-value list of a (sub)tree in usenet format. --- --- Authorisation: no --- --- Tables: VICtemplate read --- --- Types: none --- -CREATE OR REPLACE FUNCTION exportTemplateSubTree(INT4, INT4, TEXT) - RETURNS TEXT AS $$ - -- $Id$ - DECLARE - vResult TEXT := ''; - vRow RECORD; - vBasename TEXT; - - BEGIN - -- Append dot to basename of not topnode - vBasename:=$3; - IF length(vBasename) != 0 THEN - vBasename := vBasename || '.'; - END IF; - - -- first dump own parameters - FOR vRow IN - SELECT name, limits, index - FROM VICtemplate - WHERE treeID = $1 - AND parentID = $2 - AND leaf = true - ORDER BY name - LOOP - vResult := vResult || vBaseName || vRow.name || '=' || vRow.limits || chr(10); - END LOOP; - - -- call myself for all the children - FOR vRow IN - SELECT nodeID, name, index - FROM VICtemplate - WHERE treeID = $1 - AND parentID = $2 - AND leaf = false - ORDER BY name - LOOP - IF vRow.index != -1 THEN - vRow.name := vRow.name || '[' || vRow.index || ']'; - END IF; - vResult := vResult || exportTemplateSubTree($1, vRow.nodeID, vBasename || vRow.name); - END LOOP; - - RETURN vResult; - END; -$$ LANGUAGE plpgsql; - --- --- recursive helper function --- exportVICSubTree (treeID, topNodeID, prefixlength) --- --- Makes a key-value list of a (sub)tree in usenet format. --- --- Authorisation: no --- --- Tables: VIChierarchy read --- --- Types: none --- -CREATE OR REPLACE FUNCTION exportVICSubTree(INT4, INT4, INT4) - RETURNS TEXT AS $$ - -- $Id$ - DECLARE - vResult TEXT := ''; - vRow RECORD; - - BEGIN - -- first dump own parameters - FOR vRow IN - SELECT name, value - FROM VIChierarchy - WHERE treeID = $1 - AND parentID = $2 - AND leaf = true - ORDER BY name - LOOP - vResult := vResult || substr(vRow.name,$3) || '=' - || vRow.value || chr(10); - END LOOP; - - -- call myself for all the children - FOR vRow IN - SELECT nodeID, name - FROM VIChierarchy - WHERE treeID = $1 - AND parentID = $2 - AND leaf = false - ORDER BY name - LOOP - vResult := vResult || exportVICSubTree($1, vRow.nodeID, $3); - END LOOP; - - RETURN vResult; - END; -$$ LANGUAGE plpgsql; - --- --- recursive helper function --- exportPICSubTree (treeID, topNodeID, prefixlength) --- --- Makes a key-value list of a (sub)tree in usenet format. --- --- Authorisation: no --- --- Tables: PIChierarchy read --- --- Types: none --- -CREATE OR REPLACE FUNCTION exportPICSubTree(INT4, INT4, INT4) - RETURNS TEXT AS $$ - -- $Id$ - DECLARE - vResult TEXT := ''; - vRow RECORD; - vName PIChierarchy.name%TYPE; - - BEGIN - -- first get name of top node - SELECT name - INTO vName - FROM PIChierarchy - WHERE treeID = $1 - AND nodeID = $2; - vName := vName || '%'; - - -- call myself for all the children - FOR vRow IN - SELECT name - FROM PIChierarchy - WHERE treeID = $1 - AND name like vName - AND leaf = true - ORDER BY nodeid - LOOP - vResult := vResult || substr(vRow.name,$3) || chr(10); - END LOOP; - - RETURN vResult; - END; -$$ LANGUAGE plpgsql; - --- --- exportTree (authToken, treeID, topNodeID) --- --- Makes a key-value list of a (sub)tree in usenet format. --- --- Authorisation: yes --- --- Tables: VIChierarchy read --- --- Types: none --- -CREATE OR REPLACE FUNCTION exportTree(INT4, INT4, INT4) - RETURNS TEXT AS $$ - -- $Id$ - DECLARE - vFunction INT2 := 1; - vIsAuth BOOLEAN; - vResult TEXT; - vName VIChierarchy.name%TYPE; - vParent VICtemplate.parentid%TYPE; - vPrefixLen INTEGER; - vIsPicTree BOOLEAN; - vIsVicTree BOOLEAN; - vAuthToken ALIAS FOR $1; - - BEGIN - -- check authorisation(authToken, treeID, func, treetype) - vIsAuth := FALSE; - SELECT isAuthorized(vAuthToken, $2, vFunction, 0) - INTO vIsAuth; - IF NOT vIsAuth THEN - RAISE EXCEPTION 'Not authorized'; - END IF; - - -- get name of topNode - vIsPicTree := FALSE; - vIsVicTree := FALSE; - SELECT name - INTO vName - FROM VIChierarchy - WHERE treeID = $2 - AND nodeID = $3; - IF FOUND THEN - vIsVicTree := TRUE; - ELSE - SELECT name - INTO vName - FROM PIChierarchy - WHERE treeID = $2 - AND nodeID = $3; - IF FOUND THEN - vIsPicTree := TRUE; - ELSE - SELECT name, parentID - INTO vName, vParent - FROM VICtemplate - WHERE treeID = $2 - AND nodeID = $3; - IF NOT FOUND THEN - RAISE EXCEPTION 'Node % does not exist in tree %', $3, $2; - END IF; - vName := fullTemplateNodeName($2, vParent, vName); - END IF; - END IF; - - vPrefixLen = length(vName); - vResult := 'prefix=' || vName || '.' || chr(10); - - -- construct entries for all nodes from here on. - IF vIsPicTree THEN - vResult := vResult || exportPICSubTree($2, $3, vPrefixLen+2); - ELSE - IF vIsVicTree THEN - vResult := vResult || exportVICSubTree($2, $3, vPrefixLen+2) || exportProcessType($2, vPrefixLen+2) || exportCampaign($2, vPrefixLen+2) || exportIDs($2, vPrefixLen+2); - ELSE - vResult := vResult || exportTemplateSubTree($2, $3, ''); - END IF; - END IF; - RETURN vResult; - END; -$$ LANGUAGE plpgsql; - diff --git a/dependencies/OTDB/sql/fresh_database b/dependencies/OTDB/sql/fresh_database deleted file mode 100755 index 22ff0cc4c1e302144b0ceb23fa56a240f4a0bb60..0000000000000000000000000000000000000000 --- a/dependencies/OTDB/sql/fresh_database +++ /dev/null @@ -1,65 +0,0 @@ -#!/bin/bash -# -# Script to (re)create a OTDB database from scratch, using the sql statements -# -# Usage: fresh_database <DBNAME> -# -# Requires all sql-commands to be present in /opt/lofar/sbin/sql -# If existing, DROPS the current database -# -if [ -z $1 ]; then - echo "Usage: fresh_database <DBNAME>" - exit 0 -fi - -if [ "$1" == "-h" ]; then - echo "Usage: fresh_database <DBNAME>" - exit 0 -fi - -DBNAME=$1 -DBUSER=postgres -DBHOST=localhost -DBPORT=5432 - -# The following commands assume that the user has super user privileges. -# -# Access to PostgreSQL databases is managed via the 'pg_hba.conf' file. -# -# Postgres should be told to listen to external TCP ports. -# Edit /sasdb/data/postgresq.conf -# to have the following stanzas: -# -# Listen_addresses = '*' -# Port = 5432 -# -# Don't forget to restart Postgres after altering these files, -# as follows (Debian): -# -# pg_ctl start -D /sasdb/data -l /sasdb/data/pg_log/logfile -# -# Drop DB & USER. User DBUSER owns DBNAME, so we have to remove the database -# first! -# Note the '|| true' at the end. This ensures that the commands succeed, -# even if the database is not found. - -echo " == Dropping database $DBNAME ==" -echo dropdb --host $DBHOST --port $DBPORT --user postgres --echo $DBNAME || true -dropdb --host $DBHOST --port $DBPORT --user postgres --echo $DBNAME || true -# Create USER, DB, and add the 'plpgsql' language for stored procedures. - -echo " == Creating new database $DBNAME ==" -echo createdb --host $DBHOST --port $DBPORT --user postgres --owner $DBUSER --echo $DBNAME -createdb --host $DBHOST --port $DBPORT --user postgres --owner $DBUSER --echo $DBNAME -echo createlang --host $DBHOST --port $DBPORT --user postgres --dbname $DBNAME --echo "plpgsql" -createlang --host $DBHOST --port $DBPORT --user postgres --dbname $DBNAME --echo "plpgsql" - -echo " == Creating new tables in $DBNAME ==" -if [ -e /opt/lofar/sbin/sql/create_OTDB.sql ]; then - cd /opt/lofar/sbin/sql - echo psql -f create_OTDB.sql --host $DBHOST --port $DBPORT --user $DBUSER $DBNAME 2>&1 | grep ERROR | grep -v "does not exist" - psql -f create_OTDB.sql --host $DBHOST --port $DBPORT --user $DBUSER $DBNAME 2>&1 | grep ERROR | grep -v "does not exist" -else - echo "Cannot find /opt/lofar/sbin/sql/create_OTDB.sql; did you install this?" -fi -echo " == Done ==" diff --git a/dependencies/OTDB/sql/fresh_database.sh b/dependencies/OTDB/sql/fresh_database.sh deleted file mode 100755 index b7717e05cb2bf413cbb3437cfd1ebf42ea856b9c..0000000000000000000000000000000000000000 --- a/dependencies/OTDB/sql/fresh_database.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/sh -# -# DROPS the current database and make a whole new test database -# -DATABASENAME=CDR -if [ $# -eq 1 ]; then - DATABASENAME=$1 -fi - -# -echo "DELETING AND REBUILDING DATABASE " $DATABASENAME -sleep 5 -# -dropdb -h rs005 -U postgres $DATABASENAME -createdb -h rs005 -U postgres $DATABASENAME - -echo "creating new tables" -psql -f create_OTDB.sql -h rs005 -U postgres $DATABASENAME 2>&1 | grep ERROR | grep -v "does not exist" - diff --git a/dependencies/OTDB/sql/fresh_oper_database.sh b/dependencies/OTDB/sql/fresh_oper_database.sh deleted file mode 100755 index c769eafc83c35b2ef02311d4b1e46af960e74290..0000000000000000000000000000000000000000 --- a/dependencies/OTDB/sql/fresh_oper_database.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/sh -# -# DROPS the current database and make a whole new test database -# -DATABASENAME=CDR -if [ $# -eq 1 ]; then - DATABASENAME=$1 -fi - -# -echo "DELETING AND REBUILDING DATABASE " $DATABASENAME -sleep 5 -# -dropdb -h sasdb -U lofarsystem $DATABASENAME -createdb -h sasdb -U lofarsystem $DATABASENAME - -echo "creating new tables" -psql -f create_OTDB.sql -h sasdb -U lofarsystem $DATABASENAME 2>&1 | grep ERROR | grep -v "does not exist" - diff --git a/dependencies/OTDB/sql/fresh_sas001_database.sh b/dependencies/OTDB/sql/fresh_sas001_database.sh deleted file mode 100755 index cc3ab3417532117ff8b87d511f1e0c1b14868997..0000000000000000000000000000000000000000 --- a/dependencies/OTDB/sql/fresh_sas001_database.sh +++ /dev/null @@ -1,44 +0,0 @@ -#!/bin/sh -# -# DROPS the current database and make a whole new test database -# - -set -e -set -x - -export DBNAME=LOFAR_1 -export DBUSER=postgres -export DBHOST=sasdb -export DBPORT=5432 - -# The following commands assume that the user who executes this script has super user -# privileges. -# -# Access to PostgreSQL databases is managed via the 'pg_hba.conf' file. In current Debian -# systems, this file can be found at /etc/postgresql/8.1/main/pg_hba.conf. Make sure youallow -# access to the database. -# -# Postgres should be told to listen to external TCP ports. -# Edit /sasdb/data/postgresq.conf -# to have the following stanzas: -# -# Listen_addresses = '*' -# Port = 5432 -# -# Don't forget to restart Postgres after altering these files, -# as follows (Debian): -# -# pg_ctl start -D /sasdb/data -l /sasdb/data/pg_log/logfile -# -# Drop DB & USER. User DBUSER owns DBNAME, so we have to remove the database first! -# Note the '|| true' at the end. This ensures that the commands succeed, -# even if the database is not found. - -dropdb --host $DBHOST --port $DBPORT --user postgres --echo $DBNAME || true -# Create USER, DB, and add the 'plpgsql' language for stored procedures. - -createdb --host $DBHOST --port $DBPORT --user postgres --owner $DBUSER --echo $DBNAME -createlang --host $DBHOST --port $DBPORT --user postgres --dbname $DBNAME --echo "plpgsql" - -echo "creating new tables" -psql -f create_OTDB.sql --host $DBHOST --port $DBPORT --user $DBUSER $DBNAME 2>&1 | grep ERROR | grep -v "does not exist" diff --git a/dependencies/OTDB/sql/getAllTaskID_func.sql b/dependencies/OTDB/sql/getAllTaskID_func.sql deleted file mode 100644 index 3587d015b2de9ba84e3b898f138fbc8ffc3fd78f..0000000000000000000000000000000000000000 --- a/dependencies/OTDB/sql/getAllTaskID_func.sql +++ /dev/null @@ -1,41 +0,0 @@ --- --- getAllTaskID.sql: function for getting treeinfo from the OTDB --- --- Copyright (C) 2010 --- ASTRON (Netherlands Foundation for Research in Astronomy) --- P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, softwaresupport@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:$ - -CREATE OR REPLACE FUNCTION getAllTaskID() - RETURNS SETOF INTEGER AS $$ - -- $Id: addComponentToVT_func.sql 19935 2012-01-25 09:06:14Z mol $ - DECLARE - vRecord RECORD; - - BEGIN - FOR vRecord IN - SELECT CAST(value AS INTEGER) - FROM VICHIERARCHY - WHERE NAME = 'LOFAR.ObsSW.Observation.Scheduler.taskID' - ORDER BY VALUE - LOOP - RETURN NEXT vRecord.value; - END LOOP; - RETURN; - END; -$$ language plpgsql; diff --git a/dependencies/OTDB/sql/getBrokenHardware_func.sql b/dependencies/OTDB/sql/getBrokenHardware_func.sql deleted file mode 100644 index ed6bcd14da522ec8224116fa1a991ba631247935..0000000000000000000000000000000000000000 --- a/dependencies/OTDB/sql/getBrokenHardware_func.sql +++ /dev/null @@ -1,89 +0,0 @@ --- --- getBrokenHardware.sql: function for getting hardware not suitable for operational use. --- --- Copyright (C) 2011 --- ASTRON (Netherlands Foundation for Research in Astronomy) --- P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, softwaresupport@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: getTreeList_func.sql 18624 2011-07-27 15:34:51Z schoenmakers $ --- - --- --- getBrokenHardware ([timestamp]) --- --- Get a list KVTs from the pic of hardware that was 'broken' on the given date. --- --- Authorisation: none --- --- Tables: pickvt read --- --- Types: OTDBvalue --- - -CREATE OR REPLACE VIEW pktemp AS SELECT DISTINCT ON (paramid) paramid, value, time FROM pickvt WHERE value::integer > 10 ORDER BY paramid,time DESC; - -CREATE OR REPLACE FUNCTION nextPICkvt(int,timestamp) - RETURNS SETOF OTDBvalue AS $$ - SELECT paramid,''::VARCHAR(150),value,time::timestamp - FROM pickvt - WHERE paramid=$1 AND time>$2 - ORDER BY TIME - LIMIT 1; -$$ LANGUAGE SQL; - -CREATE OR REPLACE FUNCTION getBrokenHardware(VARCHAR(20), VARCHAR(20)) - RETURNS SETOF OTDBvalue AS $$ - -- $Id: addComponentToVT_func.sql 19935 2012-01-25 09:06:14Z mol $ - DECLARE - vRecord RECORD; - vRecord2 RECORD; - vStartTime TIMESTAMP; - vStopTime TIMESTAMP; - vWhere TEXT; - - BEGIN - IF $1 = '' THEN - vStartTime := now(); - ELSE - vStartTime := $1; - END IF; - IF $2 = '' THEN - vStopTime := now(); - vWhere := 'WHERE time < ' || chr(39) || vStartTime || chr(39); - ELSE - vStopTime := $2; - vWhere := 'WHERE time >= ' || chr(39) || vStartTime || chr(39) || ' AND time < ' || chr(39) || vStopTime || chr(39); - END IF; - FOR vRecord IN - EXECUTE ' - SELECT p.paramid,r.pvssname::VARCHAR(150),p.value,p.time::timestamp - FROM pktemp p - LEFT JOIN PICparamref r ON r.paramid = p.paramid ' || vWhere - LOOP - FOR vRecord2 IN - SELECT p.paramid,r.pvssname::VARCHAR(150),p.value,p.time::timestamp - FROM nextPICkvt(vRecord.paramid,vRecord.time) p - LEFT JOIN PICparamref r ON r.paramid = p.paramid - LOOP - RETURN NEXT vRecord2; - END LOOP; - RETURN NEXT vRecord; - END LOOP; - RETURN; - END -$$ LANGUAGE plpgsql; - diff --git a/dependencies/OTDB/sql/getDefaultTemplates_func.sql b/dependencies/OTDB/sql/getDefaultTemplates_func.sql deleted file mode 100644 index cba5df5f1ff70dcb688279e70604657219bc36a5..0000000000000000000000000000000000000000 --- a/dependencies/OTDB/sql/getDefaultTemplates_func.sql +++ /dev/null @@ -1,142 +0,0 @@ --- --- getDefaultTemplate.sql: function for getting treeinfo from the OTDB --- --- Copyright (C) 2005 --- ASTRON (Netherlands Foundation for Research in Astronomy) --- P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, softwaresupport@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: getTreeList_func.sql 9997 2007-03-01 12:21:46Z overeem $ --- - --- --- getDefaultTemplates () --- --- Get a list of treeID's of the default template trees. --- --- Authorisation: none --- --- Tables: otdbtree read --- otdbuser read --- campaign read --- --- Types: templateInfo --- -CREATE OR REPLACE FUNCTION getDefaultTemplates() - RETURNS SETOF templateInfo AS $$ - -- $Id: addComponentToVT_func.sql 19935 2012-01-25 09:06:14Z mol $ - DECLARE - vRecord RECORD; - TSobsolete CONSTANT INT2 := 1200; - - BEGIN - -- do selection - FOR vRecord IN - SELECT treeID, - name, - processType, - processSubtype, - strategy - FROM OTDBtree - WHERE name IS NOT NULL - LOOP - RETURN NEXT vRecord; - END LOOP; - RETURN; - END -$$ LANGUAGE plpgsql; - --- --- assignTemplateName (auth, treeID, name) --- --- Connect the given name to the given templateID --- --- Authorisation: none --- --- Tables: otdbtree write --- otdbuser read --- --- Types: none --- -CREATE OR REPLACE FUNCTION assignTemplateName(INT4, INT4, VARCHAR(32)) - RETURNS BOOLEAN AS $$ - -- $Id: addComponentToVT_func.sql 19935 2012-01-25 09:06:14Z mol $ - DECLARE - TSobsolete CONSTANT INT2 := 1200; - TTtemplate CONSTANT INT2 := 20; - TThierarchy CONSTANT INT2 := 30; - vFunction CONSTANT INT2 := 1; - vTreeType OTDBtree.treetype%TYPE; - vProcessType OTDBtree.processType%TYPE; - vprocessSubtype OTDBtree.processSubtype%TYPE; - vStrategy OTDBtree.strategy%TYPE; - vIsAuth BOOLEAN; - vDummy INTEGER; - vAuthToken ALIAS FOR $1; - - BEGIN - -- check authorisation(authToken, tree, func, parameter) - vIsAuth := FALSE; - SELECT isAuthorized(vAuthToken, $2, vFunction, 0) - INTO vIsAuth; - IF NOT vIsAuth THEN - RAISE EXCEPTION 'Not authorized'; - RETURN FALSE; - END IF; - - -- get treetype - SELECT treetype, processType, processSubtype, strategy - INTO vTreeType, vProcessType, vprocessSubtype, vStrategy - FROM OTDBtree - WHERE treeID = $2; - IF NOT FOUND THEN - RAISE EXCEPTION 'Tree % does not exist', $2; - RETURN FALSE; - END IF; - - IF vTreeType != TTtemplate THEN - RAISE EXCEPTION 'Tree % is not a template tree', $2; - RETURN FALSE; - END IF; - - -- check for double defaulttemplate entries - IF $3 IS NOT NULL AND vProcessType != '' THEN - SELECT treeID - INTO vDummy - FROM OTDBtree - WHERE processType = vProcessType - AND processSubtype = vprocessSubtype - AND strategy = vStrategy - AND name IS NOT NULL - AND state < TSobsolete; - IF FOUND AND vDummy != $2 THEN - RAISE EXCEPTION 'There is already a defaultTemplate with the same processType setting.'; - RETURN FALSE; - END IF; - END IF; - - UPDATE OTDBtree - SET name = $3 - WHERE treeID = $2; - IF NOT FOUND THEN - RAISE EXCEPTION 'Name % can not be assigned to templateID %', $3, $2; - RETURN FALSE; - END IF; - - RETURN TRUE; - END; -$$ LANGUAGE plpgsql; - diff --git a/dependencies/OTDB/sql/getExecutableTrees_func.sql b/dependencies/OTDB/sql/getExecutableTrees_func.sql deleted file mode 100644 index dca6b9ab52f8d3bb3f60f18b382971f2ea30892e..0000000000000000000000000000000000000000 --- a/dependencies/OTDB/sql/getExecutableTrees_func.sql +++ /dev/null @@ -1,84 +0,0 @@ --- --- getExecutableTrees.sql: function for getting treeinfo from the OTDB --- --- Copyright (C) 2005 --- ASTRON (Netherlands Foundation for Research in Astronomy) --- P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, softwaresupport@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$ --- - --- --- getExecutableTrees (state) --- --- Get a list of trees the is ready for execution or --- is already in execution. --- --- Authorisation: none --- --- Tables: otdbtree read --- otdbuser read --- campaign read --- --- Types: treeInfo --- -CREATE OR REPLACE FUNCTION getExecutableTrees(INT2) - RETURNS SETOF treeInfo AS $$ - -- $Id$ - DECLARE - vRecord RECORD; - TSscheduled CONSTANT INT2 := 400; - TSactive CONSTANT INT2 := 600; - TThierarchy CONSTANT INT2 := 30; - - BEGIN - -- do selection - FOR vRecord IN - SELECT t.treeID, - t.momID, - t.groupID, - t.classif, - u.username, - t.d_creation, - t.modificationdate, - t.treetype, - t.state, - t.originID, - c.name, - t.starttime, - t.stoptime, - t.processType, - t.processSubtype, - t.strategy, - t.description - FROM OTDBtree t - INNER JOIN OTDBuser u ON t.creator = u.userid - INNER JOIN campaign c ON c.ID = t.campaign - WHERE t.treetype = TThierarchy - AND t.classif = $1 - AND t.state between TSscheduled AND TSactive - AND t.stoptime > now() - ORDER BY t.starttime, t.treeID - LOOP - RETURN NEXT vRecord; - END LOOP; - RETURN; - END -$$ LANGUAGE plpgsql; - - - diff --git a/dependencies/OTDB/sql/getModifiedTrees_func.sql b/dependencies/OTDB/sql/getModifiedTrees_func.sql deleted file mode 100644 index b7c1da39f149c07aa4e2464874bc957568637cdc..0000000000000000000000000000000000000000 --- a/dependencies/OTDB/sql/getModifiedTrees_func.sql +++ /dev/null @@ -1,82 +0,0 @@ --- --- getModifiedTrees.sql: function for getting treeinfo from the OTDB --- --- Copyright (C) 2012 --- ASTRON (Netherlands Foundation for Research in Astronomy) --- P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, softwaresupport@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: getTreeList_func.sql 18624 2011-07-27 15:34:51Z schoenmakers $ --- - --- --- getModifiedTrees (after, [treeType]) --- --- Get a list of trees that is modified after given timestamp. --- --- Authorisation: none --- --- Tables: otdbtree read --- otdbuser read --- campaign read --- --- Types: treeInfo --- -CREATE OR REPLACE FUNCTION getModifiedTrees(VARCHAR(20), INT2) - RETURNS SETOF treeInfo AS $$ - -- $Id: addComponentToVT_func.sql 19935 2012-01-25 09:06:14Z mol $ - DECLARE - vRecord RECORD; - vQuery TEXT; - - BEGIN - -- Construct where clause - vQuery := 'WHERE t.modificationDate >' || chr(39) || $1 || chr(39); - IF $2 > 0 THEN - vQuery := vQuery || ' AND t.treetype = ' || $2; - END IF; - - -- do selection - FOR vRecord IN EXECUTE ' - SELECT t.treeID, - t.momID, - t.groupID, - t.classif, - u.username, - t.d_creation, - t.modificationdate, - t.treetype, - t.state, - t.originID, - c.name, - t.starttime, - t.stoptime, - t.processType, - t.processSubtype, - t.strategy, - t.description - FROM OTDBtree t - INNER JOIN OTDBuser u ON t.creator = u.userid - INNER JOIN campaign c ON c.ID = t.campaign - ' || vQuery || ' AND t.name IS NULL - ORDER BY t.treeID DESC' - LOOP - RETURN NEXT vRecord; - END LOOP; - RETURN; - END -$$ LANGUAGE plpgsql; - diff --git a/dependencies/OTDB/sql/getMomID2treeID_func.sql b/dependencies/OTDB/sql/getMomID2treeID_func.sql deleted file mode 100644 index b8fdc492228151c46597abd8628b755c6c9e05c4..0000000000000000000000000000000000000000 --- a/dependencies/OTDB/sql/getMomID2treeID_func.sql +++ /dev/null @@ -1,52 +0,0 @@ --- --- getMomID2treeID.sql: function for changing the Mom information of a tree --- --- Copyright (C) 2012 --- ASTRON (Netherlands Foundation for Research in Astronomy) --- P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, softwaresupport@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: setMomInfo_func.sql 18624 2011-07-27 15:34:51Z schoenmakers $ --- - --- --- getMomID2treeID() --- --- Authorisation: no --- --- Tables: otdbtree read --- --- Types: none --- - -DROP TYPE IF EXISTS treeIDmomID CASCADE; -CREATE TYPE treeIDmomID AS (treeID INTEGER, momID INTEGER); - -CREATE OR REPLACE FUNCTION getMomID2treeID() - RETURNS SETOF treeIDmomID AS $$ - -- $Id: addComponentToVT_func.sql 19935 2012-01-25 09:06:14Z mol $ - DECLARE - vRecord RECORD; - - BEGIN - FOR vRecord IN SELECT treeID,MomID FROM OTDBtree WHERE momID != '0' ORDER BY momID - LOOP - RETURN NEXT vRecord; - END LOOP; - RETURN; - END -$$ LANGUAGE plpgsql; - diff --git a/dependencies/OTDB/sql/getNode_func.sql b/dependencies/OTDB/sql/getNode_func.sql deleted file mode 100644 index 505bcde0be1322aab71c3a766e9a042f00e13e82..0000000000000000000000000000000000000000 --- a/dependencies/OTDB/sql/getNode_func.sql +++ /dev/null @@ -1,165 +0,0 @@ --- --- getNode.sql: gets the topnode of the tree --- --- Copyright (C) 2005 --- ASTRON (Netherlands Foundation for Research in Astronomy) --- P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, softwaresupport@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$ --- - --- --- getNode (treeID, nodeID) --- --- Gets the node of the tree --- --- Authorisation: no --- --- Tables: otdbtree read --- --- Types: OTDBnode --- -CREATE OR REPLACE FUNCTION getNode(INT4, INT4) - RETURNS OTDBnode AS ' - -- $Id$ - DECLARE - TThardware CONSTANT INT2 := 10; - TTtemplate CONSTANT INT2 := 20; - vNode RECORD; - vTreeType OTDBtree.treetype%TYPE; - vLeaf VICtemplate.leaf%TYPE; - - BEGIN - -- get treetype - SELECT treetype - INTO vTreeType - FROM OTDBtree - WHERE treeID = $1; - IF NOT FOUND THEN - RAISE EXCEPTION \'Tree % does not exist\', $1; - END IF; - - IF vTreeType = TThardware THEN - SELECT h.nodeID, - h.parentID, - h.paramrefID, - h.name::VARCHAR(150), - h.index, - h.leaf, - 1::int2, - \'1\'::text, -- limits - r.description - INTO vNode - FROM PIChierarchy h - INNER JOIN PICparamref r on r.paramid = h.paramrefID - WHERE h.treeID = $1 - AND h.nodeID = $2; - - ELSIF vTreeType = TTtemplate THEN - -- is node a param of a node? - SELECT leaf - INTO vLeaf - FROM VICtemplate - WHERE treeID = $1 - AND nodeID = $2; - - IF vLeaf = FALSE THEN - SELECT t.nodeID, - t.parentID, - t.originID, - t.name::VARCHAR(150), - t.index, - t.leaf, - t.instances, - t.limits, - n.description - INTO vNode - FROM VICtemplate t - INNER JOIN VICnodedef n on n.nodeID = t.originID - WHERE t.treeID = $1 - AND t.nodeID = $2; - ELSE - -- a param - SELECT t.nodeID, - t.parentID, - t.originID, - t.name::VARCHAR(150), - t.index, - t.leaf, - t.instances, - t.limits, - n.description - INTO vNode - FROM VICtemplate t - INNER JOIN VICparamdef n on n.paramID = t.originID - WHERE t.treeID = $1 - AND t.nodeID = $2; - END IF; - - ELSE - -- VIChierarchy - SELECT leaf - INTO vLeaf - FROM VIChierarchy - WHERE treeID = $1 - AND nodeID = $2; - - - IF vLeaf = FALSE THEN - SELECT h.nodeID, - h.parentID, - h.paramRefID, - h.name::VARCHAR(150), - h.index, - h.leaf, - 1::int2, - \'1\'::text, -- limits, - n.description - INTO vNode - FROM VIChierarchy h - INNER JOIN VICnodedef n on n.nodeID = h.paramRefID - WHERE h.treeID = $1 - AND h.nodeID = $2; - ELSE - -- a param - SELECT h.nodeID, - h.parentID, - h.paramRefID, - h.name::VARCHAR(150), - h.index, - h.leaf, - 1::int2, - h.value, --- \'1\'::text, -- limits, - p.description - INTO vNode - FROM VIChierarchy h - INNER JOIN VICparamdef p on p.paramID = h.paramRefID - WHERE h.treeID = $1 - AND h.nodeID = $2; - END IF; - END IF; - - -- be sure 0 rows are returned when nothing is found - IF NOT FOUND THEN - RAISE EXCEPTION \'Node %,% not found\', $1, $2; - END IF; - - RETURN vNode; - END; -' LANGUAGE plpgsql; - diff --git a/dependencies/OTDB/sql/getPICitemList_func.sql b/dependencies/OTDB/sql/getPICitemList_func.sql deleted file mode 100644 index 71b8f96084455058a8d8097c0553e9d742148da6..0000000000000000000000000000000000000000 --- a/dependencies/OTDB/sql/getPICitemList_func.sql +++ /dev/null @@ -1,131 +0,0 @@ --- --- getPICitemList.sql: function for getting some layers of a PIC tree --- --- Copyright (C) 2005 --- ASTRON (Netherlands Foundation for Research in Astronomy) --- P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, softwaresupport@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$ --- - --- --- getPICitemList (treeID, topNode, depth) --- --- Get a list of items. --- --- Authorisation: none --- --- Tables: picparamref read --- pichierarchy read --- --- Types: OTDBnode --- -CREATE OR REPLACE FUNCTION getPICitemList(INT4, INT4, INT4) - RETURNS SETOF OTDBnode AS ' - -- $Id$ - DECLARE - vRecord RECORD; - vFullname VARCHAR(150); - vNodename VARCHAR(150); - vQuery VARCHAR(150); - vLeaf PIChierarchy.leaf%TYPE; - vParamRefID PIChierarchy.paramRefID%TYPE; - i INTEGER; - - BEGIN - -- Is topNode a Node or a Parameter? - SELECT leaf, paramRefID, name - INTO vLeaf, vParamRefID, vFullname - FROM PIChierarchy - WHERE nodeID = $2; - - IF vLeaf = TRUE AND $3 = 0 THEN - vQuery := \'=\' || chr(39) || vFullname || chr(39) - || \' AND h.leaf=true \'; - ELSE - -- construct query - vQuery := \'similar to \' || chr(39) || vFullname; - FOR i in 1..$3 LOOP - vQuery := vQuery || \'.[^\\\\\\\\.]+\'; - END LOOP; - vQuery := vQuery || chr(39); - END IF; - - -- finally get result - FOR vRecord IN EXECUTE \' - SELECT h.nodeid, - h.parentid, - h.paramrefid, - h.name::VARCHAR(150), - h.index, - h.leaf, - 1::int2, - \\\'\\\'::text, - r.description - FROM PIChierarchy h - INNER JOIN PICparamRef r ON r.paramid = h.paramrefID - WHERE h.treeID = \' || $1 || \' - AND h.name \' || vQuery - LOOP - RETURN NEXT vRecord; - END LOOP; - RETURN; - END -' LANGUAGE plpgsql; - --- --- getPICitemList (treeID, namefragment) --- --- Get a list of items. --- --- Authorisation: none --- --- Tables: picparamref read --- pichierarchy read --- --- Types: OTDBnode --- -CREATE OR REPLACE FUNCTION getPICitemList(INT4, VARCHAR(150)) - RETURNS SETOF OTDBnode AS ' - -- $Id$ - DECLARE - vRecord RECORD; - - BEGIN - FOR vRecord IN - SELECT h.nodeid, - h.parentid, - h.paramrefid, - h.name::VARCHAR(150), - h.index, - h.leaf, - 1::int2, - \'\'::text, - r.description - FROM PICparamref r - INNER JOIN PIChierarchy h ON r.paramid = h.paramrefID - WHERE h.treeID = $1 - AND r.pvssname like $2 - LOOP - RETURN NEXT vRecord; - END LOOP; - RETURN; - END -' LANGUAGE plpgsql; - - - diff --git a/dependencies/OTDB/sql/getPICparamDef_func.sql b/dependencies/OTDB/sql/getPICparamDef_func.sql deleted file mode 100644 index 39d2bcf71c2a6c892557fc4152d9450a6044b963..0000000000000000000000000000000000000000 --- a/dependencies/OTDB/sql/getPICparamDef_func.sql +++ /dev/null @@ -1,66 +0,0 @@ --- --- getPICParamDef.sql: function for getting parameterDefinition from the OTDB --- --- Copyright (C) 2005 --- ASTRON (Netherlands Foundation for Research in Astronomy) --- P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, softwaresupport@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$ --- - --- --- getParamDef (paramID) --- --- Get info of one parmeter --- --- Authorisation: none --- --- Tables: PICparamdef read --- --- Types: OTDBparamDef --- -CREATE OR REPLACE FUNCTION getPICParamDef(INT4) - RETURNS OTDBparamDef AS ' - -- $Id$ - DECLARE - vRecord RECORD; - - BEGIN - SELECT paramid, - 0::int4, - pvssname, - par_type, - unit, - pruning, - 0::int2, - true, - \'\'::text, - description - INTO vRecord - FROM PICparamref - WHERE paramID = $1; - - IF NOT FOUND THEN - RAISE EXCEPTION \'Parameter % does not exist\', $1; - END IF; - - RETURN vRecord; - END -' LANGUAGE plpgsql; - - - diff --git a/dependencies/OTDB/sql/getSchedulerInfo_func.sql b/dependencies/OTDB/sql/getSchedulerInfo_func.sql deleted file mode 100644 index eacfccf193e5a39f1c3ed2cf86798e27b05b944d..0000000000000000000000000000000000000000 --- a/dependencies/OTDB/sql/getSchedulerInfo_func.sql +++ /dev/null @@ -1,84 +0,0 @@ --- --- getSchedulerInfo_func.sql: function for getting treeinfo from the OTDB --- --- Copyright (C) 2010 --- ASTRON (Netherlands Foundation for Research in Astronomy) --- P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, softwaresupport@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 --- - -DROP TYPE IF EXISTS schedulerInfo CASCADE; - -CREATE TYPE schedulerInfo AS ( - contactEmail VARCHAR(40), - contactName VARCHAR(30), - contactPhone VARCHAR(20), - firstPossibleDay INT4, - fixedDay BOOLEAN, - fixedTime BOOLEAN, - lastPossibleDay INT4, - late BOOLEAN, - nightTimeWeightFactor INT4, - predecessors TEXT, - predMaxTimeDif VARCHAR(10), - predMinTimeDif VARCHAR(10), - priority FLOAT, - reason TEXT, - referenceFrame INT4, - reservation INT4, - storageSelectionMode INT4, - taskDuration INT4, - taskID INT4, - taskName VARCHAR(40), - taskType INT4, - windowMaximumTime VARCHAR(8), - windowMinimumTime VARCHAR(8) -); - -CREATE OR REPLACE FUNCTION getSchedulerInfo(INT4) - RETURNS schedulerInfo AS ' - DECLARE vRecord schedulerInfo; - DECLARE fieldList CURSOR FOR - SELECT limits FROM getvhitemlist($1, \'%Observation.Scheduler.%\') ORDER BY name ASC; - - BEGIN - OPEN fieldList; - FETCH fieldList INTO vRecord.contactEmail; - FETCH fieldList INTO vRecord.contactName; - FETCH fieldList INTO vRecord.contactPhone; - FETCH fieldList INTO vRecord.firstPossibleDay; - FETCH fieldList INTO vRecord.fixedDay; - FETCH fieldList INTO vRecord.fixedTime; - FETCH fieldList INTO vRecord.lastPossibleDay; - FETCH fieldList INTO vRecord.late; - FETCH fieldList INTO vRecord.nightTimeWeightFactor; - FETCH fieldList INTO vRecord.predecessors; - FETCH fieldList INTO vRecord.predMaxTimeDif; - FETCH fieldList INTO vRecord.predMinTimeDif; - FETCH fieldList INTO vRecord.priority; - FETCH fieldList INTO vRecord.reason; - FETCH fieldList INTO vRecord.referenceFrame; - FETCH fieldList INTO vRecord.reservation; - FETCH fieldList INTO vRecord.storageSelectionMode; - FETCH fieldList INTO vRecord.taskDuration; - FETCH fieldList INTO vRecord.taskID; - FETCH fieldList INTO vRecord.taskName; - FETCH fieldList INTO vRecord.taskType; - FETCH fieldList INTO vRecord.windowMaximumTime; - FETCH fieldList INTO vRecord.windowMinimumTime; - RETURN vRecord; - END; -' language plpgsql; diff --git a/dependencies/OTDB/sql/getStateChanges_func.sql b/dependencies/OTDB/sql/getStateChanges_func.sql deleted file mode 100644 index c4c71ae43207df8db9d034ec2dcad29c394a9990..0000000000000000000000000000000000000000 --- a/dependencies/OTDB/sql/getStateChanges_func.sql +++ /dev/null @@ -1,88 +0,0 @@ --- --- getStateChanges.sql: function for getting state changes in a given period --- --- Copyright (C) 2015 --- ASTRON (Netherlands Foundation for Research in Astronomy) --- P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, softwaresupport@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: getStateList_func.sql 30919 2015-02-05 15:26:22Z amesfoort $ --- - --- --- getStateChanges(begindate, enddate) --- --- Get a list of statechanges. --- --- Authorisation: none --- --- Tables: otdbtree read --- otdbuser read --- --- Types: treeState --- -DROP TYPE IF EXISTS stateChange CASCADE; -CREATE TYPE stateChange AS ( - -- $Id: create_types.sql 30919 2015-02-05 15:26:22Z amesfoort $ - treeID INT4, -- OTDBtree.treeID%TYPE, - momID INT4, -- OTDBtree.momID%TYPE, - state INT2, -- treestate.ID%TYPE, - username VARCHAR(20), -- OTDBuser.username%TYPE, - modtime timestamp(0), - creation timestamp(6) -); - -CREATE OR REPLACE FUNCTION getStateChanges(TIMESTAMP(6), TIMESTAMP(6)) - RETURNS SETOF stateChange AS ' - -- $Id: getStateList_func.sql 30919 2015-02-05 15:26:22Z amesfoort $ - DECLARE - vRecord RECORD; - vQuery TEXT; - vKeyField TEXT; - - BEGIN - -- create query for treeID (when filled) - vQuery := \'WHERE \'; - IF $1 IS NOT NULL THEN - IF $2 IS NULL THEN - vQuery := vQuery || \'s.creation >\' || chr(39) || $1 || chr(39); - ELSE - vQuery := vQuery || \'s.creation >\' || chr(39) || $1 || chr(39) - || \' AND s.creation <=\' || chr(39) || $2 || chr(39); - END IF; - END IF; - - -- do selection - FOR vRecord IN EXECUTE \' - SELECT s.treeID, - s.momID, - s.state, - u.username, - s.timestamp, - s.creation - FROM StateHistory s - INNER JOIN OTDBuser u ON s.userid = u.userid - \' || vQuery || \' - ORDER BY s.creation ASC\' - LOOP - RETURN NEXT vRecord; - END LOOP; - RETURN; - END -' LANGUAGE plpgsql; - - - diff --git a/dependencies/OTDB/sql/getStateList_func.sql b/dependencies/OTDB/sql/getStateList_func.sql deleted file mode 100644 index 7296f028cbc31866474a31aa12f4268713c08861..0000000000000000000000000000000000000000 --- a/dependencies/OTDB/sql/getStateList_func.sql +++ /dev/null @@ -1,95 +0,0 @@ --- --- getStateList.sql: function for getting state history from (a) tree(s) --- --- Copyright (C) 2005 --- ASTRON (Netherlands Foundation for Research in Astronomy) --- P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, softwaresupport@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$ --- - --- --- getStateList (treeID, isMomID, begindate, enddate) --- --- Get a list of statechanges. --- --- Authorisation: none --- --- Tables: otdbtree read --- otdbuser read --- --- Types: treeState --- -CREATE OR REPLACE FUNCTION getStateList(INT4, BOOLEAN, TIMESTAMP, TIMESTAMP) - RETURNS SETOF stateInfo AS ' - -- $Id$ - DECLARE - vRecord RECORD; - vQuery TEXT; - vKeyField TEXT; - - BEGIN - -- Construct where clause - IF $2 = TRUE THEN - vKeyField := \'s.momID\'; - ELSE - vKeyField := \'s.treeID\'; - END IF; - - -- create query for treeID (when filled) - vQuery := \'\'; - IF $1 > 0 THEN - -- add selection on treeID - vQuery := \'WHERE \' || vKeyField || \' =\' || chr(39) || $1 || chr(39); - IF $3 IS NOT NULL THEN - vQuery := vQuery || \' AND \'; - END IF; - END IF; - - -- append query with timestamp restriction(s) - IF $3 IS NOT NULL THEN - IF vQuery = \'\' THEN - vQuery := \'WHERE \'; - END IF; - IF $4 IS NULL THEN - vQuery := vQuery || \'s.timestamp >=\' || chr(39) || $3 || chr(39); - ELSE - vQuery := vQuery || \'s.timestamp >=\' || chr(39) || $3 || chr(39) - || \' AND s.timestamp <\' || chr(39) || $4 || chr(39); - END IF; - END IF; - - -- do selection - FOR vRecord IN EXECUTE \' - SELECT s.treeID, - s.momID, - s.state, - u.username, - s.timestamp - FROM StateHistory s - INNER JOIN OTDBuser u ON s.userid = u.userid - \' || vQuery || \' - ORDER BY s.timestamp ASC\' - LOOP - RETURN NEXT vRecord; - END LOOP; - RETURN; - END -' LANGUAGE plpgsql; - - - diff --git a/dependencies/OTDB/sql/getStations_func.sql b/dependencies/OTDB/sql/getStations_func.sql deleted file mode 100644 index 7f5d8883c1df52035227cf67d61a0b3893c56967..0000000000000000000000000000000000000000 --- a/dependencies/OTDB/sql/getStations_func.sql +++ /dev/null @@ -1,69 +0,0 @@ --- --- getStations.sql: function for getting a list of station from the active PIC tree. --- --- Copyright (C) 2016 --- ASTRON (Netherlands Foundation for Research in Astronomy) --- P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, softwaresupport@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: getTreeList_func.sql 9997 2007-03-01 12:21:46Z overeem $ --- - --- --- getStations () --- --- Get a list of stations from the active PIC tree. --- --- Authorisation: none --- --- Tables: otdbtree read --- pichierarchy read --- --- Types: None --- -CREATE OR REPLACE FUNCTION getStations() - RETURNS SETOF TEXT AS $$ - -- $Id: addComponentToVT_func.sql 19935 2012-01-25 09:06:14Z mol $ - DECLARE - vRecord RECORD; - vTreeType OTDBtree.treetype%TYPE; - vPicID OTDBtree.treeid%TYPE; - TTPic CONSTANT INT2 := 10; - TSactive CONSTANT INT2 := 600; - - BEGIN - -- do selection - SELECT treeid - INTO vPicID - FROM OTDBtree - WHERE treetype = TTPic - AND state = TSactive; - IF NOT FOUND THEN - RAISE EXCEPTION 'No active PIC tree found!'; - END IF; - - FOR vRecord IN - SELECT name - FROM PIChierarchy - WHERE treeid = vPicID - AND name similar to 'LOFAR.PIC.[A-Za-z]+.[A-Za-z0-9]+' - AND leaf is False - LOOP - RETURN NEXT vRecord.name; - END LOOP; - RETURN; - END -$$ LANGUAGE plpgsql; diff --git a/dependencies/OTDB/sql/getTopNode_func.sql b/dependencies/OTDB/sql/getTopNode_func.sql deleted file mode 100644 index 2b318c8ffe0f54debdde56959ead75bce625ca5c..0000000000000000000000000000000000000000 --- a/dependencies/OTDB/sql/getTopNode_func.sql +++ /dev/null @@ -1,108 +0,0 @@ --- --- getTopNode.sql: gets the topnode of the tree --- --- Copyright (C) 2005 --- ASTRON (Netherlands Foundation for Research in Astronomy) --- P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, softwaresupport@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$ --- - --- --- getTopNode (treeID) --- --- gets the topnode of the tree --- --- Authorisation: no --- --- Tables: otdbtree read --- --- Types: OTDBnode --- -CREATE OR REPLACE FUNCTION getTopNode(INT4) - RETURNS OTDBnode AS ' - -- $Id$ - DECLARE - TThardware CONSTANT INT2 := 10; - TTtemplate CONSTANT INT2 := 20; - vNode RECORD; - vTreeType OTDBtree.treetype%TYPE; - - BEGIN - -- get treetype - SELECT treetype - INTO vTreeType - FROM OTDBtree - WHERE treeID = $1; - IF NOT FOUND THEN - RAISE EXCEPTION \'Tree % does not exist\', $1; - END IF; - - IF vTreeType = TThardware THEN - SELECT h.nodeID, - h.parentID, - h.paramrefID, - h.name::VARCHAR(150), - h.index, - h.leaf, - 1::int2, - \'1\'::text, -- limits - r.description - INTO vNode - FROM PIChierarchy h - INNER JOIN PICparamref r on r.paramid = h.paramrefID - WHERE h.treeID = $1 - AND h.parentID = 0; - - ELSIF vTreeType = TTtemplate THEN - SELECT t.nodeID, - t.parentID, - t.originID, - t.name::VARCHAR(150), - t.index, - t.leaf, - t.instances, - t.limits, - n.description - INTO vNode - FROM VICtemplate t - INNER JOIN VICnodedef n on n.nodeID = t.originID - WHERE t.treeID = $1 - AND t.parentID = 0; - - ELSE - SELECT h.nodeID, - h.parentID, - h.paramRefID, - h.name::VARCHAR(150), - h.index, - h.leaf, - 1::int2, - \'1\'::text, -- limits, - n.description - INTO vNode - FROM VIChierarchy h - INNER JOIN VICnodedef n on n.nodeID = h.paramRefID - WHERE h.treeID = $1 - AND h.parentID = 0; - - END IF; - - RETURN vNode; - END; -' LANGUAGE plpgsql; - diff --git a/dependencies/OTDB/sql/getTreeGroup_func.sql b/dependencies/OTDB/sql/getTreeGroup_func.sql deleted file mode 100644 index 053363ad9aea96099ca1572ce9da4f967dc96a48..0000000000000000000000000000000000000000 --- a/dependencies/OTDB/sql/getTreeGroup_func.sql +++ /dev/null @@ -1,153 +0,0 @@ --- --- getTreeGroup.sql: function for getting treeinfo from the OTDB --- --- Copyright (C) 2005 --- ASTRON (Netherlands Foundation for Research in Astronomy) --- P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, softwaresupport@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: getExecutableTrees_func.sql 8438 2006-05-18 19:16:37Z overeem $ --- - --- --- getTreeGroup (groupType, periodInMinutes, cluster) --- --- groupType = 0: get all trees that have to be scheduled --- 1: get all trees that are scheduled to start in the period: now till now+period --- 2: get all trees with starttime <=now and stoptime > now ; period param is ignored --- 3: get all trees with stoptime in the period: now-period till now --- 4: get all trees with stoptime < now and have state >= APPROVED --- --- cluster : '' Does not include limitation to the selection. --- 'CEP2' Returns all PIPELINES that belong to the groupType and that are assigned to CEP2 --- '!CEP2' Returns all trees that belongs to the groupType EXCEPT the PIPELINES that are assigned to CEP2 --- Other values are also allowed like CEP4 en !CEP4 --- --- With this function we can get the planned, active or finished trees from the database. --- --- Authorisation: none --- --- Tables: otdbtree read --- otdbuser read --- campaign read --- --- Types: treeInfo --- -CREATE OR REPLACE FUNCTION getTreeGroup(INT, INT, VARCHAR(20)) - RETURNS SETOF treeInfo AS $$ - -- $Id: addComponentToVT_func.sql 19935 2012-01-25 09:06:14Z mol $ - DECLARE - vRecord RECORD; - TSapproved CONSTANT INT2 := 300; - TSscheduled CONSTANT INT2 := 400; - TSqueued CONSTANT INT2 := 500; - TScompleting CONSTANT INT2 := 900; - TSfinished CONSTANT INT2 := 1000; - TThierarchy CONSTANT INT2 := 30; - TCoperational CONSTANT INT2 := 3; - vWhere TEXT; - vQuery TEXT; - vSortOrder TEXT; - vSortOrderExcept TEXT; - vExcept TEXT; - vCluster TEXT; - - BEGIN - vWhere := ''; - vQuery := 'SELECT v.* FROM VICtrees v'; - vSortOrder := 't.starttime, t.treeID'; - vExcept := ''; - IF $1 = 0 THEN - vWhere := ' AND (t.stoptime > now() OR t.stoptime IS NULL) '; - ELSE - IF $1 = 1 THEN - vWhere := ' AND (t.state = ' || TSscheduled || ' OR t.state = ' || TSqueued || ') '; - vWhere := vWhere || ' AND t.starttime >= now() AND t.starttime < now()+interval ' || chr(39) || $2 || ' minutes' || chr(39); - ELSE - IF $1 = 2 THEN - vWhere := ' AND t.state > ' || TSscheduled || ' AND t.state < ' || TScompleting; - vWhere := vWhere || ' AND t.stoptime>now()-interval ' || chr(39) || $2 || ' minutes' || chr(39); - ELSE - IF $1 = 3 THEN - vWhere := ' AND t.state >= ' || TScompleting; - vWhere := vWhere || ' AND t.stoptime > now()-interval ' || chr(39) || $2 || ' minutes' || chr(39); - vSortOrder := 't.stoptime, t.treeID'; - ELSE - IF $1 = 4 THEN - vWhere := ' AND t.state >= ' || TSapproved; - vWhere := vWhere || ' AND t.stoptime < now() '; - vSortOrder := 't.treeID'; - ELSE - RAISE EXCEPTION 'groupType must be 0,1,2,3 or 4 not %', $1; - END IF; - END IF; - END IF; - END IF; - END IF; - IF $3 != '' THEN - vExcept := ' - SELECT x.* FROM VICtrees x INNER JOIN VIChierarchy h USING(treeid) - WHERE x.processtype = \'Pipeline\' - AND h.name = \'LOFAR.ObsSW.Observation.Cluster.ProcessingCluster.clusterName\' - AND h.value='|| chr(39); - - IF LEFT($3,1) = '!' THEN - vCluster := substring($3 from 2); - vExcept := ' EXCEPT ' || vExcept || vCluster || chr(39); - ELSE - vCluster := $3; - vQuery := vExcept || vCluster || chr(39); - vExcept := ''; - END IF; - END IF; - - vSortOrderExcept := replace(vSortOrder, 't.', ''); - - -- do selection - FOR vRecord IN EXECUTE ' - WITH VICtrees AS ( - SELECT t.treeID, - t.momID, - t.groupID, - t.classif, - u.username, - t.d_creation, - t.modificationdate, - t.treetype, - t.state, - t.originID, - c.name, - t.starttime, - t.stoptime, - t.processType, - t.processSubtype, - t.strategy, - t.description - FROM OTDBtree t - INNER JOIN OTDBuser u ON t.creator = u.userid - INNER JOIN campaign c ON c.ID = t.campaign - WHERE t.treetype = 30 - AND t.classif = 3 - ' || vWhere || ' - ORDER BY ' || vSortOrder || ') - ' || vQuery || vExcept || ' ORDER BY ' || vSortOrderExcept - LOOP - RETURN NEXT vRecord; - END LOOP; - RETURN; - END -$$ LANGUAGE plpgsql; - diff --git a/dependencies/OTDB/sql/getTreeInfo_func.sql b/dependencies/OTDB/sql/getTreeInfo_func.sql deleted file mode 100644 index 962ace7a17723a222db6bbe281255f1f1d7835a2..0000000000000000000000000000000000000000 --- a/dependencies/OTDB/sql/getTreeInfo_func.sql +++ /dev/null @@ -1,106 +0,0 @@ --- --- getTreeInfo.sql: function for getting treeinfo from the OTDB --- --- Copyright (C) 2005 --- ASTRON (Netherlands Foundation for Research in Astronomy) --- P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, softwaresupport@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$ --- - --- --- getTreeInfo (treeID, isMomID) --- --- Get info of one tree --- --- Authorisation: none --- --- Tables: otdbtree read --- otdbuser read --- campaign read --- --- Types: treeInfo --- -CREATE OR REPLACE FUNCTION getTreeInfo(INT4, BOOLEAN) - RETURNS treeInfo AS $$ - -- $Id$ - DECLARE - vRecord RECORD; - - -- note EXECUTE only works in loops, so we have to put the whole - -- query in the IF statement. - BEGIN - IF $2 = TRUE THEN - SELECT t.treeID, - t.momID, - t.groupID, - t.classif, - u.username, - t.d_creation, - t.modificationdate, - t.treetype, - t.state, - t.originID, - c.name, - t.starttime, - t.stoptime, - t.processType, - t.processSubtype, - t.strategy, - t.description - INTO vRecord - FROM OTDBtree t - INNER JOIN OTDBuser u ON t.creator = u.userid - INNER JOIN campaign c ON c.ID = t.campaign - WHERE t.momID = $1; - - IF NOT FOUND THEN - RAISE EXCEPTION 'Tree with MomID % does not exist', $1; - END IF; - ELSE - SELECT t.treeID, - t.momID, - t.groupID, - t.classif, - u.username, - t.d_creation, - t.modificationdate, - t.treetype, - t.state, - t.originID, - c.name, - t.starttime, - t.stoptime, - t.processType, - t.processSubtype, - t.strategy, - t.description - INTO vRecord - FROM OTDBtree t - INNER JOIN OTDBuser u ON t.creator = u.userid - INNER JOIN campaign c ON c.ID = t.campaign - WHERE t.treeID = $1; - - IF NOT FOUND THEN - RAISE EXCEPTION 'Tree with ID % does not exist', $1; - END IF; - END IF; - - RETURN vRecord; - END -$$ LANGUAGE plpgsql; - diff --git a/dependencies/OTDB/sql/getTreeList_func.sql b/dependencies/OTDB/sql/getTreeList_func.sql deleted file mode 100644 index 22cb9094cfe5a9f0e92e7774581bca0e13a8065c..0000000000000000000000000000000000000000 --- a/dependencies/OTDB/sql/getTreeList_func.sql +++ /dev/null @@ -1,107 +0,0 @@ --- --- getTreeList.sql: function for getting treeinfo from the OTDB --- --- Copyright (C) 2005 --- ASTRON (Netherlands Foundation for Research in Astronomy) --- P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, softwaresupport@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$ --- - --- --- getTreeList ([treeType], [classification], [groupID], [processType], [processSubtype], [strategy]) --- --- Get a list of trees. --- --- Authorisation: none --- --- Tables: otdbtree read --- otdbuser read --- campaign read --- --- Types: treeInfo --- -CREATE OR REPLACE FUNCTION getTreeList(INT2, INT2, INT4, VARCHAR(20), VARCHAR(50), VARCHAR(30)) - RETURNS SETOF treeInfo AS $$ - -- $Id$ - DECLARE - vRecord RECORD; - vQuery TEXT; - - BEGIN - -- Construct where clause - IF $1 = 0 AND $2 = 0 THEN - -- parameters are both zero, select all records - vQuery := 'WHERE t.treeID != 0'; - ELSE - vQuery := 'WHERE '; - IF $1 > 0 THEN - -- add selection on treeType - vQuery := vQuery || 't.treetype = ' || chr(39) || $1 || chr(39); - IF $2 > 0 THEN - vQuery := vQuery || ' AND '; - END IF; - END IF; - IF $2 > 0 THEN - -- add selection on classification - vQuery := vQuery || 't.classif = ' || chr(39) || $2 || chr(39); - END IF; - END IF; - IF $3 != 0 THEN - vQuery := vQuery || ' AND t.groupID = ' || chr(39) || $3 || chr(39); - END IF; - IF $4 != '' THEN - vQuery := vQuery || ' AND t.processType = ' || chr(39) || $4 || chr(39); - END IF; - IF $5 != '' THEN - vQuery := vQuery || ' AND t.processSubtype = ' || chr(39) || $5 || chr(39); - END IF; - IF $6 != '' THEN - vQuery := vQuery || ' AND t.strategy = ' || chr(39) || $6 || chr(39); - END IF; - - -- do selection - FOR vRecord IN EXECUTE ' - SELECT t.treeID, - t.momID, - t.groupID, - t.classif, - u.username, - t.d_creation, - t.modificationdate, - t.treetype, - t.state, - t.originID, - c.name, - t.starttime, - t.stoptime, - t.processType, - t.processSubtype, - t.strategy, - t.description - FROM OTDBtree t - INNER JOIN OTDBuser u ON t.creator = u.userid - INNER JOIN campaign c ON c.ID = t.campaign - ' || vQuery || ' AND t.name IS NULL - ORDER BY t.treeID DESC' - LOOP - RETURN NEXT vRecord; - END LOOP; - RETURN; - END -$$ LANGUAGE plpgsql; - diff --git a/dependencies/OTDB/sql/getTreesInPeriod_func.sql b/dependencies/OTDB/sql/getTreesInPeriod_func.sql deleted file mode 100644 index 8476ec106512509bd53adc7573d374331f816023..0000000000000000000000000000000000000000 --- a/dependencies/OTDB/sql/getTreesInPeriod_func.sql +++ /dev/null @@ -1,80 +0,0 @@ --- --- searchTreeInPeriod.sql: function for getting treeinfo from the OTDB --- --- Copyright (C) 2005 --- ASTRON (Netherlands Foundation for Research in Astronomy) --- P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, softwaresupport@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: getTreeList_func.sql 9997 2007-03-01 12:21:46Z overeem $ --- - --- --- getTreesInPeriod (treeType, startDate, endDate) --- --- Get a list of trees. --- --- Authorisation: none --- --- Tables: otdbtree read --- otdbuser read --- campaign read --- --- Types: treeInfo --- -CREATE OR REPLACE FUNCTION getTreesInPeriod(INT2, TIMESTAMP, TIMESTAMP) - RETURNS SETOF treeInfo AS $$ - -- $Id: addComponentToVT_func.sql 19935 2012-01-25 09:06:14Z mol $ - DECLARE - vRecord RECORD; - vQuery TEXT; - - BEGIN - -- Construct where clause - vQuery := 'WHERE t.treetype = ' || chr(39) || $1 || chr(39) || ' AND ((t.starttime <= '; - vQuery := vQuery || chr(39) || $3 || chr(39) || ' AND t.stoptime >= ' || chr(39) || $2 || chr(39) || ')'; - vQuery := vQuery || ' OR t.starttime IS NULL OR t.stoptime IS NULL)'; - -- do selection - FOR vRecord IN EXECUTE ' - SELECT t.treeID, - t.momID, - t.groupID, - t.classif, - u.username, - t.d_creation, - t.modificationdate, - t.treetype, - t.state, - t.originID, - c.name, - t.starttime, - t.stoptime, - t.processType, - t.processSubtype, - t.strategy, - t.description - FROM OTDBtree t - INNER JOIN OTDBuser u ON t.creator = u.userid - INNER JOIN campaign c ON c.ID = t.campaign - ' || vQuery || ' - ORDER BY t.treeID ASC' - LOOP - RETURN NEXT vRecord; - END LOOP; - RETURN; - END -$$ LANGUAGE plpgsql; - diff --git a/dependencies/OTDB/sql/getVCNodeList_func.sql b/dependencies/OTDB/sql/getVCNodeList_func.sql deleted file mode 100644 index 8bda0a63061c90f8f18c1a79b739b7b1ba6e4999..0000000000000000000000000000000000000000 --- a/dependencies/OTDB/sql/getVCNodeList_func.sql +++ /dev/null @@ -1,71 +0,0 @@ --- --- getVCNodeList.sql: gets the topnode of the tree --- --- Copyright (C) 2005 --- ASTRON (Netherlands Foundation for Research in Astronomy) --- P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, softwaresupport@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$ --- - --- --- getVCNodeList (namefragment, versionnr, toponly) --- --- Get a list with the top components --- --- Authorisation: no --- --- Tables: VICnodedef read --- --- Types: OTDBnodeDef --- -CREATE OR REPLACE FUNCTION getVCNodeList(VARCHAR(150), INT4, BOOLEAN) - RETURNS SETOF OTDBnodeDef AS ' - -- $Id$ - DECLARE - vRecord RECORD; - vRestriction VARCHAR(200); - - BEGIN - IF $2 <> 0 THEN - vRestriction := \' AND version = \' || $2; - ELSE - vRestriction := \'\'; - END IF; - - IF $3 = TRUE THEN - vRestriction := \' EXCEPT SELECT n.* FROM VICnodeDEF n, VICparamDef p \' || - \' WHERE cleanNodeName(p.name) = n.name\'; - END IF; - - -- do selection - FOR vRecord IN EXECUTE \' - SELECT nodeID, - name, - version, - classif, - constraints, - description - FROM VICnodedef - WHERE name LIKE \' || chr(39) || $1 || chr(39) || vRestriction - LOOP - RETURN NEXT vRecord; - END LOOP; - RETURN; - END; -' LANGUAGE plpgsql; - diff --git a/dependencies/OTDB/sql/getVCparams_func.sql b/dependencies/OTDB/sql/getVCparams_func.sql deleted file mode 100644 index 1aba8c091816412e803fd05ab188ed237f16050f..0000000000000000000000000000000000000000 --- a/dependencies/OTDB/sql/getVCparams_func.sql +++ /dev/null @@ -1,64 +0,0 @@ --- --- getVCparams.sql: function for getting parameterDefinition from the OTDB --- --- Copyright (C) 2005 --- ASTRON (Netherlands Foundation for Research in Astronomy) --- P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, softwaresupport@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$ --- - --- --- getVCparams (paramID) --- --- Get info of all parameters of a VIC component --- --- Authorisation: none --- --- Tables: VICparamdef read --- --- Types: OTDBparamDef --- -CREATE OR REPLACE FUNCTION getVCparams(INT4) - RETURNS SETOF OTDBparamDef AS ' - -- $Id$ - DECLARE - vRecord RECORD; - - BEGIN - FOR vRecord IN - SELECT paramid, - nodeid, - name, - par_type, - unit, - pruning, - validmoment, - rtmod, - limits, - description - FROM VICparamdef - WHERE nodeID = $1 - ORDER BY name - LOOP - RETURN NEXT vRecord; - END LOOP; - - RETURN; - END -' LANGUAGE plpgsql; - diff --git a/dependencies/OTDB/sql/getVHitemList_func.sql b/dependencies/OTDB/sql/getVHitemList_func.sql deleted file mode 100644 index 980e3f0e8219e0392a7241b96cced26d6ae25606..0000000000000000000000000000000000000000 --- a/dependencies/OTDB/sql/getVHitemList_func.sql +++ /dev/null @@ -1,176 +0,0 @@ --- --- getVHitemList.sql: function for getting some layers of a VH tree --- --- Copyright (C) 2005 --- ASTRON (Netherlands Foundation for Research in Astronomy) --- P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, softwaresupport@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$ --- - --- --- getVHitemList (treeID, topNode, depth) --- --- Get a list of items. --- --- Authorisation: none --- --- Tables: vicnodedef read --- vichierarchy read --- --- Types: OTDBnode --- -CREATE OR REPLACE FUNCTION getVHitemList(INT4, INT4, INT4) - RETURNS SETOF OTDBnode AS ' - -- $Id$ - DECLARE - vRecord RECORD; - vFullname VARCHAR(250); - vQuery VARCHAR(250); - vLeaf VIChierarchy.leaf%TYPE; - vParamRefID VIChierarchy.paramRefID%TYPE; - i INTEGER; - - BEGIN - -- Is topNode a Node or a Parameter? - SELECT leaf, paramRefID, name - INTO vLeaf, vParamRefID, vFullname - FROM VIChierarchy - WHERE nodeID = $2; - - IF vLeaf = TRUE AND $3 = 0 THEN - vQuery := \'=\' || chr(39) || vFullname || chr(39) - || \' AND h.leaf=true \'; - ELSE - -- construct query - vFullname = replace(vFullname, \'[\', \'\\\\\\\\[\'); - vFullname = replace(vFullname, \']\', \'\\\\\\\\]\'); - vQuery := \'similar to \' || chr(39) || vFullname; - FOR i in 1..$3 LOOP - vQuery := vQuery || \'.[^\\\\\\\\.]+\'; - END LOOP; - vQuery := vQuery || chr(39); - END IF; - - -- finally get result - FOR vRecord IN EXECUTE \' - SELECT h.nodeid, - h.parentid, - h.paramrefid, - h.name::VARCHAR(150), - h.index, - h.leaf, - 1::int2, - h.value, - \\\'\\\'::text -- n.description - FROM VIChierarchy h - -- TODO: join depends on leaf; see getNode function - -- INNER JOIN VICnodedef n ON n.nodeID = h.paramrefID - WHERE h.treeID = \' || $1 || \' - AND h.name \' || vQuery || \' - ORDER BY h.leaf, h.name, h.index \' - LOOP - RETURN NEXT vRecord; - END LOOP; - RETURN; - END -' LANGUAGE plpgsql; - --- --- getVHitemList (treeID, namefragment) --- --- Get a list of items. --- --- Authorisation: none --- --- Tables: picparamref read --- pichierarchy read --- --- Types: OTDBnode --- -CREATE OR REPLACE FUNCTION getVHitemList(INT4, VARCHAR(120)) - RETURNS SETOF OTDBnode AS $$ - -- $Id$ - DECLARE - vRecord RECORD; - - BEGIN - FOR vRecord IN - SELECT h.nodeid, - h.parentid, - h.paramrefid, - h.name::VARCHAR(150), - h.index, - h.leaf, - 1::int2, - h.value, - ''::text -- n.description - FROM VIChierarchy h - -- TODO: join depends on leaf; see getNode function - -- INNER JOIN VICnodedef n ON n.nodeID = h.paramrefID - WHERE h.treeID = $1 - AND h.name LIKE $2 - ORDER BY h.leaf, h.name, h.index - LOOP - RETURN NEXT vRecord; - END LOOP; - RETURN; - END -$$ LANGUAGE plpgsql; - --- --- getVHitemListRegex (treeID, regexString) --- --- Get a list of items. --- --- Authorisation: none --- --- Tables: picparamref read --- pichierarchy read --- --- Types: OTDBnode --- -CREATE OR REPLACE FUNCTION getVHitemListRegex(INT4, VARCHAR(120)) - RETURNS SETOF OTDBnode AS $$ - -- $Id$ - DECLARE - vRecord RECORD; - - BEGIN - FOR vRecord IN - SELECT h.nodeid, - h.parentid, - h.paramrefid, - h.name::VARCHAR(150), - h.index, - h.leaf, - 1::int2, - h.value, - ''::text -- n.description - FROM VIChierarchy h - -- TODO: join depends on leaf; see getNode function - -- INNER JOIN VICnodedef n ON n.nodeID = h.paramrefID - WHERE h.treeID = $1 - AND h.name similar to ($2) - ORDER BY h.leaf, h.name, h.index - LOOP - RETURN NEXT vRecord; - END LOOP; - RETURN; - END -$$ LANGUAGE plpgsql; - diff --git a/dependencies/OTDB/sql/getVICnodeDef_func.sql b/dependencies/OTDB/sql/getVICnodeDef_func.sql deleted file mode 100644 index a825eaff05b448c77850768f00a1e9d42a887e67..0000000000000000000000000000000000000000 --- a/dependencies/OTDB/sql/getVICnodeDef_func.sql +++ /dev/null @@ -1,153 +0,0 @@ --- --- getVICnodedef.sql: function for getting one node from the VIC comp. table --- --- Copyright (C) 2005 --- ASTRON (Netherlands Foundation for Research in Astronomy) --- P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, softwaresupport@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$ --- - --- --- getVICnodedef (nodeID) --- --- Get one node definition on nodeID --- --- Authorisation: none --- --- Tables: vicnodedef read --- --- Types: OTDBnodeDef --- -CREATE OR REPLACE FUNCTION getVICnodedef(INT4) - RETURNS OTDBnodeDef AS ' - -- $Id$ - DECLARE - vRecord RECORD; - - BEGIN - SELECT nodeid, - name, - version, - classif, - constraints, - description - INTO vRecord - FROM VICnodeDef - WHERE nodeID = $1; - - IF NOT FOUND THEN - RAISE EXCEPTION \'Component % does not exist.\', $1; - END IF; - - RETURN vRecord; - END -' LANGUAGE plpgsql; - --- --- getVICnodedef (name, version, classif) --- --- Get one node definition on name,version and classif --- --- Authorisation: none --- --- Tables: vicnodedef read --- --- Types: OTDBnodeDef --- -CREATE OR REPLACE FUNCTION getVICnodedef(VARCHAR(150), INT4, INT2) - RETURNS OTDBnodeDef AS ' - -- $Id$ - DECLARE - vRecord RECORD; - - BEGIN - SELECT nodeid, - name, - version, - classif, - constraints, - description - INTO vRecord - FROM VICnodeDef - WHERE name = rtrim(translate($1, \'.\', \' \')) - AND version = $2 - AND classif = $3; - - IF NOT FOUND THEN - RAISE EXCEPTION \'Component %,%,% does not exist.\', $1, $2, $3; - END IF; - - RETURN vRecord; - END -' LANGUAGE plpgsql; - --- --- getVICnodedef (treeID, nodename, paramname) --- --- Get the param of the node. --- --- Authorisation: none --- --- Tables: vicnodedef read --- victemplate read --- --- Types: OTDBnodeDef --- -CREATE OR REPLACE FUNCTION getVICnodedef(INT4, VARCHAR(150), VARCHAR(150)) - RETURNS OTDBnode AS ' - -- $Id$ - DECLARE - vNodeID VICtemplate.nodeID%TYPE; - vRecord RECORD; - - BEGIN ---RAISE WARNING \'GVND:%,%,%\', $1, $2, $3; - SELECT nodeid - INTO vNodeID - FROM VICtemplate - WHERE treeID = $1 - AND name = $2; - - IF NOT FOUND THEN - RAISE EXCEPTION \'Component % does not exist in tree %.\', $2, $1; - END IF; - - SELECT t.nodeid, - t.parentid, - t.originid, - t.name::VARCHAR(150), - t.index, - t.leaf, - t.instances, - t.limits, - \'\'::text --- n.description -- TODO: join depends on t.leaf - INTO vRecord - FROM VICtemplate t --- INNER JOIN VICnodedef n on n.nodeID = t.originID - WHERE t.parentID = vNodeID - AND t.name = $3; - - IF NOT FOUND THEN - RAISE EXCEPTION \'Parameter % of component % does not exist.\', $3, $2; - END IF; - - RETURN vRecord; - END -' LANGUAGE plpgsql; - diff --git a/dependencies/OTDB/sql/getVICparamDef_func.sql b/dependencies/OTDB/sql/getVICparamDef_func.sql deleted file mode 100644 index 32f4ed51762c9190af8207f40c149d49f970d306..0000000000000000000000000000000000000000 --- a/dependencies/OTDB/sql/getVICparamDef_func.sql +++ /dev/null @@ -1,65 +0,0 @@ --- --- getVICParamDef.sql: function for getting parameterDefinition from the OTDB --- --- Copyright (C) 2005 --- ASTRON (Netherlands Foundation for Research in Astronomy) --- P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, softwaresupport@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$ --- - --- --- getParamDef (paramID) --- --- Get info of one parmeter --- --- Authorisation: none --- --- Tables: VICparamdef read --- --- Types: OTDBparamDef --- -CREATE OR REPLACE FUNCTION getVICParamDef(INT4) - RETURNS OTDBparamDef AS ' - -- $Id$ - DECLARE - vRecord RECORD; - - BEGIN - SELECT paramid, - nodeid, - name, - par_type, - unit, - pruning, - validmoment, - rtmod, - limits, - description - INTO vRecord - FROM VICparamdef - WHERE paramID = $1; - - IF NOT FOUND THEN - RAISE EXCEPTION \'Parameter % does not exist\', $1; - END IF; - - RETURN vRecord; - END -' LANGUAGE plpgsql; - - diff --git a/dependencies/OTDB/sql/getVTchildren_func.sql b/dependencies/OTDB/sql/getVTchildren_func.sql deleted file mode 100644 index 8fb5533d30302b42dd0163cf0a03502c659bac22..0000000000000000000000000000000000000000 --- a/dependencies/OTDB/sql/getVTchildren_func.sql +++ /dev/null @@ -1,67 +0,0 @@ --- --- getVTchildren.sql: function for getting some layers of a VIC template tree --- --- Copyright (C) 2005 --- ASTRON (Netherlands Foundation for Research in Astronomy) --- P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, softwaresupport@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$ --- - --- --- getVTchildren (treeID, nodeList) --- --- Get a list of items. --- --- Authorisation: none --- --- Tables: victemplate read --- --- Types: OTDBnode --- --- TODO: we should also use the index?? --- -CREATE OR REPLACE FUNCTION getVTChildren(INT4, TEXT) - RETURNS SETOF OTDBnode AS ' - -- $Id$ - DECLARE - vRecord RECORD; - - BEGIN - - -- get result - FOR vRecord IN EXECUTE \' - SELECT t.nodeid, - t.parentid, - t.originid, - t.name::VARCHAR(150), - t.index, - t.leaf, - t.instances, - t.limits, - \\\'\\\'::text - FROM VICtemplate t - WHERE t.treeID = \' || $1 || \' - AND t.parentID in (\' || $2 || \') - ORDER BY t.leaf, t.name, t.index \' - LOOP - RETURN NEXT vRecord; - END LOOP; - RETURN; - END -' LANGUAGE plpgsql; - diff --git a/dependencies/OTDB/sql/getVTitemList_func.sql b/dependencies/OTDB/sql/getVTitemList_func.sql deleted file mode 100644 index b72dea44d21187bd4ee0fd92a86f9b557a1876f5..0000000000000000000000000000000000000000 --- a/dependencies/OTDB/sql/getVTitemList_func.sql +++ /dev/null @@ -1,66 +0,0 @@ --- --- getVTitemList.sql: function for a list of nodes on a name fragment. --- --- Copyright (C) 2005 --- ASTRON (Netherlands Foundation for Research in Astronomy) --- P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, softwaresupport@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$ --- - --- --- getVTitemList (treeID, name fragment) --- --- Get a list of items based on a name fragment. --- --- Authorisation: none --- --- Tables: victemplate read --- --- Types: OTDBnode --- -CREATE OR REPLACE FUNCTION getVTitemList(INT4, VARCHAR(150)) - RETURNS SETOF OTDBnode AS ' - -- $Id$ - DECLARE - vRecord RECORD; - - BEGIN - FOR vRecord IN - SELECT t.nodeid, - t.parentid, - t.originid, - t.name::VARCHAR(150), - t.index, - t.leaf, - t.instances, - t.limits, - \'\'::text --- n.description -- TODO: join depends on t.leaf - FROM VICtemplate t --- INNER JOIN VICnodedef n on n.nodeID = t.originID - WHERE t.treeID = $1 - AND t.name LIKE $2 - ORDER BY t.leaf, t.name, t.index - LOOP - RETURN NEXT vRecord; - END LOOP; - - RETURN; - END -' LANGUAGE plpgsql; - diff --git a/dependencies/OTDB/sql/getVTitem_func.sql b/dependencies/OTDB/sql/getVTitem_func.sql deleted file mode 100644 index 0c130cacee9bef9cb26985bfe83c9c69cb2f84e7..0000000000000000000000000000000000000000 --- a/dependencies/OTDB/sql/getVTitem_func.sql +++ /dev/null @@ -1,129 +0,0 @@ --- --- getVTitem.sql: get a node on its full name --- --- Copyright (C) 2011 --- ASTRON (Netherlands Foundation for Research in Astronomy) --- P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, softwaresupport@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: getVTitemList_func.sql 9567 2006-11-01 09:11:34Z overeem $ --- - --- --- getVTitemRecursive (treeID, name, index, parentid) --- --- Get an item on its name. --- --- Authorisation: none --- --- Tables: victemplate read --- --- Types: OTDBnode --- -CREATE OR REPLACE FUNCTION getVTitemRecursive(INT4, VARCHAR(150), INT4) - RETURNS OTDBnode AS $$ - -- $Id: addComponentToVT_func.sql 19935 2012-01-25 09:06:14Z mol $ - DECLARE - vRecord RECORD; - vParentName VARCHAR(150); - vChildName VARCHAR(150); - aFullName ALIAS FOR $2; - aParentID ALIAS FOR $3; - vIndex VARCHAR(50); --- The database [March 2011] has parameters with index=1 and index=-1 --- that is due to a change in the code used to load the components --- As long as that is the case we have to work with 2 index values - vIndex2 VARCHAR(50); - - BEGIN - -- strip off first part of name and try if it has an index - vParentName := split_part(aFullName, '.', 1); - vIndex := substring(vParentName from E'.*\\[([0-9])\\]$'); - IF vIndex IS NULL THEN - vIndex := -1; - vIndex2 := 1; - ELSE - vIndex2 := vIndex; - vParentName := substring(vParentName from E'([^\\[]+)\\[.*'); - END IF; - -- remember the remainder of the name - vChildName := substring(aFullName from E'[^\\.]+\\.(.*)'); - - IF aParentID = 0 THEN - SELECT nodeid, - parentid, - originid, - name::VARCHAR(150), - index, - leaf, - instances, - limits, - ''::text - INTO vRecord - FROM VICtemplate - WHERE treeID = $1 - AND name = vParentName - AND (index::VARCHAR(50) = vIndex OR index::VARCHAR(50) = vIndex2) - ORDER BY index; - ELSE - SELECT nodeid, - parentid, - originid, - name::VARCHAR(150), - index, - leaf, - instances, - limits, - ''::text - INTO vRecord - FROM VICtemplate - WHERE treeID = $1 - AND name = vParentName - AND (index::VARCHAR(50) = vIndex OR index::VARCHAR(50) = vIndex2) - AND parentid = aParentID - ORDER BY index; - END IF; - - IF FOUND AND NOT vChildName IS NULL THEN - vRecord := getVTitemRecursive($1, vChildName, vRecord.nodeid); - END IF; - RETURN vRecord; - END; -$$ LANGUAGE plpgsql; - --- --- getVTitem (treeID, fullname) --- --- Get an items on its fullname. --- --- Authorisation: none --- --- Tables: victemplate read --- --- Types: OTDBnode --- -CREATE OR REPLACE FUNCTION getVTitem(INT4, VARCHAR(150)) - RETURNS OTDBnode AS $$ - -- $Id: addComponentToVT_func.sql 19935 2012-01-25 09:06:14Z mol $ - DECLARE - vRecord RECORD; - - BEGIN - vRecord := getVTitemRecursive($1, $2, 0); - RETURN vRecord; - END -$$ LANGUAGE plpgsql; - diff --git a/dependencies/OTDB/sql/hVICsearchParamID_func.sql b/dependencies/OTDB/sql/hVICsearchParamID_func.sql deleted file mode 100644 index eff4692d54f9e97a6021f1a283b1540b16c3498d..0000000000000000000000000000000000000000 --- a/dependencies/OTDB/sql/hVICsearchParamID_func.sql +++ /dev/null @@ -1,75 +0,0 @@ --- --- hVICsearchParamID.sql: search parameterID in hierarchical VICtree. --- --- Copyright (C) 2005 --- ASTRON (Netherlands Foundation for Research in Astronomy) --- P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, softwaresupport@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$ --- - --- --- hVICsearchParamID (paramname): paramID --- --- Tries to resolve a parametername like a.b.c.d to an entry in an --- hierarchical VIC tree. --- --- Authorisation: none --- --- Tables: VIChierarchy read --- --- Types: none --- -CREATE OR REPLACE FUNCTION hVICsearchParamID(VARCHAR(150)) - RETURNS INT4 AS ' - -- $Id$ - DECLARE - vDotPos INT4; - vFieldnr INT4; - vNodeID INT4; - vParentID INT4; - vNodename VARCHAR(150); - vKey VARCHAR(150); - - BEGIN - vKey := $1; - vFieldnr := 1; - vParentID := 0; - vNodeID := 0; - LOOP - vNodename := split_part(vKey, \'.\', vFieldnr); - EXIT WHEN length(vNodename) <= 0; - - -- TODO: this will not work for shared VIs (does not start at top) - SELECT nodeID - INTO vNodeID - FROM VIChierarchy - WHERE parentID = vParentID - AND name = vNodename; - IF NOT FOUND THEN - RETURN 0; - END IF; - - vFieldnr := vFieldnr + 1; - vParentID:= vNodeID; - END LOOP; - - RETURN vNodeID; - END; -' LANGUAGE plpgsql; - - diff --git a/dependencies/OTDB/sql/instanciateTree_func.sql b/dependencies/OTDB/sql/instanciateTree_func.sql deleted file mode 100644 index 1b96e0900e7c5f4fe083cb7c39f609a70af768d9..0000000000000000000000000000000000000000 --- a/dependencies/OTDB/sql/instanciateTree_func.sql +++ /dev/null @@ -1,448 +0,0 @@ --- --- instanciateTree.sql: create a full VIC tree from a template. --- --- Copyright (C) 2005 --- ASTRON (Netherlands Foundation for Research in Astronomy) --- P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, softwaresupport@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$ --- - --- --- helper function --- getTemplateOrigin(TreeID) --- --- Returns the oroginID of a template tree. When the templatetree is a --- default template it returns the treeID of the default template. --- --- Authorisation: none --- --- Tables: VICtemplate read --- --- Types: none --- -CREATE OR REPLACE FUNCTION getTemplateOrigin(INT4) - RETURNS INT4 AS ' - -- $Id$ - DECLARE - vTemplateID INT4; - vName OTDBtree.name%TYPE; - - BEGIN - -- get template tree - SELECT originID - INTO vTemplateID - FROM OTDBtree - WHERE treeID = $1; - - -- get info from origin of template - SELECT name - INTO vName - FROM OTDBtree - WHERE treeID = vTemplateID; - - -- if origin is a default template returns that treeID - IF vName IS NOT NULL THEN - RETURN vTemplateID; - END IF; - RETURN $1; - END; -' LANGUAGE plpgsql; - - --- --- helper function --- resolveVHparam(orgTreeID, paramreference) --- --- Recursively follow the limits reference until a 'leaf' is reached. --- --- Authorisation: none --- --- Tables: VICtemplate read --- --- Types: none --- -CREATE OR REPLACE FUNCTION resolveVHparam(INT4, TEXT) - RETURNS TEXT AS ' - -- $Id$ - DECLARE - vDotpos INTEGER; - vNodeName VARCHAR(200); - vParamName VARCHAR(200); - vRemainder VARCHAR(200); - vOrgArray VARCHAR(200); - vElem VARCHAR(150); - vAnswer TEXT; - vIsArray BOOLEAN; - vSize INTEGER; - vRecord RECORD; - - BEGIN ---RAISE WARNING \'resolve(%,%)\', $1, $2; - vDotpos := strpos($2, \'.\'); -- >>a.b.c or <<a - IF vDotpos < 1 THEN - RETURN $2; - END IF; - vNodeName := substr($2, 3, vDotpos-3); -- a - vParamName := substr($2, vDotpos+1); -- b.c - vDotpos := strpos(vParamName, \'.\'); - IF vDotpos > 0 THEN - vRemainder := substr(vParamName, vDotPos); -- .c - vParamName := substr(vParamName, 1, vDotPos-1); -- b - ELSE - vRemainder := \'\'; - END IF; - -- does paramname end in [] ? - IF rtrim(vParamName, \'[] \') != vParamName THEN - vIsArray := true; - vParamName := rtrim(vParamName, \'[] \'); - ELSE - vIsArray := false; - END IF; - - -- Get parameter definition from VICtemplate - SELECT * - INTO vRecord - FROM getVICNodeDef ($1, vNodeName, vParamName); - - IF NOT FOUND THEN - RAISE EXCEPTION \'Parameter % from Node % not found\', vNodeName, vParamName; - END IF; - - IF vIsArray THEN - IF vRemainder = \'\' THEN - -- calc size of array - RETURN calcArraySize(vRecord.limits); - ELSE - -- reference array - -- create an array with same size as current vRecord.limits array - -- while rereferencing the elements of the vRecord.limits array. - vAnswer := \'[\'; - vOrgArray := btrim(vRecord.limits, \'[] \'); - vSize := calcArraySize(vRecord.limits); - FOR i IN 1..vSize LOOP - -- get clean name of element - vElem := btrim(split_part(vOrgArray, \',\', i), \' \'); - -- make sure it begins with << - IF substr(vElem,1,2) != \'>>\' THEN - vElem := \'>>\' || vElem; - END IF; - -- resolve value - vElem := resolveVHparam($1, vElem || vRemainder); - -- add to array - vAnswer := vAnswer || vElem || \',\'; ---RAISE WARNING \'anwser=%\', vAnswer; - END LOOP; - -- finish array and return result. - vAnswer := rtrim(vAnswer, \',\') || \']\'; - RETURN vAnswer; - END IF; - ELSE - IF vRemainder = \'\' THEN - RETURN vRecord.limits; - ELSE - vRecord.limits := vRecord.limits || vRemainder; - RETURN resolveVHparam($1, vRecord.limits); - END IF; - END IF; - END; -' LANGUAGE plpgsql; - - --- --- helper function --- instanciateVHparams(orgNodeID, newTreeID, newNodeID, basename) --- --- Gives the newNodeID in the newTreeID the same parameters as the orgNode. --- Note: new node must already exist. --- --- Authorisation: none --- --- Tables: VICtemplate read --- VIChierarchy insert --- --- Types: none --- -CREATE OR REPLACE FUNCTION instanciateVHparams(INT4, INT4, INT4, TEXT) - RETURNS VOID AS ' - -- $Id$ - DECLARE - vParam RECORD; - - BEGIN - FOR vParam IN - SELECT treeID, originID, name, limits - FROM VICtemplate - WHERE parentID = $1 - AND leaf = TRUE - AND name NOT like \'\\\\%%\' - LOOP - IF isReference(vParam.limits) THEN - vParam.limits := resolveVHparam(vParam.treeID, vParam.limits); - END IF; - INSERT - INTO VIChierarchy(treeID, parentID, paramrefID, name, value) - VALUES ($2, $3, vParam.originID, $4 || vParam.name, vParam.limits); - -- note: nodeId, index and leaf are defaulted. - END LOOP; - RETURN; - END; -' LANGUAGE plpgsql; - --- --- helper function --- instanciateVHleafNode(orgNodeID, newTreeID, newParentID, index, basename):newNodeID --- --- Duplicates a complete VT node to the VH tree --- --- Authorisation: none --- --- Tables: VICtemplate read --- VIChierarchy insert --- --- Types: none --- -CREATE OR REPLACE FUNCTION instanciateVHleafNode(INT4, INT4, INT4, INT2, TEXT) - RETURNS INT4 AS ' - -- $Id$ - DECLARE - vNode RECORD; - vNewNodeID VICtemplate.nodeID%TYPE; - vTrimmedName TEXT; - vFullName TEXT; - - BEGIN - SELECT originID, name - INTO vNode - FROM VICtemplate - WHERE nodeID = $1; - IF NOT FOUND THEN - RAISE EXCEPTION \'node % with index -1 does not exist\', $1; - RETURN 0; - END IF; - - vNewNodeID := NEXTVAL(\'VIChierarchID\'); - IF $4 != -1 THEN - vNode.name := vNode.name || \'[\' || $4 || \']\'; - END IF; - - -- special case: this function was designed for creating VIC trees from template trees, - -- but is now also used by the scheduler forr adding NEW nodes to an existing VIC tree. - -- To make this possible we must NOT add the name of the original component to the given - -- name. For VIC tree creation this name always end in a DOT when the scheduler (ab)uses - -- this function the name does not end in a DOT. - vTrimmedName := rtrim($5, \'.\'); - IF vTrimmedName != $5 OR $5 = \'\' THEN - vFullName := $5 || vNode.name; - ELSE - vFullName := $5; - END IF; - -- RAISE WARNING \'iVHleaf(%,%)\', vFullName,$4; - - INSERT - INTO VIChierarchy(treeID, nodeID, parentID, - paramrefID, name, index, leaf) - VALUES ($2, vNewNodeID, $3, - vNode.originID, vFullName, $4, FALSE); - - PERFORM instanciateVHparams($1, $2, vNewNodeID, vFullName || \'.\'); - - RETURN vNewNodeID; - END; -' LANGUAGE plpgsql; - --- --- helper function --- instanciateVHsubTree(orgNodeID, newTreeID, newParentID, basename): newNodeID --- --- Duplicates a subtree starting at node orgNode to VH tree newTreeID --- under node newParentID. --- Recursive routine. --- --- Authorisation: none --- --- Tables: VICtemplate read --- VIChierarchy insert --- --- Types: none --- -CREATE OR REPLACE FUNCTION instanciateVHsubTree(INT4, INT4, INT4, TEXT) - RETURNS INT4 AS ' - -- $Id$ - DECLARE - vNode RECORD; - vVTnode RECORD; - vIndexCounter INT2; - vIndexNr INT2; - vNewNodeID VIChierarchy.nodeID%TYPE; - vNodeID VIChierarchy.nodeID%TYPE; - vDummy VIChierarchy.nodeID%TYPE; - vBasename VIChierarchy.name%TYPE; - vOwnname VIChierarchy.name%TYPE; - vSpecialisation BOOL; - - BEGIN ---RAISE WARNING \'iVHst(%,%,%,%)\', $1,$2,$3,$4; - -- Append dot to basename if not topnode - vBasename := $4; - IF length(vBasename) != 0 THEN - vBasename := vBasename || \'.\'; - END IF; - - -- get orgnode (master record: index = -1) - SELECT parentID, name, instances - INTO vNode - FROM VICtemplate - WHERE nodeID = $1; ---RAISE WARNING \'%:[%]\', vNode.name, vNode.instances; - - -- loop through nr of instances - -- check each instance if is was specialized. - FOR vIndexCounter IN 0 .. vNode.instances-1 LOOP - SELECT nodeID - INTO vNodeID - FROM VICtemplate - WHERE parentID = vNode.parentID - AND name = vNode.name - AND index = vIndexCounter; - IF NOT FOUND THEN - -- no specialisation, use master node (index=-1) - vNodeID := $1; - vSpecialisation := FALSE; - ELSE - vSpecialisation := TRUE; - END IF; - - -- if there is only 1 instance tell VHleafnode this with index = -1 - IF vNode.instances = 1 AND vSpecialisation = FALSE THEN - vIndexnr := -1; - vOwnname := vBasename || vNode.name; - ELSE - vIndexnr := vIndexCounter; - vOwnname := vBasename || vNode.name || \'[\' || vIndexCounter || \']\'; - END IF; - - -- instanciate node itself - vNewNodeID := instanciateVHleafNode(vNodeID, $2, $3, vIndexnr::int2, vBasename); - - -- dive into the childen - FOR vVTnode IN - SELECT nodeID, name - FROM VICtemplate - WHERE parentID = vNodeID - AND index = -1 - AND leaf = FALSE - LOOP - vDummy := instanciateVHsubTree(vVTnode.nodeID, $2, vNewNodeID, vOwnname); - END LOOP; - END LOOP; - - RETURN vNewNodeID; - END; -' LANGUAGE plpgsql; - - --- --- instanciateVHtree (authToken, treeID):newTreeID --- --- Creates a full VH tree from the given folded VT tree. --- --- Authorisation: yes --- --- Tables: VICtemplate read --- VIChierarchy insert --- OTDBtree insert --- --- Types: none --- -CREATE OR REPLACE FUNCTION instanciateVHtree(INT4, INT4) - RETURNS INT4 AS $$ - -- $Id$ - DECLARE - vFunction CONSTANT INT2 := 1; - TTVHtree CONSTANT INT2 := 30; - vIsAuth BOOLEAN; - vResult BOOLEAN; - vClassif OTDBtree.classif%TYPE; - vCampaign OTDBtree.campaign%TYPE; - vMomID OTDBtree.momID%TYPE; - vState OTDBtree.state%TYPE; - vDesc OTDBtree.description%TYPE; - vVTnode RECORD; - vOrgNodeID VICtemplate.nodeID%TYPE; - vNewNodeID VICtemplate.nodeID%TYPE; - vNewTreeID OTDBtree.treeID%TYPE; - vOriginID OTDBtree.treeID%TYPE; - vGroupID OTDBtree.groupID%TYPE; - vAuthToken ALIAS FOR $1; - - BEGIN - -- check authorisation(authToken, treeID, func, dummy) - vIsAuth := FALSE; - SELECT isAuthorized(vAuthToken, $2, vFunction, 0) - INTO vIsAuth; - IF NOT vIsAuth THEN - RAISE EXCEPTION 'Not authorized'; - END IF; - - -- get some info about the original tree - SELECT momId, classif, campaign, state, description, groupID - INTO vMomID, vClassif, vCampaign, vState, vDesc, vGroupID - FROM OTDBtree - WHERE treeID = $2; - -- note: tree exists, checked in authorisation check - - -- get ID of template tree if it exists - SELECT getTemplateOrigin($2) - INTO vOriginID; - - -- create a new tree --- SELECT newTree($1, $2, vMomID, vClassif, TTVHtree, vState, vCampaign) - SELECT newTree($1, vOriginID, vMomID, vClassif, TTVHtree, vState, vCampaign) - INTO vNewTreeID; - IF vNewTreeID = 0 THEN - RAISE EXCEPTION 'Tree can not be created'; - END IF; - - SELECT setDescription($1, vNewTreeID, vDesc) - INTO vResult; - -- ignore result, not important. - - -- copy groupid. - UPDATE OTDBtree set groupid = vGroupID where treeID = vNewTreeID; - - -- get topNode - SELECT nodeID - INTO vOrgNodeID - FROM VICtemplate - WHERE treeID = $2 - AND parentID = 0; - IF NOT FOUND THEN - RAISE EXCEPTION 'Topnode of tree % unknown; tree empty?', $2; - END IF; - - -- recursively instanciate the tree - vNewNodeID := instanciateVHsubTree(vOrgNodeID, vNewTreeID, 0, ''::text); - - SELECT copyProcessType($2, vNewTreeID) - INTO vResult; - -- ignore result, not important. - - RETURN vNewTreeID; - END; -$$ LANGUAGE plpgsql; - diff --git a/dependencies/OTDB/sql/isTopComponent_func.sql b/dependencies/OTDB/sql/isTopComponent_func.sql deleted file mode 100644 index 98e285f9a0bd3a322d7b3086597527699450196e..0000000000000000000000000000000000000000 --- a/dependencies/OTDB/sql/isTopComponent_func.sql +++ /dev/null @@ -1,57 +0,0 @@ --- --- isTopComponent.sql: gets the topnode of the tree --- --- Copyright (C) 2005 --- ASTRON (Netherlands Foundation for Research in Astronomy) --- P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, softwaresupport@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$ --- - --- --- isTopComponent (componentID): bool --- --- returns if a component is a topcomponent. --- --- Authorisation: no --- --- Tables: VICnodedef read --- --- Types: none --- -CREATE OR REPLACE FUNCTION isTopComponent(INT) - RETURNS BOOLEAN AS ' - -- $Id$ - DECLARE - vNodeID VICnodeDEF.nodeID%TYPE; - - BEGIN - -- do selection - SELECT nodeID - INTO vNodeID - FROM VICnodedef - WHERE nodeID = $1 - EXCEPT SELECT n.nodeID FROM VICnodeDEF n, VICparamDef p - WHERE cleanNodeName(p.name) = n.name; - IF FOUND THEN - RETURN TRUE; - END IF; - - RETURN FALSE; - END; -' LANGUAGE plpgsql; - diff --git a/dependencies/OTDB/sql/misc_func.sql b/dependencies/OTDB/sql/misc_func.sql deleted file mode 100644 index 9327c931293bec18433fb964400a83459f83f807..0000000000000000000000000000000000000000 --- a/dependencies/OTDB/sql/misc_func.sql +++ /dev/null @@ -1,279 +0,0 @@ --- --- misc_func.sql: miscelaneous functions. --- --- Copyright (C) 2005 --- ASTRON (Netherlands Foundation for Research in Astronomy) --- P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, softwaresupport@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$ --- - --- --- isAuthorized (authToken, treeID, function, value) --- --- checks if the function may be executed with the given value. --- --- Authorisation: n/a --- --- Tables: otdbuser read --- --- Types: none --- -CREATE OR REPLACE FUNCTION isAuthorized(INT4, INT4, INT2, INT4) - RETURNS BOOLEAN AS $$ - -- $Id$ - DECLARE - vTreeType OTDBtree.treetype%TYPE; - vState OTDBtree.state%TYPE; - vCallerID INT2 := 0; - - BEGIN - -- get treetype and owner for authorisation - IF $2 != 0 THEN - SELECT treetype, state - INTO vTreeType, vState - FROM OTDBtree - WHERE treeID = $2; - IF NOT FOUND THEN - RAISE EXCEPTION 'Tree % does not exist!', $2; - RETURN FALSE; - END IF; - END IF; - - -- Resolve creator and check it. - SELECT whoIs($1) - INTO vCallerID; - IF NOT FOUND OR vCallerID = 0 THEN - RAISE EXCEPTION 'Illegal authorisation token'; - RETURN FALSE; - END IF; - - -- TODO: search auth tables - -- SELECT .. vCallerID, vTreeType, $3, $4 - - RETURN TRUE; -- for now everthing is allowed - END; -$$ LANGUAGE plpgsql; - - --- --- whoIs (authToken) --- --- Returns the userID based on the Auth Token. --- --- Authorisation: n/a --- --- Tables: otdbuser read --- --- Types: none --- -CREATE OR REPLACE FUNCTION whoIs(INT4) - RETURNS INT4 AS ' - -- $Id$ - BEGIN - RETURN 1; -- for now return userid 1 - END; -' LANGUAGE plpgsql; - - --- --- VersionNrString (versionnr) --- --- Returns a string being the formatted versionnr --- --- Authorisation: n/a --- --- Tables: none --- --- Types: none --- -CREATE OR REPLACE FUNCTION VersionNrString(INT4) - RETURNS VARCHAR(20) AS $$ - -- $Id$ - BEGIN - RETURN $1/10000 || '.' || ($1/100)%100 || '.' || $1%100; - END; -$$ LANGUAGE plpgsql IMMUTABLE; - --- --- VersionNrValue(versionnr_string) --- --- Returns the integer value of the versionnumberstring --- --- Authorisation: n/a --- --- Tables: none --- --- Types: none --- -CREATE OR REPLACE FUNCTION VersionNrValue(VARCHAR(50)) - RETURNS INT4 AS $$ - -- $Id$ - DECLARE - vRelease INT4; - vUpdate INT4; - vPatch INT4; - - BEGIN - vRelease := substring($1 from E'([0-9]+)\.[0-9]+\.[0-9]+'); - vUpdate := substring($1 from E'[0-9]+\.([0-9]+)\.[0-9]+'); - vPatch := substring($1 from E'[0-9]+\.[0-9]+\.([0-9]+)'); - - RETURN vRelease * 10000 + (vUpdate%100)*100 + vPatch%100; - END; -$$ LANGUAGE plpgsql IMMUTABLE; - --- --- getVersionNr (nodename) --- --- Returns a string being the formatted versionnr --- --- Authorisation: n/a --- --- Tables: none --- --- Types: none --- -CREATE OR REPLACE FUNCTION getVersionNr(VARCHAR(150)) - RETURNS INT4 AS $$ - -- $Id$ - BEGIN - RETURN VersionNrValue(substring($1 from '%{#"%#"}' for '#')); - END; -$$ LANGUAGE plpgsql IMMUTABLE; - --- --- childNodeName (name, versionnr) --- --- Returns the child node name: --- # is added of at begin and versionnr is appended --- --- Authorisation: n/a --- --- Tables: none --- --- Types: none --- -CREATE OR REPLACE FUNCTION childNodeName(VARCHAR(150), INT4) - RETURNS VARCHAR(150) AS $$ - -- $Id$ - BEGIN - RETURN '#' || $1 || '{' || VersionNrString($2) || '}'; - END; -$$ LANGUAGE plpgsql IMMUTABLE; - --- --- cleanNodeName (name) --- --- Returns the basic node name: --- # is stripped of at begin and trailing {xx} is removed. --- --- Authorisation: n/a --- --- Tables: none --- --- Types: none --- -CREATE OR REPLACE FUNCTION cleanNodeName(VARCHAR(150)) - RETURNS TEXT AS $$ - -- $Id$ - BEGIN - IF substr($1, length($1)) = '}' THEN - RETURN ltrim(substr($1, 1, strpos($1,'{')-1), '#'); - ELSE - RETURN ltrim($1,'#'); - END IF; - END; -$$ LANGUAGE plpgsql IMMUTABLE; - - --- --- strippedNodeName (name) --- --- Returns the basic node name without its namespace: --- # is stripped of at begin and trailing {xx} is removed. --- --- Authorisation: n/a --- --- Tables: none --- --- Types: none --- -CREATE OR REPLACE FUNCTION strippedNodeName(VARCHAR(150)) - RETURNS TEXT AS $$ - -- $Id$ - DECLARE - vColonPos INT; - vName VARCHAR(150); - BEGIN - vName := cleanNodeName($1); - vColonPos := position(':' in vName); - IF vColonPos > 0 THEN - RETURN(substr(vName,vColonPos+1)); - ELSE - RETURN(vName); - END IF; - END; -$$ LANGUAGE plpgsql IMMUTABLE; - - --- --- isReference (name) --- --- Authorisation: n/a --- --- Tables: none --- --- Types: none --- -CREATE OR REPLACE FUNCTION isReference(TEXT) - RETURNS BOOLEAN AS $$ - -- $Id$ - BEGIN - RETURN substr($1, 1, 2) = '>>'; - END; -$$ LANGUAGE plpgsql IMMUTABLE; - --- --- calcArraySize (arraystring) --- --- Authorisation: n/a --- --- Tables: none --- --- Types: none --- -CREATE OR REPLACE FUNCTION calcArraySize(TEXT) - RETURNS TEXT AS $$ - -- $Id$ - DECLARE - vSize INTEGER; - vArray TEXT; - - BEGIN - vArray := ltrim($1,'[ '); - vArray := rtrim(vArray,'] '); - vSize := 0; - WHILE length(vArray) > 0 LOOP - -- remove element - vArray := ltrim(vArray, 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_ "[]{}+%<>.'); - vSize := vSize + 1; -- count element - vArray := ltrim(vArray, ','); -- strip comma - END LOOP; - RETURN vSize; - END; -$$ LANGUAGE plpgsql IMMUTABLE; diff --git a/dependencies/OTDB/sql/newTree_func.sql b/dependencies/OTDB/sql/newTree_func.sql deleted file mode 100644 index 34cb74e94f230bb6b2162ded13d2f9382d32712e..0000000000000000000000000000000000000000 --- a/dependencies/OTDB/sql/newTree_func.sql +++ /dev/null @@ -1,88 +0,0 @@ --- --- newTree.sql: function for creating a new entry in the OTDBtree table. --- --- Copyright (C) 2005 --- ASTRON (Netherlands Foundation for Research in Astronomy) --- P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, softwaresupport@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$ --- - --- --- newTree (authToken, orgTree, momID, classif, treetype, state, campaign) --- --- Creates a new tree record and returns the treeID of this new tree. --- --- Authorisation: yes --- --- Tables: otdbtree insert --- --- Types: none --- -CREATE OR REPLACE FUNCTION newTree(INT4, INT4, INT4, INT2, INT2, INT2, INT4) - RETURNS INT4 AS ' - -- $Id$ - DECLARE - vFunction INT2 := 1; - vNewTreeID OTDBtree.treeID%TYPE; - vCreatorID OTDBtree.creator%TYPE; - vIsAuth BOOLEAN; - vAuthToken ALIAS FOR $1; - - BEGIN - -- check authorisation(authToken, treeID, func, treetype) - vIsAuth := FALSE; - SELECT isAuthorized(vAuthToken, $2, vFunction, $5::int4) - INTO vIsAuth; - IF NOT vIsAuth THEN - RETURN 0; - END IF; - - -- authorized. Resolve creator - SELECT whoIs(vAuthToken) - INTO vCreatorID; - - -- Finally create tree entry - vNewTreeID := nextval(\'OTDBtreeID\'); - INSERT INTO OTDBtree (treeID, - originid, - momID, - classif, - treetype, - state, - creator, - campaign, - owner) - VALUES (vNewTreeID, - $2, -- orgTree - $3, -- momID - $4, -- classif - $5, -- treeType - $6, -- state - vCreatorID, - $7, -- campaign - vCreatorID); - - IF NOT FOUND THEN - RETURN 0; - ELSE - PERFORM addTreeState(vNewTreeID, $3, $6, vCreatorID, \'\'); - RETURN vNewTreeID; - END IF; - END; -' LANGUAGE plpgsql; - diff --git a/dependencies/OTDB/sql/saveSchedulerInfo_func.sql b/dependencies/OTDB/sql/saveSchedulerInfo_func.sql deleted file mode 100644 index 8fbd82dc047dbf5d90b0e60cc28d375af3f123e8..0000000000000000000000000000000000000000 --- a/dependencies/OTDB/sql/saveSchedulerInfo_func.sql +++ /dev/null @@ -1,136 +0,0 @@ --- --- saveSchedulerInfo.sql: function updating a Node of a VIC template tree --- --- Copyright (C) 2010 --- ASTRON (Netherlands Foundation for Research in Astronomy) --- P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, softwaresupport@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: updateVTnode_func.sql 9104 2006-08-16 11:43:02Z overeem $ --- - --- --- saveSchedulerInfo (authToken, treeID, nodeID, instances, limits) --- --- Saves the new values to the database --- --- Authorisation: yes --- --- Tables: OTDBtree read --- VIChierarchy update --- --- Types: none --- -CREATE OR REPLACE FUNCTION saveSchedulerInfo(INT4, INT4, TEXT, TEXT, TEXT, TEXT, TEXT, TEXT, TEXT, TEXT, TEXT, TEXT, TEXT, TEXT, TEXT, TEXT, TEXT, TEXT, TEXT, TEXT, TEXT, TEXT, TEXT, TEXT, TEXT) - RETURNS BOOLEAN AS $$ - -- $Id: addComponentToVT_func.sql 19935 2012-01-25 09:06:14Z mol $ - DECLARE - TThierarchy CONSTANT INT2 := 30; - vFunction CONSTANT INT2 := 1; - vTreeType OTDBtree.treetype%TYPE; - vIsAuth BOOLEAN; - vAuthToken ALIAS FOR $1; - vLimits TEXT; - vRecord RECORD; - vCounter INT4; - vQuery TEXT; - fieldList CURSOR FOR - SELECT nodeId,limits FROM getvhitemlist($2, '%Observation.Scheduler.%') ORDER BY name ASC; - - BEGIN - -- check authorisation(authToken, tree, func, parameter) - vIsAuth := FALSE; - SELECT isAuthorized(vAuthToken, $2, vFunction, 0) - INTO vIsAuth; - IF NOT vIsAuth THEN - RAISE EXCEPTION 'Not authorized'; - RETURN FALSE; - END IF; - - -- get treetype - SELECT treetype - INTO vTreeType - FROM OTDBtree - WHERE treeID = $2; - IF NOT FOUND THEN - RAISE EXCEPTION 'Tree % does not exist', $1; - END IF; - - IF NOT vTreeType = TThierarchy THEN - RAISE EXCEPTION 'Tree % is not a VIC tree', $2; - END IF; - - -- Authorisation is checked, tree is checked, do the work. - - OPEN fieldList; - FETCH fieldList INTO vRecord; - UPDATE VIChierarchy SET value=$3 WHERE treeID=$2 AND nodeID=vRecord.nodeID; - FETCH fieldList INTO vRecord; - UPDATE VIChierarchy SET value=$4 WHERE treeID=$2 AND nodeID=vRecord.nodeID; - FETCH fieldList INTO vRecord; - UPDATE VIChierarchy SET value=$5 WHERE treeID=$2 AND nodeID=vRecord.nodeID; - FETCH fieldList INTO vRecord; - UPDATE VIChierarchy SET value=$6 WHERE treeID=$2 AND nodeID=vRecord.nodeID; - FETCH fieldList INTO vRecord; - UPDATE VIChierarchy SET value=$7 WHERE treeID=$2 AND nodeID=vRecord.nodeID; - FETCH fieldList INTO vRecord; - UPDATE VIChierarchy SET value=$8 WHERE treeID=$2 AND nodeID=vRecord.nodeID; - FETCH fieldList INTO vRecord; - UPDATE VIChierarchy SET value=$9 WHERE treeID=$2 AND nodeID=vRecord.nodeID; - FETCH fieldList INTO vRecord; - UPDATE VIChierarchy SET value=$10 WHERE treeID=$2 AND nodeID=vRecord.nodeID; - FETCH fieldList INTO vRecord; - UPDATE VIChierarchy SET value=$11 WHERE treeID=$2 AND nodeID=vRecord.nodeID; - FETCH fieldList INTO vRecord; - UPDATE VIChierarchy SET value=$12 WHERE treeID=$2 AND nodeID=vRecord.nodeID; - FETCH fieldList INTO vRecord; - UPDATE VIChierarchy SET value=$13 WHERE treeID=$2 AND nodeID=vRecord.nodeID; - FETCH fieldList INTO vRecord; - UPDATE VIChierarchy SET value=$14 WHERE treeID=$2 AND nodeID=vRecord.nodeID; - FETCH fieldList INTO vRecord; - UPDATE VIChierarchy SET value=$15 WHERE treeID=$2 AND nodeID=vRecord.nodeID; - FETCH fieldList INTO vRecord; - UPDATE VIChierarchy SET value=$16 WHERE treeID=$2 AND nodeID=vRecord.nodeID; - FETCH fieldList INTO vRecord; - UPDATE VIChierarchy SET value=$17 WHERE treeID=$2 AND nodeID=vRecord.nodeID; - FETCH fieldList INTO vRecord; - UPDATE VIChierarchy SET value=$18 WHERE treeID=$2 AND nodeID=vRecord.nodeID; - FETCH fieldList INTO vRecord; - UPDATE VIChierarchy SET value=$19 WHERE treeID=$2 AND nodeID=vRecord.nodeID; - FETCH fieldList INTO vRecord; - UPDATE VIChierarchy SET value=$20 WHERE treeID=$2 AND nodeID=vRecord.nodeID; - FETCH fieldList INTO vRecord; - UPDATE VIChierarchy SET value=$21 WHERE treeID=$2 AND nodeID=vRecord.nodeID; - FETCH fieldList INTO vRecord; - UPDATE VIChierarchy SET value=$22 WHERE treeID=$2 AND nodeID=vRecord.nodeID; - FETCH fieldList INTO vRecord; - UPDATE VIChierarchy SET value=$23 WHERE treeID=$2 AND nodeID=vRecord.nodeID; - FETCH fieldList INTO vRecord; - UPDATE VIChierarchy SET value=$24 WHERE treeID=$2 AND nodeID=vRecord.nodeID; - FETCH fieldList INTO vRecord; - UPDATE VIChierarchy SET value=$25 WHERE treeID=$2 AND nodeID=vRecord.nodeID; --- FETCH fieldList INTO vRecord; --- UPDATE VIChierarchy SET value=$26 WHERE treeID=$2 AND nodeID=vRecord.nodeID; --- FETCH fieldList INTO vRecord; --- UPDATE VIChierarchy SET value=$27 WHERE treeID=$2 AND nodeID=vRecord.nodeID; --- FETCH fieldList INTO vRecord; --- UPDATE VIChierarchy SET value=$26 WHERE treeID=$2 AND nodeID=vRecord.nodeID; --- FETCH fieldList INTO vRecord; --- UPDATE VIChierarchy SET value=$27 WHERE treeID=$2 AND nodeID=vRecord.nodeID; - RETURN TRUE; - END; -$$ LANGUAGE plpgsql; - diff --git a/dependencies/OTDB/sql/saveVCnode_func.sql b/dependencies/OTDB/sql/saveVCnode_func.sql deleted file mode 100644 index 730c6c0fb4c67e30f9d1a3e6db2c59ec22109af3..0000000000000000000000000000000000000000 --- a/dependencies/OTDB/sql/saveVCnode_func.sql +++ /dev/null @@ -1,92 +0,0 @@ --- --- saveVCnode.sql: function saving a node in the VC table --- --- Copyright (C) 2005 --- ASTRON (Netherlands Foundation for Research in Astronomy) --- P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, softwaresupport@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$ --- - --- --- saveVCnode (authToken, nodeID, name, version, --- classif, constraints, description) --- --- Saves the new values to the database --- --- Authorisation: yes --- --- Tables: VICnodeDef insert/update --- --- Types: none --- -CREATE OR REPLACE FUNCTION saveVCnode(INT4, INT4, VARCHAR(150), INT4, - INT2, TEXT, TEXT) - RETURNS INT4 AS $$ - -- $Id$ - DECLARE - vNodeID VICnodedef.nodeID%TYPE; - vName VICnodedef.name%TYPE; - vFunction INT2 := 1; - vIsAuth BOOLEAN; - vAuthToken ALIAS FOR $1; - vConstraints TEXT; - vDescription TEXT; - - BEGIN - -- check authorisation(authToken, tree, func, parameter) - vIsAuth := FALSE; - SELECT isAuthorized(vAuthToken, 0, vFunction, 0) - INTO vIsAuth; - IF NOT vIsAuth THEN - RAISE EXCEPTION 'Not authorized'; - RETURN FALSE; - END IF; - - vName := rtrim(translate($3, '.', ' ')); -- replace dot w space - vConstraints := replace($6, '\'', ''); -- remove single quotes - vDescription := replace($7, '\'', ''); - - -- check if node exists - SELECT nodeID - INTO vNodeID - FROM VICnodedef - WHERE name = $3 - AND version = $4 - AND classif = $5; - IF NOT FOUND THEN - vNodeID := nextval('VICnodedefID'); - -- create new node - INSERT INTO VICnodedef - VALUES (vNodeID, vName, $4, $5, vConstraints, vDescription); - ELSE - -- update node - UPDATE VICnodedef - SET constraints = vConstraints, - description = vDescription - WHERE nodeID = vNodeID; - END IF; - - IF NOT FOUND THEN - RAISE EXCEPTION 'Node % could not be saved', $4; - RETURN 0; - END IF; - - RETURN vNodeID; - END; -$$ LANGUAGE plpgsql; - diff --git a/dependencies/OTDB/sql/saveVICparamDef_func.sql b/dependencies/OTDB/sql/saveVICparamDef_func.sql deleted file mode 100644 index 3484860b3745fd329f74e571d8d347e07f2233df..0000000000000000000000000000000000000000 --- a/dependencies/OTDB/sql/saveVICparamDef_func.sql +++ /dev/null @@ -1,103 +0,0 @@ --- --- saveVICparamDef.sql: function saving a node in the VC table --- --- Copyright (C) 2005 --- ASTRON (Netherlands Foundation for Research in Astronomy) --- P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, softwaresupport@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$ --- - --- --- saveVICparamDef (authToken, nodeID, name, type, unit, pruning, --- valMoment, rtMod, limits, description) --- --- Saves the new values to the database --- --- Authorisation: yes --- --- Tables: VICparamDef insert/update --- --- Types: none --- -CREATE OR REPLACE FUNCTION saveVICparamDef(INT4, INT4, VARCHAR(150), INT2, - INT2, INT2, INT2, BOOLEAN, TEXT, TEXT) - RETURNS INT4 AS ' - -- $Id$ - DECLARE - vParamID VICparamDef.paramID%TYPE; - vName VICparamDef.name%TYPE; - vVersionNr VICNodeDef.version%TYPE; - vFunction INT2 := 1; - vIsAuth BOOLEAN; - vAuthToken ALIAS FOR $1; - vLimits TEXT; - vDescription TEXT; - - BEGIN - -- check authorisation(authToken, tree, func, parameter) - vIsAuth := FALSE; - SELECT isAuthorized(vAuthToken, 0, vFunction, 0) - INTO vIsAuth; - IF NOT vIsAuth THEN - RAISE EXCEPTION \'Not authorized\'; - RETURN FALSE; - END IF; - - -- assure clean input. - if substr($3,1,1) = \'#\' THEN - vVersionNr := getVersionNr($3); - vName := childNodeName(translate(cleanNodeName($3), \'.\', \' \'), vVersionNr); - ELSE - vName := rtrim(translate($3, \'.\', \' \')); - END IF; - vLimits := replace($9, \'\\\'\', \'\'); - vDescription := replace($10, \'\\\'\', \'\'); - - -- check if node exists - SELECT paramID - INTO vParamID - FROM VICparamDef - WHERE name = vName - AND nodeID = $2; - IF NOT FOUND THEN - vParamID := nextval(\'VICparamdefID\'); - -- create new param - INSERT INTO VICparamdef - VALUES (vParamID, $2, vName, $4, $5, $6, $7, $8, vLimits, vDescription); - ELSE - -- update param - UPDATE VICparamdef - SET par_type = $4, - unit = $5, - pruning = $6, - validmoment = $7, - RTmod = $8, - limits = vLimits, - description = vDescription - WHERE paramID = vParamID; - END IF; - - IF NOT FOUND THEN - RAISE EXCEPTION \'Parameter % could not be saved\', $3; - RETURN 0; - END IF; - - RETURN vParamID; - END; -' LANGUAGE plpgsql; - diff --git a/dependencies/OTDB/sql/searchPICinPeriod_func.sql b/dependencies/OTDB/sql/searchPICinPeriod_func.sql deleted file mode 100644 index 5862c655352e2bdeb2d4c152f4985c53692c4c5d..0000000000000000000000000000000000000000 --- a/dependencies/OTDB/sql/searchPICinPeriod_func.sql +++ /dev/null @@ -1,97 +0,0 @@ --- --- searchPICinPeriod.sql: Search values of subtrees witihn a period --- --- Copyright (C) 2005 --- ASTRON (Netherlands Foundation for Research in Astronomy) --- P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, softwaresupport@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$ --- - --- --- searchPICinPeriod (treeID, topNode, depth, begindate, enddate) --- --- Get a list of values. --- --- Authorisation: none --- --- Tables: otdbtree read --- pichierarchy read --- --- Types: OTDBvalue --- -CREATE OR REPLACE FUNCTION searchPICinPeriod(INT4, INT4, INT4, TIMESTAMP, TIMESTAMP) - RETURNS SETOF OTDBvalue AS ' - -- $Id$ - DECLARE - vRecord RECORD; - vFullname VARCHAR(150); - vNodename VARCHAR(150); - vLeaf PIChierarchy.leaf%TYPE; - vParamRefID PIChierarchy.paramRefID%TYPE; - vQuery TEXT; - - BEGIN - -- Is topNode a node or a parameter? - SELECT leaf, paramRefID, name - INTO vLeaf, vParamRefID, vFullname - FROM PIChierarchy - WHERE nodeID = $2; - - -- TEMP SQUIRM FOR CDR 2005-10-12 - vFullname := ltrim (vFullname, \'.\'); - -- END OF SQUIRM - - IF vLeaf = TRUE AND $3 = 0 THEN - vQuery := \'=\' || chr(39) || vFullname || chr(39); - ELSE - -- construct query - vQuery := \'similar to \' || chr(39) || vFullname; - FOR i in 1..$3 LOOP - vQuery := vQuery || \'.[^\\\\\\\\.]+\'; - END LOOP; - vQuery := vQuery || chr(39); - END IF; - - -- append query with one or two time limits - IF $5 IS NULL - THEN - vQuery := vQuery || \' AND k.time > \' || chr(39) || $4 || chr(39); - ELSE - vQuery := vQuery || \' AND k.time BETWEEN \' - || chr(39) || $4 || chr(39) - || \' AND \' || chr(39) || $5 || chr(39); - END IF; - - -- get record in paramref table - FOR vRecord IN EXECUTE \' - SELECT k.paramid, - r.pvssname, - k.value, - k.time - FROM PICparamref r - INNER JOIN PICkvt k ON r.paramid = k.paramid - WHERE r.pvssname \' || vQuery || \' - ORDER BY k.paramid, k.time\' - LOOP - RETURN NEXT vRecord; - END LOOP; - RETURN; - END -' LANGUAGE plpgsql; - - diff --git a/dependencies/OTDB/sql/searchVHinPeriod_func.sql b/dependencies/OTDB/sql/searchVHinPeriod_func.sql deleted file mode 100644 index fddde3c9a5b5635d2b782f432087a42c685b49ee..0000000000000000000000000000000000000000 --- a/dependencies/OTDB/sql/searchVHinPeriod_func.sql +++ /dev/null @@ -1,102 +0,0 @@ --- --- searchInPeriod.sql: Search values of subtrees witihn a period --- --- Copyright (C) 2005 --- ASTRON (Netherlands Foundation for Research in Astronomy) --- P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, softwaresupport@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$ --- - --- --- searchInPeriod (treeID, topNode, depth, begindate, enddate) --- --- Get a list of values. --- --- Authorisation: none --- --- Tables: otdbtree read --- vichierarchy read --- --- Types: OTDBvalue --- -CREATE OR REPLACE FUNCTION searchVHinPeriod(INT4, INT4, INT4, TIMESTAMP, TIMESTAMP) - RETURNS SETOF OTDBvalue AS ' - -- $Id$ - DECLARE - vRecord RECORD; - vFullname VARCHAR(150); - vNodename VARCHAR(150); - vLeaf VIChierarchy.leaf%TYPE; - vParamRefID VIChierarchy.paramRefID%TYPE; - vQuery TEXT; - - BEGIN ---RAISE WARNING \'searchVH:%,%,%,%,%\', $1, $2, $3, $4, $5; - -- Is topNode a node or a parameter? - SELECT leaf, paramRefID, name - INTO vLeaf, vParamRefID, vFullname - FROM VIChierarchy - WHERE nodeID = $2 - AND treeID = $1; - - IF NOT FOUND THEN - RAISE EXCEPTION \'Parameter % not found in tree %\', $2, $1; - END IF; - - IF vLeaf = TRUE AND $3 = 0 THEN - vQuery := \'=\' || chr(39) || vFullname || chr(39); - ELSE - -- construct query - vFullname = replace(vFullname, \'[\', \'\\\\\\\\[\'); - vFullname = replace(vFullname, \']\', \'\\\\\\\\]\'); - vQuery := \'similar to \' || chr(39) || vFullname; - FOR i in 1..$3 LOOP - vQuery := vQuery || \'.[^\\\\\\\\.]+\'; - END LOOP; - vQuery := vQuery || chr(39); - END IF; - - -- append query with one or two time limits - IF $5 IS NULL - THEN - vQuery := vQuery || \' AND k.time > \' || chr(39) || $4 || chr(39); - ELSE - vQuery := vQuery || \' AND k.time BETWEEN \' - || chr(39) || $4 || chr(39) - || \' AND \' || chr(39) || $5 || chr(39); - END IF; ---RAISE WARNING \'Query:%\', vQuery; - -- get record in paramref table - FOR vRecord IN EXECUTE \' - SELECT h.nodeID, - k.paramname, - k.value, - k.time - FROM VICkvt k - INNER JOIN VIChierarchy h ON k.paramname = h.name - WHERE k.paramname \' || vQuery || \' - AND k.treeID = \' || $1 || \' - ORDER BY h.nodeID, k.time\' - LOOP - RETURN NEXT vRecord; - END LOOP; - RETURN; - END -' LANGUAGE plpgsql; - - diff --git a/dependencies/OTDB/sql/security_func.sql b/dependencies/OTDB/sql/security_func.sql deleted file mode 100644 index e6d0c2f94a259d8c8995911ae588900d1016ec14..0000000000000000000000000000000000000000 --- a/dependencies/OTDB/sql/security_func.sql +++ /dev/null @@ -1,75 +0,0 @@ --- --- security_func.sql: Some security related functions --- --- Copyright (C) 2005 --- ASTRON (Netherlands Foundation for Research in Astronomy) --- P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, softwaresupport@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$ --- - --- OTDBlogin (username, passwd) --- Check is to given combination of username and password is valid -CREATE OR REPLACE FUNCTION OTDBlogin(VARCHAR(80), VARCHAR(80)) - RETURNS INT4 AS ' - -- $Id$ - DECLARE - vUserNr INT4; - - BEGIN - -- determine parameterID - SELECT userID - INTO vUserNr - FROM OTDBuser - WHERE username = $1 - AND password = $2; - IF NOT FOUND THEN - RETURN 0; - END IF; - - UPDATE OTDBuser - SET lastLogin = \'now\' - WHERE username = $1; - - RETURN vUserNr; - -- TODO: return authToken instead. - END; -' LANGUAGE plpgsql; - - --- OTDBauthenticate (userID, task, value) --- Check if the user is allowed to perform a task -CREATE OR REPLACE FUNCTION OTDBauthenticate(INTEGER, INTEGER, INTEGER) - RETURNS INT4 AS ' - -- $Id$ - DECLARE - - BEGIN - -- determine parameterID - SELECT userID - FROM OTDBaccess - WHERE userID = $1 - AND task = $2 - AND value = $3; - IF NOT FOUND THEN - RETURN 0; - END IF; - - RETURN 1; - END; -' LANGUAGE plpgsql; - diff --git a/dependencies/OTDB/sql/setDescription_func.sql b/dependencies/OTDB/sql/setDescription_func.sql deleted file mode 100644 index 387a7ac12104585aecf7f46d5233b7c1d30f7630..0000000000000000000000000000000000000000 --- a/dependencies/OTDB/sql/setDescription_func.sql +++ /dev/null @@ -1,63 +0,0 @@ --- --- setDescription.sql: function for changing the description of a tree --- --- Copyright (C) 2006 --- ASTRON (Netherlands Foundation for Research in Astronomy) --- P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, softwaresupport@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$ --- - --- --- setDescription (authToken, treeID, description) --- --- Authorisation: yes --- --- Tables: otdbtree update --- --- Types: none --- -CREATE OR REPLACE FUNCTION setDescription(INT4, INT4, TEXT) - RETURNS BOOLEAN AS $$ - -- $Id$ - DECLARE - vFunction INT2 := 1; - vIsAuth BOOLEAN; - vAuthToken ALIAS FOR $1; - vCampaignID campaign.id%TYPE; - vDescription TEXT; - - BEGIN - -- check authorisation(authToken, treeID, func, none) - vIsAuth := FALSE; - SELECT isAuthorized(vAuthToken, $2, vFunction, 0) - INTO vIsAuth; - IF NOT vIsAuth THEN - RAISE EXCEPTION 'Not authorized.'; - RETURN FALSE; - END IF; - - -- update the tree - vDescription := replace($3, E'\\\'', E''); - -- vDescription := replace($3, \'\\\'\', \'\'); - UPDATE OTDBtree - SET description = vDescription - WHERE treeID = $2; - - RETURN TRUE; - END; -$$ LANGUAGE plpgsql; diff --git a/dependencies/OTDB/sql/setMomInfo_func.sql b/dependencies/OTDB/sql/setMomInfo_func.sql deleted file mode 100644 index 6239715cc6b797da74b7dc6bf29fa4dd9df48152..0000000000000000000000000000000000000000 --- a/dependencies/OTDB/sql/setMomInfo_func.sql +++ /dev/null @@ -1,73 +0,0 @@ --- --- SetMomInfo.sql: function for changing the Mom information of a tree --- --- Copyright (C) 2005 --- ASTRON (Netherlands Foundation for Research in Astronomy) --- P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, softwaresupport@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$ --- - --- --- setMomInfo (authToken, treeID, MomID, groupID, campaign) --- --- Authorisation: yes --- --- Tables: otdbtree update --- --- Types: none --- -CREATE OR REPLACE FUNCTION setMomInfo(INT4, INT4, INT4, INT4, TEXT) - RETURNS BOOLEAN AS $$ - -- $Id$ - DECLARE - vFunction INT2 := 1; - vIsAuth BOOLEAN; - vAuthToken ALIAS FOR $1; - vCampaignID campaign.id%TYPE; - - BEGIN - -- check authorisation(authToken, treeID, func, none) - vIsAuth := FALSE; - SELECT isAuthorized(vAuthToken, $2, vFunction, 0) - INTO vIsAuth; - IF NOT vIsAuth THEN - RAISE EXCEPTION 'Not authorized.'; - RETURN FALSE; - END IF; - - -- Translate campaign information - SELECT id - FROM campaign - INTO vCampaignID - WHERE name = $5; - IF NOT FOUND THEN - RAISE EXCEPTION 'Campaign information not found.'; - RETURN FALSE; - END IF; - - -- Finally update tree - UPDATE OTDBtree - SET momID = $3, - groupID = $4, - campaign = vCampaignID - WHERE treeID = $2; - - RETURN TRUE; - END; -$$ LANGUAGE plpgsql; - diff --git a/dependencies/OTDB/sql/setSchedule_func.sql b/dependencies/OTDB/sql/setSchedule_func.sql deleted file mode 100644 index 3598556ef25fdfdffc511f99efd314ea1d4c539d..0000000000000000000000000000000000000000 --- a/dependencies/OTDB/sql/setSchedule_func.sql +++ /dev/null @@ -1,182 +0,0 @@ --- --- SetSchedule.sql: function for changing the scheduling times of a tree. --- --- Copyright (C) 2006 --- ASTRON (Netherlands Foundation for Research in Astronomy) --- P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, softwaresupport@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$ --- - --- -- setSchedule (authToken, treeID, aStartTime, aStopTime) --- --- Authorisation: yes --- --- Tables: otdbtree update --- --- Types: none --- -CREATE OR REPLACE FUNCTION setSchedule(INT4, INT4, VARCHAR(20), VARCHAR(20)) - RETURNS BOOLEAN AS $$ - -- $Id$ - DECLARE - vFunction INT2 := 1; - TSactive CONSTANT INT2 := 600; - TThierarchy CONSTANT INT2 := 30; - vIsAuth BOOLEAN; - vAuthToken ALIAS FOR $1; - vCampaignID campaign.id%TYPE; - vTreeType OTDBtree.treetype%TYPE; - vState OTDBtree.state%TYPE; - vStartTime timestamp; - vStopTime timestamp; - - BEGIN - -- check Timestamps - IF $3 = '' THEN - vStartTime := NULL; - ELSE - vStartTime := $3; - END IF; - IF $4 = '' THEN - vStopTime := NULL; - ELSE - vStopTime := $4; - END IF; - -- check authorisation(authToken, treeID, func, none) - vIsAuth := FALSE; - SELECT isAuthorized(vAuthToken, $2, vFunction, 0) - INTO vIsAuth; - IF NOT vIsAuth THEN - RAISE EXCEPTION 'Not authorized.'; - RETURN FALSE; - END IF; - - -- Only non-active VH trees can be scheduled. - SELECT treetype, state - INTO vTreeType, vState - FROM OTDBtree - WHERE treeID = $2; - - IF vTreeType <> TThierarchy THEN - RAISE EXCEPTION 'Only VH trees can be scheduled.'; - END IF; - - IF vState = TSactive THEN - RAISE EXCEPTION 'Tree may not be active'; - END IF; - - -- Finally update tree - UPDATE OTDBtree - SET starttime = vStartTime, - stoptime = vStopTime - WHERE treeID = $2; - - UPDATE vicHierarchy - SET value = vStartTime - WHERE treeID = $2 - AND name LIKE '%.Observation.startTime'; - - UPDATE vicHierarchy - SET value = vStopTime - WHERE treeID = $2 - AND name LIKE '%.Observation.stopTime'; - - RETURN TRUE; - END; -$$ LANGUAGE plpgsql; - --- -- setSchedule (authToken, treeID, aStartTime, aStopTime, insideTreeAlso) --- --- Authorisation: yes --- --- Tables: otdbtree update --- --- Types: none --- -CREATE OR REPLACE FUNCTION setSchedule(INT4, INT4, VARCHAR(20), VARCHAR(20), BOOLEAN) - RETURNS BOOLEAN AS $$ - -- $Id$ - DECLARE - vFunction INT2 := 1; - TSactive CONSTANT INT2 := 600; - TThierarchy CONSTANT INT2 := 30; - vIsAuth BOOLEAN; - vAuthToken ALIAS FOR $1; - vCampaignID campaign.id%TYPE; - vTreeType OTDBtree.treetype%TYPE; - vState OTDBtree.state%TYPE; - vStartTime timestamp; - vStopTime timestamp; - - BEGIN - -- check Timestamps - IF $3 = '' THEN - vStartTime := NULL; - ELSE - vStartTime := $3; - END IF; - IF $4 = '' THEN - vStopTime := NULL; - ELSE - vStopTime := $4; - END IF; - -- check authorisation(authToken, treeID, func, none) - vIsAuth := FALSE; - SELECT isAuthorized(vAuthToken, $2, vFunction, 0) - INTO vIsAuth; - IF NOT vIsAuth THEN - RAISE EXCEPTION 'Not authorized.'; - RETURN FALSE; - END IF; - - -- Only non-active VH trees can be scheduled. - SELECT treetype, state - INTO vTreeType, vState - FROM OTDBtree - WHERE treeID = $2; - - IF vTreeType <> TThierarchy THEN - RAISE EXCEPTION 'Only VH trees can be scheduled.'; - END IF; - - IF vState = TSactive THEN - RAISE EXCEPTION 'Tree may not be active'; - END IF; - - -- Finally update tree - UPDATE OTDBtree - SET starttime = vStartTime, - stoptime = vStopTime - WHERE treeID = $2; - - IF $5 = true THEN - UPDATE vicHierarchy - SET value = vStartTime - WHERE treeID = $2 - AND name LIKE '%.Observation.startTime'; - - UPDATE vicHierarchy - SET value = vStopTime - WHERE treeID = $2 - AND name LIKE '%.Observation.stopTime'; - END IF; - - RETURN TRUE; - END; -$$ LANGUAGE plpgsql; - diff --git a/dependencies/OTDB/sql/setTreeState_func.sql b/dependencies/OTDB/sql/setTreeState_func.sql deleted file mode 100644 index bca0a7855ecc93ddf2859207c5547b8f0850f6f8..0000000000000000000000000000000000000000 --- a/dependencies/OTDB/sql/setTreeState_func.sql +++ /dev/null @@ -1,250 +0,0 @@ --- --- SetTreeState.sql: function for changing the State of the tree --- --- Copyright (C) 2005-2013 --- ASTRON (Netherlands Foundation for Research in Astronomy) --- P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, softwaresupport@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$ --- - --- --- setTreeState (authToken, treeID, treeState, allow_update) --- --- Checks if the treeState is legal before assigning it. --- --- Authorisation: yes --- --- Tables: otdbtree update --- --- Types: none --- -CREATE OR REPLACE FUNCTION setTreeState(INT4, INT4, INT2, BOOLEAN) - RETURNS BOOLEAN AS $$ - -- $Id$ - DECLARE - vFunction INT2 := 1; - vTreeState OTDBtree.state%TYPE; - vTreeID OTDBtree.treeID%TYPE; - vMomID OTDBtree.momID%TYPE; - vTreeType OTDBtree.treeType%TYPE; - vClassif OTDBtree.classif%TYPE; - vIsAuth BOOLEAN; - vAuthToken ALIAS FOR $1; - vUserID INT4; - TThardware CONSTANT INT2 := 10; - TTVIC CONSTANT INT2 := 30; - TSactive CONSTANT INT2 := 600; - TSfinished CONSTANT INT2 := 1000; - TSaborted CONSTANT INT2 := 1100; - TSobsolete CONSTANT INT2 := 1200; - - BEGIN - -- check authorisation(authToken, treeID, func, treeState) - vIsAuth := FALSE; - SELECT isAuthorized(vAuthToken, $2, vFunction, $3::int4) - INTO vIsAuth; - IF NOT vIsAuth THEN - RAISE EXCEPTION 'Not authorized.'; - RETURN FALSE; - END IF; - - -- check classification - SELECT id - INTO vTreeState - FROM treeState - WHERE id = $3; - IF NOT FOUND THEN - RAISE EXCEPTION 'TreeState % does not exist', $3; - RETURN FALSE; - END IF; - - -- get current treetype. - -- Note: tree existance is checked during auth.check - SELECT momID, treetype, classif - INTO vMomID, vTreeType, vClassif - FROM OTDBtree - WHERE treeID = $2; - - -- changing PIC tree to operational? - -- restriction: only 1 PIC may be active of each classification - IF vTreeType = TThardware AND $3 = TSactive THEN - SELECT treeid - INTO vTreeID -- dummy - FROM OTDBtree - WHERE treetype = TThardware - AND classif = vClassif - AND state = TSactive - AND treeID <> $2; - IF FOUND THEN - RAISE EXCEPTION 'Already an active hardware tree of the same classification.'; - RETURN FALSE; - END IF; - END IF; - - -- Finally update tree - UPDATE OTDBtree - SET state = $3 - WHERE treeid = $2; - - SELECT whoIs($1) - INTO vUserID; - PERFORM addTreeState ($2, vMomID, $3, vUserID, ''); - - -- (temp?) add extra timeinfo on PIC trees. - IF vTreeType = TThardware THEN - BEGIN - IF $3 = TSactive THEN - UPDATE OTDBtree - SET starttime = now() - WHERE treeid = $2; - END IF; - IF $3 = TSobsolete THEN - UPDATE OTDBtree - SET stoptime = now() - WHERE treeid = $2; - END IF; - END; - END IF; - - -- add timeinfo to VIC trees - IF vTreeType = TTVIC THEN - BEGIN - IF $3 = TSactive THEN - UPDATE OTDBtree - SET starttime = now() - WHERE treeid = $2; - END IF; - IF $4 = TRUE AND ($3 = TSfinished OR $3 = TSaborted) THEN - UPDATE OTDBtree - SET stoptime = now() - WHERE treeid = $2; - END IF; - END; - END IF; - - RETURN TRUE; - END; -$$ LANGUAGE plpgsql; - -CREATE OR REPLACE FUNCTION setTreeState(INT4, INT4, INT2) - RETURNS BOOLEAN AS ' - DECLARE - vFunction INT2 := 1; - vTreeState OTDBtree.state%TYPE; - vTreeID OTDBtree.treeID%TYPE; - vMomID OTDBtree.momID%TYPE; - vTreeType OTDBtree.treeType%TYPE; - vClassif OTDBtree.classif%TYPE; - vIsAuth BOOLEAN; - vAuthToken ALIAS FOR $1; - vUserID INT4; - TThardware CONSTANT INT2 := 10; - TTVIC CONSTANT INT2 := 30; - TSactive CONSTANT INT2 := 600; - TSfinished CONSTANT INT2 := 1000; - TSaborted CONSTANT INT2 := 1100; - TSobsolete CONSTANT INT2 := 1200; - - BEGIN - -- check authorisation(authToken, treeID, func, treeState) - vIsAuth := FALSE; - SELECT isAuthorized(vAuthToken, $2, vFunction, $3::int4) - INTO vIsAuth; - IF NOT vIsAuth THEN - RAISE EXCEPTION \'Not authorized.\'; - RETURN FALSE; - END IF; - - -- check classification - SELECT id - INTO vTreeState - FROM treeState - WHERE id = $3; - IF NOT FOUND THEN - RAISE EXCEPTION \'TreeState % does not exist\', $3; - RETURN FALSE; - END IF; - - -- get current treetype. - -- Note: tree existance is checked during auth.check - SELECT momID, treetype, classif - INTO vMomID, vTreeType, vClassif - FROM OTDBtree - WHERE treeID = $2; - - -- changing PIC tree to operational? - -- restriction: only 1 PIC may be active of each classification - IF vTreeType = TThardware AND $3 = TSactive THEN - SELECT treeid - INTO vTreeID -- dummy - FROM OTDBtree - WHERE treetype = TThardware - AND classif = vClassif - AND state = TSactive - AND treeID <> $2; - IF FOUND THEN - RAISE EXCEPTION \'Already an active hardware tree of the same classification.\'; - RETURN FALSE; - END IF; - END IF; - - -- Finally update tree - UPDATE OTDBtree - SET state = $3 - WHERE treeid = $2; - - SELECT whoIs($1) - INTO vUserID; - PERFORM addTreeState ($2, vMomID, $3, vUserID, \'\'); - - -- (temp?) add extra timeinfo on PIC trees. - IF vTreeType = TThardware THEN - BEGIN - IF $3 = TSactive THEN - UPDATE OTDBtree - SET starttime = now() - WHERE treeid = $2; - END IF; - IF $3 = TSobsolete THEN - UPDATE OTDBtree - SET stoptime = now() - WHERE treeid = $2; - END IF; - END; - END IF; - - -- add timeinfo to VIC trees - IF vTreeType = TTVIC THEN - BEGIN - IF $3 = TSactive THEN - UPDATE OTDBtree - SET starttime = now() - WHERE treeid = $2; - END IF; - IF $3 = TSfinished OR $3 = TSaborted THEN - UPDATE OTDBtree - SET stoptime = now() - WHERE treeid = $2; - END IF; - END; - END IF; - - RETURN TRUE; - END; -' LANGUAGE plpgsql; - diff --git a/dependencies/OTDB/sql/updateVTnode_func.sql b/dependencies/OTDB/sql/updateVTnode_func.sql deleted file mode 100644 index bf0dc53bf725f1ec934a6fb17cad89182f8685bd..0000000000000000000000000000000000000000 --- a/dependencies/OTDB/sql/updateVTnode_func.sql +++ /dev/null @@ -1,97 +0,0 @@ --- --- updateVTnode.sql: function updating a Node of a VIC template tree --- --- Copyright (C) 2005 --- ASTRON (Netherlands Foundation for Research in Astronomy) --- P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, softwaresupport@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$ --- - --- --- updateVTnode (authToken, treeID, nodeID, instances, limits) --- --- Saves the new values to the database --- --- Authorisation: yes --- --- Tables: VICtemplate update --- VIChierarchy update --- --- Types: OTDBnode --- -CREATE OR REPLACE FUNCTION updateVTnode(INT4, INT4, INT4, INT2, TEXT) - RETURNS BOOLEAN AS $$ - -- $Id$ - DECLARE - TTtemplate CONSTANT INT2 := 20; - TThierarchy CONSTANT INT2 := 30; - vFunction CONSTANT INT2 := 1; - vTreeType OTDBtree.treetype%TYPE; - vIsAuth BOOLEAN; - vAuthToken ALIAS FOR $1; - vLimits TEXT; - - BEGIN - -- check authorisation(authToken, tree, func, parameter) - vIsAuth := FALSE; - SELECT isAuthorized(vAuthToken, $2, vFunction, 0) - INTO vIsAuth; - IF NOT vIsAuth THEN - RAISE EXCEPTION 'Not authorized'; - RETURN FALSE; - END IF; - - -- get treetype - SELECT treetype - INTO vTreeType - FROM OTDBtree - WHERE treeID = $2; - IF NOT FOUND THEN - RAISE EXCEPTION 'Tree % does not exist', $1; - END IF; - - IF vTreeType = TTtemplate THEN - -- get ParentID of node to duplicate - vLimits := replace($5, E'\\\'', E''); - UPDATE VICtemplate - SET instances = $4, - limits = vLimits - WHERE treeID = $2 - AND nodeID = $3; - IF NOT FOUND THEN - RAISE EXCEPTION 'Node % of template-tree could not be updated', $3; - RETURN FALSE; - END IF; - ELSEIF vTreeType = TThierarchy THEN - vLimits := replace($5, E'\\\'', E''); - UPDATE VIChierarchy - SET value = vLimits - WHERE treeID = $2 - AND nodeID = $3; - IF NOT FOUND THEN - RAISE EXCEPTION 'Node % of VIC-tree could not be updated', $3; - RETURN FALSE; - END IF; - ELSE - RAISE EXCEPTION 'Nodes of PIC trees can not be updated'; - END IF; - - RETURN TRUE; - END; -$$ LANGUAGE plpgsql; - diff --git a/dependencies/OTDB/sql/update_all_functions.sh b/dependencies/OTDB/sql/update_all_functions.sh deleted file mode 100755 index 869e5775cb439123dc0b6305ed0953e9048ad764..0000000000000000000000000000000000000000 --- a/dependencies/OTDB/sql/update_all_functions.sh +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/bash -# -# Script to update all sql functions in the OTDB -# -LOFAR_DB=LOFAR_4 - -# Gather all sql functions -all_funcs=( `ls -1 *_func.sql` ) -if [ ${#all_funcs[@]} -ge 1 ]; then - if [ -e /tmp/otdb_func_update_$$.sql ]; then - result=`rm -f /tmp/otdb_func_update_$$.sql >& /dev/null; echo $?` - if [ $result -ne 0 ]; then - echo "Could not remove file /tmp/otdb_func_update_$$.sql" - exit - fi - fi - for func in "${all_funcs[@]}" - do - echo "\i $func" >> /tmp/otdb_func_update_$$.sql - done -else - echo "Could not find sql function files; wrong directory?" - exit -fi - -# Update database -if [ -e /tmp/otdb_func_update_$$.sql ]; then - echo "Updating database $LOFAR_DB ; see file otdb_func_update_$$.log for log messages" - psql -f /tmp/otdb_func_update_$$.sql -U postgres -h localhost $LOFAR_DB >& otdb_func_update_$$.log -else - echo "Could not find file /tmp/otdb_func_update_$$.sql " - exit -fi diff --git a/dependencies/OTDB/sql/upgradeOTDB.sql b/dependencies/OTDB/sql/upgradeOTDB.sql deleted file mode 100644 index bc2bd910bbed2b977eaf77aacaf01ad9081694b4..0000000000000000000000000000000000000000 --- a/dependencies/OTDB/sql/upgradeOTDB.sql +++ /dev/null @@ -1,6 +0,0 @@ - --- Load new functions -\i getStations_func.sql - --- Load modified/improved functions -\i setMomInfo_func.sql diff --git a/dependencies/OTDB/src/Converter.cc b/dependencies/OTDB/src/Converter.cc index 99db2e1f7eab4b8a3620ac8143c8822a100cc87c..3214f6e6d60c31f2243a8540052906cd7084b7b2 100644 --- a/dependencies/OTDB/src/Converter.cc +++ b/dependencies/OTDB/src/Converter.cc @@ -30,8 +30,10 @@ #include <OTDB/Converter.h> #include <pqxx/transaction> +#include <utility> using namespace pqxx; +using std::pair; namespace LOFAR { namespace OTDB { diff --git a/dependencies/OTDB/src/TreeMaintenance.cc b/dependencies/OTDB/src/TreeMaintenance.cc index 0ac93e6459740965942458bd6c3ef207d88b4293..fb5b0931591929c6a7f13070d4bc55180edfa9fa 100644 --- a/dependencies/OTDB/src/TreeMaintenance.cc +++ b/dependencies/OTDB/src/TreeMaintenance.cc @@ -27,7 +27,6 @@ #include <Common/LofarLogger.h> #include <Common/ParameterSet.h> #include <Common/StringUtil.h> -#include <Common/lofar_string.h> #include <fstream> #include <OTDB/TreeMaintenance.h> #include <OTDB/OTDBnode.h> @@ -35,6 +34,9 @@ #include <OTDB/misc.h> #include <pqxx/transaction> +#include <string> + +using std::string; using namespace pqxx; diff --git a/dependencies/OTDB/src/loadCompFile.cc b/dependencies/OTDB/src/loadCompFile.cc index 9ea7db2e8a9cbe593408730cd888c685c555764f..c0290a39ebd4bcb3adfed6f4d10555b23c8c6a0e 100644 --- a/dependencies/OTDB/src/loadCompFile.cc +++ b/dependencies/OTDB/src/loadCompFile.cc @@ -27,8 +27,6 @@ #include <Common/LofarLogger.h> #include <Common/StringUtil.h> #include <Common/lofar_fstream.h> -#include <Common/lofar_string.h> -#include <Common/lofar_vector.h> #include <Common/LofarTypes.h> #include <OTDB/TreeMaintenance.h> #include <OTDB/wSpaceSplit.h> @@ -40,6 +38,11 @@ #include <OTDB/misc.h> #include <pqxx/transaction> +#include <string> +#include <vector> + +using std::string; +using std::vector; using namespace pqxx; diff --git a/dependencies/OTDB/src/misc.cc b/dependencies/OTDB/src/misc.cc index 5abc49d5909fd3f5d47e8ae43a7463079c90e8a6..d68b9cfb38a679660d370ef9d9f88dec668d16e6 100644 --- a/dependencies/OTDB/src/misc.cc +++ b/dependencies/OTDB/src/misc.cc @@ -25,7 +25,6 @@ //# Includes #include <Common/LofarLogger.h> -#include <Common/lofar_string.h> #include <Common/StringUtil.h> #include <OTDB/misc.h> #include <cstdio> diff --git a/dependencies/Stream/include/Stream/PortBroker.h b/dependencies/Stream/include/Stream/PortBroker.h index 6fe458c1d53d5655040c2c76f1df0a4882e2dfa9..be36c79fce4a9a1660d1992a95b96204d92a9066 100644 --- a/dependencies/Stream/include/Stream/PortBroker.h +++ b/dependencies/Stream/include/Stream/PortBroker.h @@ -29,7 +29,6 @@ #include <Common/Thread/Thread.h> #include <Common/Thread/Mutex.h> #include <Common/Thread/Condition.h> -#include <Common/Singleton.h> #include <Stream/FileDescriptorBasedStream.h> #include <Stream/SocketStream.h> diff --git a/dependencies/pytools/include/pytools/PycBasicData.h b/dependencies/pytools/include/pytools/PycBasicData.h index 5c221d18dc1b4da13e7c2952f218d2fc6686854b..3ceae8137d97870be657d041cbf22cf9bc18746d 100755 --- a/dependencies/pytools/include/pytools/PycBasicData.h +++ b/dependencies/pytools/include/pytools/PycBasicData.h @@ -31,7 +31,6 @@ // include python first to avoid _POSIX_C_SOURCE redefined warnings #include <boost/python.hpp> #include <boost/python/object.hpp> -#include <Common/lofar_complex.h> #include <vector> #include <map> diff --git a/dependencies/pytools/src/PycBasicData.cc b/dependencies/pytools/src/PycBasicData.cc index ec01c7a4735ba5716ed42c1f986864757eefbbda..7c7d291a02890284bb94ebe6ffaca69236d5e537 100644 --- a/dependencies/pytools/src/PycBasicData.cc +++ b/dependencies/pytools/src/PycBasicData.cc @@ -51,8 +51,6 @@ namespace LOFAR { namespace pytools { LOFAR::pytools::register_convert_std_vector<int>(); LOFAR::pytools::register_convert_std_vector<double>(); LOFAR::pytools::register_convert_std_vector<float>(); - LOFAR::pytools::register_convert_std_vector<dcomplex>(); - LOFAR::pytools::register_convert_std_vector<fcomplex>(); LOFAR::pytools::register_convert_std_vector<std::string>(); } diff --git a/dependencies/pytools/test/tConvert.cc b/dependencies/pytools/test/tConvert.cc index 3f0fecbb5f84811298bdaebdb0f57d95aa7da832..79695e96501d2158eec12f076dfad002612f9c89 100755 --- a/dependencies/pytools/test/tConvert.cc +++ b/dependencies/pytools/test/tConvert.cc @@ -50,14 +50,10 @@ namespace LOFAR { namespace pytools { {cout << "ssize " << in << endl; return in;} double testfloat (double in) {cout << "Float " << in << endl; return in;} - dcomplex testcomplex (const dcomplex& in) - {cout << "DComplex " << in << endl; return in;} string teststring (const string& in) {cout << "String " << in << endl; string out=in; return out;} vector<int> testvecint (const vector<int>& in) {cout << "VecInt " << in << endl; return in;} - vector<dcomplex> testveccomplex (const vector<dcomplex>& in) - {cout << "VecComplex " << in << endl; return in;} vector<string> testvecstr (const vector<string>& in) {cout << "VecStr " << in << endl; return in;} }; @@ -71,10 +67,8 @@ namespace LOFAR { namespace pytools { .def ("testint64", &TConvert::testint64) .def ("testssize", &TConvert::testssize) .def ("testfloat", &TConvert::testfloat) - .def ("testcomplex", &TConvert::testcomplex) .def ("teststring", &TConvert::teststring) .def ("testvecint", &TConvert::testvecint) - .def ("testveccomplex", &TConvert::testveccomplex) .def ("testvecstr", &TConvert::testvecstr) ; } diff --git a/dependencies/pytools/test/tConvert.py b/dependencies/pytools/test/tConvert.py index cf30737c2234844ab34e0e7581edeefad61e564c..095c04e990aee8aababc12def25f8d267ff4ea72 100755 --- a/dependencies/pytools/test/tConvert.py +++ b/dependencies/pytools/test/tConvert.py @@ -23,7 +23,6 @@ def dotest(t): print(t.testvecint ([])) print(t.testvecint ((-1,-2,-3,-4))) print(t.testvecint (-10)) - print(t.testveccomplex ([1+2j, -1-3j, -1.5+2.5j])) print(t.testvecstr (["a1","a2","b1","b2"])) print(t.testvecstr (())) print(t.testvecstr ("sc1")) diff --git a/dependencies/pytools/test/tConvert.stdout b/dependencies/pytools/test/tConvert.stdout index 12615e00bdca85085c8a853314b7a5aa251cfadc..5ffb635568ac6ef7485938f8cb0dc76cb3328585 100644 --- a/dependencies/pytools/test/tConvert.stdout +++ b/dependencies/pytools/test/tConvert.stdout @@ -30,8 +30,6 @@ VecInt [-1,-2,-3,-4] [-1, -2, -3, -4] VecInt [-10] [-10] -VecComplex [(1,2),(-1,-3),(-1.5,2.5)] -[(1+2j), (-1-3j), (-1.5+2.5j)] VecStr [a1,a2,b1,b2] ['a1', 'a2', 'b1', 'b2'] VecStr []