[boinc-app-seti] 01/01: Imported Upstream version 7.28~svn2203
Gianfranco Costamagna
locutusofborg-guest at moszumanska.debian.org
Mon Apr 14 07:59:57 UTC 2014
This is an automated email from the git hooks/post-receive script.
locutusofborg-guest pushed a commit to annotated tag upstream/7.28_svn2203
in repository boinc-app-seti.
commit 1eceeb8ee0a4f3f8c33caa28c7f3ce4eae99ead2
Author: Gianfranco Costamagna <costamagnagianfranco at yahoo.it>
Date: Mon Apr 14 00:01:57 2014 +0200
Imported Upstream version 7.28~svn2203
---
Makefile.am | 2 +-
Makefile.incl | 2 +-
build_android_client.sh | 76 +-
client/Makefile.am | 6 +-
client/amd64fft8g.cpp | 6 +
client/analyzeFuncs.cpp | 221 +-
client/analyzeFuncs.h | 3 +
client/analyzePoT.cpp | 29 +-
client/analyzeReport.cpp | 57 +-
client/autocorr.cpp | 6 +
client/chirpfft.cpp | 28 +-
client/fft8g.cpp | 189 +-
client/fft8g.h | 4 -
client/gaussfit.cpp | 53 +-
client/gdata.cpp | 39 +-
client/lcgamm.cpp | 65 +-
client/main.cpp | 48 +-
client/malloc_a.cpp | 41 +-
client/malloc_a.h | 2 +-
client/progress.cpp | 55 +-
client/pulsefind.cpp | 79 +
client/pulsefind.h | 4 +
client/s_util.cpp | 46 +-
client/sah_gfx.cpp | 3 -
client/seti.cpp | 151 +-
client/seti.h | 1 +
client/seti_header.cpp | 30 +
client/spike.cpp | 6 +
client/timecvt.cpp | 32 +-
client/vector/analyzeFuncs_altivec.cpp | 179 +-
client/vector/analyzeFuncs_avx.cpp | 147 +
client/vector/analyzeFuncs_fpu.cpp | 40 +-
client/vector/analyzeFuncs_mmx.cpp | 12 +
client/vector/analyzeFuncs_sse.cpp | 427 +-
client/vector/analyzeFuncs_sse2.cpp | 32 +-
client/vector/analyzeFuncs_sse3.cpp | 27 +-
client/vector/analyzeFuncs_vector.cpp | 256 +-
client/vector/analyzeFuncs_vector.h | 5 +-
client/vector/analyzeFuncs_vfp_aux.cpp | 38 +
client/vector/analyzeFuncs_x86_64.cpp | 6 +
client/vector/fp_arm.h | 10 +-
client/vector/sighandler.h | 26 +-
client/vector/x86_ops.h | 4 +-
client/worker.cpp | 37 +-
.../working_collect2_line_for_android_armv6-neon | 1 +
client/working_collect2_line_for_android_armv6-vfp | 1 +
configure.ac | 116 +-
db/schema_master.cpp | 29450 ++++++++++---------
db/schema_master.h | 2496 +-
db/tools/analysis_configs.xml | 2 +-
db/tools/insert_splitter_config.cpp | 3 +-
db/tools/settings.sql | 6 +-
db/tools/splitter_configs.xml | 6 +-
db/xml_util.h | 10 +-
m4/sah_avx.m4 | 6 +-
55 files changed, 19041 insertions(+), 15586 deletions(-)
diff --git a/Makefile.am b/Makefile.am
index be73fbd..a147252 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -15,7 +15,7 @@ endif
endif
if ENABLE_SERVER
- SERVER_SUBDIRS = splitter_fft splitter_pfb assimilator validate
+ SERVER_SUBDIRS = splitter_pfb assimilator validate
endif
if USE_MY_IMAGELIBS
diff --git a/Makefile.incl b/Makefile.incl
index 64d4296..62cc811 100644
--- a/Makefile.incl
+++ b/Makefile.incl
@@ -30,7 +30,7 @@ INFORMIX_LIBS = @INFORMIX_LIBS@
INFORMIX_CFLAGS = @INFORMIX_CFLAGS@
APP_LIBS = @ASMLIB_LIBS@ @APP_LIBS@
APP_LDFLAGS = @ASMLIB_LDFLAGS@ @APP_LDFLAGS@
-APP_CFLAGS = @ASMLIB_CFLAGS@ @APP_CFLAGS@ @FP_ABI_FLAGS@ @FP_FLAGS@
+APP_CFLAGS = @ASMLIB_CFLAGS@ @APP_CFLAGS@
GRAPHICS_CFLAGS = @GRAPHICS_CFLAGS@
DEFS = @DEFS@
GRAPHICS_LIBS = @GRAPHICS_LIBS@
diff --git a/build_android_client.sh b/build_android_client.sh
index cfae449..e660eec 100755
--- a/build_android_client.sh
+++ b/build_android_client.sh
@@ -7,13 +7,59 @@
# Script to compile various BOINC libraries for Android to be used
# by science applications
+#for targetarch in armv6-soft armv6-vfp armv6-neon armv7-neon armv7-vfpv3 armv7-vfpv4 armv7-vfpv3d16 thumb-vfpv3d16
+for targetarch in armv6-vfp armv6-neon
+do
+fpabi="-mfloat-abi=softfp"
+configargs=""
+cpuarch=armv7-a
+tune=cortex-a9
+case $targetarch in
+ armv6-soft)
+ fpabi="-mfloat-abi=soft"
+ cpuarch=armv6
+ fpu=
+ tune=cortex-m1
+ ;;
+ armv6-vfp)
+ cpuarch=armv6
+ configargs="--disable-neon"
+ fpu="-mfpu=vfp"
+ tune=cortex-m1
+ ;;
+ armv6-neon)
+ cpuarch=armv6
+ tune=cortex-m1
+ fpu="-mfpu=neon -ftree-vectorize"
+ ;;
+ thumb-vfpv3d16)
+ cpuarch="armv7-a -mthumb"
+ fpu="-mfpu=vfpv3-d16"
+ ;;
+ *-neon)
+ fpu="-mfpu=neon -ftree-vectorize"
+ ;;
+ *-vfpv3)
+ fpu="-mfpu=vfpv3"
+ ;;
+ *-vfpv3d16)
+ fpu="-mfpu=vfpv3-d16"
+ ;;
+ *-vfpv4)
+ fpu="-mfpu=vfpv4"
+ ;;
+ *)
+ ;;
+esac
+
+
+
+
COMPILEBOINC="yes"
CONFIGURE="yes"
MAKECLEAN="yes"
export BOINC="../boinc" #BOINC source code
-export OPENSSL_DIR=$BOINC/../boinc_depends_android_eclipse/openssl
-export CURL_DIR=$BOINC/../boinc_depends_android_eclipse/curl
export PKG_CONFIG_DEBUG_SPEW=1
export ANDROIDTC="/usr/arm-linux-androideabi"
@@ -35,10 +81,10 @@ export AR=${CROSS_PREFIX}-ar
export STRIP=${CROSS_PREFIX}-strip
export RANLIB=${CROSS_PREFIX}-ranlib
-export CFLAGS="--sysroot=$TCSYSROOT -DANDROID -DDECLARE_TIMEZONE -Wall -O3 -fomit-frame-pointer -march=armv6 -mtune=cortex-a9"
-export CXXFLAGS="--sysroot=$TCSYSROOT -DANDROID -Wall -funroll-loops -fexceptions -O3 -fomit-frame-pointer -march=armv6 -mtune=cortex-a9"
+export CFLAGS="--sysroot=$TCSYSROOT -DANDROID -DDECLARE_TIMEZONE -Wall -O3 -fomit-frame-pointer -march=${cpuarch} -I$TCSYSROOT/usr/include ${fpu} ${fpabi}"
+export CXXFLAGS="--sysroot=$TCSYSROOT -DANDROID -Wall -funroll-loops -fexceptions -O3 -fomit-frame-pointer -march=${cpuarch} -I$TCSYSROOT/usr/include ${fpu} ${fpabi}"
export CCASFLAGS="${CFLAGS}"
-export LDFLAGS="-L$TCINCLUDES/lib/armv6 -L$TCSYSROOT/usr/lib -L$TCINCLUDES/lib -llog -lstdc++"
+export LDFLAGS="-static-libstdc++ -static-libgcc -L$TCINCLUDES/lib/${targetarch} -L$TCSYSROOT/usr/lib -L$TCINCLUDES/lib -llog -lstdc++"
export LIBS="/usr/arm-linux-androideabi/arm-linux-androideabi/lib/libstdc++.a"
export PKG_CONFIG_SYSROOT_DIR=$TCSYSROOT
export PKG_CONFIG_PATH=$CURL_DIR/lib/pkgconfig:$OPENSSL_DIR/lib/pkgconfig
@@ -46,14 +92,26 @@ export PKG_CONFIG_PATH=$CURL_DIR/lib/pkgconfig:$OPENSSL_DIR/lib/pkgconfig
if [ -n "$COMPILEBOINC" ]; then
echo "==================building Libraries from $BOINC=========================="
if [ -n "$MAKECLEAN" ]; then
+cd client
make clean
+cd ..
fi
if [ -n "$CONFIGURE" ]; then
./_autosetup
-./configure -C --host=${ac_cv_host} --prefix="${ANDROIDTC}/arm-linux-androideabi" --exec-prefix="${ANDROIDTC}/arm-linux-androideabi" --with-boinc-platform="arm-android-linux-gnu" --with-ssl=$TCINCLUDES --disable-graphics --disable-server
+/bin/rm config.cache
+if ! ./configure -C --host=${ac_cv_host} --prefix="${ANDROIDTC}/arm-linux-androideabi" --exec-prefix="${ANDROIDTC}/arm-linux-androideabi" --with-boinc-platform="arm-android-linux-gnu" --with-ssl=$TCINCLUDES --disable-graphics --disable-server $configargs
+then
+ break
fi
-make
-
+fi
+cd client
+if ! make ; then
+ break
+fi
+pwd
+source ./working_collect2_line_for_android_$targetarch
+cp seti_boinc setiathome_7.28_arm-android-linux-gnu__$targetarch
+cd ..
echo "=============================BOINC done============================="
-
fi
+done
diff --git a/client/Makefile.am b/client/Makefile.am
index bed9cf5..f9c8236 100644
--- a/client/Makefile.am
+++ b/client/Makefile.am
@@ -3,7 +3,7 @@
include $(top_srcdir)/Makefile.incl
-BOINC_LIBS = -L$(BOINCDIR)/api -L$(BOINCDIR)/api/.libs -lboinc_api -L$(BOINCDIR)/lib -L$(BOINCDIR)/lib/.libs -lboinc
+BOINC_LIBS = -lboinc_api -lboinc
CLIENT_C_FLAGS = $(APP_CFLAGS) $(CFLAGS) \
$(DEFS) \
@@ -167,7 +167,7 @@ endif
endif
if X86_64
-# allow use of sse instructions on i[3456]86
+# allow use of sse instructions on x86_64
seti_boinc-analyzeFuncs_sse3.o: vector/analyzeFuncs_sse3.cpp
if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(seti_boinc_CXXFLAGS) $(CXXFLAGS) -DUSE_SSE3 \
@@ -202,7 +202,7 @@ if PPC
seti_boinc-analyzeFuncs_altivec.o: vector/analyzeFuncs_altivec.cpp
if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(seti_boinc_CXXFLAGS) $(CXXFLAGS) -DUSE_ALTIVEC \
- -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -faltivec \
+ -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -faltivec -mabi=altivec \
-c -o $@ $<; then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \
else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
seti_boinc-analyzeFuncs_vector.o: vector/analyzeFuncs_vector.cpp
diff --git a/client/amd64fft8g.cpp b/client/amd64fft8g.cpp
index e1f2896..c2225c0 100644
--- a/client/amd64fft8g.cpp
+++ b/client/amd64fft8g.cpp
@@ -47,6 +47,9 @@ void cftfsub(int n, float *a, float *w)
void cftmdl(int n, int l, float *a, float *w);
int j, j1, j2, j3, l;
__m128 x10, x32, y10, y32, zz;
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("cftfsub()");
+#endif
zz = _mm_setzero_ps ();
@@ -119,5 +122,8 @@ void cftfsub(int n, float *a, float *w)
_mm_storel_pi ((__m64 *) (a + j1), y10);
}
}
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
}
#endif // USE_AMD_OPT_CODE
diff --git a/client/analyzeFuncs.cpp b/client/analyzeFuncs.cpp
index 5c8219e..46f745d 100644
--- a/client/analyzeFuncs.cpp
+++ b/client/analyzeFuncs.cpp
@@ -57,6 +57,15 @@ const char *SAH_PACKAGE_STRING=CUSTOM_STRING;
#ifdef HAVE_MEMORY_H
#include <memory.h>
#endif
+#ifdef HAVE_MMAN_H
+#include <mman.h>
+#endif
+#ifdef HAVE_SYS_MMAN_H
+#include <sys/mman.h>
+#endif
+#ifdef HAVE_MMAP_H
+#include <mmap.h>
+#endif
#include <time.h>
#include "sincos.h"
@@ -67,6 +76,7 @@ const char *SAH_PACKAGE_STRING=CUSTOM_STRING;
#include "sah_gfx_main.h"
#endif
#include "diagnostics.h"
+#include "vector/sighandler.h"
#ifdef __arm__
#include "vector/fp_arm.h"
#endif
@@ -171,6 +181,9 @@ int seti_analyze (ANALYSIS_STATE& state) {
float* PowerSpectrum = NULL;
float* tPowerSpectrum; // Transposed power spectra if used.
float* AutoCorrelation = NULL;
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("seti_analyze()");
+#endif
use_transposed_pot= (!notranspose_flag) &&
((app_init_data.host_info.m_nbytes != 0) &&
@@ -232,17 +245,49 @@ int seti_analyze (ANALYSIS_STATE& state) {
#ifdef USE_FFTWF
double sz;
FILE *wisdom;
- if ((wisdom=boinc_fopen("wisdom.sah","r"))) {
- char *wiz=(char *)calloc_a(1024,64,MEM_ALIGN);
- int n=0;
- while (wiz && n<64*1024 && !feof(wisdom)) {
- n+=fread(wiz+n,1,80,wisdom);
+ std::string wisdom_path("wisdom.sah");
+ double wisdom_size=0;
+
+ if ((file_size(wisdom_path.c_str(),wisdom_size)==0) && (wisdom_size>512)) {
+ if ((wisdom=boinc_fopen(wisdom_path.c_str(),"r"))) {
+#ifdef HAVE_MUNMAP
+ char *wiz=(char *)mmap(NULL,wisdom_size,PROT_READ,MAP_PRIVATE,fileno(wisdom),0);
+#else
+ char *wiz=(char *)calloc_a(wisdom_size+1,1,MEM_ALIGN);
+ int n=0;
+ while (wiz && n<wisdom_size && !feof(wisdom)) {
+ n+=fread(wiz+n,1,80,wisdom);
+ }
+#endif
+ install_sighandler();
+ if (sigsetjmp(jb,1)) {
+ uninstall_sighandler();
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("fftwf_forget_wisdom()");
+#endif
+ fftwf_forget_wisdom();
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
+ } else {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("fftwf_import_wisdom_from_string()");
+#endif
+ fftwf_import_wisdom_from_string(wiz);
+ uninstall_sighandler();
+ }
+#ifdef HAVE_MUNMAP
+ munmap(wiz,wisdom_size);
+#else
+ free_a(wiz);
+#endif
+ fclose(wisdom);
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
}
- fftwf_import_wisdom_from_string(wiz);
- free_a(wiz);
- fclose(wisdom);
}
-#endif
+#endif /* USE_FFTWF */
#ifdef BOINC_APP_GRAPHICS
@@ -273,7 +318,13 @@ int seti_analyze (ANALYSIS_STATE& state) {
}
// TODO: Deallocate these at the end of the function
- analysis_plans[FftNum] = fftwf_plan_dft_1d(FftLen, scratch, WorkData, FFTW_BACKWARD, FFTW_MEASURE|FFTW_PRESERVE_INPUT);
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("fftwf_plan_dft_1d()");
+#endif
+ analysis_plans[FftNum] = fftwf_plan_dft_1d(FftLen, scratch, WorkData, FFTW_BACKWARD, FFTW_MEASURE_OR_ESTIMATE|FFTW_PRESERVE_INPUT);
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
#endif
FftNum++;
#ifdef USE_FFTWF
@@ -293,20 +344,32 @@ int seti_analyze (ANALYSIS_STATE& state) {
if ((WorkData == NULL) || (scratch==NULL)) {
SETIERROR(MALLOC_FAILED, "WorkData == NULL || scratch == NULL");
}
- autocorr_plan=fftwf_plan_r2r_1d(ac_fft_len, scratch, out, FFTW_REDFT10, FFTW_MEASURE|FFTW_PRESERVE_INPUT);
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("fftwf_plan_r2r_1d()");
+#endif
+ autocorr_plan=fftwf_plan_r2r_1d(ac_fft_len, scratch, out, FFTW_REDFT10, FFTW_MEASURE_OR_ESTIMATE|FFTW_PRESERVE_INPUT);
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
free_a(scratch);
free_a(out);
}
- wisdom=boinc_fopen("wisdom.sah","w");
+ wisdom=boinc_fopen(wisdom_path.c_str(),"w");
if (wisdom) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("fftwf_export_wisdom_to_string()");
+#endif
char *wiz=fftwf_export_wisdom_to_string();
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
if (wiz) {
fwrite(wiz,strlen(wiz),1,wisdom);
}
fclose(wisdom);
}
-#endif
+#endif /* USE_FFTWF */
if (!state.icfft) {
#ifdef CUSTOM_STRING
@@ -553,11 +616,17 @@ int seti_analyze (ANALYSIS_STATE& state) {
(Ipp32fc*)WorkData,
FftSpec[FftNum], FftBuf);
#elif defined(USE_FFTWF)
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("fftwf_execute_dft()");
+#endif
fftwf_execute_dft(analysis_plans[FftNum], &ChirpedData[CurrentSub], WorkData);
-#else
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
+#else /* !USE_FFTWF */
// replace time with freq - ooura FFT
cdft(fftlen*2, 1, WorkData, BitRevTab[FftNum], CoeffTab[FftNum]);
-#endif
+#endif /* USE_FFTWF */
// replace freq with power
state.FLOP_counter+=(double)fftlen;
@@ -569,7 +638,13 @@ int seti_analyze (ANALYSIS_STATE& state) {
if (fftlen==(long)ac_fft_len) {
state.FLOP_counter+=((double)fftlen)*5*log((double)fftlen)/log(2.0)+2*fftlen;
#if defined(USE_FFTWF)
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("fftwf_execute_r2r()");
+#endif
fftwf_execute_r2r(autocorr_plan,&PowerSpectrum[CurrentSub],AutoCorrelation);
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
#else
#error Analysis needs to be modified for your FFT choice.
#endif
@@ -741,6 +816,9 @@ int seti_analyze (ANALYSIS_STATE& state) {
outfile.close();
//if (retval) SETIERROR(WRITE_FAILED,"from outfile.fflush in seti_analyze()");
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return retval;
}
@@ -751,7 +829,9 @@ int v_BaseLineSmooth(
int BoxCarLength,
int NumPointsInChunk
) {
-
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("v_BaseLineSmooth");
+#endif
// We use a sliding boxcar method for baseline smoothing. Input data
// is the time domain. It is transformed (using a separate array)
// into the frequency domain. After baseline smoothing is done
@@ -814,20 +894,39 @@ int v_BaseLineSmooth(
ippAlgHintAccurate);
#elif defined(USE_FFTWF)
sah_complex *scratch = (sah_complex *)malloc_a(NumPointsInChunk * sizeof(sah_complex),MEM_ALIGN);
-
- backward_transform = fftwf_plan_dft_1d(NumPointsInChunk, scratch, DataOutChunk, FFTW_BACKWARD, FFTW_MEASURE|FFTW_PRESERVE_INPUT);
- forward_transform = fftwf_plan_dft_1d(NumPointsInChunk, DataOutChunk, DataOutChunk, FFTW_FORWARD, FFTW_MEASURE);
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("fftwf_plan_dft_1d()");
+#endif
+ backward_transform = fftwf_plan_dft_1d(NumPointsInChunk, scratch, DataOutChunk, FFTW_BACKWARD, FFTW_MEASURE_OR_ESTIMATE|FFTW_PRESERVE_INPUT);
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+ call_stack.enter("fftwf_plan_dft_1d()");
+#endif
+ forward_transform = fftwf_plan_dft_1d(NumPointsInChunk, DataOutChunk, DataOutChunk, FFTW_FORWARD, FFTW_MEASURE_OR_ESTIMATE);
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
free_a(scratch);
-#else
+#else /* !USE_FFTWF */
BitRevTab = (int*) calloc_a(3+(int)sqrt((float)NumPointsInChunk/2), sizeof(int), MEM_ALIGN);
- if (BitRevTab == NULL) return MALLOC_FAILED;
+ if (BitRevTab == NULL) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
+ return MALLOC_FAILED;
+ }
CoeffTab = (float*) calloc_a(NumPointsInChunk/2, sizeof(float), MEM_ALIGN);
- if (CoeffTab == NULL) return MALLOC_FAILED;
+ if (CoeffTab == NULL) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
+ return MALLOC_FAILED;
+ }
// flag to tell cdft() to init it's work areas
// already done since we used calloc_a();
// BitRevTab[0] = 0;
-#endif
+#endif /* USE_FFTWF */
}
@@ -847,9 +946,15 @@ int v_BaseLineSmooth(
FftSpec, NULL);
#elif !defined(USE_FFTWF)
cdft(NumPointsInChunk*2, 1, DataOutChunk, BitRevTab, CoeffTab);
-#else
+#else /* USE_FFTWF */
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("fftwf_execute_dft()");
+#endif
fftwf_execute_dft(backward_transform,DataInChunk,DataOutChunk);
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
#endif
+#endif /* !USE_FFTWF */
GetPowerSpectrum(
DataOutChunk, PowerSpectrum, NumPointsInChunk
@@ -913,7 +1018,13 @@ int v_BaseLineSmooth(
#elif !defined(USE_FFTWF)
cdft(NumPointsInChunk*2, -1, DataOutChunk, BitRevTab, CoeffTab);
#else
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("fftwf_execute()");
+#endif
fftwf_execute(forward_transform);
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
#endif
analysis_state.FLOP_counter+=10.0*NumPointsInChunk*log((double)NumPointsInChunk)/log(2.0)+10.0*NumPointsInChunk;
// return powers to normal
@@ -923,6 +1034,9 @@ int v_BaseLineSmooth(
}
}
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return 0;
}
@@ -932,6 +1046,9 @@ int v_GetPowerSpectrum(
float* PowerSpectrum,
int NumDataPoints
) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("v_GetPowerSpectrum()");
+#endif
int i;
#ifdef __INTEL_COMPILER
@@ -944,6 +1061,9 @@ int v_GetPowerSpectrum(
PowerSpectrum[i] = FreqData[i][0] * FreqData[i][0]
+ FreqData[i][1] * FreqData[i][1];
}
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return 0;
}
@@ -958,6 +1078,9 @@ int v_ChirpData(
int ul_NumDataPoints,
double sample_rate
) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("v_ChirpData()");
+#endif
int i;
double recip_sample_rate=1.0/sample_rate;
@@ -1014,6 +1137,9 @@ int v_ChirpData(
}
analysis_state.FLOP_counter+=12.0*ul_NumDataPoints;
}
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return 0;
}
#endif // USE_INTEL_OPT_CODE
@@ -1028,6 +1154,9 @@ int v_ChirpData(
void InitTrigArray(int len, double ChirpStep, int InitChirpRateInd,
double SampleRate) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("InitTrigArray()");
+#endif
int i;
double ang, Coef;
@@ -1103,6 +1232,9 @@ void CalcTrigArray (int len, int ChirpRateInd) {
switch ( TempCRateInd - CurrentChirpRateInd ) {
case 0:
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return; // replaces "automatic skip"
case 1:
for ( j = 0; j < len; j++ ) {
@@ -1146,21 +1278,35 @@ void CalcTrigArray (int len, int ChirpRateInd) {
break;
}
CurrentChirpRateInd = TempCRateInd;
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
}
// free TrigStep and CurrentTrig
void FreeTrigArray() {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("FreeTrigArray()");
+#endif
if (TrigStep) free_a(TrigStep);
TrigStep = NULL;
if (CurrentTrig) free_a(CurrentTrig);
CurrentTrig = NULL;
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
}
template <int x>
inline void v_subTranspose(float * __restrict in, float * __restrict out, int xline, int yline) {
+#ifdef USE_MANUAL_CALLSTACK
+ static char name_buf[64];
+ sprintf(name_buf,"v_subtranspose<%d>()",x);
+ call_stack.enter(name_buf);
+#endif
// Transpose an X by X subsection of a XLINE by YLINE matrix into the
// appropriate part of a YLINE by XLINE matrix. "IN" points to the first
// (lowest address) element of the input submatrix. "OUT" points to the
@@ -1180,22 +1326,34 @@ inline void v_subTranspose(float * __restrict in, float * __restrict out, int xl
*p++=tmp[i+j*x];
}
}
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
}
int v_Transpose(int x, int y, float * __restrict in, float * __restrict out) {
// stupidest possible algorithm
// assume in and out can't overlap
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("v_Transpose()");
+#endif
int i,j;
for (j=0;j<y;j++) {
for (i=0;i<x;i++) {
out[i*y+j]=in[j*x+i];
}
}
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return 0;
}
int v_Transpose2(int x, int y, float * __restrict in, float * __restrict out) {
// Attempts to improve cache hit ratio by transposing 4 elements at a time.
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("v_Transpose2()");
+#endif
int i,j;
for (j=0;j<y-1;j+=2) {
for (i=0;i<x-1;i+=2) {
@@ -1210,11 +1368,17 @@ int v_Transpose2(int x, int y, float * __restrict in, float * __restrict out) {
out[i*y+j]=in[j*x+i];
}
}
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return 0;
}
int v_Transpose4(int x, int y, float * __restrict in, float * __restrict out) {
// Attempts to improve cache hit ratio by transposing 16 elements at a time.
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("v_Transpose4()");
+#endif
int i,j;
for (j=0;j<y-3;j+=4) {
for (i=0;i<x-3;i+=4) {
@@ -1240,11 +1404,17 @@ int v_Transpose4(int x, int y, float * __restrict in, float * __restrict out) {
out[i*y+j]=in[j*x+i];
}
}
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return 0;
}
int v_Transpose8(int x, int y, float * __restrict in, float * __restrict out) {
// Attempts to improve cache hit ratio by transposing 64 elements at a time.
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("v_Transpose8()");
+#endif
int i,j;
for (j=0;j<y-7;j+=8) {
for (i=0;i<x-7;i+=8) {
@@ -1284,6 +1454,9 @@ int v_Transpose8(int x, int y, float * __restrict in, float * __restrict out) {
out[i*y+j]=in[j*x+i];
}
}
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return 0;
}
diff --git a/client/analyzeFuncs.h b/client/analyzeFuncs.h
index 18c5328..fe82db7 100644
--- a/client/analyzeFuncs.h
+++ b/client/analyzeFuncs.h
@@ -54,6 +54,7 @@
#define TRIPLET_PROGRESS_FACTOR 0.1f
#define PULSE_PROGRESS_FACTOR(N) (N/14.0f)
*/
+
#define KILOBYTE 1024L
#define MEGABYTE 1048576L
@@ -65,6 +66,8 @@
#define MIN_TRIGARRAY_MEMORY static_cast<double>(64*MEGABYTE)
#endif
+#define FFTW_MEASURE_OR_ESTIMATE ((app_init_data.host_info.m_nbytes >= MIN_TRANSPOSE_MEMORY)?FFTW_MEASURE:FFTW_ESTIMATE)
+
#define PROGRESS_DISPLAY_RES 1.0
// for text-only versions: display progress with every 1%
diff --git a/client/analyzePoT.cpp b/client/analyzePoT.cpp
index bcd73a8..4888eea 100644
--- a/client/analyzePoT.cpp
+++ b/client/analyzePoT.cpp
@@ -73,7 +73,9 @@ int analyze_pot(
int NumDataPoints,
ChirpFftPair_t &cfft
) {
-
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("analyze_pot()");
+#endif
// This function analyses Power over Time for the current data block.
// The PoT array is created by taking an array of power spectra (a
@@ -375,7 +377,9 @@ int analyze_pot(
} // end looking for pulses
-
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return (retval); // no error return point
}
@@ -387,7 +391,9 @@ int GetFixedPoT(
int ul_PoTLen,
int ul_PoT
) {
-
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("GetFixedPoT()");
+#endif
// This routine returns a PoT array of fixed length, regardless
// of the actual number of time bins in the current data block.
@@ -556,11 +562,16 @@ int GetFixedPoT(
} // end for ul_PoT_i < swi.analysis_cfg.gauss_pot_length
analysis_state.FLOP_counter+=(double)(9*swi.analysis_cfg.gauss_pot_length);
}
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return 0;
}
void ComputePoTInfo(int num_cfft, int NumDataPoints) {
-
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("ComputePoTInfo()");
+#endif
// Tis routine calculates various PoT values based on program constants
// and data contained in the current WU.
@@ -620,9 +631,15 @@ void ComputePoTInfo(int num_cfft, int NumDataPoints) {
PoTInfo.GaussTOffsetStart = static_cast<int>(floor(swi.analysis_cfg.pot_t_offset * PoTInfo.GaussSigma+0.5));
PoTInfo.GaussTOffsetStop = swi.analysis_cfg.gauss_pot_length - PoTInfo.GaussTOffsetStart;
}
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
}
void GetPulsePoTLen(long FullPoTLen, int * PulsePoTLen, int * PulseOverlap) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("GetPulsePotLen()");
+#endif
// This routine, given the time axis length of a WU in bins and data available
// in the PoTInfo struct, will calculate how many time bins to pass the pulse
@@ -670,6 +687,8 @@ void GetPulsePoTLen(long FullPoTLen, int * PulsePoTLen, int * PulseOverlap) {
fprintf(stderr, "BinRate = %f\n", BinRate);
fprintf(stderr, "BinsPerBeam = %f\n", BinsPerBeam);
#endif
-
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
}
diff --git a/client/analyzeReport.cpp b/client/analyzeReport.cpp
index 9a893a8..7fd3d8f 100644
--- a/client/analyzeReport.cpp
+++ b/client/analyzeReport.cpp
@@ -75,6 +75,9 @@ int gaussian_count = 0;
void reload_graphics_state() {
#ifdef BOINC_APP_GRAPHICS
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("reload_graphics_state()");
+#endif
if (!nographics()) {
sah_graphics->si.copy(best_spike, true);
sah_graphics->ai.copy(best_autocorr, true);
@@ -82,10 +85,16 @@ void reload_graphics_state() {
sah_graphics->pi.copy(best_pulse, true);
sah_graphics->ti.copy(best_triplet, true);
}
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
#endif
}
void reset_high_scores() {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("reset_high_scores()");
+#endif
if(best_spike) delete(best_spike);
if(best_autocorr) delete(best_autocorr);
if(best_gauss) delete(best_gauss);
@@ -98,14 +107,26 @@ void reset_high_scores() {
best_gauss->score=-12;
best_pulse = new(PULSE_INFO);
best_triplet = new(TRIPLET_INFO);
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
}
static double interpol(double x1,double y1,double x2,double y2, double x) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("interpol()");
+#endif
double slope=(y2-y1)/(x2-x1);
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return slope*(x-x1)+y1;
}
void time_to_ra_dec(double time_jd, double *ra, double *dec) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("time_to_ra_dec()");
+#endif
int i=0;
double raoffs=0;
@@ -140,11 +161,16 @@ void time_to_ra_dec(double time_jd, double *ra, double *dec) {
swi.position_history[i+1].dec,
time_jd
);
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
}
int result_spike(SPIKE_INFO &si) {
-
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("result_spike()");
+#endif
int retval=0;
retval = outfile.printf("%s", si.s.print_xml(0,0,1).c_str());
@@ -160,10 +186,16 @@ int result_spike(SPIKE_INFO &si) {
SETIERROR(RESULT_OVERFLOW,"in result_spike");
}
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return 0;
}
int result_autocorr(AUTOCORR_INFO &ai) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("result_autocorr()");
+#endif
int retval=0;
@@ -180,10 +212,16 @@ int result_autocorr(AUTOCORR_INFO &ai) {
SETIERROR(RESULT_OVERFLOW,"in result_autocorr");
}
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return 0;
}
int result_gaussian(GAUSS_INFO &gi) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("result_gaussian()");
+#endif
int retval=0;
@@ -204,6 +242,9 @@ int result_gaussian(GAUSS_INFO &gi) {
SETIERROR(RESULT_OVERFLOW,"in result_gaussian");
}
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return 0;
}
@@ -213,6 +254,9 @@ int ReportTripletEvent(
float mid_time_bin, int start_time_bin, int freq_bin,
int pot_len,const float *PoT, int write_triplet
) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("ReportTripletEvent()");
+#endif
TRIPLET_INFO ti;
triplet triplet;
int retval=0, i, j;
@@ -324,13 +368,18 @@ BOINCASSERT(_CrtCheckMemory());
#ifdef _WIN32
BOINCASSERT(_CrtCheckMemory());
#endif
-
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return(retval);
}
int ReportPulseEvent(float PulsePower,float MeanPower, float period,
int time_bin,int freq_bin, float snr, float thresh, float *folded_pot,
int scale, int write_pulse) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("ReportPulseEvent()");
+#endif
PULSE_INFO pi;
pulse pulse;
int retval=0, i, len_prof=static_cast<int>(floor(period));
@@ -444,7 +493,9 @@ BOINCASSERT(_CrtCheckMemory());
BOINCASSERT(_CrtCheckMemory());
#endif
-
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return(retval);
}
diff --git a/client/autocorr.cpp b/client/autocorr.cpp
index 397bacd..1c3521a 100644
--- a/client/autocorr.cpp
+++ b/client/autocorr.cpp
@@ -60,6 +60,9 @@ int FindAutoCorrelation(
int fft_num,
SETI_WU_INFO& swi
) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("FindAutoCorrelation()");
+#endif
// Because positive and negative delays are the same
// we only have to look at half the points
int i, j, k, m, retval, blksize;
@@ -145,6 +148,9 @@ int FindAutoCorrelation(
if (retval) SETIERROR(retval,"from result_autocorr()");
}
}
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return 0;
}
diff --git a/client/chirpfft.cpp b/client/chirpfft.cpp
index 0d2e568..62e1812 100644
--- a/client/chirpfft.cpp
+++ b/client/chirpfft.cpp
@@ -64,6 +64,9 @@ size_t GenChirpFftPairs(
ChirpFftPair_t ** ChirpFftPairs,
double * MinChirpStep
) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("GenChirpFftPairs()");
+#endif
long i, j, max_fft_len;
double CRate;
@@ -167,12 +170,17 @@ size_t GenChirpFftPairs(
fflush(stderr);
if (ChirpSteps) free (ChirpSteps);
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return(ChirpFftMap.size());
}
void CalcChirpSteps(double* ChirpSteps, double* MinChirpStep) {
-
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("CalcChirpSteps()");
+#endif
double ChirpRes = swi.analysis_cfg.chirp_resolution;
double NumSamples = swi.nsamples;
double WUDuration = (double)(swi.nsamples/swi.subband_sample_rate);
@@ -223,15 +231,22 @@ void CalcChirpSteps(double* ChirpSteps, double* MinChirpStep) {
*MinChirpStep = ChirpSteps[i];
}
}
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
}
bool VeryClose(double a, double b, double CloseEnough) {
-
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("VeryClose()");
+#endif
double Diff;
Diff = fabs(a - b);
-
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
if(Diff > CloseEnough)
return(false);
else
@@ -240,7 +255,9 @@ bool VeryClose(double a, double b, double CloseEnough) {
int ReadCFftFile(ChirpFftPair_t ** ChirpFftPairs, double * MinChirpStep) {
-
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("ReadCFftFile()");
+#endif
// ChirpFftSet_t ChirpFftSet;
ChirpFftPair_t * ChirpFftPair;
int NumChirpFftPairs;
@@ -268,6 +285,9 @@ int ReadCFftFile(ChirpFftPair_t ** ChirpFftPairs, double * MinChirpStep) {
fclose(cfftfp);
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return(NumChirpFftPairs);
}
diff --git a/client/fft8g.cpp b/client/fft8g.cpp
index 1ed485b..f033987 100644
--- a/client/fft8g.cpp
+++ b/client/fft8g.cpp
@@ -15,10 +15,9 @@ NOTE ON USE BY SETI at HOME : All floating point objects were changed
Also, the following unused transforms were
removed from the source:
rdft: Real Discrete Fourier Transform
- ddct: Discrete Cosine Transform
- ddst: Discrete Sine Transform
- dfct: Cosine Transform of RDFT (Real Symmetric DFT)
- dfst: Sine Transform of RDFT (Real Anti-symmetric DFT)
+ ddst: Discrete Sine Transform
+ dfct: Cosine Transform of RDFT (Real Symmetric DFT)
+ dfst: Sine Transform of RDFT (Real Anti-symmetric DFT)
Modified to use sincosf/sinf/cosf/atanf. Implementations of these are
in sincos.h for machines without
@@ -35,11 +34,7 @@ functions
cdft: Complex Discrete Fourier Transform
function prototypes
void cdft(int, int, float *, int *, float *);
- void rdft(int, int, float *, int *, float *);
void ddct(int, int, float *, int *, float *);
- void ddst(int, int, float *, int *, float *);
- void dfct(int, float *, float *, int *, float *);
- void dfst(int, float *, float *, int *, float *);
-------- Complex DFT (Discrete Fourier Transform) --------
@@ -83,6 +78,45 @@ function prototypes
a[j] *= 1.0 / n;
}
.
+
+------- DCT (Discrete Cosine Transform) / Inverse of DCT --------
+ [definition]
+ <case1> IDCT (excluding scale)
+ C[k] = sum_j=0^n-1 a[j]*cos(pi*j*(k+1/2)/n), 0<=k<n
+ <case2> DCT
+ C[k] = sum_j=0^n-1 a[j]*cos(pi*(j+1/2)*k/n), 0<=k<n
+ [usage]
+ <case1>
+ ip[0] = 0; // first time only
+ ddct(n, 1, a, ip, w);
+ <case2>
+ ip[0] = 0; // first time only
+ ddct(n, -1, a, ip, w);
+ [parameters]
+ n :data length (int)
+ n >= 2, n = power of 2
+ a[0...n-1] :input/output data (float *)
+ output data
+ a[k] = C[k], 0<=k<n
+ ip[0...*] :work area for bit reversal (int *)
+ length of ip >= 2+sqrt(n/2)
+ strictly,
+ length of ip >=
+ 2+(1<<(int)(log(n/2+0.5)/log(2))/2).
+ ip[0],ip[1] are pointers of the cos/sin table.
+ w[0...n*5/4-1] :cos/sin table (float *)
+ w[],ip[] are initialized if ip[0] == 0.
+ [remark]
+ Inverse of
+ ddct(n, -1, a, ip, w);
+ is
+ a[0] *= 0.5;
+ ddct(n, 1, a, ip, w);
+ for (j = 0; j <= n - 1; j++) {
+ a[j] *= 2.0 / n;
+ }
+
+
Appendix :
@@ -93,6 +127,7 @@ Appendix :
#include "sah_config.h"
#include "sincos.h"
#include "s_util.h"
+#include "seti.h"
void fft8g_start() {}
@@ -103,6 +138,9 @@ void cdft(int n, int isgn, sah_complex *aa, int *ip, float *w) {
void bitrv2conj(int n, int *ip, float *a);
void cftfsub(int n, float *a, float *w);
void cftbsub(int n, float *a, float *w);
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("cdft()");
+#endif
float *a=(float *)aa;
@@ -120,8 +158,71 @@ void cdft(int n, int isgn, sah_complex *aa, int *ip, float *w) {
} else if (n == 4) {
cftfsub(n, a, w);
}
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
}
+void ddct(int n, int isgn, float *a, int *ip, float *w)
+{
+ void makewt(int nw, int *ip, float *w);
+ void makect(int nc, int *ip, float *c);
+ void bitrv2(int n, int *ip, float *a);
+ void cftfsub(int n, float *a, float *w);
+ void cftbsub(int n, float *a, float *w);
+ void rftfsub(int n, float *a, int nc, float *c);
+ void rftbsub(int n, float *a, int nc, float *c);
+ void dctsub(int n, float *a, int nc, float *c);
+ int j, nw, nc;
+ float xr;
+
+ nw = ip[0];
+ if (n > (nw << 2)) {
+ nw = n >> 2;
+ makewt(nw, ip, w);
+ }
+ nc = ip[1];
+ if (n > nc) {
+ nc = n;
+ makect(nc, ip, w + nw);
+ }
+ if (isgn < 0) {
+ xr = a[n - 1];
+ for (j = n - 2; j >= 2; j -= 2) {
+ a[j + 1] = a[j] - a[j - 1];
+ a[j] += a[j - 1];
+ }
+ a[1] = a[0] - xr;
+ a[0] += xr;
+ if (n > 4) {
+ rftbsub(n, a, nc, w + nw);
+ bitrv2(n, ip + 2, a);
+ cftbsub(n, a, w);
+ } else if (n == 4) {
+ cftfsub(n, a, w);
+ }
+ }
+ dctsub(n, a, nc, w + nw);
+ if (isgn >= 0) {
+ if (n > 4) {
+ bitrv2(n, ip + 2, a);
+ cftfsub(n, a, w);
+ rftfsub(n, a, nc, w + nw);
+ } else if (n == 4) {
+ cftfsub(n, a, w);
+ }
+ xr = a[0] - a[1];
+ a[0] += a[1];
+ for (j = 2; j < n; j += 2) {
+ a[j - 1] = a[j] - a[j + 1];
+ a[j] += a[j + 1];
+ }
+ a[n - 1] = xr;
+ }
+}
+
+
+
/* -------- initializing routines -------- */
@@ -132,6 +233,9 @@ void makewt(int nw, int *ip, float *w) {
void bitrv2(int n, int *ip, float *a);
int j, nwh;
float delta, x, y;
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("makewt()");
+#endif
ip[0] = nw;
ip[1] = 1;
@@ -159,12 +263,18 @@ void makewt(int nw, int *ip, float *w) {
bitrv2(nw, ip + 2, w);
}
}
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
}
void makect(int nc, int *ip, float *c) {
int j, nch;
float delta;
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("makect()");
+#endif
ip[1] = nc;
if (nc > 1) {
@@ -178,6 +288,9 @@ void makect(int nc, int *ip, float *c) {
c[nc-j]*=0.5f;
}
}
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
}
@@ -187,6 +300,9 @@ void makect(int nc, int *ip, float *c) {
void bitrv2(int n, int *ip, float *a) {
int j, j1, k, k1, l, m, m2;
float xr, xi, yr, yi;
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("bitrv2()");
+#endif
ip[0] = 0;
l = n;
@@ -280,6 +396,9 @@ void bitrv2(int n, int *ip, float *a) {
}
}
}
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
}
@@ -287,6 +406,9 @@ void bitrv2conj(int n, int *ip, float *a) {
int j, j1, k, k1, l, m, m2;
float xr, xi, yr, yi;
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("bitrv2conj()");
+#endif
ip[0] = 0;
l = n;
m = 1;
@@ -388,6 +510,9 @@ void bitrv2conj(int n, int *ip, float *a) {
a[k1 + m2 + 1] = -a[k1 + m2 + 1];
}
}
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
}
@@ -396,6 +521,9 @@ void cftfsub(int n, float *a, float *w) {
void cftmdl(int n, int l, float *a, float *w);
int j, j1, j2, j3, l;
float x0r, x0i, x1r, x1i, x2r, x2i, x3r, x3i;
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("cftfsub()");
+#endif
l = 2;
if (n >= 16) {
@@ -439,6 +567,9 @@ void cftfsub(int n, float *a, float *w) {
a[j1 + 1] = x0i;
}
}
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
}
@@ -449,6 +580,9 @@ void cftbsub(int n, float *a, float *w) {
float wn4r, x0r, x0i, x1r, x1i, x2r, x2i, x3r, x3i,
y0r, y0i, y1r, y1i, y2r, y2i, y3r, y3i,
y4r, y4i, y5r, y5i, y6r, y6i, y7r, y7i;
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("cftbsub");
+#endif
l = 2;
if (n > 16) {
@@ -555,6 +689,9 @@ void cftbsub(int n, float *a, float *w) {
a[j1 + 1] = x0i;
}
}
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
}
@@ -565,6 +702,9 @@ void cft1st(int n, float *a, float *w) {
float x0r, x0i, x1r, x1i, x2r, x2i, x3r, x3i,
y0r, y0i, y1r, y1i, y2r, y2i, y3r, y3i,
y4r, y4i, y5r, y5i, y6r, y6i, y7r, y7i;
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("cftlst()");
+#endif
wn4r = w[2];
x0r = a[0] + a[2];
@@ -769,6 +909,9 @@ void cft1st(int n, float *a, float *w) {
a[j + 13] = wk6r * x0i + wk6i * x0r;
}
}
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
}
@@ -779,6 +922,9 @@ void cftmdl(int n, int l, float *a, float *w) {
float x0r, x0i, x1r, x1i, x2r, x2i, x3r, x3i,
y0r, y0i, y1r, y1i, y2r, y2i, y3r, y3i,
y4r, y4i, y5r, y5i, y6r, y6i, y7r, y7i;
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("cftmdl()");
+#endif
m = l << 3;
wn4r = w[2];
@@ -1011,12 +1157,18 @@ void cftmdl(int n, int l, float *a, float *w) {
}
}
}
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
}
void rftfsub(int n, float *a, int nc, float *c) {
int j, k, kk, ks, m;
float wkr, wki, xr, xi, yr, yi;
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("rftfsub()");
+#endif
m = n >> 1;
ks = 2 * nc / m;
@@ -1035,12 +1187,18 @@ void rftfsub(int n, float *a, int nc, float *c) {
a[k] += yr;
a[k + 1] -= yi;
}
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
}
void rftbsub(int n, float *a, int nc, float *c) {
int j, k, kk, ks, m;
float wkr, wki, xr, xi, yr, yi;
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("rftbsub()");
+#endif
a[1] = -a[1];
m = n >> 1;
@@ -1061,12 +1219,18 @@ void rftbsub(int n, float *a, int nc, float *c) {
a[k + 1] = yi - a[k + 1];
}
a[m + 1] = -a[m + 1];
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
}
void dctsub(int n, float *a, int nc, float *c) {
int j, k, kk, ks, m;
float wkr, wki, xr;
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("dctsub()");
+#endif
m = n >> 1;
ks = nc / n;
@@ -1081,12 +1245,18 @@ void dctsub(int n, float *a, int nc, float *c) {
a[k] = xr;
}
a[m] *= c[0];
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
}
void dstsub(int n, float *a, int nc, float *c) {
int j, k, kk, ks, m;
float wkr, wki, xr;
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("dstsub()");
+#endif
m = n >> 1;
ks = nc / n;
@@ -1101,6 +1271,9 @@ void dstsub(int n, float *a, int nc, float *c) {
a[j] = xr;
}
a[m] *= c[0];
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
}
diff --git a/client/fft8g.h b/client/fft8g.h
index 11ef259..62eb03d 100644
--- a/client/fft8g.h
+++ b/client/fft8g.h
@@ -8,8 +8,4 @@
// $Id: fft8g.h,v 1.3.2.1 2005/05/19 00:42:30 korpela Exp $
void cdft(int, int, sah_complex *, int *, float *);
-void rdft(int, int, float *, int *, float *);
void ddct(int, int, float *, int *, float *);
-void ddst(int, int, float *, int *, float *);
-void dfct(int, float *, float *, int *, float *);
-void dfst(int, float *, float *, int *, float *);
diff --git a/client/gaussfit.cpp b/client/gaussfit.cpp
index 6270f72..27f0919 100644
--- a/client/gaussfit.cpp
+++ b/client/gaussfit.cpp
@@ -81,6 +81,9 @@ float f_GetPeak(
float f_PeakScaleFactor,
float f_weight[]
) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("f_GetPeak()");
+#endif
// Peak power is calculated as the weighted
// sum of all powers within ul_HalfSumLength
// of the assumed gaussian peak.
@@ -99,6 +102,9 @@ float f_GetPeak(
}
analysis_state.FLOP_counter+=6.0*ul_HalfSumLength;
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return(f_sum * f_PeakScaleFactor);
}
@@ -114,6 +120,9 @@ float f_GetChiSq(
// We calculate our assumed gaussian powers
// on the fly as we try to fit them to the
// actual powers at each point along the PoT.
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("f_GetChiSq()");
+#endif
int i;
float f_ChiSq=0,f_null_hyp=0, f_PredictedPower, f_tot_weight=0;
@@ -161,6 +170,9 @@ float f_GetChiSq(
}
#endif
if (xsq_null) *xsq_null=f_null_hyp;
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return f_ChiSq;
}
@@ -172,10 +184,13 @@ float f_GetTrueMean(
int ul_TOffset,
int ul_ExcludeLen
) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("f_GetTrueMean()");
+#endif
// TrueMean is the mean power of the data set minus all power
// out to ExcludeLen from our current TOffset.
int i, i_start, i_lim;
- float f_ExcludePower = 0;
+ float f_ExcludePower = 0,f;
// take care that we do not add to exclude power beyond PoT bounds!
i_start = std::max(ul_TOffset - ul_ExcludeLen, 0);
@@ -185,11 +200,18 @@ float f_GetTrueMean(
}
analysis_state.FLOP_counter+=(double)(i_lim-i_start+5);
- return((f_TotalPower - f_ExcludePower) / (ul_PowerLen - (i - i_start)));
+ f=((f_TotalPower - f_ExcludePower) / (ul_PowerLen - (i - i_start)));
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
+ return f;
}
float f_GetPeakScaleFactor(float f_sigma) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("f_GetPeakScaleFactor()");
+#endif
// The PeakScaleFactor is calculated such that when used in f_GetPeak(),
// the actual peak power can be extracted from a weighted sum.
// This sum (see f_GetPeak()), is calculated as :
@@ -210,6 +232,9 @@ float f_GetPeakScaleFactor(float f_sigma) {
}
analysis_state.FLOP_counter+=(13.0*f_sigma+3);
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return(1 / f_sum);
}
@@ -226,6 +251,9 @@ int ChooseGaussEvent(
float fp_PoT[]
) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("ChooseGaussEvent");
+#endif
GAUSS_INFO gi;
float scale_factor;
bool report, chisqOK=(ChiSq <= swi.analysis_cfg.gauss_chi_sq_thresh);
@@ -300,8 +328,15 @@ int ChooseGaussEvent(
analysis_state.FLOP_counter+=24.0;
// Final reporting.
if (report) {
- return result_gaussian(gi);
+ int retval=result_gaussian(gi);
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
+ return retval;
}
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return 0;
}
@@ -315,6 +350,9 @@ int GaussFit(
BOOLEAN b_IsAPeak;
float f_NormMaxPower;
float f_null_hyp;
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("GaussFit()");
+#endif
int ul_TOffset;
int iSigma = static_cast<int>(floor(PoTInfo.GaussSigma+0.5));
@@ -360,6 +398,9 @@ int GaussFit(
if (!b_IsAPeak) {
//printf("no peak\n");
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return 0; // no peak - bail on this PoT
}
@@ -408,6 +449,9 @@ int GaussFit(
analysis_state.FLOP_counter+=5.0*swi.analysis_cfg.gauss_pot_length+5;
if (f_PeakPower < f_TrueMean*best_gauss->display_power_thresh*0.5f) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return 0; // not even a weak peak at max group - bail on this PoT
}
}
@@ -512,6 +556,9 @@ int GaussFit(
} // End of sliding gaussian
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return 0;
} // End of gaussfit()
diff --git a/client/gdata.cpp b/client/gdata.cpp
index 467cb31..24c7b6b 100644
--- a/client/gdata.cpp
+++ b/client/gdata.cpp
@@ -39,7 +39,15 @@
void G_TRIPLET_INFO::copy(TRIPLET_INFO * ti, bool ib) {
int i;
- if (peak_power==ti->t.peak_power && period==ti->t.period) return;
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("G_TRIPLET_INFO::copy()");
+#endif
+ if (peak_power==ti->t.peak_power && period==ti->t.period) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
+ return;
+ }
peak_power = ti->t.peak_power;
period = ti->t.period;
tpotind0_0 = ti->tpotind0_0;
@@ -56,11 +64,22 @@ void G_TRIPLET_INFO::copy(TRIPLET_INFO * ti, bool ib) {
}
dirty = true;
is_best = ib;
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
}
void G_PULSE_INFO::copy(PULSE_INFO * pi, bool ib) {
int i;
- if (score==pi->score && peak_power==pi->p.peak_power) return;
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("G_PULSE_INFO::copy()");
+#endif
+ if (score==pi->score && peak_power==pi->p.peak_power) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
+ return;
+ }
peak_power = pi->p.peak_power;
period = pi->p.period;
score = pi->score;
@@ -72,11 +91,22 @@ void G_PULSE_INFO::copy(PULSE_INFO * pi, bool ib) {
//}
dirty = true;
is_best = ib;
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
}
void G_GAUSS_INFO::copy(GAUSS_INFO * gi, bool ib) {
size_t i;
- if (score==gi->score && chisqr==gi->g.chisqr) return;
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("G_GAUSS_INFO::copy()");
+#endif
+ if (score==gi->score && chisqr==gi->g.chisqr) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
+ return;
+ }
score = gi->score;
peak_power = gi->g.peak_power;
mean_power = gi->g.mean_power;
@@ -88,6 +118,9 @@ void G_GAUSS_INFO::copy(GAUSS_INFO * gi, bool ib) {
}
dirty = true;
is_best = ib;
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
}
void G_SPIKE_INFO::copy(SPIKE_INFO * si, bool ib) {
diff --git a/client/lcgamm.cpp b/client/lcgamm.cpp
index 791a977..5efdeaa 100644
--- a/client/lcgamm.cpp
+++ b/client/lcgamm.cpp
@@ -48,8 +48,10 @@
/* Log of the complete gamma function */
static double gammln(double a) {
-
- double x,y,tmp,ser;
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("gammln()");
+#endif
+ double x,y,tmp,ser,rv;
static double cof[6]={76.18009172947146,-86.50532032941677,
24.01409824083091,-1.231739572450155,
0.1208650973866179e-2,-0.5395239384953e-5};
@@ -60,7 +62,11 @@ static double gammln(double a) {
tmp -= (x+0.5)*log(tmp);
ser=1.000000000190015;
for (j=0;j<=5;j++) ser += cof[j]/++y;
- return (double)(-tmp+log(2.5066282746310005*ser/x));
+ rv=(double)(-tmp+log(2.5066282746310005*ser/x));
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
+ return rv;
}
/* Log of the compliment of the incomplete gamma function
@@ -68,10 +74,13 @@ static double gammln(double a) {
*/
double lcgf(double a, double x) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("double lcgf()");
+#endif
int i;
const double EPS=std::numeric_limits<double>::epsilon();
const double FPMIN=std::numeric_limits<double>::min()/EPS;
- double an,b,c,d,del,h,gln=gammln(a);
+ double an,b,c,d,del,h,gln=gammln(a),rv;
// assert(x>=(a+1));
BOINCASSERT(x>=(a+1));
@@ -93,10 +102,17 @@ double lcgf(double a, double x) {
}
// assert(i<ITMAX);
BOINCASSERT(i<ITMAX);
- return (float)(log(h)-x+a*log(x)-gln);
+ rv=(float)(log(h)-x+a*log(x)-gln);
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
+ return rv;
}
float lcgf(float a, float x, long& timecalled, long& numcalls) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("float lcgf(float, float, long&, long&)");
+#endif
numcalls++;
static double mytime=0;
long begintime = clock();
@@ -107,17 +123,30 @@ float lcgf(float a, float x, long& timecalled, long& numcalls) {
mytime+=UINT_MAX;
}
timecalled=(long)mytime;
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return rv;
}
static float dlcgf(float a, float x) {
- return (lcgf(a,x+0.1f)-lcgf(a,x-0.1f))/0.2f;
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("float dlcgf()");
+#endif
+ float rv=(lcgf(a,x+0.1f)-lcgf(a,x-0.1f))/0.2f;
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
+ return rv;
}
/* Solve a log(1-P(a,x))=y for x given the value of a and
* allowed fractional error in y of frac_err
*/
float invert_lcgf(float y,float a, float frac_err) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("invert_lcgf()");
+#endif
int j;
float df,dx,dxold,f,fh,fl;
float temp,xh,xl,rts;
@@ -141,23 +170,41 @@ float invert_lcgf(float y,float a, float frac_err) {
dxold=dx;
dx=0.5f*(xh-xl);
rts=xl+dx;
- if ((xl==rts) || (xh==rts)) return rts;
+ if ((xl==rts) || (xh==rts)) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
+ return rts;
+ }
} else {
dxold=dx;
dx=f/df;
temp=rts;
rts-=dx;
- if (temp==rts) return rts;
+ if (temp==rts) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
+ return rts;
+ }
}
f=lcgf(a,rts)-y;
df=dlcgf(a,rts);
- if (fabs(f)<fabs(frac_err*y)) return rts;
+ if (fabs(f)<fabs(frac_err*y)) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
+ return rts;
+ }
if (f<0.0)
xl=rts;
else
xh=rts;
}
BOINCASSERT(ITMAX);
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return 0.0;
}
diff --git a/client/main.cpp b/client/main.cpp
index 6a15962..80a37ac 100644
--- a/client/main.cpp
+++ b/client/main.cpp
@@ -84,6 +84,12 @@
#include <sys/resource.h>
#endif
+#ifdef ANDROID
+#ifdef HAVE_LIBCORKSCREW
+#include <corkscrew/backtrace.h>
+void (* ignore_this)(unsigned, const backtrace_frame_t *, const backtrace_symbol_t *, char *, size_t)=&format_backtrace_line;
+#endif
+#endif
static int g_argc;
static char **g_argv;
@@ -106,12 +112,20 @@ void usage() {
void print_error(int e) {
char* p;
-
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("print_error()");
+#endif /* USE_MANUAL_CALLSTACK */
p = error_string(e);
fprintf(stderr,"%s\n",p);
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif /* USE_MANUAL_CALLSTACK */
}
void print_version() {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("print_version()");
+#endif /* USE_MANUAL_CALLSTACK */
printf(
"SETI at home client.\n"
"Version: %d.%02d\n",
@@ -133,6 +147,9 @@ void print_version() {
"Eric Heien, Eric Korpela, Matt Lebofsky,\n"
"Tetsuji 'Maverick' Rai and Rom Walton\n"
);
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif /* USE_MANUAL_CALLSTACK */
}
extern double sigma_thresh;
@@ -163,6 +180,9 @@ extern APP_INIT_DATA app_init_data;
int main(int argc, char** argv) {
int retval = 0, i;
FORCE_FRAME_POINTER;
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("main()");
+#endif /* USE_MANUAL_CALLSTACK */
run_stage=PREGRX;
g_argc=argc;
#ifdef ANDROID
@@ -170,6 +190,9 @@ int main(int argc, char** argv) {
#endif
if (!(g_argv=(char **)calloc(argc+2,sizeof(char *)))) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif /* USE_MANUAL_CALLSTACK */
exit(MALLOC_FAILED);
}
@@ -185,6 +208,9 @@ int main(int argc, char** argv) {
while (*p=='-') p++;
if (!strncmp(p,"vers",4)) {
print_version();
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif /* USE_MANUAL_CALLSTACK */
exit(0);
} else if (!strncmp(p,"verb",4)) {
verbose = true;
@@ -204,9 +230,15 @@ int main(int argc, char** argv) {
} else {
fprintf(stderr, "bad arg: %s\n", argv[i]);
usage();
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif /* USE_MANUAL_CALLSTACK */
exit(1);
}
}
+#ifdef USE_MANUAL_CALLSTACK
+ if (verbose) call_stack.set_verbose(true);
+#endif /* USE_MANUAL_CALLSTACK */
try {
@@ -252,8 +284,14 @@ int main(int argc, char** argv) {
}
catch (seti_error e) {
e.print();
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif /* USE_MANUAL_CALLSTACK */
exit(static_cast<int>(e));
}
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif /* USE_MANUAL_CALLSTACK */
return 0;
}
@@ -272,12 +310,18 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR Args, int WinMode
LPSTR command_line;
char* argv[100];
int argc, retval;
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("WinMain()");
+#endif /* USE_MANUAL_CALLSTACK */
command_line = GetCommandLine();
argc = parse_command_line(command_line,argv);
retval = main(argc, argv);
- return retval;
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif /* USE_MANUAL_CALLSTACK */
+ return retval;
}
diff --git a/client/malloc_a.cpp b/client/malloc_a.cpp
index 937f58f..0cbce5c 100644
--- a/client/malloc_a.cpp
+++ b/client/malloc_a.cpp
@@ -28,6 +28,7 @@
// $Id: malloc_a.cpp,v 1.6.2.5 2007/05/31 22:03:10 korpela Exp $
#include "sah_config.h"
+#include <cstdio>
#include <cstdlib>
#include <cstring>
#ifdef HAVE_MEMORY_H
@@ -42,6 +43,8 @@
//#include <fftw3.h>
//#endif
+#include "diagnostics.h"
+
#include "malloc_a.h"
// for processor portability (e.g. 32/64/etc, bit processors)
@@ -76,17 +79,22 @@ typedef size_t PointerArith;
//
//
void *malloc_a(size_t size, size_t alignment) {
+ void *palignedMem;
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("malloc_a()");
+#endif
//#if defined(USE_FFTWF)
// return fftwf_malloc(size);
//#elif defined(HAVE__ALIGNED_MALLOC)
#if defined(HAVE__ALIGNED_MALLOC)
- return _aligned_malloc(size,alignment);
+ palignedMem=_aligned_malloc(size,alignment);
+#elif defined(HAVE_POSIX_MEMALIGN)
+ if (posix_memalign(&palignedMem,alignment,size)) palignedMem=NULL;
#elif defined(HAVE_MEMALIGN)
- return memalign(alignment,size);
+ palignedMem=memalign(alignment,size);
#else
PointerArith byteAlignment;
void *pmem;
- void *palignedMem;
void **pp;
// ensure byteAlignment is positive (if alignment is 0, make it 1)
@@ -104,35 +112,54 @@ void *malloc_a(size_t size, size_t alignment) {
pp = (void **) palignedMem;
pp[-1] = pmem; // store original address
- return(palignedMem); // return aligned memory
#endif
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
+ return palignedMem; // return aligned memory
}
//Frees memory that was allocated with malloc_a
void free_a(void *palignedMem) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("free_a()");
+#endif
//#if defined(USE_FFTWF)
// fftwf_free(palignedMem);
//#elif defined(HAVE__ALIGNED_FREE)
#if defined(HAVE__ALIGNED_FREE)
_aligned_free(palignedMem);
-#elif defined(HAVE_MEMALIGN)
+#elif defined(HAVE_MEMALIGN) || defined(HAVE_POSIX_MEMALIGN)
free(palignedMem);
#else
void **pp;
- if (palignedMem == NULL) return;
-
+ if (palignedMem == NULL) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
+ return;
+ }
pp = (void **) palignedMem;
//pp[-1] pts to original address of malloc'd memory
free(pp[-1]);
#endif
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
}
void *calloc_a(size_t size, size_t nitems, size_t alignment) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("calloc_a");
+#endif
void* p = malloc_a(size*nitems, alignment);
if (p)
memset(p, 0, size*nitems);
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return p;
}
diff --git a/client/malloc_a.h b/client/malloc_a.h
index aadde97..46c2541 100644
--- a/client/malloc_a.h
+++ b/client/malloc_a.h
@@ -27,7 +27,7 @@
// $Id: malloc_a.h,v 1.5.2.2 2005/06/26 19:55:43 korpela Exp $
// memory alignment multiple for large arrays
-#define MEM_ALIGN 64
+#define MEM_ALIGN 128
void* malloc_a(size_t size, size_t alignment);
void* calloc_a(size_t size, size_t nitems, size_t alignment);
diff --git a/client/progress.cpp b/client/progress.cpp
index cfae7d3..5a8df3f 100644
--- a/client/progress.cpp
+++ b/client/progress.cpp
@@ -61,22 +61,36 @@ double gauss_units;
// "remaining" is the dominant term for about the final 1/6th of the run.
#define PROG_POWER 6
void fraction_done(double progress,double remaining) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("fraction_done");
+#endif
double prog2=1.0-remaining;
progress=std::min(progress,1.0);
double prog=progress*(1.0-pow(prog2,PROG_POWER))+prog2*pow(prog2,PROG_POWER);
boinc_fraction_done(prog);
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
}
void reset_units() {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("reset_units()");
+#endif
triplet_units=0;
pulse_units=0;
spike_units=0;
gauss_units=0;
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
}
float GetProgressUnitSize(int NumDataPoints, int num_cfft, long ac_fft_len) {
-
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("GetProgressUnitSize()");
+#endif
// A ProgressUnit is defined as the computation time of a
// detection algorithm on the entire data block at a
// given chirpfft pair.
@@ -97,6 +111,7 @@ float GetProgressUnitSize(int NumDataPoints, int num_cfft, long ac_fft_len) {
double TotalPulseProgressUnits = 0.0;
double TotalTripletProgressUnits = 0.0;
double TotalChirpProgressUnits = 0.0;
+ double rv;
NumProgressUnits = 0.0;
for (i = 0; i < num_cfft; i++) {
@@ -151,7 +166,11 @@ float GetProgressUnitSize(int NumDataPoints, int num_cfft, long ac_fft_len) {
*/
// Add a fudge factor of 0.01% to make sure we do not hit 100% done too soon
- return(1.0f/(float)(NumProgressUnits + NumProgressUnits * 0.0001));
+ rv=(1.0f/(float)(NumProgressUnits + NumProgressUnits * 0.0001));
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
+ return rv;
}
@@ -167,28 +186,56 @@ float GetProgressUnitSize(int NumDataPoints, int num_cfft, long ac_fft_len) {
// by FFT length.
double SpikeProgressUnits(int FftLen) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("SpikeProgressUnits()");
+#endif
spike_units+=(1.0+log((double)FftLen)/11.783);
- return (1.0+log((double)FftLen)/11.783);
+ double rv=(1.0+log((double)FftLen)/11.783);
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
+ return rv;
}
double GaussianProgressUnits() {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("GaussianProgressUnits()");
+#endif
gauss_units+=(14.5*0.6);
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return(14.5*0.6);
}
// Pulse finding is an (n^2)log(n) computation. The final factor
// is a scaling factor and can be tuned.
double PulseProgressUnits(double PulsePoTLen, int FftLen) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("PulseProgressUnits()");
+#endif
pulse_units+=(PulsePoTLen * PulsePoTLen * log(PulsePoTLen) * FftLen / 2.65e6/4);
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return(PulsePoTLen * PulsePoTLen * log(PulsePoTLen) * FftLen / 2.65e6/4);
}
double TripletProgressUnits() {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("TripletProgressUnits()");
+#endif
triplet_units+=0.1;
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return(0.1);
}
double ChirpProgressUnits() {
-
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("ChirpProgressUnits()");
+ call_stack.exit();
+#endif
return (2.0);
}
diff --git a/client/pulsefind.cpp b/client/pulsefind.cpp
index 2a1f508..51aad37 100644
--- a/client/pulsefind.cpp
+++ b/client/pulsefind.cpp
@@ -83,6 +83,9 @@
* Written by Eric Heien.
*/
int find_triplets( const float *power, int len_power, float triplet_thresh, int time_bin, int freq_bin ) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("find_triplets()");
+#endif
static int *binsAboveThreshold;
int i,n,numBinsAboveThreshold=0,p,q,blksize;
float midpoint,mean_power=0,peak_power,period,total=0.0f,partial;
@@ -175,6 +178,9 @@ int find_triplets( const float *power, int len_power, float triplet_thresh, int
}
}
analysis_state.FLOP_counter+=(10.0*numBinsAboveThreshold*numBinsAboveThreshold);
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return (0);
}
@@ -189,6 +195,9 @@ int find_triplets( const float *power, int len_power, float triplet_thresh, int
*
*/
float sw_sum3_t31(float *ss[], struct PoTPlan *P) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("sw_sum3_t31()");
+#endif
float sum1, sum2, tmax2, tmax1;
int i = P->di;
float *one = ss[0];
@@ -279,6 +288,9 @@ float sw_sum3_t31(float *ss[], struct PoTPlan *P) {
P->dest[1] = sum1; P->dest[0] = sum2;
if (sum1 > tmax1) tmax1 = sum1; if (sum2 > tmax2) tmax2 = sum2;
}
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
if (tmax1 > tmax2) return tmax1;
return tmax2;
}
@@ -286,6 +298,9 @@ float sw_sum3_t31(float *ss[], struct PoTPlan *P) {
// use for higher sum3 folds
//
float top_sum3(float *ss[], struct PoTPlan *P) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("top_sum3()");
+#endif
float sum1, sum2, tmaxB, tmax;
int i;
float *one = ss[0];
@@ -354,6 +369,9 @@ float top_sum3(float *ss[], struct PoTPlan *P) {
P->dest[i] = sum1;
if (sum1 > tmax) tmax = sum1;
}
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
if (tmax > tmaxB) return tmax;
return tmaxB;
}
@@ -371,6 +389,9 @@ sum_func swi3tb[FOLDTBLEN] = {
//
//
float sw_sum4_t31(float *ss[], struct PoTPlan *P) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("sw_sum4_t31()");
+#endif
float sum1, sum2, tmax2, tmax1;
int i = P->di;
float *one = ss[0];
@@ -477,6 +498,9 @@ float sw_sum4_t31(float *ss[], struct PoTPlan *P) {
P->dest[1] = sum1; P->dest[0] = sum2;
if (sum1 > tmax1) tmax1 = sum1; if (sum2 > tmax2) tmax2 = sum2;
}
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
if (tmax1 > tmax2) return tmax1;
return tmax2;
}
@@ -484,6 +508,9 @@ float sw_sum4_t31(float *ss[], struct PoTPlan *P) {
// use for higher sum4 folds
//
float top_sum4(float *ss[], struct PoTPlan *P) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("top_sum4()");
+#endif
float sum1, sum2, tmaxB, tmax;
int i;
float *one = ss[0];
@@ -547,6 +574,9 @@ float top_sum4(float *ss[], struct PoTPlan *P) {
P->dest[i] = sum1;
if (sum1 > tmax) tmax = sum1;
}
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
if (tmax > tmaxB) return tmax;
return tmaxB;
}
@@ -564,6 +594,9 @@ sum_func swi4tb[FOLDTBLEN] = {
//
//
float sw_sum5_t31(float *ss[], struct PoTPlan *P) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("sw_sum5_t31()");
+#endif
float sum1, sum2, tmax2, tmax1;
int i = P->di;
float *one = ss[0];
@@ -687,6 +720,9 @@ float sw_sum5_t31(float *ss[], struct PoTPlan *P) {
P->dest[1] = sum1; P->dest[0] = sum2;
if (sum1 > tmax1) tmax1 = sum1; if (sum2 > tmax2) tmax2 = sum2;
}
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
if (tmax1 > tmax2) return tmax1;
return tmax2;
}
@@ -694,6 +730,9 @@ float sw_sum5_t31(float *ss[], struct PoTPlan *P) {
// use for higher sum5 folds
//
float top_sum5(float *ss[], struct PoTPlan *P) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("top_sum5()");
+#endif
float sum1, sum2, tmaxB, tmax;
int i;
float *one = ss[0];
@@ -767,6 +806,9 @@ float top_sum5(float *ss[], struct PoTPlan *P) {
P->dest[i] = sum1;
if (sum1 > tmax) tmax = sum1;
}
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
if (tmax > tmaxB) return tmax;
return tmaxB;
}
@@ -785,6 +827,9 @@ sum_func swi5tb[FOLDTBLEN] = {
//
//
float sw_sum2_t31(float *ss[], struct PoTPlan *P) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("sw_sum2_t31");
+#endif
float sum1, sum2, tmax2, tmax1;
int i = P->di;
float *one = ss[1]+P->offset;
@@ -858,6 +903,9 @@ float sw_sum2_t31(float *ss[], struct PoTPlan *P) {
P->dest[1] = sum1; P->dest[0] = sum2;
if (sum1 > tmax1) tmax1 = sum1; if (sum2 > tmax2) tmax2 = sum2;
}
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
if (tmax1 > tmax2) return tmax1;
return tmax2;
}
@@ -865,6 +913,9 @@ float sw_sum2_t31(float *ss[], struct PoTPlan *P) {
// use for higher sum2 folds
//
float top_sum2(float *ss[], struct PoTPlan *P) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("top_sum2()");
+#endif
float sum1, sum2, tmaxB, tmax;
int i;
float *one = ss[1]+P->offset;
@@ -921,6 +972,9 @@ float top_sum2(float *ss[], struct PoTPlan *P) {
P->dest[i] = sum1;
if (sum1 > tmax) tmax = sum1;
}
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
if (tmax > tmaxB) return tmax;
return tmaxB;
}
@@ -1002,6 +1056,9 @@ FoldSet Foldmain = {sumsel3, sumsel4, sumsel5, sumsel2, sumsel2AL, "opt FPU"};
*
*/
int CopyFoldSet(FoldSet *dst, FoldSet *src) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("CopyFoldSet()");
+#endif
int i, j3, j4, j5, j2, j2AL;
j3 = j4 = j5 = j2 = j2AL = 0;
@@ -1034,6 +1091,9 @@ int CopyFoldSet(FoldSet *dst, FoldSet *src) {
} else dst->f2AL[i] = src->f2AL[j2AL];
}
dst->name = src->name;
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return 0;
}
@@ -1051,6 +1111,9 @@ float t_funct(int m, int n, int x) {
float y;
}
*t_funct_tab;
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("t_funct()");
+#endif
float c_dis_thresh = (float)swi.analysis_cfg.pulse_display_thresh;
@@ -1066,6 +1129,9 @@ float t_funct(int m, int n, int x) {
t_funct_tab[x].y = (invert_lcgf((float)(-PoTInfo.PulseThresh - log((float)m)),
(float)n, (float)1e-4) - n) * c_dis_thresh + n;
}
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return t_funct_tab[x].y;
}
@@ -1085,6 +1151,9 @@ int plan_PulsePoT(PoTPlan * PSeq, int PulsePotLen, float *div, int *dbinoffs) {
register float tmp_max,t1;
int res=1;
int k = 0; // plan index
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("plan_PulsePoT()");
+#endif
for (i = 32, ndivs = 1; i <= PulsePotLen; ndivs++, i *= 2);
@@ -1149,6 +1218,9 @@ int plan_PulsePoT(PoTPlan * PSeq, int PulsePotLen, float *div, int *dbinoffs) {
} // for (p = lastP
} // for(num_adds =
PSeq[k].di = 0; // stop
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return (k);
}
@@ -1180,6 +1252,10 @@ int find_pulse(const float * fp_PulsePot, int PulsePotLen,
register float tmp_max,t1;
int res=1;
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("find_pulse()");
+#endif
+
// debug possible heap corruption -- jeffc
#ifdef _WIN32
BOINCASSERT(_CrtCheckMemory());
@@ -1419,6 +1495,9 @@ int find_pulse(const float * fp_PulsePot, int PulsePotLen,
BOINCASSERT(_CrtCheckMemory());
#endif
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return 0;
}
diff --git a/client/pulsefind.h b/client/pulsefind.h
index 8ada742..cc4c093 100644
--- a/client/pulsefind.h
+++ b/client/pulsefind.h
@@ -54,6 +54,10 @@ struct PoTPlan {
// std::max is SLOW
+// - Not really. GCC x64 just generates a "maxsd" instruction for either
+// this macro or std::max(). x86 version generates fucomi followed by,
+// fcmovbe for either. Oh well, it doesn't hurt anything to use a
+// macro.
#define UNSTDMAX(a,b) (((a) > (b)) ? (a) : (b))
#define FOLDTBLEN 32
diff --git a/client/s_util.cpp b/client/s_util.cpp
index 44b5515..c874e46 100644
--- a/client/s_util.cpp
+++ b/client/s_util.cpp
@@ -39,6 +39,7 @@
#include <cmath>
#include <iostream>
#include <sys/stat.h>
+#include "diagnostics.h"
#ifdef HAVE_UNISTD_H
#include <unistd.h>
@@ -83,6 +84,9 @@ void seti_error::print() const {
std::cerr << "File: " << file << std::endl;
std::cerr << "Line: " << line << std::endl;
std::cerr << std::endl;
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.print_stack();
+#endif
}
void strip_cr(char*p ) {
@@ -95,6 +99,9 @@ void strip_cr(char*p ) {
// May read up to two bytes past end.
void encode(unsigned char* bin, int nbytes, FILE* f) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("encode()");
+#endif
int count=0, offset=0, nleft;
unsigned char c0, c1, c2, c3;
for (nleft = nbytes; nleft > 0; nleft -= 3) {
@@ -115,11 +122,17 @@ void encode(unsigned char* bin, int nbytes, FILE* f) {
}
}
fprintf(f, "\n");
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
}
// Read from file, decode into bytes, put in array.
// May write up to two bytes past end of array.
int decode(unsigned char* bin, int nbytes, FILE* f) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("decode()");
+#endif
unsigned char buf[256], *p, c0, c1, c2;
int i, n, m, nleft = nbytes, offset=0;
int nbadlines = 0;
@@ -160,12 +173,18 @@ int decode(unsigned char* bin, int nbytes, FILE* f) {
nleft -= 3;
}
}
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return 0;
}
// Read from file, put in array.
int read_bin_data(unsigned char* bin, int nbytes, FILE* f) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("read_bin_data()");
+#endif
int i;
size_t n;
@@ -175,6 +194,9 @@ int read_bin_data(unsigned char* bin, int nbytes, FILE* f) {
SETIERROR(BAD_BIN_READ,"file ended too soon");
}
}
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return 0;
}
@@ -182,6 +204,9 @@ int read_bin_data(unsigned char* bin, int nbytes, FILE* f) {
// see the doc on binary data representation
void bits_to_floats(unsigned char* raw, sah_complex* data, int nsamples) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("bits_to_floats");
+#endif
int i, j, k=0;
unsigned char c;
@@ -195,11 +220,17 @@ void bits_to_floats(unsigned char* raw, sah_complex* data, int nsamples) {
c >>= 2;
}
}
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
}
int float_to_uchar(float float_element[], unsigned char char_element[],
long num_elements, float scale_factor) {
long i, test_int;
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("float_to_uchar()");
+#endif
for(i = 0; i < num_elements; i++) {
test_int = ROUND(float_element[i]/scale_factor);
@@ -208,10 +239,16 @@ int float_to_uchar(float float_element[], unsigned char char_element[],
else
char_element[i] = test_int < 0 ? 0 : 255;
}
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return 0;
}
char* error_string(int e) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("error_string()");
+#endif
char* p;
static char buf[256];
@@ -229,8 +266,15 @@ char* error_string(int e) {
case BAD_HEADER: p = "Bad file header"; break;
case BAD_DECODE: p = "Can't decode data"; break;
- default: sprintf(buf, "Unknown error %d", e) ; return buf;
+ default: sprintf(buf, "Unknown error %d", e);
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
+ return buf;
}
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return p;
}
diff --git a/client/sah_gfx.cpp b/client/sah_gfx.cpp
index 1351612..8a48d79 100644
--- a/client/sah_gfx.cpp
+++ b/client/sah_gfx.cpp
@@ -129,9 +129,6 @@
#include "gutil.h"
#include "timecvt.h"
#include "sah_gfx.h"
-#ifdef __arm__
-#include "vector/fp_arm.h"
-#endif
bool mouse_down = false;
int mouse_x, mouse_y;
diff --git a/client/seti.cpp b/client/seti.cpp
index 4b53a5d..c4a6861 100644
--- a/client/seti.cpp
+++ b/client/seti.cpp
@@ -100,12 +100,18 @@ SPIKE_INFO::SPIKE_INFO(const SPIKE_INFO &si) : track_mem<SPIKE_INFO>("SPIKE_INFO
s(si.s), score(si.score), bin(si.bin), fft_ind(si.fft_ind) {}
SPIKE_INFO &SPIKE_INFO::operator =(const SPIKE_INFO &si) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("SPIKE_INFO::operator =");
+#endif
if (&si != this) {
s=si.s;
score=si.score;
bin=si.bin;
fft_ind=si.fft_ind;
}
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return *this;
}
@@ -117,12 +123,18 @@ AUTOCORR_INFO::AUTOCORR_INFO(const AUTOCORR_INFO &ai) : track_mem<AUTOCORR_INFO>
a(ai.a), score(ai.score), bin(ai.bin), fft_ind(ai.fft_ind) {}
AUTOCORR_INFO &AUTOCORR_INFO::operator =(const AUTOCORR_INFO &ai) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("AUTOCORR_INFO::operator =");
+#endif
if (&ai != this) {
a=ai.a;
score=ai.score;
bin=ai.bin;
fft_ind=ai.fft_ind;
}
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return *this;
}
@@ -138,17 +150,26 @@ g(gi.g), score(gi.score), bin(gi.bin), fft_ind(gi.fft_ind) {
}
GAUSS_INFO &GAUSS_INFO::operator =(const GAUSS_INFO &gi) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("GAUSS_INFO::operator =");
+#endif
if (&gi != this) {
g=gi.g;
score=gi.score;
bin=gi.bin;
fft_ind=gi.fft_ind;
}
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return *this;
}
PULSE_INFO::PULSE_INFO() : track_mem<PULSE_INFO>("PULSE_INFO"), p(), score(0), freq_bin(0), time_bin(0) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("PULSE_INFO::PULSE_INFO()");
+#endif
// debug possible heap corruption -- jeffc
#ifdef _WIN32
BOINCASSERT(_CrtCheckMemory());
@@ -163,7 +184,9 @@ BOINCASSERT(_CrtCheckMemory());
#ifdef _WIN32
BOINCASSERT(_CrtCheckMemory());
#endif
-
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
}
@@ -172,7 +195,9 @@ PULSE_INFO::~PULSE_INFO() {
#ifdef _WIN32
BOINCASSERT(_CrtCheckMemory());
#endif
-
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("PULSE_INFO::~PULSE_INFO()");
+#endif
free_a(pot_min);
free_a(pot_max);
@@ -180,13 +205,17 @@ BOINCASSERT(_CrtCheckMemory());
#ifdef _WIN32
BOINCASSERT(_CrtCheckMemory());
#endif
-
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
}
PULSE_INFO::PULSE_INFO(const PULSE_INFO &pi) : track_mem<PULSE_INFO>("PULSE_INFO"),
p(pi.p), score(pi.score), freq_bin(pi.freq_bin), time_bin(pi.time_bin) {
-
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("PULSE_INFO::PULSE_INFO(const PULSE_INFO &pi)");
+#endif
// debug possible heap corruption -- jeffc
#ifdef _WIN32
BOINCASSERT(_CrtCheckMemory());
@@ -204,11 +233,15 @@ BOINCASSERT(_CrtCheckMemory());
#ifdef _WIN32
BOINCASSERT(_CrtCheckMemory());
#endif
-
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
}
PULSE_INFO &PULSE_INFO::operator =(const PULSE_INFO &pi) {
-
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("PULSE_INFO::operator =");
+#endif
// debug possible heap corruption -- jeffc
#ifdef _WIN32
BOINCASSERT(_CrtCheckMemory());
@@ -228,7 +261,9 @@ BOINCASSERT(_CrtCheckMemory());
#ifdef _WIN32
BOINCASSERT(_CrtCheckMemory());
#endif
-
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return *this;
}
@@ -236,7 +271,9 @@ TRIPLET_INFO::TRIPLET_INFO() : track_mem<TRIPLET_INFO>("TRIPLET_INFO"),
t(), score(0), bperiod(0), freq_bin(0), tpotind0_0(0), tpotind0_1(0),
tpotind1_0(0), tpotind1_1(0), tpotind2_0(0), tpotind2_1(0), time_bin(0),
scale(0) {
-
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("TRIPLET_INFO::TRIPLET_INFO()");
+#endif
// debug possible heap corruption -- jeffc
#ifdef _WIN32
BOINCASSERT(_CrtCheckMemory());
@@ -251,7 +288,9 @@ BOINCASSERT(_CrtCheckMemory());
#ifdef _WIN32
BOINCASSERT(_CrtCheckMemory());
#endif
-
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
}
TRIPLET_INFO::TRIPLET_INFO(const TRIPLET_INFO &ti) : track_mem<TRIPLET_INFO>("TRIPLET_INFO"), t(ti.t), score(ti.score),
@@ -263,7 +302,9 @@ TRIPLET_INFO::TRIPLET_INFO(const TRIPLET_INFO &ti) : track_mem<TRIPLET_INFO>("TR
time_bin(ti.time_bin), scale(ti.scale)
{
-
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("TRIPLET_INFO::TRIPLET_INFO(const TRIPLET_INFO &ti)");
+#endif
// debug possible heap corruption -- jeffc
#ifdef _WIN32
BOINCASSERT(_CrtCheckMemory());
@@ -280,11 +321,15 @@ BOINCASSERT(_CrtCheckMemory());
#ifdef _WIN32
BOINCASSERT(_CrtCheckMemory());
#endif
-
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
}
TRIPLET_INFO &TRIPLET_INFO::operator =(const TRIPLET_INFO &ti) {
-
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("TRIPLET_INFO::operator =");
+#endif
// debug possible heap corruption -- jeffc
#ifdef _WIN32
BOINCASSERT(_CrtCheckMemory());
@@ -311,13 +356,17 @@ BOINCASSERT(_CrtCheckMemory());
#ifdef _WIN32
BOINCASSERT(_CrtCheckMemory());
#endif
-
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return *this;
}
TRIPLET_INFO::~TRIPLET_INFO() {
-
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("TRIPLET_INFO::~TRIPLET_INFO()");
+#endif
// debug possible heap corruption -- jeffc
#ifdef _WIN32
BOINCASSERT(_CrtCheckMemory());
@@ -330,7 +379,9 @@ BOINCASSERT(_CrtCheckMemory());
#ifdef _WIN32
BOINCASSERT(_CrtCheckMemory());
#endif
-
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
}
@@ -338,6 +389,9 @@ BOINCASSERT(_CrtCheckMemory());
// - prepare outfile for appending
// - reset scores
int seti_init_state() {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("seti_init_state()");
+#endif
analysis_state.icfft= 0;
analysis_state.PoT_freq_bin = -1;
analysis_state.PoT_activity = POT_INACTIVE;
@@ -347,7 +401,9 @@ int seti_init_state() {
boinc_resolve_filename_s(OUTFILE_FILENAME, path);
if (outfile.open(path.c_str(), "ab")) SETIERROR(CANT_CREATE_FILE," in seti_init_state()");
-
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return 0;
}
@@ -393,7 +449,9 @@ int result_group_end() {
int checkpoint(BOOLEAN force_checkpoint) {
-
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("checkpoint()");
+#endif
int retval=0, i, l=xml_indent_level;
xml_indent_level=0;
// Making state_file static to avoid overhead of reallocating of buffers on
@@ -405,7 +463,12 @@ int checkpoint(BOOLEAN force_checkpoint) {
// The user may have set preferences for a long time between
// checkpoints to reduce disk access.
if (!force_checkpoint) {
- if (!boinc_time_to_checkpoint()) return CHECKPOINT_SKIPPED;
+ if (!boinc_time_to_checkpoint()) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
+ return CHECKPOINT_SKIPPED;
+ }
}
fflush(stderr);
@@ -654,7 +717,9 @@ BOINCASSERT(_CrtCheckMemory());
#ifdef _WIN32
BOINCASSERT(_CrtCheckMemory());
#endif
-
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return 0;
}
@@ -681,7 +746,9 @@ int parse_state_file(ANALYSIS_STATE& as) {
int ncfft, fl, PoT_freq_bin, PoT_activity;
double cr=0,flops=0;
FILE* state_file;
-
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("parse_state_file()");
+#endif
// debug possible heap corruption -- jeffc
#ifdef _WIN32
BOINCASSERT(_CrtCheckMemory());
@@ -924,7 +991,9 @@ BOINCASSERT(_CrtCheckMemory());
#ifdef _WIN32
BOINCASSERT(_CrtCheckMemory());
#endif
-
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return 0;
}
@@ -933,7 +1002,9 @@ BOINCASSERT(_CrtCheckMemory());
// On exit, these are freed and closed
int seti_do_work() {
int retval=0;
-
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("seti_do_work()");
+#endif
retval = seti_analyze(analysis_state);
free_a(analysis_state.data);
analysis_state.data = 0;
@@ -942,7 +1013,9 @@ int seti_do_work() {
free_a(analysis_state.savedWUData);
analysis_state.savedWUData = 0;
}
-
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return retval;
}
@@ -955,6 +1028,9 @@ int seti_parse_data(FILE* f, ANALYSIS_STATE& state) {
sah_complex *bin_data=0;
int retval=0;
FORCE_FRAME_POINTER;
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("seti_parse_data()");
+#endif
nsamples = swi.nsamples;
samples_per_byte=(8/swi.bits_per_sample);
@@ -1017,18 +1093,30 @@ int seti_parse_data(FILE* f, ANALYSIS_STATE& state) {
sah_graphics->ready = true;
}
#endif
-
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return 0;
}
int seti_parse_wu(FILE* f, ANALYSIS_STATE& state) {
int retval=0;
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("seti_parse_wu()");
+#endif
retval = seti_parse_wu_header(f);
if (retval) SETIERROR(retval,"from seti_parse_wu_header()");
- return seti_parse_data(f, state);
+ retval=seti_parse_data(f, state);
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
+ return retval;
}
void final_report() {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("final_report()");
+#endif
fprintf(stderr,"\nFlopcounter: %f\n\n", analysis_state.FLOP_counter);
fprintf(stderr,"Spike count: %d\n", spike_count);
fprintf(stderr,"Autocorr count: %d\n", autocorr_count);
@@ -1036,16 +1124,27 @@ void final_report() {
fprintf(stderr,"Triplet count: %d\n", triplet_count);
fprintf(stderr,"Gaussian count: %d\n", gaussian_count);
fflush(stderr);
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
}
unsigned int pow2(unsigned int num){
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("pow2()");
+#endif
unsigned int n = num > 0 ? num - 1 : 0;
n |= n >> 1;
n |= n >> 2;
n |= n >> 4;
n |= n >> 8;
n |= n >> 16;
+#if SIZEOF_INT > 4
+ n |= n >> 32;
+#endif
n++;
-
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return n >> 1;
}
diff --git a/client/seti.h b/client/seti.h
index cdb1499..db55e3d 100644
--- a/client/seti.h
+++ b/client/seti.h
@@ -34,6 +34,7 @@
#endif
#include <vector>
#include "boinc_api.h"
+#include "diagnostics.h"
extern APP_INIT_DATA app_init_data;
diff --git a/client/seti_header.cpp b/client/seti_header.cpp
index 979a539..79c9a80 100644
--- a/client/seti_header.cpp
+++ b/client/seti_header.cpp
@@ -92,6 +92,9 @@ SETI_WU_INFO::SETI_WU_INFO(const workunit &w) :
analysis_cfg(w.group_info->analysis_cfg),
beam_width(w.group_info->receiver_cfg->beam_width),
wu(&w) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("SETI_WU_INFO::SETI_WU_INFO(const workunit &w)");
+#endif /* USE_MANUAL_CALLSTACK */
if (!strcmp(w.group_info->splitter_cfg->data_type,"ascii")) data_type = DATA_ASCII;
else if (!strcmp(w.group_info->splitter_cfg->data_type,"encoded")) data_type = DATA_ENCODED;
else if (!strcmp(w.group_info->splitter_cfg->data_type,"sun_binary")) data_type = DATA_SUN_BINARY;
@@ -99,6 +102,9 @@ wu(&w) {
splitter_version+=(int)((w.group_info->splitter_cfg->version)*0x100) && 0xff;
angle_range=true_angle_range;
sprintf(tape_version,"%8.2f",w.group_info->recorder_cfg->version);
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif /* USE_MANUAL_CALLSTACK */
}
SETI_WU_INFO::SETI_WU_INFO() :
@@ -157,14 +163,26 @@ wu(s.wu) {
}
int seti_write_wu_header(FILE *file, int output_xml) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("seti_write_wu_header()");
+#endif /* USE_MANUAL_CALLSTACK */
fprintf(file,"%s",swi.wu->print_xml().c_str());
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif /* USE_MANUAL_CALLSTACK */
return 0;
}
int seti_write_wu_header(FILE *file, int output_xml, SETI_WU_INFO &swi) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("seti_write_wu_header()");
+#endif /* USE_MANUAL_CALLSTACK */
fprintf(file,"%s",swi.wu->print_xml().c_str());
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif /* USE_MANUAL_CALLSTACK */
return 0;
}
@@ -175,6 +193,9 @@ static workunit *wu;
int seti_parse_wu_header(FILE* f) {
char buf[256];
int found=0;
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("seti_parse_wu_header(FILE *)");
+#endif /* USE_MANUAL_CALLSTACK */
std::string buffer("");
buffer.reserve(10*1024);
@@ -206,10 +227,16 @@ int seti_parse_wu_header(FILE* f) {
if (!swi.data_type || !found || !swi.nsamples) {
SETIERROR(BAD_HEADER, "!swi.data_type || !found || !swi.nsamples");
}
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif /* USE_MANUAL_CALLSTACK */
return 0;
}
int seti_parse_wu_header(FILE* f, SETI_WU_INFO &swi) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("seti_parse_wu_header(FILE *, SETI_WU_INFO &)");
+#endif /* USE_MANUAL_CALLSTACK */
char buf[256];
int found=0;
@@ -242,6 +269,9 @@ int seti_parse_wu_header(FILE* f, SETI_WU_INFO &swi) {
if (!swi.data_type || !found || !swi.nsamples) {
SETIERROR(BAD_HEADER, "!swi.data_type || !found || !swi.nsamples");
}
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif /* USE_MANUAL_CALLSTACK */
return 0;
}
diff --git a/client/spike.cpp b/client/spike.cpp
index 8d3b45c..1c48ff6 100644
--- a/client/spike.cpp
+++ b/client/spike.cpp
@@ -60,6 +60,9 @@ int FindSpikes(
int fft_num,
SETI_WU_INFO& swi
) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("FindSpikes()");
+#endif
//int i, j, k, m, bin, retval;
int i, j, k, m, retval, blksize;
float temp, partial;
@@ -142,6 +145,9 @@ int FindSpikes(
if (retval) SETIERROR(retval,"from result_spike()");
}
}
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return 0;
}
diff --git a/client/timecvt.cpp b/client/timecvt.cpp
index 25abcce..2320e8c 100644
--- a/client/timecvt.cpp
+++ b/client/timecvt.cpp
@@ -47,6 +47,7 @@
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
+#include "diagnostics.h"
#include "util.h"
@@ -65,6 +66,9 @@ static void trim_newline(char*p) {
char* jd_string(double jd) {
static char buf[256], datestr[64];
time_t tmptime;
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("jd_string");
+#endif /* USE_MANUAL_CALLSTACK */
if ( jd > JD0 ) {
tmptime=jd_to_time_t(jd);
@@ -74,6 +78,9 @@ char* jd_string(double jd) {
} else {
sprintf(buf,"%14.5f",jd);
}
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif /* USE_MANUAL_CALLSTACK */
return buf;
}
@@ -82,6 +89,9 @@ char* jd_string(double jd) {
char* short_jd_string(double jd) {
static char buf[256];
time_t tmptime;
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("short_jd_string()");
+#endif /* USE_MANUAL_CALLSTACK */
if ( jd > JD0) {
tmptime=jd_to_time_t(jd);
@@ -90,10 +100,16 @@ char* short_jd_string(double jd) {
} else {
strlcpy(buf,"Unknown",sizeof(buf));
}
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif /* USE_MANUAL_CALLSTACK */
return buf;
}
void st_to_ut(TIME *st) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("st_to_ut()");
+#endif /* USE_MANUAL_CALLSTACK */
double hour=((double)st->h)+((double)st->m)/60+((double)st->s)/3600
+((double)st->c)/360000;
if (st->tz !=0) {
@@ -126,14 +142,23 @@ void st_to_ut(TIME *st) {
hour*=100;
st->c=(int)hour;
}
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif /* USE_MANUAL_CALLSTACK */
}
double ut_to_jd(long year, long month, long day, double hour) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("ut_to_jd");
+#endif /* USE_MANUAL_CALLSTACK */
double jd;
long l=(month-14)/12;
jd=(double)(day-32075L+1461L*(year+4800L+l)/4+367l*(month-2-l*12)/12-
3*((year+4900l+l)/100)/4);
jd+=(hour/24-0.5);
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif /* USE_MANUAL_CALLSTACK */
return(jd);
}
@@ -147,6 +172,9 @@ time_t jd_to_time_t(double jd) {
void st_time_convert(TIME *st) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("st_time_convert");
+#endif /* USE_MANUAL_CALLSTACK */
/* Fix Y2K Bug */
if (st->y < 90) {
st->y+=2000;
@@ -166,7 +194,9 @@ void st_time_convert(TIME *st) {
/* Fill in unix_time field */
st->unix_time=jd_to_time_t(st->jd);
-
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif /* USE_MANUAL_CALLSTACK */
}
void timecvt_end() {}
diff --git a/client/vector/analyzeFuncs_altivec.cpp b/client/vector/analyzeFuncs_altivec.cpp
index 105aba7..6995103 100644
--- a/client/vector/analyzeFuncs_altivec.cpp
+++ b/client/vector/analyzeFuncs_altivec.cpp
@@ -56,7 +56,7 @@
#define CC2 ((vector float) (0.2465220241))
#define CC3 ((vector float) (-0.0123926179))
-#define ZERO ((vector float) (0))
+#define ZERO ((vector float) (0))
#define ONE ((vector float) (1.0))
#define TWO ((vector float) (2.0))
#define RECIP_TWO ((vector float) (0.5))
@@ -65,7 +65,7 @@
#define RECIP_FIVE ((vector float) (0.2))
// 2^52 (used by quickRound)
-#define TWO_TO_52 4.503599627370496e15
+#define TWO_TO_52 4.503599627370496e15
@@ -75,53 +75,96 @@ static bool hasAltiVec=false;
bool AltiVec_Available( void )
{
if (!checked) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("AltiVec_Available()");
+#endif
checked=true;
long cpuAttributes;
OSErr err = Gestalt( gestaltPowerPCProcessorFeatures, &cpuAttributes );
if( noErr == err )
hasAltiVec = ( 1 << gestaltPowerPCHasVectorInstructions) & cpuAttributes;
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
}
return hasAltiVec;
}
inline vector float vec_fpsplat(float f_Constant) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("vec_fpsplat()");
+#endif
vector unsigned char vuc_Splat;
vector float vf_Constant;
vuc_Splat = vec_lvsl(0, &f_Constant);
vf_Constant = vec_lde(0, &f_Constant);
vuc_Splat = (vector unsigned char) vec_splat((vector float) vuc_Splat, 0);
vf_Constant = vec_perm(vf_Constant, vf_Constant, vuc_Splat);
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return vf_Constant;
}
inline vector float vec_rsqrt(vector float v) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("vec_rsqrt()");
+#endif
const vector float _0 = (vector float)(-.0);
// obtain estimate
vector float y = vec_rsqrte(v);
// two rounds of Newton-Raphson
y = vec_madd(vec_nmsub(v,vec_madd(y,y,_0),(vector float)(1.0)),vec_madd(y,(vector float)(0.5),_0),y);
y = vec_madd(vec_nmsub(v,vec_madd(y,y,_0),(vector float)(1.0)),vec_madd(y,(vector float)(0.5),_0),y);
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return y;
}
inline vector float vec_sqrt(vector float v) {
+ vector float y;
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("vec_rsqrt()");
+#endif
const vector float _0 = (vector float)(-.0);
- return vec_sel(vec_madd(v,vec_rsqrt(v),_0),_0,vec_cmpeq(v,_0));
+ y=vec_sel(vec_madd(v,vec_rsqrt(v),_0),_0,vec_cmpeq(v,_0));
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
+ return y;
}
inline vector float vec_recip(vector float v) {
// obtain estimate
vector float estimate = vec_re( v );
+ vector float y;
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("vec_recip");
+#endif
// one round of Newton-Raphson
- return vec_madd( vec_nmsub( estimate, v, (vector float) (1.0) ), estimate, estimate );
+ y=vec_madd( vec_nmsub( estimate, v, (vector float) (1.0) ), estimate, estimate );
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
+ return y;
}
int v_vTranspose(int i, int j, float *in, float *out) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("v_vTranspose");
+#endif
if (AltiVec_Available()) {
vSgetmo(j, i, (vector float *) in, (vector float *) out);
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return 0;
} else {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return UNSUPPORTED_FUNCTION;
}
}
@@ -137,6 +180,9 @@ int v_vGetPowerSpectrum(
if (!AltiVec_Available()) return UNSUPPORTED_FUNCTION;
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("v_vGetPowerSpectrum()");
+#endif
analysis_state.FLOP_counter+=3.0*NumDataPoints;
vEnd = NumDataPoints - (NumDataPoints & 3);
@@ -160,6 +206,9 @@ int v_vGetPowerSpectrum(
PowerSpectrum[i] = FreqData[i][0] * FreqData[i][0]
+ FreqData[i][1] * FreqData[i][1];
}
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return 0;
}
@@ -174,6 +223,9 @@ int v_vGetPowerSpectrumG4(
const vector unsigned char imag = (vector unsigned char) (4, 5, 6, 7, 12, 13, 14, 15, 20, 21, 22, 23, 28, 29, 30, 31);
if (!AltiVec_Available()) return UNSUPPORTED_FUNCTION;
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("v_vGetPowerSpectrumG4()");
+#endif
analysis_state.FLOP_counter+=3.0*NumDataPoints;
vEnd = NumDataPoints - (NumDataPoints & 15);
@@ -239,6 +291,9 @@ int v_vGetPowerSpectrumG4(
PowerSpectrum[i] = FreqData[i][0] * FreqData[i][0]
+ FreqData[i][1] * FreqData[i][1];
}
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return 0;
}
@@ -261,7 +316,14 @@ int v_vGetPowerSpectrumG4(
inline double
quickRound(double x, double roundVal)
{
- return (x + roundVal) - roundVal;
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("quickRound()");
+#endif
+ double rv=(x + roundVal) - roundVal;
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
+ return rv;
}
@@ -301,7 +363,11 @@ int v_vChirpData(
int i;
if (!AltiVec_Available()) return UNSUPPORTED_FUNCTION;
-
+
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("v_vChirpData()");
+#endif
+
if (chirp_rate_ind == 0) {
memcpy(cx_ChirpDataArray,
cx_DataArray,
@@ -310,7 +376,7 @@ int v_vChirpData(
} else {
int vEnd;
const vector unsigned char real = (vector unsigned char) (0, 1, 2, 3, 8, 9, 10, 11, 16, 17, 18, 19, 24, 25, 26, 27);
- const vector unsigned char imag = (vector unsigned char) (4, 5, 6, 7, 12, 13, 14, 15, 20, 21, 22, 23, 28, 29, 30, 31);
+ const vector unsigned char imag = (vector unsigned char) (4, 5, 6, 7, 12, 13, 14, 15, 20, 21, 22, 23, 28, 29, 30, 31);
double rate = chirp_rate * 0.5 / (sample_rate * sample_rate);
double roundVal = rate >= 0.0 ? TWO_TO_52 : -TWO_TO_52;
@@ -440,7 +506,7 @@ int v_vChirpData(
vec_st(cd2, 16, c);
vec_st(cd3, 32, c);
vec_st(cd4, 48, c);
- }
+ }
// handle tail elements with scalar code
for (; i < ul_NumDataPoints; ++i) {
@@ -455,6 +521,9 @@ int v_vChirpData(
}
analysis_state.FLOP_counter+=12.0*ul_NumDataPoints;
}
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return 0;
}
@@ -471,6 +540,9 @@ int v_vChirpDataG4(
int i;
if (!AltiVec_Available()) return UNSUPPORTED_FUNCTION;
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("v_vChirpDataG4()");
+#endif
if (chirp_rate_ind == 0) {
memcpy(cx_ChirpDataArray,
cx_DataArray,
@@ -479,7 +551,7 @@ int v_vChirpDataG4(
} else {
int vEnd;
const vector unsigned char real = (vector unsigned char) (0, 1, 2, 3, 8, 9, 10, 11, 16, 17, 18, 19, 24, 25, 26, 27);
- const vector unsigned char imag = (vector unsigned char) (4, 5, 6, 7, 12, 13, 14, 15, 20, 21, 22, 23, 28, 29, 30, 31);
+ const vector unsigned char imag = (vector unsigned char) (4, 5, 6, 7, 12, 13, 14, 15, 20, 21, 22, 23, 28, 29, 30, 31);
double rate = chirp_rate * 0.5 / (sample_rate * sample_rate);
double roundVal = rate >= 0.0 ? TWO_TO_52 : -TWO_TO_52;
@@ -616,7 +688,7 @@ int v_vChirpDataG4(
vec_st(cd2, 16, c);
vec_st(cd3, 32, c);
vec_st(cd4, 48, c);
- }
+ }
// handle tail elements with scalar code
for (; i < ul_NumDataPoints; ++i) {
@@ -631,6 +703,9 @@ int v_vChirpDataG4(
}
analysis_state.FLOP_counter+=12.0*ul_NumDataPoints;
}
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return 0;
}
@@ -647,6 +722,10 @@ int v_vChirpDataG5(
int i;
if (!AltiVec_Available()) return UNSUPPORTED_FUNCTION;
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("v_vChirpDataG5()");
+#endif
+
if (chirp_rate_ind == 0) {
memcpy(cx_ChirpDataArray,
cx_DataArray,
@@ -655,7 +734,7 @@ int v_vChirpDataG5(
} else {
int vEnd;
const vector unsigned char real = (vector unsigned char) (0, 1, 2, 3, 8, 9, 10, 11, 16, 17, 18, 19, 24, 25, 26, 27);
- const vector unsigned char imag = (vector unsigned char) (4, 5, 6, 7, 12, 13, 14, 15, 20, 21, 22, 23, 28, 29, 30, 31);
+ const vector unsigned char imag = (vector unsigned char) (4, 5, 6, 7, 12, 13, 14, 15, 20, 21, 22, 23, 28, 29, 30, 31);
double rate = chirp_rate * 0.5 / (sample_rate * sample_rate);
double roundVal = rate >= 0.0 ? TWO_TO_52 : -TWO_TO_52;
@@ -863,7 +942,7 @@ int v_vChirpDataG5(
vec_st(cd6, 80, c);
vec_st(cd7, 96, c);
vec_st(cd8, 112, c);
- }
+ }
// handle tail elements with scalar code
for (; i < ul_NumDataPoints; ++i) {
@@ -878,6 +957,9 @@ int v_vChirpDataG5(
}
analysis_state.FLOP_counter+=12.0*ul_NumDataPoints;
}
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return 0;
}
@@ -895,7 +977,9 @@ float f_vGetChiSq(
// actual powers at each point along the PoT.
if (!AltiVec_Available()) return UNSUPPORTED_FUNCTION;
-
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("f_vGetChiSq()");
+#endif
int i;
int vEnd, vul_PowerLen;
float f_ChiSq=0,f_null_hyp=0, f_PredictedPower;
@@ -977,6 +1061,9 @@ float f_vGetChiSq(
f_null_hyp/=ul_PowerLen;
if (xsq_null) *xsq_null=f_null_hyp;
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return f_ChiSq;
}
@@ -991,6 +1078,9 @@ float f_vGetTrueMean(
// TrueMean is the mean power of the data set minus all power
// out to ExcludeLen from our current TOffset.
if (!AltiVec_Available()) return UNSUPPORTED_FUNCTION;
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("f_vGetTrueMean()");
+#endif
int i, i_start, i_lim, vStart, vEnd;
float f_ExcludePower = 0;
vector float v_TempExcludePower = ZERO, v_ExcludePower;
@@ -1021,6 +1111,9 @@ float f_vGetTrueMean(
f_ExcludePower += vp_ExcludePower[0] + vp_ExcludePower[1] + vp_ExcludePower[2] + vp_ExcludePower[3];
analysis_state.FLOP_counter+=(double)(i_lim-i_start+5);
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return((f_TotalPower - f_ExcludePower) / (ul_PowerLen - (i - i_start)));
}
@@ -1039,7 +1132,9 @@ int vGaussFit(
float f_null_hyp;
if (!AltiVec_Available()) return UNSUPPORTED_FUNCTION;
-
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("vGaussFit()");
+#endif
int ul_TOffset;
int iSigma = static_cast<int>(floor(PoTInfo.GaussSigma+0.5));
double diSigma = iSigma;
@@ -1145,6 +1240,9 @@ int vGaussFit(
if (!b_IsAPeak) {
//printf("no peak\n");
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return 0; // no peak - bail on this PoT
}
@@ -1194,6 +1292,9 @@ int vGaussFit(
analysis_state.FLOP_counter+=5.0*swi.analysis_cfg.gauss_pot_length+5;
if (f_PeakPower < f_TrueMean * best_gauss->display_power_thresh*0.5f) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return 0; // not even a weak peak at max group - bail on this PoT
}
}
@@ -1242,7 +1343,7 @@ int vGaussFit(
// but that would cause a lot of time waste
// computing chisq etc.
if (display_power_thresh == 0) {
- display_power_thresh = best_gauss->display_power_thresh = PoTInfo.GaussPeakPowerThresh/3;
+ display_power_thresh = best_gauss->display_power_thresh = PoTInfo.GaussPeakPowerThresh/3;
}
f_ChiSq = f_vGetChiSq(
@@ -1260,7 +1361,7 @@ int vGaussFit(
f_PeakPower,
f_TrueMean,
f_ChiSq,
- f_null_hyp,
+ f_null_hyp,
ul_PoT,
static_cast<float>(PoTInfo.GaussSigma),
f_NormMaxPower,
@@ -1273,7 +1374,9 @@ int vGaussFit(
analysis_state.FLOP_counter+=loop_flops;
free(f_corr);
free(f_swsum);
-
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return 0;
} // End of vGaussFit()
@@ -1287,12 +1390,16 @@ int vGaussFit(
inline vector unsigned int vec_uisplat(unsigned int ui_Constant) {
vector unsigned char vuc_Splat;
vector unsigned int vui_Constant;
-
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("vec_uisplat()");
+#endif
vuc_Splat = vec_lvsl(0, &ui_Constant);
vui_Constant = vec_lde(0, &ui_Constant);
vuc_Splat = (vector unsigned char) vec_splat((vector unsigned int) vuc_Splat, 0);
vui_Constant = vec_perm(vui_Constant, vui_Constant, vuc_Splat);
-
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return vui_Constant;
}
@@ -1307,6 +1414,9 @@ inline vector unsigned int vec_uisplat(unsigned int ui_Constant) {
*
*/
float foldArrayBy2SPA(float *ss[], struct PoTPlan *P) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("foldArrayBy2SPA()");
+#endif
float max;
int vEnd;
vector float tempMaxV = ZERO, maxV;
@@ -1364,12 +1474,18 @@ float foldArrayBy2SPA(float *ss[], struct PoTPlan *P) {
float *maxVp = (float *) &maxV;
max = *maxVp;
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return max;
}
/* Assumes 16-byte alignment of both halves of input array
*/
float foldArrayBy2SPAL(float *ss[], struct PoTPlan *P) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("foldArrayBy2SPAL()");
+#endif
float max;
int vEnd;
vector float tempMaxV = ZERO, maxV;
@@ -1423,7 +1539,9 @@ float foldArrayBy2SPAL(float *ss[], struct PoTPlan *P) {
maxV = vec_max(tempMaxV, vec_sld(tempMaxV, tempMaxV, 4));
float *maxVp = (float *) &maxV;
max = *maxVp;
-
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return max;
}
@@ -1438,6 +1556,9 @@ float foldArrayBy2SPAL(float *ss[], struct PoTPlan *P) {
*
*/
float foldArrayBy3SP(float *ss[], struct PoTPlan *P) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("foldArrayBy3SP()");
+#endif
float max;
int vEnd;
vector float tempMaxV = ZERO, maxV;
@@ -1494,7 +1615,9 @@ float foldArrayBy3SP(float *ss[], struct PoTPlan *P) {
maxV = vec_max(tempMaxV, vec_sld(tempMaxV, tempMaxV, 4));
float *maxVp = (float *) &maxV;
max = *maxVp;
-
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return max;
}
@@ -1509,6 +1632,9 @@ float foldArrayBy3SP(float *ss[], struct PoTPlan *P) {
*
*/
float foldArrayBy4SP(float *ss[], struct PoTPlan *P) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("foldArrayBy4SP()");
+#endif
float max;
int vEnd;
vector float tempMaxV = ZERO, maxV;
@@ -1567,7 +1693,9 @@ float foldArrayBy4SP(float *ss[], struct PoTPlan *P) {
maxV = vec_max(tempMaxV, vec_sld(tempMaxV, tempMaxV, 4));
float *maxVp = (float *) &maxV;
max = *maxVp;
-
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return max;
}
@@ -1582,6 +1710,9 @@ float foldArrayBy4SP(float *ss[], struct PoTPlan *P) {
*
*/
float foldArrayBy5SP(float *ss[], struct PoTPlan *P) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("foldArrayBy5SP()");
+#endif
float max;
int vEnd;
vector float tempMaxV = ZERO, maxV;
@@ -1646,7 +1777,9 @@ float foldArrayBy5SP(float *ss[], struct PoTPlan *P) {
maxV = vec_max(tempMaxV, vec_sld(tempMaxV, tempMaxV, 4));
float *maxVp = (float *) &maxV;
max = *maxVp;
-
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return max;
}
diff --git a/client/vector/analyzeFuncs_avx.cpp b/client/vector/analyzeFuncs_avx.cpp
index 4bcf4ee..a7fe3bd 100644
--- a/client/vector/analyzeFuncs_avx.cpp
+++ b/client/vector/analyzeFuncs_avx.cpp
@@ -46,6 +46,9 @@
#elif defined(_MSC_VER)
#include <intrin.h>
#else
+#ifdef __clang__
+#define __AVX__ 1
+#endif
#include <immintrin.h>
#endif
@@ -69,10 +72,16 @@ int avx_ChirpData_a(
int ul_NumDataPoints,
const double sample_rate
) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("avx_ChirpData_a()");
+#endif
int i, vEnd;
if (chirp_rate_ind == 0) {
memcpy(cx_ChirpDataArray, cx_DataArray, (int)ul_NumDataPoints * sizeof(sah_complex) );
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return 0;
}
@@ -200,6 +209,9 @@ int avx_ChirpData_a(
}
analysis_state.FLOP_counter+=12.0*ul_NumDataPoints;
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return 0;
}
@@ -212,10 +224,16 @@ int avx_ChirpData_b(
int ul_NumDataPoints,
const double sample_rate
) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("avx_ChirpData_b()");
+#endif
int i, vEnd;
if (chirp_rate_ind == 0) {
memcpy(cx_ChirpDataArray, cx_DataArray, (int)ul_NumDataPoints * sizeof(sah_complex) );
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return 0;
}
@@ -344,6 +362,9 @@ int avx_ChirpData_b(
}
analysis_state.FLOP_counter+=12.0*ul_NumDataPoints;
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return 0;
}
@@ -358,10 +379,16 @@ int avx_ChirpData_c(
int ul_NumDataPoints,
const double sample_rate
) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("avx_ChirpData_c()");
+#endif
int i, vEnd;
if (chirp_rate_ind == 0) {
memcpy(cx_ChirpDataArray, cx_DataArray, (int)ul_NumDataPoints * sizeof(sah_complex) );
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return 0;
}
@@ -502,6 +529,9 @@ int avx_ChirpData_c(
}
analysis_state.FLOP_counter+=12.0*ul_NumDataPoints;
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return 0;
}
@@ -514,10 +544,16 @@ int avx_ChirpData_d(
int ul_NumDataPoints,
const double sample_rate
) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("avx_ChirpData_d()");
+#endif
int i, vEnd;
if (chirp_rate_ind == 0) {
memcpy(cx_ChirpDataArray, cx_DataArray, (int)ul_NumDataPoints * sizeof(sah_complex) );
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return 0;
}
@@ -657,6 +693,9 @@ int avx_ChirpData_d(
}
analysis_state.FLOP_counter+=12.0*ul_NumDataPoints;
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return 0;
}
@@ -666,6 +705,9 @@ int avx_ChirpData_d(
//
inline void v_avxSubTranspose4x8ntw(float *in, float *out, int xline, int yline) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("v_avxSubTranspose4x8ntw()");
+#endif
// Do two simultaneous 4x4 transposes in the YMM registers, non-temporal writes.
// Input is 8 rows of 4 floats, output is 4 columns of 8 floats.
// An sfence is needed after using this sub to ensure global visibilty of the writes.
@@ -684,9 +726,15 @@ inline void v_avxSubTranspose4x8ntw(float *in, float *out, int xline, int yline)
_mm256_stream_ps(out+1*yline, _mm256_unpackhi_ps(c01e, c01o)); // b0b1b2b3b4b5b6b7
_mm256_stream_ps(out+2*yline, _mm256_unpacklo_ps(c23e, c23o)); // c0c1c2c3c4c5c6c7
_mm256_stream_ps(out+3*yline, _mm256_unpackhi_ps(c23e, c23o)); // d0d1d2d3d4d5d6d7
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
}
int v_avxTranspose4x8ntw(int x, int y, float *in, float *out) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("v_avxTranspose4x8ntw()");
+#endif
int i,j;
for (j=0;j<y-7;j+=8) {
@@ -706,9 +754,15 @@ int v_avxTranspose4x8ntw(int x, int y, float *in, float *out) {
}
_mm256_zeroupper();
_mm_sfence();
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return 0;
}
int v_avxTranspose4x16ntw(int x, int y, float *in, float *out) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("v_avxSubTranspose4x16ntw()");
+#endif
int i,j;
for (j=0;j<y-15;j+=16) {
@@ -727,12 +781,18 @@ int v_avxTranspose4x16ntw(int x, int y, float *in, float *out) {
}
_mm256_zeroupper();
_mm_sfence();
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return 0;
}
/*****************************************************************/
inline void v_avxSubTranspose8x4ntw(float *in, float *out, int xline, int yline) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("v_avxSubTranspose8x4ntw()");
+#endif
// Do two simultaneous 4x4 transposes in the YMM registers, non-temporal writes.
// Input is 4 rows of 8 floats, output is 8 columns of 4 floats.
// An sfence is needed after using this sub to ensure global visibilty of the writes.
@@ -770,9 +830,15 @@ inline void v_avxSubTranspose8x4ntw(float *in, float *out, int xline, int yline)
_mm_stream_ps(out+5*yline, u6); // d5 c5 b5 a5
_mm_stream_ps(out+6*yline, u7); // d6 c6 b6 a6
_mm_stream_ps(out+7*yline, u8); // d7 c7 b7 a7
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
}
int v_avxTranspose8x4ntw(int x, int y, float *in, float *out) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("v_avxTranspose8x4ntw()");
+#endif
int i,j;
for (j=0;j<y-3;j+=4) {
for (i=0;i<x-7;i+=8) {
@@ -789,12 +855,18 @@ int v_avxTranspose8x4ntw(int x, int y, float *in, float *out) {
}
_mm256_zeroupper();
_mm_sfence();
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return 0;
}
/*****************************************************************/
inline void v_avxSubTranspose8x8ntw_a(float *in, float *out, int xline, int yline) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("v_avxSubTranspose8x8ntw_a()");
+#endif
// Do a direct 8x8 transpose in YMM registers.
// Might be slowed by register spills for 32 bit builds.
// An sfence is needed after using this sub to ensure global visibilty of the writes.
@@ -838,9 +910,15 @@ inline void v_avxSubTranspose8x8ntw_a(float *in, float *out, int xline, int ylin
_mm256_stream_ps(out+5*yline, _mm256_shuffle_ps(t3, t7, 0xDD));
_mm256_stream_ps(out+6*yline, _mm256_shuffle_ps(td, tf, 0x88));
_mm256_stream_ps(out+7*yline, _mm256_shuffle_ps(td, tf, 0xDD));
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
}
int v_avxTranspose8x8ntw_a(int x, int y, float *in, float *out) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("v_avxTranspose8x8ntw_a()");
+#endif
int i,j;
// Processors with AVX have efficient "hardware" prefetching,
// so just do one set of prefetches to help that get started.
@@ -870,11 +948,17 @@ int v_avxTranspose8x8ntw_a(int x, int y, float *in, float *out) {
}
_mm256_zeroupper();
_mm_sfence();
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return 0;
}
/*****************************************************************/
inline void v_avxSubTranspose8x8ntw_b(float *in, float *out, int xline, int yline) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("v_avxSubTranspose8x8ntw_b()");
+#endif
// Alternative 8x8 transpose with port 5 pressure reduction.
// An sfence is needed after using this sub to ensure global visibilty of the writes.
__m256 t0, t1, ta, tb, tc, td;
@@ -909,9 +993,15 @@ inline void v_avxSubTranspose8x8ntw_b(float *in, float *out, int xline, int ylin
_mm256_stream_ps(out+5*yline, _mm256_shuffle_ps(ta, tc, 0xDD));
_mm256_stream_ps(out+6*yline, _mm256_shuffle_ps(tb, td, 0x88));
_mm256_stream_ps(out+7*yline, _mm256_shuffle_ps(tb, td, 0xDD));
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
}
int v_avxTranspose8x8ntw_b(int x, int y, float *in, float *out) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("v_avxTranspose8x8ntw_b");
+#endif
int i,j;
// Processors with AVX have efficient "hardware" prefetching,
// so just do one set of prefetches to help that get started.
@@ -941,6 +1031,9 @@ int v_avxTranspose8x8ntw_b(int x, int y, float *in, float *out) {
}
_mm256_zeroupper();
_mm_sfence();
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return 0;
}
@@ -953,6 +1046,9 @@ int v_avxGetPowerSpectrum(
float* PowerSpectrum,
int NumDataPoints
) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("v_avxGetPowerSpectrum()");
+#endif
int i, vEnd;
analysis_state.FLOP_counter+=3.0*NumDataPoints;
@@ -999,6 +1095,9 @@ int v_avxGetPowerSpectrum(
+ FreqData[i][1] * FreqData[i][1];
}
_mm256_zeroupper();
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return 0;
}
@@ -1015,6 +1114,9 @@ int v_avxGetPowerSpectrum(
// First version ignores misalignments to achieve smallest code size
float foldBy3(float *ss[], struct PoTPlan *P) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("foldBy3()");
+#endif
const float lim = (float)(((P->di) - 1) & 7);
__m256 tailelem = _mm256_set_ps(7.0f, 6.0f, 5.0f, 4.0f, 3.0f, 2.0f, 1.0f, 0.0f);
__m256 taillim = _mm256_broadcast_ss(&lim);
@@ -1048,6 +1150,9 @@ float foldBy3(float *ss[], struct PoTPlan *P) {
maxV = _mm256_max_ps(maxV, _mm256_shuffle_ps(maxV, maxV, 0x01)); // 1
float max = _mm_cvtss_f32(_mm256_castps256_ps128(maxV));
_mm256_zeroupper();
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return max;
}
@@ -1055,6 +1160,9 @@ sum_func AVXTBa3[FOLDTBLEN] = {foldBy3};
float foldBy4(float *ss[], struct PoTPlan *P) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("foldBy4()");
+#endif
const float lim = (float)(((P->di) - 1) & 7);
__m256 tailelem = _mm256_set_ps(7.0f, 6.0f, 5.0f, 4.0f, 3.0f, 2.0f, 1.0f, 0.0f);
__m256 taillim = _mm256_broadcast_ss(&lim);
@@ -1089,6 +1197,9 @@ float foldBy4(float *ss[], struct PoTPlan *P) {
maxV = _mm256_max_ps(maxV, _mm256_shuffle_ps(maxV, maxV, 0x01));
float max = _mm_cvtss_f32(_mm256_castps256_ps128(maxV));
_mm256_zeroupper();
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return max;
}
@@ -1096,6 +1207,9 @@ sum_func AVXTBa4[FOLDTBLEN] = {foldBy4};
float foldBy5(float *ss[], struct PoTPlan *P) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("foldBy5()");
+#endif
const float lim = (float)(((P->di) - 1) & 7);
__m256 tailelem = _mm256_set_ps(7.0f, 6.0f, 5.0f, 4.0f, 3.0f, 2.0f, 1.0f, 0.0f);
__m256 taillim = _mm256_broadcast_ss(&lim);
@@ -1132,6 +1246,9 @@ float foldBy5(float *ss[], struct PoTPlan *P) {
maxV = _mm256_max_ps(maxV, _mm256_shuffle_ps(maxV, maxV, 0x01));
float max = _mm_cvtss_f32(_mm256_castps256_ps128(maxV));
_mm256_zeroupper();
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return max;
}
@@ -1139,6 +1256,9 @@ sum_func AVXTBa5[FOLDTBLEN] = {foldBy5};
float foldBy2(float *ss[], struct PoTPlan *P) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("foldBy2()");
+#endif
const float lim = (float)(((P->di) - 1) & 7);
__m256 tailelem = _mm256_set_ps(7.0f, 6.0f, 5.0f, 4.0f, 3.0f, 2.0f, 1.0f, 0.0f);
__m256 taillim = _mm256_broadcast_ss(&lim);
@@ -1169,6 +1289,9 @@ float foldBy2(float *ss[], struct PoTPlan *P) {
maxV = _mm256_max_ps(maxV, _mm256_shuffle_ps(maxV, maxV, 0x01));
float max = _mm_cvtss_f32(_mm256_castps256_ps128(maxV));
_mm256_zeroupper();
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return max;
}
@@ -1181,6 +1304,9 @@ FoldSet AVXfold_a = {AVXTBa3, AVXTBa4, AVXTBa5, AVXTBa2, AVXTBa2, "JS AVX_a"};
// Alternate set using 16 byte unaligned loads and inserts for the probably unaligned
// elements, based on Intel optimization recommendations.
float foldBy3c(float *ss[], struct PoTPlan *P) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("foldBy3c()");
+#endif
const float lim = (float)(((P->di) - 1) & 7);
__m256 tailelem = _mm256_set_ps(7.0f, 6.0f, 5.0f, 4.0f, 3.0f, 2.0f, 1.0f, 0.0f);
__m256 taillim = _mm256_broadcast_ss(&lim);
@@ -1215,6 +1341,9 @@ float foldBy3c(float *ss[], struct PoTPlan *P) {
maxV = _mm256_max_ps(maxV, _mm256_shuffle_ps(maxV, maxV, 0x01));
float max = _mm_cvtss_f32(_mm256_castps256_ps128(maxV));
_mm256_zeroupper();
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return max;
}
@@ -1222,6 +1351,9 @@ sum_func AVXTBc3[FOLDTBLEN] = {foldBy3c};
float foldBy4c(float *ss[], struct PoTPlan *P) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("foldBy4c");
+#endif
const float lim = (float)(((P->di) - 1) & 7);
__m256 tailelem = _mm256_set_ps(7.0f, 6.0f, 5.0f, 4.0f, 3.0f, 2.0f, 1.0f, 0.0f);
__m256 taillim = _mm256_broadcast_ss(&lim);
@@ -1260,6 +1392,9 @@ float foldBy4c(float *ss[], struct PoTPlan *P) {
maxV = _mm256_max_ps(maxV, _mm256_shuffle_ps(maxV, maxV, 0x01));
float max = _mm_cvtss_f32(_mm256_castps256_ps128(maxV));
_mm256_zeroupper();
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return max;
}
@@ -1267,6 +1402,9 @@ sum_func AVXTBc4[FOLDTBLEN] = {foldBy4c};
float foldBy5c(float *ss[], struct PoTPlan *P) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("foldBy5c()");
+#endif
const float lim = (float)(((P->di) - 1) & 7);
__m256 tailelem = _mm256_set_ps(7.0f, 6.0f, 5.0f, 4.0f, 3.0f, 2.0f, 1.0f, 0.0f);
__m256 taillim = _mm256_broadcast_ss(&lim);
@@ -1309,6 +1447,9 @@ float foldBy5c(float *ss[], struct PoTPlan *P) {
maxV = _mm256_max_ps(maxV, _mm256_shuffle_ps(maxV, maxV, 0x01));
float max = _mm_cvtss_f32(_mm256_castps256_ps128(maxV));
_mm256_zeroupper();
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return max;
}
@@ -1316,6 +1457,9 @@ sum_func AVXTBc5[FOLDTBLEN] = {foldBy5c};
float foldBy2c(float *ss[], struct PoTPlan *P) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("foldBy2c()");
+#endif
const float lim = (float)(((P->di) - 1) & 7);
__m256 tailelem = _mm256_set_ps(7.0f, 6.0f, 5.0f, 4.0f, 3.0f, 2.0f, 1.0f, 0.0f);
__m256 taillim = _mm256_broadcast_ss(&lim);
@@ -1346,6 +1490,9 @@ float foldBy2c(float *ss[], struct PoTPlan *P) {
maxV = _mm256_max_ps(maxV, _mm256_shuffle_ps(maxV, maxV, 0x01));
float max = _mm_cvtss_f32(_mm256_castps256_ps128(maxV));
_mm256_zeroupper();
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return max;
}
diff --git a/client/vector/analyzeFuncs_fpu.cpp b/client/vector/analyzeFuncs_fpu.cpp
index 74d3596..cbcf319 100644
--- a/client/vector/analyzeFuncs_fpu.cpp
+++ b/client/vector/analyzeFuncs_fpu.cpp
@@ -54,6 +54,9 @@ inline void clean_up_fastfrac() {
// This routine should work as long as x86_64 supports x87 instructions.
// After that the illegal instruction trap should take care of it.
inline double fastfrac(double val, double roundVal) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("fastfrac()");
+#endif
// reduce val to the range (-0.5, 0.5) using "val - round(val)"
#if defined(_MSC_VER) && !defined(_WIN64)
__asm {
@@ -72,17 +75,23 @@ inline double fastfrac(double val, double roundVal) {
: "=&t" (val)
: "0" (val), "f" (roundVal), "f" (val)
);
-#elif defined(_WIN64)
- val -= ((val + roundVal) - roundVal); // TODO: ADD CHECK THAT THIS WORKS
+#elif defined(_WIN64) || defined (__arm__)
+ val -= ((val + roundVal) - roundVal); // TODO: ADD CHECK THAT THIS WORKS
#else
val -= floor(val + 0.5);
#endif
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return val;
}
static unsigned short fpucw1;
inline void set_extended_precision() {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("set_extended_precision()");
+#endif
// Windows and *BSD operate the X87 FPU so it rounds at mantissa bit 53, the
// quick rounding algorithm needs rounding at the last bit.
unsigned short fpucw2;
@@ -97,9 +106,15 @@ inline void set_extended_precision() {
#else
// Nothing necessary for linux, osx, _WIN64 VC++ and most everything else.
#endif
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
}
inline void restore_fpucw() {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("restore_fpucw()");
+#endif
#if defined(_MSC_VER) && !defined(_WIN64)
__asm fldcw fpucw1;
#elif defined(__GNUC__) && (defined(_WIN32) || defined(_WIN64) || defined(_BSD))
@@ -107,6 +122,9 @@ inline void restore_fpucw() {
#else
// NADA
#endif
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
}
double z;
@@ -119,8 +137,14 @@ int fpu_ChirpData (
int ul_NumDataPoints,
double sample_rate
) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("fpu_ChirpData()");
+#endif
if (ChirpRateInd == 0) {
memcpy(cx_ChirpDataArray, cx_DataArray, (int)ul_NumDataPoints * sizeof(sah_complex) );
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return 0;
}
@@ -228,6 +252,9 @@ int fpu_ChirpData (
}
analysis_state.FLOP_counter+=12.0*ul_NumDataPoints;
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return 0;
}
@@ -247,10 +274,16 @@ int fpu_opt_ChirpData (
double sample_rate
){
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("fpu_opt_ChirpData()");
+#endif
float chirp_sign; // BENH - Pulled conditional out of loop
if ( ChirpRateInd == 0 )
{
memcpy( cx_ChirpDataArray, cx_DataArray, int( ul_NumDataPoints * sizeof(sah_complex)) );
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return ( 0 );
}
@@ -329,5 +362,8 @@ int fpu_opt_ChirpData (
//R count_flops( 12 * ul_NumDataPoints );
analysis_state.FLOP_counter+=12.0*ul_NumDataPoints;
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return ( 0 );
}
diff --git a/client/vector/analyzeFuncs_mmx.cpp b/client/vector/analyzeFuncs_mmx.cpp
index ad182f8..fa9359c 100644
--- a/client/vector/analyzeFuncs_mmx.cpp
+++ b/client/vector/analyzeFuncs_mmx.cpp
@@ -40,6 +40,9 @@ typedef __m64 MMX;
//
void __fastcall copy_MMX(char *dest, const char *src, int blocks)
{
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("copy_MMX()");
+#endif
MMX m0,m1,m2,m3,m4,m5,m6,m7;
MMX *m_src = (MMX *)src;
@@ -67,6 +70,9 @@ void __fastcall copy_MMX(char *dest, const char *src, int blocks)
m_dst += 8;
}
s_end();
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.end();
+#endif
}
//
@@ -75,6 +81,9 @@ void __fastcall copy_MMX(char *dest, const char *src, int blocks)
//
void __fastcall copy_MMXnt(char *dest, const char *src, int blocks)
{
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("copy_MMXnt()");
+#endif
MMX m0,m1,m2,m3,m4,m5,m6,m7;
MMX *m_src = (MMX *)src;
@@ -104,4 +113,7 @@ void __fastcall copy_MMXnt(char *dest, const char *src, int blocks)
}
s_end();
s_fence_writes();
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
}
diff --git a/client/vector/analyzeFuncs_sse.cpp b/client/vector/analyzeFuncs_sse.cpp
index a6d5cd7..24756de 100644
--- a/client/vector/analyzeFuncs_sse.cpp
+++ b/client/vector/analyzeFuncs_sse.cpp
@@ -69,6 +69,11 @@ inline void v_pfsubTranspose(float *in, float *out, int xline, int yline) {
// appropriate part of a YLINE by XLINE matrix. "IN" points to the first
// (lowest address) element of the input submatrix. "OUT" points to the
// first (lowest address) element of the output submatrix.
+#ifdef USE_MANUAL_CALLSTACK
+ static char name[64];
+ if (name[0]==0) sprintf(name,"v_pfsubTranspose<%d>()",x);
+ call_stack.enter(name);
+#endif
int i,j;
float *p;
register float tmp[x*x];
@@ -86,10 +91,16 @@ inline void v_pfsubTranspose(float *in, float *out, int xline, int yline) {
}
prefetcht0(in+j*xline+x);
}
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
}
int v_pfTranspose2(int x, int y, float *in, float *out) {
// Attempts to improve cache hit ratio by transposing 4 elements at a time.
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("v_pfTranspose2()");
+#endif
int i,j;
for (j=0;j<y-1;j+=2) {
for (i=0;i<x-1;i+=2) {
@@ -104,11 +115,17 @@ int v_pfTranspose2(int x, int y, float *in, float *out) {
out[i*y+j]=in[j*x+i];
}
}
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return 0;
}
int v_pfTranspose4(int x, int y, float *in, float *out) {
// Attempts to improve cache hit ratio by transposing 16 elements at a time.
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("v_pfTranspose4()");
+#endif
int i,j;
for (j=0;j<y-3;j+=4) {
for (i=0;i<x-3;i+=4) {
@@ -134,11 +151,17 @@ int v_pfTranspose4(int x, int y, float *in, float *out) {
out[i*y+j]=in[j*x+i];
}
}
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return 0;
}
int v_pfTranspose8(int x, int y, float *in, float *out) {
// Attempts to improve cache hit ratio by transposing 64 elements at a time.
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("v_pfTranspose8()");
+#endif
int i,j;
for (j=0;j<y-7;j+=8) {
for (i=0;i<x-7;i+=8) {
@@ -178,6 +201,9 @@ int v_pfTranspose8(int x, int y, float *in, float *out) {
out[i*y+j]=in[j*x+i];
}
}
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return 0;
}
@@ -185,13 +211,16 @@ int v_pfTranspose8(int x, int y, float *in, float *out) {
inline void v_vsubTranspose4(float *in, float *out, int xline, int yline) {
// do a 4x4 transpose in the SSE registers.
// This could probably be optimized a bit further.
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("v_vsubTranspose4()");
+#endif
prefetcht0(out);
prefetcht0(out+yline);
prefetcht0(out+2*yline);
prefetcht0(out+3*yline);
// TODO: figure out why the intrinsic version crashes for MinGW build
// not critical, but shuffle-only _MM_TRANSPOSE4_PS is optimal on some
-#if defined(USE_INTRINSICS) && defined(_MM_TRANSPOSE4_PS) && !defined(__GNUC__)
+#if defined(USE_INTRINSICS) && (defined(_MM_TRANSPOSE4_PS) && !defined(__GNUC__) || defined(__clang__))
register float4 row0=*(__m128 *)in;
register float4 row1=*(__m128 *)(in+xline);
register float4 row2=*(__m128 *)(in+2*xline);
@@ -236,9 +265,15 @@ inline void v_vsubTranspose4(float *in, float *out, int xline, int yline) {
prefetcht0(in+1*xline+4);
prefetcht0(in+2*xline+4);
prefetcht0(in+3*xline+4);
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
}
int v_vTranspose4(int x, int y, float *in, float *out) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("v_vTranspose4()");
+#endif
int i,j;
for (j=0;j<y-3;j+=4) {
for (i=0;i<x-3;i+=4) {
@@ -264,16 +299,22 @@ int v_vTranspose4(int x, int y, float *in, float *out) {
out[i*y+j]=in[j*x+i];
}
}
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return 0;
}
inline void v_vsubTranspose4np(float *in, float *out, int xline, int yline) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("v_vsubTranspose4np()");
+#endif
// do a 4x4 transpose in the SSE registers.
// This could probably be optimized a bit further.
// JWS: No prefetches in this version, faster on some systems.
// TODO: figure out why the intrinsic version crashes for MinGW build
// not critical, but the shuffle-only _MM_TRANSPOSE4_PS is optimal on some
-#if defined(USE_INTRINSICS) && defined(_MM_TRANSPOSE4_PS) && !defined(__GNUC__)
+#if defined(USE_INTRINSICS) && (defined(_MM_TRANSPOSE4_PS) && !defined(__GNUC__) || defined(__clang__))
register float4 row0=*(__m128 *)in;
register float4 row1=*(__m128 *)(in+xline);
register float4 row2=*(__m128 *)(in+2*xline);
@@ -314,9 +355,15 @@ inline void v_vsubTranspose4np(float *in, float *out, int xline, int yline) {
// no intrinsics, no GCC, just do something which should work
v_pfsubTranspose<4>(in, out, xline, yline);
#endif
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
}
int v_vTranspose4np(int x, int y, float *in, float *out) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("v_vTranspose4np()");
+#endif
int i,j;
for (j=0;j<y-3;j+=4) {
for (i=0;i<x-3;i+=4) {
@@ -331,12 +378,18 @@ int v_vTranspose4np(int x, int y, float *in, float *out) {
out[i*y+j]=in[j*x+i];
}
}
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return 0;
}
// Following section disappears without intrinsics
#ifdef USE_INTRINSICS
inline void v_vsubTranspose4ntw(float *in, float *out, int xline, int yline) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("v_vsubTranspose4ntw()");
+#endif
// Do a 4x4 transpose in the SSE registers, non-temporal writes.
// An sfence is needed after using this sub to ensure global visibilty of the writes.
__m128 tmp1, tmp2, tmp3, tmp4, tmp5, tmp6;
@@ -361,9 +414,15 @@ inline void v_vsubTranspose4ntw(float *in, float *out, int xline, int yline) {
tmp6 = _mm_movehl_ps(tmp6,tmp2); // d3 c3 b3 a3
_mm_stream_ps(out+2*yline, tmp5);
_mm_stream_ps(out+3*yline, tmp6);
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
}
int v_vTranspose4ntw(int x, int y, float *in, float *out) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("v_vTranspose4ntw()");
+#endif
int i,j;
for (j=0;j<y-3;j+=4) {
for (i=0;i<x-3;i+=4) {
@@ -379,10 +438,16 @@ int v_vTranspose4ntw(int x, int y, float *in, float *out) {
}
}
_mm_sfence();
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return 0;
}
int v_vTranspose4x8ntw(int x, int y, float *in, float *out) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("v_vTranspose4x8ntw()");
+#endif
int i,j;
for (j=0;j<y-7;j+=8) {
for (i=0;i<x-3;i+=4) {
@@ -399,10 +464,16 @@ int v_vTranspose4x8ntw(int x, int y, float *in, float *out) {
}
}
_mm_sfence();
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return 0;
}
int v_vTranspose4x16ntw(int x, int y, float *in, float *out) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("v_vTranspose4x16ntw()");
+#endif
int i,j;
for (j=0;j<y-15;j+=16) {
for (i=0;i<x-3;i+=4) {
@@ -421,9 +492,15 @@ int v_vTranspose4x16ntw(int x, int y, float *in, float *out) {
}
}
_mm_sfence();
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return 0;
}
int v_vpfTranspose8x4ntw(int x, int y, float *in, float *out) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("v_vpfTranspose8x4ntw()");
+#endif
int i,j;
for (j=0;j<y-3;j+=4) {
for (i=0;i<x-7;i+=8) {
@@ -445,6 +522,9 @@ int v_vpfTranspose8x4ntw(int x, int y, float *in, float *out) {
}
}
_mm_sfence();
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return 0;
}
#endif // USE_INTRINSICS
@@ -461,6 +541,9 @@ int v_vGetPowerSpectrum(
#endif
if (!boinc_has_sse()) return UNSUPPORTED_FUNCTION;
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("v_vGetPowerSpectrum()");
+#endif
analysis_state.FLOP_counter+=3.0*NumDataPoints;
@@ -506,6 +589,9 @@ int v_vGetPowerSpectrum(
PowerSpectrum[i] = FreqData[i][0] * FreqData[i][0]
+ FreqData[i][1] * FreqData[i][1];
}
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return 0;
}
@@ -520,6 +606,9 @@ int v_vGetPowerSpectrumUnrolled(
register __m128 xmm7 asm("xmm7");
#endif
if (!boinc_has_sse()) return UNSUPPORTED_FUNCTION;
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("v_vGetPowerSpectrumUnrolled()");
+#endif
analysis_state.FLOP_counter+=3.0*NumDataPoints;
@@ -591,6 +680,9 @@ int v_vGetPowerSpectrumUnrolled(
PowerSpectrum[i] = FreqData[i][0] * FreqData[i][0]
+ FreqData[i][1] * FreqData[i][1];
}
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return 0;
}
@@ -606,6 +698,9 @@ int v_vGetPowerSpectrum2(
register __m128 xmm7 asm("xmm7");
#endif
if (!boinc_has_sse()) return UNSUPPORTED_FUNCTION;
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("v_vGetPowerSpectrum2()");
+#endif
analysis_state.FLOP_counter+=3.0*NumDataPoints;
@@ -649,6 +744,9 @@ int v_vGetPowerSpectrum2(
PowerSpectrum[i] = FreqData[i][0] * FreqData[i][0]
+ FreqData[i][1] * FreqData[i][1];
}
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return 0;
}
@@ -665,6 +763,9 @@ int v_vGetPowerSpectrumUnrolled2(
#endif
if (!boinc_has_sse()) return UNSUPPORTED_FUNCTION;
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("v_vGetPowerSpectrumUnrolled2()");
+#endif
analysis_state.FLOP_counter+=3.0*NumDataPoints;
@@ -734,6 +835,9 @@ int v_vGetPowerSpectrumUnrolled2(
PowerSpectrum[i] = FreqData[i][0] * FreqData[i][0]
+ FreqData[i][1] * FreqData[i][1];
}
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return 0;
}
@@ -770,6 +874,9 @@ inline void clean_up_fastfrac() {
// This routine should work as long as x86_64 supports x87 instructions.
// After that the illegal instruction trap should take care of it.
inline double fastfrac(double val, double roundVal) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("fastfrac()");
+#endif
// reduce val to the range (-0.5, 0.5) using "val - round(val)"
#if defined(_MSC_VER) && !defined(_WIN64)
__asm {
@@ -793,12 +900,18 @@ inline double fastfrac(double val, double roundVal) {
#else
val -= std::floor(val + 0.5);
#endif
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return val;
}
static unsigned short fpucw1;
inline void set_extended_precision() {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("set_extended_precision()");
+#endif
// Windows and *BSD operate the X87 FPU so it rounds at mantissa bit 53, the
// quick rounding algorithm needs rounding at the last bit.
unsigned short fpucw2;
@@ -813,9 +926,15 @@ inline void set_extended_precision() {
#else
// Nothing necessary for linux, osx, _WIN64 VC++ and most everything else.
#endif
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
}
inline void restore_fpucw() {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("restore_fpucw()");
+#endif
#if defined(_MSC_VER) && !defined(_WIN64)
__asm fldcw fpucw1;
#elif defined(__GNUC__) && (defined(_WIN32) || defined(_WIN64) || defined(_BSD))
@@ -823,14 +942,24 @@ inline void restore_fpucw() {
#else
// NADA
#endif
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
}
__m128 vec_recip1(__m128 v) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("vec_recip1()");
+#endif
// obtain estimate
__m128 estimate = _mm_rcp_ps( v );
// one round of Newton-Raphson
- return _mm_add_ps(_mm_mul_ps(_mm_sub_ps(ONE, _mm_mul_ps(estimate, v)), estimate), estimate);
+ __m128 rv=_mm_add_ps(_mm_mul_ps(_mm_sub_ps(ONE, _mm_mul_ps(estimate, v)), estimate), estimate);
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
+ return rv;
}
int sse1_ChirpData_ak(
@@ -841,9 +970,15 @@ int sse1_ChirpData_ak(
int ul_NumDataPoints,
double sample_rate
) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("sse1_ChirpData_ak()");
+#endif
if (ChirpRateInd == 0) {
memcpy(fp_ChirpDataArray, fp_DataArray, (int)ul_NumDataPoints * sizeof(sah_complex) );
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return 0;
}
@@ -1064,6 +1199,9 @@ int sse1_ChirpData_ak(
}
analysis_state.FLOP_counter+=12.0*ul_NumDataPoints;
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return 0;
}
@@ -1080,9 +1218,14 @@ int sse1_ChirpData_ak8e(
int ul_NumDataPoints,
double sample_rate
) {
-
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("sse1_ChirpData_ak8e()");
+#endif
if (ChirpRateInd == 0) {
memcpy(fp_ChirpDataArray, fp_DataArray, (int)ul_NumDataPoints * sizeof(sah_complex) );
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return 0;
}
@@ -1305,6 +1448,9 @@ int sse1_ChirpData_ak8e(
}
analysis_state.FLOP_counter+=12.0*ul_NumDataPoints;
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return 0;
}
@@ -1322,8 +1468,14 @@ int sse1_ChirpData_ak8h(
double sample_rate
) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("sse1_ChirpData_ak8h()");
+#endif
if (ChirpRateInd == 0) {
memcpy(fp_ChirpDataArray, fp_DataArray, (int)ul_NumDataPoints * sizeof(sah_complex) );
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return 0;
}
@@ -1541,6 +1693,9 @@ int sse1_ChirpData_ak8h(
}
analysis_state.FLOP_counter+=12.0*ul_NumDataPoints;
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return 0;
}
@@ -1580,6 +1735,9 @@ ALIGNED(unsigned int, 16) sse_partMask[][4] = {
// concept: Ben Herndon
//
inline float s_maxp2f( __m128 max1 ) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("s_maxp2f()");
+#endif
float tMax;
__m128 maxReg = max1;
@@ -1589,11 +1747,20 @@ inline float s_maxp2f( __m128 max1 ) {
maxReg = _mm_max_ss( maxReg, max1 ); // [1] vs [0]
_mm_store_ss( &tMax, maxReg );
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return ( tMax );
}
+#if defined(__clang__)
+#define s_getU( aaaa, ptr ) \
+ aaaa = _mm_loadl_pi(aaaa, (__m64*)(ptr)); \
+ aaaa = _mm_loadh_pi(aaaa, ((__m64 *)(ptr))+1)
+#else
#define s_getU( aaaa, ptr ) \
aaaa = _mm_loadh_pi( _mm_loadl_pi(aaaa, (__m64 *)ptr), ((__m64 *)(ptr))+1 )
+#endif
#define s_putU( ptr, aaaa ) \
_mm_storel_pi((__m64 *)ptr, aaaa), _mm_storeh_pi( ((__m64 *)ptr)+1 , aaaa)
@@ -1614,6 +1781,9 @@ inline float s_maxp2f( __m128 max1 ) {
// fold by 2
//
float sse_sum2(float *ss[], struct PoTPlan *P) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("sse_sum2()");
+#endif
__m128 sum1, sum2, tmp1, tmp2, max1, max2;
int i, length = P->di;
float *ptr1 = ss[1]+P->offset;
@@ -1654,13 +1824,20 @@ float sse_sum2(float *ss[], struct PoTPlan *P) {
s_putU( &sums[i + 0], sum1 );
s_putU( &sums[i +4], sum2 );
- return s_maxp2f( _mm_max_ps( max1, max2 ) );
+ float rv= s_maxp2f( _mm_max_ps( max1, max2 ) );
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
+ return rv;
}
//
// fold by 3s
//
float sse_sum3(float *ss[], struct PoTPlan *P) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("sse_sum3()");
+#endif
__m128 sum1, sum2, tmp1, tmp2, max1, max2;
int i, length = P->di;
float *ptr1 = ss[0];
@@ -1709,13 +1886,20 @@ float sse_sum3(float *ss[], struct PoTPlan *P) {
s_putU( &sums[i + 0], sum1 );
s_putU( &sums[i +4], sum2 );
- return s_maxp2f( _mm_max_ps( max1, max2 ) );
+ float rv= s_maxp2f( _mm_max_ps( max1, max2 ) );
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
+ return rv;
}
//
// fold by 4
//
float sse_sum4(float *ss[], struct PoTPlan *P) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("sse_sum4()");
+#endif
__m128 sum1, sum2, tmp1, tmp2, max1, max2;
int i, length = P->di;
float *ptr1 = ss[0];
@@ -1773,13 +1957,20 @@ float sse_sum4(float *ss[], struct PoTPlan *P) {
s_putU( &sums[i + 0], sum1 );
s_putU( &sums[i +4], sum2 );
- return s_maxp2f( _mm_max_ps( max1, max2 ) );
+ float rv= s_maxp2f( _mm_max_ps( max1, max2 ) );
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
+ return rv;
}
//
// fold by 5
//
float sse_sum5(float *ss[], struct PoTPlan *P) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("sse_sum5()");
+#endif
__m128 sum1, sum2, tmp1, tmp2, max1, max2;
int i, length = P->di;
float *ptr1 = ss[0];
@@ -1846,7 +2037,11 @@ float sse_sum5(float *ss[], struct PoTPlan *P) {
s_putU( &sums[i + 0], sum1 );
s_putU( &sums[i +4], sum2 );
- return s_maxp2f( _mm_max_ps( max1, max2 ) );
+ float rv= s_maxp2f( _mm_max_ps( max1, max2 ) );
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
+ return rv;
}
sum_func sse_list3[FOLDTBLEN] = {
@@ -1934,6 +2129,9 @@ ALIGNED(float, 16) sse_foldLim[][4] = {
// Fold by 3 versions
//
float sse_pulPoTf3u(float *ss[], struct PoTPlan *P) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("sse_pulPoTf2u()");
+#endif
__m128 sum1, sum2, max1, max2;
__m128 tmp1, tmp2;
int i;
@@ -2004,10 +2202,17 @@ float sse_pulPoTf3u(float *ss[], struct PoTPlan *P) {
sum1 = _mm_sub_ps(sum1, SSE_LIM( mask1 ) );
max1 = _mm_max_ps( max1, sum1 );
}
- return ( s_maxp2f( max1 ) );
+ float rv= ( s_maxp2f( max1 ) );
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
+ return rv;
}
float sse_pulPoTf3(float *ss[], struct PoTPlan *P) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("sse_pulPoTf3()");
+#endif
__m128 sum1, sum2, max1, max2;
__m128 tmp1, tmp2;
int i;
@@ -2048,10 +2253,17 @@ float sse_pulPoTf3(float *ss[], struct PoTPlan *P) {
sum1 = _mm_sub_ps(sum1, SSE_LIM( mask1 ) );
max1 = _mm_max_ps( max1, sum1 );
}
- return ( s_maxp2f( max1 ) );
+ float rv= ( s_maxp2f( max1 ) );
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
+ return rv;
}
float sse_pulPoTf3L8(float *ss[], struct PoTPlan *P) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("sse_pulPoTf3L8()");
+#endif
__m128 sum1, sum2, max1, max2;
__m128 tmp1, tmp2;
@@ -2081,7 +2293,11 @@ float sse_pulPoTf3L8(float *ss[], struct PoTPlan *P) {
max1 = _mm_max_ps( max1, sum1 );
max2 = _mm_max_ps( max2, sum2 );
- return ( s_maxp2f( _mm_max_ps( max1, max2 ) ) );
+ float rv= ( s_maxp2f( _mm_max_ps( max1, max2 ) ) );
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
+ return rv;
}
sum_func BHSSETB3[FOLDTBLEN] =
@@ -2099,6 +2315,9 @@ sum_func BHSSETB3[FOLDTBLEN] =
// Fold by 4 versions
//
float sse_pulPoTf4u(float *ss[], struct PoTPlan *P) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("sse_pulPoTf4u()");
+#endif
__m128 sum1, sum2, max1, max2;
__m128 tmp1, tmp2;
int i;
@@ -2184,10 +2403,17 @@ float sse_pulPoTf4u(float *ss[], struct PoTPlan *P) {
sum1 = _mm_sub_ps(sum1, SSE_LIM( mask1 ) );
max1 = _mm_max_ps( max1, sum1 );
}
- return ( s_maxp2f( max1 ) );
+ float rv= ( s_maxp2f( max1 ) );
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
+ return rv;
}
float sse_pulPoTf4(float *ss[], struct PoTPlan *P) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("sse_pulPoTf4()");
+#endif
__m128 sum1, sum2, max1, max2;
__m128 tmp1, tmp2;
int i;
@@ -2235,11 +2461,18 @@ float sse_pulPoTf4(float *ss[], struct PoTPlan *P) {
sum1 = _mm_sub_ps(sum1, SSE_LIM( mask1 ) );
max1 = _mm_max_ps( max1, sum1 );
}
- return ( s_maxp2f( max1 ) );
+ float rv=( s_maxp2f( max1 ) );
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
+ return rv;
}
float sse_pulPoTf4L8(float *ss[], struct PoTPlan *P) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("sse_pulPoTf4L8()");
+#endif
__m128 sum1, sum2, max1, max2;
__m128 tmp1, tmp2;
int i;
@@ -2275,7 +2508,11 @@ float sse_pulPoTf4L8(float *ss[], struct PoTPlan *P) {
max1 = _mm_max_ps( max1, sum1 );
max2 = _mm_max_ps( max2, sum2 );
- return ( s_maxp2f( _mm_max_ps( max1, max2 ) ) );
+ float rv= ( s_maxp2f( _mm_max_ps( max1, max2 ) ) );
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
+ return rv;
}
sum_func BHSSETB4[FOLDTBLEN] = {
@@ -2292,6 +2529,9 @@ sum_func BHSSETB4[FOLDTBLEN] = {
// Fold by 5 versions
//
float sse_pulPoTf5u(float *ss[], struct PoTPlan *P) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("sse_pulPoTf5u()");
+#endif
__m128 sum1, sum2, max1, max2;
__m128 tmp1, tmp2;
int i;
@@ -2392,10 +2632,17 @@ float sse_pulPoTf5u(float *ss[], struct PoTPlan *P) {
sum1 = _mm_sub_ps(sum1, SSE_LIM( mask1 ) );
max1 = _mm_max_ps( max1, sum1 );
}
- return ( s_maxp2f( max1 ) );
+ float rv=( s_maxp2f( max1 ) );
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
+ return rv;
}
float sse_pulPoTf5(float *ss[], struct PoTPlan *P) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("sse_pulPoTf5()");
+#endif
__m128 sum1, sum2, max1, max2;
__m128 tmp1, tmp2;
int i;
@@ -2450,10 +2697,17 @@ float sse_pulPoTf5(float *ss[], struct PoTPlan *P) {
sum1 = _mm_sub_ps(sum1, SSE_LIM( mask1 ) );
max1 = _mm_max_ps( max1, sum1 );
}
- return ( s_maxp2f( max1 ) );
+ float rv=( s_maxp2f( max1 ) );
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
+ return rv;
}
float sse_pulPoTf5L8(float *ss[], struct PoTPlan *P) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("sse_pulPoTf5L8()");
+#endif
__m128 sum1, sum2, max1, max2;
__m128 tmp1, tmp2;
int i;
@@ -2494,10 +2748,17 @@ float sse_pulPoTf5L8(float *ss[], struct PoTPlan *P) {
max1 = _mm_max_ps( max1, sum1 );
max2 = _mm_max_ps( max2, sum2 );
- return ( s_maxp2f( _mm_max_ps( max1, max2 ) ) );
+ float rv= ( s_maxp2f( _mm_max_ps( max1, max2 ) ) );
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
+ return rv;
}
float sse_pulPoTf5L4(float *ss[], struct PoTPlan *P) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("sse_pulPoTf5L4()");
+#endif
__m128 sum1, sum2, max1, max2;
__m128 tmp1, tmp2;
int i;
@@ -2523,7 +2784,11 @@ float sse_pulPoTf5L4(float *ss[], struct PoTPlan *P) {
sum1 = _mm_sub_ps(sum1, SSE_LIM( mask1 ) );
max1 = _mm_max_ps( max1, sum1 );
- return ( s_maxp2f( max1 ) );
+ float rv= ( s_maxp2f( max1 ) );
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
+ return rv;
}
sum_func BHSSETB5[FOLDTBLEN] = {
@@ -2540,6 +2805,9 @@ sum_func BHSSETB5[FOLDTBLEN] = {
// Fold by 2 versions
//
float sse_pulPoTf2u(float *ss[], struct PoTPlan *P) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("sse_pulPoTf2u()");
+#endif
__m128 sum1, sum2, tmp1, tmp2, max1, max2;
int i;
@@ -2595,10 +2863,17 @@ float sse_pulPoTf2u(float *ss[], struct PoTPlan *P) {
sum1 = _mm_sub_ps(sum1, SSE_LIM( mask1 ) );
max1 = _mm_max_ps( max1, sum1 );
}
- return ( s_maxp2f( max1 ) );
+ float rv= ( s_maxp2f( max1 ) );
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
+ return rv;
}
float sse_pulPoTf2(float *ss[], struct PoTPlan *P) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("sse_pulPoTf2()");
+#endif
__m128 sum1, sum2, tmp1, tmp2, max1, max2;
int i;
@@ -2632,10 +2907,17 @@ float sse_pulPoTf2(float *ss[], struct PoTPlan *P) {
sum1 = _mm_sub_ps(sum1, SSE_LIM( mask1 ) );
max1 = _mm_max_ps( max1, sum1 );
}
- return ( s_maxp2f( max1 ) );
+ float rv= ( s_maxp2f( max1 ) );
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
+ return rv;
}
float sse_pulPoTf2L8(float *ss[], struct PoTPlan *P) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("sse_pulPoTf2L8()");
+#endif
__m128 sum1, sum2, tmp1, tmp2, max1, max2;
int i;
@@ -2660,10 +2942,17 @@ float sse_pulPoTf2L8(float *ss[], struct PoTPlan *P) {
max1 = _mm_max_ps( max1, sum1 );
max2 = _mm_max_ps( max2, sum2 );
- return ( s_maxp2f( _mm_max_ps( max1, max2 ) ) );
+ float rv= ( s_maxp2f( _mm_max_ps( max1, max2 ) ) );
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
+ return rv;
}
float sse_pulPoTf2L4(float *ss[], struct PoTPlan *P) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("sse_pulPoTf2L4()");
+#endif
__m128 sum1, tmp1, max1;
int i;
@@ -2680,7 +2969,11 @@ float sse_pulPoTf2L4(float *ss[], struct PoTPlan *P) {
sum1 = _mm_sub_ps(sum1, SSE_LIM( mask1 ) );
max1 = _mm_max_ps( max1, sum1 );
- return ( s_maxp2f( max1 ) );
+ float rv= ( s_maxp2f( max1 ) );
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
+ return rv;
}
sum_func BHSSETB2[FOLDTBLEN] = {
@@ -2698,6 +2991,9 @@ sum_func BHSSETB2[FOLDTBLEN] = {
// versions for tmp0 aligned
//
float sse_pulPoTf2ALu(float *ss[], struct PoTPlan *P) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("sse_pulPoTf2ALu()");
+#endif
__m128 sum1, sum2, tmp1, tmp2, max1, max2;
int i;
@@ -2753,10 +3049,17 @@ float sse_pulPoTf2ALu(float *ss[], struct PoTPlan *P) {
sum1 = _mm_sub_ps(sum1, SSE_LIM( mask1 ) );
max1 = _mm_max_ps( max1, sum1 );
}
- return ( s_maxp2f( max1 ) );
+ float rv= ( s_maxp2f( max1 ) );
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
+ return rv;
}
float sse_pulPoTf2AL(float *ss[], struct PoTPlan *P) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("sse_pulPoTf2AL()");
+#endif
__m128 sum1, sum2, tmp1, tmp2, max1, max2;
int i;
@@ -2790,11 +3093,18 @@ float sse_pulPoTf2AL(float *ss[], struct PoTPlan *P) {
sum1 = _mm_sub_ps(sum1, SSE_LIM( mask1 ) );
max1 = _mm_max_ps( max1, sum1 );
}
- return ( s_maxp2f( max1 ) );
+ float rv= ( s_maxp2f( max1 ) );
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
+ return rv;
}
float sse_pulPoTf2AL8(float *ss[], struct PoTPlan *P) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("sse_pulPoTf2AL8()");
+#endif
__m128 sum1, sum2, tmp1, tmp2, max1, max2;
int i;
@@ -2819,10 +3129,17 @@ float sse_pulPoTf2AL8(float *ss[], struct PoTPlan *P) {
max1 = _mm_max_ps( max1, sum1 );
max2 = _mm_max_ps( max2, sum2 );
- return ( s_maxp2f( _mm_max_ps( max1, max2 ) ) );
+ float rv= ( s_maxp2f( _mm_max_ps( max1, max2 ) ) );
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
+ return rv;
}
float sse_pulPoTf2AL4(float *ss[], struct PoTPlan *P) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("sse_pulPoTf2AL4()");
+#endif
__m128 sum1, tmp1, max1;
int i;
@@ -2839,7 +3156,11 @@ float sse_pulPoTf2AL4(float *ss[], struct PoTPlan *P) {
sum1 = _mm_sub_ps(sum1, SSE_LIM( mask1 ) );
max1 = _mm_max_ps( max1, sum1 );
- return ( s_maxp2f( max1 ) );
+ float rv= ( s_maxp2f( max1 ) );
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
+ return rv;
}
sum_func BHSSETB2AL[FOLDTBLEN] = {
@@ -2877,6 +3198,9 @@ submask tailmask[4] = {
float foldArrayBy3(float *ss[], struct PoTPlan *P) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("foldArrayBy3()");
+#endif
float max;
__m128 maxV = ZERO;
int i = 0;
@@ -2909,11 +3233,17 @@ float foldArrayBy3(float *ss[], struct PoTPlan *P) {
maxV = _mm_max_ps(maxV, _mm_shuffle_ps(maxV, maxV, 0x39));
_mm_store_ss(&max, maxV);
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return max;
}
float foldArrayBy3LO(float *ss[], struct PoTPlan *P) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("foldArrayBy3LO()");
+#endif
const float *p1 = ss[0], *p2 = ss[0]+P->tmp0, *p3 = ss[0]+P->tmp1;
float *pst = P->dest;
@@ -2925,6 +3255,9 @@ float foldArrayBy3LO(float *ss[], struct PoTPlan *P) {
if (pst[i] > max) max = pst[i];
i += 1;
}
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return max;
}
sum_func AKSSETB3[FOLDTBLEN] = {
@@ -2935,6 +3268,9 @@ sum_func AKSSETB3[FOLDTBLEN] = {
};
float foldArrayBy4(float *ss[], struct PoTPlan *P) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("foldArrayBy4()");
+#endif
float max;
__m128 maxV = ZERO;
int i = 0;
@@ -2971,10 +3307,16 @@ float foldArrayBy4(float *ss[], struct PoTPlan *P) {
maxV = _mm_max_ps(maxV, _mm_shuffle_ps(maxV, maxV, 0x39));
_mm_store_ss(&max, maxV);
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return max;
}
float foldArrayBy4LO(float *ss[], struct PoTPlan *P) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("foldArrayBy4LO()");
+#endif
const float *p1 = ss[0], *p2 = ss[0]+P->tmp0, *p3 = ss[0]+P->tmp1, *p4 = ss[0]+P->tmp2;
float *pst = P->dest;
@@ -2986,6 +3328,9 @@ float foldArrayBy4LO(float *ss[], struct PoTPlan *P) {
if (pst[i] > max) max = pst[i];
i += 1;
}
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return max;
}
sum_func AKSSETB4[FOLDTBLEN] = {
@@ -2996,6 +3341,9 @@ sum_func AKSSETB4[FOLDTBLEN] = {
};
float foldArrayBy5(float *ss[], struct PoTPlan *P) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("foldArrayBy5()");
+#endif
float max;
__m128 maxV = ZERO;
int i = 0;
@@ -3036,10 +3384,16 @@ float foldArrayBy5(float *ss[], struct PoTPlan *P) {
maxV = _mm_max_ps(maxV, _mm_shuffle_ps(maxV, maxV, 0x39));
_mm_store_ss(&max, maxV);
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return max;
}
float foldArrayBy5LO(float *ss[], struct PoTPlan *P) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("foldArrayBy5LO()");
+#endif
const float *p1 = ss[0], *p2 = ss[0]+P->tmp0, *p3 = ss[0]+P->tmp1, *p4 = ss[0]+P->tmp2, *p5 = ss[0]+P->tmp3;
float *pst = P->dest;
@@ -3051,6 +3405,9 @@ float foldArrayBy5LO(float *ss[], struct PoTPlan *P) {
if (pst[i] > max) max = pst[i];
i += 1;
}
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return max;
}
@@ -3064,6 +3421,9 @@ sum_func AKSSETB5[FOLDTBLEN] = {
// 2A version allows non-aligned tmp0
float foldArrayBy2A(float *ss[], struct PoTPlan *P) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("FoldArrayBy2A()");
+#endif
float max;
__m128 maxV = ZERO;
int i = 0;
@@ -3092,6 +3452,9 @@ float foldArrayBy2A(float *ss[], struct PoTPlan *P) {
maxV = _mm_max_ps(maxV, _mm_shuffle_ps(maxV, maxV, 0x39));
_mm_store_ss(&max, maxV);
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return max;
}
@@ -3099,6 +3462,9 @@ float foldArrayBy2A(float *ss[], struct PoTPlan *P) {
float foldArrayBy2AL(float *ss[], struct PoTPlan *P) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("foldArrayBy2AL()");
+#endif
float max;
__m128 maxV = ZERO;
int i = 0;
@@ -3127,10 +3493,16 @@ float foldArrayBy2AL(float *ss[], struct PoTPlan *P) {
maxV = _mm_max_ps(maxV, _mm_shuffle_ps(maxV, maxV, 0x39));
_mm_store_ss(&max, maxV);
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return max;
}
float foldArrayBy2LO(float *ss[], struct PoTPlan *P) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("foldArrayBy2LO()");
+#endif
const float *p1 = ss[1]+P->offset, *p2 = ss[1]+P->tmp0;
float *pst = P->dest;
@@ -3142,6 +3514,9 @@ float foldArrayBy2LO(float *ss[], struct PoTPlan *P) {
if (pst[i] > max) max = pst[i];
i += 1;
}
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return max;
}
sum_func AKSSETB2[FOLDTBLEN] = {
diff --git a/client/vector/analyzeFuncs_sse2.cpp b/client/vector/analyzeFuncs_sse2.cpp
index 833aa5f..04d6f32 100644
--- a/client/vector/analyzeFuncs_sse2.cpp
+++ b/client/vector/analyzeFuncs_sse2.cpp
@@ -36,13 +36,19 @@
#include "analyzeFuncs.h"
-__inline __m128 vec_recip2(__m128 v)
- {
+__inline __m128 vec_recip2(__m128 v) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("vec_recip2()");
+#endif
// obtain estimate
__m128 estimate = _mm_rcp_ps( v );
// one round of Newton-Raphson
- return _mm_add_ps(_mm_mul_ps(_mm_sub_ps(ONE, _mm_mul_ps(estimate, v)), estimate), estimate);
- }
+ __m128 rv=_mm_add_ps(_mm_mul_ps(_mm_sub_ps(ONE, _mm_mul_ps(estimate, v)), estimate), estimate);
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
+ return rv;
+}
// =============================================================================
@@ -60,9 +66,15 @@ int sse2_ChirpData_ak(
double sample_rate
) {
int i;
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("sse2_ChirpData_ak()");
+#endif
if (chirp_rate_ind == 0) {
memcpy(cx_ChirpDataArray, cx_DataArray, (int)ul_NumDataPoints * sizeof(sah_complex) );
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return 0;
}
@@ -190,6 +202,9 @@ int sse2_ChirpData_ak(
}
analysis_state.FLOP_counter+=12.0*ul_NumDataPoints;
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return 0;
}
@@ -208,10 +223,16 @@ int sse2_ChirpData_ak8(
int ul_NumDataPoints,
const double sample_rate
) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("sse2_ChirpData_ak8()");
+#endif
int i, vEnd;
if (chirp_rate_ind == 0) {
memcpy(cx_ChirpDataArray, cx_DataArray, (int)ul_NumDataPoints * sizeof(sah_complex) );
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return 0;
}
@@ -322,6 +343,9 @@ int sse2_ChirpData_ak8(
}
analysis_state.FLOP_counter+=12.0*ul_NumDataPoints;
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return 0;
}
diff --git a/client/vector/analyzeFuncs_sse3.cpp b/client/vector/analyzeFuncs_sse3.cpp
index 6b50111..0ef13e5 100644
--- a/client/vector/analyzeFuncs_sse3.cpp
+++ b/client/vector/analyzeFuncs_sse3.cpp
@@ -48,10 +48,17 @@
__inline __m128 vec_recip3(__m128 v)
{
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("vec_recip3()");
+#endif
// obtain estimate
__m128 estimate = _mm_rcp_ps( v );
// one round of Newton-Raphson
- return _mm_add_ps(_mm_mul_ps(_mm_sub_ps(ONE, _mm_mul_ps(estimate, v)), estimate), estimate);
+ __m128 rv=_mm_add_ps(_mm_mul_ps(_mm_sub_ps(ONE, _mm_mul_ps(estimate, v)), estimate), estimate);
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
+ return rv;
}
// =============================================================================
@@ -69,9 +76,15 @@ int sse3_ChirpData_ak(
double sample_rate
) {
int i;
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("sse3_ChirpData_ak()");
+#endif
if (chirp_rate_ind == 0) {
memcpy(cx_ChirpDataArray, cx_DataArray, (int)ul_NumDataPoints * sizeof(sah_complex) );
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return 0;
}
@@ -182,6 +195,9 @@ int sse3_ChirpData_ak(
}
analysis_state.FLOP_counter+=12.0*ul_NumDataPoints;
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return 0;
}
@@ -201,10 +217,16 @@ int sse3_ChirpData_ak8(
int ul_NumDataPoints,
double sample_rate
) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("sse3_ChirpData_ak8()");
+#endif
int i;
if (chirp_rate_ind == 0) {
memcpy(cx_ChirpDataArray, cx_DataArray, (int)ul_NumDataPoints * sizeof(sah_complex) );
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return 0;
}
@@ -321,6 +343,9 @@ int sse3_ChirpData_ak8(
cx_ChirpDataArray[i][1] = re * s + im * c;
}
analysis_state.FLOP_counter+=12.0*ul_NumDataPoints;
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return 0;
}
diff --git a/client/vector/analyzeFuncs_vector.cpp b/client/vector/analyzeFuncs_vector.cpp
index 4a58551..aa1846e 100644
--- a/client/vector/analyzeFuncs_vector.cpp
+++ b/client/vector/analyzeFuncs_vector.cpp
@@ -68,7 +68,8 @@
#include "sah_gfx_main.h"
#endif
#include "diagnostics.h"
-
+#include "filesys.h"
+#include "str_replace.h"
#include "sighandler.h"
#include "analyzeFuncs.h"
#include "analyzeFuncs_vector.h"
@@ -98,38 +99,43 @@
#ifndef __APPLE_CC__
-#ifdef HAVE___ISNAN
-#define isnotnan(x) (!__isnan(x))
-#elif defined(HAVE__ISNAN)
+#if defined(HAVE__ISNAN)
#define isnotnan(x) (!_isnan(x))
#elif defined(HAVE_ISNAN)
#define isnotnan(x) (!isnan(x))
+#elif defined(HAVE___ISNAN)
+#define isnotnan(x) (!__isnan(x))
#else
#define isnotnan(x) ((x) == (x))
#endif
#endif
-// Bit patterns to compare host capabilities and what SIMD capability a routine needs
-#define BA_ANY 0x00000001 // any CPU OK
-#define BA_MMX 0x00000002
-#define BA_SSE 0x00000004
-#define BA_SSE2 0x00000008
-#define BA_SSE3 0x00000010
-#define BA_3Dnow 0x00000020
-#define BA_3DnowP 0x00000040
-#define BA_MMX_P 0x00000080
-#define BA_SSSE3 0x00000100
-#define BA_SSE41 0x00000200
-#define BA_SSE4a 0x00000400
-#define BA_SSE42 0x00000800
-#define BA_XOP 0x00001001
-#define BA_AVX 0x00002000
-#define BA_FMA 0x00004000
-#define BA_FMA4 0x00008000
-#define BA_ALTVC 0x00100000
-#define BA_NEON 0x00200000
-#define BA_VFP 0x00400000
+static bool do_print;
+// Bit patterns to compare host capabilities and what SIMD capability a routine needs
+#define BA_ANY 0x00000001 // any CPU OK
+#define BA_MMX 0x00000002
+#define BA_SSE 0x00000004
+#define BA_SSE2 0x00000008
+#define BA_SSE3 0x00000010
+#define BA_3Dnow 0x00000020
+#define BA_3DnowP 0x00000040
+#define BA_MMX_P 0x00000080
+#define BA_SSSE3 0x00000100
+#define BA_SSE41 0x00000200
+#define BA_SSE4a 0x00000400
+#define BA_SSE42 0x00000800
+#define BA_XOP 0x00001001
+#define BA_AVX 0x00002000
+#define BA_FMA 0x00004000
+#define BA_FMA4 0x00008000
+#define BA_ALTVC 0x00100000
+#define BA_NEON 0x00200000
+#define BA_VFP 0x00400000
+#define BA_VFPV3 0x00800000
+#define BA_VFPV3D16 0x01000000
+#define BA_VFPV4 0x02000000
+#define BA_VFPV4D16 0x04000000
uint32_t CPUCaps = BA_ANY;
@@ -143,6 +149,9 @@ uint32_t CPUCaps = BA_ANY;
#if defined(USE_AVX)
int avxSupported(void) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("avxSupported()");
+#endif
int retval = 1;
#if defined(__GNUC__) && (((__GNUC__ == 4) && (__GNUC_MINOR__ > 3)) || (__GNUC__ > 4))
#if defined(__i386__) && (defined(__PIC__) || defined(__pic__))
@@ -193,6 +202,9 @@ int avxSupported(void) {
DONE:
};
#endif // compiler
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return retval;
}
#endif // USE_AVX
@@ -200,6 +212,9 @@ int avxSupported(void) {
/**********************
*/
void SetCapabilities(void) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("SetCapabilities()");
+#endif
#if defined(__APPLE_CC__)
// OS X assumes MMX, SSE and SSE2 are present on Intel processors
@@ -253,15 +268,51 @@ void SetCapabilities(void) {
#elif defined(__arm__) && defined(__VFP_FP__) && !defined(__SOFTFP__)
-#if defined(HAVE_CPU_FEATURES_H) && defined(ANDROID)
- uint64_t features=android_getCpuFeatures();
- if (features & ANDROID_CPU_ARM_FEATURE_ARMv7) CPUCaps |= BA_VFP;
- if (features & ANDROID_CPU_ARM_FEATURE_NEON) CPUCaps |= BA_NEON;
-#else
- CPUCaps |= BA_VFP;
- CPUCaps |= BA_NEON;
+#if defined(ANDROID) || defined(__linux__)
+ // if strlen(p_features) is 0 or p_features doesn't contain "vfp" assume
+ // either BOINC is screwed up or we're running stand along.
+ size_t len=strlen(app_init_data.host_info.p_features);
+ if ((len==0) || (strstr(app_init_data.host_info.p_features,"vfp") == 0)) {
+ if (do_print) fprintf(stderr,"Getting CPU Capabilities from /proc/cpuinfo\n");
+ app_init_data.host_info.p_features[0]=0;
+ char buf[256];
+ FILE *cpuinfo=boinc_fopen("/proc/cpuinfo","r");
+ if (cpuinfo) {
+ while (fgets(buf,sizeof(buf),cpuinfo)) {
+ if (strstr(buf, "Features")==buf) {
+ strlcpy(app_init_data.host_info.p_features,strstr(buf,":")+1,sizeof(app_init_data.host_info.p_features));
+ break;
+ }
+ }
+ fclose(cpuinfo);
+ } else {
+ fprintf(stderr,"Could not open /proc/cpuinfo\n");
+ }
+ len=strlen(app_init_data.host_info.p_features);
+ if (len == 0) fprintf(stderr,"Didn't find 'Features' line\n");
+ }
+
+ // ensure the features list ends with a space.
+ if ((app_init_data.host_info.p_features[len-1] != ' ') &&
+ (len<sizeof(app_init_data.host_info.p_features))) {
+ app_init_data.host_info.p_features[len++]=' ';
+ app_init_data.host_info.p_features[len]=0;
+ }
+ if (do_print) fprintf(stderr,"features: %s\n",app_init_data.host_info.p_features);
+
+ if (strstr(app_init_data.host_info.p_features," vfpv4 ")) CPUCaps |= BA_VFPV4;
+ if (strstr(app_init_data.host_info.p_features," vfpv4d16 ")) CPUCaps |= BA_VFPV4D16;
+ if (strstr(app_init_data.host_info.p_features," vfpv3 ")) CPUCaps |= BA_VFPV3;
+ if (strstr(app_init_data.host_info.p_features," vfpv3d16 ")) CPUCaps |= BA_VFPV3D16;
+ if (strstr(app_init_data.host_info.p_features," vfp ")) CPUCaps |= BA_VFP;
+#ifdef USE_NEON
+ if (strstr(app_init_data.host_info.p_features," neon ")) CPUCaps |= BA_NEON;
#endif
+#endif // ANDROID
+#endif // __arm__
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
#endif
}
@@ -297,8 +348,10 @@ GPStb GetPowerSpectrumFuncs[]={
#endif
#if defined(__arm__) && defined(__VFP_FP__) && !defined(__SOFTFP__)
vfp_GetPowerSpectrum, BA_VFP, "vfp_GetPowerSpectrum",
+#ifdef USE_NEON
neon_GetPowerSpectrum, BA_NEON, "neon_GetPowerSpectrum",
#endif
+#endif
};
const int num_GPS=(sizeof(GetPowerSpectrumFuncs)/sizeof(GPStb));
@@ -340,8 +393,10 @@ CDtb ChirpDataFuncs[]={
#endif
#if defined(__arm__) && defined(__VFP_FP__) && !defined(__SOFTFP__)
vfp_ChirpData, BA_VFP, "vfp_ChirpData",
+#ifdef USE_NEON
neon_ChirpData, BA_NEON, "neon_ChirpData",
#endif
+#endif
};
const int num_CD=(sizeof(ChirpDataFuncs)/sizeof(CDtb));
@@ -396,7 +451,6 @@ bool found_transpose=false;
/***************************************************************************/
-
FolSub FoldSubs[] = {
&swifold, BA_ANY,
#ifdef USE_ALTIVEC
@@ -416,16 +470,20 @@ FolSub FoldSubs[] = {
#endif
#if defined(__arm__) && defined(__VFP_FP__) && !defined(__SOFTFP__)
&vfpFoldMain, BA_VFP,
+#ifdef USE_NEON
&neonFoldMain, BA_NEON,
#endif
+#endif
};
const int num_FS=(sizeof(FoldSubs)/sizeof(FolSub));
bool found_folding=false;
-static bool do_print;
bool TestBoincSignalHandling() {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("TestBoincSignalHandling()");
+#endif
#ifdef USE_ASMLIB
return true;
#endif
@@ -433,12 +491,18 @@ bool TestBoincSignalHandling() {
FORCE_FRAME_POINTER;
if (sigsetjmp(jb,1)) {
uninstall_sighandler();
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return true;
} else {
// Try some illegal instructions to check the signal handling.
#ifdef __GNUC__
#if defined(__APPLE__)
uninstall_sighandler();
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return true;
#elif defined(__x86_64__)
__asm__ ("movq %cr4,%rax");
@@ -452,6 +516,9 @@ bool TestBoincSignalHandling() {
#elif defined(_MSC_VER) && ( defined(_M_IX86) || defined(_M_X64) )
#ifndef _NDEBUG
uninstall_sighandler();
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return true;
#else
__asm {
@@ -463,11 +530,17 @@ bool TestBoincSignalHandling() {
#endif
}
uninstall_sighandler();
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return false;
}
BaseLineSmooth_func ChooseBaseLineSmooth() {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("ChooseBaseLineSmooth()");
+#endif
hires_timer timer;
BaseLineSmooth_func baseline_smooth;
int i,j,rv,k = sizeof(BaseLineSmoothFuncs)/sizeof(BLStb);
@@ -480,6 +553,9 @@ BaseLineSmooth_func ChooseBaseLineSmooth() {
if (do_print) fprintf(stderr,"%32s (no other)%s\n",
BaseLineSmoothFuncs[0].nom,
verbose ? "\n": "");
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return v_BaseLineSmooth;
}
sah_complex *indata=(sah_complex *)malloc_a(NumDataPoints*sizeof(sah_complex),MEM_ALIGN);
@@ -494,6 +570,9 @@ BaseLineSmooth_func ChooseBaseLineSmooth() {
free_a(outdata);
if (save)
free_a(save);
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return v_BaseLineSmooth;
}
for (i=0;i<NumDataPoints;i++) {
@@ -573,13 +652,22 @@ BaseLineSmooth_func ChooseBaseLineSmooth() {
best_timing,
best_accuracy,
verbose ? " choice\n": "");
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return baseline_smooth;
}
GetPowerSpectrum_func ChooseGetPowerSpectrum() {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("ChooseGetPowerSpectrum()");
+#endif
if (default_functions_flag) {
if (do_print)
fprintf(stderr,"%32s (default)\n",GetPowerSpectrumFuncs[0].nom);
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return GetPowerSpectrumFuncs[0].func;
} // else
hires_timer timer;
@@ -601,6 +689,9 @@ GetPowerSpectrum_func ChooseGetPowerSpectrum() {
free_a(outdata);
if (save)
free_a(save);
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return v_GetPowerSpectrum;
}
for (i=0;i<NumDataPoints;i++) {
@@ -683,6 +774,9 @@ GetPowerSpectrum_func ChooseGetPowerSpectrum() {
best_timing,
best_accuracy,
verbose ? " choice\n": "");
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return get_power_spectrum;
}
@@ -691,11 +785,17 @@ extern void FreeTrigArray();
extern void InitTrigArray(int len, double ChirpStep, int InitInd, double SampleRate);
ChirpData_func ChooseChirpData() {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("ChooseChirpData()");
+#endif
bool CacheChirpCalc=((app_init_data.host_info.m_nbytes == 0) ||
(app_init_data.host_info.m_nbytes >= MIN_TRIGARRAY_MEMORY));
if (default_functions_flag) {
if (do_print)
fprintf(stderr,"%32s (default)\n",ChirpDataFuncs[0].nom);
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return ChirpDataFuncs[0].func;
} // else
hires_timer timer;
@@ -709,6 +809,9 @@ ChirpData_func ChooseChirpData() {
if (k == 1) {
if (do_print) fprintf(stderr,"%32s (no other)\n",ChirpDataFuncs[0].nom);
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return v_ChirpData;
}
sah_complex *indata=(sah_complex *)malloc_a(NumDataPoints*sizeof(sah_complex),MEM_ALIGN);
@@ -723,6 +826,9 @@ ChirpData_func ChooseChirpData() {
if (test)
free_a(test);
fprintf(stderr,"Memory allocation failed in ChooseChirp\n");
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return v_ChirpData;
}
//JWS: Generate indata as the chirp of flat line (constant) data
@@ -831,13 +937,22 @@ ChirpData_func ChooseChirpData() {
best_timing,
best_accuracy,
verbose ? " choice\n": "");
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return chirp_data;
}
Transpose_func ChooseTranspose() {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("ChooseTranspose()");
+#endif
if (default_functions_flag) {
if (do_print)
fprintf(stderr,"%32s (default)\n",TransposeFuncs[2].nom); //JWS: v_Transpose4 is the default
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return TransposeFuncs[2].func;
} // else
hires_timer timer;
@@ -859,6 +974,9 @@ Transpose_func ChooseTranspose() {
free_a(outdata);
if (save)
free_a(save);
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return v_Transpose;
}
for (i=0;i<NumDataPoints;i++) {
@@ -941,6 +1059,9 @@ Transpose_func ChooseTranspose() {
best_timing,
best_accuracy,
verbose ? " choice\n": "");
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return transpose;
}
@@ -1012,6 +1133,9 @@ FoldSet TestFoldSet = {fold3test, fold4test, fold5test, fold2test, fold2ALtest,
*
*/
int planFoldTest(PoTPlan * PSeq, float *div, int FFTtbl[][5]) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("planFoldTest()");
+#endif
float period;
int i, iL, j, di, ndivs;
int num_adds, num_adds_2;
@@ -1106,6 +1230,9 @@ int planFoldTest(PoTPlan * PSeq, float *div, int FFTtbl[][5]) {
PSeq[iDmp].di, PSeq[iDmp].dest, PSeq[iDmp].fun_ptr, PSeq[iDmp].tmp0, PSeq[iDmp].tmp1);
}
*/
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return (k);
}
@@ -1116,9 +1243,15 @@ int planFoldTest(PoTPlan * PSeq, float *div, int FFTtbl[][5]) {
*
*/
int ChooseFoldSubs(ChirpFftPair_t * ChirpFftPairs, int num_cfft, int nsamples) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("ChooseFoldSubs()");
+#endif
if (default_functions_flag) {
if (do_print)
fprintf(stderr,"%24s folding (default)\n",Foldmain.name);
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return 0;
} // else
hires_timer timer;
@@ -1167,7 +1300,13 @@ int ChooseFoldSubs(ChirpFftPair_t * ChirpFftPairs, int num_cfft, int nsamples) {
NumPlans += 3 * FFTtbl[iL][2] * ndivs;
}
}
- if (NumPlans == 0) return 0; // No pulse finding in this WU, abort test.
+ if (NumPlans == 0) {
+ // No pulse finding in this WU, abort test.
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
+ return 0;
+ }
// At some angle ranges the total number of test folds may be too few to get good
// timing measurements. Scale up so there are at least 16K test folds.
@@ -1203,6 +1342,9 @@ int ChooseFoldSubs(ChirpFftPair_t * ChirpFftPairs, int num_cfft, int nsamples) {
free_a(maxdata);
if (save)
free_a(save);
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return 0; // Can't test, make no change
}
@@ -1303,6 +1445,9 @@ int ChooseFoldSubs(ChirpFftPair_t * ChirpFftPairs, int num_cfft, int nsamples) {
best_accuracy,
verbose ? " choice\n": "");
CopyFoldSet(&Foldmain, FoldSubs[best].fsp);
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return 0;
}
@@ -1316,41 +1461,47 @@ void ChooseFunctions(BaseLineSmooth_func *baseline_smooth,
int num_cfft,
int nsamples,
bool print_choices) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("ChooseFunctions()");
+#endif
do_print=print_choices;
if (verbose) do_print = true;
- if (do_print) {
- fprintf(stderr,"Optimal function choices:\n");
- fprintf(stderr,"--------------------------------------------------------\n");
- fprintf(stderr,"%32s %8s %7s\n","name","timing","error");
- fprintf(stderr,"--------------------------------------------------------\n");
- fflush(stderr);
- }
if (TestBoincSignalHandling()) {
SetCapabilities();
hires_timer durtimer;
double TestDur=0;
+ if (do_print) {
+ fprintf(stderr,"Optimal function choices:\n");
+ fprintf(stderr,"--------------------------------------------------------\n");
+ fprintf(stderr,"%32s %8s %7s\n","name","timing","error");
+ fprintf(stderr,"--------------------------------------------------------\n");
+ fflush(stderr);
+ }
durtimer.start();
#ifdef ANDROID
// low memory android is a special case because android will kill
// without warning to free memory. Testing the functions could trigger
// a loop. So we'll choose what fits the processor and return
if (app_init_data.host_info.m_nbytes &&
- (app_init_data.host_info.m_nbytes < MIN_TRANSPOSE_MEMORY)) {
+ (app_init_data.host_info.m_nbytes < MIN_TRIGARRAY_MEMORY)) {
*baseline_smooth=v_BaseLineSmooth;
found_baseline_smooth=true;
if (do_print) fprintf(stderr,"%32s (no other)\n",
"v_BaseLineSmooth");
#if defined(__VFP_FP__) && !defined(__SOFTFP__)
+#ifdef USE_NEON
if (CPUCaps & BA_NEON) {
- *get_power_spectrum=neon_GetPowerSpectrum;
+ *get_power_spectrum=vfp_GetPowerSpectrum;
found_get_power_spectrum=true;
if (do_print) fprintf(stderr,"%32s (CPU Caps)\n",
- "neon_GetPowerSpectrum");
+ "vfp_GetPowerSpectrum");
*chirp_data=neon_ChirpData;
found_chirp_data=true;
if (do_print) fprintf(stderr,"%32s (CPU Caps)\n",
"neon_ChirpData");
- } else if (CPUCaps & BA_VFP) {
+ } else
+#endif
+ if (CPUCaps & BA_VFP) {
*get_power_spectrum=vfp_GetPowerSpectrum;
found_get_power_spectrum=true;
if (do_print) fprintf(stderr,"%32s (CPU Caps)\n",
@@ -1377,16 +1528,19 @@ void ChooseFunctions(BaseLineSmooth_func *baseline_smooth,
if (do_print) fprintf(stderr,"%32s (default)\n",
"v_Transpose4");
#if defined(__VFP_FP__) && !defined(__SOFTFP__)
+#ifdef USE_NEON
if (CPUCaps & BA_NEON) {
CopyFoldSet(&Foldmain, &neonFoldMain);
found_folding=true;
if (do_print) fprintf(stderr,"%32s (CPU Caps)\n",
- "neonFoldMain");
- } else if (CPUCaps & BA_VFP) {
+ "opt NEON folding");
+ } else
+#endif
+ if (CPUCaps & BA_VFP) {
CopyFoldSet(&Foldmain, &vfpFoldMain);
found_folding=true;
if (do_print) fprintf(stderr,"%32s (CPU Caps)\n",
- "vfpFoldMain");
+ "oft VFP folding");
} else {
#endif
CopyFoldSet(&Foldmain, &swifold);
@@ -1402,10 +1556,10 @@ void ChooseFunctions(BaseLineSmooth_func *baseline_smooth,
if (do_print) {
fflush(stderr);
}
+ call_stack.exit();
return;
}
#endif
-
if (!found_baseline_smooth) {
*baseline_smooth=ChooseBaseLineSmooth();
} else {
@@ -1451,7 +1605,9 @@ void ChooseFunctions(BaseLineSmooth_func *baseline_smooth,
if (do_print) {
fflush(stderr);
}
-
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
}
diff --git a/client/vector/analyzeFuncs_vector.h b/client/vector/analyzeFuncs_vector.h
index ecb868c..0d06e1b 100644
--- a/client/vector/analyzeFuncs_vector.h
+++ b/client/vector/analyzeFuncs_vector.h
@@ -359,11 +359,13 @@ extern int v_avxGetPowerSpectrum(
#endif
#if defined(__arm__) && defined(__VFP_FP__) && !defined(__SOFTFP__)
+#ifdef USE_NEON
extern int neon_GetPowerSpectrum(
sah_complex * cx_FreqData,
float * fp_PowerSpectrum,
int ul_NumDataPoints
);
+#endif
extern int vfp_GetPowerSpectrum(
sah_complex * cx_FreqData,
float * fp_PowerSpectrum,
@@ -378,6 +380,7 @@ extern int vfp_ChirpData (
int ul_NumDataPoints,
double sample_rate
);
+#ifdef USE_NEON
extern int neon_ChirpData (
sah_complex * cx_DataArray,
sah_complex * cx_ChirpDataArray,
@@ -386,7 +389,7 @@ extern int neon_ChirpData (
int ul_NumDataPoints,
double sample_rate
);
-
+#endif
#endif
#endif
diff --git a/client/vector/analyzeFuncs_vfp_aux.cpp b/client/vector/analyzeFuncs_vfp_aux.cpp
index ada6bb3..531ce68 100644
--- a/client/vector/analyzeFuncs_vfp_aux.cpp
+++ b/client/vector/analyzeFuncs_vfp_aux.cpp
@@ -67,6 +67,11 @@ inline void v_pfsubTranspose(float *in, float *out, int xline, int yline) {
// appropriate part of a YLINE by XLINE matrix. "IN" points to the first
// (lowest address) element of the input submatrix. "OUT" points to the
// first (lowest address) element of the output submatrix.
+#ifdef USE_MANUAL_CALLSTACK
+ static char name[64];
+ if (name[0]==0) sprintf(name,"v_pfsubTranspose<%d>()",x);
+ call_stack.enter(name);
+#endif
int i,j;
float *p;
register float tmp[x*x];
@@ -84,10 +89,16 @@ inline void v_pfsubTranspose(float *in, float *out, int xline, int yline) {
}
pld(in+j*xline+x);
}
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
}
int v_pfTranspose2(int x, int y, float *in, float *out) {
// Attempts to improve cache hit ratio by transposing 4 elements at a time.
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("v_pfTranspose2()");
+#endif
int i,j;
for (j=0;j<y-1;j+=2) {
for (i=0;i<x-1;i+=2) {
@@ -102,11 +113,17 @@ int v_pfTranspose2(int x, int y, float *in, float *out) {
out[i*y+j]=in[j*x+i];
}
}
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return 0;
}
int v_pfTranspose4(int x, int y, float *in, float *out) {
// Attempts to improve cache hit ratio by transposing 16 elements at a time.
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("v_pfTranspose4()");
+#endif
int i,j;
for (j=0;j<y-3;j+=4) {
for (i=0;i<x-3;i+=4) {
@@ -132,11 +149,17 @@ int v_pfTranspose4(int x, int y, float *in, float *out) {
out[i*y+j]=in[j*x+i];
}
}
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return 0;
}
int v_pfTranspose8(int x, int y, float *in, float *out) {
// Attempts to improve cache hit ratio by transposing 64 elements at a time.
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("v_pfTranspose8()");
+#endif
int i,j;
for (j=0;j<y-7;j+=8) {
for (i=0;i<x-7;i+=8) {
@@ -176,11 +199,17 @@ int v_pfTranspose8(int x, int y, float *in, float *out) {
out[i*y+j]=in[j*x+i];
}
}
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return 0;
}
static inline int vfp_subTranspose2(int x, int y, float *in, float *out) {
// Attempts to improve cache hit ratio by transposing 4 elements at a time.
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("vfp_subTranspose2()");
+#endif
__asm__ __volatile__ (
"fldmias %2, {s4, s5}\n"
"fldmias %3, {s6, s7}\n"
@@ -192,11 +221,17 @@ static inline int vfp_subTranspose2(int x, int y, float *in, float *out) {
:
: "r" (out), "r" (out+y), "r" (in), "r" (in+x)
: "s3", "s4", "s5", "s6", "s7" );
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return 0;
}
int v_vfpTranspose2(int x, int y, float *in, float *out) {
// Attempts to improve cache hit ratio by transposing 4 elements at a time.
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("vfp_Transpose2()");
+#endif
int i,j;
for (j=0;j<y-1;j+=2) {
for (i=0;i<x-1;i+=2) {
@@ -211,6 +246,9 @@ int v_vfpTranspose2(int x, int y, float *in, float *out) {
out[i*y+j]=in[j*x+i];
}
}
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return 0;
}
diff --git a/client/vector/analyzeFuncs_x86_64.cpp b/client/vector/analyzeFuncs_x86_64.cpp
index 15b37fc..e2006a4 100644
--- a/client/vector/analyzeFuncs_x86_64.cpp
+++ b/client/vector/analyzeFuncs_x86_64.cpp
@@ -58,6 +58,9 @@ int v_vChirpData_x86_64(
int ul_NumDataPoints,
double sample_rate
) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("v_vChirpData_x86_64()");
+#endif
static const int as [4] __attribute__((aligned(16)))= {INT_MIN, 0, INT_MIN, 0} ; // {-, +, -, +}
char *cblock = (char *)alloca(11*16);
cblock+=(16-((ssize_t)cblock % 16));
@@ -181,6 +184,9 @@ int v_vChirpData_x86_64(
_mm_storel_pi ((__m64 *) (fp_ChirpDataArray + i), ri);
}
}
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return 0;
}
#endif
diff --git a/client/vector/fp_arm.h b/client/vector/fp_arm.h
index a5f23af..a4197c3 100644
--- a/client/vector/fp_arm.h
+++ b/client/vector/fp_arm.h
@@ -39,6 +39,7 @@
#if defined(__arm__) && !defined(_RC_CHOP)
#include <signal.h>
#include <setjmp.h>
+#include "s_util.h"
#include "sighandler.h"
// Exception masks
@@ -119,22 +120,25 @@ inline static unsigned int restorefp() {
return save_cw;
}
+#if 0
static const uint64_t arm_TWO_TO_52(0x4330000000000000);
static const uint64_t arm_SIGN_BIT(0x8000000000000000);
static const uint32_t arm_TWO_TO_23(0x4b000000);
static const uint32_t arm_FSIGN_BIT(0x80000000);
+#if defined(__VFP_FP__) && !defined(__SOFTFP__)
+
inline static double arm_round(double x) {
register uint64_t s=*reinterpret_cast<uint64_t *>(&x) & arm_SIGN_BIT;
uint64_t a=s | arm_TWO_TO_52;
- register double d=*reinterpret_cast<double *>(&a);
+ volatile register double d=*reinterpret_cast<double *>(&a);
return (x+d)-d;
}
inline static float arm_round(float x) {
register uint32_t s=*reinterpret_cast<uint32_t *>(&x) & arm_FSIGN_BIT;
uint32_t a=s | arm_TWO_TO_23;
- register float d=*reinterpret_cast<float *>(&a);
+ volatile register float d=*reinterpret_cast<float *>(&a);
return (x+d)-d;
}
@@ -149,6 +153,8 @@ inline static float arm_floor(float x) {
}
#define floor(x) arm_floor(x)
+#endif
#endif
+#endif
diff --git a/client/vector/sighandler.h b/client/vector/sighandler.h
index 69543cf..b69ebec 100644
--- a/client/vector/sighandler.h
+++ b/client/vector/sighandler.h
@@ -67,11 +67,17 @@
#endif
-#ifdef HAVE_SIGLONGJMP
+#if defined(HAVE_SIGJMP_BUF)
static sigjmp_buf jb;
#else
static jmp_buf jb;
+#endif
+
+#if !defined(HAVE_SIGSETJMP) && !defined(sigsetjmp)
#define sigsetjmp(x,y) setjmp(x)
+#endif
+
+#if !defined(HAVE_SIGLONGJMP) && !defined(siglongjmp)
#define siglongjmp(x,y) longjmp(x,y)
#endif
static int sc;
@@ -86,6 +92,9 @@ typedef void (*signal_handler)(int);
/* all our signal handler does is jump to a place we've set */
static void sighandler(int x) {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("sighandler()");
+#endif
#if defined(HAVE_SIGACTION)
sigset_t unblock;
sigemptyset(&unblock);
@@ -103,6 +112,9 @@ static void sighandler(int x) {
signal(x,sighandler);
#endif
sc++;
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
siglongjmp(jb,1);
}
@@ -144,6 +156,9 @@ static const int install_handler[]={
/* Keep these as stubs even if signal handling is not enabled */
static inline void install_sighandler() {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("install_sighandler()");
+#endif
#ifdef HAVE_SIGACTION
struct sigaction new_action;
new_action.sa_handler=sighandler;
@@ -162,10 +177,16 @@ static inline void install_sighandler() {
}
i++;
}
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
}
static inline void uninstall_sighandler() {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("install_sighandler()");
+#endif
/* Don't uninstall the windows signal handler! */
int i=0,sig;
while ((sig=install_handler[i])!=0) {
@@ -179,6 +200,9 @@ static inline void uninstall_sighandler() {
}
i++;
}
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
}
//static inline void reinstall_sighandler() {
diff --git a/client/vector/x86_ops.h b/client/vector/x86_ops.h
index a81ff34..5a0c5da 100644
--- a/client/vector/x86_ops.h
+++ b/client/vector/x86_ops.h
@@ -135,7 +135,7 @@
#if defined(__SSE2__)
// SSE2 specific functions/macros here.
-#ifdef _MSC_VER
+#if defined(_MSC_VER) || defined(__clang__)
typedef __m128d x86_m128d;
#else
typedef double x86_m128d __attribute__ ((mode(V2DF))) __attribute__((aligned(16)));
@@ -144,7 +144,7 @@ typedef double x86_m128d __attribute__ ((mode(V2DF))) __attribute__((aligned(16)
#if defined(__SSE__)
// SSE specific functions/macros here.
-#ifdef _MSC_VER
+#if defined(_MSC_VER) || defined(__clang__)
typedef __m128 x86_m128;
typedef __m128i x86_m128i;
#else
diff --git a/client/worker.cpp b/client/worker.cpp
index bcf1a43..f610613 100644
--- a/client/worker.cpp
+++ b/client/worker.cpp
@@ -68,7 +68,9 @@ bool verbose;
// this gets called first on all platforms
int common_init() {
-
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("common_init()");
+#endif
#ifdef ALLOW_CFFT_FILE
FILE* f;
f = boinc_fopen(CFFT_FILENAME, "r");
@@ -77,14 +79,18 @@ int common_init() {
fclose(f);
}
#endif
-
-
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return 0;
}
// Do this when start on a work unit for the first time.
// Creates result header file.
static int initialize_for_wu() {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("initialize_for_wu()");
+#endif
int retval = 0;
FILE* f;
string path;
@@ -96,6 +102,9 @@ static int initialize_for_wu() {
fprintf(f, "<result>\n");
retval = seti_write_wu_header(f, 1);
fclose(f);
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return retval;
}
@@ -103,6 +112,9 @@ static int initialize_for_wu() {
// parse input and state files
//
static int read_wu_state() {
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("read_wu_state()");
+#endif
FILE* f;
int retval=0;
string path;
@@ -137,6 +149,9 @@ static int read_wu_state() {
}
boinc_fraction_done(progress*remaining+(1.0-remaining)*(1.0-remaining));
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
return 0;
}
@@ -144,13 +159,18 @@ void worker() {
int retval=0;
run_stage=POSTINIT;
FORCE_FRAME_POINTER;
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.enter("worker()");
+#endif
#if defined(__GNUC__) && defined (__i386__)
__asm__ __volatile__ ("andl $-16, %esp");
#endif
// Set up the FPU if necessary.
+#if 0
#ifdef __arm__
- controlfp(_RC_NEAREST|_NAN_DEFAULT|_FLUSH_TO_ZERO,_MCW_EM|_MCW_RC|_MCW_NAN|_MCW_FLUSH_TO_ZERO);
+ controlfp(0,0xc00000);
+#endif
#endif
try {
@@ -175,11 +195,20 @@ void worker() {
boinc_fraction_done(progress);
checkpoint(true); // force a checkpoint
boinc_finish(0);
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
exit(0); // an overflow is not an app error
} else {
e.print();
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
exit(static_cast<int>(e));
}
}
+#ifdef USE_MANUAL_CALLSTACK
+ call_stack.exit();
+#endif
}
diff --git a/client/working_collect2_line_for_android_armv6-neon b/client/working_collect2_line_for_android_armv6-neon
new file mode 100644
index 0000000..16cbb75
--- /dev/null
+++ b/client/working_collect2_line_for_android_armv6-neon
@@ -0,0 +1 @@
+ /usr/arm-linux-androideabi/bin/../libexec/gcc/arm-linux-androideabi/4.6/collect2 --sysroot=/usr/arm-linux-androideabi/sysroot --eh-frame-hdr -dynamic-linker /system/bin/linker -X -m armelf_linux_eabi -z noexecstack -z relro -z now -o seti_boinc /usr/arm-linux-androideabi/sysroot/usr/lib/crtbegin_dynamic.o -L/usr/arm-linux-androideabi/arm-linux-androideabi/lib/${targetarch} -L/usr/arm-linux-androideabi/sysroot/usr/lib -L/usr/arm-linux-androideabi/arm-linux-androideabi/lib -L/usr/arm-linu [...]
diff --git a/client/working_collect2_line_for_android_armv6-vfp b/client/working_collect2_line_for_android_armv6-vfp
new file mode 100644
index 0000000..f2465f4
--- /dev/null
+++ b/client/working_collect2_line_for_android_armv6-vfp
@@ -0,0 +1 @@
+ /usr/arm-linux-androideabi/bin/../libexec/gcc/arm-linux-androideabi/4.6/collect2 --sysroot=/usr/arm-linux-androideabi/sysroot --eh-frame-hdr -dynamic-linker /system/bin/linker -X -m armelf_linux_eabi -z noexecstack -z relro -z now -o seti_boinc /usr/arm-linux-androideabi/sysroot/usr/lib/crtbegin_dynamic.o -L/usr/arm-linux-androideabi/arm-linux-androideabi/lib/${targetarch} -L/usr/arm-linux-androideabi/sysroot/usr/lib -L/usr/arm-linux-androideabi/arm-linux-androideabi/lib -L/usr/arm-linu [...]
diff --git a/configure.ac b/configure.ac
index f9807d5..a9844d7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4,7 +4,7 @@
AC_PREREQ(2.57)
-AC_INIT(setiathome_v7, 7.19, korpela at ssl.berkeley.edu)
+AC_INIT(setiathome_v7, 7.28, korpela at ssl.berkeley.edu)
AC_CONFIG_MACRO_DIR([m4])
svnrev="`svn info | grep Revision:`"
@@ -218,6 +218,12 @@ fi
# Checks for libraries.
APP_LDFLAGS="$LDSTATIC $LDFLAGS"
APP_CFLAGS="$CFLAGS"
+AC_CHECK_LIB([log],[__android_log_print],
+ [APP_LIBS="-llog ${APP_LIBS}"])
+
+dnl AC_CHECK_LIB([corkscrew],[unwind_backtrace_signal_arch],
+dnl [APP_LIBS="-lcorkscrew ${APP_LIBS}"])
+
AC_CHECK_LIB([m], [sin],[
AC_DEFINE([HAVE_LIBM],[1],[Define to 1 if you have the math library])
APP_LIBS="-lm ${APP_LIBS}"
@@ -241,6 +247,15 @@ AC_CHECK_LIB([cpufeatures], [android_getCpuFeatures], [
],
[],
[-lm])
+AC_ARG_ENABLE(neon,
+ AC_HELP_STRING([--disable-neon],
+ [Disable neon instruction set on ARM devices]),
+ [enable_neon=${enableval}],
+ [enable_neon=yes])
+if test "x${enable_neon}" = xyes ; then
+ AC_DEFINE([USE_NEON],1,[Define to 1 to enable neon instructions on ARM devices])
+fi
+
SAH_CHECK_ASMLIB
APP_LIBS="${ASMLIB_LIBS} ${APP_LIBS}"
APP_CFLAGS="${ASMLIB_CFLAGS} ${APP_CFLAGS}"
@@ -372,7 +387,7 @@ SAH_LARGEFILE_BREAKS_CXX
SAH_HEADER_STDCXX
AC_HEADER_SYS_WAIT
AC_HEADER_TIME
-AC_CHECK_HEADERS([fcntl.h inttypes.h limits.h memory.h alloca.h malloc.h stdlib.h string.h strings.h errno.h sys/time.h sys/types.h sys/ioctl.h sys/statvfs.h unistd.h dirent.h math.h float.h ieeefp.h floatingpoint.h complex.h fftw3.h setjmp.h signal.h mach/mach_time.h sys/param.h sys/systm.h machine/cpu.h cpu-features.h sys/cpu-features.h machine/cpu-features.h])
+AC_CHECK_HEADERS([mmap.h mman.h sys/mman.h fcntl.h inttypes.h limits.h memory.h alloca.h malloc.h stdlib.h string.h strings.h errno.h sys/time.h sys/types.h sys/ioctl.h sys/statvfs.h unistd.h dirent.h math.h float.h ieeefp.h floatingpoint.h complex.h fftw3.h setjmp.h signal.h mach/mach_time.h sys/param.h sys/systm.h machine/cpu.h cpu-features.h sys/cpu-features.h machine/cpu-features.h])
save_cxxflags="${CXXFLAGS}"
save_cppflags="${CPPFLAGS}"
CXXFLAGS="${CXXFLAGS} -msse3"
@@ -402,6 +417,93 @@ AC_STRUCT_TM
AC_CHECK_SIZEOF([long int])
AC_CHECK_SIZEOF([long double])
AC_CHECK_TYPES([long long,_int64,int64_t,bool,_int32,int32_t, hrtime_t, uint_fast64_t, uint64_t, _uint64, u_int64_t, ptrdiff_t, ssize_t, off64_t])
+AC_CHECK_TYPES([sigjmp_buf, jmp_buf], [], [], [[#ifdef HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+#ifdef HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+#ifdef STDC_HEADERS
+# include <stdlib.h>
+# include <stddef.h>
+#else
+# ifdef HAVE_STDLIB_H
+# include <stdlib.h>
+# endif
+#endif
+#ifdef HAVE_STRING_H
+# if !defined STDC_HEADERS && defined HAVE_MEMORY_H
+# include <memory.h>
+# endif
+# include <string.h>
+#endif
+#ifdef HAVE_STRINGS_H
+# include <strings.h>
+#endif
+#ifdef HAVE_INTTYPES_H
+# include <inttypes.h>
+#endif
+#ifdef HAVE_STDINT_H
+# include <stdint.h>
+#endif
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+#ifdef HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+#ifdef HAVE_SETJMP_H
+# include <setjmp.h>
+#endif
+]])
+CXXFLAGS="${save_cxxflags} -mavx"
+CPPFLAGS="${save_cppflags} -mavx"
+AC_CHECK_TYPES([__m256,_m256,__m256d,_m256d,__m256i,_m256i],[],[],[[#ifdef HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+#ifdef HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+#ifdef STDC_HEADERS
+# include <stdlib.h>
+# include <stddef.h>
+#else
+# ifdef HAVE_STDLIB_H
+# include <stdlib.h>
+# endif
+#endif
+#ifdef HAVE_STRING_H
+# if !defined STDC_HEADERS && defined HAVE_MEMORY_H
+# include <memory.h>
+# endif
+# include <string.h>
+#endif
+#ifdef HAVE_STRINGS_H
+# include <strings.h>
+#endif
+#ifdef HAVE_INTTYPES_H
+# include <inttypes.h>
+#endif
+#ifdef HAVE_STDINT_H
+# include <stdint.h>
+#endif
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+#define __AVX__ 1
+#if defined(HAVE_IMMINTRIN_H)
+#include <immintrin.h>
+#elif defined(HAVE_AVXINTRIN_H)
+#include <avxintrin.h>
+#elif defined(HAVE_X86INTRIN_H)
+#include <x86intrin.h>
+#elif defined(HAVE_INTRIN_H)
+#include <intrin.h>
+#endif
+]])
+CXXFLAGS="${save_cxxflags}"
+CPPFLAGS="${save_cppflags}"
+
AC_CACHE_SAVE
# Checks for library functions.
@@ -414,7 +516,7 @@ if test "${ac_cv_func_alloca_works}" = "yes" ; then
fi
AC_FUNC_STAT
AC_FUNC_STRFTIME
-AC_CHECK_FUNCS([ _aligned_malloc alloca _alloca __builtin_alloca memalign atexit exit _exit getcwd memset munmap putenv strchr strstr strcasestr atoll dlopen gethrtime mach_absolute_time get_cyclecount clock_gettime nanotime microtime gettimeofday sqrt floor sinf cosf sincos sincosf atanf isnan _isnan __isnan isnanf _isnanf __isnanf siglongjmp sigsetjmp sigaction sysv_signal bsd_signal ])
+AC_CHECK_FUNCS([ _aligned_malloc alloca _alloca __builtin_alloca posix_memalign memalign atexit exit _exit getcwd memset munmap putenv strchr strstr strcasestr atoll dlopen gethrtime mach_absolute_time get_cyclecount clock_gettime nanotime microtime gettimeofday sqrt floor sinf cosf sincos sincosf atanf isnan _isnan __isnan isnanf _isnanf __isnanf siglongjmp sigsetjmp sigaction sysv_signal bsd_signal ])
SAH_CHECK_NAMESPACES
AH_TEMPLATE([HAVE_STD_MIN],[Define to 1 if min is in namespace std::])
AH_TEMPLATE([HAVE_STD_MAX],[Define to 1 if max is in namespace std::])
@@ -446,7 +548,7 @@ AC_ARG_WITH([float-abi],
AC_HELP_STRING([--with-float-abi=<abi>],
[set -mfloat-abi parameter for gcc]),
[FP_ABI_FLAGS="-mfloat-abi=$withval"],[
- if test "x$FP_ABI_FLAGS" = "x" && ! ( echo ${CFLAGS} ${CPPFLAGS} ${CXXFLAGS} | grep mfloat-abi ) ; then
+ if test "x$FP_ABI_FLAGS" = "x" && test "x`echo ${CFLAGS} ${CPPFLAGS} ${CXXFLAGS} | grep mfloat-ab`" = "x" ; then
case $host in
arm-*-armhf|arm-*-gnueabihf)
FP_ABI_FLAGS="-mfloat-abi=hard"
@@ -464,8 +566,8 @@ AC_ARG_WITH([fpu],
AC_HELP_STRING([--with-fpu=<fpu>],
[set -mfpu parameter for gcc]),
[FP_FLAGS="-mfpu=$withval"],[
- if test "x$FP_ABI_FLAGS" != "x-mfloat-abi=soft" && ! ( echo ${CFLAGS} ${CPPFLAGS} ${CXXFLAGS} | grep "mfloat-abi=soft[[ $]]" ) ; then
- if test "x$FP_FLAGS" = "x" && ! ( echo ${CFLAGS} ${CPPFLAGS} ${CXXFLAGS} | grep mfpu ) ; then
+ if test "x$FP_ABI_FLAGS" != "x-mfloat-abi=soft" && ! ( echo ${CFLAGS} ${CPPFLAGS} ${CXXFLAGS} | grep "mfloat-abi=soft[[ $]]" >/dev/null ) ; then
+ if test "x$FP_FLAGS" = "x" && ! ( echo ${CFLAGS} ${CPPFLAGS} ${CXXFLAGS} | grep mfpu >/dev/null ) ; then
case $host in
arm-*-armhf|arm-*-armel|arm-*-androideabi)
FP_FLAGS="-mfpu=vfp"
@@ -534,8 +636,8 @@ AC_CONFIG_FILES([Makefile
db/schema_to_class
assimilator/Makefile
validate/Makefile
- splitter_fft/Makefile
splitter_pfb/Makefile
+ splitter_fft/Makefile
])
AC_CONFIG_HEADERS([sah_config.h])
diff --git a/db/schema_master.cpp b/db/schema_master.cpp
index fe2dd6c..504ea9b 100644
--- a/db/schema_master.cpp
+++ b/db/schema_master.cpp
@@ -28,14440 +28,15718 @@ using namespace ifx;
const char *db_name="sah2b at sah_master_tcp";
int db_is_open;
-template <> const char * const db_type<coordinate_t>::type_name="coordinate_t";
-template <> const char * db_type<coordinate_t>::_search_tag=type_name;
+template <> const char *const db_type<coordinate_t>::type_name="coordinate_t";
+template <> const char *db_type<coordinate_t>::_search_tag=type_name;
template <> const int db_type<coordinate_t>::_nfields=3;
-template <> const char * const db_type<coordinate_t>::column_names[3]={"time","ra","dec"};
+template <> const char *const db_type<coordinate_t>::column_names[3]= {"time","ra","dec"};
-coordinate_t::coordinate_t() :
- db_type<coordinate_t>(*this),
- time(0),
- ra(0),
- dec(0)
-{
- db_open();
+coordinate_t::coordinate_t() :
+ db_type<coordinate_t>(*this),
+ time(0),
+ ra(0),
+ dec(0) {
+ db_open();
}
-coordinate_t::coordinate_t(const coordinate_t &a) :
- db_type<coordinate_t>(*this),
- time(a.time),
- ra(a.ra),
- dec(a.dec)
-{
- db_open();
+coordinate_t::coordinate_t(const coordinate_t &a) :
+ db_type<coordinate_t>(*this),
+ time(a.time),
+ ra(a.ra),
+ dec(a.dec) {
+ db_open();
}
-coordinate_t::coordinate_t(const SQL_ROW &a) :
- db_type<coordinate_t>(*this)
-{
- db_open();
- parse(a);
+coordinate_t::coordinate_t(const SQL_ROW &a) :
+ db_type<coordinate_t>(*this) {
+ db_open();
+ parse(a);
}
-coordinate_t::coordinate_t(const std::string &s,const char *tag) :
- db_type<coordinate_t>(*this)
-{
- db_open();
- if (xml_match_tag(s,tag)) {
- parse_xml(s,tag);
- } else {
- parse(s);
- }
+coordinate_t::coordinate_t(const std::string &s,const char *tag) :
+ db_type<coordinate_t>(*this) {
+ db_open();
+ if (xml_match_tag(s,tag)) {
+ parse_xml(s,tag);
+ } else {
+ parse(s);
+ }
}
coordinate_t &coordinate_t::operator =(const coordinate_t &a) {
- if (&a != this) {
- time=a.time;
- ra=a.ra;
- dec=a.dec;
- }
- return (*this);
-}
-
-
-std::string coordinate_t::update_format() const
-{ std::ostringstream rv("");
-
- rv << "ROW(";
- for (int i=1;i<3;i++) rv << "?,";
- rv << "?";
-rv << ")";
-
- return rv.str();
-}
-
-
-std::string coordinate_t::insert_format() const
-{ return update_format();
-}
-
-std::string coordinate_t::select_format() const
-{
-std::string rv("");
-for (int i=0; i<2;i++) rv+="?,";
-rv+="?";
-return rv;
-}
-
-std::string coordinate_t::print(int full_subtables, int show_ids, int no_refs) const
-{ std::ostringstream rv("");
-
- rv.precision(14);
- rv << "ROW(";
- rv << time;
- rv << ',';
- rv << ra;
- rv << ',';
- rv << dec;
- rv << ")";
- return rv.str();
-}
-
-
-std::string coordinate_t::print_xml(int full_subtables, int show_ids, int no_refs,const char *tag) const
-{
- std::ostringstream rv("");
-
- rv.precision(14);
- rv << xml_indent() << '<' << tag << ">\n";
- xml_indent(2);
- rv << xml_indent() << "<time>" << time << "</time>\n";
- rv << xml_indent() << "<ra>" << ra << "</ra>\n";
- rv << xml_indent() << "<dec>" << dec << "</dec>\n";
- xml_indent(-2);
- rv << xml_indent() << "</" << tag << ">\n";
- return rv.str();
-}
-
-
- void coordinate_t::parse_xml(const std::string &s,const char *tag) {
- std::string field,sub;
- if (extract_xml_record(s,tag,field)) {
- std::string::size_type pos=0;
- if (extract_xml_record(field,"time",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> time;
- }
- if (extract_xml_record(field,"ra",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> ra;
- }
- if (extract_xml_record(field,"dec",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> dec;
- }
- }
- }
-
- void coordinate_t::parse(const SQL_ROW &s) {
- {
- std::istringstream row(*(s[0]));
- row >> time;
- }
- {
- std::istringstream row(*(s[1]));
- row >> ra;
- }
- {
- std::istringstream row(*(s[2]));
- row >> dec;
- }
- }
-
- void coordinate_t::parse(const std::string &s) {
- SQL_ROW row(&s,3);
- parse(row);
- }
-
-template <> const char * const db_type<chirp_parameter_t>::type_name="chirp_parameter_t";
-template <> const char * db_type<chirp_parameter_t>::_search_tag=type_name;
+ if (&a != this) {
+ time=a.time;
+ ra=a.ra;
+ dec=a.dec;
+ }
+ return (*this);
+}
+
+
+std::string coordinate_t::update_format() const {
+ std::ostringstream rv("");
+
+ rv << "ROW(";
+ for (int i=1; i<3; i++) {
+ rv << "?,";
+ }
+ rv << "?";
+ rv << ")";
+
+ return rv.str();
+}
+
+
+std::string coordinate_t::insert_format() const {
+ return update_format();
+}
+
+std::string coordinate_t::select_format() const {
+ std::string rv("");
+ for (int i=0; i<2; i++) {
+ rv+="?,";
+ }
+ rv+="?";
+ return rv;
+}
+
+std::string coordinate_t::print(int full_subtables, int show_ids, int no_refs) const {
+ std::ostringstream rv("");
+
+ rv.precision(14);
+ rv << "ROW(";
+ rv << time;
+ rv << ',';
+ rv << ra;
+ rv << ',';
+ rv << dec;
+ rv << ")";
+ return rv.str();
+}
+
+
+std::string coordinate_t::print_xml(int full_subtables, int show_ids, int no_refs,const char *tag) const {
+ std::ostringstream rv("");
+
+ rv.precision(14);
+ rv << xml_indent() << '<' << tag << ">\n";
+ xml_indent(2);
+ rv << xml_indent() << "<time>" << time << "</time>\n";
+ rv << xml_indent() << "<ra>" << ra << "</ra>\n";
+ rv << xml_indent() << "<dec>" << dec << "</dec>\n";
+ xml_indent(-2);
+ rv << xml_indent() << "</" << tag << ">\n";
+ return rv.str();
+}
+
+
+void coordinate_t::parse_xml(const std::string &s,const char *tag) {
+ std::string field,sub;
+ if (extract_xml_record(s,tag,field)) {
+ std::string::size_type pos=0;
+ if (extract_xml_record(field,"time",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> time;
+ }
+ if (extract_xml_record(field,"ra",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> ra;
+ }
+ if (extract_xml_record(field,"dec",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> dec;
+ }
+ }
+}
+
+void coordinate_t::parse(const SQL_ROW &s) {
+ {
+ std::istringstream row(*(s[0]));
+ row >> time;
+ }
+ {
+ std::istringstream row(*(s[1]));
+ row >> ra;
+ }
+ {
+ std::istringstream row(*(s[2]));
+ row >> dec;
+ }
+}
+
+void coordinate_t::parse(const std::string &s) {
+ SQL_ROW row(&s,3);
+ parse(row);
+}
+
+template <> const char *const db_type<chirp_parameter_t>::type_name="chirp_parameter_t";
+template <> const char *db_type<chirp_parameter_t>::_search_tag=type_name;
template <> const int db_type<chirp_parameter_t>::_nfields=2;
-template <> const char * const db_type<chirp_parameter_t>::column_names[2]={"chirp_limit","fft_len_flags"};
+template <> const char *const db_type<chirp_parameter_t>::column_names[2]= {"chirp_limit","fft_len_flags"};
-chirp_parameter_t::chirp_parameter_t() :
- db_type<chirp_parameter_t>(*this),
- chirp_limit(0),
- fft_len_flags(0)
-{
- db_open();
+chirp_parameter_t::chirp_parameter_t() :
+ db_type<chirp_parameter_t>(*this),
+ chirp_limit(0),
+ fft_len_flags(0) {
+ db_open();
}
-chirp_parameter_t::chirp_parameter_t(const chirp_parameter_t &a) :
- db_type<chirp_parameter_t>(*this),
- chirp_limit(a.chirp_limit),
- fft_len_flags(a.fft_len_flags)
-{
- db_open();
+chirp_parameter_t::chirp_parameter_t(const chirp_parameter_t &a) :
+ db_type<chirp_parameter_t>(*this),
+ chirp_limit(a.chirp_limit),
+ fft_len_flags(a.fft_len_flags) {
+ db_open();
}
-chirp_parameter_t::chirp_parameter_t(const SQL_ROW &a) :
- db_type<chirp_parameter_t>(*this)
-{
- db_open();
- parse(a);
+chirp_parameter_t::chirp_parameter_t(const SQL_ROW &a) :
+ db_type<chirp_parameter_t>(*this) {
+ db_open();
+ parse(a);
}
-chirp_parameter_t::chirp_parameter_t(const std::string &s,const char *tag) :
- db_type<chirp_parameter_t>(*this)
-{
- db_open();
- if (xml_match_tag(s,tag)) {
- parse_xml(s,tag);
- } else {
- parse(s);
- }
+chirp_parameter_t::chirp_parameter_t(const std::string &s,const char *tag) :
+ db_type<chirp_parameter_t>(*this) {
+ db_open();
+ if (xml_match_tag(s,tag)) {
+ parse_xml(s,tag);
+ } else {
+ parse(s);
+ }
}
chirp_parameter_t &chirp_parameter_t::operator =(const chirp_parameter_t &a) {
- if (&a != this) {
- chirp_limit=a.chirp_limit;
- fft_len_flags=a.fft_len_flags;
- }
- return (*this);
-}
-
-
-std::string chirp_parameter_t::update_format() const
-{ std::ostringstream rv("");
-
- rv << "ROW(";
- for (int i=1;i<2;i++) rv << "?,";
- rv << "?";
-rv << ")";
-
- return rv.str();
-}
-
-
-std::string chirp_parameter_t::insert_format() const
-{ return update_format();
-}
-
-std::string chirp_parameter_t::select_format() const
-{
-std::string rv("");
-for (int i=0; i<1;i++) rv+="?,";
-rv+="?";
-return rv;
-}
-
-std::string chirp_parameter_t::print(int full_subtables, int show_ids, int no_refs) const
-{ std::ostringstream rv("");
-
- rv.precision(14);
- rv << "ROW(";
- rv << chirp_limit;
- rv << ',';
- rv << fft_len_flags;
- rv << ")";
- return rv.str();
-}
-
-
-std::string chirp_parameter_t::print_xml(int full_subtables, int show_ids, int no_refs,const char *tag) const
-{
- std::ostringstream rv("");
-
- rv.precision(14);
- rv << xml_indent() << '<' << tag << ">\n";
- xml_indent(2);
- rv << xml_indent() << "<chirp_limit>" << chirp_limit << "</chirp_limit>\n";
- rv << xml_indent() << "<fft_len_flags>" << fft_len_flags << "</fft_len_flags>\n";
- xml_indent(-2);
- rv << xml_indent() << "</" << tag << ">\n";
- return rv.str();
-}
-
-
- void chirp_parameter_t::parse_xml(const std::string &s,const char *tag) {
- std::string field,sub;
- if (extract_xml_record(s,tag,field)) {
- std::string::size_type pos=0;
- if (extract_xml_record(field,"chirp_limit",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> chirp_limit;
- }
- if (extract_xml_record(field,"fft_len_flags",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> fft_len_flags;
- }
- }
- }
-
- void chirp_parameter_t::parse(const SQL_ROW &s) {
- {
- std::istringstream row(*(s[0]));
- row >> chirp_limit;
- }
- {
- std::istringstream row(*(s[1]));
- row >> fft_len_flags;
- }
- }
-
- void chirp_parameter_t::parse(const std::string &s) {
- SQL_ROW row(&s,2);
- parse(row);
- }
-
-template <> const char * const db_type<subband_description_t>::type_name="subband_description_t";
-template <> const char * db_type<subband_description_t>::_search_tag=type_name;
+ if (&a != this) {
+ chirp_limit=a.chirp_limit;
+ fft_len_flags=a.fft_len_flags;
+ }
+ return (*this);
+}
+
+
+std::string chirp_parameter_t::update_format() const {
+ std::ostringstream rv("");
+
+ rv << "ROW(";
+ for (int i=1; i<2; i++) {
+ rv << "?,";
+ }
+ rv << "?";
+ rv << ")";
+
+ return rv.str();
+}
+
+
+std::string chirp_parameter_t::insert_format() const {
+ return update_format();
+}
+
+std::string chirp_parameter_t::select_format() const {
+ std::string rv("");
+ for (int i=0; i<1; i++) {
+ rv+="?,";
+ }
+ rv+="?";
+ return rv;
+}
+
+std::string chirp_parameter_t::print(int full_subtables, int show_ids, int no_refs) const {
+ std::ostringstream rv("");
+
+ rv.precision(14);
+ rv << "ROW(";
+ rv << chirp_limit;
+ rv << ',';
+ rv << fft_len_flags;
+ rv << ")";
+ return rv.str();
+}
+
+
+std::string chirp_parameter_t::print_xml(int full_subtables, int show_ids, int no_refs,const char *tag) const {
+ std::ostringstream rv("");
+
+ rv.precision(14);
+ rv << xml_indent() << '<' << tag << ">\n";
+ xml_indent(2);
+ rv << xml_indent() << "<chirp_limit>" << chirp_limit << "</chirp_limit>\n";
+ rv << xml_indent() << "<fft_len_flags>" << fft_len_flags << "</fft_len_flags>\n";
+ xml_indent(-2);
+ rv << xml_indent() << "</" << tag << ">\n";
+ return rv.str();
+}
+
+
+void chirp_parameter_t::parse_xml(const std::string &s,const char *tag) {
+ std::string field,sub;
+ if (extract_xml_record(s,tag,field)) {
+ std::string::size_type pos=0;
+ if (extract_xml_record(field,"chirp_limit",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> chirp_limit;
+ }
+ if (extract_xml_record(field,"fft_len_flags",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> fft_len_flags;
+ }
+ }
+}
+
+void chirp_parameter_t::parse(const SQL_ROW &s) {
+ {
+ std::istringstream row(*(s[0]));
+ row >> chirp_limit;
+ }
+ {
+ std::istringstream row(*(s[1]));
+ row >> fft_len_flags;
+ }
+}
+
+void chirp_parameter_t::parse(const std::string &s) {
+ SQL_ROW row(&s,2);
+ parse(row);
+}
+
+template <> const char *const db_type<subband_description_t>::type_name="subband_description_t";
+template <> const char *db_type<subband_description_t>::_search_tag=type_name;
template <> const int db_type<subband_description_t>::_nfields=4;
-template <> const char * const db_type<subband_description_t>::column_names[4]={"number","center","base","sample_rate"};
+template <> const char *const db_type<subband_description_t>::column_names[4]= {"number","center","base","sample_rate"};
-subband_description_t::subband_description_t() :
- db_type<subband_description_t>(*this),
- number(0),
- center(0),
- base(0),
- sample_rate(0)
-{
- db_open();
+subband_description_t::subband_description_t() :
+ db_type<subband_description_t>(*this),
+ number(0),
+ center(0),
+ base(0),
+ sample_rate(0) {
+ db_open();
}
-subband_description_t::subband_description_t(const subband_description_t &a) :
- db_type<subband_description_t>(*this),
- number(a.number),
- center(a.center),
- base(a.base),
- sample_rate(a.sample_rate)
-{
- db_open();
+subband_description_t::subband_description_t(const subband_description_t &a) :
+ db_type<subband_description_t>(*this),
+ number(a.number),
+ center(a.center),
+ base(a.base),
+ sample_rate(a.sample_rate) {
+ db_open();
}
-subband_description_t::subband_description_t(const SQL_ROW &a) :
- db_type<subband_description_t>(*this)
-{
- db_open();
- parse(a);
+subband_description_t::subband_description_t(const SQL_ROW &a) :
+ db_type<subband_description_t>(*this) {
+ db_open();
+ parse(a);
}
-subband_description_t::subband_description_t(const std::string &s,const char *tag) :
- db_type<subband_description_t>(*this)
-{
- db_open();
- if (xml_match_tag(s,tag)) {
- parse_xml(s,tag);
- } else {
- parse(s);
- }
+subband_description_t::subband_description_t(const std::string &s,const char *tag) :
+ db_type<subband_description_t>(*this) {
+ db_open();
+ if (xml_match_tag(s,tag)) {
+ parse_xml(s,tag);
+ } else {
+ parse(s);
+ }
}
subband_description_t &subband_description_t::operator =(const subband_description_t &a) {
- if (&a != this) {
- number=a.number;
- center=a.center;
- base=a.base;
- sample_rate=a.sample_rate;
- }
- return (*this);
-}
-
-
-std::string subband_description_t::update_format() const
-{ std::ostringstream rv("");
-
- rv << "ROW(";
- for (int i=1;i<4;i++) rv << "?,";
- rv << "?";
-rv << ")";
-
- return rv.str();
-}
-
-
-std::string subband_description_t::insert_format() const
-{ return update_format();
-}
-
-std::string subband_description_t::select_format() const
-{
-std::string rv("");
-for (int i=0; i<3;i++) rv+="?,";
-rv+="?";
-return rv;
-}
-
-std::string subband_description_t::print(int full_subtables, int show_ids, int no_refs) const
-{ std::ostringstream rv("");
-
- rv.precision(14);
- rv << "ROW(";
- rv << number;
- rv << ',';
- rv << center;
- rv << ',';
- rv << base;
- rv << ',';
- rv << sample_rate;
- rv << ")";
- return rv.str();
-}
-
-
-std::string subband_description_t::print_xml(int full_subtables, int show_ids, int no_refs,const char *tag) const
-{
- std::ostringstream rv("");
-
- rv.precision(14);
- rv << xml_indent() << '<' << tag << ">\n";
- xml_indent(2);
- rv << xml_indent() << "<number>" << number << "</number>\n";
- rv << xml_indent() << "<center>" << center << "</center>\n";
- rv << xml_indent() << "<base>" << base << "</base>\n";
- rv << xml_indent() << "<sample_rate>" << sample_rate << "</sample_rate>\n";
- xml_indent(-2);
- rv << xml_indent() << "</" << tag << ">\n";
- return rv.str();
-}
-
-
- void subband_description_t::parse_xml(const std::string &s,const char *tag) {
- std::string field,sub;
- if (extract_xml_record(s,tag,field)) {
- std::string::size_type pos=0;
- if (extract_xml_record(field,"number",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> number;
- }
- if (extract_xml_record(field,"center",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> center;
- }
- if (extract_xml_record(field,"base",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> base;
- }
- if (extract_xml_record(field,"sample_rate",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> sample_rate;
- }
- }
- }
-
- void subband_description_t::parse(const SQL_ROW &s) {
- {
- std::istringstream row(*(s[0]));
- row >> number;
- }
- {
- std::istringstream row(*(s[1]));
- row >> center;
- }
- {
- std::istringstream row(*(s[2]));
- row >> base;
- }
- {
- std::istringstream row(*(s[3]));
- row >> sample_rate;
- }
- }
-
- void subband_description_t::parse(const std::string &s) {
- SQL_ROW row(&s,4);
- parse(row);
- }
-
-template <> const char * const db_type<data_description_t>::type_name="data_description_t";
-template <> const char * db_type<data_description_t>::_search_tag=type_name;
+ if (&a != this) {
+ number=a.number;
+ center=a.center;
+ base=a.base;
+ sample_rate=a.sample_rate;
+ }
+ return (*this);
+}
+
+
+std::string subband_description_t::update_format() const {
+ std::ostringstream rv("");
+
+ rv << "ROW(";
+ for (int i=1; i<4; i++) {
+ rv << "?,";
+ }
+ rv << "?";
+ rv << ")";
+
+ return rv.str();
+}
+
+
+std::string subband_description_t::insert_format() const {
+ return update_format();
+}
+
+std::string subband_description_t::select_format() const {
+ std::string rv("");
+ for (int i=0; i<3; i++) {
+ rv+="?,";
+ }
+ rv+="?";
+ return rv;
+}
+
+std::string subband_description_t::print(int full_subtables, int show_ids, int no_refs) const {
+ std::ostringstream rv("");
+
+ rv.precision(14);
+ rv << "ROW(";
+ rv << number;
+ rv << ',';
+ rv << center;
+ rv << ',';
+ rv << base;
+ rv << ',';
+ rv << sample_rate;
+ rv << ")";
+ return rv.str();
+}
+
+
+std::string subband_description_t::print_xml(int full_subtables, int show_ids, int no_refs,const char *tag) const {
+ std::ostringstream rv("");
+
+ rv.precision(14);
+ rv << xml_indent() << '<' << tag << ">\n";
+ xml_indent(2);
+ rv << xml_indent() << "<number>" << number << "</number>\n";
+ rv << xml_indent() << "<center>" << center << "</center>\n";
+ rv << xml_indent() << "<base>" << base << "</base>\n";
+ rv << xml_indent() << "<sample_rate>" << sample_rate << "</sample_rate>\n";
+ xml_indent(-2);
+ rv << xml_indent() << "</" << tag << ">\n";
+ return rv.str();
+}
+
+
+void subband_description_t::parse_xml(const std::string &s,const char *tag) {
+ std::string field,sub;
+ if (extract_xml_record(s,tag,field)) {
+ std::string::size_type pos=0;
+ if (extract_xml_record(field,"number",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> number;
+ }
+ if (extract_xml_record(field,"center",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> center;
+ }
+ if (extract_xml_record(field,"base",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> base;
+ }
+ if (extract_xml_record(field,"sample_rate",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> sample_rate;
+ }
+ }
+}
+
+void subband_description_t::parse(const SQL_ROW &s) {
+ {
+ std::istringstream row(*(s[0]));
+ row >> number;
+ }
+ {
+ std::istringstream row(*(s[1]));
+ row >> center;
+ }
+ {
+ std::istringstream row(*(s[2]));
+ row >> base;
+ }
+ {
+ std::istringstream row(*(s[3]));
+ row >> sample_rate;
+ }
+}
+
+void subband_description_t::parse(const std::string &s) {
+ SQL_ROW row(&s,4);
+ parse(row);
+}
+
+template <> const char *const db_type<data_description_t>::type_name="data_description_t";
+template <> const char *db_type<data_description_t>::_search_tag=type_name;
template <> const int db_type<data_description_t>::_nfields=9;
-template <> const char * const db_type<data_description_t>::column_names[9]={"start_ra","start_dec","end_ra","end_dec","true_angle_range","time_recorded","time_recorded_jd","nsamples","coords"};
+template <> const char *const db_type<data_description_t>::column_names[9]= {"start_ra","start_dec","end_ra","end_dec","true_angle_range","time_recorded","time_recorded_jd","nsamples","coords"};
-data_description_t::data_description_t() :
- db_type<data_description_t>(*this),
- start_ra(0),
- start_dec(0),
- end_ra(0),
- end_dec(0),
- true_angle_range(0),
- time_recorded_jd(0),
- nsamples(0),
- coords((coordinate_t *)0,0,_x_xml_values)
-{
- db_open();
- time_recorded[0]=0;
+data_description_t::data_description_t() :
+ db_type<data_description_t>(*this),
+ start_ra(0),
+ start_dec(0),
+ end_ra(0),
+ end_dec(0),
+ true_angle_range(0),
+ time_recorded_jd(0),
+ nsamples(0),
+ coords((coordinate_t *)0,0,_x_xml_values) {
+ db_open();
+ time_recorded[0]=0;
}
-data_description_t::data_description_t(const data_description_t &a) :
- db_type<data_description_t>(*this),
- start_ra(a.start_ra),
- start_dec(a.start_dec),
- end_ra(a.end_ra),
- end_dec(a.end_dec),
- true_angle_range(a.true_angle_range),
- time_recorded_jd(a.time_recorded_jd),
- nsamples(a.nsamples),
- coords(a.coords)
-{
- db_open();
- strcpy(time_recorded,a.time_recorded);
+data_description_t::data_description_t(const data_description_t &a) :
+ db_type<data_description_t>(*this),
+ start_ra(a.start_ra),
+ start_dec(a.start_dec),
+ end_ra(a.end_ra),
+ end_dec(a.end_dec),
+ true_angle_range(a.true_angle_range),
+ time_recorded_jd(a.time_recorded_jd),
+ nsamples(a.nsamples),
+ coords(a.coords) {
+ db_open();
+ strcpy(time_recorded,a.time_recorded);
}
-data_description_t::data_description_t(const SQL_ROW &a) :
- db_type<data_description_t>(*this)
-{
- db_open();
- parse(a);
+data_description_t::data_description_t(const SQL_ROW &a) :
+ db_type<data_description_t>(*this) {
+ db_open();
+ parse(a);
}
-data_description_t::data_description_t(const std::string &s,const char *tag) :
- db_type<data_description_t>(*this)
-{
- db_open();
- if (xml_match_tag(s,tag)) {
- parse_xml(s,tag);
- } else {
- parse(s);
- }
+data_description_t::data_description_t(const std::string &s,const char *tag) :
+ db_type<data_description_t>(*this) {
+ db_open();
+ if (xml_match_tag(s,tag)) {
+ parse_xml(s,tag);
+ } else {
+ parse(s);
+ }
}
data_description_t &data_description_t::operator =(const data_description_t &a) {
- if (&a != this) {
- start_ra=a.start_ra;
- start_dec=a.start_dec;
- end_ra=a.end_ra;
- end_dec=a.end_dec;
- true_angle_range=a.true_angle_range;
- time_recorded_jd=a.time_recorded_jd;
- nsamples=a.nsamples;
- {
- coords.clear();
- std::vector<coordinate_t>::const_iterator i(a.coords.begin());
- for (;i!=a.coords.end();i++) {
- coords.push_back(*i);
- }
- }
- strcpy(time_recorded,a.time_recorded);
- }
- return (*this);
-}
-
-
-std::string data_description_t::update_format() const
-{ std::ostringstream rv("");
-
- rv << "ROW(";
- for (int i=1;i<9;i++) rv << "?,";
- rv << "?";
-rv << ")";
-
- return rv.str();
-}
-
-
-std::string data_description_t::insert_format() const
-{ return update_format();
-}
-
-std::string data_description_t::select_format() const
-{
-std::string rv("");
-for (int i=0; i<8;i++) rv+="?,";
-rv+="?";
-return rv;
-}
-
-std::string data_description_t::print(int full_subtables, int show_ids, int no_refs) const
-{ std::ostringstream rv("");
-
- rv.precision(14);
- rv << "ROW(";
- rv << start_ra;
- rv << ',';
- rv << start_dec;
- rv << ',';
- rv << end_ra;
- rv << ',';
- rv << end_dec;
- rv << ',';
- rv << true_angle_range;
- rv << ',';
- rv << "'" << time_recorded << "'";
- rv << ',';
- rv << time_recorded_jd;
- rv << ',';
- rv << nsamples;
- rv << ',';
- rv << "LIST {";
- {
- std::vector<coordinate_t>::const_iterator p=coords.begin();
- for (;p<coords.end();p++) {
- rv << p->print();
- if (p != coords.end()-1) {
- rv << ',';
- } else {
- rv << "}";
- }
- }
- }
- rv << ")";
- return rv.str();
-}
-
-
-std::string data_description_t::print_xml(int full_subtables, int show_ids, int no_refs,const char *tag) const
-{
- std::ostringstream rv("");
-
- rv.precision(14);
- rv << xml_indent() << '<' << tag << ">\n";
- xml_indent(2);
- rv << xml_indent() << "<start_ra>" << start_ra << "</start_ra>\n";
- rv << xml_indent() << "<start_dec>" << start_dec << "</start_dec>\n";
- rv << xml_indent() << "<end_ra>" << end_ra << "</end_ra>\n";
- rv << xml_indent() << "<end_dec>" << end_dec << "</end_dec>\n";
- rv << xml_indent() << "<true_angle_range>" << true_angle_range << "</true_angle_range>\n";
- {
- std::string enc_field=xml_encode_string(time_recorded,std::min(strlen(time_recorded),sizeof(time_recorded)));
- rv << xml_indent() << "<time_recorded>";
- rv << enc_field << "</time_recorded>\n";
- }
- rv << xml_indent() << "<time_recorded_jd>" << time_recorded_jd << "</time_recorded_jd>\n";
- rv << xml_indent() << "<nsamples>" << nsamples << "</nsamples>\n";
- if (coords.size()) {
- rv << xml_indent() << "<coords";
- {
- std::string enc_string=coords.print_xml();
- rv << ">\n" ;
- rv << enc_string;
- }
-}
- rv << xml_indent(-2);
- rv << "</coords>\n";
- xml_indent(-2);
- rv << xml_indent() << "</" << tag << ">\n";
- return rv.str();
-}
-
-
- void data_description_t::parse_xml(const std::string &s,const char *tag) {
- std::string field,sub;
- if (extract_xml_record(s,tag,field)) {
- std::string::size_type pos=0;
- if (extract_xml_record(field,"start_ra",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> start_ra;
- }
- if (extract_xml_record(field,"start_dec",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> start_dec;
- }
- if (extract_xml_record(field,"end_ra",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> end_ra;
- }
- if (extract_xml_record(field,"end_dec",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> end_dec;
- }
- if (extract_xml_record(field,"true_angle_range",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> true_angle_range;
- }
- if (extract_xml_record(field,"time_recorded",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::string::size_type epos=sub.find("<",pos);
- if (epos==std::string::npos) epos=sub.find('\n',pos);
- if (epos==std::string::npos) epos=pos+strlen(sub.c_str()+pos);
- std::vector<unsigned char> in(xml_decode_string<unsigned char>((const char *)sub.c_str()+pos,epos-pos));
- strncpy(time_recorded,(const char *)&(in.front()),std::min(in.size(),(size_t)255));
- time_recorded[std::min(in.size(),(size_t)254)]=0;
- }
- if (extract_xml_record(field,"time_recorded_jd",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> time_recorded_jd;
- }
- if (extract_xml_record(field,"nsamples",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> nsamples;
- }
- coords.clear();
- if (extract_xml_record(field,"coords",sub)) {
- pos=0;
- while ((pos=sub.find("<coordinate_t",pos)) != std::string::npos) {
- coords.push_back(coordinate_t(std::string(sub.c_str()+pos)));
- pos=sub.find("</coordinate_t",pos);
- pos=sub.find(">",pos);
- }
- }
- }
- }
-
- void data_description_t::parse(const SQL_ROW &s) {
- {
- std::istringstream row(*(s[0]));
- row >> start_ra;
- }
- {
- std::istringstream row(*(s[1]));
- row >> start_dec;
- }
- {
- std::istringstream row(*(s[2]));
- row >> end_ra;
- }
- {
- std::istringstream row(*(s[3]));
- row >> end_dec;
- }
- {
- std::istringstream row(*(s[4]));
- row >> true_angle_range;
- }
- {
- strncpy(time_recorded,s[5]->c_str(),255);
- time_recorded[254]=0;
- }
- {
- std::istringstream row(*(s[6]));
- row >> time_recorded_jd;
- }
- {
- std::istringstream row(*(s[7]));
- row >> nsamples;
- }
- {
- std::string::size_type p,q;
- int i;
- coords.clear();
- SQL_ROW tmp(s[8]);
- for (i=0;i<tmp.argc();i++) {
- coords.push_back(coordinate_t(SQL_ROW(tmp[i])));
- }
- }
- }
-
- void data_description_t::parse(const std::string &s) {
- SQL_ROW row(&s,9);
- parse(row);
- }
-
-template <> const char * const db_table<receiver_config>::table_name="receiver_config";
-template <> const char * db_table<receiver_config>::_search_tag=table_name;
+ if (&a != this) {
+ start_ra=a.start_ra;
+ start_dec=a.start_dec;
+ end_ra=a.end_ra;
+ end_dec=a.end_dec;
+ true_angle_range=a.true_angle_range;
+ time_recorded_jd=a.time_recorded_jd;
+ nsamples=a.nsamples;
+ {
+ coords.clear();
+ std::vector<coordinate_t>::const_iterator i(a.coords.begin());
+ for (; i!=a.coords.end(); i++) {
+ coords.push_back(*i);
+ }
+ }
+ strcpy(time_recorded,a.time_recorded);
+ }
+ return (*this);
+}
+
+
+std::string data_description_t::update_format() const {
+ std::ostringstream rv("");
+
+ rv << "ROW(";
+ for (int i=1; i<9; i++) {
+ rv << "?,";
+ }
+ rv << "?";
+ rv << ")";
+
+ return rv.str();
+}
+
+
+std::string data_description_t::insert_format() const {
+ return update_format();
+}
+
+std::string data_description_t::select_format() const {
+ std::string rv("");
+ for (int i=0; i<8; i++) {
+ rv+="?,";
+ }
+ rv+="?";
+ return rv;
+}
+
+std::string data_description_t::print(int full_subtables, int show_ids, int no_refs) const {
+ std::ostringstream rv("");
+
+ rv.precision(14);
+ rv << "ROW(";
+ rv << start_ra;
+ rv << ',';
+ rv << start_dec;
+ rv << ',';
+ rv << end_ra;
+ rv << ',';
+ rv << end_dec;
+ rv << ',';
+ rv << true_angle_range;
+ rv << ',';
+ rv << "'" << time_recorded << "'";
+ rv << ',';
+ rv << time_recorded_jd;
+ rv << ',';
+ rv << nsamples;
+ rv << ',';
+ rv << "LIST {";
+ {
+ std::vector<coordinate_t>::const_iterator p=coords.begin();
+ for (; p<coords.end(); p++) {
+ rv << p->print();
+ if (p != coords.end()-1) {
+ rv << ',';
+ } else {
+ rv << "}";
+ }
+ }
+ }
+ rv << ")";
+ return rv.str();
+}
+
+
+std::string data_description_t::print_xml(int full_subtables, int show_ids, int no_refs,const char *tag) const {
+ std::ostringstream rv("");
+
+ rv.precision(14);
+ rv << xml_indent() << '<' << tag << ">\n";
+ xml_indent(2);
+ rv << xml_indent() << "<start_ra>" << start_ra << "</start_ra>\n";
+ rv << xml_indent() << "<start_dec>" << start_dec << "</start_dec>\n";
+ rv << xml_indent() << "<end_ra>" << end_ra << "</end_ra>\n";
+ rv << xml_indent() << "<end_dec>" << end_dec << "</end_dec>\n";
+ rv << xml_indent() << "<true_angle_range>" << true_angle_range << "</true_angle_range>\n";
+ {
+ std::string enc_field=xml_encode_string(time_recorded,std::min(strlen(time_recorded),sizeof(time_recorded)));
+ rv << xml_indent() << "<time_recorded>";
+ rv << enc_field << "</time_recorded>\n";
+ }
+ rv << xml_indent() << "<time_recorded_jd>" << time_recorded_jd << "</time_recorded_jd>\n";
+ rv << xml_indent() << "<nsamples>" << nsamples << "</nsamples>\n";
+ if (coords.size()) {
+ rv << xml_indent() << "<coords";
+ {
+ std::string enc_string=coords.print_xml();
+ rv << ">\n" ;
+ rv << enc_string;
+ }
+ }
+ rv << xml_indent(-2);
+ rv << "</coords>\n";
+ xml_indent(-2);
+ rv << xml_indent() << "</" << tag << ">\n";
+ return rv.str();
+}
+
+
+void data_description_t::parse_xml(const std::string &s,const char *tag) {
+ std::string field,sub;
+ if (extract_xml_record(s,tag,field)) {
+ std::string::size_type pos=0;
+ if (extract_xml_record(field,"start_ra",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> start_ra;
+ }
+ if (extract_xml_record(field,"start_dec",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> start_dec;
+ }
+ if (extract_xml_record(field,"end_ra",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> end_ra;
+ }
+ if (extract_xml_record(field,"end_dec",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> end_dec;
+ }
+ if (extract_xml_record(field,"true_angle_range",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> true_angle_range;
+ }
+ if (extract_xml_record(field,"time_recorded",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::string::size_type epos=sub.find("<",pos);
+ if (epos==std::string::npos) {
+ epos=sub.find('\n',pos);
+ }
+ if (epos==std::string::npos) {
+ epos=pos+strlen(sub.c_str()+pos);
+ }
+ std::vector<unsigned char> in(xml_decode_string<unsigned char>((const char *)sub.c_str()+pos,epos-pos));
+ strncpy(time_recorded,(const char *)&(in.front()),std::min(in.size(),(size_t)255));
+ time_recorded[std::min(in.size(),(size_t)254)]=0;
+ }
+ if (extract_xml_record(field,"time_recorded_jd",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> time_recorded_jd;
+ }
+ if (extract_xml_record(field,"nsamples",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> nsamples;
+ }
+ coords.clear();
+ if (extract_xml_record(field,"coords",sub)) {
+ pos=0;
+ while ((pos=sub.find("<coordinate_t",pos)) != std::string::npos) {
+ coords.push_back(coordinate_t(std::string(sub.c_str()+pos)));
+ pos=sub.find("</coordinate_t",pos);
+ pos=sub.find(">",pos);
+ }
+ }
+ }
+}
+
+void data_description_t::parse(const SQL_ROW &s) {
+ {
+ std::istringstream row(*(s[0]));
+ row >> start_ra;
+ }
+ {
+ std::istringstream row(*(s[1]));
+ row >> start_dec;
+ }
+ {
+ std::istringstream row(*(s[2]));
+ row >> end_ra;
+ }
+ {
+ std::istringstream row(*(s[3]));
+ row >> end_dec;
+ }
+ {
+ std::istringstream row(*(s[4]));
+ row >> true_angle_range;
+ }
+ {
+ strncpy(time_recorded,s[5]->c_str(),255);
+ time_recorded[254]=0;
+ }
+ {
+ std::istringstream row(*(s[6]));
+ row >> time_recorded_jd;
+ }
+ {
+ std::istringstream row(*(s[7]));
+ row >> nsamples;
+ }
+ {
+ std::string::size_type p,q;
+ int i;
+ coords.clear();
+ SQL_ROW tmp(s[8]);
+ for (i=0; i<tmp.argc(); i++) {
+ coords.push_back(coordinate_t(SQL_ROW(tmp[i])));
+ }
+ }
+}
+
+void data_description_t::parse(const std::string &s) {
+ SQL_ROW row(&s,9);
+ parse(row);
+}
+
+template <> const char *const db_table<receiver_config>::table_name="receiver_config";
+template <> const char *db_table<receiver_config>::_search_tag=table_name;
template <> const int db_table<receiver_config>::_nfields=16;
-template <> const char * const db_table<receiver_config>::column_names[16]={"id","s4_id","name","beam_width","center_freq","latitude","longitude","elevation","diameter","az_orientation","az_corr_coeff","zen_corr_coeff","array_az_ellipse","array_za_ellipse","array_angle","min_vgc"};
-
-receiver_config::receiver_config() :
- db_table<receiver_config>(*this,-1),
- id(0),
- s4_id(0),
- beam_width(0),
- center_freq(0),
- latitude(0),
- longitude(0),
- elevation(0),
- diameter(0),
- az_orientation(0),
- az_corr_coeff((float *)0,0,_x_csv),
- zen_corr_coeff((float *)0,0,_x_csv),
- array_az_ellipse(0),
- array_za_ellipse(0),
- array_angle(0),
- min_vgc(0)
-{
- db_open();
- name[0]=0;
-}
-
-
-receiver_config::receiver_config(const receiver_config &a) :
- db_table<receiver_config>(*this,-1),
- id(a.id),
- s4_id(a.s4_id),
- beam_width(a.beam_width),
- center_freq(a.center_freq),
- latitude(a.latitude),
- longitude(a.longitude),
- elevation(a.elevation),
- diameter(a.diameter),
- az_orientation(a.az_orientation),
- az_corr_coeff(a.az_corr_coeff),
- zen_corr_coeff(a.zen_corr_coeff),
- array_az_ellipse(a.array_az_ellipse),
- array_za_ellipse(a.array_za_ellipse),
- array_angle(a.array_angle),
- min_vgc(a.min_vgc)
-{
- db_open();
- strcpy(name,a.name);
-}
-
-
-receiver_config::receiver_config(const SQL_ROW &a) :
- db_table<receiver_config>(*this,-1)
-{
- db_open();
- parse(a);
-}
-
-
-receiver_config::receiver_config(const std::string &s,const char *tag) :
- db_table<receiver_config>(*this,-1)
-{
- db_open();
- if (xml_match_tag(s,tag)) {
- parse_xml(s,tag);
- } else {
- parse(s);
- }
+template <> const char *const db_table<receiver_config>::column_names[16]= {"id","s4_id","name","beam_width","center_freq","latitude","longitude","elevation","diameter","az_orientation","az_corr_coeff","zen_corr_coeff","array_az_ellipse","array_za_ellipse","array_angle","min_vgc"};
+
+receiver_config::receiver_config() :
+ db_table<receiver_config>(*this,-1),
+ id(0),
+ s4_id(0),
+ beam_width(0),
+ center_freq(0),
+ latitude(0),
+ longitude(0),
+ elevation(0),
+ diameter(0),
+ az_orientation(0),
+ az_corr_coeff((float *)0,0,_x_csv),
+ zen_corr_coeff((float *)0,0,_x_csv),
+ array_az_ellipse(0),
+ array_za_ellipse(0),
+ array_angle(0),
+ min_vgc(0) {
+ db_open();
+ name[0]=0;
+}
+
+
+receiver_config::receiver_config(const receiver_config &a) :
+ db_table<receiver_config>(*this,-1),
+ id(a.id),
+ s4_id(a.s4_id),
+ beam_width(a.beam_width),
+ center_freq(a.center_freq),
+ latitude(a.latitude),
+ longitude(a.longitude),
+ elevation(a.elevation),
+ diameter(a.diameter),
+ az_orientation(a.az_orientation),
+ az_corr_coeff(a.az_corr_coeff),
+ zen_corr_coeff(a.zen_corr_coeff),
+ array_az_ellipse(a.array_az_ellipse),
+ array_za_ellipse(a.array_za_ellipse),
+ array_angle(a.array_angle),
+ min_vgc(a.min_vgc) {
+ db_open();
+ strcpy(name,a.name);
+}
+
+
+receiver_config::receiver_config(const SQL_ROW &a) :
+ db_table<receiver_config>(*this,-1) {
+ db_open();
+ parse(a);
+}
+
+
+receiver_config::receiver_config(const std::string &s,const char *tag) :
+ db_table<receiver_config>(*this,-1) {
+ db_open();
+ if (xml_match_tag(s,tag)) {
+ parse_xml(s,tag);
+ } else {
+ parse(s);
+ }
}
receiver_config &receiver_config::operator =(const receiver_config &a) {
- if (&a != this) {
- id=a.id;
- s4_id=a.s4_id;
- beam_width=a.beam_width;
- center_freq=a.center_freq;
- latitude=a.latitude;
- longitude=a.longitude;
- elevation=a.elevation;
- diameter=a.diameter;
- az_orientation=a.az_orientation;
- {
- az_corr_coeff.clear();
- std::vector<float>::const_iterator i(a.az_corr_coeff.begin());
- for (;i!=a.az_corr_coeff.end();i++) {
- az_corr_coeff.push_back(*i);
- }
- }
- {
- zen_corr_coeff.clear();
- std::vector<float>::const_iterator i(a.zen_corr_coeff.begin());
- for (;i!=a.zen_corr_coeff.end();i++) {
- zen_corr_coeff.push_back(*i);
- }
- }
- array_az_ellipse=a.array_az_ellipse;
- array_za_ellipse=a.array_za_ellipse;
- array_angle=a.array_angle;
- min_vgc=a.min_vgc;
- strcpy(name,a.name);
- }
- return (*this);
-}
-
-
-std::string receiver_config::update_format() const
-{ std::ostringstream rv("");
-
- for (int i=2;i<16;i++) rv << "?,";
- rv << "?";
- return rv.str();
-}
-
-
-std::string receiver_config::insert_format() const
-{ return std::string("?,")+update_format();
-}
-
-std::string receiver_config::select_format() const
-{
-std::string rv("");
-for (int i=0; i<15;i++) rv+="?,";
-rv+="?";
-return rv;
-}
-
-std::string receiver_config::print(int full_subtables, int show_ids, int no_refs) const
-{ std::ostringstream rv("");
-
- rv.precision(14);
- if (show_ids) rv << id;
- rv << ',';
- rv << s4_id;
- rv << ',';
- rv << "'" << name << "'";
- rv << ',';
- rv << beam_width;
- rv << ',';
- rv << center_freq;
- rv << ',';
- rv << latitude;
- rv << ',';
- rv << longitude;
- rv << ',';
- rv << elevation;
- rv << ',';
- rv << diameter;
- rv << ',';
- rv << az_orientation;
- rv << ',';
- rv << "LIST {";
- {
- std::vector<float>::const_iterator p=az_corr_coeff.begin();
- for (;p<az_corr_coeff.end();p++) {
- rv << *p;
- if (p != az_corr_coeff.end()-1) {
- rv << ',';
- } else {
- rv << "}";
- }
- }
- }
- rv << ',';
- rv << "LIST {";
- {
- std::vector<float>::const_iterator p=zen_corr_coeff.begin();
- for (;p<zen_corr_coeff.end();p++) {
- rv << *p;
- if (p != zen_corr_coeff.end()-1) {
- rv << ',';
- } else {
- rv << "}";
- }
- }
- }
- rv << ',';
- rv << array_az_ellipse;
- rv << ',';
- rv << array_za_ellipse;
- rv << ',';
- rv << array_angle;
- rv << ',';
- rv << min_vgc;
- return rv.str();
-}
-
-
-std::string receiver_config::print_xml(int full_subtables, int show_ids, int no_refs,const char *tag) const
-{
- std::ostringstream rv("");
-
- rv.precision(14);
- rv << xml_indent() << '<' << tag << ">\n";
- xml_indent(2);
- if (show_ids) rv << xml_indent() << "<id>" << id << "</id>\n";
- rv << xml_indent() << "<s4_id>" << s4_id << "</s4_id>\n";
- {
- std::string enc_field=xml_encode_string(name,std::min(strlen(name),sizeof(name)));
- rv << xml_indent() << "<name>";
- rv << enc_field << "</name>\n";
- }
- rv << xml_indent() << "<beam_width>" << beam_width << "</beam_width>\n";
- rv << xml_indent() << "<center_freq>" << center_freq << "</center_freq>\n";
- rv << xml_indent() << "<latitude>" << latitude << "</latitude>\n";
- rv << xml_indent() << "<longitude>" << longitude << "</longitude>\n";
- rv << xml_indent() << "<elevation>" << elevation << "</elevation>\n";
- rv << xml_indent() << "<diameter>" << diameter << "</diameter>\n";
- rv << xml_indent() << "<az_orientation>" << az_orientation << "</az_orientation>\n";
- if (az_corr_coeff.size()) {
- rv << xml_indent() << "<az_corr_coeff";
- {
- std::string enc_string=az_corr_coeff.print_xml();
- rv << " length=" << enc_string.size() << " encoding=\"" << xml_encoding_names[az_corr_coeff.encoding] << "\">" ;
- rv << enc_string;
- }
-}
- rv << "</az_corr_coeff>\n";
- if (zen_corr_coeff.size()) {
- rv << xml_indent() << "<zen_corr_coeff";
- {
- std::string enc_string=zen_corr_coeff.print_xml();
- rv << " length=" << enc_string.size() << " encoding=\"" << xml_encoding_names[zen_corr_coeff.encoding] << "\">" ;
- rv << enc_string;
- }
-}
- rv << "</zen_corr_coeff>\n";
- rv << xml_indent() << "<array_az_ellipse>" << array_az_ellipse << "</array_az_ellipse>\n";
- rv << xml_indent() << "<array_za_ellipse>" << array_za_ellipse << "</array_za_ellipse>\n";
- rv << xml_indent() << "<array_angle>" << array_angle << "</array_angle>\n";
- rv << xml_indent() << "<min_vgc>" << min_vgc << "</min_vgc>\n";
- xml_indent(-2);
- rv << xml_indent() << "</" << tag << ">\n";
- return rv.str();
-}
-
-
- void receiver_config::parse_xml(const std::string &s,const char *tag) {
- std::string field,sub;
- if (extract_xml_record(s,tag,field)) {
- std::string::size_type pos=0;
- if (extract_xml_record(field,"id",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> id;
- }
- if (extract_xml_record(field,"s4_id",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> s4_id;
- }
- if (extract_xml_record(field,"name",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::string::size_type epos=sub.find("<",pos);
- if (epos==std::string::npos) epos=sub.find('\n',pos);
- if (epos==std::string::npos) epos=pos+strlen(sub.c_str()+pos);
- std::vector<unsigned char> in(xml_decode_string<unsigned char>((const char *)sub.c_str()+pos,epos-pos));
- strncpy(name,(const char *)&(in.front()),std::min(in.size(),(size_t)255));
- name[std::min(in.size(),(size_t)254)]=0;
- }
- if (extract_xml_record(field,"beam_width",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> beam_width;
- }
- if (extract_xml_record(field,"center_freq",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> center_freq;
- }
- if (extract_xml_record(field,"latitude",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> latitude;
- }
- if (extract_xml_record(field,"longitude",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> longitude;
- }
- if (extract_xml_record(field,"elevation",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> elevation;
- }
- if (extract_xml_record(field,"diameter",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> diameter;
- }
- if (extract_xml_record(field,"az_orientation",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> az_orientation;
- }
- az_corr_coeff.clear();
- if (extract_xml_record(field,"az_corr_coeff",sub)) {
- pos=sub.find(">");
- do {
- if (pos!=std::string::npos) {
- do { pos++; } while ((sub[pos]=='\n') || (sub[pos]==','));
- std::istringstream in(std::string(sub.c_str()+pos));
- float tmp;
- in >> tmp;
- az_corr_coeff.push_back(tmp);
- }
- } while ((pos=sub.find(",",pos)) != std::string::npos);
- }
- zen_corr_coeff.clear();
- if (extract_xml_record(field,"zen_corr_coeff",sub)) {
- pos=sub.find(">");
- do {
- if (pos!=std::string::npos) {
- do { pos++; } while ((sub[pos]=='\n') || (sub[pos]==','));
- std::istringstream in(std::string(sub.c_str()+pos));
- float tmp;
- in >> tmp;
- zen_corr_coeff.push_back(tmp);
- }
- } while ((pos=sub.find(",",pos)) != std::string::npos);
- }
- if (extract_xml_record(field,"array_az_ellipse",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> array_az_ellipse;
- }
- if (extract_xml_record(field,"array_za_ellipse",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> array_za_ellipse;
- }
- if (extract_xml_record(field,"array_angle",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> array_angle;
- }
- if (extract_xml_record(field,"min_vgc",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> min_vgc;
- }
- }
- }
-
- void receiver_config::parse(const SQL_ROW &s) {
- {
- std::istringstream row(*(s[0]));
- row >> id;
- }
- {
- std::istringstream row(*(s[1]));
- row >> s4_id;
- }
- {
- strncpy(name,s[2]->c_str(),255);
- name[254]=0;
- }
- {
- std::istringstream row(*(s[3]));
- row >> beam_width;
- }
- {
- std::istringstream row(*(s[4]));
- row >> center_freq;
- }
- {
- std::istringstream row(*(s[5]));
- row >> latitude;
- }
- {
- std::istringstream row(*(s[6]));
- row >> longitude;
- }
- {
- std::istringstream row(*(s[7]));
- row >> elevation;
- }
- {
- std::istringstream row(*(s[8]));
- row >> diameter;
- }
- {
- std::istringstream row(*(s[9]));
- row >> az_orientation;
- }
- {
- std::string::size_type p,q;
- int i;
- az_corr_coeff.clear();
- SQL_ROW tmp(s[10]);
- for (i=0;i<tmp.argc();i++) {
- std::istringstream in(*(tmp[i]));
- float tmp0;
- in >> tmp0;
- az_corr_coeff.push_back(tmp0);
- }
- }
- {
- std::string::size_type p,q;
- int i;
- zen_corr_coeff.clear();
- SQL_ROW tmp(s[11]);
- for (i=0;i<tmp.argc();i++) {
- std::istringstream in(*(tmp[i]));
- float tmp0;
- in >> tmp0;
- zen_corr_coeff.push_back(tmp0);
- }
- }
- {
- std::istringstream row(*(s[12]));
- row >> array_az_ellipse;
- }
- {
- std::istringstream row(*(s[13]));
- row >> array_za_ellipse;
- }
- {
- std::istringstream row(*(s[14]));
- row >> array_angle;
- }
- {
- std::istringstream row(*(s[15]));
- row >> min_vgc;
- }
- }
-
- void receiver_config::parse(const std::string &s) {
- SQL_ROW row(&s,16);
- parse(row);
- }
-
-template <> const char * const db_table<recorder_config>::table_name="recorder_config";
-template <> const char * db_table<recorder_config>::_search_tag=table_name;
+ if (&a != this) {
+ id=a.id;
+ s4_id=a.s4_id;
+ beam_width=a.beam_width;
+ center_freq=a.center_freq;
+ latitude=a.latitude;
+ longitude=a.longitude;
+ elevation=a.elevation;
+ diameter=a.diameter;
+ az_orientation=a.az_orientation;
+ {
+ az_corr_coeff.clear();
+ std::vector<float>::const_iterator i(a.az_corr_coeff.begin());
+ for (; i!=a.az_corr_coeff.end(); i++) {
+ az_corr_coeff.push_back(*i);
+ }
+ }
+ {
+ zen_corr_coeff.clear();
+ std::vector<float>::const_iterator i(a.zen_corr_coeff.begin());
+ for (; i!=a.zen_corr_coeff.end(); i++) {
+ zen_corr_coeff.push_back(*i);
+ }
+ }
+ array_az_ellipse=a.array_az_ellipse;
+ array_za_ellipse=a.array_za_ellipse;
+ array_angle=a.array_angle;
+ min_vgc=a.min_vgc;
+ strcpy(name,a.name);
+ }
+ return (*this);
+}
+
+
+std::string receiver_config::update_format() const {
+ std::ostringstream rv("");
+
+ for (int i=2; i<16; i++) {
+ rv << "?,";
+ }
+ rv << "?";
+ return rv.str();
+}
+
+
+std::string receiver_config::insert_format() const {
+ return std::string("?,")+update_format();
+}
+
+std::string receiver_config::select_format() const {
+ std::string rv("");
+ for (int i=0; i<15; i++) {
+ rv+="?,";
+ }
+ rv+="?";
+ return rv;
+}
+
+std::string receiver_config::print(int full_subtables, int show_ids, int no_refs) const {
+ std::ostringstream rv("");
+
+ rv.precision(14);
+ if (show_ids) {
+ rv << id;
+ }
+ rv << ',';
+ rv << s4_id;
+ rv << ',';
+ rv << "'" << name << "'";
+ rv << ',';
+ rv << beam_width;
+ rv << ',';
+ rv << center_freq;
+ rv << ',';
+ rv << latitude;
+ rv << ',';
+ rv << longitude;
+ rv << ',';
+ rv << elevation;
+ rv << ',';
+ rv << diameter;
+ rv << ',';
+ rv << az_orientation;
+ rv << ',';
+ rv << "LIST {";
+ {
+ std::vector<float>::const_iterator p=az_corr_coeff.begin();
+ for (; p<az_corr_coeff.end(); p++) {
+ rv << *p;
+ if (p != az_corr_coeff.end()-1) {
+ rv << ',';
+ } else {
+ rv << "}";
+ }
+ }
+ }
+ rv << ',';
+ rv << "LIST {";
+ {
+ std::vector<float>::const_iterator p=zen_corr_coeff.begin();
+ for (; p<zen_corr_coeff.end(); p++) {
+ rv << *p;
+ if (p != zen_corr_coeff.end()-1) {
+ rv << ',';
+ } else {
+ rv << "}";
+ }
+ }
+ }
+ rv << ',';
+ rv << array_az_ellipse;
+ rv << ',';
+ rv << array_za_ellipse;
+ rv << ',';
+ rv << array_angle;
+ rv << ',';
+ rv << min_vgc;
+ return rv.str();
+}
+
+
+std::string receiver_config::print_xml(int full_subtables, int show_ids, int no_refs,const char *tag) const {
+ std::ostringstream rv("");
+
+ rv.precision(14);
+ rv << xml_indent() << '<' << tag << ">\n";
+ xml_indent(2);
+ if (show_ids) {
+ rv << xml_indent() << "<id>" << id << "</id>\n";
+ }
+ rv << xml_indent() << "<s4_id>" << s4_id << "</s4_id>\n";
+ {
+ std::string enc_field=xml_encode_string(name,std::min(strlen(name),sizeof(name)));
+ rv << xml_indent() << "<name>";
+ rv << enc_field << "</name>\n";
+ }
+ rv << xml_indent() << "<beam_width>" << beam_width << "</beam_width>\n";
+ rv << xml_indent() << "<center_freq>" << center_freq << "</center_freq>\n";
+ rv << xml_indent() << "<latitude>" << latitude << "</latitude>\n";
+ rv << xml_indent() << "<longitude>" << longitude << "</longitude>\n";
+ rv << xml_indent() << "<elevation>" << elevation << "</elevation>\n";
+ rv << xml_indent() << "<diameter>" << diameter << "</diameter>\n";
+ rv << xml_indent() << "<az_orientation>" << az_orientation << "</az_orientation>\n";
+ if (az_corr_coeff.size()) {
+ rv << xml_indent() << "<az_corr_coeff";
+ {
+ std::string enc_string=az_corr_coeff.print_xml();
+ rv << " length=" << enc_string.size() << " encoding=\"" << xml_encoding_names[az_corr_coeff.encoding] << "\">" ;
+ rv << enc_string;
+ }
+ }
+ rv << "</az_corr_coeff>\n";
+ if (zen_corr_coeff.size()) {
+ rv << xml_indent() << "<zen_corr_coeff";
+ {
+ std::string enc_string=zen_corr_coeff.print_xml();
+ rv << " length=" << enc_string.size() << " encoding=\"" << xml_encoding_names[zen_corr_coeff.encoding] << "\">" ;
+ rv << enc_string;
+ }
+ }
+ rv << "</zen_corr_coeff>\n";
+ rv << xml_indent() << "<array_az_ellipse>" << array_az_ellipse << "</array_az_ellipse>\n";
+ rv << xml_indent() << "<array_za_ellipse>" << array_za_ellipse << "</array_za_ellipse>\n";
+ rv << xml_indent() << "<array_angle>" << array_angle << "</array_angle>\n";
+ rv << xml_indent() << "<min_vgc>" << min_vgc << "</min_vgc>\n";
+ xml_indent(-2);
+ rv << xml_indent() << "</" << tag << ">\n";
+ return rv.str();
+}
+
+
+void receiver_config::parse_xml(const std::string &s,const char *tag) {
+ std::string field,sub;
+ if (extract_xml_record(s,tag,field)) {
+ std::string::size_type pos=0;
+ if (extract_xml_record(field,"id",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> id;
+ }
+ if (extract_xml_record(field,"s4_id",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> s4_id;
+ }
+ if (extract_xml_record(field,"name",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::string::size_type epos=sub.find("<",pos);
+ if (epos==std::string::npos) {
+ epos=sub.find('\n',pos);
+ }
+ if (epos==std::string::npos) {
+ epos=pos+strlen(sub.c_str()+pos);
+ }
+ std::vector<unsigned char> in(xml_decode_string<unsigned char>((const char *)sub.c_str()+pos,epos-pos));
+ strncpy(name,(const char *)&(in.front()),std::min(in.size(),(size_t)255));
+ name[std::min(in.size(),(size_t)254)]=0;
+ }
+ if (extract_xml_record(field,"beam_width",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> beam_width;
+ }
+ if (extract_xml_record(field,"center_freq",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> center_freq;
+ }
+ if (extract_xml_record(field,"latitude",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> latitude;
+ }
+ if (extract_xml_record(field,"longitude",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> longitude;
+ }
+ if (extract_xml_record(field,"elevation",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> elevation;
+ }
+ if (extract_xml_record(field,"diameter",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> diameter;
+ }
+ if (extract_xml_record(field,"az_orientation",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> az_orientation;
+ }
+ az_corr_coeff.clear();
+ if (extract_xml_record(field,"az_corr_coeff",sub)) {
+ pos=sub.find(">");
+ do {
+ if (pos!=std::string::npos) {
+ do {
+ pos++;
+ } while ((sub[pos]=='\n') || (sub[pos]==','));
+ std::istringstream in(std::string(sub.c_str()+pos));
+ float tmp;
+ in >> tmp;
+ az_corr_coeff.push_back(tmp);
+ }
+ } while ((pos=sub.find(",",pos)) != std::string::npos);
+ }
+ zen_corr_coeff.clear();
+ if (extract_xml_record(field,"zen_corr_coeff",sub)) {
+ pos=sub.find(">");
+ do {
+ if (pos!=std::string::npos) {
+ do {
+ pos++;
+ } while ((sub[pos]=='\n') || (sub[pos]==','));
+ std::istringstream in(std::string(sub.c_str()+pos));
+ float tmp;
+ in >> tmp;
+ zen_corr_coeff.push_back(tmp);
+ }
+ } while ((pos=sub.find(",",pos)) != std::string::npos);
+ }
+ if (extract_xml_record(field,"array_az_ellipse",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> array_az_ellipse;
+ }
+ if (extract_xml_record(field,"array_za_ellipse",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> array_za_ellipse;
+ }
+ if (extract_xml_record(field,"array_angle",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> array_angle;
+ }
+ if (extract_xml_record(field,"min_vgc",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> min_vgc;
+ }
+ }
+}
+
+void receiver_config::parse(const SQL_ROW &s) {
+ {
+ std::istringstream row(*(s[0]));
+ row >> id;
+ }
+ {
+ std::istringstream row(*(s[1]));
+ row >> s4_id;
+ }
+ {
+ strncpy(name,s[2]->c_str(),255);
+ name[254]=0;
+ }
+ {
+ std::istringstream row(*(s[3]));
+ row >> beam_width;
+ }
+ {
+ std::istringstream row(*(s[4]));
+ row >> center_freq;
+ }
+ {
+ std::istringstream row(*(s[5]));
+ row >> latitude;
+ }
+ {
+ std::istringstream row(*(s[6]));
+ row >> longitude;
+ }
+ {
+ std::istringstream row(*(s[7]));
+ row >> elevation;
+ }
+ {
+ std::istringstream row(*(s[8]));
+ row >> diameter;
+ }
+ {
+ std::istringstream row(*(s[9]));
+ row >> az_orientation;
+ }
+ {
+ std::string::size_type p,q;
+ int i;
+ az_corr_coeff.clear();
+ SQL_ROW tmp(s[10]);
+ for (i=0; i<tmp.argc(); i++) {
+ std::istringstream in(*(tmp[i]));
+ float tmp0;
+ in >> tmp0;
+ az_corr_coeff.push_back(tmp0);
+ }
+ }
+ {
+ std::string::size_type p,q;
+ int i;
+ zen_corr_coeff.clear();
+ SQL_ROW tmp(s[11]);
+ for (i=0; i<tmp.argc(); i++) {
+ std::istringstream in(*(tmp[i]));
+ float tmp0;
+ in >> tmp0;
+ zen_corr_coeff.push_back(tmp0);
+ }
+ }
+ {
+ std::istringstream row(*(s[12]));
+ row >> array_az_ellipse;
+ }
+ {
+ std::istringstream row(*(s[13]));
+ row >> array_za_ellipse;
+ }
+ {
+ std::istringstream row(*(s[14]));
+ row >> array_angle;
+ }
+ {
+ std::istringstream row(*(s[15]));
+ row >> min_vgc;
+ }
+}
+
+void receiver_config::parse(const std::string &s) {
+ SQL_ROW row(&s,16);
+ parse(row);
+}
+
+template <> const char *const db_table<recorder_config>::table_name="recorder_config";
+template <> const char *db_table<recorder_config>::_search_tag=table_name;
template <> const int db_table<recorder_config>::_nfields=6;
-template <> const char * const db_table<recorder_config>::column_names[6]={"id","name","bits_per_sample","sample_rate","beams","version"};
+template <> const char *const db_table<recorder_config>::column_names[6]= {"id","name","bits_per_sample","sample_rate","beams","version"};
-recorder_config::recorder_config() :
- db_table<recorder_config>(*this,-1),
- id(0),
- bits_per_sample(0),
- sample_rate(0),
- beams(0),
- version(0)
-{
- db_open();
- name[0]=0;
+recorder_config::recorder_config() :
+ db_table<recorder_config>(*this,-1),
+ id(0),
+ bits_per_sample(0),
+ sample_rate(0),
+ beams(0),
+ version(0) {
+ db_open();
+ name[0]=0;
}
-recorder_config::recorder_config(const recorder_config &a) :
- db_table<recorder_config>(*this,-1),
- id(a.id),
- bits_per_sample(a.bits_per_sample),
- sample_rate(a.sample_rate),
- beams(a.beams),
- version(a.version)
-{
- db_open();
- strcpy(name,a.name);
+recorder_config::recorder_config(const recorder_config &a) :
+ db_table<recorder_config>(*this,-1),
+ id(a.id),
+ bits_per_sample(a.bits_per_sample),
+ sample_rate(a.sample_rate),
+ beams(a.beams),
+ version(a.version) {
+ db_open();
+ strcpy(name,a.name);
}
-recorder_config::recorder_config(const SQL_ROW &a) :
- db_table<recorder_config>(*this,-1)
-{
- db_open();
- parse(a);
+recorder_config::recorder_config(const SQL_ROW &a) :
+ db_table<recorder_config>(*this,-1) {
+ db_open();
+ parse(a);
}
-recorder_config::recorder_config(const std::string &s,const char *tag) :
- db_table<recorder_config>(*this,-1)
-{
- db_open();
- if (xml_match_tag(s,tag)) {
- parse_xml(s,tag);
- } else {
- parse(s);
- }
+recorder_config::recorder_config(const std::string &s,const char *tag) :
+ db_table<recorder_config>(*this,-1) {
+ db_open();
+ if (xml_match_tag(s,tag)) {
+ parse_xml(s,tag);
+ } else {
+ parse(s);
+ }
}
recorder_config &recorder_config::operator =(const recorder_config &a) {
- if (&a != this) {
- id=a.id;
- bits_per_sample=a.bits_per_sample;
- sample_rate=a.sample_rate;
- beams=a.beams;
- version=a.version;
- strcpy(name,a.name);
- }
- return (*this);
-}
-
-
-std::string recorder_config::update_format() const
-{ std::ostringstream rv("");
-
- for (int i=2;i<6;i++) rv << "?,";
- rv << "?";
- return rv.str();
-}
-
-
-std::string recorder_config::insert_format() const
-{ return std::string("?,")+update_format();
-}
-
-std::string recorder_config::select_format() const
-{
-std::string rv("");
-for (int i=0; i<5;i++) rv+="?,";
-rv+="?";
-return rv;
-}
-
-std::string recorder_config::print(int full_subtables, int show_ids, int no_refs) const
-{ std::ostringstream rv("");
-
- rv.precision(14);
- if (show_ids) rv << id;
- rv << ',';
- rv << "'" << name << "'";
- rv << ',';
- rv << bits_per_sample;
- rv << ',';
- rv << sample_rate;
- rv << ',';
- rv << beams;
- rv << ',';
- rv << version;
- return rv.str();
-}
-
-
-std::string recorder_config::print_xml(int full_subtables, int show_ids, int no_refs,const char *tag) const
-{
- std::ostringstream rv("");
-
- rv.precision(14);
- rv << xml_indent() << '<' << tag << ">\n";
- xml_indent(2);
- if (show_ids) rv << xml_indent() << "<id>" << id << "</id>\n";
- {
- std::string enc_field=xml_encode_string(name,std::min(strlen(name),sizeof(name)));
- rv << xml_indent() << "<name>";
- rv << enc_field << "</name>\n";
- }
- rv << xml_indent() << "<bits_per_sample>" << bits_per_sample << "</bits_per_sample>\n";
- rv << xml_indent() << "<sample_rate>" << sample_rate << "</sample_rate>\n";
- rv << xml_indent() << "<beams>" << beams << "</beams>\n";
- rv << xml_indent() << "<version>" << version << "</version>\n";
- xml_indent(-2);
- rv << xml_indent() << "</" << tag << ">\n";
- return rv.str();
-}
-
-
- void recorder_config::parse_xml(const std::string &s,const char *tag) {
- std::string field,sub;
- if (extract_xml_record(s,tag,field)) {
- std::string::size_type pos=0;
- if (extract_xml_record(field,"id",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> id;
- }
- if (extract_xml_record(field,"name",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::string::size_type epos=sub.find("<",pos);
- if (epos==std::string::npos) epos=sub.find('\n',pos);
- if (epos==std::string::npos) epos=pos+strlen(sub.c_str()+pos);
- std::vector<unsigned char> in(xml_decode_string<unsigned char>((const char *)sub.c_str()+pos,epos-pos));
- strncpy(name,(const char *)&(in.front()),std::min(in.size(),(size_t)64));
- name[std::min(in.size(),(size_t)63)]=0;
- }
- if (extract_xml_record(field,"bits_per_sample",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> bits_per_sample;
- }
- if (extract_xml_record(field,"sample_rate",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> sample_rate;
- }
- if (extract_xml_record(field,"beams",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> beams;
- }
- if (extract_xml_record(field,"version",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> version;
- }
- }
- }
-
- void recorder_config::parse(const SQL_ROW &s) {
- {
- std::istringstream row(*(s[0]));
- row >> id;
- }
- {
- strncpy(name,s[1]->c_str(),64);
- name[63]=0;
- }
- {
- std::istringstream row(*(s[2]));
- row >> bits_per_sample;
- }
- {
- std::istringstream row(*(s[3]));
- row >> sample_rate;
- }
- {
- std::istringstream row(*(s[4]));
- row >> beams;
- }
- {
- std::istringstream row(*(s[5]));
- row >> version;
- }
- }
-
- void recorder_config::parse(const std::string &s) {
- SQL_ROW row(&s,6);
- parse(row);
- }
-
-template <> const char * const db_table<splitter_config>::table_name="splitter_config";
-template <> const char * db_table<splitter_config>::_search_tag=table_name;
+ if (&a != this) {
+ id=a.id;
+ bits_per_sample=a.bits_per_sample;
+ sample_rate=a.sample_rate;
+ beams=a.beams;
+ version=a.version;
+ strcpy(name,a.name);
+ }
+ return (*this);
+}
+
+
+std::string recorder_config::update_format() const {
+ std::ostringstream rv("");
+
+ for (int i=2; i<6; i++) {
+ rv << "?,";
+ }
+ rv << "?";
+ return rv.str();
+}
+
+
+std::string recorder_config::insert_format() const {
+ return std::string("?,")+update_format();
+}
+
+std::string recorder_config::select_format() const {
+ std::string rv("");
+ for (int i=0; i<5; i++) {
+ rv+="?,";
+ }
+ rv+="?";
+ return rv;
+}
+
+std::string recorder_config::print(int full_subtables, int show_ids, int no_refs) const {
+ std::ostringstream rv("");
+
+ rv.precision(14);
+ if (show_ids) {
+ rv << id;
+ }
+ rv << ',';
+ rv << "'" << name << "'";
+ rv << ',';
+ rv << bits_per_sample;
+ rv << ',';
+ rv << sample_rate;
+ rv << ',';
+ rv << beams;
+ rv << ',';
+ rv << version;
+ return rv.str();
+}
+
+
+std::string recorder_config::print_xml(int full_subtables, int show_ids, int no_refs,const char *tag) const {
+ std::ostringstream rv("");
+
+ rv.precision(14);
+ rv << xml_indent() << '<' << tag << ">\n";
+ xml_indent(2);
+ if (show_ids) {
+ rv << xml_indent() << "<id>" << id << "</id>\n";
+ }
+ {
+ std::string enc_field=xml_encode_string(name,std::min(strlen(name),sizeof(name)));
+ rv << xml_indent() << "<name>";
+ rv << enc_field << "</name>\n";
+ }
+ rv << xml_indent() << "<bits_per_sample>" << bits_per_sample << "</bits_per_sample>\n";
+ rv << xml_indent() << "<sample_rate>" << sample_rate << "</sample_rate>\n";
+ rv << xml_indent() << "<beams>" << beams << "</beams>\n";
+ rv << xml_indent() << "<version>" << version << "</version>\n";
+ xml_indent(-2);
+ rv << xml_indent() << "</" << tag << ">\n";
+ return rv.str();
+}
+
+
+void recorder_config::parse_xml(const std::string &s,const char *tag) {
+ std::string field,sub;
+ if (extract_xml_record(s,tag,field)) {
+ std::string::size_type pos=0;
+ if (extract_xml_record(field,"id",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> id;
+ }
+ if (extract_xml_record(field,"name",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::string::size_type epos=sub.find("<",pos);
+ if (epos==std::string::npos) {
+ epos=sub.find('\n',pos);
+ }
+ if (epos==std::string::npos) {
+ epos=pos+strlen(sub.c_str()+pos);
+ }
+ std::vector<unsigned char> in(xml_decode_string<unsigned char>((const char *)sub.c_str()+pos,epos-pos));
+ strncpy(name,(const char *)&(in.front()),std::min(in.size(),(size_t)64));
+ name[std::min(in.size(),(size_t)63)]=0;
+ }
+ if (extract_xml_record(field,"bits_per_sample",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> bits_per_sample;
+ }
+ if (extract_xml_record(field,"sample_rate",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> sample_rate;
+ }
+ if (extract_xml_record(field,"beams",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> beams;
+ }
+ if (extract_xml_record(field,"version",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> version;
+ }
+ }
+}
+
+void recorder_config::parse(const SQL_ROW &s) {
+ {
+ std::istringstream row(*(s[0]));
+ row >> id;
+ }
+ {
+ strncpy(name,s[1]->c_str(),64);
+ name[63]=0;
+ }
+ {
+ std::istringstream row(*(s[2]));
+ row >> bits_per_sample;
+ }
+ {
+ std::istringstream row(*(s[3]));
+ row >> sample_rate;
+ }
+ {
+ std::istringstream row(*(s[4]));
+ row >> beams;
+ }
+ {
+ std::istringstream row(*(s[5]));
+ row >> version;
+ }
+}
+
+void recorder_config::parse(const std::string &s) {
+ SQL_ROW row(&s,6);
+ parse(row);
+}
+
+template <> const char *const db_table<splitter_config>::table_name="splitter_config";
+template <> const char *db_table<splitter_config>::_search_tag=table_name;
template <> const int db_table<splitter_config>::_nfields=12;
-template <> const char * const db_table<splitter_config>::column_names[12]={"id","version","data_type","fft_len","ifft_len","filter","window","samples_per_wu","highpass","blanker_filter","pfb_ntaps","pfb_width_factor"};
-
-splitter_config::splitter_config() :
- db_table<splitter_config>(*this,-1),
- id(0),
- version(0),
- fft_len(0),
- ifft_len(0),
- samples_per_wu(0),
- highpass(0),
- pfb_ntaps(0),
- pfb_width_factor(0)
-{
- db_open();
- data_type[0]=0;
- filter[0]=0;
- window[0]=0;
- blanker_filter[0]=0;
-}
-
-
-splitter_config::splitter_config(const splitter_config &a) :
- db_table<splitter_config>(*this,-1),
- id(a.id),
- version(a.version),
- fft_len(a.fft_len),
- ifft_len(a.ifft_len),
- samples_per_wu(a.samples_per_wu),
- highpass(a.highpass),
- pfb_ntaps(a.pfb_ntaps),
- pfb_width_factor(a.pfb_width_factor)
-{
- db_open();
- strcpy(data_type,a.data_type);
- strcpy(filter,a.filter);
- strcpy(window,a.window);
- strcpy(blanker_filter,a.blanker_filter);
-}
-
-
-splitter_config::splitter_config(const SQL_ROW &a) :
- db_table<splitter_config>(*this,-1)
-{
- db_open();
- parse(a);
-}
-
-
-splitter_config::splitter_config(const std::string &s,const char *tag) :
- db_table<splitter_config>(*this,-1)
-{
- db_open();
- if (xml_match_tag(s,tag)) {
- parse_xml(s,tag);
- } else {
- parse(s);
- }
+template <> const char *const db_table<splitter_config>::column_names[12]= {"id","version","data_type","fft_len","ifft_len","filter","window","samples_per_wu","highpass","blanker_filter","pfb_ntaps","pfb_width_factor"};
+
+splitter_config::splitter_config() :
+ db_table<splitter_config>(*this,-1),
+ id(0),
+ version(0),
+ fft_len(0),
+ ifft_len(0),
+ samples_per_wu(0),
+ highpass(0),
+ pfb_ntaps(0),
+ pfb_width_factor(0) {
+ db_open();
+ data_type[0]=0;
+ filter[0]=0;
+ window[0]=0;
+ blanker_filter[0]=0;
+}
+
+
+splitter_config::splitter_config(const splitter_config &a) :
+ db_table<splitter_config>(*this,-1),
+ id(a.id),
+ version(a.version),
+ fft_len(a.fft_len),
+ ifft_len(a.ifft_len),
+ samples_per_wu(a.samples_per_wu),
+ highpass(a.highpass),
+ pfb_ntaps(a.pfb_ntaps),
+ pfb_width_factor(a.pfb_width_factor) {
+ db_open();
+ strcpy(data_type,a.data_type);
+ strcpy(filter,a.filter);
+ strcpy(window,a.window);
+ strcpy(blanker_filter,a.blanker_filter);
+}
+
+
+splitter_config::splitter_config(const SQL_ROW &a) :
+ db_table<splitter_config>(*this,-1) {
+ db_open();
+ parse(a);
+}
+
+
+splitter_config::splitter_config(const std::string &s,const char *tag) :
+ db_table<splitter_config>(*this,-1) {
+ db_open();
+ if (xml_match_tag(s,tag)) {
+ parse_xml(s,tag);
+ } else {
+ parse(s);
+ }
}
splitter_config &splitter_config::operator =(const splitter_config &a) {
- if (&a != this) {
- id=a.id;
- version=a.version;
- fft_len=a.fft_len;
- ifft_len=a.ifft_len;
- samples_per_wu=a.samples_per_wu;
- highpass=a.highpass;
- pfb_ntaps=a.pfb_ntaps;
- pfb_width_factor=a.pfb_width_factor;
- strcpy(data_type,a.data_type);
- strcpy(filter,a.filter);
- strcpy(window,a.window);
- strcpy(blanker_filter,a.blanker_filter);
- }
- return (*this);
-}
-
-
-std::string splitter_config::update_format() const
-{ std::ostringstream rv("");
-
- for (int i=2;i<12;i++) rv << "?,";
- rv << "?";
- return rv.str();
-}
-
-
-std::string splitter_config::insert_format() const
-{ return std::string("?,")+update_format();
-}
-
-std::string splitter_config::select_format() const
-{
-std::string rv("");
-for (int i=0; i<11;i++) rv+="?,";
-rv+="?";
-return rv;
-}
-
-std::string splitter_config::print(int full_subtables, int show_ids, int no_refs) const
-{ std::ostringstream rv("");
-
- rv.precision(14);
- if (show_ids) rv << id;
- rv << ',';
- rv << version;
- rv << ',';
- rv << "'" << data_type << "'";
- rv << ',';
- rv << fft_len;
- rv << ',';
- rv << ifft_len;
- rv << ',';
- rv << "'" << filter << "'";
- rv << ',';
- rv << "'" << window << "'";
- rv << ',';
- rv << samples_per_wu;
- rv << ',';
- rv << highpass;
- rv << ',';
- rv << "'" << blanker_filter << "'";
- rv << ',';
- rv << pfb_ntaps;
- rv << ',';
- rv << pfb_width_factor;
- return rv.str();
-}
-
-
-std::string splitter_config::print_xml(int full_subtables, int show_ids, int no_refs,const char *tag) const
-{
- std::ostringstream rv("");
-
- rv.precision(14);
- rv << xml_indent() << '<' << tag << ">\n";
- xml_indent(2);
- if (show_ids) rv << xml_indent() << "<id>" << id << "</id>\n";
- rv << xml_indent() << "<version>" << version << "</version>\n";
- {
- std::string enc_field=xml_encode_string(data_type,std::min(strlen(data_type),sizeof(data_type)));
- rv << xml_indent() << "<data_type>";
- rv << enc_field << "</data_type>\n";
- }
- rv << xml_indent() << "<fft_len>" << fft_len << "</fft_len>\n";
- rv << xml_indent() << "<ifft_len>" << ifft_len << "</ifft_len>\n";
- {
- std::string enc_field=xml_encode_string(filter,std::min(strlen(filter),sizeof(filter)));
- rv << xml_indent() << "<filter>";
- rv << enc_field << "</filter>\n";
- }
- {
- std::string enc_field=xml_encode_string(window,std::min(strlen(window),sizeof(window)));
- rv << xml_indent() << "<window>";
- rv << enc_field << "</window>\n";
- }
- rv << xml_indent() << "<samples_per_wu>" << samples_per_wu << "</samples_per_wu>\n";
- rv << xml_indent() << "<highpass>" << highpass << "</highpass>\n";
- {
- std::string enc_field=xml_encode_string(blanker_filter,std::min(strlen(blanker_filter),sizeof(blanker_filter)));
- rv << xml_indent() << "<blanker_filter>";
- rv << enc_field << "</blanker_filter>\n";
- }
- rv << xml_indent() << "<pfb_ntaps>" << pfb_ntaps << "</pfb_ntaps>\n";
- rv << xml_indent() << "<pfb_width_factor>" << pfb_width_factor << "</pfb_width_factor>\n";
- xml_indent(-2);
- rv << xml_indent() << "</" << tag << ">\n";
- return rv.str();
-}
-
-
- void splitter_config::parse_xml(const std::string &s,const char *tag) {
- std::string field,sub;
- if (extract_xml_record(s,tag,field)) {
- std::string::size_type pos=0;
- if (extract_xml_record(field,"id",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> id;
- }
- if (extract_xml_record(field,"version",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> version;
- }
- if (extract_xml_record(field,"data_type",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::string::size_type epos=sub.find("<",pos);
- if (epos==std::string::npos) epos=sub.find('\n',pos);
- if (epos==std::string::npos) epos=pos+strlen(sub.c_str()+pos);
- std::vector<unsigned char> in(xml_decode_string<unsigned char>((const char *)sub.c_str()+pos,epos-pos));
- strncpy(data_type,(const char *)&(in.front()),std::min(in.size(),(size_t)64));
- data_type[std::min(in.size(),(size_t)63)]=0;
- }
- if (extract_xml_record(field,"fft_len",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> fft_len;
- }
- if (extract_xml_record(field,"ifft_len",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> ifft_len;
- }
- if (extract_xml_record(field,"filter",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::string::size_type epos=sub.find("<",pos);
- if (epos==std::string::npos) epos=sub.find('\n',pos);
- if (epos==std::string::npos) epos=pos+strlen(sub.c_str()+pos);
- std::vector<unsigned char> in(xml_decode_string<unsigned char>((const char *)sub.c_str()+pos,epos-pos));
- strncpy(filter,(const char *)&(in.front()),std::min(in.size(),(size_t)64));
- filter[std::min(in.size(),(size_t)63)]=0;
- }
- if (extract_xml_record(field,"window",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::string::size_type epos=sub.find("<",pos);
- if (epos==std::string::npos) epos=sub.find('\n',pos);
- if (epos==std::string::npos) epos=pos+strlen(sub.c_str()+pos);
- std::vector<unsigned char> in(xml_decode_string<unsigned char>((const char *)sub.c_str()+pos,epos-pos));
- strncpy(window,(const char *)&(in.front()),std::min(in.size(),(size_t)64));
- window[std::min(in.size(),(size_t)63)]=0;
- }
- if (extract_xml_record(field,"samples_per_wu",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> samples_per_wu;
- }
- if (extract_xml_record(field,"highpass",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> highpass;
- }
- if (extract_xml_record(field,"blanker_filter",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::string::size_type epos=sub.find("<",pos);
- if (epos==std::string::npos) epos=sub.find('\n',pos);
- if (epos==std::string::npos) epos=pos+strlen(sub.c_str()+pos);
- std::vector<unsigned char> in(xml_decode_string<unsigned char>((const char *)sub.c_str()+pos,epos-pos));
- strncpy(blanker_filter,(const char *)&(in.front()),std::min(in.size(),(size_t)64));
- blanker_filter[std::min(in.size(),(size_t)63)]=0;
- }
- if (extract_xml_record(field,"pfb_ntaps",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> pfb_ntaps;
- }
- if (extract_xml_record(field,"pfb_width_factor",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> pfb_width_factor;
- }
- }
- }
-
- void splitter_config::parse(const SQL_ROW &s) {
- {
- std::istringstream row(*(s[0]));
- row >> id;
- }
- {
- std::istringstream row(*(s[1]));
- row >> version;
- }
- {
- strncpy(data_type,s[2]->c_str(),64);
- data_type[63]=0;
- }
- {
- std::istringstream row(*(s[3]));
- row >> fft_len;
- }
- {
- std::istringstream row(*(s[4]));
- row >> ifft_len;
- }
- {
- strncpy(filter,s[5]->c_str(),64);
- filter[63]=0;
- }
- {
- strncpy(window,s[6]->c_str(),64);
- window[63]=0;
- }
- {
- std::istringstream row(*(s[7]));
- row >> samples_per_wu;
- }
- {
- std::istringstream row(*(s[8]));
- row >> highpass;
- }
- {
- strncpy(blanker_filter,s[9]->c_str(),64);
- blanker_filter[63]=0;
- }
- {
- std::istringstream row(*(s[10]));
- row >> pfb_ntaps;
- }
- {
- std::istringstream row(*(s[11]));
- row >> pfb_width_factor;
- }
- }
-
- void splitter_config::parse(const std::string &s) {
- SQL_ROW row(&s,12);
- parse(row);
- }
-
-template <> const char * const db_table<analysis_config>::table_name="analysis_config";
-template <> const char * db_table<analysis_config>::_search_tag=table_name;
+ if (&a != this) {
+ id=a.id;
+ version=a.version;
+ fft_len=a.fft_len;
+ ifft_len=a.ifft_len;
+ samples_per_wu=a.samples_per_wu;
+ highpass=a.highpass;
+ pfb_ntaps=a.pfb_ntaps;
+ pfb_width_factor=a.pfb_width_factor;
+ strcpy(data_type,a.data_type);
+ strcpy(filter,a.filter);
+ strcpy(window,a.window);
+ strcpy(blanker_filter,a.blanker_filter);
+ }
+ return (*this);
+}
+
+
+std::string splitter_config::update_format() const {
+ std::ostringstream rv("");
+
+ for (int i=2; i<12; i++) {
+ rv << "?,";
+ }
+ rv << "?";
+ return rv.str();
+}
+
+
+std::string splitter_config::insert_format() const {
+ return std::string("?,")+update_format();
+}
+
+std::string splitter_config::select_format() const {
+ std::string rv("");
+ for (int i=0; i<11; i++) {
+ rv+="?,";
+ }
+ rv+="?";
+ return rv;
+}
+
+std::string splitter_config::print(int full_subtables, int show_ids, int no_refs) const {
+ std::ostringstream rv("");
+
+ rv.precision(14);
+ if (show_ids) {
+ rv << id;
+ }
+ rv << ',';
+ rv << version;
+ rv << ',';
+ rv << "'" << data_type << "'";
+ rv << ',';
+ rv << fft_len;
+ rv << ',';
+ rv << ifft_len;
+ rv << ',';
+ rv << "'" << filter << "'";
+ rv << ',';
+ rv << "'" << window << "'";
+ rv << ',';
+ rv << samples_per_wu;
+ rv << ',';
+ rv << highpass;
+ rv << ',';
+ rv << "'" << blanker_filter << "'";
+ rv << ',';
+ rv << pfb_ntaps;
+ rv << ',';
+ rv << pfb_width_factor;
+ return rv.str();
+}
+
+
+std::string splitter_config::print_xml(int full_subtables, int show_ids, int no_refs,const char *tag) const {
+ std::ostringstream rv("");
+
+ rv.precision(14);
+ rv << xml_indent() << '<' << tag << ">\n";
+ xml_indent(2);
+ if (show_ids) {
+ rv << xml_indent() << "<id>" << id << "</id>\n";
+ }
+ rv << xml_indent() << "<version>" << version << "</version>\n";
+ {
+ std::string enc_field=xml_encode_string(data_type,std::min(strlen(data_type),sizeof(data_type)));
+ rv << xml_indent() << "<data_type>";
+ rv << enc_field << "</data_type>\n";
+ }
+ rv << xml_indent() << "<fft_len>" << fft_len << "</fft_len>\n";
+ rv << xml_indent() << "<ifft_len>" << ifft_len << "</ifft_len>\n";
+ {
+ std::string enc_field=xml_encode_string(filter,std::min(strlen(filter),sizeof(filter)));
+ rv << xml_indent() << "<filter>";
+ rv << enc_field << "</filter>\n";
+ }
+ {
+ std::string enc_field=xml_encode_string(window,std::min(strlen(window),sizeof(window)));
+ rv << xml_indent() << "<window>";
+ rv << enc_field << "</window>\n";
+ }
+ rv << xml_indent() << "<samples_per_wu>" << samples_per_wu << "</samples_per_wu>\n";
+ rv << xml_indent() << "<highpass>" << highpass << "</highpass>\n";
+ {
+ std::string enc_field=xml_encode_string(blanker_filter,std::min(strlen(blanker_filter),sizeof(blanker_filter)));
+ rv << xml_indent() << "<blanker_filter>";
+ rv << enc_field << "</blanker_filter>\n";
+ }
+ rv << xml_indent() << "<pfb_ntaps>" << pfb_ntaps << "</pfb_ntaps>\n";
+ rv << xml_indent() << "<pfb_width_factor>" << pfb_width_factor << "</pfb_width_factor>\n";
+ xml_indent(-2);
+ rv << xml_indent() << "</" << tag << ">\n";
+ return rv.str();
+}
+
+
+void splitter_config::parse_xml(const std::string &s,const char *tag) {
+ std::string field,sub;
+ if (extract_xml_record(s,tag,field)) {
+ std::string::size_type pos=0;
+ if (extract_xml_record(field,"id",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> id;
+ }
+ if (extract_xml_record(field,"version",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> version;
+ }
+ if (extract_xml_record(field,"data_type",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::string::size_type epos=sub.find("<",pos);
+ if (epos==std::string::npos) {
+ epos=sub.find('\n',pos);
+ }
+ if (epos==std::string::npos) {
+ epos=pos+strlen(sub.c_str()+pos);
+ }
+ std::vector<unsigned char> in(xml_decode_string<unsigned char>((const char *)sub.c_str()+pos,epos-pos));
+ strncpy(data_type,(const char *)&(in.front()),std::min(in.size(),(size_t)64));
+ data_type[std::min(in.size(),(size_t)63)]=0;
+ }
+ if (extract_xml_record(field,"fft_len",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> fft_len;
+ }
+ if (extract_xml_record(field,"ifft_len",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> ifft_len;
+ }
+ if (extract_xml_record(field,"filter",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::string::size_type epos=sub.find("<",pos);
+ if (epos==std::string::npos) {
+ epos=sub.find('\n',pos);
+ }
+ if (epos==std::string::npos) {
+ epos=pos+strlen(sub.c_str()+pos);
+ }
+ std::vector<unsigned char> in(xml_decode_string<unsigned char>((const char *)sub.c_str()+pos,epos-pos));
+ strncpy(filter,(const char *)&(in.front()),std::min(in.size(),(size_t)64));
+ filter[std::min(in.size(),(size_t)63)]=0;
+ }
+ if (extract_xml_record(field,"window",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::string::size_type epos=sub.find("<",pos);
+ if (epos==std::string::npos) {
+ epos=sub.find('\n',pos);
+ }
+ if (epos==std::string::npos) {
+ epos=pos+strlen(sub.c_str()+pos);
+ }
+ std::vector<unsigned char> in(xml_decode_string<unsigned char>((const char *)sub.c_str()+pos,epos-pos));
+ strncpy(window,(const char *)&(in.front()),std::min(in.size(),(size_t)64));
+ window[std::min(in.size(),(size_t)63)]=0;
+ }
+ if (extract_xml_record(field,"samples_per_wu",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> samples_per_wu;
+ }
+ if (extract_xml_record(field,"highpass",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> highpass;
+ }
+ if (extract_xml_record(field,"blanker_filter",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::string::size_type epos=sub.find("<",pos);
+ if (epos==std::string::npos) {
+ epos=sub.find('\n',pos);
+ }
+ if (epos==std::string::npos) {
+ epos=pos+strlen(sub.c_str()+pos);
+ }
+ std::vector<unsigned char> in(xml_decode_string<unsigned char>((const char *)sub.c_str()+pos,epos-pos));
+ strncpy(blanker_filter,(const char *)&(in.front()),std::min(in.size(),(size_t)64));
+ blanker_filter[std::min(in.size(),(size_t)63)]=0;
+ }
+ if (extract_xml_record(field,"pfb_ntaps",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> pfb_ntaps;
+ }
+ if (extract_xml_record(field,"pfb_width_factor",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> pfb_width_factor;
+ }
+ }
+}
+
+void splitter_config::parse(const SQL_ROW &s) {
+ {
+ std::istringstream row(*(s[0]));
+ row >> id;
+ }
+ {
+ std::istringstream row(*(s[1]));
+ row >> version;
+ }
+ {
+ strncpy(data_type,s[2]->c_str(),64);
+ data_type[63]=0;
+ }
+ {
+ std::istringstream row(*(s[3]));
+ row >> fft_len;
+ }
+ {
+ std::istringstream row(*(s[4]));
+ row >> ifft_len;
+ }
+ {
+ strncpy(filter,s[5]->c_str(),64);
+ filter[63]=0;
+ }
+ {
+ strncpy(window,s[6]->c_str(),64);
+ window[63]=0;
+ }
+ {
+ std::istringstream row(*(s[7]));
+ row >> samples_per_wu;
+ }
+ {
+ std::istringstream row(*(s[8]));
+ row >> highpass;
+ }
+ {
+ strncpy(blanker_filter,s[9]->c_str(),64);
+ blanker_filter[63]=0;
+ }
+ {
+ std::istringstream row(*(s[10]));
+ row >> pfb_ntaps;
+ }
+ {
+ std::istringstream row(*(s[11]));
+ row >> pfb_width_factor;
+ }
+}
+
+void splitter_config::parse(const std::string &s) {
+ SQL_ROW row(&s,12);
+ parse(row);
+}
+
+template <> const char *const db_table<analysis_config>::table_name="analysis_config";
+template <> const char *db_table<analysis_config>::_search_tag=table_name;
template <> const int db_table<analysis_config>::_nfields=39;
-template <> const char * const db_table<analysis_config>::column_names[39]={"id","spike_thresh","spikes_per_spectrum","autocorr_thresh","autocorr_per_spectrum","autocorr_fftlen","gauss_null_chi_sq_thresh","gauss_chi_sq_thresh","gauss_power_thresh","gauss_peak_power_thresh","gauss_pot_length","pulse_thresh","pulse_display_thresh","pulse_max","pulse_min","pulse_fft_max","pulse_pot_length","triplet_thresh","triplet_max","triplet_min","triplet_pot_length","pot_overlap_factor","pot_t_offset", [...]
-
-analysis_config::analysis_config() :
- db_table<analysis_config>(*this,-1),
- id(0),
- spike_thresh(0),
- spikes_per_spectrum(0),
- autocorr_thresh(0),
- autocorr_per_spectrum(0),
- autocorr_fftlen(0),
- gauss_null_chi_sq_thresh(0),
- gauss_chi_sq_thresh(0),
- gauss_power_thresh(0),
- gauss_peak_power_thresh(0),
- gauss_pot_length(0),
- pulse_thresh(0),
- pulse_display_thresh(0),
- pulse_max(0),
- pulse_min(0),
- pulse_fft_max(0),
- pulse_pot_length(0),
- triplet_thresh(0),
- triplet_max(0),
- triplet_min(0),
- triplet_pot_length(0),
- pot_overlap_factor(0),
- pot_t_offset(0),
- pot_min_slew(0),
- pot_max_slew(0),
- chirp_resolution(0),
- analysis_fft_lengths(0),
- bsmooth_boxcar_length(0),
- bsmooth_chunk_size(0),
- chirps((chirp_parameter_t *)0,0,_x_xml_values),
- pulse_beams(0),
- max_signals(0),
- max_spikes(0),
- max_autocorr(0),
- max_gaussians(0),
- max_pulses(0),
- max_triplets(0),
- keyuniq(0),
- credit_rate(0)
-{
- db_open();
-}
-
-
-analysis_config::analysis_config(const analysis_config &a) :
- db_table<analysis_config>(*this,-1),
- id(a.id),
- spike_thresh(a.spike_thresh),
- spikes_per_spectrum(a.spikes_per_spectrum),
- autocorr_thresh(a.autocorr_thresh),
- autocorr_per_spectrum(a.autocorr_per_spectrum),
- autocorr_fftlen(a.autocorr_fftlen),
- gauss_null_chi_sq_thresh(a.gauss_null_chi_sq_thresh),
- gauss_chi_sq_thresh(a.gauss_chi_sq_thresh),
- gauss_power_thresh(a.gauss_power_thresh),
- gauss_peak_power_thresh(a.gauss_peak_power_thresh),
- gauss_pot_length(a.gauss_pot_length),
- pulse_thresh(a.pulse_thresh),
- pulse_display_thresh(a.pulse_display_thresh),
- pulse_max(a.pulse_max),
- pulse_min(a.pulse_min),
- pulse_fft_max(a.pulse_fft_max),
- pulse_pot_length(a.pulse_pot_length),
- triplet_thresh(a.triplet_thresh),
- triplet_max(a.triplet_max),
- triplet_min(a.triplet_min),
- triplet_pot_length(a.triplet_pot_length),
- pot_overlap_factor(a.pot_overlap_factor),
- pot_t_offset(a.pot_t_offset),
- pot_min_slew(a.pot_min_slew),
- pot_max_slew(a.pot_max_slew),
- chirp_resolution(a.chirp_resolution),
- analysis_fft_lengths(a.analysis_fft_lengths),
- bsmooth_boxcar_length(a.bsmooth_boxcar_length),
- bsmooth_chunk_size(a.bsmooth_chunk_size),
- chirps(a.chirps),
- pulse_beams(a.pulse_beams),
- max_signals(a.max_signals),
- max_spikes(a.max_spikes),
- max_autocorr(a.max_autocorr),
- max_gaussians(a.max_gaussians),
- max_pulses(a.max_pulses),
- max_triplets(a.max_triplets),
- keyuniq(a.keyuniq),
- credit_rate(a.credit_rate)
-{
- db_open();
-}
-
-
-analysis_config::analysis_config(const SQL_ROW &a) :
- db_table<analysis_config>(*this,-1)
-{
- db_open();
- parse(a);
-}
-
-
-analysis_config::analysis_config(const std::string &s,const char *tag) :
- db_table<analysis_config>(*this,-1)
-{
- db_open();
- if (xml_match_tag(s,tag)) {
- parse_xml(s,tag);
- } else {
- parse(s);
- }
+template <> const char *const db_table<analysis_config>::column_names[39]= {"id","spike_thresh","spikes_per_spectrum","autocorr_thresh","autocorr_per_spectrum","autocorr_fftlen","gauss_null_chi_sq_thresh","gauss_chi_sq_thresh","gauss_power_thresh","gauss_peak_power_thresh","gauss_pot_length","pulse_thresh","pulse_display_thresh","pulse_max","pulse_min","pulse_fft_max","pulse_pot_length","triplet_thresh","triplet_max","triplet_min","triplet_pot_length","pot_overlap_factor","pot_t_offset", [...]
+
+analysis_config::analysis_config() :
+ db_table<analysis_config>(*this,-1),
+ id(0),
+ spike_thresh(0),
+ spikes_per_spectrum(0),
+ autocorr_thresh(0),
+ autocorr_per_spectrum(0),
+ autocorr_fftlen(0),
+ gauss_null_chi_sq_thresh(0),
+ gauss_chi_sq_thresh(0),
+ gauss_power_thresh(0),
+ gauss_peak_power_thresh(0),
+ gauss_pot_length(0),
+ pulse_thresh(0),
+ pulse_display_thresh(0),
+ pulse_max(0),
+ pulse_min(0),
+ pulse_fft_max(0),
+ pulse_pot_length(0),
+ triplet_thresh(0),
+ triplet_max(0),
+ triplet_min(0),
+ triplet_pot_length(0),
+ pot_overlap_factor(0),
+ pot_t_offset(0),
+ pot_min_slew(0),
+ pot_max_slew(0),
+ chirp_resolution(0),
+ analysis_fft_lengths(0),
+ bsmooth_boxcar_length(0),
+ bsmooth_chunk_size(0),
+ chirps((chirp_parameter_t *)0,0,_x_xml_values),
+ pulse_beams(0),
+ max_signals(0),
+ max_spikes(0),
+ max_autocorr(0),
+ max_gaussians(0),
+ max_pulses(0),
+ max_triplets(0),
+ keyuniq(0),
+ credit_rate(0) {
+ db_open();
+}
+
+
+analysis_config::analysis_config(const analysis_config &a) :
+ db_table<analysis_config>(*this,-1),
+ id(a.id),
+ spike_thresh(a.spike_thresh),
+ spikes_per_spectrum(a.spikes_per_spectrum),
+ autocorr_thresh(a.autocorr_thresh),
+ autocorr_per_spectrum(a.autocorr_per_spectrum),
+ autocorr_fftlen(a.autocorr_fftlen),
+ gauss_null_chi_sq_thresh(a.gauss_null_chi_sq_thresh),
+ gauss_chi_sq_thresh(a.gauss_chi_sq_thresh),
+ gauss_power_thresh(a.gauss_power_thresh),
+ gauss_peak_power_thresh(a.gauss_peak_power_thresh),
+ gauss_pot_length(a.gauss_pot_length),
+ pulse_thresh(a.pulse_thresh),
+ pulse_display_thresh(a.pulse_display_thresh),
+ pulse_max(a.pulse_max),
+ pulse_min(a.pulse_min),
+ pulse_fft_max(a.pulse_fft_max),
+ pulse_pot_length(a.pulse_pot_length),
+ triplet_thresh(a.triplet_thresh),
+ triplet_max(a.triplet_max),
+ triplet_min(a.triplet_min),
+ triplet_pot_length(a.triplet_pot_length),
+ pot_overlap_factor(a.pot_overlap_factor),
+ pot_t_offset(a.pot_t_offset),
+ pot_min_slew(a.pot_min_slew),
+ pot_max_slew(a.pot_max_slew),
+ chirp_resolution(a.chirp_resolution),
+ analysis_fft_lengths(a.analysis_fft_lengths),
+ bsmooth_boxcar_length(a.bsmooth_boxcar_length),
+ bsmooth_chunk_size(a.bsmooth_chunk_size),
+ chirps(a.chirps),
+ pulse_beams(a.pulse_beams),
+ max_signals(a.max_signals),
+ max_spikes(a.max_spikes),
+ max_autocorr(a.max_autocorr),
+ max_gaussians(a.max_gaussians),
+ max_pulses(a.max_pulses),
+ max_triplets(a.max_triplets),
+ keyuniq(a.keyuniq),
+ credit_rate(a.credit_rate) {
+ db_open();
+}
+
+
+analysis_config::analysis_config(const SQL_ROW &a) :
+ db_table<analysis_config>(*this,-1) {
+ db_open();
+ parse(a);
+}
+
+
+analysis_config::analysis_config(const std::string &s,const char *tag) :
+ db_table<analysis_config>(*this,-1) {
+ db_open();
+ if (xml_match_tag(s,tag)) {
+ parse_xml(s,tag);
+ } else {
+ parse(s);
+ }
}
analysis_config &analysis_config::operator =(const analysis_config &a) {
- if (&a != this) {
- id=a.id;
- spike_thresh=a.spike_thresh;
- spikes_per_spectrum=a.spikes_per_spectrum;
- autocorr_thresh=a.autocorr_thresh;
- autocorr_per_spectrum=a.autocorr_per_spectrum;
- autocorr_fftlen=a.autocorr_fftlen;
- gauss_null_chi_sq_thresh=a.gauss_null_chi_sq_thresh;
- gauss_chi_sq_thresh=a.gauss_chi_sq_thresh;
- gauss_power_thresh=a.gauss_power_thresh;
- gauss_peak_power_thresh=a.gauss_peak_power_thresh;
- gauss_pot_length=a.gauss_pot_length;
- pulse_thresh=a.pulse_thresh;
- pulse_display_thresh=a.pulse_display_thresh;
- pulse_max=a.pulse_max;
- pulse_min=a.pulse_min;
- pulse_fft_max=a.pulse_fft_max;
- pulse_pot_length=a.pulse_pot_length;
- triplet_thresh=a.triplet_thresh;
- triplet_max=a.triplet_max;
- triplet_min=a.triplet_min;
- triplet_pot_length=a.triplet_pot_length;
- pot_overlap_factor=a.pot_overlap_factor;
- pot_t_offset=a.pot_t_offset;
- pot_min_slew=a.pot_min_slew;
- pot_max_slew=a.pot_max_slew;
- chirp_resolution=a.chirp_resolution;
- analysis_fft_lengths=a.analysis_fft_lengths;
- bsmooth_boxcar_length=a.bsmooth_boxcar_length;
- bsmooth_chunk_size=a.bsmooth_chunk_size;
- {
- chirps.clear();
- std::vector<chirp_parameter_t>::const_iterator i(a.chirps.begin());
- for (;i!=a.chirps.end();i++) {
- chirps.push_back(*i);
- }
- }
- pulse_beams=a.pulse_beams;
- max_signals=a.max_signals;
- max_spikes=a.max_spikes;
- max_autocorr=a.max_autocorr;
- max_gaussians=a.max_gaussians;
- max_pulses=a.max_pulses;
- max_triplets=a.max_triplets;
- keyuniq=a.keyuniq;
- credit_rate=a.credit_rate;
- }
- return (*this);
-}
-
-
-std::string analysis_config::update_format() const
-{ std::ostringstream rv("");
-
- for (int i=2;i<39;i++) rv << "?,";
- rv << "?";
- return rv.str();
-}
-
-
-std::string analysis_config::insert_format() const
-{ return std::string("?,")+update_format();
-}
-
-std::string analysis_config::select_format() const
-{
-std::string rv("");
-for (int i=0; i<38;i++) rv+="?,";
-rv+="?";
-return rv;
-}
-
-std::string analysis_config::print(int full_subtables, int show_ids, int no_refs) const
-{ std::ostringstream rv("");
-
- rv.precision(14);
- if (show_ids) rv << id;
- rv << ',';
- rv << spike_thresh;
- rv << ',';
- rv << spikes_per_spectrum;
- rv << ',';
- rv << autocorr_thresh;
- rv << ',';
- rv << autocorr_per_spectrum;
- rv << ',';
- rv << autocorr_fftlen;
- rv << ',';
- rv << gauss_null_chi_sq_thresh;
- rv << ',';
- rv << gauss_chi_sq_thresh;
- rv << ',';
- rv << gauss_power_thresh;
- rv << ',';
- rv << gauss_peak_power_thresh;
- rv << ',';
- rv << gauss_pot_length;
- rv << ',';
- rv << pulse_thresh;
- rv << ',';
- rv << pulse_display_thresh;
- rv << ',';
- rv << pulse_max;
- rv << ',';
- rv << pulse_min;
- rv << ',';
- rv << pulse_fft_max;
- rv << ',';
- rv << pulse_pot_length;
- rv << ',';
- rv << triplet_thresh;
- rv << ',';
- rv << triplet_max;
- rv << ',';
- rv << triplet_min;
- rv << ',';
- rv << triplet_pot_length;
- rv << ',';
- rv << pot_overlap_factor;
- rv << ',';
- rv << pot_t_offset;
- rv << ',';
- rv << pot_min_slew;
- rv << ',';
- rv << pot_max_slew;
- rv << ',';
- rv << chirp_resolution;
- rv << ',';
- rv << analysis_fft_lengths;
- rv << ',';
- rv << bsmooth_boxcar_length;
- rv << ',';
- rv << bsmooth_chunk_size;
- rv << ',';
- rv << "LIST {";
- {
- std::vector<chirp_parameter_t>::const_iterator p=chirps.begin();
- for (;p<chirps.end();p++) {
- rv << p->print();
- if (p != chirps.end()-1) {
- rv << ',';
- } else {
- rv << "}";
- }
- }
- }
- rv << ',';
- rv << pulse_beams;
- rv << ',';
- rv << max_signals;
- rv << ',';
- rv << max_spikes;
- rv << ',';
- rv << max_autocorr;
- rv << ',';
- rv << max_gaussians;
- rv << ',';
- rv << max_pulses;
- rv << ',';
- rv << max_triplets;
- rv << ',';
- rv << keyuniq;
- rv << ',';
- rv << credit_rate;
- return rv.str();
-}
-
-
-std::string analysis_config::print_xml(int full_subtables, int show_ids, int no_refs,const char *tag) const
-{
- std::ostringstream rv("");
-
- rv.precision(14);
- rv << xml_indent() << '<' << tag << ">\n";
- xml_indent(2);
- if (show_ids) rv << xml_indent() << "<id>" << id << "</id>\n";
- rv << xml_indent() << "<spike_thresh>" << spike_thresh << "</spike_thresh>\n";
- rv << xml_indent() << "<spikes_per_spectrum>" << spikes_per_spectrum << "</spikes_per_spectrum>\n";
- rv << xml_indent() << "<autocorr_thresh>" << autocorr_thresh << "</autocorr_thresh>\n";
- rv << xml_indent() << "<autocorr_per_spectrum>" << autocorr_per_spectrum << "</autocorr_per_spectrum>\n";
- rv << xml_indent() << "<autocorr_fftlen>" << autocorr_fftlen << "</autocorr_fftlen>\n";
- rv << xml_indent() << "<gauss_null_chi_sq_thresh>" << gauss_null_chi_sq_thresh << "</gauss_null_chi_sq_thresh>\n";
- rv << xml_indent() << "<gauss_chi_sq_thresh>" << gauss_chi_sq_thresh << "</gauss_chi_sq_thresh>\n";
- rv << xml_indent() << "<gauss_power_thresh>" << gauss_power_thresh << "</gauss_power_thresh>\n";
- rv << xml_indent() << "<gauss_peak_power_thresh>" << gauss_peak_power_thresh << "</gauss_peak_power_thresh>\n";
- rv << xml_indent() << "<gauss_pot_length>" << gauss_pot_length << "</gauss_pot_length>\n";
- rv << xml_indent() << "<pulse_thresh>" << pulse_thresh << "</pulse_thresh>\n";
- rv << xml_indent() << "<pulse_display_thresh>" << pulse_display_thresh << "</pulse_display_thresh>\n";
- rv << xml_indent() << "<pulse_max>" << pulse_max << "</pulse_max>\n";
- rv << xml_indent() << "<pulse_min>" << pulse_min << "</pulse_min>\n";
- rv << xml_indent() << "<pulse_fft_max>" << pulse_fft_max << "</pulse_fft_max>\n";
- rv << xml_indent() << "<pulse_pot_length>" << pulse_pot_length << "</pulse_pot_length>\n";
- rv << xml_indent() << "<triplet_thresh>" << triplet_thresh << "</triplet_thresh>\n";
- rv << xml_indent() << "<triplet_max>" << triplet_max << "</triplet_max>\n";
- rv << xml_indent() << "<triplet_min>" << triplet_min << "</triplet_min>\n";
- rv << xml_indent() << "<triplet_pot_length>" << triplet_pot_length << "</triplet_pot_length>\n";
- rv << xml_indent() << "<pot_overlap_factor>" << pot_overlap_factor << "</pot_overlap_factor>\n";
- rv << xml_indent() << "<pot_t_offset>" << pot_t_offset << "</pot_t_offset>\n";
- rv << xml_indent() << "<pot_min_slew>" << pot_min_slew << "</pot_min_slew>\n";
- rv << xml_indent() << "<pot_max_slew>" << pot_max_slew << "</pot_max_slew>\n";
- rv << xml_indent() << "<chirp_resolution>" << chirp_resolution << "</chirp_resolution>\n";
- rv << xml_indent() << "<analysis_fft_lengths>" << analysis_fft_lengths << "</analysis_fft_lengths>\n";
- rv << xml_indent() << "<bsmooth_boxcar_length>" << bsmooth_boxcar_length << "</bsmooth_boxcar_length>\n";
- rv << xml_indent() << "<bsmooth_chunk_size>" << bsmooth_chunk_size << "</bsmooth_chunk_size>\n";
- if (chirps.size()) {
- rv << xml_indent() << "<chirps";
- {
- std::string enc_string=chirps.print_xml();
- rv << ">\n" ;
- rv << enc_string;
- }
-}
- rv << xml_indent(-2);
- rv << "</chirps>\n";
- rv << xml_indent() << "<pulse_beams>" << pulse_beams << "</pulse_beams>\n";
- rv << xml_indent() << "<max_signals>" << max_signals << "</max_signals>\n";
- rv << xml_indent() << "<max_spikes>" << max_spikes << "</max_spikes>\n";
- rv << xml_indent() << "<max_autocorr>" << max_autocorr << "</max_autocorr>\n";
- rv << xml_indent() << "<max_gaussians>" << max_gaussians << "</max_gaussians>\n";
- rv << xml_indent() << "<max_pulses>" << max_pulses << "</max_pulses>\n";
- rv << xml_indent() << "<max_triplets>" << max_triplets << "</max_triplets>\n";
- rv << xml_indent() << "<keyuniq>" << keyuniq << "</keyuniq>\n";
- rv << xml_indent() << "<credit_rate>" << credit_rate << "</credit_rate>\n";
- xml_indent(-2);
- rv << xml_indent() << "</" << tag << ">\n";
- return rv.str();
-}
-
-
- void analysis_config::parse_xml(const std::string &s,const char *tag) {
- std::string field,sub;
- if (extract_xml_record(s,tag,field)) {
- std::string::size_type pos=0;
- if (extract_xml_record(field,"id",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> id;
- }
- if (extract_xml_record(field,"spike_thresh",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> spike_thresh;
- }
- if (extract_xml_record(field,"spikes_per_spectrum",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> spikes_per_spectrum;
- }
- if (extract_xml_record(field,"autocorr_thresh",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> autocorr_thresh;
- }
- if (extract_xml_record(field,"autocorr_per_spectrum",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> autocorr_per_spectrum;
- }
- if (extract_xml_record(field,"autocorr_fftlen",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> autocorr_fftlen;
- }
- if (extract_xml_record(field,"gauss_null_chi_sq_thresh",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> gauss_null_chi_sq_thresh;
- }
- if (extract_xml_record(field,"gauss_chi_sq_thresh",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> gauss_chi_sq_thresh;
- }
- if (extract_xml_record(field,"gauss_power_thresh",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> gauss_power_thresh;
- }
- if (extract_xml_record(field,"gauss_peak_power_thresh",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> gauss_peak_power_thresh;
- }
- if (extract_xml_record(field,"gauss_pot_length",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> gauss_pot_length;
- }
- if (extract_xml_record(field,"pulse_thresh",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> pulse_thresh;
- }
- if (extract_xml_record(field,"pulse_display_thresh",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> pulse_display_thresh;
- }
- if (extract_xml_record(field,"pulse_max",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> pulse_max;
- }
- if (extract_xml_record(field,"pulse_min",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> pulse_min;
- }
- if (extract_xml_record(field,"pulse_fft_max",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> pulse_fft_max;
- }
- if (extract_xml_record(field,"pulse_pot_length",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> pulse_pot_length;
- }
- if (extract_xml_record(field,"triplet_thresh",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> triplet_thresh;
- }
- if (extract_xml_record(field,"triplet_max",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> triplet_max;
- }
- if (extract_xml_record(field,"triplet_min",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> triplet_min;
- }
- if (extract_xml_record(field,"triplet_pot_length",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> triplet_pot_length;
- }
- if (extract_xml_record(field,"pot_overlap_factor",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> pot_overlap_factor;
- }
- if (extract_xml_record(field,"pot_t_offset",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> pot_t_offset;
- }
- if (extract_xml_record(field,"pot_min_slew",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> pot_min_slew;
- }
- if (extract_xml_record(field,"pot_max_slew",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> pot_max_slew;
- }
- if (extract_xml_record(field,"chirp_resolution",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> chirp_resolution;
- }
- if (extract_xml_record(field,"analysis_fft_lengths",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> analysis_fft_lengths;
- }
- if (extract_xml_record(field,"bsmooth_boxcar_length",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> bsmooth_boxcar_length;
- }
- if (extract_xml_record(field,"bsmooth_chunk_size",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> bsmooth_chunk_size;
- }
- chirps.clear();
- if (extract_xml_record(field,"chirps",sub)) {
- pos=0;
- while ((pos=sub.find("<chirp_parameter_t",pos)) != std::string::npos) {
- chirps.push_back(chirp_parameter_t(std::string(sub.c_str()+pos)));
- pos=sub.find("</chirp_parameter_t",pos);
- pos=sub.find(">",pos);
- }
- }
- if (extract_xml_record(field,"pulse_beams",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> pulse_beams;
- }
- if (extract_xml_record(field,"max_signals",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> max_signals;
- }
- if (extract_xml_record(field,"max_spikes",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> max_spikes;
- }
- if (extract_xml_record(field,"max_autocorr",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> max_autocorr;
- }
- if (extract_xml_record(field,"max_gaussians",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> max_gaussians;
- }
- if (extract_xml_record(field,"max_pulses",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> max_pulses;
- }
- if (extract_xml_record(field,"max_triplets",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> max_triplets;
- }
- if (extract_xml_record(field,"keyuniq",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> keyuniq;
- }
- if (extract_xml_record(field,"credit_rate",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> credit_rate;
- }
- }
- }
-
- void analysis_config::parse(const SQL_ROW &s) {
- {
- std::istringstream row(*(s[0]));
- row >> id;
- }
- {
- std::istringstream row(*(s[1]));
- row >> spike_thresh;
- }
- {
- std::istringstream row(*(s[2]));
- row >> spikes_per_spectrum;
- }
- {
- std::istringstream row(*(s[3]));
- row >> autocorr_thresh;
- }
- {
- std::istringstream row(*(s[4]));
- row >> autocorr_per_spectrum;
- }
- {
- std::istringstream row(*(s[5]));
- row >> autocorr_fftlen;
- }
- {
- std::istringstream row(*(s[6]));
- row >> gauss_null_chi_sq_thresh;
- }
- {
- std::istringstream row(*(s[7]));
- row >> gauss_chi_sq_thresh;
- }
- {
- std::istringstream row(*(s[8]));
- row >> gauss_power_thresh;
- }
- {
- std::istringstream row(*(s[9]));
- row >> gauss_peak_power_thresh;
- }
- {
- std::istringstream row(*(s[10]));
- row >> gauss_pot_length;
- }
- {
- std::istringstream row(*(s[11]));
- row >> pulse_thresh;
- }
- {
- std::istringstream row(*(s[12]));
- row >> pulse_display_thresh;
- }
- {
- std::istringstream row(*(s[13]));
- row >> pulse_max;
- }
- {
- std::istringstream row(*(s[14]));
- row >> pulse_min;
- }
- {
- std::istringstream row(*(s[15]));
- row >> pulse_fft_max;
- }
- {
- std::istringstream row(*(s[16]));
- row >> pulse_pot_length;
- }
- {
- std::istringstream row(*(s[17]));
- row >> triplet_thresh;
- }
- {
- std::istringstream row(*(s[18]));
- row >> triplet_max;
- }
- {
- std::istringstream row(*(s[19]));
- row >> triplet_min;
- }
- {
- std::istringstream row(*(s[20]));
- row >> triplet_pot_length;
- }
- {
- std::istringstream row(*(s[21]));
- row >> pot_overlap_factor;
- }
- {
- std::istringstream row(*(s[22]));
- row >> pot_t_offset;
- }
- {
- std::istringstream row(*(s[23]));
- row >> pot_min_slew;
- }
- {
- std::istringstream row(*(s[24]));
- row >> pot_max_slew;
- }
- {
- std::istringstream row(*(s[25]));
- row >> chirp_resolution;
- }
- {
- std::istringstream row(*(s[26]));
- row >> analysis_fft_lengths;
- }
- {
- std::istringstream row(*(s[27]));
- row >> bsmooth_boxcar_length;
- }
- {
- std::istringstream row(*(s[28]));
- row >> bsmooth_chunk_size;
- }
- {
- std::string::size_type p,q;
- int i;
- chirps.clear();
- SQL_ROW tmp(s[29]);
- for (i=0;i<tmp.argc();i++) {
- chirps.push_back(chirp_parameter_t(SQL_ROW(tmp[i])));
- }
- }
- {
- std::istringstream row(*(s[30]));
- row >> pulse_beams;
- }
- {
- std::istringstream row(*(s[31]));
- row >> max_signals;
- }
- {
- std::istringstream row(*(s[32]));
- row >> max_spikes;
- }
- {
- std::istringstream row(*(s[33]));
- row >> max_autocorr;
- }
- {
- std::istringstream row(*(s[34]));
- row >> max_gaussians;
- }
- {
- std::istringstream row(*(s[35]));
- row >> max_pulses;
- }
- {
- std::istringstream row(*(s[36]));
- row >> max_triplets;
- }
- {
- std::istringstream row(*(s[37]));
- row >> keyuniq;
- }
- {
- std::istringstream row(*(s[38]));
- row >> credit_rate;
- }
- }
-
- void analysis_config::parse(const std::string &s) {
- SQL_ROW row(&s,39);
- parse(row);
- }
-
-template <> const char * const db_table<science_config>::table_name="science_config";
-template <> const char * db_table<science_config>::_search_tag=table_name;
+ if (&a != this) {
+ id=a.id;
+ spike_thresh=a.spike_thresh;
+ spikes_per_spectrum=a.spikes_per_spectrum;
+ autocorr_thresh=a.autocorr_thresh;
+ autocorr_per_spectrum=a.autocorr_per_spectrum;
+ autocorr_fftlen=a.autocorr_fftlen;
+ gauss_null_chi_sq_thresh=a.gauss_null_chi_sq_thresh;
+ gauss_chi_sq_thresh=a.gauss_chi_sq_thresh;
+ gauss_power_thresh=a.gauss_power_thresh;
+ gauss_peak_power_thresh=a.gauss_peak_power_thresh;
+ gauss_pot_length=a.gauss_pot_length;
+ pulse_thresh=a.pulse_thresh;
+ pulse_display_thresh=a.pulse_display_thresh;
+ pulse_max=a.pulse_max;
+ pulse_min=a.pulse_min;
+ pulse_fft_max=a.pulse_fft_max;
+ pulse_pot_length=a.pulse_pot_length;
+ triplet_thresh=a.triplet_thresh;
+ triplet_max=a.triplet_max;
+ triplet_min=a.triplet_min;
+ triplet_pot_length=a.triplet_pot_length;
+ pot_overlap_factor=a.pot_overlap_factor;
+ pot_t_offset=a.pot_t_offset;
+ pot_min_slew=a.pot_min_slew;
+ pot_max_slew=a.pot_max_slew;
+ chirp_resolution=a.chirp_resolution;
+ analysis_fft_lengths=a.analysis_fft_lengths;
+ bsmooth_boxcar_length=a.bsmooth_boxcar_length;
+ bsmooth_chunk_size=a.bsmooth_chunk_size;
+ {
+ chirps.clear();
+ std::vector<chirp_parameter_t>::const_iterator i(a.chirps.begin());
+ for (; i!=a.chirps.end(); i++) {
+ chirps.push_back(*i);
+ }
+ }
+ pulse_beams=a.pulse_beams;
+ max_signals=a.max_signals;
+ max_spikes=a.max_spikes;
+ max_autocorr=a.max_autocorr;
+ max_gaussians=a.max_gaussians;
+ max_pulses=a.max_pulses;
+ max_triplets=a.max_triplets;
+ keyuniq=a.keyuniq;
+ credit_rate=a.credit_rate;
+ }
+ return (*this);
+}
+
+
+std::string analysis_config::update_format() const {
+ std::ostringstream rv("");
+
+ for (int i=2; i<39; i++) {
+ rv << "?,";
+ }
+ rv << "?";
+ return rv.str();
+}
+
+
+std::string analysis_config::insert_format() const {
+ return std::string("?,")+update_format();
+}
+
+std::string analysis_config::select_format() const {
+ std::string rv("");
+ for (int i=0; i<38; i++) {
+ rv+="?,";
+ }
+ rv+="?";
+ return rv;
+}
+
+std::string analysis_config::print(int full_subtables, int show_ids, int no_refs) const {
+ std::ostringstream rv("");
+
+ rv.precision(14);
+ if (show_ids) {
+ rv << id;
+ }
+ rv << ',';
+ rv << spike_thresh;
+ rv << ',';
+ rv << spikes_per_spectrum;
+ rv << ',';
+ rv << autocorr_thresh;
+ rv << ',';
+ rv << autocorr_per_spectrum;
+ rv << ',';
+ rv << autocorr_fftlen;
+ rv << ',';
+ rv << gauss_null_chi_sq_thresh;
+ rv << ',';
+ rv << gauss_chi_sq_thresh;
+ rv << ',';
+ rv << gauss_power_thresh;
+ rv << ',';
+ rv << gauss_peak_power_thresh;
+ rv << ',';
+ rv << gauss_pot_length;
+ rv << ',';
+ rv << pulse_thresh;
+ rv << ',';
+ rv << pulse_display_thresh;
+ rv << ',';
+ rv << pulse_max;
+ rv << ',';
+ rv << pulse_min;
+ rv << ',';
+ rv << pulse_fft_max;
+ rv << ',';
+ rv << pulse_pot_length;
+ rv << ',';
+ rv << triplet_thresh;
+ rv << ',';
+ rv << triplet_max;
+ rv << ',';
+ rv << triplet_min;
+ rv << ',';
+ rv << triplet_pot_length;
+ rv << ',';
+ rv << pot_overlap_factor;
+ rv << ',';
+ rv << pot_t_offset;
+ rv << ',';
+ rv << pot_min_slew;
+ rv << ',';
+ rv << pot_max_slew;
+ rv << ',';
+ rv << chirp_resolution;
+ rv << ',';
+ rv << analysis_fft_lengths;
+ rv << ',';
+ rv << bsmooth_boxcar_length;
+ rv << ',';
+ rv << bsmooth_chunk_size;
+ rv << ',';
+ rv << "LIST {";
+ {
+ std::vector<chirp_parameter_t>::const_iterator p=chirps.begin();
+ for (; p<chirps.end(); p++) {
+ rv << p->print();
+ if (p != chirps.end()-1) {
+ rv << ',';
+ } else {
+ rv << "}";
+ }
+ }
+ }
+ rv << ',';
+ rv << pulse_beams;
+ rv << ',';
+ rv << max_signals;
+ rv << ',';
+ rv << max_spikes;
+ rv << ',';
+ rv << max_autocorr;
+ rv << ',';
+ rv << max_gaussians;
+ rv << ',';
+ rv << max_pulses;
+ rv << ',';
+ rv << max_triplets;
+ rv << ',';
+ rv << keyuniq;
+ rv << ',';
+ rv << credit_rate;
+ return rv.str();
+}
+
+
+std::string analysis_config::print_xml(int full_subtables, int show_ids, int no_refs,const char *tag) const {
+ std::ostringstream rv("");
+
+ rv.precision(14);
+ rv << xml_indent() << '<' << tag << ">\n";
+ xml_indent(2);
+ if (show_ids) {
+ rv << xml_indent() << "<id>" << id << "</id>\n";
+ }
+ rv << xml_indent() << "<spike_thresh>" << spike_thresh << "</spike_thresh>\n";
+ rv << xml_indent() << "<spikes_per_spectrum>" << spikes_per_spectrum << "</spikes_per_spectrum>\n";
+ rv << xml_indent() << "<autocorr_thresh>" << autocorr_thresh << "</autocorr_thresh>\n";
+ rv << xml_indent() << "<autocorr_per_spectrum>" << autocorr_per_spectrum << "</autocorr_per_spectrum>\n";
+ rv << xml_indent() << "<autocorr_fftlen>" << autocorr_fftlen << "</autocorr_fftlen>\n";
+ rv << xml_indent() << "<gauss_null_chi_sq_thresh>" << gauss_null_chi_sq_thresh << "</gauss_null_chi_sq_thresh>\n";
+ rv << xml_indent() << "<gauss_chi_sq_thresh>" << gauss_chi_sq_thresh << "</gauss_chi_sq_thresh>\n";
+ rv << xml_indent() << "<gauss_power_thresh>" << gauss_power_thresh << "</gauss_power_thresh>\n";
+ rv << xml_indent() << "<gauss_peak_power_thresh>" << gauss_peak_power_thresh << "</gauss_peak_power_thresh>\n";
+ rv << xml_indent() << "<gauss_pot_length>" << gauss_pot_length << "</gauss_pot_length>\n";
+ rv << xml_indent() << "<pulse_thresh>" << pulse_thresh << "</pulse_thresh>\n";
+ rv << xml_indent() << "<pulse_display_thresh>" << pulse_display_thresh << "</pulse_display_thresh>\n";
+ rv << xml_indent() << "<pulse_max>" << pulse_max << "</pulse_max>\n";
+ rv << xml_indent() << "<pulse_min>" << pulse_min << "</pulse_min>\n";
+ rv << xml_indent() << "<pulse_fft_max>" << pulse_fft_max << "</pulse_fft_max>\n";
+ rv << xml_indent() << "<pulse_pot_length>" << pulse_pot_length << "</pulse_pot_length>\n";
+ rv << xml_indent() << "<triplet_thresh>" << triplet_thresh << "</triplet_thresh>\n";
+ rv << xml_indent() << "<triplet_max>" << triplet_max << "</triplet_max>\n";
+ rv << xml_indent() << "<triplet_min>" << triplet_min << "</triplet_min>\n";
+ rv << xml_indent() << "<triplet_pot_length>" << triplet_pot_length << "</triplet_pot_length>\n";
+ rv << xml_indent() << "<pot_overlap_factor>" << pot_overlap_factor << "</pot_overlap_factor>\n";
+ rv << xml_indent() << "<pot_t_offset>" << pot_t_offset << "</pot_t_offset>\n";
+ rv << xml_indent() << "<pot_min_slew>" << pot_min_slew << "</pot_min_slew>\n";
+ rv << xml_indent() << "<pot_max_slew>" << pot_max_slew << "</pot_max_slew>\n";
+ rv << xml_indent() << "<chirp_resolution>" << chirp_resolution << "</chirp_resolution>\n";
+ rv << xml_indent() << "<analysis_fft_lengths>" << analysis_fft_lengths << "</analysis_fft_lengths>\n";
+ rv << xml_indent() << "<bsmooth_boxcar_length>" << bsmooth_boxcar_length << "</bsmooth_boxcar_length>\n";
+ rv << xml_indent() << "<bsmooth_chunk_size>" << bsmooth_chunk_size << "</bsmooth_chunk_size>\n";
+ if (chirps.size()) {
+ rv << xml_indent() << "<chirps";
+ {
+ std::string enc_string=chirps.print_xml();
+ rv << ">\n" ;
+ rv << enc_string;
+ }
+ }
+ rv << xml_indent(-2);
+ rv << "</chirps>\n";
+ rv << xml_indent() << "<pulse_beams>" << pulse_beams << "</pulse_beams>\n";
+ rv << xml_indent() << "<max_signals>" << max_signals << "</max_signals>\n";
+ rv << xml_indent() << "<max_spikes>" << max_spikes << "</max_spikes>\n";
+ rv << xml_indent() << "<max_autocorr>" << max_autocorr << "</max_autocorr>\n";
+ rv << xml_indent() << "<max_gaussians>" << max_gaussians << "</max_gaussians>\n";
+ rv << xml_indent() << "<max_pulses>" << max_pulses << "</max_pulses>\n";
+ rv << xml_indent() << "<max_triplets>" << max_triplets << "</max_triplets>\n";
+ rv << xml_indent() << "<keyuniq>" << keyuniq << "</keyuniq>\n";
+ rv << xml_indent() << "<credit_rate>" << credit_rate << "</credit_rate>\n";
+ xml_indent(-2);
+ rv << xml_indent() << "</" << tag << ">\n";
+ return rv.str();
+}
+
+
+void analysis_config::parse_xml(const std::string &s,const char *tag) {
+ std::string field,sub;
+ if (extract_xml_record(s,tag,field)) {
+ std::string::size_type pos=0;
+ if (extract_xml_record(field,"id",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> id;
+ }
+ if (extract_xml_record(field,"spike_thresh",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> spike_thresh;
+ }
+ if (extract_xml_record(field,"spikes_per_spectrum",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> spikes_per_spectrum;
+ }
+ if (extract_xml_record(field,"autocorr_thresh",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> autocorr_thresh;
+ }
+ if (extract_xml_record(field,"autocorr_per_spectrum",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> autocorr_per_spectrum;
+ }
+ if (extract_xml_record(field,"autocorr_fftlen",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> autocorr_fftlen;
+ }
+ if (extract_xml_record(field,"gauss_null_chi_sq_thresh",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> gauss_null_chi_sq_thresh;
+ }
+ if (extract_xml_record(field,"gauss_chi_sq_thresh",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> gauss_chi_sq_thresh;
+ }
+ if (extract_xml_record(field,"gauss_power_thresh",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> gauss_power_thresh;
+ }
+ if (extract_xml_record(field,"gauss_peak_power_thresh",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> gauss_peak_power_thresh;
+ }
+ if (extract_xml_record(field,"gauss_pot_length",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> gauss_pot_length;
+ }
+ if (extract_xml_record(field,"pulse_thresh",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> pulse_thresh;
+ }
+ if (extract_xml_record(field,"pulse_display_thresh",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> pulse_display_thresh;
+ }
+ if (extract_xml_record(field,"pulse_max",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> pulse_max;
+ }
+ if (extract_xml_record(field,"pulse_min",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> pulse_min;
+ }
+ if (extract_xml_record(field,"pulse_fft_max",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> pulse_fft_max;
+ }
+ if (extract_xml_record(field,"pulse_pot_length",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> pulse_pot_length;
+ }
+ if (extract_xml_record(field,"triplet_thresh",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> triplet_thresh;
+ }
+ if (extract_xml_record(field,"triplet_max",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> triplet_max;
+ }
+ if (extract_xml_record(field,"triplet_min",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> triplet_min;
+ }
+ if (extract_xml_record(field,"triplet_pot_length",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> triplet_pot_length;
+ }
+ if (extract_xml_record(field,"pot_overlap_factor",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> pot_overlap_factor;
+ }
+ if (extract_xml_record(field,"pot_t_offset",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> pot_t_offset;
+ }
+ if (extract_xml_record(field,"pot_min_slew",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> pot_min_slew;
+ }
+ if (extract_xml_record(field,"pot_max_slew",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> pot_max_slew;
+ }
+ if (extract_xml_record(field,"chirp_resolution",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> chirp_resolution;
+ }
+ if (extract_xml_record(field,"analysis_fft_lengths",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> analysis_fft_lengths;
+ }
+ if (extract_xml_record(field,"bsmooth_boxcar_length",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> bsmooth_boxcar_length;
+ }
+ if (extract_xml_record(field,"bsmooth_chunk_size",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> bsmooth_chunk_size;
+ }
+ chirps.clear();
+ if (extract_xml_record(field,"chirps",sub)) {
+ pos=0;
+ while ((pos=sub.find("<chirp_parameter_t",pos)) != std::string::npos) {
+ chirps.push_back(chirp_parameter_t(std::string(sub.c_str()+pos)));
+ pos=sub.find("</chirp_parameter_t",pos);
+ pos=sub.find(">",pos);
+ }
+ }
+ if (extract_xml_record(field,"pulse_beams",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> pulse_beams;
+ }
+ if (extract_xml_record(field,"max_signals",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> max_signals;
+ }
+ if (extract_xml_record(field,"max_spikes",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> max_spikes;
+ }
+ if (extract_xml_record(field,"max_autocorr",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> max_autocorr;
+ }
+ if (extract_xml_record(field,"max_gaussians",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> max_gaussians;
+ }
+ if (extract_xml_record(field,"max_pulses",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> max_pulses;
+ }
+ if (extract_xml_record(field,"max_triplets",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> max_triplets;
+ }
+ if (extract_xml_record(field,"keyuniq",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> keyuniq;
+ }
+ if (extract_xml_record(field,"credit_rate",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> credit_rate;
+ }
+ }
+}
+
+void analysis_config::parse(const SQL_ROW &s) {
+ {
+ std::istringstream row(*(s[0]));
+ row >> id;
+ }
+ {
+ std::istringstream row(*(s[1]));
+ row >> spike_thresh;
+ }
+ {
+ std::istringstream row(*(s[2]));
+ row >> spikes_per_spectrum;
+ }
+ {
+ std::istringstream row(*(s[3]));
+ row >> autocorr_thresh;
+ }
+ {
+ std::istringstream row(*(s[4]));
+ row >> autocorr_per_spectrum;
+ }
+ {
+ std::istringstream row(*(s[5]));
+ row >> autocorr_fftlen;
+ }
+ {
+ std::istringstream row(*(s[6]));
+ row >> gauss_null_chi_sq_thresh;
+ }
+ {
+ std::istringstream row(*(s[7]));
+ row >> gauss_chi_sq_thresh;
+ }
+ {
+ std::istringstream row(*(s[8]));
+ row >> gauss_power_thresh;
+ }
+ {
+ std::istringstream row(*(s[9]));
+ row >> gauss_peak_power_thresh;
+ }
+ {
+ std::istringstream row(*(s[10]));
+ row >> gauss_pot_length;
+ }
+ {
+ std::istringstream row(*(s[11]));
+ row >> pulse_thresh;
+ }
+ {
+ std::istringstream row(*(s[12]));
+ row >> pulse_display_thresh;
+ }
+ {
+ std::istringstream row(*(s[13]));
+ row >> pulse_max;
+ }
+ {
+ std::istringstream row(*(s[14]));
+ row >> pulse_min;
+ }
+ {
+ std::istringstream row(*(s[15]));
+ row >> pulse_fft_max;
+ }
+ {
+ std::istringstream row(*(s[16]));
+ row >> pulse_pot_length;
+ }
+ {
+ std::istringstream row(*(s[17]));
+ row >> triplet_thresh;
+ }
+ {
+ std::istringstream row(*(s[18]));
+ row >> triplet_max;
+ }
+ {
+ std::istringstream row(*(s[19]));
+ row >> triplet_min;
+ }
+ {
+ std::istringstream row(*(s[20]));
+ row >> triplet_pot_length;
+ }
+ {
+ std::istringstream row(*(s[21]));
+ row >> pot_overlap_factor;
+ }
+ {
+ std::istringstream row(*(s[22]));
+ row >> pot_t_offset;
+ }
+ {
+ std::istringstream row(*(s[23]));
+ row >> pot_min_slew;
+ }
+ {
+ std::istringstream row(*(s[24]));
+ row >> pot_max_slew;
+ }
+ {
+ std::istringstream row(*(s[25]));
+ row >> chirp_resolution;
+ }
+ {
+ std::istringstream row(*(s[26]));
+ row >> analysis_fft_lengths;
+ }
+ {
+ std::istringstream row(*(s[27]));
+ row >> bsmooth_boxcar_length;
+ }
+ {
+ std::istringstream row(*(s[28]));
+ row >> bsmooth_chunk_size;
+ }
+ {
+ std::string::size_type p,q;
+ int i;
+ chirps.clear();
+ SQL_ROW tmp(s[29]);
+ for (i=0; i<tmp.argc(); i++) {
+ chirps.push_back(chirp_parameter_t(SQL_ROW(tmp[i])));
+ }
+ }
+ {
+ std::istringstream row(*(s[30]));
+ row >> pulse_beams;
+ }
+ {
+ std::istringstream row(*(s[31]));
+ row >> max_signals;
+ }
+ {
+ std::istringstream row(*(s[32]));
+ row >> max_spikes;
+ }
+ {
+ std::istringstream row(*(s[33]));
+ row >> max_autocorr;
+ }
+ {
+ std::istringstream row(*(s[34]));
+ row >> max_gaussians;
+ }
+ {
+ std::istringstream row(*(s[35]));
+ row >> max_pulses;
+ }
+ {
+ std::istringstream row(*(s[36]));
+ row >> max_triplets;
+ }
+ {
+ std::istringstream row(*(s[37]));
+ row >> keyuniq;
+ }
+ {
+ std::istringstream row(*(s[38]));
+ row >> credit_rate;
+ }
+}
+
+void analysis_config::parse(const std::string &s) {
+ SQL_ROW row(&s,39);
+ parse(row);
+}
+
+template <> const char *const db_table<science_config>::table_name="science_config";
+template <> const char *db_table<science_config>::_search_tag=table_name;
template <> const int db_table<science_config>::_nfields=29;
-template <> const char * const db_table<science_config>::column_names[29]={"id","active","qpix_scheme","qpix_nside","fpix_width","total_bandwidth","freq_uncertainty","fwhm_beamwidth","sky_disc_radius","observable_sky","epoch","bary_chirp_window","bary_freq_window","nonbary_freq_window","spike_obs_duration","spike_obs_interval","gauss_obs_duration","gauss_obs_interval","pulse_obs_duration","pulse_obs_interval","triplet_obs_duration","triplet_obs_interval","min_spike_id","min_autocorr_id", [...]
-
-science_config::science_config() :
- db_table<science_config>(*this,-1),
- id(0),
- active(0),
- qpix_nside(0),
- fpix_width(0),
- total_bandwidth(0),
- freq_uncertainty(0),
- fwhm_beamwidth(0),
- sky_disc_radius(0),
- observable_sky(0),
- epoch(0),
- bary_chirp_window(0),
- bary_freq_window(0),
- nonbary_freq_window(0),
- spike_obs_duration(0),
- spike_obs_interval(0),
- gauss_obs_duration(0),
- gauss_obs_interval(0),
- pulse_obs_duration(0),
- pulse_obs_interval(0),
- triplet_obs_duration(0),
- triplet_obs_interval(0),
- min_spike_id(0),
- min_autocorr_id(0),
- min_gaussian_id(0),
- min_pulse_id(0),
- min_triplet_id(0),
- min_app_version(0)
-{
- db_open();
- qpix_scheme[0]=0;
- info_xml[0]=0;
-}
-
-
-science_config::science_config(const science_config &a) :
- db_table<science_config>(*this,-1),
- id(a.id),
- active(a.active),
- qpix_nside(a.qpix_nside),
- fpix_width(a.fpix_width),
- total_bandwidth(a.total_bandwidth),
- freq_uncertainty(a.freq_uncertainty),
- fwhm_beamwidth(a.fwhm_beamwidth),
- sky_disc_radius(a.sky_disc_radius),
- observable_sky(a.observable_sky),
- epoch(a.epoch),
- bary_chirp_window(a.bary_chirp_window),
- bary_freq_window(a.bary_freq_window),
- nonbary_freq_window(a.nonbary_freq_window),
- spike_obs_duration(a.spike_obs_duration),
- spike_obs_interval(a.spike_obs_interval),
- gauss_obs_duration(a.gauss_obs_duration),
- gauss_obs_interval(a.gauss_obs_interval),
- pulse_obs_duration(a.pulse_obs_duration),
- pulse_obs_interval(a.pulse_obs_interval),
- triplet_obs_duration(a.triplet_obs_duration),
- triplet_obs_interval(a.triplet_obs_interval),
- min_spike_id(a.min_spike_id),
- min_autocorr_id(a.min_autocorr_id),
- min_gaussian_id(a.min_gaussian_id),
- min_pulse_id(a.min_pulse_id),
- min_triplet_id(a.min_triplet_id),
- min_app_version(a.min_app_version)
-{
- db_open();
- strcpy(qpix_scheme,a.qpix_scheme);
- strcpy(info_xml,a.info_xml);
-}
-
-
-science_config::science_config(const SQL_ROW &a) :
- db_table<science_config>(*this,-1)
-{
- db_open();
- parse(a);
-}
-
-
-science_config::science_config(const std::string &s,const char *tag) :
- db_table<science_config>(*this,-1)
-{
- db_open();
- if (xml_match_tag(s,tag)) {
- parse_xml(s,tag);
- } else {
- parse(s);
- }
+template <> const char *const db_table<science_config>::column_names[29]= {"id","active","qpix_scheme","qpix_nside","fpix_width","total_bandwidth","freq_uncertainty","fwhm_beamwidth","sky_disc_radius","observable_sky","epoch","bary_chirp_window","bary_freq_window","nonbary_freq_window","spike_obs_duration","spike_obs_interval","gauss_obs_duration","gauss_obs_interval","pulse_obs_duration","pulse_obs_interval","triplet_obs_duration","triplet_obs_interval","min_spike_id","min_autocorr_id", [...]
+
+science_config::science_config() :
+ db_table<science_config>(*this,-1),
+ id(0),
+ active(0),
+ qpix_nside(0),
+ fpix_width(0),
+ total_bandwidth(0),
+ freq_uncertainty(0),
+ fwhm_beamwidth(0),
+ sky_disc_radius(0),
+ observable_sky(0),
+ epoch(0),
+ bary_chirp_window(0),
+ bary_freq_window(0),
+ nonbary_freq_window(0),
+ spike_obs_duration(0),
+ spike_obs_interval(0),
+ gauss_obs_duration(0),
+ gauss_obs_interval(0),
+ pulse_obs_duration(0),
+ pulse_obs_interval(0),
+ triplet_obs_duration(0),
+ triplet_obs_interval(0),
+ min_spike_id(0),
+ min_autocorr_id(0),
+ min_gaussian_id(0),
+ min_pulse_id(0),
+ min_triplet_id(0),
+ min_app_version(0) {
+ db_open();
+ qpix_scheme[0]=0;
+ info_xml[0]=0;
+}
+
+
+science_config::science_config(const science_config &a) :
+ db_table<science_config>(*this,-1),
+ id(a.id),
+ active(a.active),
+ qpix_nside(a.qpix_nside),
+ fpix_width(a.fpix_width),
+ total_bandwidth(a.total_bandwidth),
+ freq_uncertainty(a.freq_uncertainty),
+ fwhm_beamwidth(a.fwhm_beamwidth),
+ sky_disc_radius(a.sky_disc_radius),
+ observable_sky(a.observable_sky),
+ epoch(a.epoch),
+ bary_chirp_window(a.bary_chirp_window),
+ bary_freq_window(a.bary_freq_window),
+ nonbary_freq_window(a.nonbary_freq_window),
+ spike_obs_duration(a.spike_obs_duration),
+ spike_obs_interval(a.spike_obs_interval),
+ gauss_obs_duration(a.gauss_obs_duration),
+ gauss_obs_interval(a.gauss_obs_interval),
+ pulse_obs_duration(a.pulse_obs_duration),
+ pulse_obs_interval(a.pulse_obs_interval),
+ triplet_obs_duration(a.triplet_obs_duration),
+ triplet_obs_interval(a.triplet_obs_interval),
+ min_spike_id(a.min_spike_id),
+ min_autocorr_id(a.min_autocorr_id),
+ min_gaussian_id(a.min_gaussian_id),
+ min_pulse_id(a.min_pulse_id),
+ min_triplet_id(a.min_triplet_id),
+ min_app_version(a.min_app_version) {
+ db_open();
+ strcpy(qpix_scheme,a.qpix_scheme);
+ strcpy(info_xml,a.info_xml);
+}
+
+
+science_config::science_config(const SQL_ROW &a) :
+ db_table<science_config>(*this,-1) {
+ db_open();
+ parse(a);
+}
+
+
+science_config::science_config(const std::string &s,const char *tag) :
+ db_table<science_config>(*this,-1) {
+ db_open();
+ if (xml_match_tag(s,tag)) {
+ parse_xml(s,tag);
+ } else {
+ parse(s);
+ }
}
science_config &science_config::operator =(const science_config &a) {
- if (&a != this) {
- id=a.id;
- active=a.active;
- qpix_nside=a.qpix_nside;
- fpix_width=a.fpix_width;
- total_bandwidth=a.total_bandwidth;
- freq_uncertainty=a.freq_uncertainty;
- fwhm_beamwidth=a.fwhm_beamwidth;
- sky_disc_radius=a.sky_disc_radius;
- observable_sky=a.observable_sky;
- epoch=a.epoch;
- bary_chirp_window=a.bary_chirp_window;
- bary_freq_window=a.bary_freq_window;
- nonbary_freq_window=a.nonbary_freq_window;
- spike_obs_duration=a.spike_obs_duration;
- spike_obs_interval=a.spike_obs_interval;
- gauss_obs_duration=a.gauss_obs_duration;
- gauss_obs_interval=a.gauss_obs_interval;
- pulse_obs_duration=a.pulse_obs_duration;
- pulse_obs_interval=a.pulse_obs_interval;
- triplet_obs_duration=a.triplet_obs_duration;
- triplet_obs_interval=a.triplet_obs_interval;
- min_spike_id=a.min_spike_id;
- min_autocorr_id=a.min_autocorr_id;
- min_gaussian_id=a.min_gaussian_id;
- min_pulse_id=a.min_pulse_id;
- min_triplet_id=a.min_triplet_id;
- min_app_version=a.min_app_version;
- strcpy(qpix_scheme,a.qpix_scheme);
- strcpy(info_xml,a.info_xml);
- }
- return (*this);
-}
-
-
-std::string science_config::update_format() const
-{ std::ostringstream rv("");
-
- for (int i=2;i<29;i++) rv << "?,";
- rv << "?";
- return rv.str();
-}
-
-
-std::string science_config::insert_format() const
-{ return std::string("?,")+update_format();
-}
-
-std::string science_config::select_format() const
-{
-std::string rv("");
-for (int i=0; i<28;i++) rv+="?,";
-rv+="?";
-return rv;
-}
-
-std::string science_config::print(int full_subtables, int show_ids, int no_refs) const
-{ std::ostringstream rv("");
-
- rv.precision(14);
- if (show_ids) rv << id;
- rv << ',';
- rv << active;
- rv << ',';
- rv << "'" << qpix_scheme << "'";
- rv << ',';
- rv << qpix_nside;
- rv << ',';
- rv << fpix_width;
- rv << ',';
- rv << total_bandwidth;
- rv << ',';
- rv << freq_uncertainty;
- rv << ',';
- rv << fwhm_beamwidth;
- rv << ',';
- rv << sky_disc_radius;
- rv << ',';
- rv << observable_sky;
- rv << ',';
- rv << epoch;
- rv << ',';
- rv << bary_chirp_window;
- rv << ',';
- rv << bary_freq_window;
- rv << ',';
- rv << nonbary_freq_window;
- rv << ',';
- rv << spike_obs_duration;
- rv << ',';
- rv << spike_obs_interval;
- rv << ',';
- rv << gauss_obs_duration;
- rv << ',';
- rv << gauss_obs_interval;
- rv << ',';
- rv << pulse_obs_duration;
- rv << ',';
- rv << pulse_obs_interval;
- rv << ',';
- rv << triplet_obs_duration;
- rv << ',';
- rv << triplet_obs_interval;
- rv << ',';
- rv << min_spike_id;
- rv << ',';
- rv << min_autocorr_id;
- rv << ',';
- rv << min_gaussian_id;
- rv << ',';
- rv << min_pulse_id;
- rv << ',';
- rv << min_triplet_id;
- rv << ',';
- rv << min_app_version;
- rv << ',';
- rv << "'" << info_xml << "'";
- return rv.str();
-}
-
-
-std::string science_config::print_xml(int full_subtables, int show_ids, int no_refs,const char *tag) const
-{
- std::ostringstream rv("");
-
- rv.precision(14);
- rv << xml_indent() << '<' << tag << ">\n";
- xml_indent(2);
- if (show_ids) rv << xml_indent() << "<id>" << id << "</id>\n";
- rv << xml_indent() << "<active>" << active << "</active>\n";
- {
- std::string enc_field=xml_encode_string(qpix_scheme,std::min(strlen(qpix_scheme),sizeof(qpix_scheme)));
- rv << xml_indent() << "<qpix_scheme>";
- rv << enc_field << "</qpix_scheme>\n";
- }
- rv << xml_indent() << "<qpix_nside>" << qpix_nside << "</qpix_nside>\n";
- rv << xml_indent() << "<fpix_width>" << fpix_width << "</fpix_width>\n";
- rv << xml_indent() << "<total_bandwidth>" << total_bandwidth << "</total_bandwidth>\n";
- rv << xml_indent() << "<freq_uncertainty>" << freq_uncertainty << "</freq_uncertainty>\n";
- rv << xml_indent() << "<fwhm_beamwidth>" << fwhm_beamwidth << "</fwhm_beamwidth>\n";
- rv << xml_indent() << "<sky_disc_radius>" << sky_disc_radius << "</sky_disc_radius>\n";
- rv << xml_indent() << "<observable_sky>" << observable_sky << "</observable_sky>\n";
- rv << xml_indent() << "<epoch>" << epoch << "</epoch>\n";
- rv << xml_indent() << "<bary_chirp_window>" << bary_chirp_window << "</bary_chirp_window>\n";
- rv << xml_indent() << "<bary_freq_window>" << bary_freq_window << "</bary_freq_window>\n";
- rv << xml_indent() << "<nonbary_freq_window>" << nonbary_freq_window << "</nonbary_freq_window>\n";
- rv << xml_indent() << "<spike_obs_duration>" << spike_obs_duration << "</spike_obs_duration>\n";
- rv << xml_indent() << "<spike_obs_interval>" << spike_obs_interval << "</spike_obs_interval>\n";
- rv << xml_indent() << "<gauss_obs_duration>" << gauss_obs_duration << "</gauss_obs_duration>\n";
- rv << xml_indent() << "<gauss_obs_interval>" << gauss_obs_interval << "</gauss_obs_interval>\n";
- rv << xml_indent() << "<pulse_obs_duration>" << pulse_obs_duration << "</pulse_obs_duration>\n";
- rv << xml_indent() << "<pulse_obs_interval>" << pulse_obs_interval << "</pulse_obs_interval>\n";
- rv << xml_indent() << "<triplet_obs_duration>" << triplet_obs_duration << "</triplet_obs_duration>\n";
- rv << xml_indent() << "<triplet_obs_interval>" << triplet_obs_interval << "</triplet_obs_interval>\n";
- rv << xml_indent() << "<min_spike_id>" << min_spike_id << "</min_spike_id>\n";
- rv << xml_indent() << "<min_autocorr_id>" << min_autocorr_id << "</min_autocorr_id>\n";
- rv << xml_indent() << "<min_gaussian_id>" << min_gaussian_id << "</min_gaussian_id>\n";
- rv << xml_indent() << "<min_pulse_id>" << min_pulse_id << "</min_pulse_id>\n";
- rv << xml_indent() << "<min_triplet_id>" << min_triplet_id << "</min_triplet_id>\n";
- rv << xml_indent() << "<min_app_version>" << min_app_version << "</min_app_version>\n";
- {
- std::string enc_field=xml_encode_string(info_xml,std::min(strlen(info_xml),sizeof(info_xml)));
- rv << xml_indent() << "<info_xml>";
- rv << enc_field << "</info_xml>\n";
- }
- xml_indent(-2);
- rv << xml_indent() << "</" << tag << ">\n";
- return rv.str();
-}
-
-
- void science_config::parse_xml(const std::string &s,const char *tag) {
- std::string field,sub;
- if (extract_xml_record(s,tag,field)) {
- std::string::size_type pos=0;
- if (extract_xml_record(field,"id",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> id;
- }
- if (extract_xml_record(field,"active",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> active;
- }
- if (extract_xml_record(field,"qpix_scheme",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::string::size_type epos=sub.find("<",pos);
- if (epos==std::string::npos) epos=sub.find('\n',pos);
- if (epos==std::string::npos) epos=pos+strlen(sub.c_str()+pos);
- std::vector<unsigned char> in(xml_decode_string<unsigned char>((const char *)sub.c_str()+pos,epos-pos));
- strncpy(qpix_scheme,(const char *)&(in.front()),std::min(in.size(),(size_t)16));
- qpix_scheme[std::min(in.size(),(size_t)15)]=0;
- }
- if (extract_xml_record(field,"qpix_nside",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> qpix_nside;
- }
- if (extract_xml_record(field,"fpix_width",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> fpix_width;
- }
- if (extract_xml_record(field,"total_bandwidth",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> total_bandwidth;
- }
- if (extract_xml_record(field,"freq_uncertainty",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> freq_uncertainty;
- }
- if (extract_xml_record(field,"fwhm_beamwidth",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> fwhm_beamwidth;
- }
- if (extract_xml_record(field,"sky_disc_radius",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> sky_disc_radius;
- }
- if (extract_xml_record(field,"observable_sky",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> observable_sky;
- }
- if (extract_xml_record(field,"epoch",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> epoch;
- }
- if (extract_xml_record(field,"bary_chirp_window",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> bary_chirp_window;
- }
- if (extract_xml_record(field,"bary_freq_window",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> bary_freq_window;
- }
- if (extract_xml_record(field,"nonbary_freq_window",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> nonbary_freq_window;
- }
- if (extract_xml_record(field,"spike_obs_duration",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> spike_obs_duration;
- }
- if (extract_xml_record(field,"spike_obs_interval",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> spike_obs_interval;
- }
- if (extract_xml_record(field,"gauss_obs_duration",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> gauss_obs_duration;
- }
- if (extract_xml_record(field,"gauss_obs_interval",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> gauss_obs_interval;
- }
- if (extract_xml_record(field,"pulse_obs_duration",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> pulse_obs_duration;
- }
- if (extract_xml_record(field,"pulse_obs_interval",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> pulse_obs_interval;
- }
- if (extract_xml_record(field,"triplet_obs_duration",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> triplet_obs_duration;
- }
- if (extract_xml_record(field,"triplet_obs_interval",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> triplet_obs_interval;
- }
- if (extract_xml_record(field,"min_spike_id",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> min_spike_id;
- }
- if (extract_xml_record(field,"min_autocorr_id",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> min_autocorr_id;
- }
- if (extract_xml_record(field,"min_gaussian_id",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> min_gaussian_id;
- }
- if (extract_xml_record(field,"min_pulse_id",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> min_pulse_id;
- }
- if (extract_xml_record(field,"min_triplet_id",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> min_triplet_id;
- }
- if (extract_xml_record(field,"min_app_version",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> min_app_version;
- }
- if (extract_xml_record(field,"info_xml",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::string::size_type epos=sub.find("<",pos);
- if (epos==std::string::npos) epos=sub.find('\n',pos);
- if (epos==std::string::npos) epos=pos+strlen(sub.c_str()+pos);
- std::vector<unsigned char> in(xml_decode_string<unsigned char>((const char *)sub.c_str()+pos,epos-pos));
- strncpy(info_xml,(const char *)&(in.front()),std::min(in.size(),(size_t)255));
- info_xml[std::min(in.size(),(size_t)254)]=0;
- }
- }
- }
-
- void science_config::parse(const SQL_ROW &s) {
- {
- std::istringstream row(*(s[0]));
- row >> id;
- }
- {
- std::istringstream row(*(s[1]));
- row >> active;
- }
- {
- strncpy(qpix_scheme,s[2]->c_str(),16);
- qpix_scheme[15]=0;
- }
- {
- std::istringstream row(*(s[3]));
- row >> qpix_nside;
- }
- {
- std::istringstream row(*(s[4]));
- row >> fpix_width;
- }
- {
- std::istringstream row(*(s[5]));
- row >> total_bandwidth;
- }
- {
- std::istringstream row(*(s[6]));
- row >> freq_uncertainty;
- }
- {
- std::istringstream row(*(s[7]));
- row >> fwhm_beamwidth;
- }
- {
- std::istringstream row(*(s[8]));
- row >> sky_disc_radius;
- }
- {
- std::istringstream row(*(s[9]));
- row >> observable_sky;
- }
- {
- std::istringstream row(*(s[10]));
- row >> epoch;
- }
- {
- std::istringstream row(*(s[11]));
- row >> bary_chirp_window;
- }
- {
- std::istringstream row(*(s[12]));
- row >> bary_freq_window;
- }
- {
- std::istringstream row(*(s[13]));
- row >> nonbary_freq_window;
- }
- {
- std::istringstream row(*(s[14]));
- row >> spike_obs_duration;
- }
- {
- std::istringstream row(*(s[15]));
- row >> spike_obs_interval;
- }
- {
- std::istringstream row(*(s[16]));
- row >> gauss_obs_duration;
- }
- {
- std::istringstream row(*(s[17]));
- row >> gauss_obs_interval;
- }
- {
- std::istringstream row(*(s[18]));
- row >> pulse_obs_duration;
- }
- {
- std::istringstream row(*(s[19]));
- row >> pulse_obs_interval;
- }
- {
- std::istringstream row(*(s[20]));
- row >> triplet_obs_duration;
- }
- {
- std::istringstream row(*(s[21]));
- row >> triplet_obs_interval;
- }
- {
- std::istringstream row(*(s[22]));
- row >> min_spike_id;
- }
- {
- std::istringstream row(*(s[23]));
- row >> min_autocorr_id;
- }
- {
- std::istringstream row(*(s[24]));
- row >> min_gaussian_id;
- }
- {
- std::istringstream row(*(s[25]));
- row >> min_pulse_id;
- }
- {
- std::istringstream row(*(s[26]));
- row >> min_triplet_id;
- }
- {
- std::istringstream row(*(s[27]));
- row >> min_app_version;
- }
- {
- strncpy(info_xml,s[28]->c_str(),255);
- info_xml[254]=0;
- }
- }
-
- void science_config::parse(const std::string &s) {
- SQL_ROW row(&s,29);
- parse(row);
- }
-
-template <> const char * const db_type<candidate_t>::type_name="candidate_t";
-template <> const char * db_type<candidate_t>::_search_tag=type_name;
+ if (&a != this) {
+ id=a.id;
+ active=a.active;
+ qpix_nside=a.qpix_nside;
+ fpix_width=a.fpix_width;
+ total_bandwidth=a.total_bandwidth;
+ freq_uncertainty=a.freq_uncertainty;
+ fwhm_beamwidth=a.fwhm_beamwidth;
+ sky_disc_radius=a.sky_disc_radius;
+ observable_sky=a.observable_sky;
+ epoch=a.epoch;
+ bary_chirp_window=a.bary_chirp_window;
+ bary_freq_window=a.bary_freq_window;
+ nonbary_freq_window=a.nonbary_freq_window;
+ spike_obs_duration=a.spike_obs_duration;
+ spike_obs_interval=a.spike_obs_interval;
+ gauss_obs_duration=a.gauss_obs_duration;
+ gauss_obs_interval=a.gauss_obs_interval;
+ pulse_obs_duration=a.pulse_obs_duration;
+ pulse_obs_interval=a.pulse_obs_interval;
+ triplet_obs_duration=a.triplet_obs_duration;
+ triplet_obs_interval=a.triplet_obs_interval;
+ min_spike_id=a.min_spike_id;
+ min_autocorr_id=a.min_autocorr_id;
+ min_gaussian_id=a.min_gaussian_id;
+ min_pulse_id=a.min_pulse_id;
+ min_triplet_id=a.min_triplet_id;
+ min_app_version=a.min_app_version;
+ strcpy(qpix_scheme,a.qpix_scheme);
+ strcpy(info_xml,a.info_xml);
+ }
+ return (*this);
+}
+
+
+std::string science_config::update_format() const {
+ std::ostringstream rv("");
+
+ for (int i=2; i<29; i++) {
+ rv << "?,";
+ }
+ rv << "?";
+ return rv.str();
+}
+
+
+std::string science_config::insert_format() const {
+ return std::string("?,")+update_format();
+}
+
+std::string science_config::select_format() const {
+ std::string rv("");
+ for (int i=0; i<28; i++) {
+ rv+="?,";
+ }
+ rv+="?";
+ return rv;
+}
+
+std::string science_config::print(int full_subtables, int show_ids, int no_refs) const {
+ std::ostringstream rv("");
+
+ rv.precision(14);
+ if (show_ids) {
+ rv << id;
+ }
+ rv << ',';
+ rv << active;
+ rv << ',';
+ rv << "'" << qpix_scheme << "'";
+ rv << ',';
+ rv << qpix_nside;
+ rv << ',';
+ rv << fpix_width;
+ rv << ',';
+ rv << total_bandwidth;
+ rv << ',';
+ rv << freq_uncertainty;
+ rv << ',';
+ rv << fwhm_beamwidth;
+ rv << ',';
+ rv << sky_disc_radius;
+ rv << ',';
+ rv << observable_sky;
+ rv << ',';
+ rv << epoch;
+ rv << ',';
+ rv << bary_chirp_window;
+ rv << ',';
+ rv << bary_freq_window;
+ rv << ',';
+ rv << nonbary_freq_window;
+ rv << ',';
+ rv << spike_obs_duration;
+ rv << ',';
+ rv << spike_obs_interval;
+ rv << ',';
+ rv << gauss_obs_duration;
+ rv << ',';
+ rv << gauss_obs_interval;
+ rv << ',';
+ rv << pulse_obs_duration;
+ rv << ',';
+ rv << pulse_obs_interval;
+ rv << ',';
+ rv << triplet_obs_duration;
+ rv << ',';
+ rv << triplet_obs_interval;
+ rv << ',';
+ rv << min_spike_id;
+ rv << ',';
+ rv << min_autocorr_id;
+ rv << ',';
+ rv << min_gaussian_id;
+ rv << ',';
+ rv << min_pulse_id;
+ rv << ',';
+ rv << min_triplet_id;
+ rv << ',';
+ rv << min_app_version;
+ rv << ',';
+ rv << "'" << info_xml << "'";
+ return rv.str();
+}
+
+
+std::string science_config::print_xml(int full_subtables, int show_ids, int no_refs,const char *tag) const {
+ std::ostringstream rv("");
+
+ rv.precision(14);
+ rv << xml_indent() << '<' << tag << ">\n";
+ xml_indent(2);
+ if (show_ids) {
+ rv << xml_indent() << "<id>" << id << "</id>\n";
+ }
+ rv << xml_indent() << "<active>" << active << "</active>\n";
+ {
+ std::string enc_field=xml_encode_string(qpix_scheme,std::min(strlen(qpix_scheme),sizeof(qpix_scheme)));
+ rv << xml_indent() << "<qpix_scheme>";
+ rv << enc_field << "</qpix_scheme>\n";
+ }
+ rv << xml_indent() << "<qpix_nside>" << qpix_nside << "</qpix_nside>\n";
+ rv << xml_indent() << "<fpix_width>" << fpix_width << "</fpix_width>\n";
+ rv << xml_indent() << "<total_bandwidth>" << total_bandwidth << "</total_bandwidth>\n";
+ rv << xml_indent() << "<freq_uncertainty>" << freq_uncertainty << "</freq_uncertainty>\n";
+ rv << xml_indent() << "<fwhm_beamwidth>" << fwhm_beamwidth << "</fwhm_beamwidth>\n";
+ rv << xml_indent() << "<sky_disc_radius>" << sky_disc_radius << "</sky_disc_radius>\n";
+ rv << xml_indent() << "<observable_sky>" << observable_sky << "</observable_sky>\n";
+ rv << xml_indent() << "<epoch>" << epoch << "</epoch>\n";
+ rv << xml_indent() << "<bary_chirp_window>" << bary_chirp_window << "</bary_chirp_window>\n";
+ rv << xml_indent() << "<bary_freq_window>" << bary_freq_window << "</bary_freq_window>\n";
+ rv << xml_indent() << "<nonbary_freq_window>" << nonbary_freq_window << "</nonbary_freq_window>\n";
+ rv << xml_indent() << "<spike_obs_duration>" << spike_obs_duration << "</spike_obs_duration>\n";
+ rv << xml_indent() << "<spike_obs_interval>" << spike_obs_interval << "</spike_obs_interval>\n";
+ rv << xml_indent() << "<gauss_obs_duration>" << gauss_obs_duration << "</gauss_obs_duration>\n";
+ rv << xml_indent() << "<gauss_obs_interval>" << gauss_obs_interval << "</gauss_obs_interval>\n";
+ rv << xml_indent() << "<pulse_obs_duration>" << pulse_obs_duration << "</pulse_obs_duration>\n";
+ rv << xml_indent() << "<pulse_obs_interval>" << pulse_obs_interval << "</pulse_obs_interval>\n";
+ rv << xml_indent() << "<triplet_obs_duration>" << triplet_obs_duration << "</triplet_obs_duration>\n";
+ rv << xml_indent() << "<triplet_obs_interval>" << triplet_obs_interval << "</triplet_obs_interval>\n";
+ rv << xml_indent() << "<min_spike_id>" << min_spike_id << "</min_spike_id>\n";
+ rv << xml_indent() << "<min_autocorr_id>" << min_autocorr_id << "</min_autocorr_id>\n";
+ rv << xml_indent() << "<min_gaussian_id>" << min_gaussian_id << "</min_gaussian_id>\n";
+ rv << xml_indent() << "<min_pulse_id>" << min_pulse_id << "</min_pulse_id>\n";
+ rv << xml_indent() << "<min_triplet_id>" << min_triplet_id << "</min_triplet_id>\n";
+ rv << xml_indent() << "<min_app_version>" << min_app_version << "</min_app_version>\n";
+ {
+ std::string enc_field=xml_encode_string(info_xml,std::min(strlen(info_xml),sizeof(info_xml)));
+ rv << xml_indent() << "<info_xml>";
+ rv << enc_field << "</info_xml>\n";
+ }
+ xml_indent(-2);
+ rv << xml_indent() << "</" << tag << ">\n";
+ return rv.str();
+}
+
+
+void science_config::parse_xml(const std::string &s,const char *tag) {
+ std::string field,sub;
+ if (extract_xml_record(s,tag,field)) {
+ std::string::size_type pos=0;
+ if (extract_xml_record(field,"id",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> id;
+ }
+ if (extract_xml_record(field,"active",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> active;
+ }
+ if (extract_xml_record(field,"qpix_scheme",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::string::size_type epos=sub.find("<",pos);
+ if (epos==std::string::npos) {
+ epos=sub.find('\n',pos);
+ }
+ if (epos==std::string::npos) {
+ epos=pos+strlen(sub.c_str()+pos);
+ }
+ std::vector<unsigned char> in(xml_decode_string<unsigned char>((const char *)sub.c_str()+pos,epos-pos));
+ strncpy(qpix_scheme,(const char *)&(in.front()),std::min(in.size(),(size_t)16));
+ qpix_scheme[std::min(in.size(),(size_t)15)]=0;
+ }
+ if (extract_xml_record(field,"qpix_nside",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> qpix_nside;
+ }
+ if (extract_xml_record(field,"fpix_width",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> fpix_width;
+ }
+ if (extract_xml_record(field,"total_bandwidth",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> total_bandwidth;
+ }
+ if (extract_xml_record(field,"freq_uncertainty",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> freq_uncertainty;
+ }
+ if (extract_xml_record(field,"fwhm_beamwidth",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> fwhm_beamwidth;
+ }
+ if (extract_xml_record(field,"sky_disc_radius",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> sky_disc_radius;
+ }
+ if (extract_xml_record(field,"observable_sky",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> observable_sky;
+ }
+ if (extract_xml_record(field,"epoch",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> epoch;
+ }
+ if (extract_xml_record(field,"bary_chirp_window",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> bary_chirp_window;
+ }
+ if (extract_xml_record(field,"bary_freq_window",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> bary_freq_window;
+ }
+ if (extract_xml_record(field,"nonbary_freq_window",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> nonbary_freq_window;
+ }
+ if (extract_xml_record(field,"spike_obs_duration",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> spike_obs_duration;
+ }
+ if (extract_xml_record(field,"spike_obs_interval",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> spike_obs_interval;
+ }
+ if (extract_xml_record(field,"gauss_obs_duration",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> gauss_obs_duration;
+ }
+ if (extract_xml_record(field,"gauss_obs_interval",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> gauss_obs_interval;
+ }
+ if (extract_xml_record(field,"pulse_obs_duration",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> pulse_obs_duration;
+ }
+ if (extract_xml_record(field,"pulse_obs_interval",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> pulse_obs_interval;
+ }
+ if (extract_xml_record(field,"triplet_obs_duration",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> triplet_obs_duration;
+ }
+ if (extract_xml_record(field,"triplet_obs_interval",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> triplet_obs_interval;
+ }
+ if (extract_xml_record(field,"min_spike_id",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> min_spike_id;
+ }
+ if (extract_xml_record(field,"min_autocorr_id",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> min_autocorr_id;
+ }
+ if (extract_xml_record(field,"min_gaussian_id",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> min_gaussian_id;
+ }
+ if (extract_xml_record(field,"min_pulse_id",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> min_pulse_id;
+ }
+ if (extract_xml_record(field,"min_triplet_id",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> min_triplet_id;
+ }
+ if (extract_xml_record(field,"min_app_version",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> min_app_version;
+ }
+ if (extract_xml_record(field,"info_xml",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::string::size_type epos=sub.find("<",pos);
+ if (epos==std::string::npos) {
+ epos=sub.find('\n',pos);
+ }
+ if (epos==std::string::npos) {
+ epos=pos+strlen(sub.c_str()+pos);
+ }
+ std::vector<unsigned char> in(xml_decode_string<unsigned char>((const char *)sub.c_str()+pos,epos-pos));
+ strncpy(info_xml,(const char *)&(in.front()),std::min(in.size(),(size_t)255));
+ info_xml[std::min(in.size(),(size_t)254)]=0;
+ }
+ }
+}
+
+void science_config::parse(const SQL_ROW &s) {
+ {
+ std::istringstream row(*(s[0]));
+ row >> id;
+ }
+ {
+ std::istringstream row(*(s[1]));
+ row >> active;
+ }
+ {
+ strncpy(qpix_scheme,s[2]->c_str(),16);
+ qpix_scheme[15]=0;
+ }
+ {
+ std::istringstream row(*(s[3]));
+ row >> qpix_nside;
+ }
+ {
+ std::istringstream row(*(s[4]));
+ row >> fpix_width;
+ }
+ {
+ std::istringstream row(*(s[5]));
+ row >> total_bandwidth;
+ }
+ {
+ std::istringstream row(*(s[6]));
+ row >> freq_uncertainty;
+ }
+ {
+ std::istringstream row(*(s[7]));
+ row >> fwhm_beamwidth;
+ }
+ {
+ std::istringstream row(*(s[8]));
+ row >> sky_disc_radius;
+ }
+ {
+ std::istringstream row(*(s[9]));
+ row >> observable_sky;
+ }
+ {
+ std::istringstream row(*(s[10]));
+ row >> epoch;
+ }
+ {
+ std::istringstream row(*(s[11]));
+ row >> bary_chirp_window;
+ }
+ {
+ std::istringstream row(*(s[12]));
+ row >> bary_freq_window;
+ }
+ {
+ std::istringstream row(*(s[13]));
+ row >> nonbary_freq_window;
+ }
+ {
+ std::istringstream row(*(s[14]));
+ row >> spike_obs_duration;
+ }
+ {
+ std::istringstream row(*(s[15]));
+ row >> spike_obs_interval;
+ }
+ {
+ std::istringstream row(*(s[16]));
+ row >> gauss_obs_duration;
+ }
+ {
+ std::istringstream row(*(s[17]));
+ row >> gauss_obs_interval;
+ }
+ {
+ std::istringstream row(*(s[18]));
+ row >> pulse_obs_duration;
+ }
+ {
+ std::istringstream row(*(s[19]));
+ row >> pulse_obs_interval;
+ }
+ {
+ std::istringstream row(*(s[20]));
+ row >> triplet_obs_duration;
+ }
+ {
+ std::istringstream row(*(s[21]));
+ row >> triplet_obs_interval;
+ }
+ {
+ std::istringstream row(*(s[22]));
+ row >> min_spike_id;
+ }
+ {
+ std::istringstream row(*(s[23]));
+ row >> min_autocorr_id;
+ }
+ {
+ std::istringstream row(*(s[24]));
+ row >> min_gaussian_id;
+ }
+ {
+ std::istringstream row(*(s[25]));
+ row >> min_pulse_id;
+ }
+ {
+ std::istringstream row(*(s[26]));
+ row >> min_triplet_id;
+ }
+ {
+ std::istringstream row(*(s[27]));
+ row >> min_app_version;
+ }
+ {
+ strncpy(info_xml,s[28]->c_str(),255);
+ info_xml[254]=0;
+ }
+}
+
+void science_config::parse(const std::string &s) {
+ SQL_ROW row(&s,29);
+ parse(row);
+}
+
+template <> const char *const db_type<candidate_t>::type_name="candidate_t";
+template <> const char *db_type<candidate_t>::_search_tag=type_name;
template <> const int db_type<candidate_t>::_nfields=5;
-template <> const char * const db_type<candidate_t>::column_names[5]={"type","id","num_obs","score","is_rfi"};
+template <> const char *const db_type<candidate_t>::column_names[5]= {"type","id","num_obs","score","is_rfi"};
-candidate_t::candidate_t() :
- db_type<candidate_t>(*this),
- type(0),
- id(0),
- num_obs(0),
- score(0),
- is_rfi(0)
-{
- db_open();
+candidate_t::candidate_t() :
+ db_type<candidate_t>(*this),
+ type(0),
+ id(0),
+ num_obs(0),
+ score(0),
+ is_rfi(0) {
+ db_open();
}
-candidate_t::candidate_t(const candidate_t &a) :
- db_type<candidate_t>(*this),
- type(a.type),
- id(a.id),
- num_obs(a.num_obs),
- score(a.score),
- is_rfi(a.is_rfi)
-{
- db_open();
+candidate_t::candidate_t(const candidate_t &a) :
+ db_type<candidate_t>(*this),
+ type(a.type),
+ id(a.id),
+ num_obs(a.num_obs),
+ score(a.score),
+ is_rfi(a.is_rfi) {
+ db_open();
}
-candidate_t::candidate_t(const SQL_ROW &a) :
- db_type<candidate_t>(*this)
-{
- db_open();
- parse(a);
+candidate_t::candidate_t(const SQL_ROW &a) :
+ db_type<candidate_t>(*this) {
+ db_open();
+ parse(a);
}
-candidate_t::candidate_t(const std::string &s,const char *tag) :
- db_type<candidate_t>(*this)
-{
- db_open();
- if (xml_match_tag(s,tag)) {
- parse_xml(s,tag);
- } else {
- parse(s);
- }
+candidate_t::candidate_t(const std::string &s,const char *tag) :
+ db_type<candidate_t>(*this) {
+ db_open();
+ if (xml_match_tag(s,tag)) {
+ parse_xml(s,tag);
+ } else {
+ parse(s);
+ }
}
candidate_t &candidate_t::operator =(const candidate_t &a) {
- if (&a != this) {
- type=a.type;
- id=a.id;
- num_obs=a.num_obs;
- score=a.score;
- is_rfi=a.is_rfi;
- }
- return (*this);
-}
-
-
-std::string candidate_t::update_format() const
-{ std::ostringstream rv("");
-
- rv << "ROW(";
- for (int i=1;i<5;i++) rv << "?,";
- rv << "?";
-rv << ")";
-
- return rv.str();
-}
-
-
-std::string candidate_t::insert_format() const
-{ return update_format();
-}
-
-std::string candidate_t::select_format() const
-{
-std::string rv("");
-for (int i=0; i<4;i++) rv+="?,";
-rv+="?";
-return rv;
-}
-
-std::string candidate_t::print(int full_subtables, int show_ids, int no_refs) const
-{ std::ostringstream rv("");
-
- rv.precision(14);
- rv << "ROW(";
- rv << type;
- rv << ',';
- rv << id;
- rv << ',';
- rv << num_obs;
- rv << ',';
- rv << score;
- rv << ',';
- rv << is_rfi;
- rv << ")";
- return rv.str();
-}
-
-
-std::string candidate_t::print_xml(int full_subtables, int show_ids, int no_refs,const char *tag) const
-{
- std::ostringstream rv("");
-
- rv.precision(14);
- rv << xml_indent() << '<' << tag << ">\n";
- xml_indent(2);
- rv << xml_indent() << "<type>" << type << "</type>\n";
- rv << xml_indent() << "<id>" << id << "</id>\n";
- rv << xml_indent() << "<num_obs>" << num_obs << "</num_obs>\n";
- rv << xml_indent() << "<score>" << score << "</score>\n";
- rv << xml_indent() << "<is_rfi>" << is_rfi << "</is_rfi>\n";
- xml_indent(-2);
- rv << xml_indent() << "</" << tag << ">\n";
- return rv.str();
-}
-
-
- void candidate_t::parse_xml(const std::string &s,const char *tag) {
- std::string field,sub;
- if (extract_xml_record(s,tag,field)) {
- std::string::size_type pos=0;
- if (extract_xml_record(field,"type",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> type;
- }
- if (extract_xml_record(field,"id",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> id;
- }
- if (extract_xml_record(field,"num_obs",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> num_obs;
- }
- if (extract_xml_record(field,"score",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> score;
- }
- if (extract_xml_record(field,"is_rfi",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> is_rfi;
- }
- }
- }
-
- void candidate_t::parse(const SQL_ROW &s) {
- {
- std::istringstream row(*(s[0]));
- row >> type;
- }
- {
- std::istringstream row(*(s[1]));
- row >> id;
- }
- {
- std::istringstream row(*(s[2]));
- row >> num_obs;
- }
- {
- std::istringstream row(*(s[3]));
- row >> score;
- }
- {
- std::istringstream row(*(s[4]));
- row >> is_rfi;
- }
- }
-
- void candidate_t::parse(const std::string &s) {
- SQL_ROW row(&s,5);
- parse(row);
- }
-
-template <> const char * const db_table<meta_candidate>::table_name="meta_candidate";
-template <> const char * db_table<meta_candidate>::_search_tag=table_name;
+ if (&a != this) {
+ type=a.type;
+ id=a.id;
+ num_obs=a.num_obs;
+ score=a.score;
+ is_rfi=a.is_rfi;
+ }
+ return (*this);
+}
+
+
+std::string candidate_t::update_format() const {
+ std::ostringstream rv("");
+
+ rv << "ROW(";
+ for (int i=1; i<5; i++) {
+ rv << "?,";
+ }
+ rv << "?";
+ rv << ")";
+
+ return rv.str();
+}
+
+
+std::string candidate_t::insert_format() const {
+ return update_format();
+}
+
+std::string candidate_t::select_format() const {
+ std::string rv("");
+ for (int i=0; i<4; i++) {
+ rv+="?,";
+ }
+ rv+="?";
+ return rv;
+}
+
+std::string candidate_t::print(int full_subtables, int show_ids, int no_refs) const {
+ std::ostringstream rv("");
+
+ rv.precision(14);
+ rv << "ROW(";
+ rv << type;
+ rv << ',';
+ rv << id;
+ rv << ',';
+ rv << num_obs;
+ rv << ',';
+ rv << score;
+ rv << ',';
+ rv << is_rfi;
+ rv << ")";
+ return rv.str();
+}
+
+
+std::string candidate_t::print_xml(int full_subtables, int show_ids, int no_refs,const char *tag) const {
+ std::ostringstream rv("");
+
+ rv.precision(14);
+ rv << xml_indent() << '<' << tag << ">\n";
+ xml_indent(2);
+ rv << xml_indent() << "<type>" << type << "</type>\n";
+ rv << xml_indent() << "<id>" << id << "</id>\n";
+ rv << xml_indent() << "<num_obs>" << num_obs << "</num_obs>\n";
+ rv << xml_indent() << "<score>" << score << "</score>\n";
+ rv << xml_indent() << "<is_rfi>" << is_rfi << "</is_rfi>\n";
+ xml_indent(-2);
+ rv << xml_indent() << "</" << tag << ">\n";
+ return rv.str();
+}
+
+
+void candidate_t::parse_xml(const std::string &s,const char *tag) {
+ std::string field,sub;
+ if (extract_xml_record(s,tag,field)) {
+ std::string::size_type pos=0;
+ if (extract_xml_record(field,"type",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> type;
+ }
+ if (extract_xml_record(field,"id",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> id;
+ }
+ if (extract_xml_record(field,"num_obs",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> num_obs;
+ }
+ if (extract_xml_record(field,"score",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> score;
+ }
+ if (extract_xml_record(field,"is_rfi",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> is_rfi;
+ }
+ }
+}
+
+void candidate_t::parse(const SQL_ROW &s) {
+ {
+ std::istringstream row(*(s[0]));
+ row >> type;
+ }
+ {
+ std::istringstream row(*(s[1]));
+ row >> id;
+ }
+ {
+ std::istringstream row(*(s[2]));
+ row >> num_obs;
+ }
+ {
+ std::istringstream row(*(s[3]));
+ row >> score;
+ }
+ {
+ std::istringstream row(*(s[4]));
+ row >> is_rfi;
+ }
+}
+
+void candidate_t::parse(const std::string &s) {
+ SQL_ROW row(&s,5);
+ parse(row);
+}
+
+template <> const char *const db_table<meta_candidate>::table_name="meta_candidate";
+template <> const char *db_table<meta_candidate>::_search_tag=table_name;
template <> const int db_table<meta_candidate>::_nfields=32;
-template <> const char * const db_table<meta_candidate>::column_names[32]={"id","version","time_last_updated","num_spikes","num_spike_b_multiplets","best_spike_b_mp_score","num_spike_nb_multiplets","best_spike_nb_mp_score","spike_high_id","num_gaussians","num_gaussian_b_multiplets","best_gaussian_b_mp_score","num_gaussian_nb_multiplets","best_gaussian_nb_mp_score","gaussian_high_id","num_pulses","num_pulse_b_multiplets","best_pulse_b_mp_score","num_pulse_nb_multiplets","best_pulse_nb_mp_ [...]
-
-meta_candidate::meta_candidate() :
- db_table<meta_candidate>(*this,-1),
- id(0),
- version(0),
- time_last_updated(0),
- num_spikes(0),
- num_spike_b_multiplets(0),
- best_spike_b_mp_score(0),
- num_spike_nb_multiplets(0),
- best_spike_nb_mp_score(0),
- spike_high_id(0),
- num_gaussians(0),
- num_gaussian_b_multiplets(0),
- best_gaussian_b_mp_score(0),
- num_gaussian_nb_multiplets(0),
- best_gaussian_nb_mp_score(0),
- gaussian_high_id(0),
- num_pulses(0),
- num_pulse_b_multiplets(0),
- best_pulse_b_mp_score(0),
- num_pulse_nb_multiplets(0),
- best_pulse_nb_mp_score(0),
- pulse_high_id(0),
- num_triplets(0),
- num_triplet_b_multiplets(0),
- best_triplet_b_mp_score(0),
- num_triplet_nb_multiplets(0),
- best_triplet_nb_mp_score(0),
- triplet_high_id(0),
- num_stars(0),
- best_star_score(0),
- meta_score(0),
- rfi_clean(0),
- state(0)
-{
- db_open();
-}
-
-
-meta_candidate::meta_candidate(const meta_candidate &a) :
- db_table<meta_candidate>(*this,-1),
- id(a.id),
- version(a.version),
- time_last_updated(a.time_last_updated),
- num_spikes(a.num_spikes),
- num_spike_b_multiplets(a.num_spike_b_multiplets),
- best_spike_b_mp_score(a.best_spike_b_mp_score),
- num_spike_nb_multiplets(a.num_spike_nb_multiplets),
- best_spike_nb_mp_score(a.best_spike_nb_mp_score),
- spike_high_id(a.spike_high_id),
- num_gaussians(a.num_gaussians),
- num_gaussian_b_multiplets(a.num_gaussian_b_multiplets),
- best_gaussian_b_mp_score(a.best_gaussian_b_mp_score),
- num_gaussian_nb_multiplets(a.num_gaussian_nb_multiplets),
- best_gaussian_nb_mp_score(a.best_gaussian_nb_mp_score),
- gaussian_high_id(a.gaussian_high_id),
- num_pulses(a.num_pulses),
- num_pulse_b_multiplets(a.num_pulse_b_multiplets),
- best_pulse_b_mp_score(a.best_pulse_b_mp_score),
- num_pulse_nb_multiplets(a.num_pulse_nb_multiplets),
- best_pulse_nb_mp_score(a.best_pulse_nb_mp_score),
- pulse_high_id(a.pulse_high_id),
- num_triplets(a.num_triplets),
- num_triplet_b_multiplets(a.num_triplet_b_multiplets),
- best_triplet_b_mp_score(a.best_triplet_b_mp_score),
- num_triplet_nb_multiplets(a.num_triplet_nb_multiplets),
- best_triplet_nb_mp_score(a.best_triplet_nb_mp_score),
- triplet_high_id(a.triplet_high_id),
- num_stars(a.num_stars),
- best_star_score(a.best_star_score),
- meta_score(a.meta_score),
- rfi_clean(a.rfi_clean),
- state(a.state)
-{
- db_open();
-}
-
-
-meta_candidate::meta_candidate(const SQL_ROW &a) :
- db_table<meta_candidate>(*this,-1)
-{
- db_open();
- parse(a);
-}
-
-
-meta_candidate::meta_candidate(const std::string &s,const char *tag) :
- db_table<meta_candidate>(*this,-1)
-{
- db_open();
- if (xml_match_tag(s,tag)) {
- parse_xml(s,tag);
- } else {
- parse(s);
- }
+template <> const char *const db_table<meta_candidate>::column_names[32]= {"id","version","time_last_updated","num_spikes","num_spike_b_multiplets","best_spike_b_mp_score","num_spike_nb_multiplets","best_spike_nb_mp_score","spike_high_id","num_gaussians","num_gaussian_b_multiplets","best_gaussian_b_mp_score","num_gaussian_nb_multiplets","best_gaussian_nb_mp_score","gaussian_high_id","num_pulses","num_pulse_b_multiplets","best_pulse_b_mp_score","num_pulse_nb_multiplets","best_pulse_nb_mp_ [...]
+
+meta_candidate::meta_candidate() :
+ db_table<meta_candidate>(*this,-1),
+ id(0),
+ version(0),
+ time_last_updated(0),
+ num_spikes(0),
+ num_spike_b_multiplets(0),
+ best_spike_b_mp_score(0),
+ num_spike_nb_multiplets(0),
+ best_spike_nb_mp_score(0),
+ spike_high_id(0),
+ num_gaussians(0),
+ num_gaussian_b_multiplets(0),
+ best_gaussian_b_mp_score(0),
+ num_gaussian_nb_multiplets(0),
+ best_gaussian_nb_mp_score(0),
+ gaussian_high_id(0),
+ num_pulses(0),
+ num_pulse_b_multiplets(0),
+ best_pulse_b_mp_score(0),
+ num_pulse_nb_multiplets(0),
+ best_pulse_nb_mp_score(0),
+ pulse_high_id(0),
+ num_triplets(0),
+ num_triplet_b_multiplets(0),
+ best_triplet_b_mp_score(0),
+ num_triplet_nb_multiplets(0),
+ best_triplet_nb_mp_score(0),
+ triplet_high_id(0),
+ num_stars(0),
+ best_star_score(0),
+ meta_score(0),
+ rfi_clean(0),
+ state(0) {
+ db_open();
+}
+
+
+meta_candidate::meta_candidate(const meta_candidate &a) :
+ db_table<meta_candidate>(*this,-1),
+ id(a.id),
+ version(a.version),
+ time_last_updated(a.time_last_updated),
+ num_spikes(a.num_spikes),
+ num_spike_b_multiplets(a.num_spike_b_multiplets),
+ best_spike_b_mp_score(a.best_spike_b_mp_score),
+ num_spike_nb_multiplets(a.num_spike_nb_multiplets),
+ best_spike_nb_mp_score(a.best_spike_nb_mp_score),
+ spike_high_id(a.spike_high_id),
+ num_gaussians(a.num_gaussians),
+ num_gaussian_b_multiplets(a.num_gaussian_b_multiplets),
+ best_gaussian_b_mp_score(a.best_gaussian_b_mp_score),
+ num_gaussian_nb_multiplets(a.num_gaussian_nb_multiplets),
+ best_gaussian_nb_mp_score(a.best_gaussian_nb_mp_score),
+ gaussian_high_id(a.gaussian_high_id),
+ num_pulses(a.num_pulses),
+ num_pulse_b_multiplets(a.num_pulse_b_multiplets),
+ best_pulse_b_mp_score(a.best_pulse_b_mp_score),
+ num_pulse_nb_multiplets(a.num_pulse_nb_multiplets),
+ best_pulse_nb_mp_score(a.best_pulse_nb_mp_score),
+ pulse_high_id(a.pulse_high_id),
+ num_triplets(a.num_triplets),
+ num_triplet_b_multiplets(a.num_triplet_b_multiplets),
+ best_triplet_b_mp_score(a.best_triplet_b_mp_score),
+ num_triplet_nb_multiplets(a.num_triplet_nb_multiplets),
+ best_triplet_nb_mp_score(a.best_triplet_nb_mp_score),
+ triplet_high_id(a.triplet_high_id),
+ num_stars(a.num_stars),
+ best_star_score(a.best_star_score),
+ meta_score(a.meta_score),
+ rfi_clean(a.rfi_clean),
+ state(a.state) {
+ db_open();
+}
+
+
+meta_candidate::meta_candidate(const SQL_ROW &a) :
+ db_table<meta_candidate>(*this,-1) {
+ db_open();
+ parse(a);
+}
+
+
+meta_candidate::meta_candidate(const std::string &s,const char *tag) :
+ db_table<meta_candidate>(*this,-1) {
+ db_open();
+ if (xml_match_tag(s,tag)) {
+ parse_xml(s,tag);
+ } else {
+ parse(s);
+ }
}
meta_candidate &meta_candidate::operator =(const meta_candidate &a) {
- if (&a != this) {
- id=a.id;
- version=a.version;
- time_last_updated=a.time_last_updated;
- num_spikes=a.num_spikes;
- num_spike_b_multiplets=a.num_spike_b_multiplets;
- best_spike_b_mp_score=a.best_spike_b_mp_score;
- num_spike_nb_multiplets=a.num_spike_nb_multiplets;
- best_spike_nb_mp_score=a.best_spike_nb_mp_score;
- spike_high_id=a.spike_high_id;
- num_gaussians=a.num_gaussians;
- num_gaussian_b_multiplets=a.num_gaussian_b_multiplets;
- best_gaussian_b_mp_score=a.best_gaussian_b_mp_score;
- num_gaussian_nb_multiplets=a.num_gaussian_nb_multiplets;
- best_gaussian_nb_mp_score=a.best_gaussian_nb_mp_score;
- gaussian_high_id=a.gaussian_high_id;
- num_pulses=a.num_pulses;
- num_pulse_b_multiplets=a.num_pulse_b_multiplets;
- best_pulse_b_mp_score=a.best_pulse_b_mp_score;
- num_pulse_nb_multiplets=a.num_pulse_nb_multiplets;
- best_pulse_nb_mp_score=a.best_pulse_nb_mp_score;
- pulse_high_id=a.pulse_high_id;
- num_triplets=a.num_triplets;
- num_triplet_b_multiplets=a.num_triplet_b_multiplets;
- best_triplet_b_mp_score=a.best_triplet_b_mp_score;
- num_triplet_nb_multiplets=a.num_triplet_nb_multiplets;
- best_triplet_nb_mp_score=a.best_triplet_nb_mp_score;
- triplet_high_id=a.triplet_high_id;
- num_stars=a.num_stars;
- best_star_score=a.best_star_score;
- meta_score=a.meta_score;
- rfi_clean=a.rfi_clean;
- state=a.state;
- }
- return (*this);
-}
-
-
-std::string meta_candidate::update_format() const
-{ std::ostringstream rv("");
-
- for (int i=2;i<32;i++) rv << "?,";
- rv << "?";
- return rv.str();
-}
-
-
-std::string meta_candidate::insert_format() const
-{ return std::string("?,")+update_format();
-}
-
-std::string meta_candidate::select_format() const
-{
-std::string rv("");
-for (int i=0; i<31;i++) rv+="?,";
-rv+="?";
-return rv;
-}
-
-std::string meta_candidate::print(int full_subtables, int show_ids, int no_refs) const
-{ std::ostringstream rv("");
-
- rv.precision(14);
- if (show_ids) rv << id;
- rv << ',';
- rv << version;
- rv << ',';
- rv << time_last_updated;
- rv << ',';
- rv << num_spikes;
- rv << ',';
- rv << num_spike_b_multiplets;
- rv << ',';
- rv << best_spike_b_mp_score;
- rv << ',';
- rv << num_spike_nb_multiplets;
- rv << ',';
- rv << best_spike_nb_mp_score;
- rv << ',';
- rv << spike_high_id;
- rv << ',';
- rv << num_gaussians;
- rv << ',';
- rv << num_gaussian_b_multiplets;
- rv << ',';
- rv << best_gaussian_b_mp_score;
- rv << ',';
- rv << num_gaussian_nb_multiplets;
- rv << ',';
- rv << best_gaussian_nb_mp_score;
- rv << ',';
- rv << gaussian_high_id;
- rv << ',';
- rv << num_pulses;
- rv << ',';
- rv << num_pulse_b_multiplets;
- rv << ',';
- rv << best_pulse_b_mp_score;
- rv << ',';
- rv << num_pulse_nb_multiplets;
- rv << ',';
- rv << best_pulse_nb_mp_score;
- rv << ',';
- rv << pulse_high_id;
- rv << ',';
- rv << num_triplets;
- rv << ',';
- rv << num_triplet_b_multiplets;
- rv << ',';
- rv << best_triplet_b_mp_score;
- rv << ',';
- rv << num_triplet_nb_multiplets;
- rv << ',';
- rv << best_triplet_nb_mp_score;
- rv << ',';
- rv << triplet_high_id;
- rv << ',';
- rv << num_stars;
- rv << ',';
- rv << best_star_score;
- rv << ',';
- rv << meta_score;
- rv << ',';
- rv << rfi_clean;
- rv << ',';
- rv << state;
- return rv.str();
-}
-
-
-std::string meta_candidate::print_xml(int full_subtables, int show_ids, int no_refs,const char *tag) const
-{
- std::ostringstream rv("");
-
- rv.precision(14);
- rv << xml_indent() << '<' << tag << ">\n";
- xml_indent(2);
- if (show_ids) rv << xml_indent() << "<id>" << id << "</id>\n";
- rv << xml_indent() << "<version>" << version << "</version>\n";
- rv << xml_indent() << "<time_last_updated>" << time_last_updated << "</time_last_updated>\n";
- rv << xml_indent() << "<num_spikes>" << num_spikes << "</num_spikes>\n";
- rv << xml_indent() << "<num_spike_b_multiplets>" << num_spike_b_multiplets << "</num_spike_b_multiplets>\n";
- rv << xml_indent() << "<best_spike_b_mp_score>" << best_spike_b_mp_score << "</best_spike_b_mp_score>\n";
- rv << xml_indent() << "<num_spike_nb_multiplets>" << num_spike_nb_multiplets << "</num_spike_nb_multiplets>\n";
- rv << xml_indent() << "<best_spike_nb_mp_score>" << best_spike_nb_mp_score << "</best_spike_nb_mp_score>\n";
- rv << xml_indent() << "<spike_high_id>" << spike_high_id << "</spike_high_id>\n";
- rv << xml_indent() << "<num_gaussians>" << num_gaussians << "</num_gaussians>\n";
- rv << xml_indent() << "<num_gaussian_b_multiplets>" << num_gaussian_b_multiplets << "</num_gaussian_b_multiplets>\n";
- rv << xml_indent() << "<best_gaussian_b_mp_score>" << best_gaussian_b_mp_score << "</best_gaussian_b_mp_score>\n";
- rv << xml_indent() << "<num_gaussian_nb_multiplets>" << num_gaussian_nb_multiplets << "</num_gaussian_nb_multiplets>\n";
- rv << xml_indent() << "<best_gaussian_nb_mp_score>" << best_gaussian_nb_mp_score << "</best_gaussian_nb_mp_score>\n";
- rv << xml_indent() << "<gaussian_high_id>" << gaussian_high_id << "</gaussian_high_id>\n";
- rv << xml_indent() << "<num_pulses>" << num_pulses << "</num_pulses>\n";
- rv << xml_indent() << "<num_pulse_b_multiplets>" << num_pulse_b_multiplets << "</num_pulse_b_multiplets>\n";
- rv << xml_indent() << "<best_pulse_b_mp_score>" << best_pulse_b_mp_score << "</best_pulse_b_mp_score>\n";
- rv << xml_indent() << "<num_pulse_nb_multiplets>" << num_pulse_nb_multiplets << "</num_pulse_nb_multiplets>\n";
- rv << xml_indent() << "<best_pulse_nb_mp_score>" << best_pulse_nb_mp_score << "</best_pulse_nb_mp_score>\n";
- rv << xml_indent() << "<pulse_high_id>" << pulse_high_id << "</pulse_high_id>\n";
- rv << xml_indent() << "<num_triplets>" << num_triplets << "</num_triplets>\n";
- rv << xml_indent() << "<num_triplet_b_multiplets>" << num_triplet_b_multiplets << "</num_triplet_b_multiplets>\n";
- rv << xml_indent() << "<best_triplet_b_mp_score>" << best_triplet_b_mp_score << "</best_triplet_b_mp_score>\n";
- rv << xml_indent() << "<num_triplet_nb_multiplets>" << num_triplet_nb_multiplets << "</num_triplet_nb_multiplets>\n";
- rv << xml_indent() << "<best_triplet_nb_mp_score>" << best_triplet_nb_mp_score << "</best_triplet_nb_mp_score>\n";
- rv << xml_indent() << "<triplet_high_id>" << triplet_high_id << "</triplet_high_id>\n";
- rv << xml_indent() << "<num_stars>" << num_stars << "</num_stars>\n";
- rv << xml_indent() << "<best_star_score>" << best_star_score << "</best_star_score>\n";
- rv << xml_indent() << "<meta_score>" << meta_score << "</meta_score>\n";
- rv << xml_indent() << "<rfi_clean>" << rfi_clean << "</rfi_clean>\n";
- rv << xml_indent() << "<state>" << state << "</state>\n";
- xml_indent(-2);
- rv << xml_indent() << "</" << tag << ">\n";
- return rv.str();
-}
-
-
- void meta_candidate::parse_xml(const std::string &s,const char *tag) {
- std::string field,sub;
- if (extract_xml_record(s,tag,field)) {
- std::string::size_type pos=0;
- if (extract_xml_record(field,"id",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> id;
- }
- if (extract_xml_record(field,"version",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> version;
- }
- if (extract_xml_record(field,"time_last_updated",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> time_last_updated;
- }
- if (extract_xml_record(field,"num_spikes",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> num_spikes;
- }
- if (extract_xml_record(field,"num_spike_b_multiplets",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> num_spike_b_multiplets;
- }
- if (extract_xml_record(field,"best_spike_b_mp_score",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> best_spike_b_mp_score;
- }
- if (extract_xml_record(field,"num_spike_nb_multiplets",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> num_spike_nb_multiplets;
- }
- if (extract_xml_record(field,"best_spike_nb_mp_score",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> best_spike_nb_mp_score;
- }
- if (extract_xml_record(field,"spike_high_id",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> spike_high_id;
- }
- if (extract_xml_record(field,"num_gaussians",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> num_gaussians;
- }
- if (extract_xml_record(field,"num_gaussian_b_multiplets",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> num_gaussian_b_multiplets;
- }
- if (extract_xml_record(field,"best_gaussian_b_mp_score",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> best_gaussian_b_mp_score;
- }
- if (extract_xml_record(field,"num_gaussian_nb_multiplets",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> num_gaussian_nb_multiplets;
- }
- if (extract_xml_record(field,"best_gaussian_nb_mp_score",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> best_gaussian_nb_mp_score;
- }
- if (extract_xml_record(field,"gaussian_high_id",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> gaussian_high_id;
- }
- if (extract_xml_record(field,"num_pulses",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> num_pulses;
- }
- if (extract_xml_record(field,"num_pulse_b_multiplets",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> num_pulse_b_multiplets;
- }
- if (extract_xml_record(field,"best_pulse_b_mp_score",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> best_pulse_b_mp_score;
- }
- if (extract_xml_record(field,"num_pulse_nb_multiplets",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> num_pulse_nb_multiplets;
- }
- if (extract_xml_record(field,"best_pulse_nb_mp_score",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> best_pulse_nb_mp_score;
- }
- if (extract_xml_record(field,"pulse_high_id",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> pulse_high_id;
- }
- if (extract_xml_record(field,"num_triplets",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> num_triplets;
- }
- if (extract_xml_record(field,"num_triplet_b_multiplets",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> num_triplet_b_multiplets;
- }
- if (extract_xml_record(field,"best_triplet_b_mp_score",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> best_triplet_b_mp_score;
- }
- if (extract_xml_record(field,"num_triplet_nb_multiplets",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> num_triplet_nb_multiplets;
- }
- if (extract_xml_record(field,"best_triplet_nb_mp_score",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> best_triplet_nb_mp_score;
- }
- if (extract_xml_record(field,"triplet_high_id",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> triplet_high_id;
- }
- if (extract_xml_record(field,"num_stars",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> num_stars;
- }
- if (extract_xml_record(field,"best_star_score",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> best_star_score;
- }
- if (extract_xml_record(field,"meta_score",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> meta_score;
- }
- if (extract_xml_record(field,"rfi_clean",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> rfi_clean;
- }
- if (extract_xml_record(field,"state",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> state;
- }
- }
- }
-
- void meta_candidate::parse(const SQL_ROW &s) {
- {
- std::istringstream row(*(s[0]));
- row >> id;
- }
- {
- std::istringstream row(*(s[1]));
- row >> version;
- }
- {
- std::istringstream row(*(s[2]));
- row >> time_last_updated;
- }
- {
- std::istringstream row(*(s[3]));
- row >> num_spikes;
- }
- {
- std::istringstream row(*(s[4]));
- row >> num_spike_b_multiplets;
- }
- {
- std::istringstream row(*(s[5]));
- row >> best_spike_b_mp_score;
- }
- {
- std::istringstream row(*(s[6]));
- row >> num_spike_nb_multiplets;
- }
- {
- std::istringstream row(*(s[7]));
- row >> best_spike_nb_mp_score;
- }
- {
- std::istringstream row(*(s[8]));
- row >> spike_high_id;
- }
- {
- std::istringstream row(*(s[9]));
- row >> num_gaussians;
- }
- {
- std::istringstream row(*(s[10]));
- row >> num_gaussian_b_multiplets;
- }
- {
- std::istringstream row(*(s[11]));
- row >> best_gaussian_b_mp_score;
- }
- {
- std::istringstream row(*(s[12]));
- row >> num_gaussian_nb_multiplets;
- }
- {
- std::istringstream row(*(s[13]));
- row >> best_gaussian_nb_mp_score;
- }
- {
- std::istringstream row(*(s[14]));
- row >> gaussian_high_id;
- }
- {
- std::istringstream row(*(s[15]));
- row >> num_pulses;
- }
- {
- std::istringstream row(*(s[16]));
- row >> num_pulse_b_multiplets;
- }
- {
- std::istringstream row(*(s[17]));
- row >> best_pulse_b_mp_score;
- }
- {
- std::istringstream row(*(s[18]));
- row >> num_pulse_nb_multiplets;
- }
- {
- std::istringstream row(*(s[19]));
- row >> best_pulse_nb_mp_score;
- }
- {
- std::istringstream row(*(s[20]));
- row >> pulse_high_id;
- }
- {
- std::istringstream row(*(s[21]));
- row >> num_triplets;
- }
- {
- std::istringstream row(*(s[22]));
- row >> num_triplet_b_multiplets;
- }
- {
- std::istringstream row(*(s[23]));
- row >> best_triplet_b_mp_score;
- }
- {
- std::istringstream row(*(s[24]));
- row >> num_triplet_nb_multiplets;
- }
- {
- std::istringstream row(*(s[25]));
- row >> best_triplet_nb_mp_score;
- }
- {
- std::istringstream row(*(s[26]));
- row >> triplet_high_id;
- }
- {
- std::istringstream row(*(s[27]));
- row >> num_stars;
- }
- {
- std::istringstream row(*(s[28]));
- row >> best_star_score;
- }
- {
- std::istringstream row(*(s[29]));
- row >> meta_score;
- }
- {
- std::istringstream row(*(s[30]));
- row >> rfi_clean;
- }
- {
- std::istringstream row(*(s[31]));
- row >> state;
- }
- }
-
- void meta_candidate::parse(const std::string &s) {
- SQL_ROW row(&s,32);
- parse(row);
- }
-
-template <> const char * const db_table<multiplet>::table_name="multiplet";
-template <> const char * db_table<multiplet>::_search_tag=table_name;
+ if (&a != this) {
+ id=a.id;
+ version=a.version;
+ time_last_updated=a.time_last_updated;
+ num_spikes=a.num_spikes;
+ num_spike_b_multiplets=a.num_spike_b_multiplets;
+ best_spike_b_mp_score=a.best_spike_b_mp_score;
+ num_spike_nb_multiplets=a.num_spike_nb_multiplets;
+ best_spike_nb_mp_score=a.best_spike_nb_mp_score;
+ spike_high_id=a.spike_high_id;
+ num_gaussians=a.num_gaussians;
+ num_gaussian_b_multiplets=a.num_gaussian_b_multiplets;
+ best_gaussian_b_mp_score=a.best_gaussian_b_mp_score;
+ num_gaussian_nb_multiplets=a.num_gaussian_nb_multiplets;
+ best_gaussian_nb_mp_score=a.best_gaussian_nb_mp_score;
+ gaussian_high_id=a.gaussian_high_id;
+ num_pulses=a.num_pulses;
+ num_pulse_b_multiplets=a.num_pulse_b_multiplets;
+ best_pulse_b_mp_score=a.best_pulse_b_mp_score;
+ num_pulse_nb_multiplets=a.num_pulse_nb_multiplets;
+ best_pulse_nb_mp_score=a.best_pulse_nb_mp_score;
+ pulse_high_id=a.pulse_high_id;
+ num_triplets=a.num_triplets;
+ num_triplet_b_multiplets=a.num_triplet_b_multiplets;
+ best_triplet_b_mp_score=a.best_triplet_b_mp_score;
+ num_triplet_nb_multiplets=a.num_triplet_nb_multiplets;
+ best_triplet_nb_mp_score=a.best_triplet_nb_mp_score;
+ triplet_high_id=a.triplet_high_id;
+ num_stars=a.num_stars;
+ best_star_score=a.best_star_score;
+ meta_score=a.meta_score;
+ rfi_clean=a.rfi_clean;
+ state=a.state;
+ }
+ return (*this);
+}
+
+
+std::string meta_candidate::update_format() const {
+ std::ostringstream rv("");
+
+ for (int i=2; i<32; i++) {
+ rv << "?,";
+ }
+ rv << "?";
+ return rv.str();
+}
+
+
+std::string meta_candidate::insert_format() const {
+ return std::string("?,")+update_format();
+}
+
+std::string meta_candidate::select_format() const {
+ std::string rv("");
+ for (int i=0; i<31; i++) {
+ rv+="?,";
+ }
+ rv+="?";
+ return rv;
+}
+
+std::string meta_candidate::print(int full_subtables, int show_ids, int no_refs) const {
+ std::ostringstream rv("");
+
+ rv.precision(14);
+ if (show_ids) {
+ rv << id;
+ }
+ rv << ',';
+ rv << version;
+ rv << ',';
+ rv << time_last_updated;
+ rv << ',';
+ rv << num_spikes;
+ rv << ',';
+ rv << num_spike_b_multiplets;
+ rv << ',';
+ rv << best_spike_b_mp_score;
+ rv << ',';
+ rv << num_spike_nb_multiplets;
+ rv << ',';
+ rv << best_spike_nb_mp_score;
+ rv << ',';
+ rv << spike_high_id;
+ rv << ',';
+ rv << num_gaussians;
+ rv << ',';
+ rv << num_gaussian_b_multiplets;
+ rv << ',';
+ rv << best_gaussian_b_mp_score;
+ rv << ',';
+ rv << num_gaussian_nb_multiplets;
+ rv << ',';
+ rv << best_gaussian_nb_mp_score;
+ rv << ',';
+ rv << gaussian_high_id;
+ rv << ',';
+ rv << num_pulses;
+ rv << ',';
+ rv << num_pulse_b_multiplets;
+ rv << ',';
+ rv << best_pulse_b_mp_score;
+ rv << ',';
+ rv << num_pulse_nb_multiplets;
+ rv << ',';
+ rv << best_pulse_nb_mp_score;
+ rv << ',';
+ rv << pulse_high_id;
+ rv << ',';
+ rv << num_triplets;
+ rv << ',';
+ rv << num_triplet_b_multiplets;
+ rv << ',';
+ rv << best_triplet_b_mp_score;
+ rv << ',';
+ rv << num_triplet_nb_multiplets;
+ rv << ',';
+ rv << best_triplet_nb_mp_score;
+ rv << ',';
+ rv << triplet_high_id;
+ rv << ',';
+ rv << num_stars;
+ rv << ',';
+ rv << best_star_score;
+ rv << ',';
+ rv << meta_score;
+ rv << ',';
+ rv << rfi_clean;
+ rv << ',';
+ rv << state;
+ return rv.str();
+}
+
+
+std::string meta_candidate::print_xml(int full_subtables, int show_ids, int no_refs,const char *tag) const {
+ std::ostringstream rv("");
+
+ rv.precision(14);
+ rv << xml_indent() << '<' << tag << ">\n";
+ xml_indent(2);
+ if (show_ids) {
+ rv << xml_indent() << "<id>" << id << "</id>\n";
+ }
+ rv << xml_indent() << "<version>" << version << "</version>\n";
+ rv << xml_indent() << "<time_last_updated>" << time_last_updated << "</time_last_updated>\n";
+ rv << xml_indent() << "<num_spikes>" << num_spikes << "</num_spikes>\n";
+ rv << xml_indent() << "<num_spike_b_multiplets>" << num_spike_b_multiplets << "</num_spike_b_multiplets>\n";
+ rv << xml_indent() << "<best_spike_b_mp_score>" << best_spike_b_mp_score << "</best_spike_b_mp_score>\n";
+ rv << xml_indent() << "<num_spike_nb_multiplets>" << num_spike_nb_multiplets << "</num_spike_nb_multiplets>\n";
+ rv << xml_indent() << "<best_spike_nb_mp_score>" << best_spike_nb_mp_score << "</best_spike_nb_mp_score>\n";
+ rv << xml_indent() << "<spike_high_id>" << spike_high_id << "</spike_high_id>\n";
+ rv << xml_indent() << "<num_gaussians>" << num_gaussians << "</num_gaussians>\n";
+ rv << xml_indent() << "<num_gaussian_b_multiplets>" << num_gaussian_b_multiplets << "</num_gaussian_b_multiplets>\n";
+ rv << xml_indent() << "<best_gaussian_b_mp_score>" << best_gaussian_b_mp_score << "</best_gaussian_b_mp_score>\n";
+ rv << xml_indent() << "<num_gaussian_nb_multiplets>" << num_gaussian_nb_multiplets << "</num_gaussian_nb_multiplets>\n";
+ rv << xml_indent() << "<best_gaussian_nb_mp_score>" << best_gaussian_nb_mp_score << "</best_gaussian_nb_mp_score>\n";
+ rv << xml_indent() << "<gaussian_high_id>" << gaussian_high_id << "</gaussian_high_id>\n";
+ rv << xml_indent() << "<num_pulses>" << num_pulses << "</num_pulses>\n";
+ rv << xml_indent() << "<num_pulse_b_multiplets>" << num_pulse_b_multiplets << "</num_pulse_b_multiplets>\n";
+ rv << xml_indent() << "<best_pulse_b_mp_score>" << best_pulse_b_mp_score << "</best_pulse_b_mp_score>\n";
+ rv << xml_indent() << "<num_pulse_nb_multiplets>" << num_pulse_nb_multiplets << "</num_pulse_nb_multiplets>\n";
+ rv << xml_indent() << "<best_pulse_nb_mp_score>" << best_pulse_nb_mp_score << "</best_pulse_nb_mp_score>\n";
+ rv << xml_indent() << "<pulse_high_id>" << pulse_high_id << "</pulse_high_id>\n";
+ rv << xml_indent() << "<num_triplets>" << num_triplets << "</num_triplets>\n";
+ rv << xml_indent() << "<num_triplet_b_multiplets>" << num_triplet_b_multiplets << "</num_triplet_b_multiplets>\n";
+ rv << xml_indent() << "<best_triplet_b_mp_score>" << best_triplet_b_mp_score << "</best_triplet_b_mp_score>\n";
+ rv << xml_indent() << "<num_triplet_nb_multiplets>" << num_triplet_nb_multiplets << "</num_triplet_nb_multiplets>\n";
+ rv << xml_indent() << "<best_triplet_nb_mp_score>" << best_triplet_nb_mp_score << "</best_triplet_nb_mp_score>\n";
+ rv << xml_indent() << "<triplet_high_id>" << triplet_high_id << "</triplet_high_id>\n";
+ rv << xml_indent() << "<num_stars>" << num_stars << "</num_stars>\n";
+ rv << xml_indent() << "<best_star_score>" << best_star_score << "</best_star_score>\n";
+ rv << xml_indent() << "<meta_score>" << meta_score << "</meta_score>\n";
+ rv << xml_indent() << "<rfi_clean>" << rfi_clean << "</rfi_clean>\n";
+ rv << xml_indent() << "<state>" << state << "</state>\n";
+ xml_indent(-2);
+ rv << xml_indent() << "</" << tag << ">\n";
+ return rv.str();
+}
+
+
+void meta_candidate::parse_xml(const std::string &s,const char *tag) {
+ std::string field,sub;
+ if (extract_xml_record(s,tag,field)) {
+ std::string::size_type pos=0;
+ if (extract_xml_record(field,"id",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> id;
+ }
+ if (extract_xml_record(field,"version",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> version;
+ }
+ if (extract_xml_record(field,"time_last_updated",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> time_last_updated;
+ }
+ if (extract_xml_record(field,"num_spikes",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> num_spikes;
+ }
+ if (extract_xml_record(field,"num_spike_b_multiplets",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> num_spike_b_multiplets;
+ }
+ if (extract_xml_record(field,"best_spike_b_mp_score",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> best_spike_b_mp_score;
+ }
+ if (extract_xml_record(field,"num_spike_nb_multiplets",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> num_spike_nb_multiplets;
+ }
+ if (extract_xml_record(field,"best_spike_nb_mp_score",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> best_spike_nb_mp_score;
+ }
+ if (extract_xml_record(field,"spike_high_id",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> spike_high_id;
+ }
+ if (extract_xml_record(field,"num_gaussians",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> num_gaussians;
+ }
+ if (extract_xml_record(field,"num_gaussian_b_multiplets",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> num_gaussian_b_multiplets;
+ }
+ if (extract_xml_record(field,"best_gaussian_b_mp_score",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> best_gaussian_b_mp_score;
+ }
+ if (extract_xml_record(field,"num_gaussian_nb_multiplets",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> num_gaussian_nb_multiplets;
+ }
+ if (extract_xml_record(field,"best_gaussian_nb_mp_score",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> best_gaussian_nb_mp_score;
+ }
+ if (extract_xml_record(field,"gaussian_high_id",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> gaussian_high_id;
+ }
+ if (extract_xml_record(field,"num_pulses",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> num_pulses;
+ }
+ if (extract_xml_record(field,"num_pulse_b_multiplets",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> num_pulse_b_multiplets;
+ }
+ if (extract_xml_record(field,"best_pulse_b_mp_score",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> best_pulse_b_mp_score;
+ }
+ if (extract_xml_record(field,"num_pulse_nb_multiplets",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> num_pulse_nb_multiplets;
+ }
+ if (extract_xml_record(field,"best_pulse_nb_mp_score",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> best_pulse_nb_mp_score;
+ }
+ if (extract_xml_record(field,"pulse_high_id",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> pulse_high_id;
+ }
+ if (extract_xml_record(field,"num_triplets",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> num_triplets;
+ }
+ if (extract_xml_record(field,"num_triplet_b_multiplets",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> num_triplet_b_multiplets;
+ }
+ if (extract_xml_record(field,"best_triplet_b_mp_score",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> best_triplet_b_mp_score;
+ }
+ if (extract_xml_record(field,"num_triplet_nb_multiplets",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> num_triplet_nb_multiplets;
+ }
+ if (extract_xml_record(field,"best_triplet_nb_mp_score",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> best_triplet_nb_mp_score;
+ }
+ if (extract_xml_record(field,"triplet_high_id",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> triplet_high_id;
+ }
+ if (extract_xml_record(field,"num_stars",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> num_stars;
+ }
+ if (extract_xml_record(field,"best_star_score",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> best_star_score;
+ }
+ if (extract_xml_record(field,"meta_score",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> meta_score;
+ }
+ if (extract_xml_record(field,"rfi_clean",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> rfi_clean;
+ }
+ if (extract_xml_record(field,"state",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> state;
+ }
+ }
+}
+
+void meta_candidate::parse(const SQL_ROW &s) {
+ {
+ std::istringstream row(*(s[0]));
+ row >> id;
+ }
+ {
+ std::istringstream row(*(s[1]));
+ row >> version;
+ }
+ {
+ std::istringstream row(*(s[2]));
+ row >> time_last_updated;
+ }
+ {
+ std::istringstream row(*(s[3]));
+ row >> num_spikes;
+ }
+ {
+ std::istringstream row(*(s[4]));
+ row >> num_spike_b_multiplets;
+ }
+ {
+ std::istringstream row(*(s[5]));
+ row >> best_spike_b_mp_score;
+ }
+ {
+ std::istringstream row(*(s[6]));
+ row >> num_spike_nb_multiplets;
+ }
+ {
+ std::istringstream row(*(s[7]));
+ row >> best_spike_nb_mp_score;
+ }
+ {
+ std::istringstream row(*(s[8]));
+ row >> spike_high_id;
+ }
+ {
+ std::istringstream row(*(s[9]));
+ row >> num_gaussians;
+ }
+ {
+ std::istringstream row(*(s[10]));
+ row >> num_gaussian_b_multiplets;
+ }
+ {
+ std::istringstream row(*(s[11]));
+ row >> best_gaussian_b_mp_score;
+ }
+ {
+ std::istringstream row(*(s[12]));
+ row >> num_gaussian_nb_multiplets;
+ }
+ {
+ std::istringstream row(*(s[13]));
+ row >> best_gaussian_nb_mp_score;
+ }
+ {
+ std::istringstream row(*(s[14]));
+ row >> gaussian_high_id;
+ }
+ {
+ std::istringstream row(*(s[15]));
+ row >> num_pulses;
+ }
+ {
+ std::istringstream row(*(s[16]));
+ row >> num_pulse_b_multiplets;
+ }
+ {
+ std::istringstream row(*(s[17]));
+ row >> best_pulse_b_mp_score;
+ }
+ {
+ std::istringstream row(*(s[18]));
+ row >> num_pulse_nb_multiplets;
+ }
+ {
+ std::istringstream row(*(s[19]));
+ row >> best_pulse_nb_mp_score;
+ }
+ {
+ std::istringstream row(*(s[20]));
+ row >> pulse_high_id;
+ }
+ {
+ std::istringstream row(*(s[21]));
+ row >> num_triplets;
+ }
+ {
+ std::istringstream row(*(s[22]));
+ row >> num_triplet_b_multiplets;
+ }
+ {
+ std::istringstream row(*(s[23]));
+ row >> best_triplet_b_mp_score;
+ }
+ {
+ std::istringstream row(*(s[24]));
+ row >> num_triplet_nb_multiplets;
+ }
+ {
+ std::istringstream row(*(s[25]));
+ row >> best_triplet_nb_mp_score;
+ }
+ {
+ std::istringstream row(*(s[26]));
+ row >> triplet_high_id;
+ }
+ {
+ std::istringstream row(*(s[27]));
+ row >> num_stars;
+ }
+ {
+ std::istringstream row(*(s[28]));
+ row >> best_star_score;
+ }
+ {
+ std::istringstream row(*(s[29]));
+ row >> meta_score;
+ }
+ {
+ std::istringstream row(*(s[30]));
+ row >> rfi_clean;
+ }
+ {
+ std::istringstream row(*(s[31]));
+ row >> state;
+ }
+}
+
+void meta_candidate::parse(const std::string &s) {
+ SQL_ROW row(&s,32);
+ parse(row);
+}
+
+template <> const char *const db_table<multiplet>::table_name="multiplet";
+template <> const char *db_table<multiplet>::_search_tag=table_name;
template <> const int db_table<multiplet>::_nfields=25;
-template <> const char * const db_table<multiplet>::column_names[25]={"id","version","signal_type","mp_type","qpix","freq_win","mean_ra","mean_decl","ra_stddev","decl_stddev","mean_angular_distance","angular_distance_stddev","mean_frequency","frequency_stddev","mean_chirp","chirp_stddev","mean_period","period_stddev","mean_snr","snr_stddev","mean_threshold","threshold_stddev","score","num_detections","signal_ids"};
-
-multiplet::multiplet() :
- db_table<multiplet>(*this,-1),
- id(0),
- version(0),
- signal_type(0),
- mp_type(0),
- qpix(0),
- freq_win(0),
- mean_ra(0),
- mean_decl(0),
- ra_stddev(0),
- decl_stddev(0),
- mean_angular_distance(0),
- angular_distance_stddev(0),
- mean_frequency(0),
- frequency_stddev(0),
- mean_chirp(0),
- chirp_stddev(0),
- mean_period(0),
- period_stddev(0),
- mean_snr(0),
- snr_stddev(0),
- mean_threshold(0),
- threshold_stddev(0),
- score(0),
- num_detections(0),
- signal_ids((sqlint8_t *)0,0,_x_csv)
-{
- db_open();
-}
-
-
-multiplet::multiplet(const multiplet &a) :
- db_table<multiplet>(*this,-1),
- id(a.id),
- version(a.version),
- signal_type(a.signal_type),
- mp_type(a.mp_type),
- qpix(a.qpix),
- freq_win(a.freq_win),
- mean_ra(a.mean_ra),
- mean_decl(a.mean_decl),
- ra_stddev(a.ra_stddev),
- decl_stddev(a.decl_stddev),
- mean_angular_distance(a.mean_angular_distance),
- angular_distance_stddev(a.angular_distance_stddev),
- mean_frequency(a.mean_frequency),
- frequency_stddev(a.frequency_stddev),
- mean_chirp(a.mean_chirp),
- chirp_stddev(a.chirp_stddev),
- mean_period(a.mean_period),
- period_stddev(a.period_stddev),
- mean_snr(a.mean_snr),
- snr_stddev(a.snr_stddev),
- mean_threshold(a.mean_threshold),
- threshold_stddev(a.threshold_stddev),
- score(a.score),
- num_detections(a.num_detections),
- signal_ids(a.signal_ids)
-{
- db_open();
-}
-
-
-multiplet::multiplet(const SQL_ROW &a) :
- db_table<multiplet>(*this,-1)
-{
- db_open();
- parse(a);
-}
-
-
-multiplet::multiplet(const std::string &s,const char *tag) :
- db_table<multiplet>(*this,-1)
-{
- db_open();
- if (xml_match_tag(s,tag)) {
- parse_xml(s,tag);
- } else {
- parse(s);
- }
+template <> const char *const db_table<multiplet>::column_names[25]= {"id","version","signal_type","mp_type","qpix","freq_win","mean_ra","mean_decl","ra_stddev","decl_stddev","mean_angular_distance","angular_distance_stddev","mean_frequency","frequency_stddev","mean_chirp","chirp_stddev","mean_period","period_stddev","mean_snr","snr_stddev","mean_threshold","threshold_stddev","score","num_detections","signal_ids"};
+
+multiplet::multiplet() :
+ db_table<multiplet>(*this,-1),
+ id(0),
+ version(0),
+ signal_type(0),
+ mp_type(0),
+ qpix(0),
+ freq_win(0),
+ mean_ra(0),
+ mean_decl(0),
+ ra_stddev(0),
+ decl_stddev(0),
+ mean_angular_distance(0),
+ angular_distance_stddev(0),
+ mean_frequency(0),
+ frequency_stddev(0),
+ mean_chirp(0),
+ chirp_stddev(0),
+ mean_period(0),
+ period_stddev(0),
+ mean_snr(0),
+ snr_stddev(0),
+ mean_threshold(0),
+ threshold_stddev(0),
+ score(0),
+ num_detections(0),
+ signal_ids((sqlint8_t *)0,0,_x_csv) {
+ db_open();
+}
+
+
+multiplet::multiplet(const multiplet &a) :
+ db_table<multiplet>(*this,-1),
+ id(a.id),
+ version(a.version),
+ signal_type(a.signal_type),
+ mp_type(a.mp_type),
+ qpix(a.qpix),
+ freq_win(a.freq_win),
+ mean_ra(a.mean_ra),
+ mean_decl(a.mean_decl),
+ ra_stddev(a.ra_stddev),
+ decl_stddev(a.decl_stddev),
+ mean_angular_distance(a.mean_angular_distance),
+ angular_distance_stddev(a.angular_distance_stddev),
+ mean_frequency(a.mean_frequency),
+ frequency_stddev(a.frequency_stddev),
+ mean_chirp(a.mean_chirp),
+ chirp_stddev(a.chirp_stddev),
+ mean_period(a.mean_period),
+ period_stddev(a.period_stddev),
+ mean_snr(a.mean_snr),
+ snr_stddev(a.snr_stddev),
+ mean_threshold(a.mean_threshold),
+ threshold_stddev(a.threshold_stddev),
+ score(a.score),
+ num_detections(a.num_detections),
+ signal_ids(a.signal_ids) {
+ db_open();
+}
+
+
+multiplet::multiplet(const SQL_ROW &a) :
+ db_table<multiplet>(*this,-1) {
+ db_open();
+ parse(a);
+}
+
+
+multiplet::multiplet(const std::string &s,const char *tag) :
+ db_table<multiplet>(*this,-1) {
+ db_open();
+ if (xml_match_tag(s,tag)) {
+ parse_xml(s,tag);
+ } else {
+ parse(s);
+ }
}
multiplet &multiplet::operator =(const multiplet &a) {
- if (&a != this) {
- id=a.id;
- version=a.version;
- signal_type=a.signal_type;
- mp_type=a.mp_type;
- qpix=a.qpix;
- freq_win=a.freq_win;
- mean_ra=a.mean_ra;
- mean_decl=a.mean_decl;
- ra_stddev=a.ra_stddev;
- decl_stddev=a.decl_stddev;
- mean_angular_distance=a.mean_angular_distance;
- angular_distance_stddev=a.angular_distance_stddev;
- mean_frequency=a.mean_frequency;
- frequency_stddev=a.frequency_stddev;
- mean_chirp=a.mean_chirp;
- chirp_stddev=a.chirp_stddev;
- mean_period=a.mean_period;
- period_stddev=a.period_stddev;
- mean_snr=a.mean_snr;
- snr_stddev=a.snr_stddev;
- mean_threshold=a.mean_threshold;
- threshold_stddev=a.threshold_stddev;
- score=a.score;
- num_detections=a.num_detections;
- {
- signal_ids.clear();
- std::vector<sqlint8_t>::const_iterator i(a.signal_ids.begin());
- for (;i!=a.signal_ids.end();i++) {
- signal_ids.push_back(*i);
- }
- }
- }
- return (*this);
-}
-
-
-std::string multiplet::update_format() const
-{ std::ostringstream rv("");
-
- for (int i=2;i<25;i++) rv << "?,";
- rv << "?";
- return rv.str();
-}
-
-
-std::string multiplet::insert_format() const
-{ return std::string("?,")+update_format();
-}
-
-std::string multiplet::select_format() const
-{
-std::string rv("");
-for (int i=0; i<24;i++) rv+="?,";
-rv+="?";
-return rv;
-}
-
-std::string multiplet::print(int full_subtables, int show_ids, int no_refs) const
-{ std::ostringstream rv("");
-
- rv.precision(14);
- if (show_ids) rv << id;
- rv << ',';
- rv << version;
- rv << ',';
- rv << signal_type;
- rv << ',';
- rv << mp_type;
- rv << ',';
- rv << qpix;
- rv << ',';
- rv << freq_win;
- rv << ',';
- rv << mean_ra;
- rv << ',';
- rv << mean_decl;
- rv << ',';
- rv << ra_stddev;
- rv << ',';
- rv << decl_stddev;
- rv << ',';
- rv << mean_angular_distance;
- rv << ',';
- rv << angular_distance_stddev;
- rv << ',';
- rv << mean_frequency;
- rv << ',';
- rv << frequency_stddev;
- rv << ',';
- rv << mean_chirp;
- rv << ',';
- rv << chirp_stddev;
- rv << ',';
- rv << mean_period;
- rv << ',';
- rv << period_stddev;
- rv << ',';
- rv << mean_snr;
- rv << ',';
- rv << snr_stddev;
- rv << ',';
- rv << mean_threshold;
- rv << ',';
- rv << threshold_stddev;
- rv << ',';
- rv << score;
- rv << ',';
- rv << num_detections;
- rv << ',';
- rv << "LIST {";
- {
- std::vector<sqlint8_t>::const_iterator p=signal_ids.begin();
- for (;p<signal_ids.end();p++) {
- rv << *p;
- if (p != signal_ids.end()-1) {
- rv << ',';
- } else {
- rv << "}";
- }
- }
- }
- return rv.str();
-}
-
-
-std::string multiplet::print_xml(int full_subtables, int show_ids, int no_refs,const char *tag) const
-{
- std::ostringstream rv("");
-
- rv.precision(14);
- rv << xml_indent() << '<' << tag << ">\n";
- xml_indent(2);
- if (show_ids) rv << xml_indent() << "<id>" << id << "</id>\n";
- rv << xml_indent() << "<version>" << version << "</version>\n";
- rv << xml_indent() << "<signal_type>" << signal_type << "</signal_type>\n";
- rv << xml_indent() << "<mp_type>" << mp_type << "</mp_type>\n";
- rv << xml_indent() << "<qpix>" << qpix << "</qpix>\n";
- rv << xml_indent() << "<freq_win>" << freq_win << "</freq_win>\n";
- rv << xml_indent() << "<mean_ra>" << mean_ra << "</mean_ra>\n";
- rv << xml_indent() << "<mean_decl>" << mean_decl << "</mean_decl>\n";
- rv << xml_indent() << "<ra_stddev>" << ra_stddev << "</ra_stddev>\n";
- rv << xml_indent() << "<decl_stddev>" << decl_stddev << "</decl_stddev>\n";
- rv << xml_indent() << "<mean_angular_distance>" << mean_angular_distance << "</mean_angular_distance>\n";
- rv << xml_indent() << "<angular_distance_stddev>" << angular_distance_stddev << "</angular_distance_stddev>\n";
- rv << xml_indent() << "<mean_frequency>" << mean_frequency << "</mean_frequency>\n";
- rv << xml_indent() << "<frequency_stddev>" << frequency_stddev << "</frequency_stddev>\n";
- rv << xml_indent() << "<mean_chirp>" << mean_chirp << "</mean_chirp>\n";
- rv << xml_indent() << "<chirp_stddev>" << chirp_stddev << "</chirp_stddev>\n";
- rv << xml_indent() << "<mean_period>" << mean_period << "</mean_period>\n";
- rv << xml_indent() << "<period_stddev>" << period_stddev << "</period_stddev>\n";
- rv << xml_indent() << "<mean_snr>" << mean_snr << "</mean_snr>\n";
- rv << xml_indent() << "<snr_stddev>" << snr_stddev << "</snr_stddev>\n";
- rv << xml_indent() << "<mean_threshold>" << mean_threshold << "</mean_threshold>\n";
- rv << xml_indent() << "<threshold_stddev>" << threshold_stddev << "</threshold_stddev>\n";
- rv << xml_indent() << "<score>" << score << "</score>\n";
- rv << xml_indent() << "<num_detections>" << num_detections << "</num_detections>\n";
- if (signal_ids.size()) {
- rv << xml_indent() << "<signal_ids";
- {
- std::string enc_string=signal_ids.print_xml();
- rv << " length=" << enc_string.size() << " encoding=\"" << xml_encoding_names[signal_ids.encoding] << "\">" ;
- rv << enc_string;
- }
-}
- rv << "</signal_ids>\n";
- xml_indent(-2);
- rv << xml_indent() << "</" << tag << ">\n";
- return rv.str();
-}
-
-
- void multiplet::parse_xml(const std::string &s,const char *tag) {
- std::string field,sub;
- if (extract_xml_record(s,tag,field)) {
- std::string::size_type pos=0;
- if (extract_xml_record(field,"id",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> id;
- }
- if (extract_xml_record(field,"version",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> version;
- }
- if (extract_xml_record(field,"signal_type",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> signal_type;
- }
- if (extract_xml_record(field,"mp_type",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> mp_type;
- }
- if (extract_xml_record(field,"qpix",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> qpix;
- }
- if (extract_xml_record(field,"freq_win",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> freq_win;
- }
- if (extract_xml_record(field,"mean_ra",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> mean_ra;
- }
- if (extract_xml_record(field,"mean_decl",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> mean_decl;
- }
- if (extract_xml_record(field,"ra_stddev",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> ra_stddev;
- }
- if (extract_xml_record(field,"decl_stddev",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> decl_stddev;
- }
- if (extract_xml_record(field,"mean_angular_distance",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> mean_angular_distance;
- }
- if (extract_xml_record(field,"angular_distance_stddev",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> angular_distance_stddev;
- }
- if (extract_xml_record(field,"mean_frequency",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> mean_frequency;
- }
- if (extract_xml_record(field,"frequency_stddev",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> frequency_stddev;
- }
- if (extract_xml_record(field,"mean_chirp",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> mean_chirp;
- }
- if (extract_xml_record(field,"chirp_stddev",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> chirp_stddev;
- }
- if (extract_xml_record(field,"mean_period",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> mean_period;
- }
- if (extract_xml_record(field,"period_stddev",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> period_stddev;
- }
- if (extract_xml_record(field,"mean_snr",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> mean_snr;
- }
- if (extract_xml_record(field,"snr_stddev",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> snr_stddev;
- }
- if (extract_xml_record(field,"mean_threshold",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> mean_threshold;
- }
- if (extract_xml_record(field,"threshold_stddev",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> threshold_stddev;
- }
- if (extract_xml_record(field,"score",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> score;
- }
- if (extract_xml_record(field,"num_detections",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> num_detections;
- }
- signal_ids.clear();
- if (extract_xml_record(field,"signal_ids",sub)) {
- pos=sub.find(">");
- do {
- if (pos!=std::string::npos) {
- do { pos++; } while ((sub[pos]=='\n') || (sub[pos]==','));
- std::istringstream in(std::string(sub.c_str()+pos));
- sqlint8_t tmp;
- in >> tmp;
- signal_ids.push_back(tmp);
- }
- } while ((pos=sub.find(",",pos)) != std::string::npos);
- }
- }
- }
-
- void multiplet::parse(const SQL_ROW &s) {
- {
- std::istringstream row(*(s[0]));
- row >> id;
- }
- {
- std::istringstream row(*(s[1]));
- row >> version;
- }
- {
- std::istringstream row(*(s[2]));
- row >> signal_type;
- }
- {
- std::istringstream row(*(s[3]));
- row >> mp_type;
- }
- {
- std::istringstream row(*(s[4]));
- row >> qpix;
- }
- {
- std::istringstream row(*(s[5]));
- row >> freq_win;
- }
- {
- std::istringstream row(*(s[6]));
- row >> mean_ra;
- }
- {
- std::istringstream row(*(s[7]));
- row >> mean_decl;
- }
- {
- std::istringstream row(*(s[8]));
- row >> ra_stddev;
- }
- {
- std::istringstream row(*(s[9]));
- row >> decl_stddev;
- }
- {
- std::istringstream row(*(s[10]));
- row >> mean_angular_distance;
- }
- {
- std::istringstream row(*(s[11]));
- row >> angular_distance_stddev;
- }
- {
- std::istringstream row(*(s[12]));
- row >> mean_frequency;
- }
- {
- std::istringstream row(*(s[13]));
- row >> frequency_stddev;
- }
- {
- std::istringstream row(*(s[14]));
- row >> mean_chirp;
- }
- {
- std::istringstream row(*(s[15]));
- row >> chirp_stddev;
- }
- {
- std::istringstream row(*(s[16]));
- row >> mean_period;
- }
- {
- std::istringstream row(*(s[17]));
- row >> period_stddev;
- }
- {
- std::istringstream row(*(s[18]));
- row >> mean_snr;
- }
- {
- std::istringstream row(*(s[19]));
- row >> snr_stddev;
- }
- {
- std::istringstream row(*(s[20]));
- row >> mean_threshold;
- }
- {
- std::istringstream row(*(s[21]));
- row >> threshold_stddev;
- }
- {
- std::istringstream row(*(s[22]));
- row >> score;
- }
- {
- std::istringstream row(*(s[23]));
- row >> num_detections;
- }
- {
- std::string::size_type p,q;
- int i;
- signal_ids.clear();
- SQL_ROW tmp(s[24]);
- for (i=0;i<tmp.argc();i++) {
- std::istringstream in(*(tmp[i]));
- sqlint8_t tmp0;
- in >> tmp0;
- signal_ids.push_back(tmp0);
- }
- }
- }
-
- void multiplet::parse(const std::string &s) {
- SQL_ROW row(&s,25);
- parse(row);
- }
-
-template <> const char * const db_table<star>::table_name="star";
-template <> const char * db_table<star>::_search_tag=table_name;
+ if (&a != this) {
+ id=a.id;
+ version=a.version;
+ signal_type=a.signal_type;
+ mp_type=a.mp_type;
+ qpix=a.qpix;
+ freq_win=a.freq_win;
+ mean_ra=a.mean_ra;
+ mean_decl=a.mean_decl;
+ ra_stddev=a.ra_stddev;
+ decl_stddev=a.decl_stddev;
+ mean_angular_distance=a.mean_angular_distance;
+ angular_distance_stddev=a.angular_distance_stddev;
+ mean_frequency=a.mean_frequency;
+ frequency_stddev=a.frequency_stddev;
+ mean_chirp=a.mean_chirp;
+ chirp_stddev=a.chirp_stddev;
+ mean_period=a.mean_period;
+ period_stddev=a.period_stddev;
+ mean_snr=a.mean_snr;
+ snr_stddev=a.snr_stddev;
+ mean_threshold=a.mean_threshold;
+ threshold_stddev=a.threshold_stddev;
+ score=a.score;
+ num_detections=a.num_detections;
+ {
+ signal_ids.clear();
+ std::vector<sqlint8_t>::const_iterator i(a.signal_ids.begin());
+ for (; i!=a.signal_ids.end(); i++) {
+ signal_ids.push_back(*i);
+ }
+ }
+ }
+ return (*this);
+}
+
+
+std::string multiplet::update_format() const {
+ std::ostringstream rv("");
+
+ for (int i=2; i<25; i++) {
+ rv << "?,";
+ }
+ rv << "?";
+ return rv.str();
+}
+
+
+std::string multiplet::insert_format() const {
+ return std::string("?,")+update_format();
+}
+
+std::string multiplet::select_format() const {
+ std::string rv("");
+ for (int i=0; i<24; i++) {
+ rv+="?,";
+ }
+ rv+="?";
+ return rv;
+}
+
+std::string multiplet::print(int full_subtables, int show_ids, int no_refs) const {
+ std::ostringstream rv("");
+
+ rv.precision(14);
+ if (show_ids) {
+ rv << id;
+ }
+ rv << ',';
+ rv << version;
+ rv << ',';
+ rv << signal_type;
+ rv << ',';
+ rv << mp_type;
+ rv << ',';
+ rv << qpix;
+ rv << ',';
+ rv << freq_win;
+ rv << ',';
+ rv << mean_ra;
+ rv << ',';
+ rv << mean_decl;
+ rv << ',';
+ rv << ra_stddev;
+ rv << ',';
+ rv << decl_stddev;
+ rv << ',';
+ rv << mean_angular_distance;
+ rv << ',';
+ rv << angular_distance_stddev;
+ rv << ',';
+ rv << mean_frequency;
+ rv << ',';
+ rv << frequency_stddev;
+ rv << ',';
+ rv << mean_chirp;
+ rv << ',';
+ rv << chirp_stddev;
+ rv << ',';
+ rv << mean_period;
+ rv << ',';
+ rv << period_stddev;
+ rv << ',';
+ rv << mean_snr;
+ rv << ',';
+ rv << snr_stddev;
+ rv << ',';
+ rv << mean_threshold;
+ rv << ',';
+ rv << threshold_stddev;
+ rv << ',';
+ rv << score;
+ rv << ',';
+ rv << num_detections;
+ rv << ',';
+ rv << "LIST {";
+ {
+ std::vector<sqlint8_t>::const_iterator p=signal_ids.begin();
+ for (; p<signal_ids.end(); p++) {
+ rv << *p;
+ if (p != signal_ids.end()-1) {
+ rv << ',';
+ } else {
+ rv << "}";
+ }
+ }
+ }
+ return rv.str();
+}
+
+
+std::string multiplet::print_xml(int full_subtables, int show_ids, int no_refs,const char *tag) const {
+ std::ostringstream rv("");
+
+ rv.precision(14);
+ rv << xml_indent() << '<' << tag << ">\n";
+ xml_indent(2);
+ if (show_ids) {
+ rv << xml_indent() << "<id>" << id << "</id>\n";
+ }
+ rv << xml_indent() << "<version>" << version << "</version>\n";
+ rv << xml_indent() << "<signal_type>" << signal_type << "</signal_type>\n";
+ rv << xml_indent() << "<mp_type>" << mp_type << "</mp_type>\n";
+ rv << xml_indent() << "<qpix>" << qpix << "</qpix>\n";
+ rv << xml_indent() << "<freq_win>" << freq_win << "</freq_win>\n";
+ rv << xml_indent() << "<mean_ra>" << mean_ra << "</mean_ra>\n";
+ rv << xml_indent() << "<mean_decl>" << mean_decl << "</mean_decl>\n";
+ rv << xml_indent() << "<ra_stddev>" << ra_stddev << "</ra_stddev>\n";
+ rv << xml_indent() << "<decl_stddev>" << decl_stddev << "</decl_stddev>\n";
+ rv << xml_indent() << "<mean_angular_distance>" << mean_angular_distance << "</mean_angular_distance>\n";
+ rv << xml_indent() << "<angular_distance_stddev>" << angular_distance_stddev << "</angular_distance_stddev>\n";
+ rv << xml_indent() << "<mean_frequency>" << mean_frequency << "</mean_frequency>\n";
+ rv << xml_indent() << "<frequency_stddev>" << frequency_stddev << "</frequency_stddev>\n";
+ rv << xml_indent() << "<mean_chirp>" << mean_chirp << "</mean_chirp>\n";
+ rv << xml_indent() << "<chirp_stddev>" << chirp_stddev << "</chirp_stddev>\n";
+ rv << xml_indent() << "<mean_period>" << mean_period << "</mean_period>\n";
+ rv << xml_indent() << "<period_stddev>" << period_stddev << "</period_stddev>\n";
+ rv << xml_indent() << "<mean_snr>" << mean_snr << "</mean_snr>\n";
+ rv << xml_indent() << "<snr_stddev>" << snr_stddev << "</snr_stddev>\n";
+ rv << xml_indent() << "<mean_threshold>" << mean_threshold << "</mean_threshold>\n";
+ rv << xml_indent() << "<threshold_stddev>" << threshold_stddev << "</threshold_stddev>\n";
+ rv << xml_indent() << "<score>" << score << "</score>\n";
+ rv << xml_indent() << "<num_detections>" << num_detections << "</num_detections>\n";
+ if (signal_ids.size()) {
+ rv << xml_indent() << "<signal_ids";
+ {
+ std::string enc_string=signal_ids.print_xml();
+ rv << " length=" << enc_string.size() << " encoding=\"" << xml_encoding_names[signal_ids.encoding] << "\">" ;
+ rv << enc_string;
+ }
+ }
+ rv << "</signal_ids>\n";
+ xml_indent(-2);
+ rv << xml_indent() << "</" << tag << ">\n";
+ return rv.str();
+}
+
+
+void multiplet::parse_xml(const std::string &s,const char *tag) {
+ std::string field,sub;
+ if (extract_xml_record(s,tag,field)) {
+ std::string::size_type pos=0;
+ if (extract_xml_record(field,"id",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> id;
+ }
+ if (extract_xml_record(field,"version",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> version;
+ }
+ if (extract_xml_record(field,"signal_type",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> signal_type;
+ }
+ if (extract_xml_record(field,"mp_type",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> mp_type;
+ }
+ if (extract_xml_record(field,"qpix",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> qpix;
+ }
+ if (extract_xml_record(field,"freq_win",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> freq_win;
+ }
+ if (extract_xml_record(field,"mean_ra",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> mean_ra;
+ }
+ if (extract_xml_record(field,"mean_decl",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> mean_decl;
+ }
+ if (extract_xml_record(field,"ra_stddev",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> ra_stddev;
+ }
+ if (extract_xml_record(field,"decl_stddev",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> decl_stddev;
+ }
+ if (extract_xml_record(field,"mean_angular_distance",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> mean_angular_distance;
+ }
+ if (extract_xml_record(field,"angular_distance_stddev",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> angular_distance_stddev;
+ }
+ if (extract_xml_record(field,"mean_frequency",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> mean_frequency;
+ }
+ if (extract_xml_record(field,"frequency_stddev",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> frequency_stddev;
+ }
+ if (extract_xml_record(field,"mean_chirp",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> mean_chirp;
+ }
+ if (extract_xml_record(field,"chirp_stddev",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> chirp_stddev;
+ }
+ if (extract_xml_record(field,"mean_period",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> mean_period;
+ }
+ if (extract_xml_record(field,"period_stddev",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> period_stddev;
+ }
+ if (extract_xml_record(field,"mean_snr",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> mean_snr;
+ }
+ if (extract_xml_record(field,"snr_stddev",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> snr_stddev;
+ }
+ if (extract_xml_record(field,"mean_threshold",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> mean_threshold;
+ }
+ if (extract_xml_record(field,"threshold_stddev",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> threshold_stddev;
+ }
+ if (extract_xml_record(field,"score",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> score;
+ }
+ if (extract_xml_record(field,"num_detections",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> num_detections;
+ }
+ signal_ids.clear();
+ if (extract_xml_record(field,"signal_ids",sub)) {
+ pos=sub.find(">");
+ do {
+ if (pos!=std::string::npos) {
+ do {
+ pos++;
+ } while ((sub[pos]=='\n') || (sub[pos]==','));
+ std::istringstream in(std::string(sub.c_str()+pos));
+ sqlint8_t tmp;
+ in >> tmp;
+ signal_ids.push_back(tmp);
+ }
+ } while ((pos=sub.find(",",pos)) != std::string::npos);
+ }
+ }
+}
+
+void multiplet::parse(const SQL_ROW &s) {
+ {
+ std::istringstream row(*(s[0]));
+ row >> id;
+ }
+ {
+ std::istringstream row(*(s[1]));
+ row >> version;
+ }
+ {
+ std::istringstream row(*(s[2]));
+ row >> signal_type;
+ }
+ {
+ std::istringstream row(*(s[3]));
+ row >> mp_type;
+ }
+ {
+ std::istringstream row(*(s[4]));
+ row >> qpix;
+ }
+ {
+ std::istringstream row(*(s[5]));
+ row >> freq_win;
+ }
+ {
+ std::istringstream row(*(s[6]));
+ row >> mean_ra;
+ }
+ {
+ std::istringstream row(*(s[7]));
+ row >> mean_decl;
+ }
+ {
+ std::istringstream row(*(s[8]));
+ row >> ra_stddev;
+ }
+ {
+ std::istringstream row(*(s[9]));
+ row >> decl_stddev;
+ }
+ {
+ std::istringstream row(*(s[10]));
+ row >> mean_angular_distance;
+ }
+ {
+ std::istringstream row(*(s[11]));
+ row >> angular_distance_stddev;
+ }
+ {
+ std::istringstream row(*(s[12]));
+ row >> mean_frequency;
+ }
+ {
+ std::istringstream row(*(s[13]));
+ row >> frequency_stddev;
+ }
+ {
+ std::istringstream row(*(s[14]));
+ row >> mean_chirp;
+ }
+ {
+ std::istringstream row(*(s[15]));
+ row >> chirp_stddev;
+ }
+ {
+ std::istringstream row(*(s[16]));
+ row >> mean_period;
+ }
+ {
+ std::istringstream row(*(s[17]));
+ row >> period_stddev;
+ }
+ {
+ std::istringstream row(*(s[18]));
+ row >> mean_snr;
+ }
+ {
+ std::istringstream row(*(s[19]));
+ row >> snr_stddev;
+ }
+ {
+ std::istringstream row(*(s[20]));
+ row >> mean_threshold;
+ }
+ {
+ std::istringstream row(*(s[21]));
+ row >> threshold_stddev;
+ }
+ {
+ std::istringstream row(*(s[22]));
+ row >> score;
+ }
+ {
+ std::istringstream row(*(s[23]));
+ row >> num_detections;
+ }
+ {
+ std::string::size_type p,q;
+ int i;
+ signal_ids.clear();
+ SQL_ROW tmp(s[24]);
+ for (i=0; i<tmp.argc(); i++) {
+ std::istringstream in(*(tmp[i]));
+ sqlint8_t tmp0;
+ in >> tmp0;
+ signal_ids.push_back(tmp0);
+ }
+ }
+}
+
+void multiplet::parse(const std::string &s) {
+ SQL_ROW row(&s,25);
+ parse(row);
+}
+
+template <> const char *const db_table<star>::table_name="star";
+template <> const char *db_table<star>::_search_tag=table_name;
template <> const int db_table<star>::_nfields=14;
-template <> const char * const db_table<star>::column_names[14]={"id","object_type","catalog_name","catalog_number","object_name","ra","decl","qpix","v_mag","b_minus_v","parallax","stellar_type","planets","score"};
-
-star::star() :
- db_table<star>(*this,-1),
- id(0),
- catalog_number(0),
- ra(0),
- decl(0),
- qpix(0),
- v_mag(0),
- b_minus_v(0),
- parallax(0),
- planets(0),
- score(0)
-{
- db_open();
- object_type[0]=0;
- catalog_name[0]=0;
- object_name[0]=0;
- stellar_type[0]=0;
-}
-
-
-star::star(const star &a) :
- db_table<star>(*this,-1),
- id(a.id),
- catalog_number(a.catalog_number),
- ra(a.ra),
- decl(a.decl),
- qpix(a.qpix),
- v_mag(a.v_mag),
- b_minus_v(a.b_minus_v),
- parallax(a.parallax),
- planets(a.planets),
- score(a.score)
-{
- db_open();
- strcpy(object_type,a.object_type);
- strcpy(catalog_name,a.catalog_name);
- strcpy(object_name,a.object_name);
- strcpy(stellar_type,a.stellar_type);
-}
-
-
-star::star(const SQL_ROW &a) :
- db_table<star>(*this,-1)
-{
- db_open();
- parse(a);
-}
-
-
-star::star(const std::string &s,const char *tag) :
- db_table<star>(*this,-1)
-{
- db_open();
- if (xml_match_tag(s,tag)) {
- parse_xml(s,tag);
- } else {
- parse(s);
- }
+template <> const char *const db_table<star>::column_names[14]= {"id","object_type","catalog_name","catalog_number","object_name","ra","decl","qpix","v_mag","b_minus_v","parallax","stellar_type","planets","score"};
+
+star::star() :
+ db_table<star>(*this,-1),
+ id(0),
+ catalog_number(0),
+ ra(0),
+ decl(0),
+ qpix(0),
+ v_mag(0),
+ b_minus_v(0),
+ parallax(0),
+ planets(0),
+ score(0) {
+ db_open();
+ object_type[0]=0;
+ catalog_name[0]=0;
+ object_name[0]=0;
+ stellar_type[0]=0;
+}
+
+
+star::star(const star &a) :
+ db_table<star>(*this,-1),
+ id(a.id),
+ catalog_number(a.catalog_number),
+ ra(a.ra),
+ decl(a.decl),
+ qpix(a.qpix),
+ v_mag(a.v_mag),
+ b_minus_v(a.b_minus_v),
+ parallax(a.parallax),
+ planets(a.planets),
+ score(a.score) {
+ db_open();
+ strcpy(object_type,a.object_type);
+ strcpy(catalog_name,a.catalog_name);
+ strcpy(object_name,a.object_name);
+ strcpy(stellar_type,a.stellar_type);
+}
+
+
+star::star(const SQL_ROW &a) :
+ db_table<star>(*this,-1) {
+ db_open();
+ parse(a);
+}
+
+
+star::star(const std::string &s,const char *tag) :
+ db_table<star>(*this,-1) {
+ db_open();
+ if (xml_match_tag(s,tag)) {
+ parse_xml(s,tag);
+ } else {
+ parse(s);
+ }
}
star &star::operator =(const star &a) {
- if (&a != this) {
- id=a.id;
- catalog_number=a.catalog_number;
- ra=a.ra;
- decl=a.decl;
- qpix=a.qpix;
- v_mag=a.v_mag;
- b_minus_v=a.b_minus_v;
- parallax=a.parallax;
- planets=a.planets;
- score=a.score;
- strcpy(object_type,a.object_type);
- strcpy(catalog_name,a.catalog_name);
- strcpy(object_name,a.object_name);
- strcpy(stellar_type,a.stellar_type);
- }
- return (*this);
-}
-
-
-std::string star::update_format() const
-{ std::ostringstream rv("");
-
- for (int i=2;i<14;i++) rv << "?,";
- rv << "?";
- return rv.str();
-}
-
-
-std::string star::insert_format() const
-{ return std::string("?,")+update_format();
-}
-
-std::string star::select_format() const
-{
-std::string rv("");
-for (int i=0; i<13;i++) rv+="?,";
-rv+="?";
-return rv;
-}
-
-std::string star::print(int full_subtables, int show_ids, int no_refs) const
-{ std::ostringstream rv("");
-
- rv.precision(14);
- if (show_ids) rv << id;
- rv << ',';
- rv << "'" << object_type << "'";
- rv << ',';
- rv << "'" << catalog_name << "'";
- rv << ',';
- rv << catalog_number;
- rv << ',';
- rv << "'" << object_name << "'";
- rv << ',';
- rv << ra;
- rv << ',';
- rv << decl;
- rv << ',';
- rv << qpix;
- rv << ',';
- rv << v_mag;
- rv << ',';
- rv << b_minus_v;
- rv << ',';
- rv << parallax;
- rv << ',';
- rv << "'" << stellar_type << "'";
- rv << ',';
- rv << planets;
- rv << ',';
- rv << score;
- return rv.str();
-}
-
-
-std::string star::print_xml(int full_subtables, int show_ids, int no_refs,const char *tag) const
-{
- std::ostringstream rv("");
-
- rv.precision(14);
- rv << xml_indent() << '<' << tag << ">\n";
- xml_indent(2);
- if (show_ids) rv << xml_indent() << "<id>" << id << "</id>\n";
- {
- std::string enc_field=xml_encode_string(object_type,std::min(strlen(object_type),sizeof(object_type)));
- rv << xml_indent() << "<object_type>";
- rv << enc_field << "</object_type>\n";
- }
- {
- std::string enc_field=xml_encode_string(catalog_name,std::min(strlen(catalog_name),sizeof(catalog_name)));
- rv << xml_indent() << "<catalog_name>";
- rv << enc_field << "</catalog_name>\n";
- }
- rv << xml_indent() << "<catalog_number>" << catalog_number << "</catalog_number>\n";
- {
- std::string enc_field=xml_encode_string(object_name,std::min(strlen(object_name),sizeof(object_name)));
- rv << xml_indent() << "<object_name>";
- rv << enc_field << "</object_name>\n";
- }
- rv << xml_indent() << "<ra>" << ra << "</ra>\n";
- rv << xml_indent() << "<decl>" << decl << "</decl>\n";
- rv << xml_indent() << "<qpix>" << qpix << "</qpix>\n";
- rv << xml_indent() << "<v_mag>" << v_mag << "</v_mag>\n";
- rv << xml_indent() << "<b_minus_v>" << b_minus_v << "</b_minus_v>\n";
- rv << xml_indent() << "<parallax>" << parallax << "</parallax>\n";
- {
- std::string enc_field=xml_encode_string(stellar_type,std::min(strlen(stellar_type),sizeof(stellar_type)));
- rv << xml_indent() << "<stellar_type>";
- rv << enc_field << "</stellar_type>\n";
- }
- rv << xml_indent() << "<planets>" << planets << "</planets>\n";
- rv << xml_indent() << "<score>" << score << "</score>\n";
- xml_indent(-2);
- rv << xml_indent() << "</" << tag << ">\n";
- return rv.str();
-}
-
-
- void star::parse_xml(const std::string &s,const char *tag) {
- std::string field,sub;
- if (extract_xml_record(s,tag,field)) {
- std::string::size_type pos=0;
- if (extract_xml_record(field,"id",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> id;
- }
- if (extract_xml_record(field,"object_type",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::string::size_type epos=sub.find("<",pos);
- if (epos==std::string::npos) epos=sub.find('\n',pos);
- if (epos==std::string::npos) epos=pos+strlen(sub.c_str()+pos);
- std::vector<unsigned char> in(xml_decode_string<unsigned char>((const char *)sub.c_str()+pos,epos-pos));
- strncpy(object_type,(const char *)&(in.front()),std::min(in.size(),(size_t)16));
- object_type[std::min(in.size(),(size_t)15)]=0;
- }
- if (extract_xml_record(field,"catalog_name",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::string::size_type epos=sub.find("<",pos);
- if (epos==std::string::npos) epos=sub.find('\n',pos);
- if (epos==std::string::npos) epos=pos+strlen(sub.c_str()+pos);
- std::vector<unsigned char> in(xml_decode_string<unsigned char>((const char *)sub.c_str()+pos,epos-pos));
- strncpy(catalog_name,(const char *)&(in.front()),std::min(in.size(),(size_t)64));
- catalog_name[std::min(in.size(),(size_t)63)]=0;
- }
- if (extract_xml_record(field,"catalog_number",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> catalog_number;
- }
- if (extract_xml_record(field,"object_name",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::string::size_type epos=sub.find("<",pos);
- if (epos==std::string::npos) epos=sub.find('\n',pos);
- if (epos==std::string::npos) epos=pos+strlen(sub.c_str()+pos);
- std::vector<unsigned char> in(xml_decode_string<unsigned char>((const char *)sub.c_str()+pos,epos-pos));
- strncpy(object_name,(const char *)&(in.front()),std::min(in.size(),(size_t)64));
- object_name[std::min(in.size(),(size_t)63)]=0;
- }
- if (extract_xml_record(field,"ra",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> ra;
- }
- if (extract_xml_record(field,"decl",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> decl;
- }
- if (extract_xml_record(field,"qpix",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> qpix;
- }
- if (extract_xml_record(field,"v_mag",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> v_mag;
- }
- if (extract_xml_record(field,"b_minus_v",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> b_minus_v;
- }
- if (extract_xml_record(field,"parallax",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> parallax;
- }
- if (extract_xml_record(field,"stellar_type",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::string::size_type epos=sub.find("<",pos);
- if (epos==std::string::npos) epos=sub.find('\n',pos);
- if (epos==std::string::npos) epos=pos+strlen(sub.c_str()+pos);
- std::vector<unsigned char> in(xml_decode_string<unsigned char>((const char *)sub.c_str()+pos,epos-pos));
- strncpy(stellar_type,(const char *)&(in.front()),std::min(in.size(),(size_t)32));
- stellar_type[std::min(in.size(),(size_t)31)]=0;
- }
- if (extract_xml_record(field,"planets",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> planets;
- }
- if (extract_xml_record(field,"score",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> score;
- }
- }
- }
-
- void star::parse(const SQL_ROW &s) {
- {
- std::istringstream row(*(s[0]));
- row >> id;
- }
- {
- strncpy(object_type,s[1]->c_str(),16);
- object_type[15]=0;
- }
- {
- strncpy(catalog_name,s[2]->c_str(),64);
- catalog_name[63]=0;
- }
- {
- std::istringstream row(*(s[3]));
- row >> catalog_number;
- }
- {
- strncpy(object_name,s[4]->c_str(),64);
- object_name[63]=0;
- }
- {
- std::istringstream row(*(s[5]));
- row >> ra;
- }
- {
- std::istringstream row(*(s[6]));
- row >> decl;
- }
- {
- std::istringstream row(*(s[7]));
- row >> qpix;
- }
- {
- std::istringstream row(*(s[8]));
- row >> v_mag;
- }
- {
- std::istringstream row(*(s[9]));
- row >> b_minus_v;
- }
- {
- std::istringstream row(*(s[10]));
- row >> parallax;
- }
- {
- strncpy(stellar_type,s[11]->c_str(),32);
- stellar_type[31]=0;
- }
- {
- std::istringstream row(*(s[12]));
- row >> planets;
- }
- {
- std::istringstream row(*(s[13]));
- row >> score;
- }
- }
-
- void star::parse(const std::string &s) {
- SQL_ROW row(&s,14);
- parse(row);
- }
-
-template <> const char * const db_table<candidate_count>::table_name="candidate_count";
-template <> const char * db_table<candidate_count>::_search_tag=table_name;
+ if (&a != this) {
+ id=a.id;
+ catalog_number=a.catalog_number;
+ ra=a.ra;
+ decl=a.decl;
+ qpix=a.qpix;
+ v_mag=a.v_mag;
+ b_minus_v=a.b_minus_v;
+ parallax=a.parallax;
+ planets=a.planets;
+ score=a.score;
+ strcpy(object_type,a.object_type);
+ strcpy(catalog_name,a.catalog_name);
+ strcpy(object_name,a.object_name);
+ strcpy(stellar_type,a.stellar_type);
+ }
+ return (*this);
+}
+
+
+std::string star::update_format() const {
+ std::ostringstream rv("");
+
+ for (int i=2; i<14; i++) {
+ rv << "?,";
+ }
+ rv << "?";
+ return rv.str();
+}
+
+
+std::string star::insert_format() const {
+ return std::string("?,")+update_format();
+}
+
+std::string star::select_format() const {
+ std::string rv("");
+ for (int i=0; i<13; i++) {
+ rv+="?,";
+ }
+ rv+="?";
+ return rv;
+}
+
+std::string star::print(int full_subtables, int show_ids, int no_refs) const {
+ std::ostringstream rv("");
+
+ rv.precision(14);
+ if (show_ids) {
+ rv << id;
+ }
+ rv << ',';
+ rv << "'" << object_type << "'";
+ rv << ',';
+ rv << "'" << catalog_name << "'";
+ rv << ',';
+ rv << catalog_number;
+ rv << ',';
+ rv << "'" << object_name << "'";
+ rv << ',';
+ rv << ra;
+ rv << ',';
+ rv << decl;
+ rv << ',';
+ rv << qpix;
+ rv << ',';
+ rv << v_mag;
+ rv << ',';
+ rv << b_minus_v;
+ rv << ',';
+ rv << parallax;
+ rv << ',';
+ rv << "'" << stellar_type << "'";
+ rv << ',';
+ rv << planets;
+ rv << ',';
+ rv << score;
+ return rv.str();
+}
+
+
+std::string star::print_xml(int full_subtables, int show_ids, int no_refs,const char *tag) const {
+ std::ostringstream rv("");
+
+ rv.precision(14);
+ rv << xml_indent() << '<' << tag << ">\n";
+ xml_indent(2);
+ if (show_ids) {
+ rv << xml_indent() << "<id>" << id << "</id>\n";
+ }
+ {
+ std::string enc_field=xml_encode_string(object_type,std::min(strlen(object_type),sizeof(object_type)));
+ rv << xml_indent() << "<object_type>";
+ rv << enc_field << "</object_type>\n";
+ }
+ {
+ std::string enc_field=xml_encode_string(catalog_name,std::min(strlen(catalog_name),sizeof(catalog_name)));
+ rv << xml_indent() << "<catalog_name>";
+ rv << enc_field << "</catalog_name>\n";
+ }
+ rv << xml_indent() << "<catalog_number>" << catalog_number << "</catalog_number>\n";
+ {
+ std::string enc_field=xml_encode_string(object_name,std::min(strlen(object_name),sizeof(object_name)));
+ rv << xml_indent() << "<object_name>";
+ rv << enc_field << "</object_name>\n";
+ }
+ rv << xml_indent() << "<ra>" << ra << "</ra>\n";
+ rv << xml_indent() << "<decl>" << decl << "</decl>\n";
+ rv << xml_indent() << "<qpix>" << qpix << "</qpix>\n";
+ rv << xml_indent() << "<v_mag>" << v_mag << "</v_mag>\n";
+ rv << xml_indent() << "<b_minus_v>" << b_minus_v << "</b_minus_v>\n";
+ rv << xml_indent() << "<parallax>" << parallax << "</parallax>\n";
+ {
+ std::string enc_field=xml_encode_string(stellar_type,std::min(strlen(stellar_type),sizeof(stellar_type)));
+ rv << xml_indent() << "<stellar_type>";
+ rv << enc_field << "</stellar_type>\n";
+ }
+ rv << xml_indent() << "<planets>" << planets << "</planets>\n";
+ rv << xml_indent() << "<score>" << score << "</score>\n";
+ xml_indent(-2);
+ rv << xml_indent() << "</" << tag << ">\n";
+ return rv.str();
+}
+
+
+void star::parse_xml(const std::string &s,const char *tag) {
+ std::string field,sub;
+ if (extract_xml_record(s,tag,field)) {
+ std::string::size_type pos=0;
+ if (extract_xml_record(field,"id",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> id;
+ }
+ if (extract_xml_record(field,"object_type",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::string::size_type epos=sub.find("<",pos);
+ if (epos==std::string::npos) {
+ epos=sub.find('\n',pos);
+ }
+ if (epos==std::string::npos) {
+ epos=pos+strlen(sub.c_str()+pos);
+ }
+ std::vector<unsigned char> in(xml_decode_string<unsigned char>((const char *)sub.c_str()+pos,epos-pos));
+ strncpy(object_type,(const char *)&(in.front()),std::min(in.size(),(size_t)16));
+ object_type[std::min(in.size(),(size_t)15)]=0;
+ }
+ if (extract_xml_record(field,"catalog_name",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::string::size_type epos=sub.find("<",pos);
+ if (epos==std::string::npos) {
+ epos=sub.find('\n',pos);
+ }
+ if (epos==std::string::npos) {
+ epos=pos+strlen(sub.c_str()+pos);
+ }
+ std::vector<unsigned char> in(xml_decode_string<unsigned char>((const char *)sub.c_str()+pos,epos-pos));
+ strncpy(catalog_name,(const char *)&(in.front()),std::min(in.size(),(size_t)64));
+ catalog_name[std::min(in.size(),(size_t)63)]=0;
+ }
+ if (extract_xml_record(field,"catalog_number",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> catalog_number;
+ }
+ if (extract_xml_record(field,"object_name",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::string::size_type epos=sub.find("<",pos);
+ if (epos==std::string::npos) {
+ epos=sub.find('\n',pos);
+ }
+ if (epos==std::string::npos) {
+ epos=pos+strlen(sub.c_str()+pos);
+ }
+ std::vector<unsigned char> in(xml_decode_string<unsigned char>((const char *)sub.c_str()+pos,epos-pos));
+ strncpy(object_name,(const char *)&(in.front()),std::min(in.size(),(size_t)64));
+ object_name[std::min(in.size(),(size_t)63)]=0;
+ }
+ if (extract_xml_record(field,"ra",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> ra;
+ }
+ if (extract_xml_record(field,"decl",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> decl;
+ }
+ if (extract_xml_record(field,"qpix",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> qpix;
+ }
+ if (extract_xml_record(field,"v_mag",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> v_mag;
+ }
+ if (extract_xml_record(field,"b_minus_v",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> b_minus_v;
+ }
+ if (extract_xml_record(field,"parallax",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> parallax;
+ }
+ if (extract_xml_record(field,"stellar_type",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::string::size_type epos=sub.find("<",pos);
+ if (epos==std::string::npos) {
+ epos=sub.find('\n',pos);
+ }
+ if (epos==std::string::npos) {
+ epos=pos+strlen(sub.c_str()+pos);
+ }
+ std::vector<unsigned char> in(xml_decode_string<unsigned char>((const char *)sub.c_str()+pos,epos-pos));
+ strncpy(stellar_type,(const char *)&(in.front()),std::min(in.size(),(size_t)32));
+ stellar_type[std::min(in.size(),(size_t)31)]=0;
+ }
+ if (extract_xml_record(field,"planets",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> planets;
+ }
+ if (extract_xml_record(field,"score",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> score;
+ }
+ }
+}
+
+void star::parse(const SQL_ROW &s) {
+ {
+ std::istringstream row(*(s[0]));
+ row >> id;
+ }
+ {
+ strncpy(object_type,s[1]->c_str(),16);
+ object_type[15]=0;
+ }
+ {
+ strncpy(catalog_name,s[2]->c_str(),64);
+ catalog_name[63]=0;
+ }
+ {
+ std::istringstream row(*(s[3]));
+ row >> catalog_number;
+ }
+ {
+ strncpy(object_name,s[4]->c_str(),64);
+ object_name[63]=0;
+ }
+ {
+ std::istringstream row(*(s[5]));
+ row >> ra;
+ }
+ {
+ std::istringstream row(*(s[6]));
+ row >> decl;
+ }
+ {
+ std::istringstream row(*(s[7]));
+ row >> qpix;
+ }
+ {
+ std::istringstream row(*(s[8]));
+ row >> v_mag;
+ }
+ {
+ std::istringstream row(*(s[9]));
+ row >> b_minus_v;
+ }
+ {
+ std::istringstream row(*(s[10]));
+ row >> parallax;
+ }
+ {
+ strncpy(stellar_type,s[11]->c_str(),32);
+ stellar_type[31]=0;
+ }
+ {
+ std::istringstream row(*(s[12]));
+ row >> planets;
+ }
+ {
+ std::istringstream row(*(s[13]));
+ row >> score;
+ }
+}
+
+void star::parse(const std::string &s) {
+ SQL_ROW row(&s,14);
+ parse(row);
+}
+
+template <> const char *const db_table<candidate_count>::table_name="candidate_count";
+template <> const char *db_table<candidate_count>::_search_tag=table_name;
template <> const int db_table<candidate_count>::_nfields=15;
-template <> const char * const db_table<candidate_count>::column_names[15]={"id","spikes","gaussians","pulses","triplets","spike_barycentric_multiplets","gaussian_barycentric_multiplets","pulse_barycentric_multiplets","triplet_barycentric_multiplets","spike_nonbarycentric_multiplets","gaussian_nonbarycentric_multiplets","pulse_nonbarycentric_multiplets","triplet_nonbarycentric_multiplets","stars","time_last_updated"};
-
-candidate_count::candidate_count() :
- db_table<candidate_count>(*this,-1),
- id(0),
- spikes(0),
- gaussians(0),
- pulses(0),
- triplets(0),
- spike_barycentric_multiplets(0),
- gaussian_barycentric_multiplets(0),
- pulse_barycentric_multiplets(0),
- triplet_barycentric_multiplets(0),
- spike_nonbarycentric_multiplets(0),
- gaussian_nonbarycentric_multiplets(0),
- pulse_nonbarycentric_multiplets(0),
- triplet_nonbarycentric_multiplets(0),
- stars(0),
- time_last_updated(0)
-{
- db_open();
-}
-
-
-candidate_count::candidate_count(const candidate_count &a) :
- db_table<candidate_count>(*this,-1),
- id(a.id),
- spikes(a.spikes),
- gaussians(a.gaussians),
- pulses(a.pulses),
- triplets(a.triplets),
- spike_barycentric_multiplets(a.spike_barycentric_multiplets),
- gaussian_barycentric_multiplets(a.gaussian_barycentric_multiplets),
- pulse_barycentric_multiplets(a.pulse_barycentric_multiplets),
- triplet_barycentric_multiplets(a.triplet_barycentric_multiplets),
- spike_nonbarycentric_multiplets(a.spike_nonbarycentric_multiplets),
- gaussian_nonbarycentric_multiplets(a.gaussian_nonbarycentric_multiplets),
- pulse_nonbarycentric_multiplets(a.pulse_nonbarycentric_multiplets),
- triplet_nonbarycentric_multiplets(a.triplet_nonbarycentric_multiplets),
- stars(a.stars),
- time_last_updated(a.time_last_updated)
-{
- db_open();
-}
-
-
-candidate_count::candidate_count(const SQL_ROW &a) :
- db_table<candidate_count>(*this,-1)
-{
- db_open();
- parse(a);
-}
-
-
-candidate_count::candidate_count(const std::string &s,const char *tag) :
- db_table<candidate_count>(*this,-1)
-{
- db_open();
- if (xml_match_tag(s,tag)) {
- parse_xml(s,tag);
- } else {
- parse(s);
- }
+template <> const char *const db_table<candidate_count>::column_names[15]= {"id","spikes","gaussians","pulses","triplets","spike_barycentric_multiplets","gaussian_barycentric_multiplets","pulse_barycentric_multiplets","triplet_barycentric_multiplets","spike_nonbarycentric_multiplets","gaussian_nonbarycentric_multiplets","pulse_nonbarycentric_multiplets","triplet_nonbarycentric_multiplets","stars","time_last_updated"};
+
+candidate_count::candidate_count() :
+ db_table<candidate_count>(*this,-1),
+ id(0),
+ spikes(0),
+ gaussians(0),
+ pulses(0),
+ triplets(0),
+ spike_barycentric_multiplets(0),
+ gaussian_barycentric_multiplets(0),
+ pulse_barycentric_multiplets(0),
+ triplet_barycentric_multiplets(0),
+ spike_nonbarycentric_multiplets(0),
+ gaussian_nonbarycentric_multiplets(0),
+ pulse_nonbarycentric_multiplets(0),
+ triplet_nonbarycentric_multiplets(0),
+ stars(0),
+ time_last_updated(0) {
+ db_open();
+}
+
+
+candidate_count::candidate_count(const candidate_count &a) :
+ db_table<candidate_count>(*this,-1),
+ id(a.id),
+ spikes(a.spikes),
+ gaussians(a.gaussians),
+ pulses(a.pulses),
+ triplets(a.triplets),
+ spike_barycentric_multiplets(a.spike_barycentric_multiplets),
+ gaussian_barycentric_multiplets(a.gaussian_barycentric_multiplets),
+ pulse_barycentric_multiplets(a.pulse_barycentric_multiplets),
+ triplet_barycentric_multiplets(a.triplet_barycentric_multiplets),
+ spike_nonbarycentric_multiplets(a.spike_nonbarycentric_multiplets),
+ gaussian_nonbarycentric_multiplets(a.gaussian_nonbarycentric_multiplets),
+ pulse_nonbarycentric_multiplets(a.pulse_nonbarycentric_multiplets),
+ triplet_nonbarycentric_multiplets(a.triplet_nonbarycentric_multiplets),
+ stars(a.stars),
+ time_last_updated(a.time_last_updated) {
+ db_open();
+}
+
+
+candidate_count::candidate_count(const SQL_ROW &a) :
+ db_table<candidate_count>(*this,-1) {
+ db_open();
+ parse(a);
+}
+
+
+candidate_count::candidate_count(const std::string &s,const char *tag) :
+ db_table<candidate_count>(*this,-1) {
+ db_open();
+ if (xml_match_tag(s,tag)) {
+ parse_xml(s,tag);
+ } else {
+ parse(s);
+ }
}
candidate_count &candidate_count::operator =(const candidate_count &a) {
- if (&a != this) {
- id=a.id;
- spikes=a.spikes;
- gaussians=a.gaussians;
- pulses=a.pulses;
- triplets=a.triplets;
- spike_barycentric_multiplets=a.spike_barycentric_multiplets;
- gaussian_barycentric_multiplets=a.gaussian_barycentric_multiplets;
- pulse_barycentric_multiplets=a.pulse_barycentric_multiplets;
- triplet_barycentric_multiplets=a.triplet_barycentric_multiplets;
- spike_nonbarycentric_multiplets=a.spike_nonbarycentric_multiplets;
- gaussian_nonbarycentric_multiplets=a.gaussian_nonbarycentric_multiplets;
- pulse_nonbarycentric_multiplets=a.pulse_nonbarycentric_multiplets;
- triplet_nonbarycentric_multiplets=a.triplet_nonbarycentric_multiplets;
- stars=a.stars;
- time_last_updated=a.time_last_updated;
- }
- return (*this);
-}
-
-
-std::string candidate_count::update_format() const
-{ std::ostringstream rv("");
-
- for (int i=2;i<15;i++) rv << "?,";
- rv << "?";
- return rv.str();
-}
-
-
-std::string candidate_count::insert_format() const
-{ return std::string("?,")+update_format();
-}
-
-std::string candidate_count::select_format() const
-{
-std::string rv("");
-for (int i=0; i<14;i++) rv+="?,";
-rv+="?";
-return rv;
-}
-
-std::string candidate_count::print(int full_subtables, int show_ids, int no_refs) const
-{ std::ostringstream rv("");
-
- rv.precision(14);
- if (show_ids) rv << id;
- rv << ',';
- rv << spikes;
- rv << ',';
- rv << gaussians;
- rv << ',';
- rv << pulses;
- rv << ',';
- rv << triplets;
- rv << ',';
- rv << spike_barycentric_multiplets;
- rv << ',';
- rv << gaussian_barycentric_multiplets;
- rv << ',';
- rv << pulse_barycentric_multiplets;
- rv << ',';
- rv << triplet_barycentric_multiplets;
- rv << ',';
- rv << spike_nonbarycentric_multiplets;
- rv << ',';
- rv << gaussian_nonbarycentric_multiplets;
- rv << ',';
- rv << pulse_nonbarycentric_multiplets;
- rv << ',';
- rv << triplet_nonbarycentric_multiplets;
- rv << ',';
- rv << stars;
- rv << ',';
- rv << time_last_updated;
- return rv.str();
-}
-
-
-std::string candidate_count::print_xml(int full_subtables, int show_ids, int no_refs,const char *tag) const
-{
- std::ostringstream rv("");
-
- rv.precision(14);
- rv << xml_indent() << '<' << tag << ">\n";
- xml_indent(2);
- if (show_ids) rv << xml_indent() << "<id>" << id << "</id>\n";
- rv << xml_indent() << "<spikes>" << spikes << "</spikes>\n";
- rv << xml_indent() << "<gaussians>" << gaussians << "</gaussians>\n";
- rv << xml_indent() << "<pulses>" << pulses << "</pulses>\n";
- rv << xml_indent() << "<triplets>" << triplets << "</triplets>\n";
- rv << xml_indent() << "<spike_barycentric_multiplets>" << spike_barycentric_multiplets << "</spike_barycentric_multiplets>\n";
- rv << xml_indent() << "<gaussian_barycentric_multiplets>" << gaussian_barycentric_multiplets << "</gaussian_barycentric_multiplets>\n";
- rv << xml_indent() << "<pulse_barycentric_multiplets>" << pulse_barycentric_multiplets << "</pulse_barycentric_multiplets>\n";
- rv << xml_indent() << "<triplet_barycentric_multiplets>" << triplet_barycentric_multiplets << "</triplet_barycentric_multiplets>\n";
- rv << xml_indent() << "<spike_nonbarycentric_multiplets>" << spike_nonbarycentric_multiplets << "</spike_nonbarycentric_multiplets>\n";
- rv << xml_indent() << "<gaussian_nonbarycentric_multiplets>" << gaussian_nonbarycentric_multiplets << "</gaussian_nonbarycentric_multiplets>\n";
- rv << xml_indent() << "<pulse_nonbarycentric_multiplets>" << pulse_nonbarycentric_multiplets << "</pulse_nonbarycentric_multiplets>\n";
- rv << xml_indent() << "<triplet_nonbarycentric_multiplets>" << triplet_nonbarycentric_multiplets << "</triplet_nonbarycentric_multiplets>\n";
- rv << xml_indent() << "<stars>" << stars << "</stars>\n";
- rv << xml_indent() << "<time_last_updated>" << time_last_updated << "</time_last_updated>\n";
- xml_indent(-2);
- rv << xml_indent() << "</" << tag << ">\n";
- return rv.str();
-}
-
-
- void candidate_count::parse_xml(const std::string &s,const char *tag) {
- std::string field,sub;
- if (extract_xml_record(s,tag,field)) {
- std::string::size_type pos=0;
- if (extract_xml_record(field,"id",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> id;
- }
- if (extract_xml_record(field,"spikes",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> spikes;
- }
- if (extract_xml_record(field,"gaussians",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> gaussians;
- }
- if (extract_xml_record(field,"pulses",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> pulses;
- }
- if (extract_xml_record(field,"triplets",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> triplets;
- }
- if (extract_xml_record(field,"spike_barycentric_multiplets",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> spike_barycentric_multiplets;
- }
- if (extract_xml_record(field,"gaussian_barycentric_multiplets",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> gaussian_barycentric_multiplets;
- }
- if (extract_xml_record(field,"pulse_barycentric_multiplets",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> pulse_barycentric_multiplets;
- }
- if (extract_xml_record(field,"triplet_barycentric_multiplets",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> triplet_barycentric_multiplets;
- }
- if (extract_xml_record(field,"spike_nonbarycentric_multiplets",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> spike_nonbarycentric_multiplets;
- }
- if (extract_xml_record(field,"gaussian_nonbarycentric_multiplets",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> gaussian_nonbarycentric_multiplets;
- }
- if (extract_xml_record(field,"pulse_nonbarycentric_multiplets",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> pulse_nonbarycentric_multiplets;
- }
- if (extract_xml_record(field,"triplet_nonbarycentric_multiplets",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> triplet_nonbarycentric_multiplets;
- }
- if (extract_xml_record(field,"stars",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> stars;
- }
- if (extract_xml_record(field,"time_last_updated",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> time_last_updated;
- }
- }
- }
-
- void candidate_count::parse(const SQL_ROW &s) {
- {
- std::istringstream row(*(s[0]));
- row >> id;
- }
- {
- std::istringstream row(*(s[1]));
- row >> spikes;
- }
- {
- std::istringstream row(*(s[2]));
- row >> gaussians;
- }
- {
- std::istringstream row(*(s[3]));
- row >> pulses;
- }
- {
- std::istringstream row(*(s[4]));
- row >> triplets;
- }
- {
- std::istringstream row(*(s[5]));
- row >> spike_barycentric_multiplets;
- }
- {
- std::istringstream row(*(s[6]));
- row >> gaussian_barycentric_multiplets;
- }
- {
- std::istringstream row(*(s[7]));
- row >> pulse_barycentric_multiplets;
- }
- {
- std::istringstream row(*(s[8]));
- row >> triplet_barycentric_multiplets;
- }
- {
- std::istringstream row(*(s[9]));
- row >> spike_nonbarycentric_multiplets;
- }
- {
- std::istringstream row(*(s[10]));
- row >> gaussian_nonbarycentric_multiplets;
- }
- {
- std::istringstream row(*(s[11]));
- row >> pulse_nonbarycentric_multiplets;
- }
- {
- std::istringstream row(*(s[12]));
- row >> triplet_nonbarycentric_multiplets;
- }
- {
- std::istringstream row(*(s[13]));
- row >> stars;
- }
- {
- std::istringstream row(*(s[14]));
- row >> time_last_updated;
- }
- }
-
- void candidate_count::parse(const std::string &s) {
- SQL_ROW row(&s,15);
- parse(row);
- }
-
-template <> const char * const db_table<tape>::table_name="tape";
-template <> const char * db_table<tape>::_search_tag=table_name;
+ if (&a != this) {
+ id=a.id;
+ spikes=a.spikes;
+ gaussians=a.gaussians;
+ pulses=a.pulses;
+ triplets=a.triplets;
+ spike_barycentric_multiplets=a.spike_barycentric_multiplets;
+ gaussian_barycentric_multiplets=a.gaussian_barycentric_multiplets;
+ pulse_barycentric_multiplets=a.pulse_barycentric_multiplets;
+ triplet_barycentric_multiplets=a.triplet_barycentric_multiplets;
+ spike_nonbarycentric_multiplets=a.spike_nonbarycentric_multiplets;
+ gaussian_nonbarycentric_multiplets=a.gaussian_nonbarycentric_multiplets;
+ pulse_nonbarycentric_multiplets=a.pulse_nonbarycentric_multiplets;
+ triplet_nonbarycentric_multiplets=a.triplet_nonbarycentric_multiplets;
+ stars=a.stars;
+ time_last_updated=a.time_last_updated;
+ }
+ return (*this);
+}
+
+
+std::string candidate_count::update_format() const {
+ std::ostringstream rv("");
+
+ for (int i=2; i<15; i++) {
+ rv << "?,";
+ }
+ rv << "?";
+ return rv.str();
+}
+
+
+std::string candidate_count::insert_format() const {
+ return std::string("?,")+update_format();
+}
+
+std::string candidate_count::select_format() const {
+ std::string rv("");
+ for (int i=0; i<14; i++) {
+ rv+="?,";
+ }
+ rv+="?";
+ return rv;
+}
+
+std::string candidate_count::print(int full_subtables, int show_ids, int no_refs) const {
+ std::ostringstream rv("");
+
+ rv.precision(14);
+ if (show_ids) {
+ rv << id;
+ }
+ rv << ',';
+ rv << spikes;
+ rv << ',';
+ rv << gaussians;
+ rv << ',';
+ rv << pulses;
+ rv << ',';
+ rv << triplets;
+ rv << ',';
+ rv << spike_barycentric_multiplets;
+ rv << ',';
+ rv << gaussian_barycentric_multiplets;
+ rv << ',';
+ rv << pulse_barycentric_multiplets;
+ rv << ',';
+ rv << triplet_barycentric_multiplets;
+ rv << ',';
+ rv << spike_nonbarycentric_multiplets;
+ rv << ',';
+ rv << gaussian_nonbarycentric_multiplets;
+ rv << ',';
+ rv << pulse_nonbarycentric_multiplets;
+ rv << ',';
+ rv << triplet_nonbarycentric_multiplets;
+ rv << ',';
+ rv << stars;
+ rv << ',';
+ rv << time_last_updated;
+ return rv.str();
+}
+
+
+std::string candidate_count::print_xml(int full_subtables, int show_ids, int no_refs,const char *tag) const {
+ std::ostringstream rv("");
+
+ rv.precision(14);
+ rv << xml_indent() << '<' << tag << ">\n";
+ xml_indent(2);
+ if (show_ids) {
+ rv << xml_indent() << "<id>" << id << "</id>\n";
+ }
+ rv << xml_indent() << "<spikes>" << spikes << "</spikes>\n";
+ rv << xml_indent() << "<gaussians>" << gaussians << "</gaussians>\n";
+ rv << xml_indent() << "<pulses>" << pulses << "</pulses>\n";
+ rv << xml_indent() << "<triplets>" << triplets << "</triplets>\n";
+ rv << xml_indent() << "<spike_barycentric_multiplets>" << spike_barycentric_multiplets << "</spike_barycentric_multiplets>\n";
+ rv << xml_indent() << "<gaussian_barycentric_multiplets>" << gaussian_barycentric_multiplets << "</gaussian_barycentric_multiplets>\n";
+ rv << xml_indent() << "<pulse_barycentric_multiplets>" << pulse_barycentric_multiplets << "</pulse_barycentric_multiplets>\n";
+ rv << xml_indent() << "<triplet_barycentric_multiplets>" << triplet_barycentric_multiplets << "</triplet_barycentric_multiplets>\n";
+ rv << xml_indent() << "<spike_nonbarycentric_multiplets>" << spike_nonbarycentric_multiplets << "</spike_nonbarycentric_multiplets>\n";
+ rv << xml_indent() << "<gaussian_nonbarycentric_multiplets>" << gaussian_nonbarycentric_multiplets << "</gaussian_nonbarycentric_multiplets>\n";
+ rv << xml_indent() << "<pulse_nonbarycentric_multiplets>" << pulse_nonbarycentric_multiplets << "</pulse_nonbarycentric_multiplets>\n";
+ rv << xml_indent() << "<triplet_nonbarycentric_multiplets>" << triplet_nonbarycentric_multiplets << "</triplet_nonbarycentric_multiplets>\n";
+ rv << xml_indent() << "<stars>" << stars << "</stars>\n";
+ rv << xml_indent() << "<time_last_updated>" << time_last_updated << "</time_last_updated>\n";
+ xml_indent(-2);
+ rv << xml_indent() << "</" << tag << ">\n";
+ return rv.str();
+}
+
+
+void candidate_count::parse_xml(const std::string &s,const char *tag) {
+ std::string field,sub;
+ if (extract_xml_record(s,tag,field)) {
+ std::string::size_type pos=0;
+ if (extract_xml_record(field,"id",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> id;
+ }
+ if (extract_xml_record(field,"spikes",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> spikes;
+ }
+ if (extract_xml_record(field,"gaussians",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> gaussians;
+ }
+ if (extract_xml_record(field,"pulses",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> pulses;
+ }
+ if (extract_xml_record(field,"triplets",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> triplets;
+ }
+ if (extract_xml_record(field,"spike_barycentric_multiplets",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> spike_barycentric_multiplets;
+ }
+ if (extract_xml_record(field,"gaussian_barycentric_multiplets",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> gaussian_barycentric_multiplets;
+ }
+ if (extract_xml_record(field,"pulse_barycentric_multiplets",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> pulse_barycentric_multiplets;
+ }
+ if (extract_xml_record(field,"triplet_barycentric_multiplets",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> triplet_barycentric_multiplets;
+ }
+ if (extract_xml_record(field,"spike_nonbarycentric_multiplets",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> spike_nonbarycentric_multiplets;
+ }
+ if (extract_xml_record(field,"gaussian_nonbarycentric_multiplets",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> gaussian_nonbarycentric_multiplets;
+ }
+ if (extract_xml_record(field,"pulse_nonbarycentric_multiplets",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> pulse_nonbarycentric_multiplets;
+ }
+ if (extract_xml_record(field,"triplet_nonbarycentric_multiplets",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> triplet_nonbarycentric_multiplets;
+ }
+ if (extract_xml_record(field,"stars",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> stars;
+ }
+ if (extract_xml_record(field,"time_last_updated",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> time_last_updated;
+ }
+ }
+}
+
+void candidate_count::parse(const SQL_ROW &s) {
+ {
+ std::istringstream row(*(s[0]));
+ row >> id;
+ }
+ {
+ std::istringstream row(*(s[1]));
+ row >> spikes;
+ }
+ {
+ std::istringstream row(*(s[2]));
+ row >> gaussians;
+ }
+ {
+ std::istringstream row(*(s[3]));
+ row >> pulses;
+ }
+ {
+ std::istringstream row(*(s[4]));
+ row >> triplets;
+ }
+ {
+ std::istringstream row(*(s[5]));
+ row >> spike_barycentric_multiplets;
+ }
+ {
+ std::istringstream row(*(s[6]));
+ row >> gaussian_barycentric_multiplets;
+ }
+ {
+ std::istringstream row(*(s[7]));
+ row >> pulse_barycentric_multiplets;
+ }
+ {
+ std::istringstream row(*(s[8]));
+ row >> triplet_barycentric_multiplets;
+ }
+ {
+ std::istringstream row(*(s[9]));
+ row >> spike_nonbarycentric_multiplets;
+ }
+ {
+ std::istringstream row(*(s[10]));
+ row >> gaussian_nonbarycentric_multiplets;
+ }
+ {
+ std::istringstream row(*(s[11]));
+ row >> pulse_nonbarycentric_multiplets;
+ }
+ {
+ std::istringstream row(*(s[12]));
+ row >> triplet_nonbarycentric_multiplets;
+ }
+ {
+ std::istringstream row(*(s[13]));
+ row >> stars;
+ }
+ {
+ std::istringstream row(*(s[14]));
+ row >> time_last_updated;
+ }
+}
+
+void candidate_count::parse(const std::string &s) {
+ SQL_ROW row(&s,15);
+ parse(row);
+}
+
+template <> const char *const db_table<tape>::table_name="tape";
+template <> const char *db_table<tape>::_search_tag=table_name;
template <> const int db_table<tape>::_nfields=8;
-template <> const char * const db_table<tape>::column_names[8]={"id","name","start_time","last_block_time","last_block_done","missed","tape_quality","beam"};
+template <> const char *const db_table<tape>::column_names[8]= {"id","name","start_time","last_block_time","last_block_done","missed","tape_quality","beam"};
-tape::tape() :
- db_table<tape>(*this,-1),
- id(0),
- start_time(0),
- last_block_time(0),
- last_block_done(0),
- missed(0),
- tape_quality(0),
- beam(0)
-{
- db_open();
- name[0]=0;
+tape::tape() :
+ db_table<tape>(*this,-1),
+ id(0),
+ start_time(0),
+ last_block_time(0),
+ last_block_done(0),
+ missed(0),
+ tape_quality(0),
+ beam(0) {
+ db_open();
+ name[0]=0;
}
-tape::tape(const tape &a) :
- db_table<tape>(*this,-1),
- id(a.id),
- start_time(a.start_time),
- last_block_time(a.last_block_time),
- last_block_done(a.last_block_done),
- missed(a.missed),
- tape_quality(a.tape_quality),
- beam(a.beam)
-{
- db_open();
- strcpy(name,a.name);
+tape::tape(const tape &a) :
+ db_table<tape>(*this,-1),
+ id(a.id),
+ start_time(a.start_time),
+ last_block_time(a.last_block_time),
+ last_block_done(a.last_block_done),
+ missed(a.missed),
+ tape_quality(a.tape_quality),
+ beam(a.beam) {
+ db_open();
+ strcpy(name,a.name);
}
-tape::tape(const SQL_ROW &a) :
- db_table<tape>(*this,-1)
-{
- db_open();
- parse(a);
+tape::tape(const SQL_ROW &a) :
+ db_table<tape>(*this,-1) {
+ db_open();
+ parse(a);
}
-tape::tape(const std::string &s,const char *tag) :
- db_table<tape>(*this,-1)
-{
- db_open();
- if (xml_match_tag(s,tag)) {
- parse_xml(s,tag);
- } else {
- parse(s);
- }
+tape::tape(const std::string &s,const char *tag) :
+ db_table<tape>(*this,-1) {
+ db_open();
+ if (xml_match_tag(s,tag)) {
+ parse_xml(s,tag);
+ } else {
+ parse(s);
+ }
}
tape &tape::operator =(const tape &a) {
- if (&a != this) {
- id=a.id;
- start_time=a.start_time;
- last_block_time=a.last_block_time;
- last_block_done=a.last_block_done;
- missed=a.missed;
- tape_quality=a.tape_quality;
- beam=a.beam;
- strcpy(name,a.name);
- }
- return (*this);
-}
-
-
-std::string tape::update_format() const
-{ std::ostringstream rv("");
-
- for (int i=2;i<8;i++) rv << "?,";
- rv << "?";
- return rv.str();
-}
-
-
-std::string tape::insert_format() const
-{ return std::string("?,")+update_format();
-}
-
-std::string tape::select_format() const
-{
-std::string rv("");
-for (int i=0; i<7;i++) rv+="?,";
-rv+="?";
-return rv;
-}
-
-std::string tape::print(int full_subtables, int show_ids, int no_refs) const
-{ std::ostringstream rv("");
-
- rv.precision(14);
- if (show_ids) rv << id;
- rv << ',';
- rv << "'" << name << "'";
- rv << ',';
- rv << start_time;
- rv << ',';
- rv << last_block_time;
- rv << ',';
- rv << last_block_done;
- rv << ',';
- rv << missed;
- rv << ',';
- rv << tape_quality;
- rv << ',';
- rv << beam;
- return rv.str();
-}
-
-
-std::string tape::print_xml(int full_subtables, int show_ids, int no_refs,const char *tag) const
-{
- std::ostringstream rv("");
-
- rv.precision(14);
- rv << xml_indent() << '<' << tag << ">\n";
- xml_indent(2);
- if (show_ids) rv << xml_indent() << "<id>" << id << "</id>\n";
- {
- std::string enc_field=xml_encode_string(name,std::min(strlen(name),sizeof(name)));
- rv << xml_indent() << "<name>";
- rv << enc_field << "</name>\n";
- }
- rv << xml_indent() << "<start_time>" << start_time << "</start_time>\n";
- rv << xml_indent() << "<last_block_time>" << last_block_time << "</last_block_time>\n";
- rv << xml_indent() << "<last_block_done>" << last_block_done << "</last_block_done>\n";
- rv << xml_indent() << "<missed>" << missed << "</missed>\n";
- rv << xml_indent() << "<tape_quality>" << tape_quality << "</tape_quality>\n";
- rv << xml_indent() << "<beam>" << beam << "</beam>\n";
- xml_indent(-2);
- rv << xml_indent() << "</" << tag << ">\n";
- return rv.str();
-}
-
-
- void tape::parse_xml(const std::string &s,const char *tag) {
- std::string field,sub;
- if (extract_xml_record(s,tag,field)) {
- std::string::size_type pos=0;
- if (extract_xml_record(field,"id",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> id;
- }
- if (extract_xml_record(field,"name",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::string::size_type epos=sub.find("<",pos);
- if (epos==std::string::npos) epos=sub.find('\n',pos);
- if (epos==std::string::npos) epos=pos+strlen(sub.c_str()+pos);
- std::vector<unsigned char> in(xml_decode_string<unsigned char>((const char *)sub.c_str()+pos,epos-pos));
- strncpy(name,(const char *)&(in.front()),std::min(in.size(),(size_t)20));
- name[std::min(in.size(),(size_t)19)]=0;
- }
- if (extract_xml_record(field,"start_time",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> start_time;
- }
- if (extract_xml_record(field,"last_block_time",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> last_block_time;
- }
- if (extract_xml_record(field,"last_block_done",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> last_block_done;
- }
- if (extract_xml_record(field,"missed",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> missed;
- }
- if (extract_xml_record(field,"tape_quality",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> tape_quality;
- }
- if (extract_xml_record(field,"beam",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> beam;
- }
- }
- }
-
- void tape::parse(const SQL_ROW &s) {
- {
- std::istringstream row(*(s[0]));
- row >> id;
- }
- {
- strncpy(name,s[1]->c_str(),20);
- name[19]=0;
- }
- {
- std::istringstream row(*(s[2]));
- row >> start_time;
- }
- {
- std::istringstream row(*(s[3]));
- row >> last_block_time;
- }
- {
- std::istringstream row(*(s[4]));
- row >> last_block_done;
- }
- {
- std::istringstream row(*(s[5]));
- row >> missed;
- }
- {
- std::istringstream row(*(s[6]));
- row >> tape_quality;
- }
- {
- std::istringstream row(*(s[7]));
- row >> beam;
- }
- }
-
- void tape::parse(const std::string &s) {
- SQL_ROW row(&s,8);
- parse(row);
- }
-
-template <> const char * const db_table<settings>::table_name="settings";
-template <> const char * db_table<settings>::_search_tag=table_name;
+ if (&a != this) {
+ id=a.id;
+ start_time=a.start_time;
+ last_block_time=a.last_block_time;
+ last_block_done=a.last_block_done;
+ missed=a.missed;
+ tape_quality=a.tape_quality;
+ beam=a.beam;
+ strcpy(name,a.name);
+ }
+ return (*this);
+}
+
+
+std::string tape::update_format() const {
+ std::ostringstream rv("");
+
+ for (int i=2; i<8; i++) {
+ rv << "?,";
+ }
+ rv << "?";
+ return rv.str();
+}
+
+
+std::string tape::insert_format() const {
+ return std::string("?,")+update_format();
+}
+
+std::string tape::select_format() const {
+ std::string rv("");
+ for (int i=0; i<7; i++) {
+ rv+="?,";
+ }
+ rv+="?";
+ return rv;
+}
+
+std::string tape::print(int full_subtables, int show_ids, int no_refs) const {
+ std::ostringstream rv("");
+
+ rv.precision(14);
+ if (show_ids) {
+ rv << id;
+ }
+ rv << ',';
+ rv << "'" << name << "'";
+ rv << ',';
+ rv << start_time;
+ rv << ',';
+ rv << last_block_time;
+ rv << ',';
+ rv << last_block_done;
+ rv << ',';
+ rv << missed;
+ rv << ',';
+ rv << tape_quality;
+ rv << ',';
+ rv << beam;
+ return rv.str();
+}
+
+
+std::string tape::print_xml(int full_subtables, int show_ids, int no_refs,const char *tag) const {
+ std::ostringstream rv("");
+
+ rv.precision(14);
+ rv << xml_indent() << '<' << tag << ">\n";
+ xml_indent(2);
+ if (show_ids) {
+ rv << xml_indent() << "<id>" << id << "</id>\n";
+ }
+ {
+ std::string enc_field=xml_encode_string(name,std::min(strlen(name),sizeof(name)));
+ rv << xml_indent() << "<name>";
+ rv << enc_field << "</name>\n";
+ }
+ rv << xml_indent() << "<start_time>" << start_time << "</start_time>\n";
+ rv << xml_indent() << "<last_block_time>" << last_block_time << "</last_block_time>\n";
+ rv << xml_indent() << "<last_block_done>" << last_block_done << "</last_block_done>\n";
+ rv << xml_indent() << "<missed>" << missed << "</missed>\n";
+ rv << xml_indent() << "<tape_quality>" << tape_quality << "</tape_quality>\n";
+ rv << xml_indent() << "<beam>" << beam << "</beam>\n";
+ xml_indent(-2);
+ rv << xml_indent() << "</" << tag << ">\n";
+ return rv.str();
+}
+
+
+void tape::parse_xml(const std::string &s,const char *tag) {
+ std::string field,sub;
+ if (extract_xml_record(s,tag,field)) {
+ std::string::size_type pos=0;
+ if (extract_xml_record(field,"id",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> id;
+ }
+ if (extract_xml_record(field,"name",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::string::size_type epos=sub.find("<",pos);
+ if (epos==std::string::npos) {
+ epos=sub.find('\n',pos);
+ }
+ if (epos==std::string::npos) {
+ epos=pos+strlen(sub.c_str()+pos);
+ }
+ std::vector<unsigned char> in(xml_decode_string<unsigned char>((const char *)sub.c_str()+pos,epos-pos));
+ strncpy(name,(const char *)&(in.front()),std::min(in.size(),(size_t)20));
+ name[std::min(in.size(),(size_t)19)]=0;
+ }
+ if (extract_xml_record(field,"start_time",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> start_time;
+ }
+ if (extract_xml_record(field,"last_block_time",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> last_block_time;
+ }
+ if (extract_xml_record(field,"last_block_done",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> last_block_done;
+ }
+ if (extract_xml_record(field,"missed",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> missed;
+ }
+ if (extract_xml_record(field,"tape_quality",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> tape_quality;
+ }
+ if (extract_xml_record(field,"beam",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> beam;
+ }
+ }
+}
+
+void tape::parse(const SQL_ROW &s) {
+ {
+ std::istringstream row(*(s[0]));
+ row >> id;
+ }
+ {
+ strncpy(name,s[1]->c_str(),20);
+ name[19]=0;
+ }
+ {
+ std::istringstream row(*(s[2]));
+ row >> start_time;
+ }
+ {
+ std::istringstream row(*(s[3]));
+ row >> last_block_time;
+ }
+ {
+ std::istringstream row(*(s[4]));
+ row >> last_block_done;
+ }
+ {
+ std::istringstream row(*(s[5]));
+ row >> missed;
+ }
+ {
+ std::istringstream row(*(s[6]));
+ row >> tape_quality;
+ }
+ {
+ std::istringstream row(*(s[7]));
+ row >> beam;
+ }
+}
+
+void tape::parse(const std::string &s) {
+ SQL_ROW row(&s,8);
+ parse(row);
+}
+
+template <> const char *const db_table<settings>::table_name="settings";
+template <> const char *db_table<settings>::_search_tag=table_name;
template <> const int db_table<settings>::_nfields=6;
-template <> const char * const db_table<settings>::column_names[6]={"id","active","recorder_cfg","splitter_cfg","analysis_cfg","receiver_cfg"};
+template <> const char *const db_table<settings>::column_names[6]= {"id","active","recorder_cfg","splitter_cfg","analysis_cfg","receiver_cfg"};
-settings::settings() :
- db_table<settings>(*this,-1),
- id(0),
- active(0),
- recorder_cfg(),
- splitter_cfg(),
- analysis_cfg(),
- receiver_cfg()
-{
- db_open();
+settings::settings() :
+ db_table<settings>(*this,-1),
+ id(0),
+ active(0),
+ recorder_cfg(),
+ splitter_cfg(),
+ analysis_cfg(),
+ receiver_cfg() {
+ db_open();
}
-settings::settings(const settings &a) :
- db_table<settings>(*this,-1),
- id(a.id),
- active(a.active),
- recorder_cfg(a.recorder_cfg),
- splitter_cfg(a.splitter_cfg),
- analysis_cfg(a.analysis_cfg),
- receiver_cfg(a.receiver_cfg)
-{
- db_open();
+settings::settings(const settings &a) :
+ db_table<settings>(*this,-1),
+ id(a.id),
+ active(a.active),
+ recorder_cfg(a.recorder_cfg),
+ splitter_cfg(a.splitter_cfg),
+ analysis_cfg(a.analysis_cfg),
+ receiver_cfg(a.receiver_cfg) {
+ db_open();
}
-settings::settings(const SQL_ROW &a) :
- db_table<settings>(*this,-1)
-{
- db_open();
- parse(a);
+settings::settings(const SQL_ROW &a) :
+ db_table<settings>(*this,-1) {
+ db_open();
+ parse(a);
}
-settings::settings(const std::string &s,const char *tag) :
- db_table<settings>(*this,-1)
-{
- db_open();
- if (xml_match_tag(s,tag)) {
- parse_xml(s,tag);
- } else {
- parse(s);
- }
+settings::settings(const std::string &s,const char *tag) :
+ db_table<settings>(*this,-1) {
+ db_open();
+ if (xml_match_tag(s,tag)) {
+ parse_xml(s,tag);
+ } else {
+ parse(s);
+ }
}
settings &settings::operator =(const settings &a) {
- if (&a != this) {
- id=a.id;
- active=a.active;
- recorder_cfg=a.recorder_cfg;
- splitter_cfg=a.splitter_cfg;
- analysis_cfg=a.analysis_cfg;
- receiver_cfg=a.receiver_cfg;
- }
- return (*this);
-}
-
-
-std::string settings::update_format() const
-{ std::ostringstream rv("");
-
- for (int i=2;i<6;i++) rv << "?,";
- rv << "?";
- return rv.str();
-}
-
-
-std::string settings::insert_format() const
-{ return std::string("?,")+update_format();
-}
-
-std::string settings::select_format() const
-{
-std::string rv("");
-for (int i=0; i<5;i++) rv+="?,";
-rv+="?";
-return rv;
-}
-
-std::string settings::print(int full_subtables, int show_ids, int no_refs) const
-{ std::ostringstream rv("");
-
- rv.precision(14);
- if (show_ids) rv << id;
- rv << ',';
- rv << active;
- rv << ',';
- if (!no_refs) {
- if (full_subtables) {
- rv << recorder_cfg.print(full_subtables,show_ids,no_refs);
- } else {
- rv << recorder_cfg.id;
- }
- }
- rv << ',';
- if (!no_refs) {
- if (full_subtables) {
- rv << splitter_cfg.print(full_subtables,show_ids,no_refs);
- } else {
- rv << splitter_cfg.id;
- }
- }
- rv << ',';
- if (!no_refs) {
- if (full_subtables) {
- rv << analysis_cfg.print(full_subtables,show_ids,no_refs);
- } else {
- rv << analysis_cfg.id;
- }
- }
- rv << ',';
- if (!no_refs) {
- if (full_subtables) {
- rv << receiver_cfg.print(full_subtables,show_ids,no_refs);
- } else {
- rv << receiver_cfg.id;
- }
- }
- return rv.str();
-}
-
-
-std::string settings::print_xml(int full_subtables, int show_ids, int no_refs,const char *tag) const
-{
- std::ostringstream rv("");
-
- rv.precision(14);
- rv << xml_indent() << '<' << tag << ">\n";
- xml_indent(2);
- if (show_ids) rv << xml_indent() << "<id>" << id << "</id>\n";
- rv << xml_indent() << "<active>" << active << "</active>\n";
- if (!no_refs) {
- if (full_subtables) {
- rv << recorder_cfg.print_xml(full_subtables,show_ids,no_refs,"recorder_cfg");
- } else {
- rv << xml_indent() << "<recorder_cfg><id>" << recorder_cfg.id << "</id></recorder_cfg>\n";
- }
- }
- if (!no_refs) {
- if (full_subtables) {
- rv << splitter_cfg.print_xml(full_subtables,show_ids,no_refs,"splitter_cfg");
- } else {
- rv << xml_indent() << "<splitter_cfg><id>" << splitter_cfg.id << "</id></splitter_cfg>\n";
- }
- }
- if (!no_refs) {
- if (full_subtables) {
- rv << analysis_cfg.print_xml(full_subtables,show_ids,no_refs,"analysis_cfg");
- } else {
- rv << xml_indent() << "<analysis_cfg><id>" << analysis_cfg.id << "</id></analysis_cfg>\n";
- }
- }
- if (!no_refs) {
- if (full_subtables) {
- rv << receiver_cfg.print_xml(full_subtables,show_ids,no_refs,"receiver_cfg");
- } else {
- rv << xml_indent() << "<receiver_cfg><id>" << receiver_cfg.id << "</id></receiver_cfg>\n";
- }
- }
- xml_indent(-2);
- rv << xml_indent() << "</" << tag << ">\n";
- return rv.str();
-}
-
-
- void settings::parse_xml(const std::string &s,const char *tag) {
- std::string field,sub;
- if (extract_xml_record(s,tag,field)) {
- std::string::size_type pos=0;
- if (extract_xml_record(field,"id",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> id;
- }
- if (extract_xml_record(field,"active",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> active;
- }
- if (extract_xml_record(field,"recorder_cfg",sub)) {
- recorder_cfg.parse_xml(sub,"recorder_cfg");
- }
- if (extract_xml_record(field,"splitter_cfg",sub)) {
- splitter_cfg.parse_xml(sub,"splitter_cfg");
- }
- if (extract_xml_record(field,"analysis_cfg",sub)) {
- analysis_cfg.parse_xml(sub,"analysis_cfg");
- }
- if (extract_xml_record(field,"receiver_cfg",sub)) {
- receiver_cfg.parse_xml(sub,"receiver_cfg");
- }
- }
- }
-
- void settings::parse(const SQL_ROW &s) {
- {
- std::istringstream row(*(s[0]));
- row >> id;
- }
- {
- std::istringstream row(*(s[1]));
- row >> active;
- }
- {
- recorder_cfg.parse(SQL_ROW(s[2],0));
- }
- {
- splitter_cfg.parse(SQL_ROW(s[3],0));
- }
- {
- analysis_cfg.parse(SQL_ROW(s[4],0));
- }
- {
- receiver_cfg.parse(SQL_ROW(s[5],0));
- }
- }
-
- void settings::parse(const std::string &s) {
- SQL_ROW row(&s,6);
- parse(row);
- }
-
-template <> const char * const db_table<workunit_grp>::table_name="workunit_grp";
-template <> const char * db_table<workunit_grp>::_search_tag=table_name;
+ if (&a != this) {
+ id=a.id;
+ active=a.active;
+ recorder_cfg=a.recorder_cfg;
+ splitter_cfg=a.splitter_cfg;
+ analysis_cfg=a.analysis_cfg;
+ receiver_cfg=a.receiver_cfg;
+ }
+ return (*this);
+}
+
+
+std::string settings::update_format() const {
+ std::ostringstream rv("");
+
+ for (int i=2; i<6; i++) {
+ rv << "?,";
+ }
+ rv << "?";
+ return rv.str();
+}
+
+
+std::string settings::insert_format() const {
+ return std::string("?,")+update_format();
+}
+
+std::string settings::select_format() const {
+ std::string rv("");
+ for (int i=0; i<5; i++) {
+ rv+="?,";
+ }
+ rv+="?";
+ return rv;
+}
+
+std::string settings::print(int full_subtables, int show_ids, int no_refs) const {
+ std::ostringstream rv("");
+
+ rv.precision(14);
+ if (show_ids) {
+ rv << id;
+ }
+ rv << ',';
+ rv << active;
+ rv << ',';
+ if (!no_refs) {
+ if (full_subtables) {
+ rv << recorder_cfg.print(full_subtables,show_ids,no_refs);
+ } else {
+ rv << recorder_cfg.id;
+ }
+ }
+ rv << ',';
+ if (!no_refs) {
+ if (full_subtables) {
+ rv << splitter_cfg.print(full_subtables,show_ids,no_refs);
+ } else {
+ rv << splitter_cfg.id;
+ }
+ }
+ rv << ',';
+ if (!no_refs) {
+ if (full_subtables) {
+ rv << analysis_cfg.print(full_subtables,show_ids,no_refs);
+ } else {
+ rv << analysis_cfg.id;
+ }
+ }
+ rv << ',';
+ if (!no_refs) {
+ if (full_subtables) {
+ rv << receiver_cfg.print(full_subtables,show_ids,no_refs);
+ } else {
+ rv << receiver_cfg.id;
+ }
+ }
+ return rv.str();
+}
+
+
+std::string settings::print_xml(int full_subtables, int show_ids, int no_refs,const char *tag) const {
+ std::ostringstream rv("");
+
+ rv.precision(14);
+ rv << xml_indent() << '<' << tag << ">\n";
+ xml_indent(2);
+ if (show_ids) {
+ rv << xml_indent() << "<id>" << id << "</id>\n";
+ }
+ rv << xml_indent() << "<active>" << active << "</active>\n";
+ if (!no_refs) {
+ if (full_subtables) {
+ rv << recorder_cfg.print_xml(full_subtables,show_ids,no_refs,"recorder_cfg");
+ } else {
+ rv << xml_indent() << "<recorder_cfg><id>" << recorder_cfg.id << "</id></recorder_cfg>\n";
+ }
+ }
+ if (!no_refs) {
+ if (full_subtables) {
+ rv << splitter_cfg.print_xml(full_subtables,show_ids,no_refs,"splitter_cfg");
+ } else {
+ rv << xml_indent() << "<splitter_cfg><id>" << splitter_cfg.id << "</id></splitter_cfg>\n";
+ }
+ }
+ if (!no_refs) {
+ if (full_subtables) {
+ rv << analysis_cfg.print_xml(full_subtables,show_ids,no_refs,"analysis_cfg");
+ } else {
+ rv << xml_indent() << "<analysis_cfg><id>" << analysis_cfg.id << "</id></analysis_cfg>\n";
+ }
+ }
+ if (!no_refs) {
+ if (full_subtables) {
+ rv << receiver_cfg.print_xml(full_subtables,show_ids,no_refs,"receiver_cfg");
+ } else {
+ rv << xml_indent() << "<receiver_cfg><id>" << receiver_cfg.id << "</id></receiver_cfg>\n";
+ }
+ }
+ xml_indent(-2);
+ rv << xml_indent() << "</" << tag << ">\n";
+ return rv.str();
+}
+
+
+void settings::parse_xml(const std::string &s,const char *tag) {
+ std::string field,sub;
+ if (extract_xml_record(s,tag,field)) {
+ std::string::size_type pos=0;
+ if (extract_xml_record(field,"id",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> id;
+ }
+ if (extract_xml_record(field,"active",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> active;
+ }
+ if (extract_xml_record(field,"recorder_cfg",sub)) {
+ recorder_cfg.parse_xml(sub,"recorder_cfg");
+ }
+ if (extract_xml_record(field,"splitter_cfg",sub)) {
+ splitter_cfg.parse_xml(sub,"splitter_cfg");
+ }
+ if (extract_xml_record(field,"analysis_cfg",sub)) {
+ analysis_cfg.parse_xml(sub,"analysis_cfg");
+ }
+ if (extract_xml_record(field,"receiver_cfg",sub)) {
+ receiver_cfg.parse_xml(sub,"receiver_cfg");
+ }
+ }
+}
+
+void settings::parse(const SQL_ROW &s) {
+ {
+ std::istringstream row(*(s[0]));
+ row >> id;
+ }
+ {
+ std::istringstream row(*(s[1]));
+ row >> active;
+ }
+ {
+ recorder_cfg.parse(SQL_ROW(s[2],0));
+ }
+ {
+ splitter_cfg.parse(SQL_ROW(s[3],0));
+ }
+ {
+ analysis_cfg.parse(SQL_ROW(s[4],0));
+ }
+ {
+ receiver_cfg.parse(SQL_ROW(s[5],0));
+ }
+}
+
+void settings::parse(const std::string &s) {
+ SQL_ROW row(&s,6);
+ parse(row);
+}
+
+template <> const char *const db_table<workunit_grp>::table_name="workunit_grp";
+template <> const char *db_table<workunit_grp>::_search_tag=table_name;
template <> const int db_table<workunit_grp>::_nfields=11;
-template <> const char * const db_table<workunit_grp>::column_names[11]={"id","tape_info","name","data_desc","receiver_cfg","recorder_cfg","splitter_cfg","analysis_cfg","sb_id","iq_modified","alfa_filter_bank"};
-
-workunit_grp::workunit_grp() :
- db_table<workunit_grp>(*this,-1),
- id(0),
- tape_info(),
- data_desc(),
- receiver_cfg(),
- recorder_cfg(),
- splitter_cfg(),
- analysis_cfg(),
- sb_id(0),
- iq_modified(0),
- alfa_filter_bank(0)
-{
- db_open();
- name[0]=0;
-}
-
-
-workunit_grp::workunit_grp(const workunit_grp &a) :
- db_table<workunit_grp>(*this,-1),
- id(a.id),
- tape_info(a.tape_info),
- data_desc(a.data_desc),
- receiver_cfg(a.receiver_cfg),
- recorder_cfg(a.recorder_cfg),
- splitter_cfg(a.splitter_cfg),
- analysis_cfg(a.analysis_cfg),
- sb_id(a.sb_id),
- iq_modified(a.iq_modified),
- alfa_filter_bank(a.alfa_filter_bank)
-{
- db_open();
- strcpy(name,a.name);
-}
-
-
-workunit_grp::workunit_grp(const SQL_ROW &a) :
- db_table<workunit_grp>(*this,-1)
-{
- db_open();
- parse(a);
-}
-
-
-workunit_grp::workunit_grp(const std::string &s,const char *tag) :
- db_table<workunit_grp>(*this,-1)
-{
- db_open();
- if (xml_match_tag(s,tag)) {
- parse_xml(s,tag);
- } else {
- parse(s);
- }
+template <> const char *const db_table<workunit_grp>::column_names[11]= {"id","tape_info","name","data_desc","receiver_cfg","recorder_cfg","splitter_cfg","analysis_cfg","sb_id","iq_modified","alfa_filter_bank"};
+
+workunit_grp::workunit_grp() :
+ db_table<workunit_grp>(*this,-1),
+ id(0),
+ tape_info(),
+ data_desc(),
+ receiver_cfg(),
+ recorder_cfg(),
+ splitter_cfg(),
+ analysis_cfg(),
+ sb_id(0),
+ iq_modified(0),
+ alfa_filter_bank(0) {
+ db_open();
+ name[0]=0;
+}
+
+
+workunit_grp::workunit_grp(const workunit_grp &a) :
+ db_table<workunit_grp>(*this,-1),
+ id(a.id),
+ tape_info(a.tape_info),
+ data_desc(a.data_desc),
+ receiver_cfg(a.receiver_cfg),
+ recorder_cfg(a.recorder_cfg),
+ splitter_cfg(a.splitter_cfg),
+ analysis_cfg(a.analysis_cfg),
+ sb_id(a.sb_id),
+ iq_modified(a.iq_modified),
+ alfa_filter_bank(a.alfa_filter_bank) {
+ db_open();
+ strcpy(name,a.name);
+}
+
+
+workunit_grp::workunit_grp(const SQL_ROW &a) :
+ db_table<workunit_grp>(*this,-1) {
+ db_open();
+ parse(a);
+}
+
+
+workunit_grp::workunit_grp(const std::string &s,const char *tag) :
+ db_table<workunit_grp>(*this,-1) {
+ db_open();
+ if (xml_match_tag(s,tag)) {
+ parse_xml(s,tag);
+ } else {
+ parse(s);
+ }
}
workunit_grp &workunit_grp::operator =(const workunit_grp &a) {
- if (&a != this) {
- id=a.id;
- tape_info=a.tape_info;
- data_desc=a.data_desc;
- receiver_cfg=a.receiver_cfg;
- recorder_cfg=a.recorder_cfg;
- splitter_cfg=a.splitter_cfg;
- analysis_cfg=a.analysis_cfg;
- sb_id=a.sb_id;
- iq_modified=a.iq_modified;
- alfa_filter_bank=a.alfa_filter_bank;
- strcpy(name,a.name);
- }
- return (*this);
-}
-
-
-std::string workunit_grp::update_format() const
-{ std::ostringstream rv("");
-
- for (int i=2;i<11;i++) rv << "?,";
- rv << "?";
- return rv.str();
-}
-
-
-std::string workunit_grp::insert_format() const
-{ return std::string("?,")+update_format();
-}
-
-std::string workunit_grp::select_format() const
-{
-std::string rv("");
-for (int i=0; i<10;i++) rv+="?,";
-rv+="?";
-return rv;
-}
-
-std::string workunit_grp::print(int full_subtables, int show_ids, int no_refs) const
-{ std::ostringstream rv("");
-
- rv.precision(14);
- if (show_ids) rv << id;
- rv << ',';
- if (!no_refs) {
- if (full_subtables) {
- rv << tape_info.print(full_subtables,show_ids,no_refs);
- } else {
- rv << tape_info.id;
- }
- }
- rv << ',';
- rv << "'" << name << "'";
- rv << ',';
- rv << data_desc.print(full_subtables,show_ids,no_refs);
- rv << ',';
- if (!no_refs) {
- if (full_subtables) {
- rv << receiver_cfg.print(full_subtables,show_ids,no_refs);
- } else {
- rv << receiver_cfg.id;
- }
- }
- rv << ',';
- if (!no_refs) {
- if (full_subtables) {
- rv << recorder_cfg.print(full_subtables,show_ids,no_refs);
- } else {
- rv << recorder_cfg.id;
- }
- }
- rv << ',';
- if (!no_refs) {
- if (full_subtables) {
- rv << splitter_cfg.print(full_subtables,show_ids,no_refs);
- } else {
- rv << splitter_cfg.id;
- }
- }
- rv << ',';
- if (!no_refs) {
- if (full_subtables) {
- rv << analysis_cfg.print(full_subtables,show_ids,no_refs);
- } else {
- rv << analysis_cfg.id;
- }
- }
- rv << ',';
- rv << sb_id;
- rv << ',';
- rv << iq_modified;
- rv << ',';
- rv << alfa_filter_bank;
- return rv.str();
-}
-
-
-std::string workunit_grp::print_xml(int full_subtables, int show_ids, int no_refs,const char *tag) const
-{
- std::ostringstream rv("");
-
- rv.precision(14);
- rv << xml_indent() << '<' << tag << ">\n";
- xml_indent(2);
- if (show_ids) rv << xml_indent() << "<id>" << id << "</id>\n";
- if (!no_refs) {
- if (full_subtables) {
- rv << tape_info.print_xml(full_subtables,show_ids,no_refs,"tape_info");
- } else {
- rv << xml_indent() << "<tape_info><id>" << tape_info.id << "</id></tape_info>\n";
- }
- }
- {
- std::string enc_field=xml_encode_string(name,std::min(strlen(name),sizeof(name)));
- rv << xml_indent() << "<name>";
- rv << enc_field << "</name>\n";
- }
- rv << data_desc.print_xml(full_subtables,show_ids,no_refs,"data_desc");
- if (!no_refs) {
- if (full_subtables) {
- rv << receiver_cfg.print_xml(full_subtables,show_ids,no_refs,"receiver_cfg");
- } else {
- rv << xml_indent() << "<receiver_cfg><id>" << receiver_cfg.id << "</id></receiver_cfg>\n";
- }
- }
- if (!no_refs) {
- if (full_subtables) {
- rv << recorder_cfg.print_xml(full_subtables,show_ids,no_refs,"recorder_cfg");
- } else {
- rv << xml_indent() << "<recorder_cfg><id>" << recorder_cfg.id << "</id></recorder_cfg>\n";
- }
- }
- if (!no_refs) {
- if (full_subtables) {
- rv << splitter_cfg.print_xml(full_subtables,show_ids,no_refs,"splitter_cfg");
- } else {
- rv << xml_indent() << "<splitter_cfg><id>" << splitter_cfg.id << "</id></splitter_cfg>\n";
- }
- }
- if (!no_refs) {
- if (full_subtables) {
- rv << analysis_cfg.print_xml(full_subtables,show_ids,no_refs,"analysis_cfg");
- } else {
- rv << xml_indent() << "<analysis_cfg><id>" << analysis_cfg.id << "</id></analysis_cfg>\n";
- }
- }
- rv << xml_indent() << "<sb_id>" << sb_id << "</sb_id>\n";
- rv << xml_indent() << "<iq_modified>" << iq_modified << "</iq_modified>\n";
- rv << xml_indent() << "<alfa_filter_bank>" << alfa_filter_bank << "</alfa_filter_bank>\n";
- xml_indent(-2);
- rv << xml_indent() << "</" << tag << ">\n";
- return rv.str();
-}
-
-
- void workunit_grp::parse_xml(const std::string &s,const char *tag) {
- std::string field,sub;
- if (extract_xml_record(s,tag,field)) {
- std::string::size_type pos=0;
- if (extract_xml_record(field,"id",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> id;
- }
- if (extract_xml_record(field,"tape_info",sub)) {
- tape_info.parse_xml(sub,"tape_info");
- }
- if (extract_xml_record(field,"name",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::string::size_type epos=sub.find("<",pos);
- if (epos==std::string::npos) epos=sub.find('\n',pos);
- if (epos==std::string::npos) epos=pos+strlen(sub.c_str()+pos);
- std::vector<unsigned char> in(xml_decode_string<unsigned char>((const char *)sub.c_str()+pos,epos-pos));
- strncpy(name,(const char *)&(in.front()),std::min(in.size(),(size_t)64));
- name[std::min(in.size(),(size_t)63)]=0;
- }
- if (extract_xml_record(field,"data_desc",sub)) {
- data_desc.parse_xml(sub,"data_desc");
- }
- if (extract_xml_record(field,"receiver_cfg",sub)) {
- receiver_cfg.parse_xml(sub,"receiver_cfg");
- }
- if (extract_xml_record(field,"recorder_cfg",sub)) {
- recorder_cfg.parse_xml(sub,"recorder_cfg");
- }
- if (extract_xml_record(field,"splitter_cfg",sub)) {
- splitter_cfg.parse_xml(sub,"splitter_cfg");
- }
- if (extract_xml_record(field,"analysis_cfg",sub)) {
- analysis_cfg.parse_xml(sub,"analysis_cfg");
- }
- if (extract_xml_record(field,"sb_id",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> sb_id;
- }
- if (extract_xml_record(field,"iq_modified",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> iq_modified;
- }
- if (extract_xml_record(field,"alfa_filter_bank",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> alfa_filter_bank;
- }
- }
- }
-
- void workunit_grp::parse(const SQL_ROW &s) {
- {
- std::istringstream row(*(s[0]));
- row >> id;
- }
- {
- tape_info.parse(SQL_ROW(s[1],0));
- }
- {
- strncpy(name,s[2]->c_str(),64);
- name[63]=0;
- }
- {
- data_desc.parse(SQL_ROW(s[3],0));
- }
- {
- receiver_cfg.parse(SQL_ROW(s[4],0));
- }
- {
- recorder_cfg.parse(SQL_ROW(s[5],0));
- }
- {
- splitter_cfg.parse(SQL_ROW(s[6],0));
- }
- {
- analysis_cfg.parse(SQL_ROW(s[7],0));
- }
- {
- std::istringstream row(*(s[8]));
- row >> sb_id;
- }
- {
- std::istringstream row(*(s[9]));
- row >> iq_modified;
- }
- {
- std::istringstream row(*(s[10]));
- row >> alfa_filter_bank;
- }
- }
-
- void workunit_grp::parse(const std::string &s) {
- SQL_ROW row(&s,11);
- parse(row);
- }
-
-template <> const char * const db_table<workunit_header>::table_name="workunit_header";
-template <> const char * db_table<workunit_header>::_search_tag=table_name;
+ if (&a != this) {
+ id=a.id;
+ tape_info=a.tape_info;
+ data_desc=a.data_desc;
+ receiver_cfg=a.receiver_cfg;
+ recorder_cfg=a.recorder_cfg;
+ splitter_cfg=a.splitter_cfg;
+ analysis_cfg=a.analysis_cfg;
+ sb_id=a.sb_id;
+ iq_modified=a.iq_modified;
+ alfa_filter_bank=a.alfa_filter_bank;
+ strcpy(name,a.name);
+ }
+ return (*this);
+}
+
+
+std::string workunit_grp::update_format() const {
+ std::ostringstream rv("");
+
+ for (int i=2; i<11; i++) {
+ rv << "?,";
+ }
+ rv << "?";
+ return rv.str();
+}
+
+
+std::string workunit_grp::insert_format() const {
+ return std::string("?,")+update_format();
+}
+
+std::string workunit_grp::select_format() const {
+ std::string rv("");
+ for (int i=0; i<10; i++) {
+ rv+="?,";
+ }
+ rv+="?";
+ return rv;
+}
+
+std::string workunit_grp::print(int full_subtables, int show_ids, int no_refs) const {
+ std::ostringstream rv("");
+
+ rv.precision(14);
+ if (show_ids) {
+ rv << id;
+ }
+ rv << ',';
+ if (!no_refs) {
+ if (full_subtables) {
+ rv << tape_info.print(full_subtables,show_ids,no_refs);
+ } else {
+ rv << tape_info.id;
+ }
+ }
+ rv << ',';
+ rv << "'" << name << "'";
+ rv << ',';
+ rv << data_desc.print(full_subtables,show_ids,no_refs);
+ rv << ',';
+ if (!no_refs) {
+ if (full_subtables) {
+ rv << receiver_cfg.print(full_subtables,show_ids,no_refs);
+ } else {
+ rv << receiver_cfg.id;
+ }
+ }
+ rv << ',';
+ if (!no_refs) {
+ if (full_subtables) {
+ rv << recorder_cfg.print(full_subtables,show_ids,no_refs);
+ } else {
+ rv << recorder_cfg.id;
+ }
+ }
+ rv << ',';
+ if (!no_refs) {
+ if (full_subtables) {
+ rv << splitter_cfg.print(full_subtables,show_ids,no_refs);
+ } else {
+ rv << splitter_cfg.id;
+ }
+ }
+ rv << ',';
+ if (!no_refs) {
+ if (full_subtables) {
+ rv << analysis_cfg.print(full_subtables,show_ids,no_refs);
+ } else {
+ rv << analysis_cfg.id;
+ }
+ }
+ rv << ',';
+ rv << sb_id;
+ rv << ',';
+ rv << iq_modified;
+ rv << ',';
+ rv << alfa_filter_bank;
+ return rv.str();
+}
+
+
+std::string workunit_grp::print_xml(int full_subtables, int show_ids, int no_refs,const char *tag) const {
+ std::ostringstream rv("");
+
+ rv.precision(14);
+ rv << xml_indent() << '<' << tag << ">\n";
+ xml_indent(2);
+ if (show_ids) {
+ rv << xml_indent() << "<id>" << id << "</id>\n";
+ }
+ if (!no_refs) {
+ if (full_subtables) {
+ rv << tape_info.print_xml(full_subtables,show_ids,no_refs,"tape_info");
+ } else {
+ rv << xml_indent() << "<tape_info><id>" << tape_info.id << "</id></tape_info>\n";
+ }
+ }
+ {
+ std::string enc_field=xml_encode_string(name,std::min(strlen(name),sizeof(name)));
+ rv << xml_indent() << "<name>";
+ rv << enc_field << "</name>\n";
+ }
+ rv << data_desc.print_xml(full_subtables,show_ids,no_refs,"data_desc");
+ if (!no_refs) {
+ if (full_subtables) {
+ rv << receiver_cfg.print_xml(full_subtables,show_ids,no_refs,"receiver_cfg");
+ } else {
+ rv << xml_indent() << "<receiver_cfg><id>" << receiver_cfg.id << "</id></receiver_cfg>\n";
+ }
+ }
+ if (!no_refs) {
+ if (full_subtables) {
+ rv << recorder_cfg.print_xml(full_subtables,show_ids,no_refs,"recorder_cfg");
+ } else {
+ rv << xml_indent() << "<recorder_cfg><id>" << recorder_cfg.id << "</id></recorder_cfg>\n";
+ }
+ }
+ if (!no_refs) {
+ if (full_subtables) {
+ rv << splitter_cfg.print_xml(full_subtables,show_ids,no_refs,"splitter_cfg");
+ } else {
+ rv << xml_indent() << "<splitter_cfg><id>" << splitter_cfg.id << "</id></splitter_cfg>\n";
+ }
+ }
+ if (!no_refs) {
+ if (full_subtables) {
+ rv << analysis_cfg.print_xml(full_subtables,show_ids,no_refs,"analysis_cfg");
+ } else {
+ rv << xml_indent() << "<analysis_cfg><id>" << analysis_cfg.id << "</id></analysis_cfg>\n";
+ }
+ }
+ rv << xml_indent() << "<sb_id>" << sb_id << "</sb_id>\n";
+ rv << xml_indent() << "<iq_modified>" << iq_modified << "</iq_modified>\n";
+ rv << xml_indent() << "<alfa_filter_bank>" << alfa_filter_bank << "</alfa_filter_bank>\n";
+ xml_indent(-2);
+ rv << xml_indent() << "</" << tag << ">\n";
+ return rv.str();
+}
+
+
+void workunit_grp::parse_xml(const std::string &s,const char *tag) {
+ std::string field,sub;
+ if (extract_xml_record(s,tag,field)) {
+ std::string::size_type pos=0;
+ if (extract_xml_record(field,"id",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> id;
+ }
+ if (extract_xml_record(field,"tape_info",sub)) {
+ tape_info.parse_xml(sub,"tape_info");
+ }
+ if (extract_xml_record(field,"name",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::string::size_type epos=sub.find("<",pos);
+ if (epos==std::string::npos) {
+ epos=sub.find('\n',pos);
+ }
+ if (epos==std::string::npos) {
+ epos=pos+strlen(sub.c_str()+pos);
+ }
+ std::vector<unsigned char> in(xml_decode_string<unsigned char>((const char *)sub.c_str()+pos,epos-pos));
+ strncpy(name,(const char *)&(in.front()),std::min(in.size(),(size_t)64));
+ name[std::min(in.size(),(size_t)63)]=0;
+ }
+ if (extract_xml_record(field,"data_desc",sub)) {
+ data_desc.parse_xml(sub,"data_desc");
+ }
+ if (extract_xml_record(field,"receiver_cfg",sub)) {
+ receiver_cfg.parse_xml(sub,"receiver_cfg");
+ }
+ if (extract_xml_record(field,"recorder_cfg",sub)) {
+ recorder_cfg.parse_xml(sub,"recorder_cfg");
+ }
+ if (extract_xml_record(field,"splitter_cfg",sub)) {
+ splitter_cfg.parse_xml(sub,"splitter_cfg");
+ }
+ if (extract_xml_record(field,"analysis_cfg",sub)) {
+ analysis_cfg.parse_xml(sub,"analysis_cfg");
+ }
+ if (extract_xml_record(field,"sb_id",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> sb_id;
+ }
+ if (extract_xml_record(field,"iq_modified",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> iq_modified;
+ }
+ if (extract_xml_record(field,"alfa_filter_bank",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> alfa_filter_bank;
+ }
+ }
+}
+
+void workunit_grp::parse(const SQL_ROW &s) {
+ {
+ std::istringstream row(*(s[0]));
+ row >> id;
+ }
+ {
+ tape_info.parse(SQL_ROW(s[1],0));
+ }
+ {
+ strncpy(name,s[2]->c_str(),64);
+ name[63]=0;
+ }
+ {
+ data_desc.parse(SQL_ROW(s[3],0));
+ }
+ {
+ receiver_cfg.parse(SQL_ROW(s[4],0));
+ }
+ {
+ recorder_cfg.parse(SQL_ROW(s[5],0));
+ }
+ {
+ splitter_cfg.parse(SQL_ROW(s[6],0));
+ }
+ {
+ analysis_cfg.parse(SQL_ROW(s[7],0));
+ }
+ {
+ std::istringstream row(*(s[8]));
+ row >> sb_id;
+ }
+ {
+ std::istringstream row(*(s[9]));
+ row >> iq_modified;
+ }
+ {
+ std::istringstream row(*(s[10]));
+ row >> alfa_filter_bank;
+ }
+}
+
+void workunit_grp::parse(const std::string &s) {
+ SQL_ROW row(&s,11);
+ parse(row);
+}
+
+template <> const char *const db_table<workunit_header>::table_name="workunit_header";
+template <> const char *db_table<workunit_header>::_search_tag=table_name;
template <> const int db_table<workunit_header>::_nfields=5;
-template <> const char * const db_table<workunit_header>::column_names[5]={"id","name","group_info","subband_desc","sb_id"};
+template <> const char *const db_table<workunit_header>::column_names[5]= {"id","name","group_info","subband_desc","sb_id"};
-workunit_header::workunit_header() :
- db_table<workunit_header>(*this,-1),
- id(0),
- group_info(),
- subband_desc(),
- sb_id(0)
-{
- db_open();
- name[0]=0;
+workunit_header::workunit_header() :
+ db_table<workunit_header>(*this,-1),
+ id(0),
+ group_info(),
+ subband_desc(),
+ sb_id(0) {
+ db_open();
+ name[0]=0;
}
-workunit_header::workunit_header(const workunit_header &a) :
- db_table<workunit_header>(*this,-1),
- id(a.id),
- group_info(a.group_info),
- subband_desc(a.subband_desc),
- sb_id(a.sb_id)
-{
- db_open();
- strcpy(name,a.name);
+workunit_header::workunit_header(const workunit_header &a) :
+ db_table<workunit_header>(*this,-1),
+ id(a.id),
+ group_info(a.group_info),
+ subband_desc(a.subband_desc),
+ sb_id(a.sb_id) {
+ db_open();
+ strcpy(name,a.name);
}
-workunit_header::workunit_header(const SQL_ROW &a) :
- db_table<workunit_header>(*this,-1)
-{
- db_open();
- parse(a);
+workunit_header::workunit_header(const SQL_ROW &a) :
+ db_table<workunit_header>(*this,-1) {
+ db_open();
+ parse(a);
}
-workunit_header::workunit_header(const std::string &s,const char *tag) :
- db_table<workunit_header>(*this,-1)
-{
- db_open();
- if (xml_match_tag(s,tag)) {
- parse_xml(s,tag);
- } else {
- parse(s);
- }
+workunit_header::workunit_header(const std::string &s,const char *tag) :
+ db_table<workunit_header>(*this,-1) {
+ db_open();
+ if (xml_match_tag(s,tag)) {
+ parse_xml(s,tag);
+ } else {
+ parse(s);
+ }
}
workunit_header &workunit_header::operator =(const workunit_header &a) {
- if (&a != this) {
- id=a.id;
- group_info=a.group_info;
- subband_desc=a.subband_desc;
- sb_id=a.sb_id;
- strcpy(name,a.name);
- }
- return (*this);
-}
-
-
-std::string workunit_header::update_format() const
-{ std::ostringstream rv("");
-
- for (int i=2;i<5;i++) rv << "?,";
- rv << "?";
- return rv.str();
-}
-
-
-std::string workunit_header::insert_format() const
-{ return std::string("?,")+update_format();
-}
-
-std::string workunit_header::select_format() const
-{
-std::string rv("");
-for (int i=0; i<4;i++) rv+="?,";
-rv+="?";
-return rv;
-}
-
-std::string workunit_header::print(int full_subtables, int show_ids, int no_refs) const
-{ std::ostringstream rv("");
-
- rv.precision(14);
- if (show_ids) rv << id;
- rv << ',';
- rv << "'" << name << "'";
- rv << ',';
- if (!no_refs) {
- if (full_subtables) {
- rv << group_info.print(full_subtables,show_ids,no_refs);
- } else {
- rv << group_info.id;
- }
- }
- rv << ',';
- rv << subband_desc.print(full_subtables,show_ids,no_refs);
- rv << ',';
- rv << sb_id;
- return rv.str();
-}
-
-
-std::string workunit_header::print_xml(int full_subtables, int show_ids, int no_refs,const char *tag) const
-{
- std::ostringstream rv("");
-
- rv.precision(14);
- rv << xml_indent() << '<' << tag << ">\n";
- xml_indent(2);
- if (show_ids) rv << xml_indent() << "<id>" << id << "</id>\n";
- {
- std::string enc_field=xml_encode_string(name,std::min(strlen(name),sizeof(name)));
- rv << xml_indent() << "<name>";
- rv << enc_field << "</name>\n";
- }
- if (!no_refs) {
- if (full_subtables) {
- rv << group_info.print_xml(full_subtables,show_ids,no_refs,"group_info");
- } else {
- rv << xml_indent() << "<group_info><id>" << group_info.id << "</id></group_info>\n";
- }
- }
- rv << subband_desc.print_xml(full_subtables,show_ids,no_refs,"subband_desc");
- rv << xml_indent() << "<sb_id>" << sb_id << "</sb_id>\n";
- xml_indent(-2);
- rv << xml_indent() << "</" << tag << ">\n";
- return rv.str();
-}
-
-
- void workunit_header::parse_xml(const std::string &s,const char *tag) {
- std::string field,sub;
- if (extract_xml_record(s,tag,field)) {
- std::string::size_type pos=0;
- if (extract_xml_record(field,"id",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> id;
- }
- if (extract_xml_record(field,"name",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::string::size_type epos=sub.find("<",pos);
- if (epos==std::string::npos) epos=sub.find('\n',pos);
- if (epos==std::string::npos) epos=pos+strlen(sub.c_str()+pos);
- std::vector<unsigned char> in(xml_decode_string<unsigned char>((const char *)sub.c_str()+pos,epos-pos));
- strncpy(name,(const char *)&(in.front()),std::min(in.size(),(size_t)64));
- name[std::min(in.size(),(size_t)63)]=0;
- }
- if (extract_xml_record(field,"group_info",sub)) {
- group_info.parse_xml(sub,"group_info");
- }
- if (extract_xml_record(field,"subband_desc",sub)) {
- subband_desc.parse_xml(sub,"subband_desc");
- }
- if (extract_xml_record(field,"sb_id",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> sb_id;
- }
- }
- }
-
- void workunit_header::parse(const SQL_ROW &s) {
- {
- std::istringstream row(*(s[0]));
- row >> id;
- }
- {
- strncpy(name,s[1]->c_str(),64);
- name[63]=0;
- }
- {
- group_info.parse(SQL_ROW(s[2],0));
- }
- {
- subband_desc.parse(SQL_ROW(s[3],0));
- }
- {
- std::istringstream row(*(s[4]));
- row >> sb_id;
- }
- }
-
- void workunit_header::parse(const std::string &s) {
- SQL_ROW row(&s,5);
- parse(row);
- }
-
-template <> const char * const db_table<result>::table_name="result";
-template <> const char * db_table<result>::_search_tag=table_name;
+ if (&a != this) {
+ id=a.id;
+ group_info=a.group_info;
+ subband_desc=a.subband_desc;
+ sb_id=a.sb_id;
+ strcpy(name,a.name);
+ }
+ return (*this);
+}
+
+
+std::string workunit_header::update_format() const {
+ std::ostringstream rv("");
+
+ for (int i=2; i<5; i++) {
+ rv << "?,";
+ }
+ rv << "?";
+ return rv.str();
+}
+
+
+std::string workunit_header::insert_format() const {
+ return std::string("?,")+update_format();
+}
+
+std::string workunit_header::select_format() const {
+ std::string rv("");
+ for (int i=0; i<4; i++) {
+ rv+="?,";
+ }
+ rv+="?";
+ return rv;
+}
+
+std::string workunit_header::print(int full_subtables, int show_ids, int no_refs) const {
+ std::ostringstream rv("");
+
+ rv.precision(14);
+ if (show_ids) {
+ rv << id;
+ }
+ rv << ',';
+ rv << "'" << name << "'";
+ rv << ',';
+ if (!no_refs) {
+ if (full_subtables) {
+ rv << group_info.print(full_subtables,show_ids,no_refs);
+ } else {
+ rv << group_info.id;
+ }
+ }
+ rv << ',';
+ rv << subband_desc.print(full_subtables,show_ids,no_refs);
+ rv << ',';
+ rv << sb_id;
+ return rv.str();
+}
+
+
+std::string workunit_header::print_xml(int full_subtables, int show_ids, int no_refs,const char *tag) const {
+ std::ostringstream rv("");
+
+ rv.precision(14);
+ rv << xml_indent() << '<' << tag << ">\n";
+ xml_indent(2);
+ if (show_ids) {
+ rv << xml_indent() << "<id>" << id << "</id>\n";
+ }
+ {
+ std::string enc_field=xml_encode_string(name,std::min(strlen(name),sizeof(name)));
+ rv << xml_indent() << "<name>";
+ rv << enc_field << "</name>\n";
+ }
+ if (!no_refs) {
+ if (full_subtables) {
+ rv << group_info.print_xml(full_subtables,show_ids,no_refs,"group_info");
+ } else {
+ rv << xml_indent() << "<group_info><id>" << group_info.id << "</id></group_info>\n";
+ }
+ }
+ rv << subband_desc.print_xml(full_subtables,show_ids,no_refs,"subband_desc");
+ rv << xml_indent() << "<sb_id>" << sb_id << "</sb_id>\n";
+ xml_indent(-2);
+ rv << xml_indent() << "</" << tag << ">\n";
+ return rv.str();
+}
+
+
+void workunit_header::parse_xml(const std::string &s,const char *tag) {
+ std::string field,sub;
+ if (extract_xml_record(s,tag,field)) {
+ std::string::size_type pos=0;
+ if (extract_xml_record(field,"id",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> id;
+ }
+ if (extract_xml_record(field,"name",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::string::size_type epos=sub.find("<",pos);
+ if (epos==std::string::npos) {
+ epos=sub.find('\n',pos);
+ }
+ if (epos==std::string::npos) {
+ epos=pos+strlen(sub.c_str()+pos);
+ }
+ std::vector<unsigned char> in(xml_decode_string<unsigned char>((const char *)sub.c_str()+pos,epos-pos));
+ strncpy(name,(const char *)&(in.front()),std::min(in.size(),(size_t)64));
+ name[std::min(in.size(),(size_t)63)]=0;
+ }
+ if (extract_xml_record(field,"group_info",sub)) {
+ group_info.parse_xml(sub,"group_info");
+ }
+ if (extract_xml_record(field,"subband_desc",sub)) {
+ subband_desc.parse_xml(sub,"subband_desc");
+ }
+ if (extract_xml_record(field,"sb_id",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> sb_id;
+ }
+ }
+}
+
+void workunit_header::parse(const SQL_ROW &s) {
+ {
+ std::istringstream row(*(s[0]));
+ row >> id;
+ }
+ {
+ strncpy(name,s[1]->c_str(),64);
+ name[63]=0;
+ }
+ {
+ group_info.parse(SQL_ROW(s[2],0));
+ }
+ {
+ subband_desc.parse(SQL_ROW(s[3],0));
+ }
+ {
+ std::istringstream row(*(s[4]));
+ row >> sb_id;
+ }
+}
+
+void workunit_header::parse(const std::string &s) {
+ SQL_ROW row(&s,5);
+ parse(row);
+}
+
+template <> const char *const db_table<result>::table_name="result";
+template <> const char *db_table<result>::_search_tag=table_name;
template <> const int db_table<result>::_nfields=10;
-template <> const char * const db_table<result>::column_names[10]={"id","boinc_result","wuid","received","hostid","versionid","return_code","overflow","reserved","sb_id"};
-
-result::result() :
- db_table<result>(*this,-1),
- id(0),
- boinc_result(0),
- wuid(),
- received(0),
- hostid(0),
- versionid(0),
- return_code(0),
- overflow(0),
- reserved(0),
- sb_id(0)
-{
- db_open();
-}
-
-
-result::result(const result &a) :
- db_table<result>(*this,-1),
- id(a.id),
- boinc_result(a.boinc_result),
- wuid(a.wuid),
- received(a.received),
- hostid(a.hostid),
- versionid(a.versionid),
- return_code(a.return_code),
- overflow(a.overflow),
- reserved(a.reserved),
- sb_id(a.sb_id)
-{
- db_open();
-}
-
-
-result::result(const SQL_ROW &a) :
- db_table<result>(*this,-1)
-{
- db_open();
- parse(a);
-}
-
-
-result::result(const std::string &s,const char *tag) :
- db_table<result>(*this,-1)
-{
- db_open();
- if (xml_match_tag(s,tag)) {
- parse_xml(s,tag);
- } else {
- parse(s);
- }
+template <> const char *const db_table<result>::column_names[10]= {"id","boinc_result","wuid","received","hostid","versionid","return_code","overflow","reserved","sb_id"};
+
+result::result() :
+ db_table<result>(*this,-1),
+ id(0),
+ boinc_result(0),
+ wuid(),
+ received(0),
+ hostid(0),
+ versionid(0),
+ return_code(0),
+ overflow(0),
+ reserved(0),
+ sb_id(0) {
+ db_open();
+}
+
+
+result::result(const result &a) :
+ db_table<result>(*this,-1),
+ id(a.id),
+ boinc_result(a.boinc_result),
+ wuid(a.wuid),
+ received(a.received),
+ hostid(a.hostid),
+ versionid(a.versionid),
+ return_code(a.return_code),
+ overflow(a.overflow),
+ reserved(a.reserved),
+ sb_id(a.sb_id) {
+ db_open();
+}
+
+
+result::result(const SQL_ROW &a) :
+ db_table<result>(*this,-1) {
+ db_open();
+ parse(a);
+}
+
+
+result::result(const std::string &s,const char *tag) :
+ db_table<result>(*this,-1) {
+ db_open();
+ if (xml_match_tag(s,tag)) {
+ parse_xml(s,tag);
+ } else {
+ parse(s);
+ }
}
result &result::operator =(const result &a) {
- if (&a != this) {
- id=a.id;
- boinc_result=a.boinc_result;
- wuid=a.wuid;
- received=a.received;
- hostid=a.hostid;
- versionid=a.versionid;
- return_code=a.return_code;
- overflow=a.overflow;
- reserved=a.reserved;
- sb_id=a.sb_id;
- }
- return (*this);
-}
-
-
-std::string result::update_format() const
-{ std::ostringstream rv("");
-
- for (int i=2;i<10;i++) rv << "?,";
- rv << "?";
- return rv.str();
-}
-
-
-std::string result::insert_format() const
-{ return std::string("?,")+update_format();
-}
-
-std::string result::select_format() const
-{
-std::string rv("");
-for (int i=0; i<9;i++) rv+="?,";
-rv+="?";
-return rv;
-}
-
-std::string result::print(int full_subtables, int show_ids, int no_refs) const
-{ std::ostringstream rv("");
-
- rv.precision(14);
- if (show_ids) rv << id;
- rv << ',';
- rv << boinc_result;
- rv << ',';
- if (!no_refs) {
- if (full_subtables) {
- rv << wuid.print(full_subtables,show_ids,no_refs);
- } else {
- rv << wuid.id;
- }
- }
- rv << ',';
- rv << received;
- rv << ',';
- rv << hostid;
- rv << ',';
- rv << versionid;
- rv << ',';
- rv << return_code;
- rv << ',';
- rv << overflow;
- rv << ',';
- rv << reserved;
- rv << ',';
- rv << sb_id;
- return rv.str();
-}
-
-
-std::string result::print_xml(int full_subtables, int show_ids, int no_refs,const char *tag) const
-{
- std::ostringstream rv("");
-
- rv.precision(14);
- rv << xml_indent() << '<' << tag << ">\n";
- xml_indent(2);
- if (show_ids) rv << xml_indent() << "<id>" << id << "</id>\n";
- rv << xml_indent() << "<boinc_result>" << boinc_result << "</boinc_result>\n";
- if (!no_refs) {
- if (full_subtables) {
- rv << wuid.print_xml(full_subtables,show_ids,no_refs,"wuid");
- } else {
- rv << xml_indent() << "<wuid><id>" << wuid.id << "</id></wuid>\n";
- }
- }
- rv << xml_indent() << "<received>" << received << "</received>\n";
- rv << xml_indent() << "<hostid>" << hostid << "</hostid>\n";
- rv << xml_indent() << "<versionid>" << versionid << "</versionid>\n";
- rv << xml_indent() << "<return_code>" << return_code << "</return_code>\n";
- rv << xml_indent() << "<overflow>" << overflow << "</overflow>\n";
- rv << xml_indent() << "<reserved>" << reserved << "</reserved>\n";
- rv << xml_indent() << "<sb_id>" << sb_id << "</sb_id>\n";
- xml_indent(-2);
- rv << xml_indent() << "</" << tag << ">\n";
- return rv.str();
-}
-
-
- void result::parse_xml(const std::string &s,const char *tag) {
- std::string field,sub;
- if (extract_xml_record(s,tag,field)) {
- std::string::size_type pos=0;
- if (extract_xml_record(field,"id",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> id;
- }
- if (extract_xml_record(field,"boinc_result",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> boinc_result;
- }
- if (extract_xml_record(field,"wuid",sub)) {
- wuid.parse_xml(sub,"wuid");
- }
- if (extract_xml_record(field,"received",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> received;
- }
- if (extract_xml_record(field,"hostid",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> hostid;
- }
- if (extract_xml_record(field,"versionid",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> versionid;
- }
- if (extract_xml_record(field,"return_code",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> return_code;
- }
- if (extract_xml_record(field,"overflow",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> overflow;
- }
- if (extract_xml_record(field,"reserved",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> reserved;
- }
- if (extract_xml_record(field,"sb_id",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> sb_id;
- }
- }
- }
-
- void result::parse(const SQL_ROW &s) {
- {
- std::istringstream row(*(s[0]));
- row >> id;
- }
- {
- std::istringstream row(*(s[1]));
- row >> boinc_result;
- }
- {
- wuid.parse(SQL_ROW(s[2],0));
- }
- {
- std::istringstream row(*(s[3]));
- row >> received;
- }
- {
- std::istringstream row(*(s[4]));
- row >> hostid;
- }
- {
- std::istringstream row(*(s[5]));
- row >> versionid;
- }
- {
- std::istringstream row(*(s[6]));
- row >> return_code;
- }
- {
- std::istringstream row(*(s[7]));
- row >> overflow;
- }
- {
- std::istringstream row(*(s[8]));
- row >> reserved;
- }
- {
- std::istringstream row(*(s[9]));
- row >> sb_id;
- }
- }
-
- void result::parse(const std::string &s) {
- SQL_ROW row(&s,10);
- parse(row);
- }
-
-template <> const char * const db_table<triplet>::table_name="triplet";
-template <> const char * db_table<triplet>::_search_tag=table_name;
+ if (&a != this) {
+ id=a.id;
+ boinc_result=a.boinc_result;
+ wuid=a.wuid;
+ received=a.received;
+ hostid=a.hostid;
+ versionid=a.versionid;
+ return_code=a.return_code;
+ overflow=a.overflow;
+ reserved=a.reserved;
+ sb_id=a.sb_id;
+ }
+ return (*this);
+}
+
+
+std::string result::update_format() const {
+ std::ostringstream rv("");
+
+ for (int i=2; i<10; i++) {
+ rv << "?,";
+ }
+ rv << "?";
+ return rv.str();
+}
+
+
+std::string result::insert_format() const {
+ return std::string("?,")+update_format();
+}
+
+std::string result::select_format() const {
+ std::string rv("");
+ for (int i=0; i<9; i++) {
+ rv+="?,";
+ }
+ rv+="?";
+ return rv;
+}
+
+std::string result::print(int full_subtables, int show_ids, int no_refs) const {
+ std::ostringstream rv("");
+
+ rv.precision(14);
+ if (show_ids) {
+ rv << id;
+ }
+ rv << ',';
+ rv << boinc_result;
+ rv << ',';
+ if (!no_refs) {
+ if (full_subtables) {
+ rv << wuid.print(full_subtables,show_ids,no_refs);
+ } else {
+ rv << wuid.id;
+ }
+ }
+ rv << ',';
+ rv << received;
+ rv << ',';
+ rv << hostid;
+ rv << ',';
+ rv << versionid;
+ rv << ',';
+ rv << return_code;
+ rv << ',';
+ rv << overflow;
+ rv << ',';
+ rv << reserved;
+ rv << ',';
+ rv << sb_id;
+ return rv.str();
+}
+
+
+std::string result::print_xml(int full_subtables, int show_ids, int no_refs,const char *tag) const {
+ std::ostringstream rv("");
+
+ rv.precision(14);
+ rv << xml_indent() << '<' << tag << ">\n";
+ xml_indent(2);
+ if (show_ids) {
+ rv << xml_indent() << "<id>" << id << "</id>\n";
+ }
+ rv << xml_indent() << "<boinc_result>" << boinc_result << "</boinc_result>\n";
+ if (!no_refs) {
+ if (full_subtables) {
+ rv << wuid.print_xml(full_subtables,show_ids,no_refs,"wuid");
+ } else {
+ rv << xml_indent() << "<wuid><id>" << wuid.id << "</id></wuid>\n";
+ }
+ }
+ rv << xml_indent() << "<received>" << received << "</received>\n";
+ rv << xml_indent() << "<hostid>" << hostid << "</hostid>\n";
+ rv << xml_indent() << "<versionid>" << versionid << "</versionid>\n";
+ rv << xml_indent() << "<return_code>" << return_code << "</return_code>\n";
+ rv << xml_indent() << "<overflow>" << overflow << "</overflow>\n";
+ rv << xml_indent() << "<reserved>" << reserved << "</reserved>\n";
+ rv << xml_indent() << "<sb_id>" << sb_id << "</sb_id>\n";
+ xml_indent(-2);
+ rv << xml_indent() << "</" << tag << ">\n";
+ return rv.str();
+}
+
+
+void result::parse_xml(const std::string &s,const char *tag) {
+ std::string field,sub;
+ if (extract_xml_record(s,tag,field)) {
+ std::string::size_type pos=0;
+ if (extract_xml_record(field,"id",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> id;
+ }
+ if (extract_xml_record(field,"boinc_result",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> boinc_result;
+ }
+ if (extract_xml_record(field,"wuid",sub)) {
+ wuid.parse_xml(sub,"wuid");
+ }
+ if (extract_xml_record(field,"received",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> received;
+ }
+ if (extract_xml_record(field,"hostid",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> hostid;
+ }
+ if (extract_xml_record(field,"versionid",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> versionid;
+ }
+ if (extract_xml_record(field,"return_code",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> return_code;
+ }
+ if (extract_xml_record(field,"overflow",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> overflow;
+ }
+ if (extract_xml_record(field,"reserved",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> reserved;
+ }
+ if (extract_xml_record(field,"sb_id",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> sb_id;
+ }
+ }
+}
+
+void result::parse(const SQL_ROW &s) {
+ {
+ std::istringstream row(*(s[0]));
+ row >> id;
+ }
+ {
+ std::istringstream row(*(s[1]));
+ row >> boinc_result;
+ }
+ {
+ wuid.parse(SQL_ROW(s[2],0));
+ }
+ {
+ std::istringstream row(*(s[3]));
+ row >> received;
+ }
+ {
+ std::istringstream row(*(s[4]));
+ row >> hostid;
+ }
+ {
+ std::istringstream row(*(s[5]));
+ row >> versionid;
+ }
+ {
+ std::istringstream row(*(s[6]));
+ row >> return_code;
+ }
+ {
+ std::istringstream row(*(s[7]));
+ row >> overflow;
+ }
+ {
+ std::istringstream row(*(s[8]));
+ row >> reserved;
+ }
+ {
+ std::istringstream row(*(s[9]));
+ row >> sb_id;
+ }
+}
+
+void result::parse(const std::string &s) {
+ SQL_ROW row(&s,10);
+ parse(row);
+}
+
+template <> const char *const db_table<triplet>::table_name="triplet";
+template <> const char *db_table<triplet>::_search_tag=table_name;
template <> const int db_table<triplet>::_nfields=17;
-template <> const char * const db_table<triplet>::column_names[17]={"id","result_id","peak_power","mean_power","time","ra","decl","q_pix","freq","detection_freq","barycentric_freq","fft_len","chirp_rate","rfi_checked","rfi_found","reserved","period"};
-
-triplet::triplet() :
- db_table<triplet>(*this,-1),
- id(0),
- result_id(),
- peak_power(0),
- mean_power(0),
- time(0),
- ra(0),
- decl(0),
- q_pix(0),
- freq(0),
- detection_freq(0),
- barycentric_freq(0),
- fft_len(0),
- chirp_rate(0),
- rfi_checked(0),
- rfi_found(0),
- reserved(0),
- period(0)
-{
- db_open();
-}
-
-
-triplet::triplet(const triplet &a) :
- db_table<triplet>(*this,-1),
- id(a.id),
- result_id(a.result_id),
- peak_power(a.peak_power),
- mean_power(a.mean_power),
- time(a.time),
- ra(a.ra),
- decl(a.decl),
- q_pix(a.q_pix),
- freq(a.freq),
- detection_freq(a.detection_freq),
- barycentric_freq(a.barycentric_freq),
- fft_len(a.fft_len),
- chirp_rate(a.chirp_rate),
- rfi_checked(a.rfi_checked),
- rfi_found(a.rfi_found),
- reserved(a.reserved),
- period(a.period)
-{
- db_open();
-}
-
-
-triplet::triplet(const SQL_ROW &a) :
- db_table<triplet>(*this,-1)
-{
- db_open();
- parse(a);
-}
-
-
-triplet::triplet(const std::string &s,const char *tag) :
- db_table<triplet>(*this,-1)
-{
- db_open();
- if (xml_match_tag(s,tag)) {
- parse_xml(s,tag);
- } else {
- parse(s);
- }
+template <> const char *const db_table<triplet>::column_names[17]= {"id","result_id","peak_power","mean_power","time","ra","decl","q_pix","freq","detection_freq","barycentric_freq","fft_len","chirp_rate","rfi_checked","rfi_found","reserved","period"};
+
+triplet::triplet() :
+ db_table<triplet>(*this,-1),
+ id(0),
+ result_id(),
+ peak_power(0),
+ mean_power(0),
+ time(0),
+ ra(0),
+ decl(0),
+ q_pix(0),
+ freq(0),
+ detection_freq(0),
+ barycentric_freq(0),
+ fft_len(0),
+ chirp_rate(0),
+ rfi_checked(0),
+ rfi_found(0),
+ reserved(0),
+ period(0) {
+ db_open();
+}
+
+
+triplet::triplet(const triplet &a) :
+ db_table<triplet>(*this,-1),
+ id(a.id),
+ result_id(a.result_id),
+ peak_power(a.peak_power),
+ mean_power(a.mean_power),
+ time(a.time),
+ ra(a.ra),
+ decl(a.decl),
+ q_pix(a.q_pix),
+ freq(a.freq),
+ detection_freq(a.detection_freq),
+ barycentric_freq(a.barycentric_freq),
+ fft_len(a.fft_len),
+ chirp_rate(a.chirp_rate),
+ rfi_checked(a.rfi_checked),
+ rfi_found(a.rfi_found),
+ reserved(a.reserved),
+ period(a.period) {
+ db_open();
+}
+
+
+triplet::triplet(const SQL_ROW &a) :
+ db_table<triplet>(*this,-1) {
+ db_open();
+ parse(a);
+}
+
+
+triplet::triplet(const std::string &s,const char *tag) :
+ db_table<triplet>(*this,-1) {
+ db_open();
+ if (xml_match_tag(s,tag)) {
+ parse_xml(s,tag);
+ } else {
+ parse(s);
+ }
}
triplet &triplet::operator =(const triplet &a) {
- if (&a != this) {
- id=a.id;
- result_id=a.result_id;
- peak_power=a.peak_power;
- mean_power=a.mean_power;
- time=a.time;
- ra=a.ra;
- decl=a.decl;
- q_pix=a.q_pix;
- freq=a.freq;
- detection_freq=a.detection_freq;
- barycentric_freq=a.barycentric_freq;
- fft_len=a.fft_len;
- chirp_rate=a.chirp_rate;
- rfi_checked=a.rfi_checked;
- rfi_found=a.rfi_found;
- reserved=a.reserved;
- period=a.period;
- }
- return (*this);
-}
-
-
-std::string triplet::update_format() const
-{ std::ostringstream rv("");
-
- for (int i=2;i<17;i++) rv << "?,";
- rv << "?";
- return rv.str();
-}
-
-
-std::string triplet::insert_format() const
-{ return std::string("?,")+update_format();
-}
-
-std::string triplet::select_format() const
-{
-std::string rv("");
-for (int i=0; i<16;i++) rv+="?,";
-rv+="?";
-return rv;
-}
-
-std::string triplet::print(int full_subtables, int show_ids, int no_refs) const
-{ std::ostringstream rv("");
-
- rv.precision(14);
- if (show_ids) rv << id;
- rv << ',';
- if (!no_refs) {
- if (full_subtables) {
- rv << result_id.print(full_subtables,show_ids,no_refs);
- } else {
- rv << result_id.id;
- }
- }
- rv << ',';
- rv << peak_power;
- rv << ',';
- rv << mean_power;
- rv << ',';
- rv << time;
- rv << ',';
- rv << ra;
- rv << ',';
- rv << decl;
- rv << ',';
- rv << q_pix;
- rv << ',';
- rv << freq;
- rv << ',';
- rv << detection_freq;
- rv << ',';
- rv << barycentric_freq;
- rv << ',';
- rv << fft_len;
- rv << ',';
- rv << chirp_rate;
- rv << ',';
- rv << rfi_checked;
- rv << ',';
- rv << rfi_found;
- rv << ',';
- rv << reserved;
- rv << ',';
- rv << period;
- return rv.str();
-}
-
-
-std::string triplet::print_xml(int full_subtables, int show_ids, int no_refs,const char *tag) const
-{
- std::ostringstream rv("");
-
- rv.precision(14);
- rv << xml_indent() << '<' << tag << ">\n";
- xml_indent(2);
- if (show_ids) rv << xml_indent() << "<id>" << id << "</id>\n";
- if (!no_refs) {
- if (full_subtables) {
- rv << result_id.print_xml(full_subtables,show_ids,no_refs,"result_id");
- } else {
- rv << xml_indent() << "<result_id><id>" << result_id.id << "</id></result_id>\n";
- }
- }
- rv << xml_indent() << "<peak_power>" << peak_power << "</peak_power>\n";
- rv << xml_indent() << "<mean_power>" << mean_power << "</mean_power>\n";
- rv << xml_indent() << "<time>" << time << "</time>\n";
- rv << xml_indent() << "<ra>" << ra << "</ra>\n";
- rv << xml_indent() << "<decl>" << decl << "</decl>\n";
- rv << xml_indent() << "<q_pix>" << q_pix << "</q_pix>\n";
- rv << xml_indent() << "<freq>" << freq << "</freq>\n";
- rv << xml_indent() << "<detection_freq>" << detection_freq << "</detection_freq>\n";
- rv << xml_indent() << "<barycentric_freq>" << barycentric_freq << "</barycentric_freq>\n";
- rv << xml_indent() << "<fft_len>" << fft_len << "</fft_len>\n";
- rv << xml_indent() << "<chirp_rate>" << chirp_rate << "</chirp_rate>\n";
- rv << xml_indent() << "<rfi_checked>" << rfi_checked << "</rfi_checked>\n";
- rv << xml_indent() << "<rfi_found>" << rfi_found << "</rfi_found>\n";
- rv << xml_indent() << "<reserved>" << reserved << "</reserved>\n";
- rv << xml_indent() << "<period>" << period << "</period>\n";
- xml_indent(-2);
- rv << xml_indent() << "</" << tag << ">\n";
- return rv.str();
-}
-
-
- void triplet::parse_xml(const std::string &s,const char *tag) {
- std::string field,sub;
- if (extract_xml_record(s,tag,field)) {
- std::string::size_type pos=0;
- if (extract_xml_record(field,"id",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> id;
- }
- if (extract_xml_record(field,"result_id",sub)) {
- result_id.parse_xml(sub,"result_id");
- }
- if (extract_xml_record(field,"peak_power",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> peak_power;
- }
- if (extract_xml_record(field,"mean_power",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> mean_power;
- }
- if (extract_xml_record(field,"time",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> time;
- }
- if (extract_xml_record(field,"ra",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> ra;
- }
- if (extract_xml_record(field,"decl",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> decl;
- }
- if (extract_xml_record(field,"q_pix",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> q_pix;
- }
- if (extract_xml_record(field,"freq",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> freq;
- }
- if (extract_xml_record(field,"detection_freq",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> detection_freq;
- }
- if (extract_xml_record(field,"barycentric_freq",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> barycentric_freq;
- }
- if (extract_xml_record(field,"fft_len",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> fft_len;
- }
- if (extract_xml_record(field,"chirp_rate",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> chirp_rate;
- }
- if (extract_xml_record(field,"rfi_checked",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> rfi_checked;
- }
- if (extract_xml_record(field,"rfi_found",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> rfi_found;
- }
- if (extract_xml_record(field,"reserved",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> reserved;
- }
- if (extract_xml_record(field,"period",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> period;
- }
- }
- }
-
- void triplet::parse(const SQL_ROW &s) {
- {
- std::istringstream row(*(s[0]));
- row >> id;
- }
- {
- result_id.parse(SQL_ROW(s[1],0));
- }
- {
- std::istringstream row(*(s[2]));
- row >> peak_power;
- }
- {
- std::istringstream row(*(s[3]));
- row >> mean_power;
- }
- {
- std::istringstream row(*(s[4]));
- row >> time;
- }
- {
- std::istringstream row(*(s[5]));
- row >> ra;
- }
- {
- std::istringstream row(*(s[6]));
- row >> decl;
- }
- {
- std::istringstream row(*(s[7]));
- row >> q_pix;
- }
- {
- std::istringstream row(*(s[8]));
- row >> freq;
- }
- {
- std::istringstream row(*(s[9]));
- row >> detection_freq;
- }
- {
- std::istringstream row(*(s[10]));
- row >> barycentric_freq;
- }
- {
- std::istringstream row(*(s[11]));
- row >> fft_len;
- }
- {
- std::istringstream row(*(s[12]));
- row >> chirp_rate;
- }
- {
- std::istringstream row(*(s[13]));
- row >> rfi_checked;
- }
- {
- std::istringstream row(*(s[14]));
- row >> rfi_found;
- }
- {
- std::istringstream row(*(s[15]));
- row >> reserved;
- }
- {
- std::istringstream row(*(s[16]));
- row >> period;
- }
- }
-
- void triplet::parse(const std::string &s) {
- SQL_ROW row(&s,17);
- parse(row);
- }
-
-template <> const char * const db_table<triplet_small>::table_name="triplet_small";
-template <> const char * db_table<triplet_small>::_search_tag=table_name;
+ if (&a != this) {
+ id=a.id;
+ result_id=a.result_id;
+ peak_power=a.peak_power;
+ mean_power=a.mean_power;
+ time=a.time;
+ ra=a.ra;
+ decl=a.decl;
+ q_pix=a.q_pix;
+ freq=a.freq;
+ detection_freq=a.detection_freq;
+ barycentric_freq=a.barycentric_freq;
+ fft_len=a.fft_len;
+ chirp_rate=a.chirp_rate;
+ rfi_checked=a.rfi_checked;
+ rfi_found=a.rfi_found;
+ reserved=a.reserved;
+ period=a.period;
+ }
+ return (*this);
+}
+
+
+std::string triplet::update_format() const {
+ std::ostringstream rv("");
+
+ for (int i=2; i<17; i++) {
+ rv << "?,";
+ }
+ rv << "?";
+ return rv.str();
+}
+
+
+std::string triplet::insert_format() const {
+ return std::string("?,")+update_format();
+}
+
+std::string triplet::select_format() const {
+ std::string rv("");
+ for (int i=0; i<16; i++) {
+ rv+="?,";
+ }
+ rv+="?";
+ return rv;
+}
+
+std::string triplet::print(int full_subtables, int show_ids, int no_refs) const {
+ std::ostringstream rv("");
+
+ rv.precision(14);
+ if (show_ids) {
+ rv << id;
+ }
+ rv << ',';
+ if (!no_refs) {
+ if (full_subtables) {
+ rv << result_id.print(full_subtables,show_ids,no_refs);
+ } else {
+ rv << result_id.id;
+ }
+ }
+ rv << ',';
+ rv << peak_power;
+ rv << ',';
+ rv << mean_power;
+ rv << ',';
+ rv << time;
+ rv << ',';
+ rv << ra;
+ rv << ',';
+ rv << decl;
+ rv << ',';
+ rv << q_pix;
+ rv << ',';
+ rv << freq;
+ rv << ',';
+ rv << detection_freq;
+ rv << ',';
+ rv << barycentric_freq;
+ rv << ',';
+ rv << fft_len;
+ rv << ',';
+ rv << chirp_rate;
+ rv << ',';
+ rv << rfi_checked;
+ rv << ',';
+ rv << rfi_found;
+ rv << ',';
+ rv << reserved;
+ rv << ',';
+ rv << period;
+ return rv.str();
+}
+
+
+std::string triplet::print_xml(int full_subtables, int show_ids, int no_refs,const char *tag) const {
+ std::ostringstream rv("");
+
+ rv.precision(14);
+ rv << xml_indent() << '<' << tag << ">\n";
+ xml_indent(2);
+ if (show_ids) {
+ rv << xml_indent() << "<id>" << id << "</id>\n";
+ }
+ if (!no_refs) {
+ if (full_subtables) {
+ rv << result_id.print_xml(full_subtables,show_ids,no_refs,"result_id");
+ } else {
+ rv << xml_indent() << "<result_id><id>" << result_id.id << "</id></result_id>\n";
+ }
+ }
+ rv << xml_indent() << "<peak_power>" << peak_power << "</peak_power>\n";
+ rv << xml_indent() << "<mean_power>" << mean_power << "</mean_power>\n";
+ rv << xml_indent() << "<time>" << time << "</time>\n";
+ rv << xml_indent() << "<ra>" << ra << "</ra>\n";
+ rv << xml_indent() << "<decl>" << decl << "</decl>\n";
+ rv << xml_indent() << "<q_pix>" << q_pix << "</q_pix>\n";
+ rv << xml_indent() << "<freq>" << freq << "</freq>\n";
+ rv << xml_indent() << "<detection_freq>" << detection_freq << "</detection_freq>\n";
+ rv << xml_indent() << "<barycentric_freq>" << barycentric_freq << "</barycentric_freq>\n";
+ rv << xml_indent() << "<fft_len>" << fft_len << "</fft_len>\n";
+ rv << xml_indent() << "<chirp_rate>" << chirp_rate << "</chirp_rate>\n";
+ rv << xml_indent() << "<rfi_checked>" << rfi_checked << "</rfi_checked>\n";
+ rv << xml_indent() << "<rfi_found>" << rfi_found << "</rfi_found>\n";
+ rv << xml_indent() << "<reserved>" << reserved << "</reserved>\n";
+ rv << xml_indent() << "<period>" << period << "</period>\n";
+ xml_indent(-2);
+ rv << xml_indent() << "</" << tag << ">\n";
+ return rv.str();
+}
+
+
+void triplet::parse_xml(const std::string &s,const char *tag) {
+ std::string field,sub;
+ if (extract_xml_record(s,tag,field)) {
+ std::string::size_type pos=0;
+ if (extract_xml_record(field,"id",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> id;
+ }
+ if (extract_xml_record(field,"result_id",sub)) {
+ result_id.parse_xml(sub,"result_id");
+ }
+ if (extract_xml_record(field,"peak_power",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> peak_power;
+ }
+ if (extract_xml_record(field,"mean_power",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> mean_power;
+ }
+ if (extract_xml_record(field,"time",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> time;
+ }
+ if (extract_xml_record(field,"ra",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> ra;
+ }
+ if (extract_xml_record(field,"decl",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> decl;
+ }
+ if (extract_xml_record(field,"q_pix",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> q_pix;
+ }
+ if (extract_xml_record(field,"freq",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> freq;
+ }
+ if (extract_xml_record(field,"detection_freq",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> detection_freq;
+ }
+ if (extract_xml_record(field,"barycentric_freq",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> barycentric_freq;
+ }
+ if (extract_xml_record(field,"fft_len",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> fft_len;
+ }
+ if (extract_xml_record(field,"chirp_rate",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> chirp_rate;
+ }
+ if (extract_xml_record(field,"rfi_checked",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> rfi_checked;
+ }
+ if (extract_xml_record(field,"rfi_found",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> rfi_found;
+ }
+ if (extract_xml_record(field,"reserved",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> reserved;
+ }
+ if (extract_xml_record(field,"period",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> period;
+ }
+ }
+}
+
+void triplet::parse(const SQL_ROW &s) {
+ {
+ std::istringstream row(*(s[0]));
+ row >> id;
+ }
+ {
+ result_id.parse(SQL_ROW(s[1],0));
+ }
+ {
+ std::istringstream row(*(s[2]));
+ row >> peak_power;
+ }
+ {
+ std::istringstream row(*(s[3]));
+ row >> mean_power;
+ }
+ {
+ std::istringstream row(*(s[4]));
+ row >> time;
+ }
+ {
+ std::istringstream row(*(s[5]));
+ row >> ra;
+ }
+ {
+ std::istringstream row(*(s[6]));
+ row >> decl;
+ }
+ {
+ std::istringstream row(*(s[7]));
+ row >> q_pix;
+ }
+ {
+ std::istringstream row(*(s[8]));
+ row >> freq;
+ }
+ {
+ std::istringstream row(*(s[9]));
+ row >> detection_freq;
+ }
+ {
+ std::istringstream row(*(s[10]));
+ row >> barycentric_freq;
+ }
+ {
+ std::istringstream row(*(s[11]));
+ row >> fft_len;
+ }
+ {
+ std::istringstream row(*(s[12]));
+ row >> chirp_rate;
+ }
+ {
+ std::istringstream row(*(s[13]));
+ row >> rfi_checked;
+ }
+ {
+ std::istringstream row(*(s[14]));
+ row >> rfi_found;
+ }
+ {
+ std::istringstream row(*(s[15]));
+ row >> reserved;
+ }
+ {
+ std::istringstream row(*(s[16]));
+ row >> period;
+ }
+}
+
+void triplet::parse(const std::string &s) {
+ SQL_ROW row(&s,17);
+ parse(row);
+}
+
+template <> const char *const db_table<triplet_small>::table_name="triplet_small";
+template <> const char *db_table<triplet_small>::_search_tag=table_name;
template <> const int db_table<triplet_small>::_nfields=17;
-template <> const char * const db_table<triplet_small>::column_names[17]={"id","result_id","peak_power","mean_power","time","ra","decl","q_pix","freq","detection_freq","barycentric_freq","fft_len","chirp_rate","rfi_checked","rfi_found","reserved","period"};
-
-triplet_small::triplet_small() :
- db_table<triplet_small>(*this,-1),
- id(0),
- result_id(),
- peak_power(0),
- mean_power(0),
- time(0),
- ra(0),
- decl(0),
- q_pix(0),
- freq(0),
- detection_freq(0),
- barycentric_freq(0),
- fft_len(0),
- chirp_rate(0),
- rfi_checked(0),
- rfi_found(0),
- reserved(0),
- period(0)
-{
- db_open();
-}
-
-
-triplet_small::triplet_small(const triplet_small &a) :
- db_table<triplet_small>(*this,-1),
- id(a.id),
- result_id(a.result_id),
- peak_power(a.peak_power),
- mean_power(a.mean_power),
- time(a.time),
- ra(a.ra),
- decl(a.decl),
- q_pix(a.q_pix),
- freq(a.freq),
- detection_freq(a.detection_freq),
- barycentric_freq(a.barycentric_freq),
- fft_len(a.fft_len),
- chirp_rate(a.chirp_rate),
- rfi_checked(a.rfi_checked),
- rfi_found(a.rfi_found),
- reserved(a.reserved),
- period(a.period)
-{
- db_open();
-}
-
-
-triplet_small::triplet_small(const SQL_ROW &a) :
- db_table<triplet_small>(*this,-1)
-{
- db_open();
- parse(a);
-}
-
-
-triplet_small::triplet_small(const std::string &s,const char *tag) :
- db_table<triplet_small>(*this,-1)
-{
- db_open();
- if (xml_match_tag(s,tag)) {
- parse_xml(s,tag);
- } else {
- parse(s);
- }
+template <> const char *const db_table<triplet_small>::column_names[17]= {"id","result_id","peak_power","mean_power","time","ra","decl","q_pix","freq","detection_freq","barycentric_freq","fft_len","chirp_rate","rfi_checked","rfi_found","reserved","period"};
+
+triplet_small::triplet_small() :
+ db_table<triplet_small>(*this,-1),
+ id(0),
+ result_id(),
+ peak_power(0),
+ mean_power(0),
+ time(0),
+ ra(0),
+ decl(0),
+ q_pix(0),
+ freq(0),
+ detection_freq(0),
+ barycentric_freq(0),
+ fft_len(0),
+ chirp_rate(0),
+ rfi_checked(0),
+ rfi_found(0),
+ reserved(0),
+ period(0) {
+ db_open();
+}
+
+
+triplet_small::triplet_small(const triplet_small &a) :
+ db_table<triplet_small>(*this,-1),
+ id(a.id),
+ result_id(a.result_id),
+ peak_power(a.peak_power),
+ mean_power(a.mean_power),
+ time(a.time),
+ ra(a.ra),
+ decl(a.decl),
+ q_pix(a.q_pix),
+ freq(a.freq),
+ detection_freq(a.detection_freq),
+ barycentric_freq(a.barycentric_freq),
+ fft_len(a.fft_len),
+ chirp_rate(a.chirp_rate),
+ rfi_checked(a.rfi_checked),
+ rfi_found(a.rfi_found),
+ reserved(a.reserved),
+ period(a.period) {
+ db_open();
+}
+
+
+triplet_small::triplet_small(const SQL_ROW &a) :
+ db_table<triplet_small>(*this,-1) {
+ db_open();
+ parse(a);
+}
+
+
+triplet_small::triplet_small(const std::string &s,const char *tag) :
+ db_table<triplet_small>(*this,-1) {
+ db_open();
+ if (xml_match_tag(s,tag)) {
+ parse_xml(s,tag);
+ } else {
+ parse(s);
+ }
}
triplet_small &triplet_small::operator =(const triplet_small &a) {
- if (&a != this) {
- id=a.id;
- result_id=a.result_id;
- peak_power=a.peak_power;
- mean_power=a.mean_power;
- time=a.time;
- ra=a.ra;
- decl=a.decl;
- q_pix=a.q_pix;
- freq=a.freq;
- detection_freq=a.detection_freq;
- barycentric_freq=a.barycentric_freq;
- fft_len=a.fft_len;
- chirp_rate=a.chirp_rate;
- rfi_checked=a.rfi_checked;
- rfi_found=a.rfi_found;
- reserved=a.reserved;
- period=a.period;
- }
- return (*this);
-}
-
-
-std::string triplet_small::update_format() const
-{ std::ostringstream rv("");
-
- for (int i=2;i<17;i++) rv << "?,";
- rv << "?";
- return rv.str();
-}
-
-
-std::string triplet_small::insert_format() const
-{ return std::string("?,")+update_format();
-}
-
-std::string triplet_small::select_format() const
-{
-std::string rv("");
-for (int i=0; i<16;i++) rv+="?,";
-rv+="?";
-return rv;
-}
-
-std::string triplet_small::print(int full_subtables, int show_ids, int no_refs) const
-{ std::ostringstream rv("");
-
- rv.precision(14);
- if (show_ids) rv << id;
- rv << ',';
- if (!no_refs) {
- if (full_subtables) {
- rv << result_id.print(full_subtables,show_ids,no_refs);
- } else {
- rv << result_id.id;
- }
- }
- rv << ',';
- rv << peak_power;
- rv << ',';
- rv << mean_power;
- rv << ',';
- rv << time;
- rv << ',';
- rv << ra;
- rv << ',';
- rv << decl;
- rv << ',';
- rv << q_pix;
- rv << ',';
- rv << freq;
- rv << ',';
- rv << detection_freq;
- rv << ',';
- rv << barycentric_freq;
- rv << ',';
- rv << fft_len;
- rv << ',';
- rv << chirp_rate;
- rv << ',';
- rv << rfi_checked;
- rv << ',';
- rv << rfi_found;
- rv << ',';
- rv << reserved;
- rv << ',';
- rv << period;
- return rv.str();
-}
-
-
-std::string triplet_small::print_xml(int full_subtables, int show_ids, int no_refs,const char *tag) const
-{
- std::ostringstream rv("");
-
- rv.precision(14);
- rv << xml_indent() << '<' << tag << ">\n";
- xml_indent(2);
- if (show_ids) rv << xml_indent() << "<id>" << id << "</id>\n";
- if (!no_refs) {
- if (full_subtables) {
- rv << result_id.print_xml(full_subtables,show_ids,no_refs,"result_id");
- } else {
- rv << xml_indent() << "<result_id><id>" << result_id.id << "</id></result_id>\n";
- }
- }
- rv << xml_indent() << "<peak_power>" << peak_power << "</peak_power>\n";
- rv << xml_indent() << "<mean_power>" << mean_power << "</mean_power>\n";
- rv << xml_indent() << "<time>" << time << "</time>\n";
- rv << xml_indent() << "<ra>" << ra << "</ra>\n";
- rv << xml_indent() << "<decl>" << decl << "</decl>\n";
- rv << xml_indent() << "<q_pix>" << q_pix << "</q_pix>\n";
- rv << xml_indent() << "<freq>" << freq << "</freq>\n";
- rv << xml_indent() << "<detection_freq>" << detection_freq << "</detection_freq>\n";
- rv << xml_indent() << "<barycentric_freq>" << barycentric_freq << "</barycentric_freq>\n";
- rv << xml_indent() << "<fft_len>" << fft_len << "</fft_len>\n";
- rv << xml_indent() << "<chirp_rate>" << chirp_rate << "</chirp_rate>\n";
- rv << xml_indent() << "<rfi_checked>" << rfi_checked << "</rfi_checked>\n";
- rv << xml_indent() << "<rfi_found>" << rfi_found << "</rfi_found>\n";
- rv << xml_indent() << "<reserved>" << reserved << "</reserved>\n";
- rv << xml_indent() << "<period>" << period << "</period>\n";
- xml_indent(-2);
- rv << xml_indent() << "</" << tag << ">\n";
- return rv.str();
-}
-
-
- void triplet_small::parse_xml(const std::string &s,const char *tag) {
- std::string field,sub;
- if (extract_xml_record(s,tag,field)) {
- std::string::size_type pos=0;
- if (extract_xml_record(field,"id",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> id;
- }
- if (extract_xml_record(field,"result_id",sub)) {
- result_id.parse_xml(sub,"result_id");
- }
- if (extract_xml_record(field,"peak_power",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> peak_power;
- }
- if (extract_xml_record(field,"mean_power",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> mean_power;
- }
- if (extract_xml_record(field,"time",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> time;
- }
- if (extract_xml_record(field,"ra",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> ra;
- }
- if (extract_xml_record(field,"decl",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> decl;
- }
- if (extract_xml_record(field,"q_pix",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> q_pix;
- }
- if (extract_xml_record(field,"freq",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> freq;
- }
- if (extract_xml_record(field,"detection_freq",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> detection_freq;
- }
- if (extract_xml_record(field,"barycentric_freq",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> barycentric_freq;
- }
- if (extract_xml_record(field,"fft_len",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> fft_len;
- }
- if (extract_xml_record(field,"chirp_rate",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> chirp_rate;
- }
- if (extract_xml_record(field,"rfi_checked",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> rfi_checked;
- }
- if (extract_xml_record(field,"rfi_found",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> rfi_found;
- }
- if (extract_xml_record(field,"reserved",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> reserved;
- }
- if (extract_xml_record(field,"period",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> period;
- }
- }
- }
-
- void triplet_small::parse(const SQL_ROW &s) {
- {
- std::istringstream row(*(s[0]));
- row >> id;
- }
- {
- result_id.parse(SQL_ROW(s[1],0));
- }
- {
- std::istringstream row(*(s[2]));
- row >> peak_power;
- }
- {
- std::istringstream row(*(s[3]));
- row >> mean_power;
- }
- {
- std::istringstream row(*(s[4]));
- row >> time;
- }
- {
- std::istringstream row(*(s[5]));
- row >> ra;
- }
- {
- std::istringstream row(*(s[6]));
- row >> decl;
- }
- {
- std::istringstream row(*(s[7]));
- row >> q_pix;
- }
- {
- std::istringstream row(*(s[8]));
- row >> freq;
- }
- {
- std::istringstream row(*(s[9]));
- row >> detection_freq;
- }
- {
- std::istringstream row(*(s[10]));
- row >> barycentric_freq;
- }
- {
- std::istringstream row(*(s[11]));
- row >> fft_len;
- }
- {
- std::istringstream row(*(s[12]));
- row >> chirp_rate;
- }
- {
- std::istringstream row(*(s[13]));
- row >> rfi_checked;
- }
- {
- std::istringstream row(*(s[14]));
- row >> rfi_found;
- }
- {
- std::istringstream row(*(s[15]));
- row >> reserved;
- }
- {
- std::istringstream row(*(s[16]));
- row >> period;
- }
- }
-
- void triplet_small::parse(const std::string &s) {
- SQL_ROW row(&s,17);
- parse(row);
- }
-
-template <> const char * const db_table<gaussian>::table_name="gaussian";
-template <> const char * db_table<gaussian>::_search_tag=table_name;
+ if (&a != this) {
+ id=a.id;
+ result_id=a.result_id;
+ peak_power=a.peak_power;
+ mean_power=a.mean_power;
+ time=a.time;
+ ra=a.ra;
+ decl=a.decl;
+ q_pix=a.q_pix;
+ freq=a.freq;
+ detection_freq=a.detection_freq;
+ barycentric_freq=a.barycentric_freq;
+ fft_len=a.fft_len;
+ chirp_rate=a.chirp_rate;
+ rfi_checked=a.rfi_checked;
+ rfi_found=a.rfi_found;
+ reserved=a.reserved;
+ period=a.period;
+ }
+ return (*this);
+}
+
+
+std::string triplet_small::update_format() const {
+ std::ostringstream rv("");
+
+ for (int i=2; i<17; i++) {
+ rv << "?,";
+ }
+ rv << "?";
+ return rv.str();
+}
+
+
+std::string triplet_small::insert_format() const {
+ return std::string("?,")+update_format();
+}
+
+std::string triplet_small::select_format() const {
+ std::string rv("");
+ for (int i=0; i<16; i++) {
+ rv+="?,";
+ }
+ rv+="?";
+ return rv;
+}
+
+std::string triplet_small::print(int full_subtables, int show_ids, int no_refs) const {
+ std::ostringstream rv("");
+
+ rv.precision(14);
+ if (show_ids) {
+ rv << id;
+ }
+ rv << ',';
+ if (!no_refs) {
+ if (full_subtables) {
+ rv << result_id.print(full_subtables,show_ids,no_refs);
+ } else {
+ rv << result_id.id;
+ }
+ }
+ rv << ',';
+ rv << peak_power;
+ rv << ',';
+ rv << mean_power;
+ rv << ',';
+ rv << time;
+ rv << ',';
+ rv << ra;
+ rv << ',';
+ rv << decl;
+ rv << ',';
+ rv << q_pix;
+ rv << ',';
+ rv << freq;
+ rv << ',';
+ rv << detection_freq;
+ rv << ',';
+ rv << barycentric_freq;
+ rv << ',';
+ rv << fft_len;
+ rv << ',';
+ rv << chirp_rate;
+ rv << ',';
+ rv << rfi_checked;
+ rv << ',';
+ rv << rfi_found;
+ rv << ',';
+ rv << reserved;
+ rv << ',';
+ rv << period;
+ return rv.str();
+}
+
+
+std::string triplet_small::print_xml(int full_subtables, int show_ids, int no_refs,const char *tag) const {
+ std::ostringstream rv("");
+
+ rv.precision(14);
+ rv << xml_indent() << '<' << tag << ">\n";
+ xml_indent(2);
+ if (show_ids) {
+ rv << xml_indent() << "<id>" << id << "</id>\n";
+ }
+ if (!no_refs) {
+ if (full_subtables) {
+ rv << result_id.print_xml(full_subtables,show_ids,no_refs,"result_id");
+ } else {
+ rv << xml_indent() << "<result_id><id>" << result_id.id << "</id></result_id>\n";
+ }
+ }
+ rv << xml_indent() << "<peak_power>" << peak_power << "</peak_power>\n";
+ rv << xml_indent() << "<mean_power>" << mean_power << "</mean_power>\n";
+ rv << xml_indent() << "<time>" << time << "</time>\n";
+ rv << xml_indent() << "<ra>" << ra << "</ra>\n";
+ rv << xml_indent() << "<decl>" << decl << "</decl>\n";
+ rv << xml_indent() << "<q_pix>" << q_pix << "</q_pix>\n";
+ rv << xml_indent() << "<freq>" << freq << "</freq>\n";
+ rv << xml_indent() << "<detection_freq>" << detection_freq << "</detection_freq>\n";
+ rv << xml_indent() << "<barycentric_freq>" << barycentric_freq << "</barycentric_freq>\n";
+ rv << xml_indent() << "<fft_len>" << fft_len << "</fft_len>\n";
+ rv << xml_indent() << "<chirp_rate>" << chirp_rate << "</chirp_rate>\n";
+ rv << xml_indent() << "<rfi_checked>" << rfi_checked << "</rfi_checked>\n";
+ rv << xml_indent() << "<rfi_found>" << rfi_found << "</rfi_found>\n";
+ rv << xml_indent() << "<reserved>" << reserved << "</reserved>\n";
+ rv << xml_indent() << "<period>" << period << "</period>\n";
+ xml_indent(-2);
+ rv << xml_indent() << "</" << tag << ">\n";
+ return rv.str();
+}
+
+
+void triplet_small::parse_xml(const std::string &s,const char *tag) {
+ std::string field,sub;
+ if (extract_xml_record(s,tag,field)) {
+ std::string::size_type pos=0;
+ if (extract_xml_record(field,"id",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> id;
+ }
+ if (extract_xml_record(field,"result_id",sub)) {
+ result_id.parse_xml(sub,"result_id");
+ }
+ if (extract_xml_record(field,"peak_power",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> peak_power;
+ }
+ if (extract_xml_record(field,"mean_power",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> mean_power;
+ }
+ if (extract_xml_record(field,"time",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> time;
+ }
+ if (extract_xml_record(field,"ra",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> ra;
+ }
+ if (extract_xml_record(field,"decl",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> decl;
+ }
+ if (extract_xml_record(field,"q_pix",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> q_pix;
+ }
+ if (extract_xml_record(field,"freq",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> freq;
+ }
+ if (extract_xml_record(field,"detection_freq",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> detection_freq;
+ }
+ if (extract_xml_record(field,"barycentric_freq",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> barycentric_freq;
+ }
+ if (extract_xml_record(field,"fft_len",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> fft_len;
+ }
+ if (extract_xml_record(field,"chirp_rate",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> chirp_rate;
+ }
+ if (extract_xml_record(field,"rfi_checked",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> rfi_checked;
+ }
+ if (extract_xml_record(field,"rfi_found",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> rfi_found;
+ }
+ if (extract_xml_record(field,"reserved",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> reserved;
+ }
+ if (extract_xml_record(field,"period",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> period;
+ }
+ }
+}
+
+void triplet_small::parse(const SQL_ROW &s) {
+ {
+ std::istringstream row(*(s[0]));
+ row >> id;
+ }
+ {
+ result_id.parse(SQL_ROW(s[1],0));
+ }
+ {
+ std::istringstream row(*(s[2]));
+ row >> peak_power;
+ }
+ {
+ std::istringstream row(*(s[3]));
+ row >> mean_power;
+ }
+ {
+ std::istringstream row(*(s[4]));
+ row >> time;
+ }
+ {
+ std::istringstream row(*(s[5]));
+ row >> ra;
+ }
+ {
+ std::istringstream row(*(s[6]));
+ row >> decl;
+ }
+ {
+ std::istringstream row(*(s[7]));
+ row >> q_pix;
+ }
+ {
+ std::istringstream row(*(s[8]));
+ row >> freq;
+ }
+ {
+ std::istringstream row(*(s[9]));
+ row >> detection_freq;
+ }
+ {
+ std::istringstream row(*(s[10]));
+ row >> barycentric_freq;
+ }
+ {
+ std::istringstream row(*(s[11]));
+ row >> fft_len;
+ }
+ {
+ std::istringstream row(*(s[12]));
+ row >> chirp_rate;
+ }
+ {
+ std::istringstream row(*(s[13]));
+ row >> rfi_checked;
+ }
+ {
+ std::istringstream row(*(s[14]));
+ row >> rfi_found;
+ }
+ {
+ std::istringstream row(*(s[15]));
+ row >> reserved;
+ }
+ {
+ std::istringstream row(*(s[16]));
+ row >> period;
+ }
+}
+
+void triplet_small::parse(const std::string &s) {
+ SQL_ROW row(&s,17);
+ parse(row);
+}
+
+template <> const char *const db_table<gaussian>::table_name="gaussian";
+template <> const char *db_table<gaussian>::_search_tag=table_name;
template <> const int db_table<gaussian>::_nfields=22;
-template <> const char * const db_table<gaussian>::column_names[22]={"id","result_id","peak_power","mean_power","time","ra","decl","q_pix","freq","detection_freq","barycentric_freq","fft_len","chirp_rate","rfi_checked","rfi_found","reserved","sigma","chisqr","null_chisqr","score","max_power","pot"};
-
-gaussian::gaussian() :
- db_table<gaussian>(*this,-1),
- id(0),
- result_id(),
- peak_power(0),
- mean_power(0),
- time(0),
- ra(0),
- decl(0),
- q_pix(0),
- freq(0),
- detection_freq(0),
- barycentric_freq(0),
- fft_len(0),
- chirp_rate(0),
- rfi_checked(0),
- rfi_found(0),
- reserved(0),
- sigma(0),
- chisqr(0),
- null_chisqr(0),
- score(0),
- max_power(0),
- pot((unsigned char *)0,0,_x_csv)
-{
- db_open();
-}
-
-
-gaussian::gaussian(const gaussian &a) :
- db_table<gaussian>(*this,-1),
- id(a.id),
- result_id(a.result_id),
- peak_power(a.peak_power),
- mean_power(a.mean_power),
- time(a.time),
- ra(a.ra),
- decl(a.decl),
- q_pix(a.q_pix),
- freq(a.freq),
- detection_freq(a.detection_freq),
- barycentric_freq(a.barycentric_freq),
- fft_len(a.fft_len),
- chirp_rate(a.chirp_rate),
- rfi_checked(a.rfi_checked),
- rfi_found(a.rfi_found),
- reserved(a.reserved),
- sigma(a.sigma),
- chisqr(a.chisqr),
- null_chisqr(a.null_chisqr),
- score(a.score),
- max_power(a.max_power),
- pot(a.pot)
-{
- db_open();
-}
-
-
-gaussian::gaussian(const SQL_ROW &a) :
- db_table<gaussian>(*this,-1)
-{
- db_open();
- parse(a);
-}
-
-
-gaussian::gaussian(const std::string &s,const char *tag) :
- db_table<gaussian>(*this,-1)
-{
- db_open();
- if (xml_match_tag(s,tag)) {
- parse_xml(s,tag);
- } else {
- parse(s);
- }
+template <> const char *const db_table<gaussian>::column_names[22]= {"id","result_id","peak_power","mean_power","time","ra","decl","q_pix","freq","detection_freq","barycentric_freq","fft_len","chirp_rate","rfi_checked","rfi_found","reserved","sigma","chisqr","null_chisqr","score","max_power","pot"};
+
+gaussian::gaussian() :
+ db_table<gaussian>(*this,-1),
+ id(0),
+ result_id(),
+ peak_power(0),
+ mean_power(0),
+ time(0),
+ ra(0),
+ decl(0),
+ q_pix(0),
+ freq(0),
+ detection_freq(0),
+ barycentric_freq(0),
+ fft_len(0),
+ chirp_rate(0),
+ rfi_checked(0),
+ rfi_found(0),
+ reserved(0),
+ sigma(0),
+ chisqr(0),
+ null_chisqr(0),
+ score(0),
+ max_power(0),
+ pot((unsigned char *)0,0,_x_csv) {
+ db_open();
+}
+
+
+gaussian::gaussian(const gaussian &a) :
+ db_table<gaussian>(*this,-1),
+ id(a.id),
+ result_id(a.result_id),
+ peak_power(a.peak_power),
+ mean_power(a.mean_power),
+ time(a.time),
+ ra(a.ra),
+ decl(a.decl),
+ q_pix(a.q_pix),
+ freq(a.freq),
+ detection_freq(a.detection_freq),
+ barycentric_freq(a.barycentric_freq),
+ fft_len(a.fft_len),
+ chirp_rate(a.chirp_rate),
+ rfi_checked(a.rfi_checked),
+ rfi_found(a.rfi_found),
+ reserved(a.reserved),
+ sigma(a.sigma),
+ chisqr(a.chisqr),
+ null_chisqr(a.null_chisqr),
+ score(a.score),
+ max_power(a.max_power),
+ pot(a.pot) {
+ db_open();
+}
+
+
+gaussian::gaussian(const SQL_ROW &a) :
+ db_table<gaussian>(*this,-1) {
+ db_open();
+ parse(a);
+}
+
+
+gaussian::gaussian(const std::string &s,const char *tag) :
+ db_table<gaussian>(*this,-1) {
+ db_open();
+ if (xml_match_tag(s,tag)) {
+ parse_xml(s,tag);
+ } else {
+ parse(s);
+ }
}
gaussian &gaussian::operator =(const gaussian &a) {
- if (&a != this) {
- id=a.id;
- result_id=a.result_id;
- peak_power=a.peak_power;
- mean_power=a.mean_power;
- time=a.time;
- ra=a.ra;
- decl=a.decl;
- q_pix=a.q_pix;
- freq=a.freq;
- detection_freq=a.detection_freq;
- barycentric_freq=a.barycentric_freq;
- fft_len=a.fft_len;
- chirp_rate=a.chirp_rate;
- rfi_checked=a.rfi_checked;
- rfi_found=a.rfi_found;
- reserved=a.reserved;
- sigma=a.sigma;
- chisqr=a.chisqr;
- null_chisqr=a.null_chisqr;
- score=a.score;
- max_power=a.max_power;
- pot=a.pot;
- }
- return (*this);
-}
-
-
-std::string gaussian::update_format() const
-{ std::ostringstream rv("");
-
- for (int i=2;i<22;i++) rv << "?,";
- rv << "?";
- return rv.str();
-}
-
-
-std::string gaussian::insert_format() const
-{ return std::string("?,")+update_format();
-}
-
-std::string gaussian::select_format() const
-{
-std::string rv("");
-for (int i=0; i<21;i++) rv+="?,";
-rv+="?";
-return rv;
-}
-
-std::string gaussian::print(int full_subtables, int show_ids, int no_refs) const
-{ std::ostringstream rv("");
-
- rv.precision(14);
- if (show_ids) rv << id;
- rv << ',';
- if (!no_refs) {
- if (full_subtables) {
- rv << result_id.print(full_subtables,show_ids,no_refs);
- } else {
- rv << result_id.id;
- }
- }
- rv << ',';
- rv << peak_power;
- rv << ',';
- rv << mean_power;
- rv << ',';
- rv << time;
- rv << ',';
- rv << ra;
- rv << ',';
- rv << decl;
- rv << ',';
- rv << q_pix;
- rv << ',';
- rv << freq;
- rv << ',';
- rv << detection_freq;
- rv << ',';
- rv << barycentric_freq;
- rv << ',';
- rv << fft_len;
- rv << ',';
- rv << chirp_rate;
- rv << ',';
- rv << rfi_checked;
- rv << ',';
- rv << rfi_found;
- rv << ',';
- rv << reserved;
- rv << ',';
- rv << sigma;
- rv << ',';
- rv << chisqr;
- rv << ',';
- rv << null_chisqr;
- rv << ',';
- rv << score;
- rv << ',';
- rv << max_power;
- rv << ',';
- rv << "<BYTE len=" << std::max(pot.size()*2,(size_t)1) << ">" << pot.print_hex() ;
- return rv.str();
-}
-
-
-std::string gaussian::print_xml(int full_subtables, int show_ids, int no_refs,const char *tag) const
-{
- std::ostringstream rv("");
-
- rv.precision(14);
- rv << xml_indent() << '<' << tag << ">\n";
- xml_indent(2);
- if (show_ids) rv << xml_indent() << "<id>" << id << "</id>\n";
- if (!no_refs) {
- if (full_subtables) {
- rv << result_id.print_xml(full_subtables,show_ids,no_refs,"result_id");
- } else {
- rv << xml_indent() << "<result_id><id>" << result_id.id << "</id></result_id>\n";
- }
- }
- rv << xml_indent() << "<peak_power>" << peak_power << "</peak_power>\n";
- rv << xml_indent() << "<mean_power>" << mean_power << "</mean_power>\n";
- rv << xml_indent() << "<time>" << time << "</time>\n";
- rv << xml_indent() << "<ra>" << ra << "</ra>\n";
- rv << xml_indent() << "<decl>" << decl << "</decl>\n";
- rv << xml_indent() << "<q_pix>" << q_pix << "</q_pix>\n";
- rv << xml_indent() << "<freq>" << freq << "</freq>\n";
- rv << xml_indent() << "<detection_freq>" << detection_freq << "</detection_freq>\n";
- rv << xml_indent() << "<barycentric_freq>" << barycentric_freq << "</barycentric_freq>\n";
- rv << xml_indent() << "<fft_len>" << fft_len << "</fft_len>\n";
- rv << xml_indent() << "<chirp_rate>" << chirp_rate << "</chirp_rate>\n";
- rv << xml_indent() << "<rfi_checked>" << rfi_checked << "</rfi_checked>\n";
- rv << xml_indent() << "<rfi_found>" << rfi_found << "</rfi_found>\n";
- rv << xml_indent() << "<reserved>" << reserved << "</reserved>\n";
- rv << xml_indent() << "<sigma>" << sigma << "</sigma>\n";
- rv << xml_indent() << "<chisqr>" << chisqr << "</chisqr>\n";
- rv << xml_indent() << "<null_chisqr>" << null_chisqr << "</null_chisqr>\n";
- rv << xml_indent() << "<score>" << score << "</score>\n";
- rv << xml_indent() << "<max_power>" << max_power << "</max_power>\n";
- if (pot.size()) {
- std::string enc_field=xml_encode_string(pot,pot.encoding);
- rv << xml_indent() << "<pot length=" << enc_field.size() << " encoding=\"" << xml_encoding_names[pot.encoding] << "\">";
- rv << enc_field << "</pot>\n";
- }
- xml_indent(-2);
- rv << xml_indent() << "</" << tag << ">\n";
- return rv.str();
-}
-
-
- void gaussian::parse_xml(const std::string &s,const char *tag) {
- std::string field,sub;
- if (extract_xml_record(s,tag,field)) {
- std::string::size_type pos=0;
- if (extract_xml_record(field,"id",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> id;
- }
- if (extract_xml_record(field,"result_id",sub)) {
- result_id.parse_xml(sub,"result_id");
- }
- if (extract_xml_record(field,"peak_power",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> peak_power;
- }
- if (extract_xml_record(field,"mean_power",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> mean_power;
- }
- if (extract_xml_record(field,"time",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> time;
- }
- if (extract_xml_record(field,"ra",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> ra;
- }
- if (extract_xml_record(field,"decl",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> decl;
- }
- if (extract_xml_record(field,"q_pix",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> q_pix;
- }
- if (extract_xml_record(field,"freq",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> freq;
- }
- if (extract_xml_record(field,"detection_freq",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> detection_freq;
- }
- if (extract_xml_record(field,"barycentric_freq",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> barycentric_freq;
- }
- if (extract_xml_record(field,"fft_len",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> fft_len;
- }
- if (extract_xml_record(field,"chirp_rate",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> chirp_rate;
- }
- if (extract_xml_record(field,"rfi_checked",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> rfi_checked;
- }
- if (extract_xml_record(field,"rfi_found",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> rfi_found;
- }
- if (extract_xml_record(field,"reserved",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> reserved;
- }
- if (extract_xml_record(field,"sigma",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> sigma;
- }
- if (extract_xml_record(field,"chisqr",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> chisqr;
- }
- if (extract_xml_record(field,"null_chisqr",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> null_chisqr;
- }
- if (extract_xml_record(field,"score",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> score;
- }
- if (extract_xml_record(field,"max_power",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> max_power;
- }
- if (extract_xml_record(field,"pot",sub)) {
- std::istringstream in(sub.c_str());
- in >> pot;
- }
- }
- }
-
- void gaussian::parse(const SQL_ROW &s) {
- {
- std::istringstream row(*(s[0]));
- row >> id;
- }
- {
- result_id.parse(SQL_ROW(s[1],0));
- }
- {
- std::istringstream row(*(s[2]));
- row >> peak_power;
- }
- {
- std::istringstream row(*(s[3]));
- row >> mean_power;
- }
- {
- std::istringstream row(*(s[4]));
- row >> time;
- }
- {
- std::istringstream row(*(s[5]));
- row >> ra;
- }
- {
- std::istringstream row(*(s[6]));
- row >> decl;
- }
- {
- std::istringstream row(*(s[7]));
- row >> q_pix;
- }
- {
- std::istringstream row(*(s[8]));
- row >> freq;
- }
- {
- std::istringstream row(*(s[9]));
- row >> detection_freq;
- }
- {
- std::istringstream row(*(s[10]));
- row >> barycentric_freq;
- }
- {
- std::istringstream row(*(s[11]));
- row >> fft_len;
- }
- {
- std::istringstream row(*(s[12]));
- row >> chirp_rate;
- }
- {
- std::istringstream row(*(s[13]));
- row >> rfi_checked;
- }
- {
- std::istringstream row(*(s[14]));
- row >> rfi_found;
- }
- {
- std::istringstream row(*(s[15]));
- row >> reserved;
- }
- {
- std::istringstream row(*(s[16]));
- row >> sigma;
- }
- {
- std::istringstream row(*(s[17]));
- row >> chisqr;
- }
- {
- std::istringstream row(*(s[18]));
- row >> null_chisqr;
- }
- {
- std::istringstream row(*(s[19]));
- row >> score;
- }
- {
- std::istringstream row(*(s[20]));
- row >> max_power;
- }
- {
- pot=sqlblob<unsigned char>(*(s[21]));
- }
- }
-
- void gaussian::parse(const std::string &s) {
- SQL_ROW row(&s,22);
- parse(row);
- }
-
-template <> const char * const db_table<gaussian_small>::table_name="gaussian_small";
-template <> const char * db_table<gaussian_small>::_search_tag=table_name;
+ if (&a != this) {
+ id=a.id;
+ result_id=a.result_id;
+ peak_power=a.peak_power;
+ mean_power=a.mean_power;
+ time=a.time;
+ ra=a.ra;
+ decl=a.decl;
+ q_pix=a.q_pix;
+ freq=a.freq;
+ detection_freq=a.detection_freq;
+ barycentric_freq=a.barycentric_freq;
+ fft_len=a.fft_len;
+ chirp_rate=a.chirp_rate;
+ rfi_checked=a.rfi_checked;
+ rfi_found=a.rfi_found;
+ reserved=a.reserved;
+ sigma=a.sigma;
+ chisqr=a.chisqr;
+ null_chisqr=a.null_chisqr;
+ score=a.score;
+ max_power=a.max_power;
+ pot=a.pot;
+ }
+ return (*this);
+}
+
+
+std::string gaussian::update_format() const {
+ std::ostringstream rv("");
+
+ for (int i=2; i<22; i++) {
+ rv << "?,";
+ }
+ rv << "?";
+ return rv.str();
+}
+
+
+std::string gaussian::insert_format() const {
+ return std::string("?,")+update_format();
+}
+
+std::string gaussian::select_format() const {
+ std::string rv("");
+ for (int i=0; i<21; i++) {
+ rv+="?,";
+ }
+ rv+="?";
+ return rv;
+}
+
+std::string gaussian::print(int full_subtables, int show_ids, int no_refs) const {
+ std::ostringstream rv("");
+
+ rv.precision(14);
+ if (show_ids) {
+ rv << id;
+ }
+ rv << ',';
+ if (!no_refs) {
+ if (full_subtables) {
+ rv << result_id.print(full_subtables,show_ids,no_refs);
+ } else {
+ rv << result_id.id;
+ }
+ }
+ rv << ',';
+ rv << peak_power;
+ rv << ',';
+ rv << mean_power;
+ rv << ',';
+ rv << time;
+ rv << ',';
+ rv << ra;
+ rv << ',';
+ rv << decl;
+ rv << ',';
+ rv << q_pix;
+ rv << ',';
+ rv << freq;
+ rv << ',';
+ rv << detection_freq;
+ rv << ',';
+ rv << barycentric_freq;
+ rv << ',';
+ rv << fft_len;
+ rv << ',';
+ rv << chirp_rate;
+ rv << ',';
+ rv << rfi_checked;
+ rv << ',';
+ rv << rfi_found;
+ rv << ',';
+ rv << reserved;
+ rv << ',';
+ rv << sigma;
+ rv << ',';
+ rv << chisqr;
+ rv << ',';
+ rv << null_chisqr;
+ rv << ',';
+ rv << score;
+ rv << ',';
+ rv << max_power;
+ rv << ',';
+ rv << "<BYTE len=" << std::max(pot.size()*2,(size_t)1) << ">" << pot.print_hex() ;
+ return rv.str();
+}
+
+
+std::string gaussian::print_xml(int full_subtables, int show_ids, int no_refs,const char *tag) const {
+ std::ostringstream rv("");
+
+ rv.precision(14);
+ rv << xml_indent() << '<' << tag << ">\n";
+ xml_indent(2);
+ if (show_ids) {
+ rv << xml_indent() << "<id>" << id << "</id>\n";
+ }
+ if (!no_refs) {
+ if (full_subtables) {
+ rv << result_id.print_xml(full_subtables,show_ids,no_refs,"result_id");
+ } else {
+ rv << xml_indent() << "<result_id><id>" << result_id.id << "</id></result_id>\n";
+ }
+ }
+ rv << xml_indent() << "<peak_power>" << peak_power << "</peak_power>\n";
+ rv << xml_indent() << "<mean_power>" << mean_power << "</mean_power>\n";
+ rv << xml_indent() << "<time>" << time << "</time>\n";
+ rv << xml_indent() << "<ra>" << ra << "</ra>\n";
+ rv << xml_indent() << "<decl>" << decl << "</decl>\n";
+ rv << xml_indent() << "<q_pix>" << q_pix << "</q_pix>\n";
+ rv << xml_indent() << "<freq>" << freq << "</freq>\n";
+ rv << xml_indent() << "<detection_freq>" << detection_freq << "</detection_freq>\n";
+ rv << xml_indent() << "<barycentric_freq>" << barycentric_freq << "</barycentric_freq>\n";
+ rv << xml_indent() << "<fft_len>" << fft_len << "</fft_len>\n";
+ rv << xml_indent() << "<chirp_rate>" << chirp_rate << "</chirp_rate>\n";
+ rv << xml_indent() << "<rfi_checked>" << rfi_checked << "</rfi_checked>\n";
+ rv << xml_indent() << "<rfi_found>" << rfi_found << "</rfi_found>\n";
+ rv << xml_indent() << "<reserved>" << reserved << "</reserved>\n";
+ rv << xml_indent() << "<sigma>" << sigma << "</sigma>\n";
+ rv << xml_indent() << "<chisqr>" << chisqr << "</chisqr>\n";
+ rv << xml_indent() << "<null_chisqr>" << null_chisqr << "</null_chisqr>\n";
+ rv << xml_indent() << "<score>" << score << "</score>\n";
+ rv << xml_indent() << "<max_power>" << max_power << "</max_power>\n";
+ if (pot.size()) {
+ std::string enc_field=xml_encode_string(pot,pot.encoding);
+ rv << xml_indent() << "<pot length=" << enc_field.size() << " encoding=\"" << xml_encoding_names[pot.encoding] << "\">";
+ rv << enc_field << "</pot>\n";
+ }
+ xml_indent(-2);
+ rv << xml_indent() << "</" << tag << ">\n";
+ return rv.str();
+}
+
+
+void gaussian::parse_xml(const std::string &s,const char *tag) {
+ std::string field,sub;
+ if (extract_xml_record(s,tag,field)) {
+ std::string::size_type pos=0;
+ if (extract_xml_record(field,"id",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> id;
+ }
+ if (extract_xml_record(field,"result_id",sub)) {
+ result_id.parse_xml(sub,"result_id");
+ }
+ if (extract_xml_record(field,"peak_power",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> peak_power;
+ }
+ if (extract_xml_record(field,"mean_power",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> mean_power;
+ }
+ if (extract_xml_record(field,"time",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> time;
+ }
+ if (extract_xml_record(field,"ra",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> ra;
+ }
+ if (extract_xml_record(field,"decl",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> decl;
+ }
+ if (extract_xml_record(field,"q_pix",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> q_pix;
+ }
+ if (extract_xml_record(field,"freq",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> freq;
+ }
+ if (extract_xml_record(field,"detection_freq",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> detection_freq;
+ }
+ if (extract_xml_record(field,"barycentric_freq",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> barycentric_freq;
+ }
+ if (extract_xml_record(field,"fft_len",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> fft_len;
+ }
+ if (extract_xml_record(field,"chirp_rate",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> chirp_rate;
+ }
+ if (extract_xml_record(field,"rfi_checked",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> rfi_checked;
+ }
+ if (extract_xml_record(field,"rfi_found",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> rfi_found;
+ }
+ if (extract_xml_record(field,"reserved",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> reserved;
+ }
+ if (extract_xml_record(field,"sigma",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> sigma;
+ }
+ if (extract_xml_record(field,"chisqr",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> chisqr;
+ }
+ if (extract_xml_record(field,"null_chisqr",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> null_chisqr;
+ }
+ if (extract_xml_record(field,"score",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> score;
+ }
+ if (extract_xml_record(field,"max_power",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> max_power;
+ }
+ if (extract_xml_record(field,"pot",sub)) {
+ std::istringstream in(sub.c_str());
+ in >> pot;
+ }
+ }
+}
+
+void gaussian::parse(const SQL_ROW &s) {
+ {
+ std::istringstream row(*(s[0]));
+ row >> id;
+ }
+ {
+ result_id.parse(SQL_ROW(s[1],0));
+ }
+ {
+ std::istringstream row(*(s[2]));
+ row >> peak_power;
+ }
+ {
+ std::istringstream row(*(s[3]));
+ row >> mean_power;
+ }
+ {
+ std::istringstream row(*(s[4]));
+ row >> time;
+ }
+ {
+ std::istringstream row(*(s[5]));
+ row >> ra;
+ }
+ {
+ std::istringstream row(*(s[6]));
+ row >> decl;
+ }
+ {
+ std::istringstream row(*(s[7]));
+ row >> q_pix;
+ }
+ {
+ std::istringstream row(*(s[8]));
+ row >> freq;
+ }
+ {
+ std::istringstream row(*(s[9]));
+ row >> detection_freq;
+ }
+ {
+ std::istringstream row(*(s[10]));
+ row >> barycentric_freq;
+ }
+ {
+ std::istringstream row(*(s[11]));
+ row >> fft_len;
+ }
+ {
+ std::istringstream row(*(s[12]));
+ row >> chirp_rate;
+ }
+ {
+ std::istringstream row(*(s[13]));
+ row >> rfi_checked;
+ }
+ {
+ std::istringstream row(*(s[14]));
+ row >> rfi_found;
+ }
+ {
+ std::istringstream row(*(s[15]));
+ row >> reserved;
+ }
+ {
+ std::istringstream row(*(s[16]));
+ row >> sigma;
+ }
+ {
+ std::istringstream row(*(s[17]));
+ row >> chisqr;
+ }
+ {
+ std::istringstream row(*(s[18]));
+ row >> null_chisqr;
+ }
+ {
+ std::istringstream row(*(s[19]));
+ row >> score;
+ }
+ {
+ std::istringstream row(*(s[20]));
+ row >> max_power;
+ }
+ {
+ pot=sqlblob<unsigned char>(*(s[21]));
+ }
+}
+
+void gaussian::parse(const std::string &s) {
+ SQL_ROW row(&s,22);
+ parse(row);
+}
+
+template <> const char *const db_table<gaussian_small>::table_name="gaussian_small";
+template <> const char *db_table<gaussian_small>::_search_tag=table_name;
template <> const int db_table<gaussian_small>::_nfields=21;
-template <> const char * const db_table<gaussian_small>::column_names[21]={"id","result_id","peak_power","mean_power","time","ra","decl","q_pix","freq","detection_freq","barycentric_freq","fft_len","chirp_rate","rfi_checked","rfi_found","reserved","sigma","chisqr","null_chisqr","score","max_power"};
-
-gaussian_small::gaussian_small() :
- db_table<gaussian_small>(*this,-1),
- id(0),
- result_id(),
- peak_power(0),
- mean_power(0),
- time(0),
- ra(0),
- decl(0),
- q_pix(0),
- freq(0),
- detection_freq(0),
- barycentric_freq(0),
- fft_len(0),
- chirp_rate(0),
- rfi_checked(0),
- rfi_found(0),
- reserved(0),
- sigma(0),
- chisqr(0),
- null_chisqr(0),
- score(0),
- max_power(0)
-{
- db_open();
-}
-
-
-gaussian_small::gaussian_small(const gaussian_small &a) :
- db_table<gaussian_small>(*this,-1),
- id(a.id),
- result_id(a.result_id),
- peak_power(a.peak_power),
- mean_power(a.mean_power),
- time(a.time),
- ra(a.ra),
- decl(a.decl),
- q_pix(a.q_pix),
- freq(a.freq),
- detection_freq(a.detection_freq),
- barycentric_freq(a.barycentric_freq),
- fft_len(a.fft_len),
- chirp_rate(a.chirp_rate),
- rfi_checked(a.rfi_checked),
- rfi_found(a.rfi_found),
- reserved(a.reserved),
- sigma(a.sigma),
- chisqr(a.chisqr),
- null_chisqr(a.null_chisqr),
- score(a.score),
- max_power(a.max_power)
-{
- db_open();
-}
-
-
-gaussian_small::gaussian_small(const SQL_ROW &a) :
- db_table<gaussian_small>(*this,-1)
-{
- db_open();
- parse(a);
-}
-
-
-gaussian_small::gaussian_small(const std::string &s,const char *tag) :
- db_table<gaussian_small>(*this,-1)
-{
- db_open();
- if (xml_match_tag(s,tag)) {
- parse_xml(s,tag);
- } else {
- parse(s);
- }
+template <> const char *const db_table<gaussian_small>::column_names[21]= {"id","result_id","peak_power","mean_power","time","ra","decl","q_pix","freq","detection_freq","barycentric_freq","fft_len","chirp_rate","rfi_checked","rfi_found","reserved","sigma","chisqr","null_chisqr","score","max_power"};
+
+gaussian_small::gaussian_small() :
+ db_table<gaussian_small>(*this,-1),
+ id(0),
+ result_id(),
+ peak_power(0),
+ mean_power(0),
+ time(0),
+ ra(0),
+ decl(0),
+ q_pix(0),
+ freq(0),
+ detection_freq(0),
+ barycentric_freq(0),
+ fft_len(0),
+ chirp_rate(0),
+ rfi_checked(0),
+ rfi_found(0),
+ reserved(0),
+ sigma(0),
+ chisqr(0),
+ null_chisqr(0),
+ score(0),
+ max_power(0) {
+ db_open();
+}
+
+
+gaussian_small::gaussian_small(const gaussian_small &a) :
+ db_table<gaussian_small>(*this,-1),
+ id(a.id),
+ result_id(a.result_id),
+ peak_power(a.peak_power),
+ mean_power(a.mean_power),
+ time(a.time),
+ ra(a.ra),
+ decl(a.decl),
+ q_pix(a.q_pix),
+ freq(a.freq),
+ detection_freq(a.detection_freq),
+ barycentric_freq(a.barycentric_freq),
+ fft_len(a.fft_len),
+ chirp_rate(a.chirp_rate),
+ rfi_checked(a.rfi_checked),
+ rfi_found(a.rfi_found),
+ reserved(a.reserved),
+ sigma(a.sigma),
+ chisqr(a.chisqr),
+ null_chisqr(a.null_chisqr),
+ score(a.score),
+ max_power(a.max_power) {
+ db_open();
+}
+
+
+gaussian_small::gaussian_small(const SQL_ROW &a) :
+ db_table<gaussian_small>(*this,-1) {
+ db_open();
+ parse(a);
+}
+
+
+gaussian_small::gaussian_small(const std::string &s,const char *tag) :
+ db_table<gaussian_small>(*this,-1) {
+ db_open();
+ if (xml_match_tag(s,tag)) {
+ parse_xml(s,tag);
+ } else {
+ parse(s);
+ }
}
gaussian_small &gaussian_small::operator =(const gaussian_small &a) {
- if (&a != this) {
- id=a.id;
- result_id=a.result_id;
- peak_power=a.peak_power;
- mean_power=a.mean_power;
- time=a.time;
- ra=a.ra;
- decl=a.decl;
- q_pix=a.q_pix;
- freq=a.freq;
- detection_freq=a.detection_freq;
- barycentric_freq=a.barycentric_freq;
- fft_len=a.fft_len;
- chirp_rate=a.chirp_rate;
- rfi_checked=a.rfi_checked;
- rfi_found=a.rfi_found;
- reserved=a.reserved;
- sigma=a.sigma;
- chisqr=a.chisqr;
- null_chisqr=a.null_chisqr;
- score=a.score;
- max_power=a.max_power;
- }
- return (*this);
-}
-
-
-std::string gaussian_small::update_format() const
-{ std::ostringstream rv("");
-
- for (int i=2;i<21;i++) rv << "?,";
- rv << "?";
- return rv.str();
-}
-
-
-std::string gaussian_small::insert_format() const
-{ return std::string("?,")+update_format();
-}
-
-std::string gaussian_small::select_format() const
-{
-std::string rv("");
-for (int i=0; i<20;i++) rv+="?,";
-rv+="?";
-return rv;
-}
-
-std::string gaussian_small::print(int full_subtables, int show_ids, int no_refs) const
-{ std::ostringstream rv("");
-
- rv.precision(14);
- if (show_ids) rv << id;
- rv << ',';
- if (!no_refs) {
- if (full_subtables) {
- rv << result_id.print(full_subtables,show_ids,no_refs);
- } else {
- rv << result_id.id;
- }
- }
- rv << ',';
- rv << peak_power;
- rv << ',';
- rv << mean_power;
- rv << ',';
- rv << time;
- rv << ',';
- rv << ra;
- rv << ',';
- rv << decl;
- rv << ',';
- rv << q_pix;
- rv << ',';
- rv << freq;
- rv << ',';
- rv << detection_freq;
- rv << ',';
- rv << barycentric_freq;
- rv << ',';
- rv << fft_len;
- rv << ',';
- rv << chirp_rate;
- rv << ',';
- rv << rfi_checked;
- rv << ',';
- rv << rfi_found;
- rv << ',';
- rv << reserved;
- rv << ',';
- rv << sigma;
- rv << ',';
- rv << chisqr;
- rv << ',';
- rv << null_chisqr;
- rv << ',';
- rv << score;
- rv << ',';
- rv << max_power;
- return rv.str();
-}
-
-
-std::string gaussian_small::print_xml(int full_subtables, int show_ids, int no_refs,const char *tag) const
-{
- std::ostringstream rv("");
-
- rv.precision(14);
- rv << xml_indent() << '<' << tag << ">\n";
- xml_indent(2);
- if (show_ids) rv << xml_indent() << "<id>" << id << "</id>\n";
- if (!no_refs) {
- if (full_subtables) {
- rv << result_id.print_xml(full_subtables,show_ids,no_refs,"result_id");
- } else {
- rv << xml_indent() << "<result_id><id>" << result_id.id << "</id></result_id>\n";
- }
- }
- rv << xml_indent() << "<peak_power>" << peak_power << "</peak_power>\n";
- rv << xml_indent() << "<mean_power>" << mean_power << "</mean_power>\n";
- rv << xml_indent() << "<time>" << time << "</time>\n";
- rv << xml_indent() << "<ra>" << ra << "</ra>\n";
- rv << xml_indent() << "<decl>" << decl << "</decl>\n";
- rv << xml_indent() << "<q_pix>" << q_pix << "</q_pix>\n";
- rv << xml_indent() << "<freq>" << freq << "</freq>\n";
- rv << xml_indent() << "<detection_freq>" << detection_freq << "</detection_freq>\n";
- rv << xml_indent() << "<barycentric_freq>" << barycentric_freq << "</barycentric_freq>\n";
- rv << xml_indent() << "<fft_len>" << fft_len << "</fft_len>\n";
- rv << xml_indent() << "<chirp_rate>" << chirp_rate << "</chirp_rate>\n";
- rv << xml_indent() << "<rfi_checked>" << rfi_checked << "</rfi_checked>\n";
- rv << xml_indent() << "<rfi_found>" << rfi_found << "</rfi_found>\n";
- rv << xml_indent() << "<reserved>" << reserved << "</reserved>\n";
- rv << xml_indent() << "<sigma>" << sigma << "</sigma>\n";
- rv << xml_indent() << "<chisqr>" << chisqr << "</chisqr>\n";
- rv << xml_indent() << "<null_chisqr>" << null_chisqr << "</null_chisqr>\n";
- rv << xml_indent() << "<score>" << score << "</score>\n";
- rv << xml_indent() << "<max_power>" << max_power << "</max_power>\n";
- xml_indent(-2);
- rv << xml_indent() << "</" << tag << ">\n";
- return rv.str();
-}
-
-
- void gaussian_small::parse_xml(const std::string &s,const char *tag) {
- std::string field,sub;
- if (extract_xml_record(s,tag,field)) {
- std::string::size_type pos=0;
- if (extract_xml_record(field,"id",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> id;
- }
- if (extract_xml_record(field,"result_id",sub)) {
- result_id.parse_xml(sub,"result_id");
- }
- if (extract_xml_record(field,"peak_power",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> peak_power;
- }
- if (extract_xml_record(field,"mean_power",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> mean_power;
- }
- if (extract_xml_record(field,"time",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> time;
- }
- if (extract_xml_record(field,"ra",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> ra;
- }
- if (extract_xml_record(field,"decl",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> decl;
- }
- if (extract_xml_record(field,"q_pix",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> q_pix;
- }
- if (extract_xml_record(field,"freq",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> freq;
- }
- if (extract_xml_record(field,"detection_freq",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> detection_freq;
- }
- if (extract_xml_record(field,"barycentric_freq",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> barycentric_freq;
- }
- if (extract_xml_record(field,"fft_len",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> fft_len;
- }
- if (extract_xml_record(field,"chirp_rate",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> chirp_rate;
- }
- if (extract_xml_record(field,"rfi_checked",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> rfi_checked;
- }
- if (extract_xml_record(field,"rfi_found",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> rfi_found;
- }
- if (extract_xml_record(field,"reserved",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> reserved;
- }
- if (extract_xml_record(field,"sigma",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> sigma;
- }
- if (extract_xml_record(field,"chisqr",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> chisqr;
- }
- if (extract_xml_record(field,"null_chisqr",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> null_chisqr;
- }
- if (extract_xml_record(field,"score",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> score;
- }
- if (extract_xml_record(field,"max_power",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> max_power;
- }
- }
- }
-
- void gaussian_small::parse(const SQL_ROW &s) {
- {
- std::istringstream row(*(s[0]));
- row >> id;
- }
- {
- result_id.parse(SQL_ROW(s[1],0));
- }
- {
- std::istringstream row(*(s[2]));
- row >> peak_power;
- }
- {
- std::istringstream row(*(s[3]));
- row >> mean_power;
- }
- {
- std::istringstream row(*(s[4]));
- row >> time;
- }
- {
- std::istringstream row(*(s[5]));
- row >> ra;
- }
- {
- std::istringstream row(*(s[6]));
- row >> decl;
- }
- {
- std::istringstream row(*(s[7]));
- row >> q_pix;
- }
- {
- std::istringstream row(*(s[8]));
- row >> freq;
- }
- {
- std::istringstream row(*(s[9]));
- row >> detection_freq;
- }
- {
- std::istringstream row(*(s[10]));
- row >> barycentric_freq;
- }
- {
- std::istringstream row(*(s[11]));
- row >> fft_len;
- }
- {
- std::istringstream row(*(s[12]));
- row >> chirp_rate;
- }
- {
- std::istringstream row(*(s[13]));
- row >> rfi_checked;
- }
- {
- std::istringstream row(*(s[14]));
- row >> rfi_found;
- }
- {
- std::istringstream row(*(s[15]));
- row >> reserved;
- }
- {
- std::istringstream row(*(s[16]));
- row >> sigma;
- }
- {
- std::istringstream row(*(s[17]));
- row >> chisqr;
- }
- {
- std::istringstream row(*(s[18]));
- row >> null_chisqr;
- }
- {
- std::istringstream row(*(s[19]));
- row >> score;
- }
- {
- std::istringstream row(*(s[20]));
- row >> max_power;
- }
- }
-
- void gaussian_small::parse(const std::string &s) {
- SQL_ROW row(&s,21);
- parse(row);
- }
-
-template <> const char * const db_table<pulse>::table_name="pulse";
-template <> const char * db_table<pulse>::_search_tag=table_name;
+ if (&a != this) {
+ id=a.id;
+ result_id=a.result_id;
+ peak_power=a.peak_power;
+ mean_power=a.mean_power;
+ time=a.time;
+ ra=a.ra;
+ decl=a.decl;
+ q_pix=a.q_pix;
+ freq=a.freq;
+ detection_freq=a.detection_freq;
+ barycentric_freq=a.barycentric_freq;
+ fft_len=a.fft_len;
+ chirp_rate=a.chirp_rate;
+ rfi_checked=a.rfi_checked;
+ rfi_found=a.rfi_found;
+ reserved=a.reserved;
+ sigma=a.sigma;
+ chisqr=a.chisqr;
+ null_chisqr=a.null_chisqr;
+ score=a.score;
+ max_power=a.max_power;
+ }
+ return (*this);
+}
+
+
+std::string gaussian_small::update_format() const {
+ std::ostringstream rv("");
+
+ for (int i=2; i<21; i++) {
+ rv << "?,";
+ }
+ rv << "?";
+ return rv.str();
+}
+
+
+std::string gaussian_small::insert_format() const {
+ return std::string("?,")+update_format();
+}
+
+std::string gaussian_small::select_format() const {
+ std::string rv("");
+ for (int i=0; i<20; i++) {
+ rv+="?,";
+ }
+ rv+="?";
+ return rv;
+}
+
+std::string gaussian_small::print(int full_subtables, int show_ids, int no_refs) const {
+ std::ostringstream rv("");
+
+ rv.precision(14);
+ if (show_ids) {
+ rv << id;
+ }
+ rv << ',';
+ if (!no_refs) {
+ if (full_subtables) {
+ rv << result_id.print(full_subtables,show_ids,no_refs);
+ } else {
+ rv << result_id.id;
+ }
+ }
+ rv << ',';
+ rv << peak_power;
+ rv << ',';
+ rv << mean_power;
+ rv << ',';
+ rv << time;
+ rv << ',';
+ rv << ra;
+ rv << ',';
+ rv << decl;
+ rv << ',';
+ rv << q_pix;
+ rv << ',';
+ rv << freq;
+ rv << ',';
+ rv << detection_freq;
+ rv << ',';
+ rv << barycentric_freq;
+ rv << ',';
+ rv << fft_len;
+ rv << ',';
+ rv << chirp_rate;
+ rv << ',';
+ rv << rfi_checked;
+ rv << ',';
+ rv << rfi_found;
+ rv << ',';
+ rv << reserved;
+ rv << ',';
+ rv << sigma;
+ rv << ',';
+ rv << chisqr;
+ rv << ',';
+ rv << null_chisqr;
+ rv << ',';
+ rv << score;
+ rv << ',';
+ rv << max_power;
+ return rv.str();
+}
+
+
+std::string gaussian_small::print_xml(int full_subtables, int show_ids, int no_refs,const char *tag) const {
+ std::ostringstream rv("");
+
+ rv.precision(14);
+ rv << xml_indent() << '<' << tag << ">\n";
+ xml_indent(2);
+ if (show_ids) {
+ rv << xml_indent() << "<id>" << id << "</id>\n";
+ }
+ if (!no_refs) {
+ if (full_subtables) {
+ rv << result_id.print_xml(full_subtables,show_ids,no_refs,"result_id");
+ } else {
+ rv << xml_indent() << "<result_id><id>" << result_id.id << "</id></result_id>\n";
+ }
+ }
+ rv << xml_indent() << "<peak_power>" << peak_power << "</peak_power>\n";
+ rv << xml_indent() << "<mean_power>" << mean_power << "</mean_power>\n";
+ rv << xml_indent() << "<time>" << time << "</time>\n";
+ rv << xml_indent() << "<ra>" << ra << "</ra>\n";
+ rv << xml_indent() << "<decl>" << decl << "</decl>\n";
+ rv << xml_indent() << "<q_pix>" << q_pix << "</q_pix>\n";
+ rv << xml_indent() << "<freq>" << freq << "</freq>\n";
+ rv << xml_indent() << "<detection_freq>" << detection_freq << "</detection_freq>\n";
+ rv << xml_indent() << "<barycentric_freq>" << barycentric_freq << "</barycentric_freq>\n";
+ rv << xml_indent() << "<fft_len>" << fft_len << "</fft_len>\n";
+ rv << xml_indent() << "<chirp_rate>" << chirp_rate << "</chirp_rate>\n";
+ rv << xml_indent() << "<rfi_checked>" << rfi_checked << "</rfi_checked>\n";
+ rv << xml_indent() << "<rfi_found>" << rfi_found << "</rfi_found>\n";
+ rv << xml_indent() << "<reserved>" << reserved << "</reserved>\n";
+ rv << xml_indent() << "<sigma>" << sigma << "</sigma>\n";
+ rv << xml_indent() << "<chisqr>" << chisqr << "</chisqr>\n";
+ rv << xml_indent() << "<null_chisqr>" << null_chisqr << "</null_chisqr>\n";
+ rv << xml_indent() << "<score>" << score << "</score>\n";
+ rv << xml_indent() << "<max_power>" << max_power << "</max_power>\n";
+ xml_indent(-2);
+ rv << xml_indent() << "</" << tag << ">\n";
+ return rv.str();
+}
+
+
+void gaussian_small::parse_xml(const std::string &s,const char *tag) {
+ std::string field,sub;
+ if (extract_xml_record(s,tag,field)) {
+ std::string::size_type pos=0;
+ if (extract_xml_record(field,"id",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> id;
+ }
+ if (extract_xml_record(field,"result_id",sub)) {
+ result_id.parse_xml(sub,"result_id");
+ }
+ if (extract_xml_record(field,"peak_power",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> peak_power;
+ }
+ if (extract_xml_record(field,"mean_power",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> mean_power;
+ }
+ if (extract_xml_record(field,"time",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> time;
+ }
+ if (extract_xml_record(field,"ra",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> ra;
+ }
+ if (extract_xml_record(field,"decl",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> decl;
+ }
+ if (extract_xml_record(field,"q_pix",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> q_pix;
+ }
+ if (extract_xml_record(field,"freq",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> freq;
+ }
+ if (extract_xml_record(field,"detection_freq",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> detection_freq;
+ }
+ if (extract_xml_record(field,"barycentric_freq",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> barycentric_freq;
+ }
+ if (extract_xml_record(field,"fft_len",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> fft_len;
+ }
+ if (extract_xml_record(field,"chirp_rate",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> chirp_rate;
+ }
+ if (extract_xml_record(field,"rfi_checked",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> rfi_checked;
+ }
+ if (extract_xml_record(field,"rfi_found",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> rfi_found;
+ }
+ if (extract_xml_record(field,"reserved",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> reserved;
+ }
+ if (extract_xml_record(field,"sigma",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> sigma;
+ }
+ if (extract_xml_record(field,"chisqr",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> chisqr;
+ }
+ if (extract_xml_record(field,"null_chisqr",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> null_chisqr;
+ }
+ if (extract_xml_record(field,"score",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> score;
+ }
+ if (extract_xml_record(field,"max_power",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> max_power;
+ }
+ }
+}
+
+void gaussian_small::parse(const SQL_ROW &s) {
+ {
+ std::istringstream row(*(s[0]));
+ row >> id;
+ }
+ {
+ result_id.parse(SQL_ROW(s[1],0));
+ }
+ {
+ std::istringstream row(*(s[2]));
+ row >> peak_power;
+ }
+ {
+ std::istringstream row(*(s[3]));
+ row >> mean_power;
+ }
+ {
+ std::istringstream row(*(s[4]));
+ row >> time;
+ }
+ {
+ std::istringstream row(*(s[5]));
+ row >> ra;
+ }
+ {
+ std::istringstream row(*(s[6]));
+ row >> decl;
+ }
+ {
+ std::istringstream row(*(s[7]));
+ row >> q_pix;
+ }
+ {
+ std::istringstream row(*(s[8]));
+ row >> freq;
+ }
+ {
+ std::istringstream row(*(s[9]));
+ row >> detection_freq;
+ }
+ {
+ std::istringstream row(*(s[10]));
+ row >> barycentric_freq;
+ }
+ {
+ std::istringstream row(*(s[11]));
+ row >> fft_len;
+ }
+ {
+ std::istringstream row(*(s[12]));
+ row >> chirp_rate;
+ }
+ {
+ std::istringstream row(*(s[13]));
+ row >> rfi_checked;
+ }
+ {
+ std::istringstream row(*(s[14]));
+ row >> rfi_found;
+ }
+ {
+ std::istringstream row(*(s[15]));
+ row >> reserved;
+ }
+ {
+ std::istringstream row(*(s[16]));
+ row >> sigma;
+ }
+ {
+ std::istringstream row(*(s[17]));
+ row >> chisqr;
+ }
+ {
+ std::istringstream row(*(s[18]));
+ row >> null_chisqr;
+ }
+ {
+ std::istringstream row(*(s[19]));
+ row >> score;
+ }
+ {
+ std::istringstream row(*(s[20]));
+ row >> max_power;
+ }
+}
+
+void gaussian_small::parse(const std::string &s) {
+ SQL_ROW row(&s,21);
+ parse(row);
+}
+
+template <> const char *const db_table<pulse>::table_name="pulse";
+template <> const char *db_table<pulse>::_search_tag=table_name;
template <> const int db_table<pulse>::_nfields=22;
-template <> const char * const db_table<pulse>::column_names[22]={"id","result_id","peak_power","mean_power","time","ra","decl","q_pix","freq","detection_freq","barycentric_freq","fft_len","chirp_rate","rfi_checked","rfi_found","reserved","period","snr","thresh","score","len_prof","pot"};
-
-pulse::pulse() :
- db_table<pulse>(*this,-1),
- id(0),
- result_id(),
- peak_power(0),
- mean_power(0),
- time(0),
- ra(0),
- decl(0),
- q_pix(0),
- freq(0),
- detection_freq(0),
- barycentric_freq(0),
- fft_len(0),
- chirp_rate(0),
- rfi_checked(0),
- rfi_found(0),
- reserved(0),
- period(0),
- snr(0),
- thresh(0),
- score(0),
- len_prof(0),
- pot((unsigned char *)0,0,_x_csv)
-{
- db_open();
-}
-
-
-pulse::pulse(const pulse &a) :
- db_table<pulse>(*this,-1),
- id(a.id),
- result_id(a.result_id),
- peak_power(a.peak_power),
- mean_power(a.mean_power),
- time(a.time),
- ra(a.ra),
- decl(a.decl),
- q_pix(a.q_pix),
- freq(a.freq),
- detection_freq(a.detection_freq),
- barycentric_freq(a.barycentric_freq),
- fft_len(a.fft_len),
- chirp_rate(a.chirp_rate),
- rfi_checked(a.rfi_checked),
- rfi_found(a.rfi_found),
- reserved(a.reserved),
- period(a.period),
- snr(a.snr),
- thresh(a.thresh),
- score(a.score),
- len_prof(a.len_prof),
- pot(a.pot)
-{
- db_open();
-}
-
-
-pulse::pulse(const SQL_ROW &a) :
- db_table<pulse>(*this,-1)
-{
- db_open();
- parse(a);
-}
-
-
-pulse::pulse(const std::string &s,const char *tag) :
- db_table<pulse>(*this,-1)
-{
- db_open();
- if (xml_match_tag(s,tag)) {
- parse_xml(s,tag);
- } else {
- parse(s);
- }
+template <> const char *const db_table<pulse>::column_names[22]= {"id","result_id","peak_power","mean_power","time","ra","decl","q_pix","freq","detection_freq","barycentric_freq","fft_len","chirp_rate","rfi_checked","rfi_found","reserved","period","snr","thresh","score","len_prof","pot"};
+
+pulse::pulse() :
+ db_table<pulse>(*this,-1),
+ id(0),
+ result_id(),
+ peak_power(0),
+ mean_power(0),
+ time(0),
+ ra(0),
+ decl(0),
+ q_pix(0),
+ freq(0),
+ detection_freq(0),
+ barycentric_freq(0),
+ fft_len(0),
+ chirp_rate(0),
+ rfi_checked(0),
+ rfi_found(0),
+ reserved(0),
+ period(0),
+ snr(0),
+ thresh(0),
+ score(0),
+ len_prof(0),
+ pot((unsigned char *)0,0,_x_csv) {
+ db_open();
+}
+
+
+pulse::pulse(const pulse &a) :
+ db_table<pulse>(*this,-1),
+ id(a.id),
+ result_id(a.result_id),
+ peak_power(a.peak_power),
+ mean_power(a.mean_power),
+ time(a.time),
+ ra(a.ra),
+ decl(a.decl),
+ q_pix(a.q_pix),
+ freq(a.freq),
+ detection_freq(a.detection_freq),
+ barycentric_freq(a.barycentric_freq),
+ fft_len(a.fft_len),
+ chirp_rate(a.chirp_rate),
+ rfi_checked(a.rfi_checked),
+ rfi_found(a.rfi_found),
+ reserved(a.reserved),
+ period(a.period),
+ snr(a.snr),
+ thresh(a.thresh),
+ score(a.score),
+ len_prof(a.len_prof),
+ pot(a.pot) {
+ db_open();
+}
+
+
+pulse::pulse(const SQL_ROW &a) :
+ db_table<pulse>(*this,-1) {
+ db_open();
+ parse(a);
+}
+
+
+pulse::pulse(const std::string &s,const char *tag) :
+ db_table<pulse>(*this,-1) {
+ db_open();
+ if (xml_match_tag(s,tag)) {
+ parse_xml(s,tag);
+ } else {
+ parse(s);
+ }
}
pulse &pulse::operator =(const pulse &a) {
- if (&a != this) {
- id=a.id;
- result_id=a.result_id;
- peak_power=a.peak_power;
- mean_power=a.mean_power;
- time=a.time;
- ra=a.ra;
- decl=a.decl;
- q_pix=a.q_pix;
- freq=a.freq;
- detection_freq=a.detection_freq;
- barycentric_freq=a.barycentric_freq;
- fft_len=a.fft_len;
- chirp_rate=a.chirp_rate;
- rfi_checked=a.rfi_checked;
- rfi_found=a.rfi_found;
- reserved=a.reserved;
- period=a.period;
- snr=a.snr;
- thresh=a.thresh;
- score=a.score;
- len_prof=a.len_prof;
- pot=a.pot;
- }
- return (*this);
-}
-
-
-std::string pulse::update_format() const
-{ std::ostringstream rv("");
-
- for (int i=2;i<22;i++) rv << "?,";
- rv << "?";
- return rv.str();
-}
-
-
-std::string pulse::insert_format() const
-{ return std::string("?,")+update_format();
-}
-
-std::string pulse::select_format() const
-{
-std::string rv("");
-for (int i=0; i<21;i++) rv+="?,";
-rv+="?";
-return rv;
-}
-
-std::string pulse::print(int full_subtables, int show_ids, int no_refs) const
-{ std::ostringstream rv("");
-
- rv.precision(14);
- if (show_ids) rv << id;
- rv << ',';
- if (!no_refs) {
- if (full_subtables) {
- rv << result_id.print(full_subtables,show_ids,no_refs);
- } else {
- rv << result_id.id;
- }
- }
- rv << ',';
- rv << peak_power;
- rv << ',';
- rv << mean_power;
- rv << ',';
- rv << time;
- rv << ',';
- rv << ra;
- rv << ',';
- rv << decl;
- rv << ',';
- rv << q_pix;
- rv << ',';
- rv << freq;
- rv << ',';
- rv << detection_freq;
- rv << ',';
- rv << barycentric_freq;
- rv << ',';
- rv << fft_len;
- rv << ',';
- rv << chirp_rate;
- rv << ',';
- rv << rfi_checked;
- rv << ',';
- rv << rfi_found;
- rv << ',';
- rv << reserved;
- rv << ',';
- rv << period;
- rv << ',';
- rv << snr;
- rv << ',';
- rv << thresh;
- rv << ',';
- rv << score;
- rv << ',';
- rv << len_prof;
- rv << ',';
- rv << "<BYTE len=" << std::max(pot.size()*2,(size_t)1) << ">" << pot.print_hex() ;
- return rv.str();
-}
-
-
-std::string pulse::print_xml(int full_subtables, int show_ids, int no_refs,const char *tag) const
-{
- std::ostringstream rv("");
-
- rv.precision(14);
- rv << xml_indent() << '<' << tag << ">\n";
- xml_indent(2);
- if (show_ids) rv << xml_indent() << "<id>" << id << "</id>\n";
- if (!no_refs) {
- if (full_subtables) {
- rv << result_id.print_xml(full_subtables,show_ids,no_refs,"result_id");
- } else {
- rv << xml_indent() << "<result_id><id>" << result_id.id << "</id></result_id>\n";
- }
- }
- rv << xml_indent() << "<peak_power>" << peak_power << "</peak_power>\n";
- rv << xml_indent() << "<mean_power>" << mean_power << "</mean_power>\n";
- rv << xml_indent() << "<time>" << time << "</time>\n";
- rv << xml_indent() << "<ra>" << ra << "</ra>\n";
- rv << xml_indent() << "<decl>" << decl << "</decl>\n";
- rv << xml_indent() << "<q_pix>" << q_pix << "</q_pix>\n";
- rv << xml_indent() << "<freq>" << freq << "</freq>\n";
- rv << xml_indent() << "<detection_freq>" << detection_freq << "</detection_freq>\n";
- rv << xml_indent() << "<barycentric_freq>" << barycentric_freq << "</barycentric_freq>\n";
- rv << xml_indent() << "<fft_len>" << fft_len << "</fft_len>\n";
- rv << xml_indent() << "<chirp_rate>" << chirp_rate << "</chirp_rate>\n";
- rv << xml_indent() << "<rfi_checked>" << rfi_checked << "</rfi_checked>\n";
- rv << xml_indent() << "<rfi_found>" << rfi_found << "</rfi_found>\n";
- rv << xml_indent() << "<reserved>" << reserved << "</reserved>\n";
- rv << xml_indent() << "<period>" << period << "</period>\n";
- rv << xml_indent() << "<snr>" << snr << "</snr>\n";
- rv << xml_indent() << "<thresh>" << thresh << "</thresh>\n";
- rv << xml_indent() << "<score>" << score << "</score>\n";
- rv << xml_indent() << "<len_prof>" << len_prof << "</len_prof>\n";
- if (pot.size()) {
- std::string enc_field=xml_encode_string(pot,pot.encoding);
- rv << xml_indent() << "<pot length=" << enc_field.size() << " encoding=\"" << xml_encoding_names[pot.encoding] << "\">";
- rv << enc_field << "</pot>\n";
- }
- xml_indent(-2);
- rv << xml_indent() << "</" << tag << ">\n";
- return rv.str();
-}
-
-
- void pulse::parse_xml(const std::string &s,const char *tag) {
- std::string field,sub;
- if (extract_xml_record(s,tag,field)) {
- std::string::size_type pos=0;
- if (extract_xml_record(field,"id",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> id;
- }
- if (extract_xml_record(field,"result_id",sub)) {
- result_id.parse_xml(sub,"result_id");
- }
- if (extract_xml_record(field,"peak_power",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> peak_power;
- }
- if (extract_xml_record(field,"mean_power",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> mean_power;
- }
- if (extract_xml_record(field,"time",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> time;
- }
- if (extract_xml_record(field,"ra",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> ra;
- }
- if (extract_xml_record(field,"decl",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> decl;
- }
- if (extract_xml_record(field,"q_pix",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> q_pix;
- }
- if (extract_xml_record(field,"freq",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> freq;
- }
- if (extract_xml_record(field,"detection_freq",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> detection_freq;
- }
- if (extract_xml_record(field,"barycentric_freq",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> barycentric_freq;
- }
- if (extract_xml_record(field,"fft_len",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> fft_len;
- }
- if (extract_xml_record(field,"chirp_rate",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> chirp_rate;
- }
- if (extract_xml_record(field,"rfi_checked",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> rfi_checked;
- }
- if (extract_xml_record(field,"rfi_found",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> rfi_found;
- }
- if (extract_xml_record(field,"reserved",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> reserved;
- }
- if (extract_xml_record(field,"period",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> period;
- }
- if (extract_xml_record(field,"snr",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> snr;
- }
- if (extract_xml_record(field,"thresh",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> thresh;
- }
- if (extract_xml_record(field,"score",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> score;
- }
- if (extract_xml_record(field,"len_prof",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> len_prof;
- }
- if (extract_xml_record(field,"pot",sub)) {
- std::istringstream in(sub.c_str());
- in >> pot;
- }
- }
- }
-
- void pulse::parse(const SQL_ROW &s) {
- {
- std::istringstream row(*(s[0]));
- row >> id;
- }
- {
- result_id.parse(SQL_ROW(s[1],0));
- }
- {
- std::istringstream row(*(s[2]));
- row >> peak_power;
- }
- {
- std::istringstream row(*(s[3]));
- row >> mean_power;
- }
- {
- std::istringstream row(*(s[4]));
- row >> time;
- }
- {
- std::istringstream row(*(s[5]));
- row >> ra;
- }
- {
- std::istringstream row(*(s[6]));
- row >> decl;
- }
- {
- std::istringstream row(*(s[7]));
- row >> q_pix;
- }
- {
- std::istringstream row(*(s[8]));
- row >> freq;
- }
- {
- std::istringstream row(*(s[9]));
- row >> detection_freq;
- }
- {
- std::istringstream row(*(s[10]));
- row >> barycentric_freq;
- }
- {
- std::istringstream row(*(s[11]));
- row >> fft_len;
- }
- {
- std::istringstream row(*(s[12]));
- row >> chirp_rate;
- }
- {
- std::istringstream row(*(s[13]));
- row >> rfi_checked;
- }
- {
- std::istringstream row(*(s[14]));
- row >> rfi_found;
- }
- {
- std::istringstream row(*(s[15]));
- row >> reserved;
- }
- {
- std::istringstream row(*(s[16]));
- row >> period;
- }
- {
- std::istringstream row(*(s[17]));
- row >> snr;
- }
- {
- std::istringstream row(*(s[18]));
- row >> thresh;
- }
- {
- std::istringstream row(*(s[19]));
- row >> score;
- }
- {
- std::istringstream row(*(s[20]));
- row >> len_prof;
- }
- {
- pot=sqlblob<unsigned char>(*(s[21]));
- }
- }
-
- void pulse::parse(const std::string &s) {
- SQL_ROW row(&s,22);
- parse(row);
- }
-
-template <> const char * const db_table<pulse_small>::table_name="pulse_small";
-template <> const char * db_table<pulse_small>::_search_tag=table_name;
+ if (&a != this) {
+ id=a.id;
+ result_id=a.result_id;
+ peak_power=a.peak_power;
+ mean_power=a.mean_power;
+ time=a.time;
+ ra=a.ra;
+ decl=a.decl;
+ q_pix=a.q_pix;
+ freq=a.freq;
+ detection_freq=a.detection_freq;
+ barycentric_freq=a.barycentric_freq;
+ fft_len=a.fft_len;
+ chirp_rate=a.chirp_rate;
+ rfi_checked=a.rfi_checked;
+ rfi_found=a.rfi_found;
+ reserved=a.reserved;
+ period=a.period;
+ snr=a.snr;
+ thresh=a.thresh;
+ score=a.score;
+ len_prof=a.len_prof;
+ pot=a.pot;
+ }
+ return (*this);
+}
+
+
+std::string pulse::update_format() const {
+ std::ostringstream rv("");
+
+ for (int i=2; i<22; i++) {
+ rv << "?,";
+ }
+ rv << "?";
+ return rv.str();
+}
+
+
+std::string pulse::insert_format() const {
+ return std::string("?,")+update_format();
+}
+
+std::string pulse::select_format() const {
+ std::string rv("");
+ for (int i=0; i<21; i++) {
+ rv+="?,";
+ }
+ rv+="?";
+ return rv;
+}
+
+std::string pulse::print(int full_subtables, int show_ids, int no_refs) const {
+ std::ostringstream rv("");
+
+ rv.precision(14);
+ if (show_ids) {
+ rv << id;
+ }
+ rv << ',';
+ if (!no_refs) {
+ if (full_subtables) {
+ rv << result_id.print(full_subtables,show_ids,no_refs);
+ } else {
+ rv << result_id.id;
+ }
+ }
+ rv << ',';
+ rv << peak_power;
+ rv << ',';
+ rv << mean_power;
+ rv << ',';
+ rv << time;
+ rv << ',';
+ rv << ra;
+ rv << ',';
+ rv << decl;
+ rv << ',';
+ rv << q_pix;
+ rv << ',';
+ rv << freq;
+ rv << ',';
+ rv << detection_freq;
+ rv << ',';
+ rv << barycentric_freq;
+ rv << ',';
+ rv << fft_len;
+ rv << ',';
+ rv << chirp_rate;
+ rv << ',';
+ rv << rfi_checked;
+ rv << ',';
+ rv << rfi_found;
+ rv << ',';
+ rv << reserved;
+ rv << ',';
+ rv << period;
+ rv << ',';
+ rv << snr;
+ rv << ',';
+ rv << thresh;
+ rv << ',';
+ rv << score;
+ rv << ',';
+ rv << len_prof;
+ rv << ',';
+ rv << "<BYTE len=" << std::max(pot.size()*2,(size_t)1) << ">" << pot.print_hex() ;
+ return rv.str();
+}
+
+
+std::string pulse::print_xml(int full_subtables, int show_ids, int no_refs,const char *tag) const {
+ std::ostringstream rv("");
+
+ rv.precision(14);
+ rv << xml_indent() << '<' << tag << ">\n";
+ xml_indent(2);
+ if (show_ids) {
+ rv << xml_indent() << "<id>" << id << "</id>\n";
+ }
+ if (!no_refs) {
+ if (full_subtables) {
+ rv << result_id.print_xml(full_subtables,show_ids,no_refs,"result_id");
+ } else {
+ rv << xml_indent() << "<result_id><id>" << result_id.id << "</id></result_id>\n";
+ }
+ }
+ rv << xml_indent() << "<peak_power>" << peak_power << "</peak_power>\n";
+ rv << xml_indent() << "<mean_power>" << mean_power << "</mean_power>\n";
+ rv << xml_indent() << "<time>" << time << "</time>\n";
+ rv << xml_indent() << "<ra>" << ra << "</ra>\n";
+ rv << xml_indent() << "<decl>" << decl << "</decl>\n";
+ rv << xml_indent() << "<q_pix>" << q_pix << "</q_pix>\n";
+ rv << xml_indent() << "<freq>" << freq << "</freq>\n";
+ rv << xml_indent() << "<detection_freq>" << detection_freq << "</detection_freq>\n";
+ rv << xml_indent() << "<barycentric_freq>" << barycentric_freq << "</barycentric_freq>\n";
+ rv << xml_indent() << "<fft_len>" << fft_len << "</fft_len>\n";
+ rv << xml_indent() << "<chirp_rate>" << chirp_rate << "</chirp_rate>\n";
+ rv << xml_indent() << "<rfi_checked>" << rfi_checked << "</rfi_checked>\n";
+ rv << xml_indent() << "<rfi_found>" << rfi_found << "</rfi_found>\n";
+ rv << xml_indent() << "<reserved>" << reserved << "</reserved>\n";
+ rv << xml_indent() << "<period>" << period << "</period>\n";
+ rv << xml_indent() << "<snr>" << snr << "</snr>\n";
+ rv << xml_indent() << "<thresh>" << thresh << "</thresh>\n";
+ rv << xml_indent() << "<score>" << score << "</score>\n";
+ rv << xml_indent() << "<len_prof>" << len_prof << "</len_prof>\n";
+ if (pot.size()) {
+ std::string enc_field=xml_encode_string(pot,pot.encoding);
+ rv << xml_indent() << "<pot length=" << enc_field.size() << " encoding=\"" << xml_encoding_names[pot.encoding] << "\">";
+ rv << enc_field << "</pot>\n";
+ }
+ xml_indent(-2);
+ rv << xml_indent() << "</" << tag << ">\n";
+ return rv.str();
+}
+
+
+void pulse::parse_xml(const std::string &s,const char *tag) {
+ std::string field,sub;
+ if (extract_xml_record(s,tag,field)) {
+ std::string::size_type pos=0;
+ if (extract_xml_record(field,"id",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> id;
+ }
+ if (extract_xml_record(field,"result_id",sub)) {
+ result_id.parse_xml(sub,"result_id");
+ }
+ if (extract_xml_record(field,"peak_power",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> peak_power;
+ }
+ if (extract_xml_record(field,"mean_power",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> mean_power;
+ }
+ if (extract_xml_record(field,"time",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> time;
+ }
+ if (extract_xml_record(field,"ra",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> ra;
+ }
+ if (extract_xml_record(field,"decl",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> decl;
+ }
+ if (extract_xml_record(field,"q_pix",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> q_pix;
+ }
+ if (extract_xml_record(field,"freq",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> freq;
+ }
+ if (extract_xml_record(field,"detection_freq",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> detection_freq;
+ }
+ if (extract_xml_record(field,"barycentric_freq",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> barycentric_freq;
+ }
+ if (extract_xml_record(field,"fft_len",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> fft_len;
+ }
+ if (extract_xml_record(field,"chirp_rate",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> chirp_rate;
+ }
+ if (extract_xml_record(field,"rfi_checked",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> rfi_checked;
+ }
+ if (extract_xml_record(field,"rfi_found",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> rfi_found;
+ }
+ if (extract_xml_record(field,"reserved",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> reserved;
+ }
+ if (extract_xml_record(field,"period",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> period;
+ }
+ if (extract_xml_record(field,"snr",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> snr;
+ }
+ if (extract_xml_record(field,"thresh",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> thresh;
+ }
+ if (extract_xml_record(field,"score",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> score;
+ }
+ if (extract_xml_record(field,"len_prof",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> len_prof;
+ }
+ if (extract_xml_record(field,"pot",sub)) {
+ std::istringstream in(sub.c_str());
+ in >> pot;
+ }
+ }
+}
+
+void pulse::parse(const SQL_ROW &s) {
+ {
+ std::istringstream row(*(s[0]));
+ row >> id;
+ }
+ {
+ result_id.parse(SQL_ROW(s[1],0));
+ }
+ {
+ std::istringstream row(*(s[2]));
+ row >> peak_power;
+ }
+ {
+ std::istringstream row(*(s[3]));
+ row >> mean_power;
+ }
+ {
+ std::istringstream row(*(s[4]));
+ row >> time;
+ }
+ {
+ std::istringstream row(*(s[5]));
+ row >> ra;
+ }
+ {
+ std::istringstream row(*(s[6]));
+ row >> decl;
+ }
+ {
+ std::istringstream row(*(s[7]));
+ row >> q_pix;
+ }
+ {
+ std::istringstream row(*(s[8]));
+ row >> freq;
+ }
+ {
+ std::istringstream row(*(s[9]));
+ row >> detection_freq;
+ }
+ {
+ std::istringstream row(*(s[10]));
+ row >> barycentric_freq;
+ }
+ {
+ std::istringstream row(*(s[11]));
+ row >> fft_len;
+ }
+ {
+ std::istringstream row(*(s[12]));
+ row >> chirp_rate;
+ }
+ {
+ std::istringstream row(*(s[13]));
+ row >> rfi_checked;
+ }
+ {
+ std::istringstream row(*(s[14]));
+ row >> rfi_found;
+ }
+ {
+ std::istringstream row(*(s[15]));
+ row >> reserved;
+ }
+ {
+ std::istringstream row(*(s[16]));
+ row >> period;
+ }
+ {
+ std::istringstream row(*(s[17]));
+ row >> snr;
+ }
+ {
+ std::istringstream row(*(s[18]));
+ row >> thresh;
+ }
+ {
+ std::istringstream row(*(s[19]));
+ row >> score;
+ }
+ {
+ std::istringstream row(*(s[20]));
+ row >> len_prof;
+ }
+ {
+ pot=sqlblob<unsigned char>(*(s[21]));
+ }
+}
+
+void pulse::parse(const std::string &s) {
+ SQL_ROW row(&s,22);
+ parse(row);
+}
+
+template <> const char *const db_table<pulse_small>::table_name="pulse_small";
+template <> const char *db_table<pulse_small>::_search_tag=table_name;
template <> const int db_table<pulse_small>::_nfields=20;
-template <> const char * const db_table<pulse_small>::column_names[20]={"id","result_id","peak_power","mean_power","time","ra","decl","q_pix","freq","detection_freq","barycentric_freq","fft_len","chirp_rate","rfi_checked","rfi_found","reserved","period","snr","thresh","score"};
-
-pulse_small::pulse_small() :
- db_table<pulse_small>(*this,-1),
- id(0),
- result_id(),
- peak_power(0),
- mean_power(0),
- time(0),
- ra(0),
- decl(0),
- q_pix(0),
- freq(0),
- detection_freq(0),
- barycentric_freq(0),
- fft_len(0),
- chirp_rate(0),
- rfi_checked(0),
- rfi_found(0),
- reserved(0),
- period(0),
- snr(0),
- thresh(0),
- score(0)
-{
- db_open();
-}
-
-
-pulse_small::pulse_small(const pulse_small &a) :
- db_table<pulse_small>(*this,-1),
- id(a.id),
- result_id(a.result_id),
- peak_power(a.peak_power),
- mean_power(a.mean_power),
- time(a.time),
- ra(a.ra),
- decl(a.decl),
- q_pix(a.q_pix),
- freq(a.freq),
- detection_freq(a.detection_freq),
- barycentric_freq(a.barycentric_freq),
- fft_len(a.fft_len),
- chirp_rate(a.chirp_rate),
- rfi_checked(a.rfi_checked),
- rfi_found(a.rfi_found),
- reserved(a.reserved),
- period(a.period),
- snr(a.snr),
- thresh(a.thresh),
- score(a.score)
-{
- db_open();
-}
-
-
-pulse_small::pulse_small(const SQL_ROW &a) :
- db_table<pulse_small>(*this,-1)
-{
- db_open();
- parse(a);
-}
-
-
-pulse_small::pulse_small(const std::string &s,const char *tag) :
- db_table<pulse_small>(*this,-1)
-{
- db_open();
- if (xml_match_tag(s,tag)) {
- parse_xml(s,tag);
- } else {
- parse(s);
- }
+template <> const char *const db_table<pulse_small>::column_names[20]= {"id","result_id","peak_power","mean_power","time","ra","decl","q_pix","freq","detection_freq","barycentric_freq","fft_len","chirp_rate","rfi_checked","rfi_found","reserved","period","snr","thresh","score"};
+
+pulse_small::pulse_small() :
+ db_table<pulse_small>(*this,-1),
+ id(0),
+ result_id(),
+ peak_power(0),
+ mean_power(0),
+ time(0),
+ ra(0),
+ decl(0),
+ q_pix(0),
+ freq(0),
+ detection_freq(0),
+ barycentric_freq(0),
+ fft_len(0),
+ chirp_rate(0),
+ rfi_checked(0),
+ rfi_found(0),
+ reserved(0),
+ period(0),
+ snr(0),
+ thresh(0),
+ score(0) {
+ db_open();
+}
+
+
+pulse_small::pulse_small(const pulse_small &a) :
+ db_table<pulse_small>(*this,-1),
+ id(a.id),
+ result_id(a.result_id),
+ peak_power(a.peak_power),
+ mean_power(a.mean_power),
+ time(a.time),
+ ra(a.ra),
+ decl(a.decl),
+ q_pix(a.q_pix),
+ freq(a.freq),
+ detection_freq(a.detection_freq),
+ barycentric_freq(a.barycentric_freq),
+ fft_len(a.fft_len),
+ chirp_rate(a.chirp_rate),
+ rfi_checked(a.rfi_checked),
+ rfi_found(a.rfi_found),
+ reserved(a.reserved),
+ period(a.period),
+ snr(a.snr),
+ thresh(a.thresh),
+ score(a.score) {
+ db_open();
+}
+
+
+pulse_small::pulse_small(const SQL_ROW &a) :
+ db_table<pulse_small>(*this,-1) {
+ db_open();
+ parse(a);
+}
+
+
+pulse_small::pulse_small(const std::string &s,const char *tag) :
+ db_table<pulse_small>(*this,-1) {
+ db_open();
+ if (xml_match_tag(s,tag)) {
+ parse_xml(s,tag);
+ } else {
+ parse(s);
+ }
}
pulse_small &pulse_small::operator =(const pulse_small &a) {
- if (&a != this) {
- id=a.id;
- result_id=a.result_id;
- peak_power=a.peak_power;
- mean_power=a.mean_power;
- time=a.time;
- ra=a.ra;
- decl=a.decl;
- q_pix=a.q_pix;
- freq=a.freq;
- detection_freq=a.detection_freq;
- barycentric_freq=a.barycentric_freq;
- fft_len=a.fft_len;
- chirp_rate=a.chirp_rate;
- rfi_checked=a.rfi_checked;
- rfi_found=a.rfi_found;
- reserved=a.reserved;
- period=a.period;
- snr=a.snr;
- thresh=a.thresh;
- score=a.score;
- }
- return (*this);
-}
-
-
-std::string pulse_small::update_format() const
-{ std::ostringstream rv("");
-
- for (int i=2;i<20;i++) rv << "?,";
- rv << "?";
- return rv.str();
-}
-
-
-std::string pulse_small::insert_format() const
-{ return std::string("?,")+update_format();
-}
-
-std::string pulse_small::select_format() const
-{
-std::string rv("");
-for (int i=0; i<19;i++) rv+="?,";
-rv+="?";
-return rv;
-}
-
-std::string pulse_small::print(int full_subtables, int show_ids, int no_refs) const
-{ std::ostringstream rv("");
-
- rv.precision(14);
- if (show_ids) rv << id;
- rv << ',';
- if (!no_refs) {
- if (full_subtables) {
- rv << result_id.print(full_subtables,show_ids,no_refs);
- } else {
- rv << result_id.id;
- }
- }
- rv << ',';
- rv << peak_power;
- rv << ',';
- rv << mean_power;
- rv << ',';
- rv << time;
- rv << ',';
- rv << ra;
- rv << ',';
- rv << decl;
- rv << ',';
- rv << q_pix;
- rv << ',';
- rv << freq;
- rv << ',';
- rv << detection_freq;
- rv << ',';
- rv << barycentric_freq;
- rv << ',';
- rv << fft_len;
- rv << ',';
- rv << chirp_rate;
- rv << ',';
- rv << rfi_checked;
- rv << ',';
- rv << rfi_found;
- rv << ',';
- rv << reserved;
- rv << ',';
- rv << period;
- rv << ',';
- rv << snr;
- rv << ',';
- rv << thresh;
- rv << ',';
- rv << score;
- return rv.str();
-}
-
-
-std::string pulse_small::print_xml(int full_subtables, int show_ids, int no_refs,const char *tag) const
-{
- std::ostringstream rv("");
-
- rv.precision(14);
- rv << xml_indent() << '<' << tag << ">\n";
- xml_indent(2);
- if (show_ids) rv << xml_indent() << "<id>" << id << "</id>\n";
- if (!no_refs) {
- if (full_subtables) {
- rv << result_id.print_xml(full_subtables,show_ids,no_refs,"result_id");
- } else {
- rv << xml_indent() << "<result_id><id>" << result_id.id << "</id></result_id>\n";
- }
- }
- rv << xml_indent() << "<peak_power>" << peak_power << "</peak_power>\n";
- rv << xml_indent() << "<mean_power>" << mean_power << "</mean_power>\n";
- rv << xml_indent() << "<time>" << time << "</time>\n";
- rv << xml_indent() << "<ra>" << ra << "</ra>\n";
- rv << xml_indent() << "<decl>" << decl << "</decl>\n";
- rv << xml_indent() << "<q_pix>" << q_pix << "</q_pix>\n";
- rv << xml_indent() << "<freq>" << freq << "</freq>\n";
- rv << xml_indent() << "<detection_freq>" << detection_freq << "</detection_freq>\n";
- rv << xml_indent() << "<barycentric_freq>" << barycentric_freq << "</barycentric_freq>\n";
- rv << xml_indent() << "<fft_len>" << fft_len << "</fft_len>\n";
- rv << xml_indent() << "<chirp_rate>" << chirp_rate << "</chirp_rate>\n";
- rv << xml_indent() << "<rfi_checked>" << rfi_checked << "</rfi_checked>\n";
- rv << xml_indent() << "<rfi_found>" << rfi_found << "</rfi_found>\n";
- rv << xml_indent() << "<reserved>" << reserved << "</reserved>\n";
- rv << xml_indent() << "<period>" << period << "</period>\n";
- rv << xml_indent() << "<snr>" << snr << "</snr>\n";
- rv << xml_indent() << "<thresh>" << thresh << "</thresh>\n";
- rv << xml_indent() << "<score>" << score << "</score>\n";
- xml_indent(-2);
- rv << xml_indent() << "</" << tag << ">\n";
- return rv.str();
-}
-
-
- void pulse_small::parse_xml(const std::string &s,const char *tag) {
- std::string field,sub;
- if (extract_xml_record(s,tag,field)) {
- std::string::size_type pos=0;
- if (extract_xml_record(field,"id",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> id;
- }
- if (extract_xml_record(field,"result_id",sub)) {
- result_id.parse_xml(sub,"result_id");
- }
- if (extract_xml_record(field,"peak_power",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> peak_power;
- }
- if (extract_xml_record(field,"mean_power",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> mean_power;
- }
- if (extract_xml_record(field,"time",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> time;
- }
- if (extract_xml_record(field,"ra",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> ra;
- }
- if (extract_xml_record(field,"decl",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> decl;
- }
- if (extract_xml_record(field,"q_pix",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> q_pix;
- }
- if (extract_xml_record(field,"freq",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> freq;
- }
- if (extract_xml_record(field,"detection_freq",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> detection_freq;
- }
- if (extract_xml_record(field,"barycentric_freq",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> barycentric_freq;
- }
- if (extract_xml_record(field,"fft_len",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> fft_len;
- }
- if (extract_xml_record(field,"chirp_rate",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> chirp_rate;
- }
- if (extract_xml_record(field,"rfi_checked",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> rfi_checked;
- }
- if (extract_xml_record(field,"rfi_found",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> rfi_found;
- }
- if (extract_xml_record(field,"reserved",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> reserved;
- }
- if (extract_xml_record(field,"period",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> period;
- }
- if (extract_xml_record(field,"snr",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> snr;
- }
- if (extract_xml_record(field,"thresh",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> thresh;
- }
- if (extract_xml_record(field,"score",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> score;
- }
- }
- }
-
- void pulse_small::parse(const SQL_ROW &s) {
- {
- std::istringstream row(*(s[0]));
- row >> id;
- }
- {
- result_id.parse(SQL_ROW(s[1],0));
- }
- {
- std::istringstream row(*(s[2]));
- row >> peak_power;
- }
- {
- std::istringstream row(*(s[3]));
- row >> mean_power;
- }
- {
- std::istringstream row(*(s[4]));
- row >> time;
- }
- {
- std::istringstream row(*(s[5]));
- row >> ra;
- }
- {
- std::istringstream row(*(s[6]));
- row >> decl;
- }
- {
- std::istringstream row(*(s[7]));
- row >> q_pix;
- }
- {
- std::istringstream row(*(s[8]));
- row >> freq;
- }
- {
- std::istringstream row(*(s[9]));
- row >> detection_freq;
- }
- {
- std::istringstream row(*(s[10]));
- row >> barycentric_freq;
- }
- {
- std::istringstream row(*(s[11]));
- row >> fft_len;
- }
- {
- std::istringstream row(*(s[12]));
- row >> chirp_rate;
- }
- {
- std::istringstream row(*(s[13]));
- row >> rfi_checked;
- }
- {
- std::istringstream row(*(s[14]));
- row >> rfi_found;
- }
- {
- std::istringstream row(*(s[15]));
- row >> reserved;
- }
- {
- std::istringstream row(*(s[16]));
- row >> period;
- }
- {
- std::istringstream row(*(s[17]));
- row >> snr;
- }
- {
- std::istringstream row(*(s[18]));
- row >> thresh;
- }
- {
- std::istringstream row(*(s[19]));
- row >> score;
- }
- }
-
- void pulse_small::parse(const std::string &s) {
- SQL_ROW row(&s,20);
- parse(row);
- }
-
-template <> const char * const db_table<sah_pointing>::table_name="sah_pointing";
-template <> const char * db_table<sah_pointing>::_search_tag=table_name;
+ if (&a != this) {
+ id=a.id;
+ result_id=a.result_id;
+ peak_power=a.peak_power;
+ mean_power=a.mean_power;
+ time=a.time;
+ ra=a.ra;
+ decl=a.decl;
+ q_pix=a.q_pix;
+ freq=a.freq;
+ detection_freq=a.detection_freq;
+ barycentric_freq=a.barycentric_freq;
+ fft_len=a.fft_len;
+ chirp_rate=a.chirp_rate;
+ rfi_checked=a.rfi_checked;
+ rfi_found=a.rfi_found;
+ reserved=a.reserved;
+ period=a.period;
+ snr=a.snr;
+ thresh=a.thresh;
+ score=a.score;
+ }
+ return (*this);
+}
+
+
+std::string pulse_small::update_format() const {
+ std::ostringstream rv("");
+
+ for (int i=2; i<20; i++) {
+ rv << "?,";
+ }
+ rv << "?";
+ return rv.str();
+}
+
+
+std::string pulse_small::insert_format() const {
+ return std::string("?,")+update_format();
+}
+
+std::string pulse_small::select_format() const {
+ std::string rv("");
+ for (int i=0; i<19; i++) {
+ rv+="?,";
+ }
+ rv+="?";
+ return rv;
+}
+
+std::string pulse_small::print(int full_subtables, int show_ids, int no_refs) const {
+ std::ostringstream rv("");
+
+ rv.precision(14);
+ if (show_ids) {
+ rv << id;
+ }
+ rv << ',';
+ if (!no_refs) {
+ if (full_subtables) {
+ rv << result_id.print(full_subtables,show_ids,no_refs);
+ } else {
+ rv << result_id.id;
+ }
+ }
+ rv << ',';
+ rv << peak_power;
+ rv << ',';
+ rv << mean_power;
+ rv << ',';
+ rv << time;
+ rv << ',';
+ rv << ra;
+ rv << ',';
+ rv << decl;
+ rv << ',';
+ rv << q_pix;
+ rv << ',';
+ rv << freq;
+ rv << ',';
+ rv << detection_freq;
+ rv << ',';
+ rv << barycentric_freq;
+ rv << ',';
+ rv << fft_len;
+ rv << ',';
+ rv << chirp_rate;
+ rv << ',';
+ rv << rfi_checked;
+ rv << ',';
+ rv << rfi_found;
+ rv << ',';
+ rv << reserved;
+ rv << ',';
+ rv << period;
+ rv << ',';
+ rv << snr;
+ rv << ',';
+ rv << thresh;
+ rv << ',';
+ rv << score;
+ return rv.str();
+}
+
+
+std::string pulse_small::print_xml(int full_subtables, int show_ids, int no_refs,const char *tag) const {
+ std::ostringstream rv("");
+
+ rv.precision(14);
+ rv << xml_indent() << '<' << tag << ">\n";
+ xml_indent(2);
+ if (show_ids) {
+ rv << xml_indent() << "<id>" << id << "</id>\n";
+ }
+ if (!no_refs) {
+ if (full_subtables) {
+ rv << result_id.print_xml(full_subtables,show_ids,no_refs,"result_id");
+ } else {
+ rv << xml_indent() << "<result_id><id>" << result_id.id << "</id></result_id>\n";
+ }
+ }
+ rv << xml_indent() << "<peak_power>" << peak_power << "</peak_power>\n";
+ rv << xml_indent() << "<mean_power>" << mean_power << "</mean_power>\n";
+ rv << xml_indent() << "<time>" << time << "</time>\n";
+ rv << xml_indent() << "<ra>" << ra << "</ra>\n";
+ rv << xml_indent() << "<decl>" << decl << "</decl>\n";
+ rv << xml_indent() << "<q_pix>" << q_pix << "</q_pix>\n";
+ rv << xml_indent() << "<freq>" << freq << "</freq>\n";
+ rv << xml_indent() << "<detection_freq>" << detection_freq << "</detection_freq>\n";
+ rv << xml_indent() << "<barycentric_freq>" << barycentric_freq << "</barycentric_freq>\n";
+ rv << xml_indent() << "<fft_len>" << fft_len << "</fft_len>\n";
+ rv << xml_indent() << "<chirp_rate>" << chirp_rate << "</chirp_rate>\n";
+ rv << xml_indent() << "<rfi_checked>" << rfi_checked << "</rfi_checked>\n";
+ rv << xml_indent() << "<rfi_found>" << rfi_found << "</rfi_found>\n";
+ rv << xml_indent() << "<reserved>" << reserved << "</reserved>\n";
+ rv << xml_indent() << "<period>" << period << "</period>\n";
+ rv << xml_indent() << "<snr>" << snr << "</snr>\n";
+ rv << xml_indent() << "<thresh>" << thresh << "</thresh>\n";
+ rv << xml_indent() << "<score>" << score << "</score>\n";
+ xml_indent(-2);
+ rv << xml_indent() << "</" << tag << ">\n";
+ return rv.str();
+}
+
+
+void pulse_small::parse_xml(const std::string &s,const char *tag) {
+ std::string field,sub;
+ if (extract_xml_record(s,tag,field)) {
+ std::string::size_type pos=0;
+ if (extract_xml_record(field,"id",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> id;
+ }
+ if (extract_xml_record(field,"result_id",sub)) {
+ result_id.parse_xml(sub,"result_id");
+ }
+ if (extract_xml_record(field,"peak_power",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> peak_power;
+ }
+ if (extract_xml_record(field,"mean_power",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> mean_power;
+ }
+ if (extract_xml_record(field,"time",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> time;
+ }
+ if (extract_xml_record(field,"ra",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> ra;
+ }
+ if (extract_xml_record(field,"decl",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> decl;
+ }
+ if (extract_xml_record(field,"q_pix",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> q_pix;
+ }
+ if (extract_xml_record(field,"freq",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> freq;
+ }
+ if (extract_xml_record(field,"detection_freq",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> detection_freq;
+ }
+ if (extract_xml_record(field,"barycentric_freq",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> barycentric_freq;
+ }
+ if (extract_xml_record(field,"fft_len",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> fft_len;
+ }
+ if (extract_xml_record(field,"chirp_rate",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> chirp_rate;
+ }
+ if (extract_xml_record(field,"rfi_checked",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> rfi_checked;
+ }
+ if (extract_xml_record(field,"rfi_found",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> rfi_found;
+ }
+ if (extract_xml_record(field,"reserved",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> reserved;
+ }
+ if (extract_xml_record(field,"period",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> period;
+ }
+ if (extract_xml_record(field,"snr",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> snr;
+ }
+ if (extract_xml_record(field,"thresh",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> thresh;
+ }
+ if (extract_xml_record(field,"score",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> score;
+ }
+ }
+}
+
+void pulse_small::parse(const SQL_ROW &s) {
+ {
+ std::istringstream row(*(s[0]));
+ row >> id;
+ }
+ {
+ result_id.parse(SQL_ROW(s[1],0));
+ }
+ {
+ std::istringstream row(*(s[2]));
+ row >> peak_power;
+ }
+ {
+ std::istringstream row(*(s[3]));
+ row >> mean_power;
+ }
+ {
+ std::istringstream row(*(s[4]));
+ row >> time;
+ }
+ {
+ std::istringstream row(*(s[5]));
+ row >> ra;
+ }
+ {
+ std::istringstream row(*(s[6]));
+ row >> decl;
+ }
+ {
+ std::istringstream row(*(s[7]));
+ row >> q_pix;
+ }
+ {
+ std::istringstream row(*(s[8]));
+ row >> freq;
+ }
+ {
+ std::istringstream row(*(s[9]));
+ row >> detection_freq;
+ }
+ {
+ std::istringstream row(*(s[10]));
+ row >> barycentric_freq;
+ }
+ {
+ std::istringstream row(*(s[11]));
+ row >> fft_len;
+ }
+ {
+ std::istringstream row(*(s[12]));
+ row >> chirp_rate;
+ }
+ {
+ std::istringstream row(*(s[13]));
+ row >> rfi_checked;
+ }
+ {
+ std::istringstream row(*(s[14]));
+ row >> rfi_found;
+ }
+ {
+ std::istringstream row(*(s[15]));
+ row >> reserved;
+ }
+ {
+ std::istringstream row(*(s[16]));
+ row >> period;
+ }
+ {
+ std::istringstream row(*(s[17]));
+ row >> snr;
+ }
+ {
+ std::istringstream row(*(s[18]));
+ row >> thresh;
+ }
+ {
+ std::istringstream row(*(s[19]));
+ row >> score;
+ }
+}
+
+void pulse_small::parse(const std::string &s) {
+ SQL_ROW row(&s,20);
+ parse(row);
+}
+
+template <> const char *const db_table<sah_pointing>::table_name="sah_pointing";
+template <> const char *db_table<sah_pointing>::_search_tag=table_name;
template <> const int db_table<sah_pointing>::_nfields=7;
-template <> const char * const db_table<sah_pointing>::column_names[7]={"time_id","time","ra","dec","q_pix","angle_range","bad"};
+template <> const char *const db_table<sah_pointing>::column_names[7]= {"time_id","time","ra","dec","q_pix","angle_range","bad"};
-sah_pointing::sah_pointing() :
- db_table<sah_pointing>(*this,-1),
- time_id(0),
- time(0),
- ra(0),
- dec(0),
- q_pix(0),
- angle_range(0),
- bad(0)
-{
- db_open();
+sah_pointing::sah_pointing() :
+ db_table<sah_pointing>(*this,-1),
+ time_id(0),
+ time(0),
+ ra(0),
+ dec(0),
+ q_pix(0),
+ angle_range(0),
+ bad(0) {
+ db_open();
}
-sah_pointing::sah_pointing(const sah_pointing &a) :
- db_table<sah_pointing>(*this,-1),
- time_id(a.time_id),
- time(a.time),
- ra(a.ra),
- dec(a.dec),
- q_pix(a.q_pix),
- angle_range(a.angle_range),
- bad(a.bad)
-{
- db_open();
+sah_pointing::sah_pointing(const sah_pointing &a) :
+ db_table<sah_pointing>(*this,-1),
+ time_id(a.time_id),
+ time(a.time),
+ ra(a.ra),
+ dec(a.dec),
+ q_pix(a.q_pix),
+ angle_range(a.angle_range),
+ bad(a.bad) {
+ db_open();
}
-sah_pointing::sah_pointing(const SQL_ROW &a) :
- db_table<sah_pointing>(*this,-1)
-{
- db_open();
- parse(a);
+sah_pointing::sah_pointing(const SQL_ROW &a) :
+ db_table<sah_pointing>(*this,-1) {
+ db_open();
+ parse(a);
}
-sah_pointing::sah_pointing(const std::string &s,const char *tag) :
- db_table<sah_pointing>(*this,-1)
-{
- db_open();
- if (xml_match_tag(s,tag)) {
- parse_xml(s,tag);
- } else {
- parse(s);
- }
+sah_pointing::sah_pointing(const std::string &s,const char *tag) :
+ db_table<sah_pointing>(*this,-1) {
+ db_open();
+ if (xml_match_tag(s,tag)) {
+ parse_xml(s,tag);
+ } else {
+ parse(s);
+ }
}
sah_pointing &sah_pointing::operator =(const sah_pointing &a) {
- if (&a != this) {
- time_id=a.time_id;
- time=a.time;
- ra=a.ra;
- dec=a.dec;
- q_pix=a.q_pix;
- angle_range=a.angle_range;
- bad=a.bad;
- }
- return (*this);
-}
-
-
-std::string sah_pointing::update_format() const
-{ std::ostringstream rv("");
-
- for (int i=2;i<7;i++) rv << "?,";
- rv << "?";
- return rv.str();
-}
-
-
-std::string sah_pointing::insert_format() const
-{ return std::string("?,")+update_format();
-}
-
-std::string sah_pointing::select_format() const
-{
-std::string rv("");
-for (int i=0; i<6;i++) rv+="?,";
-rv+="?";
-return rv;
-}
-
-std::string sah_pointing::print(int full_subtables, int show_ids, int no_refs) const
-{ std::ostringstream rv("");
-
- rv.precision(14);
- if (show_ids) rv << time_id;
- rv << ',';
- rv << time;
- rv << ',';
- rv << ra;
- rv << ',';
- rv << dec;
- rv << ',';
- rv << q_pix;
- rv << ',';
- rv << angle_range;
- rv << ',';
- rv << bad;
- return rv.str();
-}
-
-
-std::string sah_pointing::print_xml(int full_subtables, int show_ids, int no_refs,const char *tag) const
-{
- std::ostringstream rv("");
-
- rv.precision(14);
- rv << xml_indent() << '<' << tag << ">\n";
- xml_indent(2);
- if (show_ids) rv << xml_indent() << "<time_id>" << time_id << "</time_id>\n";
- rv << xml_indent() << "<time>" << time << "</time>\n";
- rv << xml_indent() << "<ra>" << ra << "</ra>\n";
- rv << xml_indent() << "<dec>" << dec << "</dec>\n";
- rv << xml_indent() << "<q_pix>" << q_pix << "</q_pix>\n";
- rv << xml_indent() << "<angle_range>" << angle_range << "</angle_range>\n";
- rv << xml_indent() << "<bad>" << bad << "</bad>\n";
- xml_indent(-2);
- rv << xml_indent() << "</" << tag << ">\n";
- return rv.str();
-}
-
-
- void sah_pointing::parse_xml(const std::string &s,const char *tag) {
- std::string field,sub;
- if (extract_xml_record(s,tag,field)) {
- std::string::size_type pos=0;
- if (extract_xml_record(field,"time_id",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> time_id;
- }
- if (extract_xml_record(field,"time",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> time;
- }
- if (extract_xml_record(field,"ra",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> ra;
- }
- if (extract_xml_record(field,"dec",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> dec;
- }
- if (extract_xml_record(field,"q_pix",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> q_pix;
- }
- if (extract_xml_record(field,"angle_range",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> angle_range;
- }
- if (extract_xml_record(field,"bad",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> bad;
- }
- }
- }
-
- void sah_pointing::parse(const SQL_ROW &s) {
- {
- std::istringstream row(*(s[0]));
- row >> time_id;
- }
- {
- std::istringstream row(*(s[1]));
- row >> time;
- }
- {
- std::istringstream row(*(s[2]));
- row >> ra;
- }
- {
- std::istringstream row(*(s[3]));
- row >> dec;
- }
- {
- std::istringstream row(*(s[4]));
- row >> q_pix;
- }
- {
- std::istringstream row(*(s[5]));
- row >> angle_range;
- }
- {
- std::istringstream row(*(s[6]));
- row >> bad;
- }
- }
-
- void sah_pointing::parse(const std::string &s) {
- SQL_ROW row(&s,7);
- parse(row);
- }
-
-template <> const char * const db_table<sky_map>::table_name="sky_map";
-template <> const char * db_table<sky_map>::_search_tag=table_name;
+ if (&a != this) {
+ time_id=a.time_id;
+ time=a.time;
+ ra=a.ra;
+ dec=a.dec;
+ q_pix=a.q_pix;
+ angle_range=a.angle_range;
+ bad=a.bad;
+ }
+ return (*this);
+}
+
+
+std::string sah_pointing::update_format() const {
+ std::ostringstream rv("");
+
+ for (int i=2; i<7; i++) {
+ rv << "?,";
+ }
+ rv << "?";
+ return rv.str();
+}
+
+
+std::string sah_pointing::insert_format() const {
+ return std::string("?,")+update_format();
+}
+
+std::string sah_pointing::select_format() const {
+ std::string rv("");
+ for (int i=0; i<6; i++) {
+ rv+="?,";
+ }
+ rv+="?";
+ return rv;
+}
+
+std::string sah_pointing::print(int full_subtables, int show_ids, int no_refs) const {
+ std::ostringstream rv("");
+
+ rv.precision(14);
+ if (show_ids) {
+ rv << time_id;
+ }
+ rv << ',';
+ rv << time;
+ rv << ',';
+ rv << ra;
+ rv << ',';
+ rv << dec;
+ rv << ',';
+ rv << q_pix;
+ rv << ',';
+ rv << angle_range;
+ rv << ',';
+ rv << bad;
+ return rv.str();
+}
+
+
+std::string sah_pointing::print_xml(int full_subtables, int show_ids, int no_refs,const char *tag) const {
+ std::ostringstream rv("");
+
+ rv.precision(14);
+ rv << xml_indent() << '<' << tag << ">\n";
+ xml_indent(2);
+ if (show_ids) {
+ rv << xml_indent() << "<time_id>" << time_id << "</time_id>\n";
+ }
+ rv << xml_indent() << "<time>" << time << "</time>\n";
+ rv << xml_indent() << "<ra>" << ra << "</ra>\n";
+ rv << xml_indent() << "<dec>" << dec << "</dec>\n";
+ rv << xml_indent() << "<q_pix>" << q_pix << "</q_pix>\n";
+ rv << xml_indent() << "<angle_range>" << angle_range << "</angle_range>\n";
+ rv << xml_indent() << "<bad>" << bad << "</bad>\n";
+ xml_indent(-2);
+ rv << xml_indent() << "</" << tag << ">\n";
+ return rv.str();
+}
+
+
+void sah_pointing::parse_xml(const std::string &s,const char *tag) {
+ std::string field,sub;
+ if (extract_xml_record(s,tag,field)) {
+ std::string::size_type pos=0;
+ if (extract_xml_record(field,"time_id",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> time_id;
+ }
+ if (extract_xml_record(field,"time",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> time;
+ }
+ if (extract_xml_record(field,"ra",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> ra;
+ }
+ if (extract_xml_record(field,"dec",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> dec;
+ }
+ if (extract_xml_record(field,"q_pix",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> q_pix;
+ }
+ if (extract_xml_record(field,"angle_range",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> angle_range;
+ }
+ if (extract_xml_record(field,"bad",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> bad;
+ }
+ }
+}
+
+void sah_pointing::parse(const SQL_ROW &s) {
+ {
+ std::istringstream row(*(s[0]));
+ row >> time_id;
+ }
+ {
+ std::istringstream row(*(s[1]));
+ row >> time;
+ }
+ {
+ std::istringstream row(*(s[2]));
+ row >> ra;
+ }
+ {
+ std::istringstream row(*(s[3]));
+ row >> dec;
+ }
+ {
+ std::istringstream row(*(s[4]));
+ row >> q_pix;
+ }
+ {
+ std::istringstream row(*(s[5]));
+ row >> angle_range;
+ }
+ {
+ std::istringstream row(*(s[6]));
+ row >> bad;
+ }
+}
+
+void sah_pointing::parse(const std::string &s) {
+ SQL_ROW row(&s,7);
+ parse(row);
+}
+
+template <> const char *const db_table<sky_map>::table_name="sky_map";
+template <> const char *db_table<sky_map>::_search_tag=table_name;
template <> const int db_table<sky_map>::_nfields=13;
-template <> const char * const db_table<sky_map>::column_names[13]={"npix","qpix","fpix","spike_max_id","gaussian_max_id","pulse_max_id","triplet_max_id","spike_count","gaussian_count","pulse_count","triplet_count","new_data","score"};
-
-sky_map::sky_map() :
- db_table<sky_map>(*this,-1),
- npix(0),
- qpix(0),
- fpix(0),
- spike_max_id(0),
- gaussian_max_id(0),
- pulse_max_id(0),
- triplet_max_id(0),
- spike_count(0),
- gaussian_count(0),
- pulse_count(0),
- triplet_count(0),
- new_data(0),
- score(0)
-{
- db_open();
-}
-
-
-sky_map::sky_map(const sky_map &a) :
- db_table<sky_map>(*this,-1),
- npix(a.npix),
- qpix(a.qpix),
- fpix(a.fpix),
- spike_max_id(a.spike_max_id),
- gaussian_max_id(a.gaussian_max_id),
- pulse_max_id(a.pulse_max_id),
- triplet_max_id(a.triplet_max_id),
- spike_count(a.spike_count),
- gaussian_count(a.gaussian_count),
- pulse_count(a.pulse_count),
- triplet_count(a.triplet_count),
- new_data(a.new_data),
- score(a.score)
-{
- db_open();
-}
-
-
-sky_map::sky_map(const SQL_ROW &a) :
- db_table<sky_map>(*this,-1)
-{
- db_open();
- parse(a);
-}
-
-
-sky_map::sky_map(const std::string &s,const char *tag) :
- db_table<sky_map>(*this,-1)
-{
- db_open();
- if (xml_match_tag(s,tag)) {
- parse_xml(s,tag);
- } else {
- parse(s);
- }
+template <> const char *const db_table<sky_map>::column_names[13]= {"npix","qpix","fpix","spike_max_id","gaussian_max_id","pulse_max_id","triplet_max_id","spike_count","gaussian_count","pulse_count","triplet_count","new_data","score"};
+
+sky_map::sky_map() :
+ db_table<sky_map>(*this,-1),
+ npix(0),
+ qpix(0),
+ fpix(0),
+ spike_max_id(0),
+ gaussian_max_id(0),
+ pulse_max_id(0),
+ triplet_max_id(0),
+ spike_count(0),
+ gaussian_count(0),
+ pulse_count(0),
+ triplet_count(0),
+ new_data(0),
+ score(0) {
+ db_open();
+}
+
+
+sky_map::sky_map(const sky_map &a) :
+ db_table<sky_map>(*this,-1),
+ npix(a.npix),
+ qpix(a.qpix),
+ fpix(a.fpix),
+ spike_max_id(a.spike_max_id),
+ gaussian_max_id(a.gaussian_max_id),
+ pulse_max_id(a.pulse_max_id),
+ triplet_max_id(a.triplet_max_id),
+ spike_count(a.spike_count),
+ gaussian_count(a.gaussian_count),
+ pulse_count(a.pulse_count),
+ triplet_count(a.triplet_count),
+ new_data(a.new_data),
+ score(a.score) {
+ db_open();
+}
+
+
+sky_map::sky_map(const SQL_ROW &a) :
+ db_table<sky_map>(*this,-1) {
+ db_open();
+ parse(a);
+}
+
+
+sky_map::sky_map(const std::string &s,const char *tag) :
+ db_table<sky_map>(*this,-1) {
+ db_open();
+ if (xml_match_tag(s,tag)) {
+ parse_xml(s,tag);
+ } else {
+ parse(s);
+ }
}
sky_map &sky_map::operator =(const sky_map &a) {
- if (&a != this) {
- npix=a.npix;
- qpix=a.qpix;
- fpix=a.fpix;
- spike_max_id=a.spike_max_id;
- gaussian_max_id=a.gaussian_max_id;
- pulse_max_id=a.pulse_max_id;
- triplet_max_id=a.triplet_max_id;
- spike_count=a.spike_count;
- gaussian_count=a.gaussian_count;
- pulse_count=a.pulse_count;
- triplet_count=a.triplet_count;
- new_data=a.new_data;
- score=a.score;
- }
- return (*this);
-}
-
-
-std::string sky_map::update_format() const
-{ std::ostringstream rv("");
-
- for (int i=2;i<13;i++) rv << "?,";
- rv << "?";
- return rv.str();
-}
-
-
-std::string sky_map::insert_format() const
-{ return std::string("?,")+update_format();
-}
-
-std::string sky_map::select_format() const
-{
-std::string rv("");
-for (int i=0; i<12;i++) rv+="?,";
-rv+="?";
-return rv;
-}
-
-std::string sky_map::print(int full_subtables, int show_ids, int no_refs) const
-{ std::ostringstream rv("");
-
- rv.precision(14);
- if (show_ids) rv << npix;
- rv << ',';
- rv << qpix;
- rv << ',';
- rv << fpix;
- rv << ',';
- rv << spike_max_id;
- rv << ',';
- rv << gaussian_max_id;
- rv << ',';
- rv << pulse_max_id;
- rv << ',';
- rv << triplet_max_id;
- rv << ',';
- rv << spike_count;
- rv << ',';
- rv << gaussian_count;
- rv << ',';
- rv << pulse_count;
- rv << ',';
- rv << triplet_count;
- rv << ',';
- rv << new_data;
- rv << ',';
- rv << score;
- return rv.str();
-}
-
-
-std::string sky_map::print_xml(int full_subtables, int show_ids, int no_refs,const char *tag) const
-{
- std::ostringstream rv("");
-
- rv.precision(14);
- rv << xml_indent() << '<' << tag << ">\n";
- xml_indent(2);
- if (show_ids) rv << xml_indent() << "<npix>" << npix << "</npix>\n";
- rv << xml_indent() << "<qpix>" << qpix << "</qpix>\n";
- rv << xml_indent() << "<fpix>" << fpix << "</fpix>\n";
- rv << xml_indent() << "<spike_max_id>" << spike_max_id << "</spike_max_id>\n";
- rv << xml_indent() << "<gaussian_max_id>" << gaussian_max_id << "</gaussian_max_id>\n";
- rv << xml_indent() << "<pulse_max_id>" << pulse_max_id << "</pulse_max_id>\n";
- rv << xml_indent() << "<triplet_max_id>" << triplet_max_id << "</triplet_max_id>\n";
- rv << xml_indent() << "<spike_count>" << spike_count << "</spike_count>\n";
- rv << xml_indent() << "<gaussian_count>" << gaussian_count << "</gaussian_count>\n";
- rv << xml_indent() << "<pulse_count>" << pulse_count << "</pulse_count>\n";
- rv << xml_indent() << "<triplet_count>" << triplet_count << "</triplet_count>\n";
- rv << xml_indent() << "<new_data>" << new_data << "</new_data>\n";
- rv << xml_indent() << "<score>" << score << "</score>\n";
- xml_indent(-2);
- rv << xml_indent() << "</" << tag << ">\n";
- return rv.str();
-}
-
-
- void sky_map::parse_xml(const std::string &s,const char *tag) {
- std::string field,sub;
- if (extract_xml_record(s,tag,field)) {
- std::string::size_type pos=0;
- if (extract_xml_record(field,"npix",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> npix;
- }
- if (extract_xml_record(field,"qpix",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> qpix;
- }
- if (extract_xml_record(field,"fpix",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> fpix;
- }
- if (extract_xml_record(field,"spike_max_id",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> spike_max_id;
- }
- if (extract_xml_record(field,"gaussian_max_id",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> gaussian_max_id;
- }
- if (extract_xml_record(field,"pulse_max_id",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> pulse_max_id;
- }
- if (extract_xml_record(field,"triplet_max_id",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> triplet_max_id;
- }
- if (extract_xml_record(field,"spike_count",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> spike_count;
- }
- if (extract_xml_record(field,"gaussian_count",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> gaussian_count;
- }
- if (extract_xml_record(field,"pulse_count",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> pulse_count;
- }
- if (extract_xml_record(field,"triplet_count",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> triplet_count;
- }
- if (extract_xml_record(field,"new_data",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> new_data;
- }
- if (extract_xml_record(field,"score",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> score;
- }
- }
- }
-
- void sky_map::parse(const SQL_ROW &s) {
- {
- std::istringstream row(*(s[0]));
- row >> npix;
- }
- {
- std::istringstream row(*(s[1]));
- row >> qpix;
- }
- {
- std::istringstream row(*(s[2]));
- row >> fpix;
- }
- {
- std::istringstream row(*(s[3]));
- row >> spike_max_id;
- }
- {
- std::istringstream row(*(s[4]));
- row >> gaussian_max_id;
- }
- {
- std::istringstream row(*(s[5]));
- row >> pulse_max_id;
- }
- {
- std::istringstream row(*(s[6]));
- row >> triplet_max_id;
- }
- {
- std::istringstream row(*(s[7]));
- row >> spike_count;
- }
- {
- std::istringstream row(*(s[8]));
- row >> gaussian_count;
- }
- {
- std::istringstream row(*(s[9]));
- row >> pulse_count;
- }
- {
- std::istringstream row(*(s[10]));
- row >> triplet_count;
- }
- {
- std::istringstream row(*(s[11]));
- row >> new_data;
- }
- {
- std::istringstream row(*(s[12]));
- row >> score;
- }
- }
-
- void sky_map::parse(const std::string &s) {
- SQL_ROW row(&s,13);
- parse(row);
- }
-
-template <> const char * const db_table<hotpix>::table_name="hotpix";
-template <> const char * db_table<hotpix>::_search_tag=table_name;
+ if (&a != this) {
+ npix=a.npix;
+ qpix=a.qpix;
+ fpix=a.fpix;
+ spike_max_id=a.spike_max_id;
+ gaussian_max_id=a.gaussian_max_id;
+ pulse_max_id=a.pulse_max_id;
+ triplet_max_id=a.triplet_max_id;
+ spike_count=a.spike_count;
+ gaussian_count=a.gaussian_count;
+ pulse_count=a.pulse_count;
+ triplet_count=a.triplet_count;
+ new_data=a.new_data;
+ score=a.score;
+ }
+ return (*this);
+}
+
+
+std::string sky_map::update_format() const {
+ std::ostringstream rv("");
+
+ for (int i=2; i<13; i++) {
+ rv << "?,";
+ }
+ rv << "?";
+ return rv.str();
+}
+
+
+std::string sky_map::insert_format() const {
+ return std::string("?,")+update_format();
+}
+
+std::string sky_map::select_format() const {
+ std::string rv("");
+ for (int i=0; i<12; i++) {
+ rv+="?,";
+ }
+ rv+="?";
+ return rv;
+}
+
+std::string sky_map::print(int full_subtables, int show_ids, int no_refs) const {
+ std::ostringstream rv("");
+
+ rv.precision(14);
+ if (show_ids) {
+ rv << npix;
+ }
+ rv << ',';
+ rv << qpix;
+ rv << ',';
+ rv << fpix;
+ rv << ',';
+ rv << spike_max_id;
+ rv << ',';
+ rv << gaussian_max_id;
+ rv << ',';
+ rv << pulse_max_id;
+ rv << ',';
+ rv << triplet_max_id;
+ rv << ',';
+ rv << spike_count;
+ rv << ',';
+ rv << gaussian_count;
+ rv << ',';
+ rv << pulse_count;
+ rv << ',';
+ rv << triplet_count;
+ rv << ',';
+ rv << new_data;
+ rv << ',';
+ rv << score;
+ return rv.str();
+}
+
+
+std::string sky_map::print_xml(int full_subtables, int show_ids, int no_refs,const char *tag) const {
+ std::ostringstream rv("");
+
+ rv.precision(14);
+ rv << xml_indent() << '<' << tag << ">\n";
+ xml_indent(2);
+ if (show_ids) {
+ rv << xml_indent() << "<npix>" << npix << "</npix>\n";
+ }
+ rv << xml_indent() << "<qpix>" << qpix << "</qpix>\n";
+ rv << xml_indent() << "<fpix>" << fpix << "</fpix>\n";
+ rv << xml_indent() << "<spike_max_id>" << spike_max_id << "</spike_max_id>\n";
+ rv << xml_indent() << "<gaussian_max_id>" << gaussian_max_id << "</gaussian_max_id>\n";
+ rv << xml_indent() << "<pulse_max_id>" << pulse_max_id << "</pulse_max_id>\n";
+ rv << xml_indent() << "<triplet_max_id>" << triplet_max_id << "</triplet_max_id>\n";
+ rv << xml_indent() << "<spike_count>" << spike_count << "</spike_count>\n";
+ rv << xml_indent() << "<gaussian_count>" << gaussian_count << "</gaussian_count>\n";
+ rv << xml_indent() << "<pulse_count>" << pulse_count << "</pulse_count>\n";
+ rv << xml_indent() << "<triplet_count>" << triplet_count << "</triplet_count>\n";
+ rv << xml_indent() << "<new_data>" << new_data << "</new_data>\n";
+ rv << xml_indent() << "<score>" << score << "</score>\n";
+ xml_indent(-2);
+ rv << xml_indent() << "</" << tag << ">\n";
+ return rv.str();
+}
+
+
+void sky_map::parse_xml(const std::string &s,const char *tag) {
+ std::string field,sub;
+ if (extract_xml_record(s,tag,field)) {
+ std::string::size_type pos=0;
+ if (extract_xml_record(field,"npix",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> npix;
+ }
+ if (extract_xml_record(field,"qpix",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> qpix;
+ }
+ if (extract_xml_record(field,"fpix",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> fpix;
+ }
+ if (extract_xml_record(field,"spike_max_id",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> spike_max_id;
+ }
+ if (extract_xml_record(field,"gaussian_max_id",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> gaussian_max_id;
+ }
+ if (extract_xml_record(field,"pulse_max_id",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> pulse_max_id;
+ }
+ if (extract_xml_record(field,"triplet_max_id",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> triplet_max_id;
+ }
+ if (extract_xml_record(field,"spike_count",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> spike_count;
+ }
+ if (extract_xml_record(field,"gaussian_count",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> gaussian_count;
+ }
+ if (extract_xml_record(field,"pulse_count",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> pulse_count;
+ }
+ if (extract_xml_record(field,"triplet_count",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> triplet_count;
+ }
+ if (extract_xml_record(field,"new_data",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> new_data;
+ }
+ if (extract_xml_record(field,"score",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> score;
+ }
+ }
+}
+
+void sky_map::parse(const SQL_ROW &s) {
+ {
+ std::istringstream row(*(s[0]));
+ row >> npix;
+ }
+ {
+ std::istringstream row(*(s[1]));
+ row >> qpix;
+ }
+ {
+ std::istringstream row(*(s[2]));
+ row >> fpix;
+ }
+ {
+ std::istringstream row(*(s[3]));
+ row >> spike_max_id;
+ }
+ {
+ std::istringstream row(*(s[4]));
+ row >> gaussian_max_id;
+ }
+ {
+ std::istringstream row(*(s[5]));
+ row >> pulse_max_id;
+ }
+ {
+ std::istringstream row(*(s[6]));
+ row >> triplet_max_id;
+ }
+ {
+ std::istringstream row(*(s[7]));
+ row >> spike_count;
+ }
+ {
+ std::istringstream row(*(s[8]));
+ row >> gaussian_count;
+ }
+ {
+ std::istringstream row(*(s[9]));
+ row >> pulse_count;
+ }
+ {
+ std::istringstream row(*(s[10]));
+ row >> triplet_count;
+ }
+ {
+ std::istringstream row(*(s[11]));
+ row >> new_data;
+ }
+ {
+ std::istringstream row(*(s[12]));
+ row >> score;
+ }
+}
+
+void sky_map::parse(const std::string &s) {
+ SQL_ROW row(&s,13);
+ parse(row);
+}
+
+template <> const char *const db_table<hotpix>::table_name="hotpix";
+template <> const char *db_table<hotpix>::_search_tag=table_name;
template <> const int db_table<hotpix>::_nfields=2;
-template <> const char * const db_table<hotpix>::column_names[2]={"id","last_hit_time"};
+template <> const char *const db_table<hotpix>::column_names[2]= {"id","last_hit_time"};
-hotpix::hotpix() :
- db_table<hotpix>(*this,-1),
- id(0),
- last_hit_time(0)
-{
- db_open();
+hotpix::hotpix() :
+ db_table<hotpix>(*this,-1),
+ id(0),
+ last_hit_time(0) {
+ db_open();
}
-hotpix::hotpix(const hotpix &a) :
- db_table<hotpix>(*this,-1),
- id(a.id),
- last_hit_time(a.last_hit_time)
-{
- db_open();
+hotpix::hotpix(const hotpix &a) :
+ db_table<hotpix>(*this,-1),
+ id(a.id),
+ last_hit_time(a.last_hit_time) {
+ db_open();
}
-hotpix::hotpix(const SQL_ROW &a) :
- db_table<hotpix>(*this,-1)
-{
- db_open();
- parse(a);
+hotpix::hotpix(const SQL_ROW &a) :
+ db_table<hotpix>(*this,-1) {
+ db_open();
+ parse(a);
}
-hotpix::hotpix(const std::string &s,const char *tag) :
- db_table<hotpix>(*this,-1)
-{
- db_open();
- if (xml_match_tag(s,tag)) {
- parse_xml(s,tag);
- } else {
- parse(s);
- }
+hotpix::hotpix(const std::string &s,const char *tag) :
+ db_table<hotpix>(*this,-1) {
+ db_open();
+ if (xml_match_tag(s,tag)) {
+ parse_xml(s,tag);
+ } else {
+ parse(s);
+ }
}
hotpix &hotpix::operator =(const hotpix &a) {
- if (&a != this) {
- id=a.id;
- last_hit_time=a.last_hit_time;
- }
- return (*this);
-}
-
-
-std::string hotpix::update_format() const
-{ std::ostringstream rv("");
-
- for (int i=2;i<2;i++) rv << "?,";
- rv << "?";
- return rv.str();
-}
-
-
-std::string hotpix::insert_format() const
-{ return std::string("?,")+update_format();
-}
-
-std::string hotpix::select_format() const
-{
-std::string rv("");
-for (int i=0; i<1;i++) rv+="?,";
-rv+="?";
-return rv;
-}
-
-std::string hotpix::print(int full_subtables, int show_ids, int no_refs) const
-{ std::ostringstream rv("");
-
- rv.precision(14);
- if (show_ids) rv << id;
- rv << ',';
- rv << last_hit_time;
- return rv.str();
-}
-
-
-std::string hotpix::print_xml(int full_subtables, int show_ids, int no_refs,const char *tag) const
-{
- std::ostringstream rv("");
-
- rv.precision(14);
- rv << xml_indent() << '<' << tag << ">\n";
- xml_indent(2);
- if (show_ids) rv << xml_indent() << "<id>" << id << "</id>\n";
- rv << xml_indent() << "<last_hit_time>" << last_hit_time << "</last_hit_time>\n";
- xml_indent(-2);
- rv << xml_indent() << "</" << tag << ">\n";
- return rv.str();
-}
-
-
- void hotpix::parse_xml(const std::string &s,const char *tag) {
- std::string field,sub;
- if (extract_xml_record(s,tag,field)) {
- std::string::size_type pos=0;
- if (extract_xml_record(field,"id",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> id;
- }
- if (extract_xml_record(field,"last_hit_time",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> last_hit_time;
- }
- }
- }
-
- void hotpix::parse(const SQL_ROW &s) {
- {
- std::istringstream row(*(s[0]));
- row >> id;
- }
- {
- std::istringstream row(*(s[1]));
- row >> last_hit_time;
- }
- }
-
- void hotpix::parse(const std::string &s) {
- SQL_ROW row(&s,2);
- parse(row);
- }
-
-template <> const char * const db_table<spike>::table_name="spike";
-template <> const char * db_table<spike>::_search_tag=table_name;
+ if (&a != this) {
+ id=a.id;
+ last_hit_time=a.last_hit_time;
+ }
+ return (*this);
+}
+
+
+std::string hotpix::update_format() const {
+ std::ostringstream rv("");
+
+ for (int i=2; i<2; i++) {
+ rv << "?,";
+ }
+ rv << "?";
+ return rv.str();
+}
+
+
+std::string hotpix::insert_format() const {
+ return std::string("?,")+update_format();
+}
+
+std::string hotpix::select_format() const {
+ std::string rv("");
+ for (int i=0; i<1; i++) {
+ rv+="?,";
+ }
+ rv+="?";
+ return rv;
+}
+
+std::string hotpix::print(int full_subtables, int show_ids, int no_refs) const {
+ std::ostringstream rv("");
+
+ rv.precision(14);
+ if (show_ids) {
+ rv << id;
+ }
+ rv << ',';
+ rv << last_hit_time;
+ return rv.str();
+}
+
+
+std::string hotpix::print_xml(int full_subtables, int show_ids, int no_refs,const char *tag) const {
+ std::ostringstream rv("");
+
+ rv.precision(14);
+ rv << xml_indent() << '<' << tag << ">\n";
+ xml_indent(2);
+ if (show_ids) {
+ rv << xml_indent() << "<id>" << id << "</id>\n";
+ }
+ rv << xml_indent() << "<last_hit_time>" << last_hit_time << "</last_hit_time>\n";
+ xml_indent(-2);
+ rv << xml_indent() << "</" << tag << ">\n";
+ return rv.str();
+}
+
+
+void hotpix::parse_xml(const std::string &s,const char *tag) {
+ std::string field,sub;
+ if (extract_xml_record(s,tag,field)) {
+ std::string::size_type pos=0;
+ if (extract_xml_record(field,"id",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> id;
+ }
+ if (extract_xml_record(field,"last_hit_time",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> last_hit_time;
+ }
+ }
+}
+
+void hotpix::parse(const SQL_ROW &s) {
+ {
+ std::istringstream row(*(s[0]));
+ row >> id;
+ }
+ {
+ std::istringstream row(*(s[1]));
+ row >> last_hit_time;
+ }
+}
+
+void hotpix::parse(const std::string &s) {
+ SQL_ROW row(&s,2);
+ parse(row);
+}
+
+template <> const char *const db_table<spike>::table_name="spike";
+template <> const char *db_table<spike>::_search_tag=table_name;
template <> const int db_table<spike>::_nfields=16;
-template <> const char * const db_table<spike>::column_names[16]={"id","result_id","peak_power","mean_power","time","ra","decl","q_pix","freq","detection_freq","barycentric_freq","fft_len","chirp_rate","rfi_checked","rfi_found","reserved"};
-
-spike::spike() :
- db_table<spike>(*this,-1),
- id(0),
- result_id(),
- peak_power(0),
- mean_power(0),
- time(0),
- ra(0),
- decl(0),
- q_pix(0),
- freq(0),
- detection_freq(0),
- barycentric_freq(0),
- fft_len(0),
- chirp_rate(0),
- rfi_checked(0),
- rfi_found(0),
- reserved(0)
-{
- db_open();
-}
-
-
-spike::spike(const spike &a) :
- db_table<spike>(*this,-1),
- id(a.id),
- result_id(a.result_id),
- peak_power(a.peak_power),
- mean_power(a.mean_power),
- time(a.time),
- ra(a.ra),
- decl(a.decl),
- q_pix(a.q_pix),
- freq(a.freq),
- detection_freq(a.detection_freq),
- barycentric_freq(a.barycentric_freq),
- fft_len(a.fft_len),
- chirp_rate(a.chirp_rate),
- rfi_checked(a.rfi_checked),
- rfi_found(a.rfi_found),
- reserved(a.reserved)
-{
- db_open();
-}
-
-
-spike::spike(const SQL_ROW &a) :
- db_table<spike>(*this,-1)
-{
- db_open();
- parse(a);
-}
-
-
-spike::spike(const std::string &s,const char *tag) :
- db_table<spike>(*this,-1)
-{
- db_open();
- if (xml_match_tag(s,tag)) {
- parse_xml(s,tag);
- } else {
- parse(s);
- }
+template <> const char *const db_table<spike>::column_names[16]= {"id","result_id","peak_power","mean_power","time","ra","decl","q_pix","freq","detection_freq","barycentric_freq","fft_len","chirp_rate","rfi_checked","rfi_found","reserved"};
+
+spike::spike() :
+ db_table<spike>(*this,-1),
+ id(0),
+ result_id(),
+ peak_power(0),
+ mean_power(0),
+ time(0),
+ ra(0),
+ decl(0),
+ q_pix(0),
+ freq(0),
+ detection_freq(0),
+ barycentric_freq(0),
+ fft_len(0),
+ chirp_rate(0),
+ rfi_checked(0),
+ rfi_found(0),
+ reserved(0) {
+ db_open();
+}
+
+
+spike::spike(const spike &a) :
+ db_table<spike>(*this,-1),
+ id(a.id),
+ result_id(a.result_id),
+ peak_power(a.peak_power),
+ mean_power(a.mean_power),
+ time(a.time),
+ ra(a.ra),
+ decl(a.decl),
+ q_pix(a.q_pix),
+ freq(a.freq),
+ detection_freq(a.detection_freq),
+ barycentric_freq(a.barycentric_freq),
+ fft_len(a.fft_len),
+ chirp_rate(a.chirp_rate),
+ rfi_checked(a.rfi_checked),
+ rfi_found(a.rfi_found),
+ reserved(a.reserved) {
+ db_open();
+}
+
+
+spike::spike(const SQL_ROW &a) :
+ db_table<spike>(*this,-1) {
+ db_open();
+ parse(a);
+}
+
+
+spike::spike(const std::string &s,const char *tag) :
+ db_table<spike>(*this,-1) {
+ db_open();
+ if (xml_match_tag(s,tag)) {
+ parse_xml(s,tag);
+ } else {
+ parse(s);
+ }
}
spike &spike::operator =(const spike &a) {
- if (&a != this) {
- id=a.id;
- result_id=a.result_id;
- peak_power=a.peak_power;
- mean_power=a.mean_power;
- time=a.time;
- ra=a.ra;
- decl=a.decl;
- q_pix=a.q_pix;
- freq=a.freq;
- detection_freq=a.detection_freq;
- barycentric_freq=a.barycentric_freq;
- fft_len=a.fft_len;
- chirp_rate=a.chirp_rate;
- rfi_checked=a.rfi_checked;
- rfi_found=a.rfi_found;
- reserved=a.reserved;
- }
- return (*this);
-}
-
-
-std::string spike::update_format() const
-{ std::ostringstream rv("");
-
- for (int i=2;i<16;i++) rv << "?,";
- rv << "?";
- return rv.str();
-}
-
-
-std::string spike::insert_format() const
-{ return std::string("?,")+update_format();
-}
-
-std::string spike::select_format() const
-{
-std::string rv("");
-for (int i=0; i<15;i++) rv+="?,";
-rv+="?";
-return rv;
-}
-
-std::string spike::print(int full_subtables, int show_ids, int no_refs) const
-{ std::ostringstream rv("");
-
- rv.precision(14);
- if (show_ids) rv << id;
- rv << ',';
- if (!no_refs) {
- if (full_subtables) {
- rv << result_id.print(full_subtables,show_ids,no_refs);
- } else {
- rv << result_id.id;
- }
- }
- rv << ',';
- rv << peak_power;
- rv << ',';
- rv << mean_power;
- rv << ',';
- rv << time;
- rv << ',';
- rv << ra;
- rv << ',';
- rv << decl;
- rv << ',';
- rv << q_pix;
- rv << ',';
- rv << freq;
- rv << ',';
- rv << detection_freq;
- rv << ',';
- rv << barycentric_freq;
- rv << ',';
- rv << fft_len;
- rv << ',';
- rv << chirp_rate;
- rv << ',';
- rv << rfi_checked;
- rv << ',';
- rv << rfi_found;
- rv << ',';
- rv << reserved;
- return rv.str();
-}
-
-
-std::string spike::print_xml(int full_subtables, int show_ids, int no_refs,const char *tag) const
-{
- std::ostringstream rv("");
-
- rv.precision(14);
- rv << xml_indent() << '<' << tag << ">\n";
- xml_indent(2);
- if (show_ids) rv << xml_indent() << "<id>" << id << "</id>\n";
- if (!no_refs) {
- if (full_subtables) {
- rv << result_id.print_xml(full_subtables,show_ids,no_refs,"result_id");
- } else {
- rv << xml_indent() << "<result_id><id>" << result_id.id << "</id></result_id>\n";
- }
- }
- rv << xml_indent() << "<peak_power>" << peak_power << "</peak_power>\n";
- rv << xml_indent() << "<mean_power>" << mean_power << "</mean_power>\n";
- rv << xml_indent() << "<time>" << time << "</time>\n";
- rv << xml_indent() << "<ra>" << ra << "</ra>\n";
- rv << xml_indent() << "<decl>" << decl << "</decl>\n";
- rv << xml_indent() << "<q_pix>" << q_pix << "</q_pix>\n";
- rv << xml_indent() << "<freq>" << freq << "</freq>\n";
- rv << xml_indent() << "<detection_freq>" << detection_freq << "</detection_freq>\n";
- rv << xml_indent() << "<barycentric_freq>" << barycentric_freq << "</barycentric_freq>\n";
- rv << xml_indent() << "<fft_len>" << fft_len << "</fft_len>\n";
- rv << xml_indent() << "<chirp_rate>" << chirp_rate << "</chirp_rate>\n";
- rv << xml_indent() << "<rfi_checked>" << rfi_checked << "</rfi_checked>\n";
- rv << xml_indent() << "<rfi_found>" << rfi_found << "</rfi_found>\n";
- rv << xml_indent() << "<reserved>" << reserved << "</reserved>\n";
- xml_indent(-2);
- rv << xml_indent() << "</" << tag << ">\n";
- return rv.str();
-}
-
-
- void spike::parse_xml(const std::string &s,const char *tag) {
- std::string field,sub;
- if (extract_xml_record(s,tag,field)) {
- std::string::size_type pos=0;
- if (extract_xml_record(field,"id",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> id;
- }
- if (extract_xml_record(field,"result_id",sub)) {
- result_id.parse_xml(sub,"result_id");
- }
- if (extract_xml_record(field,"peak_power",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> peak_power;
- }
- if (extract_xml_record(field,"mean_power",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> mean_power;
- }
- if (extract_xml_record(field,"time",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> time;
- }
- if (extract_xml_record(field,"ra",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> ra;
- }
- if (extract_xml_record(field,"decl",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> decl;
- }
- if (extract_xml_record(field,"q_pix",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> q_pix;
- }
- if (extract_xml_record(field,"freq",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> freq;
- }
- if (extract_xml_record(field,"detection_freq",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> detection_freq;
- }
- if (extract_xml_record(field,"barycentric_freq",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> barycentric_freq;
- }
- if (extract_xml_record(field,"fft_len",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> fft_len;
- }
- if (extract_xml_record(field,"chirp_rate",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> chirp_rate;
- }
- if (extract_xml_record(field,"rfi_checked",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> rfi_checked;
- }
- if (extract_xml_record(field,"rfi_found",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> rfi_found;
- }
- if (extract_xml_record(field,"reserved",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> reserved;
- }
- }
- }
-
- void spike::parse(const SQL_ROW &s) {
- {
- std::istringstream row(*(s[0]));
- row >> id;
- }
- {
- result_id.parse(SQL_ROW(s[1],0));
- }
- {
- std::istringstream row(*(s[2]));
- row >> peak_power;
- }
- {
- std::istringstream row(*(s[3]));
- row >> mean_power;
- }
- {
- std::istringstream row(*(s[4]));
- row >> time;
- }
- {
- std::istringstream row(*(s[5]));
- row >> ra;
- }
- {
- std::istringstream row(*(s[6]));
- row >> decl;
- }
- {
- std::istringstream row(*(s[7]));
- row >> q_pix;
- }
- {
- std::istringstream row(*(s[8]));
- row >> freq;
- }
- {
- std::istringstream row(*(s[9]));
- row >> detection_freq;
- }
- {
- std::istringstream row(*(s[10]));
- row >> barycentric_freq;
- }
- {
- std::istringstream row(*(s[11]));
- row >> fft_len;
- }
- {
- std::istringstream row(*(s[12]));
- row >> chirp_rate;
- }
- {
- std::istringstream row(*(s[13]));
- row >> rfi_checked;
- }
- {
- std::istringstream row(*(s[14]));
- row >> rfi_found;
- }
- {
- std::istringstream row(*(s[15]));
- row >> reserved;
- }
- }
-
- void spike::parse(const std::string &s) {
- SQL_ROW row(&s,16);
- parse(row);
- }
-
-template <> const char * const db_table<spike_small>::table_name="spike_small";
-template <> const char * db_table<spike_small>::_search_tag=table_name;
+ if (&a != this) {
+ id=a.id;
+ result_id=a.result_id;
+ peak_power=a.peak_power;
+ mean_power=a.mean_power;
+ time=a.time;
+ ra=a.ra;
+ decl=a.decl;
+ q_pix=a.q_pix;
+ freq=a.freq;
+ detection_freq=a.detection_freq;
+ barycentric_freq=a.barycentric_freq;
+ fft_len=a.fft_len;
+ chirp_rate=a.chirp_rate;
+ rfi_checked=a.rfi_checked;
+ rfi_found=a.rfi_found;
+ reserved=a.reserved;
+ }
+ return (*this);
+}
+
+
+std::string spike::update_format() const {
+ std::ostringstream rv("");
+
+ for (int i=2; i<16; i++) {
+ rv << "?,";
+ }
+ rv << "?";
+ return rv.str();
+}
+
+
+std::string spike::insert_format() const {
+ return std::string("?,")+update_format();
+}
+
+std::string spike::select_format() const {
+ std::string rv("");
+ for (int i=0; i<15; i++) {
+ rv+="?,";
+ }
+ rv+="?";
+ return rv;
+}
+
+std::string spike::print(int full_subtables, int show_ids, int no_refs) const {
+ std::ostringstream rv("");
+
+ rv.precision(14);
+ if (show_ids) {
+ rv << id;
+ }
+ rv << ',';
+ if (!no_refs) {
+ if (full_subtables) {
+ rv << result_id.print(full_subtables,show_ids,no_refs);
+ } else {
+ rv << result_id.id;
+ }
+ }
+ rv << ',';
+ rv << peak_power;
+ rv << ',';
+ rv << mean_power;
+ rv << ',';
+ rv << time;
+ rv << ',';
+ rv << ra;
+ rv << ',';
+ rv << decl;
+ rv << ',';
+ rv << q_pix;
+ rv << ',';
+ rv << freq;
+ rv << ',';
+ rv << detection_freq;
+ rv << ',';
+ rv << barycentric_freq;
+ rv << ',';
+ rv << fft_len;
+ rv << ',';
+ rv << chirp_rate;
+ rv << ',';
+ rv << rfi_checked;
+ rv << ',';
+ rv << rfi_found;
+ rv << ',';
+ rv << reserved;
+ return rv.str();
+}
+
+
+std::string spike::print_xml(int full_subtables, int show_ids, int no_refs,const char *tag) const {
+ std::ostringstream rv("");
+
+ rv.precision(14);
+ rv << xml_indent() << '<' << tag << ">\n";
+ xml_indent(2);
+ if (show_ids) {
+ rv << xml_indent() << "<id>" << id << "</id>\n";
+ }
+ if (!no_refs) {
+ if (full_subtables) {
+ rv << result_id.print_xml(full_subtables,show_ids,no_refs,"result_id");
+ } else {
+ rv << xml_indent() << "<result_id><id>" << result_id.id << "</id></result_id>\n";
+ }
+ }
+ rv << xml_indent() << "<peak_power>" << peak_power << "</peak_power>\n";
+ rv << xml_indent() << "<mean_power>" << mean_power << "</mean_power>\n";
+ rv << xml_indent() << "<time>" << time << "</time>\n";
+ rv << xml_indent() << "<ra>" << ra << "</ra>\n";
+ rv << xml_indent() << "<decl>" << decl << "</decl>\n";
+ rv << xml_indent() << "<q_pix>" << q_pix << "</q_pix>\n";
+ rv << xml_indent() << "<freq>" << freq << "</freq>\n";
+ rv << xml_indent() << "<detection_freq>" << detection_freq << "</detection_freq>\n";
+ rv << xml_indent() << "<barycentric_freq>" << barycentric_freq << "</barycentric_freq>\n";
+ rv << xml_indent() << "<fft_len>" << fft_len << "</fft_len>\n";
+ rv << xml_indent() << "<chirp_rate>" << chirp_rate << "</chirp_rate>\n";
+ rv << xml_indent() << "<rfi_checked>" << rfi_checked << "</rfi_checked>\n";
+ rv << xml_indent() << "<rfi_found>" << rfi_found << "</rfi_found>\n";
+ rv << xml_indent() << "<reserved>" << reserved << "</reserved>\n";
+ xml_indent(-2);
+ rv << xml_indent() << "</" << tag << ">\n";
+ return rv.str();
+}
+
+
+void spike::parse_xml(const std::string &s,const char *tag) {
+ std::string field,sub;
+ if (extract_xml_record(s,tag,field)) {
+ std::string::size_type pos=0;
+ if (extract_xml_record(field,"id",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> id;
+ }
+ if (extract_xml_record(field,"result_id",sub)) {
+ result_id.parse_xml(sub,"result_id");
+ }
+ if (extract_xml_record(field,"peak_power",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> peak_power;
+ }
+ if (extract_xml_record(field,"mean_power",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> mean_power;
+ }
+ if (extract_xml_record(field,"time",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> time;
+ }
+ if (extract_xml_record(field,"ra",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> ra;
+ }
+ if (extract_xml_record(field,"decl",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> decl;
+ }
+ if (extract_xml_record(field,"q_pix",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> q_pix;
+ }
+ if (extract_xml_record(field,"freq",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> freq;
+ }
+ if (extract_xml_record(field,"detection_freq",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> detection_freq;
+ }
+ if (extract_xml_record(field,"barycentric_freq",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> barycentric_freq;
+ }
+ if (extract_xml_record(field,"fft_len",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> fft_len;
+ }
+ if (extract_xml_record(field,"chirp_rate",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> chirp_rate;
+ }
+ if (extract_xml_record(field,"rfi_checked",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> rfi_checked;
+ }
+ if (extract_xml_record(field,"rfi_found",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> rfi_found;
+ }
+ if (extract_xml_record(field,"reserved",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> reserved;
+ }
+ }
+}
+
+void spike::parse(const SQL_ROW &s) {
+ {
+ std::istringstream row(*(s[0]));
+ row >> id;
+ }
+ {
+ result_id.parse(SQL_ROW(s[1],0));
+ }
+ {
+ std::istringstream row(*(s[2]));
+ row >> peak_power;
+ }
+ {
+ std::istringstream row(*(s[3]));
+ row >> mean_power;
+ }
+ {
+ std::istringstream row(*(s[4]));
+ row >> time;
+ }
+ {
+ std::istringstream row(*(s[5]));
+ row >> ra;
+ }
+ {
+ std::istringstream row(*(s[6]));
+ row >> decl;
+ }
+ {
+ std::istringstream row(*(s[7]));
+ row >> q_pix;
+ }
+ {
+ std::istringstream row(*(s[8]));
+ row >> freq;
+ }
+ {
+ std::istringstream row(*(s[9]));
+ row >> detection_freq;
+ }
+ {
+ std::istringstream row(*(s[10]));
+ row >> barycentric_freq;
+ }
+ {
+ std::istringstream row(*(s[11]));
+ row >> fft_len;
+ }
+ {
+ std::istringstream row(*(s[12]));
+ row >> chirp_rate;
+ }
+ {
+ std::istringstream row(*(s[13]));
+ row >> rfi_checked;
+ }
+ {
+ std::istringstream row(*(s[14]));
+ row >> rfi_found;
+ }
+ {
+ std::istringstream row(*(s[15]));
+ row >> reserved;
+ }
+}
+
+void spike::parse(const std::string &s) {
+ SQL_ROW row(&s,16);
+ parse(row);
+}
+
+template <> const char *const db_table<spike_small>::table_name="spike_small";
+template <> const char *db_table<spike_small>::_search_tag=table_name;
template <> const int db_table<spike_small>::_nfields=16;
-template <> const char * const db_table<spike_small>::column_names[16]={"id","result_id","peak_power","mean_power","time","ra","decl","q_pix","freq","detection_freq","barycentric_freq","fft_len","chirp_rate","rfi_checked","rfi_found","reserved"};
-
-spike_small::spike_small() :
- db_table<spike_small>(*this,-1),
- id(0),
- result_id(),
- peak_power(0),
- mean_power(0),
- time(0),
- ra(0),
- decl(0),
- q_pix(0),
- freq(0),
- detection_freq(0),
- barycentric_freq(0),
- fft_len(0),
- chirp_rate(0),
- rfi_checked(0),
- rfi_found(0),
- reserved(0)
-{
- db_open();
-}
-
-
-spike_small::spike_small(const spike_small &a) :
- db_table<spike_small>(*this,-1),
- id(a.id),
- result_id(a.result_id),
- peak_power(a.peak_power),
- mean_power(a.mean_power),
- time(a.time),
- ra(a.ra),
- decl(a.decl),
- q_pix(a.q_pix),
- freq(a.freq),
- detection_freq(a.detection_freq),
- barycentric_freq(a.barycentric_freq),
- fft_len(a.fft_len),
- chirp_rate(a.chirp_rate),
- rfi_checked(a.rfi_checked),
- rfi_found(a.rfi_found),
- reserved(a.reserved)
-{
- db_open();
-}
-
-
-spike_small::spike_small(const SQL_ROW &a) :
- db_table<spike_small>(*this,-1)
-{
- db_open();
- parse(a);
-}
-
-
-spike_small::spike_small(const std::string &s,const char *tag) :
- db_table<spike_small>(*this,-1)
-{
- db_open();
- if (xml_match_tag(s,tag)) {
- parse_xml(s,tag);
- } else {
- parse(s);
- }
+template <> const char *const db_table<spike_small>::column_names[16]= {"id","result_id","peak_power","mean_power","time","ra","decl","q_pix","freq","detection_freq","barycentric_freq","fft_len","chirp_rate","rfi_checked","rfi_found","reserved"};
+
+spike_small::spike_small() :
+ db_table<spike_small>(*this,-1),
+ id(0),
+ result_id(),
+ peak_power(0),
+ mean_power(0),
+ time(0),
+ ra(0),
+ decl(0),
+ q_pix(0),
+ freq(0),
+ detection_freq(0),
+ barycentric_freq(0),
+ fft_len(0),
+ chirp_rate(0),
+ rfi_checked(0),
+ rfi_found(0),
+ reserved(0) {
+ db_open();
+}
+
+
+spike_small::spike_small(const spike_small &a) :
+ db_table<spike_small>(*this,-1),
+ id(a.id),
+ result_id(a.result_id),
+ peak_power(a.peak_power),
+ mean_power(a.mean_power),
+ time(a.time),
+ ra(a.ra),
+ decl(a.decl),
+ q_pix(a.q_pix),
+ freq(a.freq),
+ detection_freq(a.detection_freq),
+ barycentric_freq(a.barycentric_freq),
+ fft_len(a.fft_len),
+ chirp_rate(a.chirp_rate),
+ rfi_checked(a.rfi_checked),
+ rfi_found(a.rfi_found),
+ reserved(a.reserved) {
+ db_open();
+}
+
+
+spike_small::spike_small(const SQL_ROW &a) :
+ db_table<spike_small>(*this,-1) {
+ db_open();
+ parse(a);
+}
+
+
+spike_small::spike_small(const std::string &s,const char *tag) :
+ db_table<spike_small>(*this,-1) {
+ db_open();
+ if (xml_match_tag(s,tag)) {
+ parse_xml(s,tag);
+ } else {
+ parse(s);
+ }
}
spike_small &spike_small::operator =(const spike_small &a) {
- if (&a != this) {
- id=a.id;
- result_id=a.result_id;
- peak_power=a.peak_power;
- mean_power=a.mean_power;
- time=a.time;
- ra=a.ra;
- decl=a.decl;
- q_pix=a.q_pix;
- freq=a.freq;
- detection_freq=a.detection_freq;
- barycentric_freq=a.barycentric_freq;
- fft_len=a.fft_len;
- chirp_rate=a.chirp_rate;
- rfi_checked=a.rfi_checked;
- rfi_found=a.rfi_found;
- reserved=a.reserved;
- }
- return (*this);
-}
-
-
-std::string spike_small::update_format() const
-{ std::ostringstream rv("");
-
- for (int i=2;i<16;i++) rv << "?,";
- rv << "?";
- return rv.str();
-}
-
-
-std::string spike_small::insert_format() const
-{ return std::string("?,")+update_format();
-}
-
-std::string spike_small::select_format() const
-{
-std::string rv("");
-for (int i=0; i<15;i++) rv+="?,";
-rv+="?";
-return rv;
-}
-
-std::string spike_small::print(int full_subtables, int show_ids, int no_refs) const
-{ std::ostringstream rv("");
-
- rv.precision(14);
- if (show_ids) rv << id;
- rv << ',';
- if (!no_refs) {
- if (full_subtables) {
- rv << result_id.print(full_subtables,show_ids,no_refs);
- } else {
- rv << result_id.id;
- }
- }
- rv << ',';
- rv << peak_power;
- rv << ',';
- rv << mean_power;
- rv << ',';
- rv << time;
- rv << ',';
- rv << ra;
- rv << ',';
- rv << decl;
- rv << ',';
- rv << q_pix;
- rv << ',';
- rv << freq;
- rv << ',';
- rv << detection_freq;
- rv << ',';
- rv << barycentric_freq;
- rv << ',';
- rv << fft_len;
- rv << ',';
- rv << chirp_rate;
- rv << ',';
- rv << rfi_checked;
- rv << ',';
- rv << rfi_found;
- rv << ',';
- rv << reserved;
- return rv.str();
-}
-
-
-std::string spike_small::print_xml(int full_subtables, int show_ids, int no_refs,const char *tag) const
-{
- std::ostringstream rv("");
-
- rv.precision(14);
- rv << xml_indent() << '<' << tag << ">\n";
- xml_indent(2);
- if (show_ids) rv << xml_indent() << "<id>" << id << "</id>\n";
- if (!no_refs) {
- if (full_subtables) {
- rv << result_id.print_xml(full_subtables,show_ids,no_refs,"result_id");
- } else {
- rv << xml_indent() << "<result_id><id>" << result_id.id << "</id></result_id>\n";
- }
- }
- rv << xml_indent() << "<peak_power>" << peak_power << "</peak_power>\n";
- rv << xml_indent() << "<mean_power>" << mean_power << "</mean_power>\n";
- rv << xml_indent() << "<time>" << time << "</time>\n";
- rv << xml_indent() << "<ra>" << ra << "</ra>\n";
- rv << xml_indent() << "<decl>" << decl << "</decl>\n";
- rv << xml_indent() << "<q_pix>" << q_pix << "</q_pix>\n";
- rv << xml_indent() << "<freq>" << freq << "</freq>\n";
- rv << xml_indent() << "<detection_freq>" << detection_freq << "</detection_freq>\n";
- rv << xml_indent() << "<barycentric_freq>" << barycentric_freq << "</barycentric_freq>\n";
- rv << xml_indent() << "<fft_len>" << fft_len << "</fft_len>\n";
- rv << xml_indent() << "<chirp_rate>" << chirp_rate << "</chirp_rate>\n";
- rv << xml_indent() << "<rfi_checked>" << rfi_checked << "</rfi_checked>\n";
- rv << xml_indent() << "<rfi_found>" << rfi_found << "</rfi_found>\n";
- rv << xml_indent() << "<reserved>" << reserved << "</reserved>\n";
- xml_indent(-2);
- rv << xml_indent() << "</" << tag << ">\n";
- return rv.str();
-}
-
-
- void spike_small::parse_xml(const std::string &s,const char *tag) {
- std::string field,sub;
- if (extract_xml_record(s,tag,field)) {
- std::string::size_type pos=0;
- if (extract_xml_record(field,"id",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> id;
- }
- if (extract_xml_record(field,"result_id",sub)) {
- result_id.parse_xml(sub,"result_id");
- }
- if (extract_xml_record(field,"peak_power",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> peak_power;
- }
- if (extract_xml_record(field,"mean_power",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> mean_power;
- }
- if (extract_xml_record(field,"time",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> time;
- }
- if (extract_xml_record(field,"ra",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> ra;
- }
- if (extract_xml_record(field,"decl",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> decl;
- }
- if (extract_xml_record(field,"q_pix",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> q_pix;
- }
- if (extract_xml_record(field,"freq",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> freq;
- }
- if (extract_xml_record(field,"detection_freq",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> detection_freq;
- }
- if (extract_xml_record(field,"barycentric_freq",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> barycentric_freq;
- }
- if (extract_xml_record(field,"fft_len",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> fft_len;
- }
- if (extract_xml_record(field,"chirp_rate",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> chirp_rate;
- }
- if (extract_xml_record(field,"rfi_checked",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> rfi_checked;
- }
- if (extract_xml_record(field,"rfi_found",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> rfi_found;
- }
- if (extract_xml_record(field,"reserved",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> reserved;
- }
- }
- }
-
- void spike_small::parse(const SQL_ROW &s) {
- {
- std::istringstream row(*(s[0]));
- row >> id;
- }
- {
- result_id.parse(SQL_ROW(s[1],0));
- }
- {
- std::istringstream row(*(s[2]));
- row >> peak_power;
- }
- {
- std::istringstream row(*(s[3]));
- row >> mean_power;
- }
- {
- std::istringstream row(*(s[4]));
- row >> time;
- }
- {
- std::istringstream row(*(s[5]));
- row >> ra;
- }
- {
- std::istringstream row(*(s[6]));
- row >> decl;
- }
- {
- std::istringstream row(*(s[7]));
- row >> q_pix;
- }
- {
- std::istringstream row(*(s[8]));
- row >> freq;
- }
- {
- std::istringstream row(*(s[9]));
- row >> detection_freq;
- }
- {
- std::istringstream row(*(s[10]));
- row >> barycentric_freq;
- }
- {
- std::istringstream row(*(s[11]));
- row >> fft_len;
- }
- {
- std::istringstream row(*(s[12]));
- row >> chirp_rate;
- }
- {
- std::istringstream row(*(s[13]));
- row >> rfi_checked;
- }
- {
- std::istringstream row(*(s[14]));
- row >> rfi_found;
- }
- {
- std::istringstream row(*(s[15]));
- row >> reserved;
- }
- }
-
- void spike_small::parse(const std::string &s) {
- SQL_ROW row(&s,16);
- parse(row);
- }
-
-template <> const char * const db_table<autocorr>::table_name="autocorr";
-template <> const char * db_table<autocorr>::_search_tag=table_name;
+ if (&a != this) {
+ id=a.id;
+ result_id=a.result_id;
+ peak_power=a.peak_power;
+ mean_power=a.mean_power;
+ time=a.time;
+ ra=a.ra;
+ decl=a.decl;
+ q_pix=a.q_pix;
+ freq=a.freq;
+ detection_freq=a.detection_freq;
+ barycentric_freq=a.barycentric_freq;
+ fft_len=a.fft_len;
+ chirp_rate=a.chirp_rate;
+ rfi_checked=a.rfi_checked;
+ rfi_found=a.rfi_found;
+ reserved=a.reserved;
+ }
+ return (*this);
+}
+
+
+std::string spike_small::update_format() const {
+ std::ostringstream rv("");
+
+ for (int i=2; i<16; i++) {
+ rv << "?,";
+ }
+ rv << "?";
+ return rv.str();
+}
+
+
+std::string spike_small::insert_format() const {
+ return std::string("?,")+update_format();
+}
+
+std::string spike_small::select_format() const {
+ std::string rv("");
+ for (int i=0; i<15; i++) {
+ rv+="?,";
+ }
+ rv+="?";
+ return rv;
+}
+
+std::string spike_small::print(int full_subtables, int show_ids, int no_refs) const {
+ std::ostringstream rv("");
+
+ rv.precision(14);
+ if (show_ids) {
+ rv << id;
+ }
+ rv << ',';
+ if (!no_refs) {
+ if (full_subtables) {
+ rv << result_id.print(full_subtables,show_ids,no_refs);
+ } else {
+ rv << result_id.id;
+ }
+ }
+ rv << ',';
+ rv << peak_power;
+ rv << ',';
+ rv << mean_power;
+ rv << ',';
+ rv << time;
+ rv << ',';
+ rv << ra;
+ rv << ',';
+ rv << decl;
+ rv << ',';
+ rv << q_pix;
+ rv << ',';
+ rv << freq;
+ rv << ',';
+ rv << detection_freq;
+ rv << ',';
+ rv << barycentric_freq;
+ rv << ',';
+ rv << fft_len;
+ rv << ',';
+ rv << chirp_rate;
+ rv << ',';
+ rv << rfi_checked;
+ rv << ',';
+ rv << rfi_found;
+ rv << ',';
+ rv << reserved;
+ return rv.str();
+}
+
+
+std::string spike_small::print_xml(int full_subtables, int show_ids, int no_refs,const char *tag) const {
+ std::ostringstream rv("");
+
+ rv.precision(14);
+ rv << xml_indent() << '<' << tag << ">\n";
+ xml_indent(2);
+ if (show_ids) {
+ rv << xml_indent() << "<id>" << id << "</id>\n";
+ }
+ if (!no_refs) {
+ if (full_subtables) {
+ rv << result_id.print_xml(full_subtables,show_ids,no_refs,"result_id");
+ } else {
+ rv << xml_indent() << "<result_id><id>" << result_id.id << "</id></result_id>\n";
+ }
+ }
+ rv << xml_indent() << "<peak_power>" << peak_power << "</peak_power>\n";
+ rv << xml_indent() << "<mean_power>" << mean_power << "</mean_power>\n";
+ rv << xml_indent() << "<time>" << time << "</time>\n";
+ rv << xml_indent() << "<ra>" << ra << "</ra>\n";
+ rv << xml_indent() << "<decl>" << decl << "</decl>\n";
+ rv << xml_indent() << "<q_pix>" << q_pix << "</q_pix>\n";
+ rv << xml_indent() << "<freq>" << freq << "</freq>\n";
+ rv << xml_indent() << "<detection_freq>" << detection_freq << "</detection_freq>\n";
+ rv << xml_indent() << "<barycentric_freq>" << barycentric_freq << "</barycentric_freq>\n";
+ rv << xml_indent() << "<fft_len>" << fft_len << "</fft_len>\n";
+ rv << xml_indent() << "<chirp_rate>" << chirp_rate << "</chirp_rate>\n";
+ rv << xml_indent() << "<rfi_checked>" << rfi_checked << "</rfi_checked>\n";
+ rv << xml_indent() << "<rfi_found>" << rfi_found << "</rfi_found>\n";
+ rv << xml_indent() << "<reserved>" << reserved << "</reserved>\n";
+ xml_indent(-2);
+ rv << xml_indent() << "</" << tag << ">\n";
+ return rv.str();
+}
+
+
+void spike_small::parse_xml(const std::string &s,const char *tag) {
+ std::string field,sub;
+ if (extract_xml_record(s,tag,field)) {
+ std::string::size_type pos=0;
+ if (extract_xml_record(field,"id",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> id;
+ }
+ if (extract_xml_record(field,"result_id",sub)) {
+ result_id.parse_xml(sub,"result_id");
+ }
+ if (extract_xml_record(field,"peak_power",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> peak_power;
+ }
+ if (extract_xml_record(field,"mean_power",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> mean_power;
+ }
+ if (extract_xml_record(field,"time",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> time;
+ }
+ if (extract_xml_record(field,"ra",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> ra;
+ }
+ if (extract_xml_record(field,"decl",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> decl;
+ }
+ if (extract_xml_record(field,"q_pix",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> q_pix;
+ }
+ if (extract_xml_record(field,"freq",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> freq;
+ }
+ if (extract_xml_record(field,"detection_freq",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> detection_freq;
+ }
+ if (extract_xml_record(field,"barycentric_freq",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> barycentric_freq;
+ }
+ if (extract_xml_record(field,"fft_len",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> fft_len;
+ }
+ if (extract_xml_record(field,"chirp_rate",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> chirp_rate;
+ }
+ if (extract_xml_record(field,"rfi_checked",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> rfi_checked;
+ }
+ if (extract_xml_record(field,"rfi_found",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> rfi_found;
+ }
+ if (extract_xml_record(field,"reserved",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> reserved;
+ }
+ }
+}
+
+void spike_small::parse(const SQL_ROW &s) {
+ {
+ std::istringstream row(*(s[0]));
+ row >> id;
+ }
+ {
+ result_id.parse(SQL_ROW(s[1],0));
+ }
+ {
+ std::istringstream row(*(s[2]));
+ row >> peak_power;
+ }
+ {
+ std::istringstream row(*(s[3]));
+ row >> mean_power;
+ }
+ {
+ std::istringstream row(*(s[4]));
+ row >> time;
+ }
+ {
+ std::istringstream row(*(s[5]));
+ row >> ra;
+ }
+ {
+ std::istringstream row(*(s[6]));
+ row >> decl;
+ }
+ {
+ std::istringstream row(*(s[7]));
+ row >> q_pix;
+ }
+ {
+ std::istringstream row(*(s[8]));
+ row >> freq;
+ }
+ {
+ std::istringstream row(*(s[9]));
+ row >> detection_freq;
+ }
+ {
+ std::istringstream row(*(s[10]));
+ row >> barycentric_freq;
+ }
+ {
+ std::istringstream row(*(s[11]));
+ row >> fft_len;
+ }
+ {
+ std::istringstream row(*(s[12]));
+ row >> chirp_rate;
+ }
+ {
+ std::istringstream row(*(s[13]));
+ row >> rfi_checked;
+ }
+ {
+ std::istringstream row(*(s[14]));
+ row >> rfi_found;
+ }
+ {
+ std::istringstream row(*(s[15]));
+ row >> reserved;
+ }
+}
+
+void spike_small::parse(const std::string &s) {
+ SQL_ROW row(&s,16);
+ parse(row);
+}
+
+template <> const char *const db_table<autocorr>::table_name="autocorr";
+template <> const char *db_table<autocorr>::_search_tag=table_name;
template <> const int db_table<autocorr>::_nfields=17;
-template <> const char * const db_table<autocorr>::column_names[17]={"id","result_id","peak_power","mean_power","time","ra","decl","q_pix","delay","freq","detection_freq","barycentric_freq","fft_len","chirp_rate","rfi_checked","rfi_found","reserved"};
-
-autocorr::autocorr() :
- db_table<autocorr>(*this,-1),
- id(0),
- result_id(),
- peak_power(0),
- mean_power(0),
- time(0),
- ra(0),
- decl(0),
- q_pix(0),
- delay(0),
- freq(0),
- detection_freq(0),
- barycentric_freq(0),
- fft_len(0),
- chirp_rate(0),
- rfi_checked(0),
- rfi_found(0),
- reserved(0)
-{
- db_open();
-}
-
-
-autocorr::autocorr(const autocorr &a) :
- db_table<autocorr>(*this,-1),
- id(a.id),
- result_id(a.result_id),
- peak_power(a.peak_power),
- mean_power(a.mean_power),
- time(a.time),
- ra(a.ra),
- decl(a.decl),
- q_pix(a.q_pix),
- delay(a.delay),
- freq(a.freq),
- detection_freq(a.detection_freq),
- barycentric_freq(a.barycentric_freq),
- fft_len(a.fft_len),
- chirp_rate(a.chirp_rate),
- rfi_checked(a.rfi_checked),
- rfi_found(a.rfi_found),
- reserved(a.reserved)
-{
- db_open();
-}
-
-
-autocorr::autocorr(const SQL_ROW &a) :
- db_table<autocorr>(*this,-1)
-{
- db_open();
- parse(a);
-}
-
-
-autocorr::autocorr(const std::string &s,const char *tag) :
- db_table<autocorr>(*this,-1)
-{
- db_open();
- if (xml_match_tag(s,tag)) {
- parse_xml(s,tag);
- } else {
- parse(s);
- }
+template <> const char *const db_table<autocorr>::column_names[17]= {"id","result_id","peak_power","mean_power","time","ra","decl","q_pix","delay","freq","detection_freq","barycentric_freq","fft_len","chirp_rate","rfi_checked","rfi_found","reserved"};
+
+autocorr::autocorr() :
+ db_table<autocorr>(*this,-1),
+ id(0),
+ result_id(),
+ peak_power(0),
+ mean_power(0),
+ time(0),
+ ra(0),
+ decl(0),
+ q_pix(0),
+ delay(0),
+ freq(0),
+ detection_freq(0),
+ barycentric_freq(0),
+ fft_len(0),
+ chirp_rate(0),
+ rfi_checked(0),
+ rfi_found(0),
+ reserved(0) {
+ db_open();
+}
+
+
+autocorr::autocorr(const autocorr &a) :
+ db_table<autocorr>(*this,-1),
+ id(a.id),
+ result_id(a.result_id),
+ peak_power(a.peak_power),
+ mean_power(a.mean_power),
+ time(a.time),
+ ra(a.ra),
+ decl(a.decl),
+ q_pix(a.q_pix),
+ delay(a.delay),
+ freq(a.freq),
+ detection_freq(a.detection_freq),
+ barycentric_freq(a.barycentric_freq),
+ fft_len(a.fft_len),
+ chirp_rate(a.chirp_rate),
+ rfi_checked(a.rfi_checked),
+ rfi_found(a.rfi_found),
+ reserved(a.reserved) {
+ db_open();
+}
+
+
+autocorr::autocorr(const SQL_ROW &a) :
+ db_table<autocorr>(*this,-1) {
+ db_open();
+ parse(a);
+}
+
+
+autocorr::autocorr(const std::string &s,const char *tag) :
+ db_table<autocorr>(*this,-1) {
+ db_open();
+ if (xml_match_tag(s,tag)) {
+ parse_xml(s,tag);
+ } else {
+ parse(s);
+ }
}
autocorr &autocorr::operator =(const autocorr &a) {
- if (&a != this) {
- id=a.id;
- result_id=a.result_id;
- peak_power=a.peak_power;
- mean_power=a.mean_power;
- time=a.time;
- ra=a.ra;
- decl=a.decl;
- q_pix=a.q_pix;
- delay=a.delay;
- freq=a.freq;
- detection_freq=a.detection_freq;
- barycentric_freq=a.barycentric_freq;
- fft_len=a.fft_len;
- chirp_rate=a.chirp_rate;
- rfi_checked=a.rfi_checked;
- rfi_found=a.rfi_found;
- reserved=a.reserved;
- }
- return (*this);
-}
-
-
-std::string autocorr::update_format() const
-{ std::ostringstream rv("");
-
- for (int i=2;i<17;i++) rv << "?,";
- rv << "?";
- return rv.str();
-}
-
-
-std::string autocorr::insert_format() const
-{ return std::string("?,")+update_format();
-}
-
-std::string autocorr::select_format() const
-{
-std::string rv("");
-for (int i=0; i<16;i++) rv+="?,";
-rv+="?";
-return rv;
-}
-
-std::string autocorr::print(int full_subtables, int show_ids, int no_refs) const
-{ std::ostringstream rv("");
-
- rv.precision(14);
- if (show_ids) rv << id;
- rv << ',';
- if (!no_refs) {
- if (full_subtables) {
- rv << result_id.print(full_subtables,show_ids,no_refs);
- } else {
- rv << result_id.id;
- }
- }
- rv << ',';
- rv << peak_power;
- rv << ',';
- rv << mean_power;
- rv << ',';
- rv << time;
- rv << ',';
- rv << ra;
- rv << ',';
- rv << decl;
- rv << ',';
- rv << q_pix;
- rv << ',';
- rv << delay;
- rv << ',';
- rv << freq;
- rv << ',';
- rv << detection_freq;
- rv << ',';
- rv << barycentric_freq;
- rv << ',';
- rv << fft_len;
- rv << ',';
- rv << chirp_rate;
- rv << ',';
- rv << rfi_checked;
- rv << ',';
- rv << rfi_found;
- rv << ',';
- rv << reserved;
- return rv.str();
-}
-
-
-std::string autocorr::print_xml(int full_subtables, int show_ids, int no_refs,const char *tag) const
-{
- std::ostringstream rv("");
-
- rv.precision(14);
- rv << xml_indent() << '<' << tag << ">\n";
- xml_indent(2);
- if (show_ids) rv << xml_indent() << "<id>" << id << "</id>\n";
- if (!no_refs) {
- if (full_subtables) {
- rv << result_id.print_xml(full_subtables,show_ids,no_refs,"result_id");
- } else {
- rv << xml_indent() << "<result_id><id>" << result_id.id << "</id></result_id>\n";
- }
- }
- rv << xml_indent() << "<peak_power>" << peak_power << "</peak_power>\n";
- rv << xml_indent() << "<mean_power>" << mean_power << "</mean_power>\n";
- rv << xml_indent() << "<time>" << time << "</time>\n";
- rv << xml_indent() << "<ra>" << ra << "</ra>\n";
- rv << xml_indent() << "<decl>" << decl << "</decl>\n";
- rv << xml_indent() << "<q_pix>" << q_pix << "</q_pix>\n";
- rv << xml_indent() << "<delay>" << delay << "</delay>\n";
- rv << xml_indent() << "<freq>" << freq << "</freq>\n";
- rv << xml_indent() << "<detection_freq>" << detection_freq << "</detection_freq>\n";
- rv << xml_indent() << "<barycentric_freq>" << barycentric_freq << "</barycentric_freq>\n";
- rv << xml_indent() << "<fft_len>" << fft_len << "</fft_len>\n";
- rv << xml_indent() << "<chirp_rate>" << chirp_rate << "</chirp_rate>\n";
- rv << xml_indent() << "<rfi_checked>" << rfi_checked << "</rfi_checked>\n";
- rv << xml_indent() << "<rfi_found>" << rfi_found << "</rfi_found>\n";
- rv << xml_indent() << "<reserved>" << reserved << "</reserved>\n";
- xml_indent(-2);
- rv << xml_indent() << "</" << tag << ">\n";
- return rv.str();
-}
-
-
- void autocorr::parse_xml(const std::string &s,const char *tag) {
- std::string field,sub;
- if (extract_xml_record(s,tag,field)) {
- std::string::size_type pos=0;
- if (extract_xml_record(field,"id",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> id;
- }
- if (extract_xml_record(field,"result_id",sub)) {
- result_id.parse_xml(sub,"result_id");
- }
- if (extract_xml_record(field,"peak_power",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> peak_power;
- }
- if (extract_xml_record(field,"mean_power",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> mean_power;
- }
- if (extract_xml_record(field,"time",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> time;
- }
- if (extract_xml_record(field,"ra",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> ra;
- }
- if (extract_xml_record(field,"decl",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> decl;
- }
- if (extract_xml_record(field,"q_pix",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> q_pix;
- }
- if (extract_xml_record(field,"delay",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> delay;
- }
- if (extract_xml_record(field,"freq",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> freq;
- }
- if (extract_xml_record(field,"detection_freq",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> detection_freq;
- }
- if (extract_xml_record(field,"barycentric_freq",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> barycentric_freq;
- }
- if (extract_xml_record(field,"fft_len",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> fft_len;
- }
- if (extract_xml_record(field,"chirp_rate",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> chirp_rate;
- }
- if (extract_xml_record(field,"rfi_checked",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> rfi_checked;
- }
- if (extract_xml_record(field,"rfi_found",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> rfi_found;
- }
- if (extract_xml_record(field,"reserved",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> reserved;
- }
- }
- }
-
- void autocorr::parse(const SQL_ROW &s) {
- {
- std::istringstream row(*(s[0]));
- row >> id;
- }
- {
- result_id.parse(SQL_ROW(s[1],0));
- }
- {
- std::istringstream row(*(s[2]));
- row >> peak_power;
- }
- {
- std::istringstream row(*(s[3]));
- row >> mean_power;
- }
- {
- std::istringstream row(*(s[4]));
- row >> time;
- }
- {
- std::istringstream row(*(s[5]));
- row >> ra;
- }
- {
- std::istringstream row(*(s[6]));
- row >> decl;
- }
- {
- std::istringstream row(*(s[7]));
- row >> q_pix;
- }
- {
- std::istringstream row(*(s[8]));
- row >> delay;
- }
- {
- std::istringstream row(*(s[9]));
- row >> freq;
- }
- {
- std::istringstream row(*(s[10]));
- row >> detection_freq;
- }
- {
- std::istringstream row(*(s[11]));
- row >> barycentric_freq;
- }
- {
- std::istringstream row(*(s[12]));
- row >> fft_len;
- }
- {
- std::istringstream row(*(s[13]));
- row >> chirp_rate;
- }
- {
- std::istringstream row(*(s[14]));
- row >> rfi_checked;
- }
- {
- std::istringstream row(*(s[15]));
- row >> rfi_found;
- }
- {
- std::istringstream row(*(s[16]));
- row >> reserved;
- }
- }
-
- void autocorr::parse(const std::string &s) {
- SQL_ROW row(&s,17);
- parse(row);
- }
-
-template <> const char * const db_table<autocorr_small>::table_name="autocorr_small";
-template <> const char * db_table<autocorr_small>::_search_tag=table_name;
+ if (&a != this) {
+ id=a.id;
+ result_id=a.result_id;
+ peak_power=a.peak_power;
+ mean_power=a.mean_power;
+ time=a.time;
+ ra=a.ra;
+ decl=a.decl;
+ q_pix=a.q_pix;
+ delay=a.delay;
+ freq=a.freq;
+ detection_freq=a.detection_freq;
+ barycentric_freq=a.barycentric_freq;
+ fft_len=a.fft_len;
+ chirp_rate=a.chirp_rate;
+ rfi_checked=a.rfi_checked;
+ rfi_found=a.rfi_found;
+ reserved=a.reserved;
+ }
+ return (*this);
+}
+
+
+std::string autocorr::update_format() const {
+ std::ostringstream rv("");
+
+ for (int i=2; i<17; i++) {
+ rv << "?,";
+ }
+ rv << "?";
+ return rv.str();
+}
+
+
+std::string autocorr::insert_format() const {
+ return std::string("?,")+update_format();
+}
+
+std::string autocorr::select_format() const {
+ std::string rv("");
+ for (int i=0; i<16; i++) {
+ rv+="?,";
+ }
+ rv+="?";
+ return rv;
+}
+
+std::string autocorr::print(int full_subtables, int show_ids, int no_refs) const {
+ std::ostringstream rv("");
+
+ rv.precision(14);
+ if (show_ids) {
+ rv << id;
+ }
+ rv << ',';
+ if (!no_refs) {
+ if (full_subtables) {
+ rv << result_id.print(full_subtables,show_ids,no_refs);
+ } else {
+ rv << result_id.id;
+ }
+ }
+ rv << ',';
+ rv << peak_power;
+ rv << ',';
+ rv << mean_power;
+ rv << ',';
+ rv << time;
+ rv << ',';
+ rv << ra;
+ rv << ',';
+ rv << decl;
+ rv << ',';
+ rv << q_pix;
+ rv << ',';
+ rv << delay;
+ rv << ',';
+ rv << freq;
+ rv << ',';
+ rv << detection_freq;
+ rv << ',';
+ rv << barycentric_freq;
+ rv << ',';
+ rv << fft_len;
+ rv << ',';
+ rv << chirp_rate;
+ rv << ',';
+ rv << rfi_checked;
+ rv << ',';
+ rv << rfi_found;
+ rv << ',';
+ rv << reserved;
+ return rv.str();
+}
+
+
+std::string autocorr::print_xml(int full_subtables, int show_ids, int no_refs,const char *tag) const {
+ std::ostringstream rv("");
+
+ rv.precision(14);
+ rv << xml_indent() << '<' << tag << ">\n";
+ xml_indent(2);
+ if (show_ids) {
+ rv << xml_indent() << "<id>" << id << "</id>\n";
+ }
+ if (!no_refs) {
+ if (full_subtables) {
+ rv << result_id.print_xml(full_subtables,show_ids,no_refs,"result_id");
+ } else {
+ rv << xml_indent() << "<result_id><id>" << result_id.id << "</id></result_id>\n";
+ }
+ }
+ rv << xml_indent() << "<peak_power>" << peak_power << "</peak_power>\n";
+ rv << xml_indent() << "<mean_power>" << mean_power << "</mean_power>\n";
+ rv << xml_indent() << "<time>" << time << "</time>\n";
+ rv << xml_indent() << "<ra>" << ra << "</ra>\n";
+ rv << xml_indent() << "<decl>" << decl << "</decl>\n";
+ rv << xml_indent() << "<q_pix>" << q_pix << "</q_pix>\n";
+ rv << xml_indent() << "<delay>" << delay << "</delay>\n";
+ rv << xml_indent() << "<freq>" << freq << "</freq>\n";
+ rv << xml_indent() << "<detection_freq>" << detection_freq << "</detection_freq>\n";
+ rv << xml_indent() << "<barycentric_freq>" << barycentric_freq << "</barycentric_freq>\n";
+ rv << xml_indent() << "<fft_len>" << fft_len << "</fft_len>\n";
+ rv << xml_indent() << "<chirp_rate>" << chirp_rate << "</chirp_rate>\n";
+ rv << xml_indent() << "<rfi_checked>" << rfi_checked << "</rfi_checked>\n";
+ rv << xml_indent() << "<rfi_found>" << rfi_found << "</rfi_found>\n";
+ rv << xml_indent() << "<reserved>" << reserved << "</reserved>\n";
+ xml_indent(-2);
+ rv << xml_indent() << "</" << tag << ">\n";
+ return rv.str();
+}
+
+
+void autocorr::parse_xml(const std::string &s,const char *tag) {
+ std::string field,sub;
+ if (extract_xml_record(s,tag,field)) {
+ std::string::size_type pos=0;
+ if (extract_xml_record(field,"id",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> id;
+ }
+ if (extract_xml_record(field,"result_id",sub)) {
+ result_id.parse_xml(sub,"result_id");
+ }
+ if (extract_xml_record(field,"peak_power",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> peak_power;
+ }
+ if (extract_xml_record(field,"mean_power",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> mean_power;
+ }
+ if (extract_xml_record(field,"time",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> time;
+ }
+ if (extract_xml_record(field,"ra",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> ra;
+ }
+ if (extract_xml_record(field,"decl",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> decl;
+ }
+ if (extract_xml_record(field,"q_pix",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> q_pix;
+ }
+ if (extract_xml_record(field,"delay",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> delay;
+ }
+ if (extract_xml_record(field,"freq",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> freq;
+ }
+ if (extract_xml_record(field,"detection_freq",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> detection_freq;
+ }
+ if (extract_xml_record(field,"barycentric_freq",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> barycentric_freq;
+ }
+ if (extract_xml_record(field,"fft_len",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> fft_len;
+ }
+ if (extract_xml_record(field,"chirp_rate",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> chirp_rate;
+ }
+ if (extract_xml_record(field,"rfi_checked",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> rfi_checked;
+ }
+ if (extract_xml_record(field,"rfi_found",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> rfi_found;
+ }
+ if (extract_xml_record(field,"reserved",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> reserved;
+ }
+ }
+}
+
+void autocorr::parse(const SQL_ROW &s) {
+ {
+ std::istringstream row(*(s[0]));
+ row >> id;
+ }
+ {
+ result_id.parse(SQL_ROW(s[1],0));
+ }
+ {
+ std::istringstream row(*(s[2]));
+ row >> peak_power;
+ }
+ {
+ std::istringstream row(*(s[3]));
+ row >> mean_power;
+ }
+ {
+ std::istringstream row(*(s[4]));
+ row >> time;
+ }
+ {
+ std::istringstream row(*(s[5]));
+ row >> ra;
+ }
+ {
+ std::istringstream row(*(s[6]));
+ row >> decl;
+ }
+ {
+ std::istringstream row(*(s[7]));
+ row >> q_pix;
+ }
+ {
+ std::istringstream row(*(s[8]));
+ row >> delay;
+ }
+ {
+ std::istringstream row(*(s[9]));
+ row >> freq;
+ }
+ {
+ std::istringstream row(*(s[10]));
+ row >> detection_freq;
+ }
+ {
+ std::istringstream row(*(s[11]));
+ row >> barycentric_freq;
+ }
+ {
+ std::istringstream row(*(s[12]));
+ row >> fft_len;
+ }
+ {
+ std::istringstream row(*(s[13]));
+ row >> chirp_rate;
+ }
+ {
+ std::istringstream row(*(s[14]));
+ row >> rfi_checked;
+ }
+ {
+ std::istringstream row(*(s[15]));
+ row >> rfi_found;
+ }
+ {
+ std::istringstream row(*(s[16]));
+ row >> reserved;
+ }
+}
+
+void autocorr::parse(const std::string &s) {
+ SQL_ROW row(&s,17);
+ parse(row);
+}
+
+template <> const char *const db_table<autocorr_small>::table_name="autocorr_small";
+template <> const char *db_table<autocorr_small>::_search_tag=table_name;
template <> const int db_table<autocorr_small>::_nfields=17;
-template <> const char * const db_table<autocorr_small>::column_names[17]={"id","result_id","peak_power","mean_power","time","ra","decl","q_pix","delay","freq","detection_freq","barycentric_freq","fft_len","chirp_rate","rfi_checked","rfi_found","reserved"};
-
-autocorr_small::autocorr_small() :
- db_table<autocorr_small>(*this,-1),
- id(0),
- result_id(),
- peak_power(0),
- mean_power(0),
- time(0),
- ra(0),
- decl(0),
- q_pix(0),
- delay(0),
- freq(0),
- detection_freq(0),
- barycentric_freq(0),
- fft_len(0),
- chirp_rate(0),
- rfi_checked(0),
- rfi_found(0),
- reserved(0)
-{
- db_open();
-}
-
-
-autocorr_small::autocorr_small(const autocorr_small &a) :
- db_table<autocorr_small>(*this,-1),
- id(a.id),
- result_id(a.result_id),
- peak_power(a.peak_power),
- mean_power(a.mean_power),
- time(a.time),
- ra(a.ra),
- decl(a.decl),
- q_pix(a.q_pix),
- delay(a.delay),
- freq(a.freq),
- detection_freq(a.detection_freq),
- barycentric_freq(a.barycentric_freq),
- fft_len(a.fft_len),
- chirp_rate(a.chirp_rate),
- rfi_checked(a.rfi_checked),
- rfi_found(a.rfi_found),
- reserved(a.reserved)
-{
- db_open();
-}
-
-
-autocorr_small::autocorr_small(const SQL_ROW &a) :
- db_table<autocorr_small>(*this,-1)
-{
- db_open();
- parse(a);
-}
-
-
-autocorr_small::autocorr_small(const std::string &s,const char *tag) :
- db_table<autocorr_small>(*this,-1)
-{
- db_open();
- if (xml_match_tag(s,tag)) {
- parse_xml(s,tag);
- } else {
- parse(s);
- }
+template <> const char *const db_table<autocorr_small>::column_names[17]= {"id","result_id","peak_power","mean_power","time","ra","decl","q_pix","delay","freq","detection_freq","barycentric_freq","fft_len","chirp_rate","rfi_checked","rfi_found","reserved"};
+
+autocorr_small::autocorr_small() :
+ db_table<autocorr_small>(*this,-1),
+ id(0),
+ result_id(),
+ peak_power(0),
+ mean_power(0),
+ time(0),
+ ra(0),
+ decl(0),
+ q_pix(0),
+ delay(0),
+ freq(0),
+ detection_freq(0),
+ barycentric_freq(0),
+ fft_len(0),
+ chirp_rate(0),
+ rfi_checked(0),
+ rfi_found(0),
+ reserved(0) {
+ db_open();
+}
+
+
+autocorr_small::autocorr_small(const autocorr_small &a) :
+ db_table<autocorr_small>(*this,-1),
+ id(a.id),
+ result_id(a.result_id),
+ peak_power(a.peak_power),
+ mean_power(a.mean_power),
+ time(a.time),
+ ra(a.ra),
+ decl(a.decl),
+ q_pix(a.q_pix),
+ delay(a.delay),
+ freq(a.freq),
+ detection_freq(a.detection_freq),
+ barycentric_freq(a.barycentric_freq),
+ fft_len(a.fft_len),
+ chirp_rate(a.chirp_rate),
+ rfi_checked(a.rfi_checked),
+ rfi_found(a.rfi_found),
+ reserved(a.reserved) {
+ db_open();
+}
+
+
+autocorr_small::autocorr_small(const SQL_ROW &a) :
+ db_table<autocorr_small>(*this,-1) {
+ db_open();
+ parse(a);
+}
+
+
+autocorr_small::autocorr_small(const std::string &s,const char *tag) :
+ db_table<autocorr_small>(*this,-1) {
+ db_open();
+ if (xml_match_tag(s,tag)) {
+ parse_xml(s,tag);
+ } else {
+ parse(s);
+ }
}
autocorr_small &autocorr_small::operator =(const autocorr_small &a) {
- if (&a != this) {
- id=a.id;
- result_id=a.result_id;
- peak_power=a.peak_power;
- mean_power=a.mean_power;
- time=a.time;
- ra=a.ra;
- decl=a.decl;
- q_pix=a.q_pix;
- delay=a.delay;
- freq=a.freq;
- detection_freq=a.detection_freq;
- barycentric_freq=a.barycentric_freq;
- fft_len=a.fft_len;
- chirp_rate=a.chirp_rate;
- rfi_checked=a.rfi_checked;
- rfi_found=a.rfi_found;
- reserved=a.reserved;
- }
- return (*this);
-}
-
-
-std::string autocorr_small::update_format() const
-{ std::ostringstream rv("");
-
- for (int i=2;i<17;i++) rv << "?,";
- rv << "?";
- return rv.str();
-}
-
-
-std::string autocorr_small::insert_format() const
-{ return std::string("?,")+update_format();
-}
-
-std::string autocorr_small::select_format() const
-{
-std::string rv("");
-for (int i=0; i<16;i++) rv+="?,";
-rv+="?";
-return rv;
-}
-
-std::string autocorr_small::print(int full_subtables, int show_ids, int no_refs) const
-{ std::ostringstream rv("");
-
- rv.precision(14);
- if (show_ids) rv << id;
- rv << ',';
- if (!no_refs) {
- if (full_subtables) {
- rv << result_id.print(full_subtables,show_ids,no_refs);
- } else {
- rv << result_id.id;
- }
- }
- rv << ',';
- rv << peak_power;
- rv << ',';
- rv << mean_power;
- rv << ',';
- rv << time;
- rv << ',';
- rv << ra;
- rv << ',';
- rv << decl;
- rv << ',';
- rv << q_pix;
- rv << ',';
- rv << delay;
- rv << ',';
- rv << freq;
- rv << ',';
- rv << detection_freq;
- rv << ',';
- rv << barycentric_freq;
- rv << ',';
- rv << fft_len;
- rv << ',';
- rv << chirp_rate;
- rv << ',';
- rv << rfi_checked;
- rv << ',';
- rv << rfi_found;
- rv << ',';
- rv << reserved;
- return rv.str();
-}
-
-
-std::string autocorr_small::print_xml(int full_subtables, int show_ids, int no_refs,const char *tag) const
-{
- std::ostringstream rv("");
-
- rv.precision(14);
- rv << xml_indent() << '<' << tag << ">\n";
- xml_indent(2);
- if (show_ids) rv << xml_indent() << "<id>" << id << "</id>\n";
- if (!no_refs) {
- if (full_subtables) {
- rv << result_id.print_xml(full_subtables,show_ids,no_refs,"result_id");
- } else {
- rv << xml_indent() << "<result_id><id>" << result_id.id << "</id></result_id>\n";
- }
- }
- rv << xml_indent() << "<peak_power>" << peak_power << "</peak_power>\n";
- rv << xml_indent() << "<mean_power>" << mean_power << "</mean_power>\n";
- rv << xml_indent() << "<time>" << time << "</time>\n";
- rv << xml_indent() << "<ra>" << ra << "</ra>\n";
- rv << xml_indent() << "<decl>" << decl << "</decl>\n";
- rv << xml_indent() << "<q_pix>" << q_pix << "</q_pix>\n";
- rv << xml_indent() << "<delay>" << delay << "</delay>\n";
- rv << xml_indent() << "<freq>" << freq << "</freq>\n";
- rv << xml_indent() << "<detection_freq>" << detection_freq << "</detection_freq>\n";
- rv << xml_indent() << "<barycentric_freq>" << barycentric_freq << "</barycentric_freq>\n";
- rv << xml_indent() << "<fft_len>" << fft_len << "</fft_len>\n";
- rv << xml_indent() << "<chirp_rate>" << chirp_rate << "</chirp_rate>\n";
- rv << xml_indent() << "<rfi_checked>" << rfi_checked << "</rfi_checked>\n";
- rv << xml_indent() << "<rfi_found>" << rfi_found << "</rfi_found>\n";
- rv << xml_indent() << "<reserved>" << reserved << "</reserved>\n";
- xml_indent(-2);
- rv << xml_indent() << "</" << tag << ">\n";
- return rv.str();
-}
-
-
- void autocorr_small::parse_xml(const std::string &s,const char *tag) {
- std::string field,sub;
- if (extract_xml_record(s,tag,field)) {
- std::string::size_type pos=0;
- if (extract_xml_record(field,"id",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> id;
- }
- if (extract_xml_record(field,"result_id",sub)) {
- result_id.parse_xml(sub,"result_id");
- }
- if (extract_xml_record(field,"peak_power",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> peak_power;
- }
- if (extract_xml_record(field,"mean_power",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> mean_power;
- }
- if (extract_xml_record(field,"time",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> time;
- }
- if (extract_xml_record(field,"ra",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> ra;
- }
- if (extract_xml_record(field,"decl",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> decl;
- }
- if (extract_xml_record(field,"q_pix",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> q_pix;
- }
- if (extract_xml_record(field,"delay",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> delay;
- }
- if (extract_xml_record(field,"freq",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> freq;
- }
- if (extract_xml_record(field,"detection_freq",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> detection_freq;
- }
- if (extract_xml_record(field,"barycentric_freq",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> barycentric_freq;
- }
- if (extract_xml_record(field,"fft_len",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> fft_len;
- }
- if (extract_xml_record(field,"chirp_rate",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> chirp_rate;
- }
- if (extract_xml_record(field,"rfi_checked",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> rfi_checked;
- }
- if (extract_xml_record(field,"rfi_found",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> rfi_found;
- }
- if (extract_xml_record(field,"reserved",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> reserved;
- }
- }
- }
-
- void autocorr_small::parse(const SQL_ROW &s) {
- {
- std::istringstream row(*(s[0]));
- row >> id;
- }
- {
- result_id.parse(SQL_ROW(s[1],0));
- }
- {
- std::istringstream row(*(s[2]));
- row >> peak_power;
- }
- {
- std::istringstream row(*(s[3]));
- row >> mean_power;
- }
- {
- std::istringstream row(*(s[4]));
- row >> time;
- }
- {
- std::istringstream row(*(s[5]));
- row >> ra;
- }
- {
- std::istringstream row(*(s[6]));
- row >> decl;
- }
- {
- std::istringstream row(*(s[7]));
- row >> q_pix;
- }
- {
- std::istringstream row(*(s[8]));
- row >> delay;
- }
- {
- std::istringstream row(*(s[9]));
- row >> freq;
- }
- {
- std::istringstream row(*(s[10]));
- row >> detection_freq;
- }
- {
- std::istringstream row(*(s[11]));
- row >> barycentric_freq;
- }
- {
- std::istringstream row(*(s[12]));
- row >> fft_len;
- }
- {
- std::istringstream row(*(s[13]));
- row >> chirp_rate;
- }
- {
- std::istringstream row(*(s[14]));
- row >> rfi_checked;
- }
- {
- std::istringstream row(*(s[15]));
- row >> rfi_found;
- }
- {
- std::istringstream row(*(s[16]));
- row >> reserved;
- }
- }
-
- void autocorr_small::parse(const std::string &s) {
- SQL_ROW row(&s,17);
- parse(row);
- }
-
-template <> const char * const db_table<classic_versions>::table_name="classic_versions";
-template <> const char * db_table<classic_versions>::_search_tag=table_name;
+ if (&a != this) {
+ id=a.id;
+ result_id=a.result_id;
+ peak_power=a.peak_power;
+ mean_power=a.mean_power;
+ time=a.time;
+ ra=a.ra;
+ decl=a.decl;
+ q_pix=a.q_pix;
+ delay=a.delay;
+ freq=a.freq;
+ detection_freq=a.detection_freq;
+ barycentric_freq=a.barycentric_freq;
+ fft_len=a.fft_len;
+ chirp_rate=a.chirp_rate;
+ rfi_checked=a.rfi_checked;
+ rfi_found=a.rfi_found;
+ reserved=a.reserved;
+ }
+ return (*this);
+}
+
+
+std::string autocorr_small::update_format() const {
+ std::ostringstream rv("");
+
+ for (int i=2; i<17; i++) {
+ rv << "?,";
+ }
+ rv << "?";
+ return rv.str();
+}
+
+
+std::string autocorr_small::insert_format() const {
+ return std::string("?,")+update_format();
+}
+
+std::string autocorr_small::select_format() const {
+ std::string rv("");
+ for (int i=0; i<16; i++) {
+ rv+="?,";
+ }
+ rv+="?";
+ return rv;
+}
+
+std::string autocorr_small::print(int full_subtables, int show_ids, int no_refs) const {
+ std::ostringstream rv("");
+
+ rv.precision(14);
+ if (show_ids) {
+ rv << id;
+ }
+ rv << ',';
+ if (!no_refs) {
+ if (full_subtables) {
+ rv << result_id.print(full_subtables,show_ids,no_refs);
+ } else {
+ rv << result_id.id;
+ }
+ }
+ rv << ',';
+ rv << peak_power;
+ rv << ',';
+ rv << mean_power;
+ rv << ',';
+ rv << time;
+ rv << ',';
+ rv << ra;
+ rv << ',';
+ rv << decl;
+ rv << ',';
+ rv << q_pix;
+ rv << ',';
+ rv << delay;
+ rv << ',';
+ rv << freq;
+ rv << ',';
+ rv << detection_freq;
+ rv << ',';
+ rv << barycentric_freq;
+ rv << ',';
+ rv << fft_len;
+ rv << ',';
+ rv << chirp_rate;
+ rv << ',';
+ rv << rfi_checked;
+ rv << ',';
+ rv << rfi_found;
+ rv << ',';
+ rv << reserved;
+ return rv.str();
+}
+
+
+std::string autocorr_small::print_xml(int full_subtables, int show_ids, int no_refs,const char *tag) const {
+ std::ostringstream rv("");
+
+ rv.precision(14);
+ rv << xml_indent() << '<' << tag << ">\n";
+ xml_indent(2);
+ if (show_ids) {
+ rv << xml_indent() << "<id>" << id << "</id>\n";
+ }
+ if (!no_refs) {
+ if (full_subtables) {
+ rv << result_id.print_xml(full_subtables,show_ids,no_refs,"result_id");
+ } else {
+ rv << xml_indent() << "<result_id><id>" << result_id.id << "</id></result_id>\n";
+ }
+ }
+ rv << xml_indent() << "<peak_power>" << peak_power << "</peak_power>\n";
+ rv << xml_indent() << "<mean_power>" << mean_power << "</mean_power>\n";
+ rv << xml_indent() << "<time>" << time << "</time>\n";
+ rv << xml_indent() << "<ra>" << ra << "</ra>\n";
+ rv << xml_indent() << "<decl>" << decl << "</decl>\n";
+ rv << xml_indent() << "<q_pix>" << q_pix << "</q_pix>\n";
+ rv << xml_indent() << "<delay>" << delay << "</delay>\n";
+ rv << xml_indent() << "<freq>" << freq << "</freq>\n";
+ rv << xml_indent() << "<detection_freq>" << detection_freq << "</detection_freq>\n";
+ rv << xml_indent() << "<barycentric_freq>" << barycentric_freq << "</barycentric_freq>\n";
+ rv << xml_indent() << "<fft_len>" << fft_len << "</fft_len>\n";
+ rv << xml_indent() << "<chirp_rate>" << chirp_rate << "</chirp_rate>\n";
+ rv << xml_indent() << "<rfi_checked>" << rfi_checked << "</rfi_checked>\n";
+ rv << xml_indent() << "<rfi_found>" << rfi_found << "</rfi_found>\n";
+ rv << xml_indent() << "<reserved>" << reserved << "</reserved>\n";
+ xml_indent(-2);
+ rv << xml_indent() << "</" << tag << ">\n";
+ return rv.str();
+}
+
+
+void autocorr_small::parse_xml(const std::string &s,const char *tag) {
+ std::string field,sub;
+ if (extract_xml_record(s,tag,field)) {
+ std::string::size_type pos=0;
+ if (extract_xml_record(field,"id",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> id;
+ }
+ if (extract_xml_record(field,"result_id",sub)) {
+ result_id.parse_xml(sub,"result_id");
+ }
+ if (extract_xml_record(field,"peak_power",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> peak_power;
+ }
+ if (extract_xml_record(field,"mean_power",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> mean_power;
+ }
+ if (extract_xml_record(field,"time",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> time;
+ }
+ if (extract_xml_record(field,"ra",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> ra;
+ }
+ if (extract_xml_record(field,"decl",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> decl;
+ }
+ if (extract_xml_record(field,"q_pix",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> q_pix;
+ }
+ if (extract_xml_record(field,"delay",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> delay;
+ }
+ if (extract_xml_record(field,"freq",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> freq;
+ }
+ if (extract_xml_record(field,"detection_freq",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> detection_freq;
+ }
+ if (extract_xml_record(field,"barycentric_freq",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> barycentric_freq;
+ }
+ if (extract_xml_record(field,"fft_len",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> fft_len;
+ }
+ if (extract_xml_record(field,"chirp_rate",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> chirp_rate;
+ }
+ if (extract_xml_record(field,"rfi_checked",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> rfi_checked;
+ }
+ if (extract_xml_record(field,"rfi_found",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> rfi_found;
+ }
+ if (extract_xml_record(field,"reserved",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> reserved;
+ }
+ }
+}
+
+void autocorr_small::parse(const SQL_ROW &s) {
+ {
+ std::istringstream row(*(s[0]));
+ row >> id;
+ }
+ {
+ result_id.parse(SQL_ROW(s[1],0));
+ }
+ {
+ std::istringstream row(*(s[2]));
+ row >> peak_power;
+ }
+ {
+ std::istringstream row(*(s[3]));
+ row >> mean_power;
+ }
+ {
+ std::istringstream row(*(s[4]));
+ row >> time;
+ }
+ {
+ std::istringstream row(*(s[5]));
+ row >> ra;
+ }
+ {
+ std::istringstream row(*(s[6]));
+ row >> decl;
+ }
+ {
+ std::istringstream row(*(s[7]));
+ row >> q_pix;
+ }
+ {
+ std::istringstream row(*(s[8]));
+ row >> delay;
+ }
+ {
+ std::istringstream row(*(s[9]));
+ row >> freq;
+ }
+ {
+ std::istringstream row(*(s[10]));
+ row >> detection_freq;
+ }
+ {
+ std::istringstream row(*(s[11]));
+ row >> barycentric_freq;
+ }
+ {
+ std::istringstream row(*(s[12]));
+ row >> fft_len;
+ }
+ {
+ std::istringstream row(*(s[13]));
+ row >> chirp_rate;
+ }
+ {
+ std::istringstream row(*(s[14]));
+ row >> rfi_checked;
+ }
+ {
+ std::istringstream row(*(s[15]));
+ row >> rfi_found;
+ }
+ {
+ std::istringstream row(*(s[16]));
+ row >> reserved;
+ }
+}
+
+void autocorr_small::parse(const std::string &s) {
+ SQL_ROW row(&s,17);
+ parse(row);
+}
+
+template <> const char *const db_table<classic_versions>::table_name="classic_versions";
+template <> const char *db_table<classic_versions>::_search_tag=table_name;
template <> const int db_table<classic_versions>::_nfields=10;
-template <> const char * const db_table<classic_versions>::column_names[10]={"id","ver_major","ver_minor","platformid","comment","filename","md5_cksum","sum_cksum","cksum_cksum","file_cksum"};
-
-classic_versions::classic_versions() :
- db_table<classic_versions>(*this,-1),
- id(0),
- ver_major(0),
- ver_minor(0),
- platformid(0),
- file_cksum(0)
-{
- db_open();
- comment[0]=0;
- filename[0]=0;
- md5_cksum[0]=0;
- sum_cksum[0]=0;
- cksum_cksum[0]=0;
-}
-
-
-classic_versions::classic_versions(const classic_versions &a) :
- db_table<classic_versions>(*this,-1),
- id(a.id),
- ver_major(a.ver_major),
- ver_minor(a.ver_minor),
- platformid(a.platformid),
- file_cksum(a.file_cksum)
-{
- db_open();
- strcpy(comment,a.comment);
- strcpy(filename,a.filename);
- strcpy(md5_cksum,a.md5_cksum);
- strcpy(sum_cksum,a.sum_cksum);
- strcpy(cksum_cksum,a.cksum_cksum);
-}
-
-
-classic_versions::classic_versions(const SQL_ROW &a) :
- db_table<classic_versions>(*this,-1)
-{
- db_open();
- parse(a);
-}
-
-
-classic_versions::classic_versions(const std::string &s,const char *tag) :
- db_table<classic_versions>(*this,-1)
-{
- db_open();
- if (xml_match_tag(s,tag)) {
- parse_xml(s,tag);
- } else {
- parse(s);
- }
+template <> const char *const db_table<classic_versions>::column_names[10]= {"id","ver_major","ver_minor","platformid","comment","filename","md5_cksum","sum_cksum","cksum_cksum","file_cksum"};
+
+classic_versions::classic_versions() :
+ db_table<classic_versions>(*this,-1),
+ id(0),
+ ver_major(0),
+ ver_minor(0),
+ platformid(0),
+ file_cksum(0) {
+ db_open();
+ comment[0]=0;
+ filename[0]=0;
+ md5_cksum[0]=0;
+ sum_cksum[0]=0;
+ cksum_cksum[0]=0;
+}
+
+
+classic_versions::classic_versions(const classic_versions &a) :
+ db_table<classic_versions>(*this,-1),
+ id(a.id),
+ ver_major(a.ver_major),
+ ver_minor(a.ver_minor),
+ platformid(a.platformid),
+ file_cksum(a.file_cksum) {
+ db_open();
+ strcpy(comment,a.comment);
+ strcpy(filename,a.filename);
+ strcpy(md5_cksum,a.md5_cksum);
+ strcpy(sum_cksum,a.sum_cksum);
+ strcpy(cksum_cksum,a.cksum_cksum);
+}
+
+
+classic_versions::classic_versions(const SQL_ROW &a) :
+ db_table<classic_versions>(*this,-1) {
+ db_open();
+ parse(a);
+}
+
+
+classic_versions::classic_versions(const std::string &s,const char *tag) :
+ db_table<classic_versions>(*this,-1) {
+ db_open();
+ if (xml_match_tag(s,tag)) {
+ parse_xml(s,tag);
+ } else {
+ parse(s);
+ }
}
classic_versions &classic_versions::operator =(const classic_versions &a) {
- if (&a != this) {
- id=a.id;
- ver_major=a.ver_major;
- ver_minor=a.ver_minor;
- platformid=a.platformid;
- file_cksum=a.file_cksum;
- strcpy(comment,a.comment);
- strcpy(filename,a.filename);
- strcpy(md5_cksum,a.md5_cksum);
- strcpy(sum_cksum,a.sum_cksum);
- strcpy(cksum_cksum,a.cksum_cksum);
- }
- return (*this);
-}
-
-
-std::string classic_versions::update_format() const
-{ std::ostringstream rv("");
-
- for (int i=2;i<10;i++) rv << "?,";
- rv << "?";
- return rv.str();
-}
-
-
-std::string classic_versions::insert_format() const
-{ return std::string("?,")+update_format();
-}
-
-std::string classic_versions::select_format() const
-{
-std::string rv("");
-for (int i=0; i<9;i++) rv+="?,";
-rv+="?";
-return rv;
-}
-
-std::string classic_versions::print(int full_subtables, int show_ids, int no_refs) const
-{ std::ostringstream rv("");
-
- rv.precision(14);
- if (show_ids) rv << id;
- rv << ',';
- rv << ver_major;
- rv << ',';
- rv << ver_minor;
- rv << ',';
- rv << platformid;
- rv << ',';
- rv << "'" << comment << "'";
- rv << ',';
- rv << "'" << filename << "'";
- rv << ',';
- rv << "'" << md5_cksum << "'";
- rv << ',';
- rv << "'" << sum_cksum << "'";
- rv << ',';
- rv << "'" << cksum_cksum << "'";
- rv << ',';
- rv << file_cksum;
- return rv.str();
-}
-
-
-std::string classic_versions::print_xml(int full_subtables, int show_ids, int no_refs,const char *tag) const
-{
- std::ostringstream rv("");
-
- rv.precision(14);
- rv << xml_indent() << '<' << tag << ">\n";
- xml_indent(2);
- if (show_ids) rv << xml_indent() << "<id>" << id << "</id>\n";
- rv << xml_indent() << "<ver_major>" << ver_major << "</ver_major>\n";
- rv << xml_indent() << "<ver_minor>" << ver_minor << "</ver_minor>\n";
- rv << xml_indent() << "<platformid>" << platformid << "</platformid>\n";
- {
- std::string enc_field=xml_encode_string(comment,std::min(strlen(comment),sizeof(comment)));
- rv << xml_indent() << "<comment>";
- rv << enc_field << "</comment>\n";
- }
- {
- std::string enc_field=xml_encode_string(filename,std::min(strlen(filename),sizeof(filename)));
- rv << xml_indent() << "<filename>";
- rv << enc_field << "</filename>\n";
- }
- {
- std::string enc_field=xml_encode_string(md5_cksum,std::min(strlen(md5_cksum),sizeof(md5_cksum)));
- rv << xml_indent() << "<md5_cksum>";
- rv << enc_field << "</md5_cksum>\n";
- }
- {
- std::string enc_field=xml_encode_string(sum_cksum,std::min(strlen(sum_cksum),sizeof(sum_cksum)));
- rv << xml_indent() << "<sum_cksum>";
- rv << enc_field << "</sum_cksum>\n";
- }
- {
- std::string enc_field=xml_encode_string(cksum_cksum,std::min(strlen(cksum_cksum),sizeof(cksum_cksum)));
- rv << xml_indent() << "<cksum_cksum>";
- rv << enc_field << "</cksum_cksum>\n";
- }
- rv << xml_indent() << "<file_cksum>" << file_cksum << "</file_cksum>\n";
- xml_indent(-2);
- rv << xml_indent() << "</" << tag << ">\n";
- return rv.str();
-}
-
-
- void classic_versions::parse_xml(const std::string &s,const char *tag) {
- std::string field,sub;
- if (extract_xml_record(s,tag,field)) {
- std::string::size_type pos=0;
- if (extract_xml_record(field,"id",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> id;
- }
- if (extract_xml_record(field,"ver_major",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> ver_major;
- }
- if (extract_xml_record(field,"ver_minor",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> ver_minor;
- }
- if (extract_xml_record(field,"platformid",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> platformid;
- }
- if (extract_xml_record(field,"comment",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::string::size_type epos=sub.find("<",pos);
- if (epos==std::string::npos) epos=sub.find('\n',pos);
- if (epos==std::string::npos) epos=pos+strlen(sub.c_str()+pos);
- std::vector<unsigned char> in(xml_decode_string<unsigned char>((const char *)sub.c_str()+pos,epos-pos));
- strncpy(comment,(const char *)&(in.front()),std::min(in.size(),(size_t)254));
- comment[std::min(in.size(),(size_t)253)]=0;
- }
- if (extract_xml_record(field,"filename",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::string::size_type epos=sub.find("<",pos);
- if (epos==std::string::npos) epos=sub.find('\n',pos);
- if (epos==std::string::npos) epos=pos+strlen(sub.c_str()+pos);
- std::vector<unsigned char> in(xml_decode_string<unsigned char>((const char *)sub.c_str()+pos,epos-pos));
- strncpy(filename,(const char *)&(in.front()),std::min(in.size(),(size_t)254));
- filename[std::min(in.size(),(size_t)253)]=0;
- }
- if (extract_xml_record(field,"md5_cksum",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::string::size_type epos=sub.find("<",pos);
- if (epos==std::string::npos) epos=sub.find('\n',pos);
- if (epos==std::string::npos) epos=pos+strlen(sub.c_str()+pos);
- std::vector<unsigned char> in(xml_decode_string<unsigned char>((const char *)sub.c_str()+pos,epos-pos));
- strncpy(md5_cksum,(const char *)&(in.front()),std::min(in.size(),(size_t)254));
- md5_cksum[std::min(in.size(),(size_t)253)]=0;
- }
- if (extract_xml_record(field,"sum_cksum",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::string::size_type epos=sub.find("<",pos);
- if (epos==std::string::npos) epos=sub.find('\n',pos);
- if (epos==std::string::npos) epos=pos+strlen(sub.c_str()+pos);
- std::vector<unsigned char> in(xml_decode_string<unsigned char>((const char *)sub.c_str()+pos,epos-pos));
- strncpy(sum_cksum,(const char *)&(in.front()),std::min(in.size(),(size_t)254));
- sum_cksum[std::min(in.size(),(size_t)253)]=0;
- }
- if (extract_xml_record(field,"cksum_cksum",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::string::size_type epos=sub.find("<",pos);
- if (epos==std::string::npos) epos=sub.find('\n',pos);
- if (epos==std::string::npos) epos=pos+strlen(sub.c_str()+pos);
- std::vector<unsigned char> in(xml_decode_string<unsigned char>((const char *)sub.c_str()+pos,epos-pos));
- strncpy(cksum_cksum,(const char *)&(in.front()),std::min(in.size(),(size_t)254));
- cksum_cksum[std::min(in.size(),(size_t)253)]=0;
- }
- if (extract_xml_record(field,"file_cksum",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> file_cksum;
- }
- }
- }
-
- void classic_versions::parse(const SQL_ROW &s) {
- {
- std::istringstream row(*(s[0]));
- row >> id;
- }
- {
- std::istringstream row(*(s[1]));
- row >> ver_major;
- }
- {
- std::istringstream row(*(s[2]));
- row >> ver_minor;
- }
- {
- std::istringstream row(*(s[3]));
- row >> platformid;
- }
- {
- strncpy(comment,s[4]->c_str(),254);
- comment[253]=0;
- }
- {
- strncpy(filename,s[5]->c_str(),254);
- filename[253]=0;
- }
- {
- strncpy(md5_cksum,s[6]->c_str(),254);
- md5_cksum[253]=0;
- }
- {
- strncpy(sum_cksum,s[7]->c_str(),254);
- sum_cksum[253]=0;
- }
- {
- strncpy(cksum_cksum,s[8]->c_str(),254);
- cksum_cksum[253]=0;
- }
- {
- std::istringstream row(*(s[9]));
- row >> file_cksum;
- }
- }
-
- void classic_versions::parse(const std::string &s) {
- SQL_ROW row(&s,10);
- parse(row);
- }
-
-template <> const char * const db_table<classic_active_versions>::table_name="classic_active_versions";
-template <> const char * db_table<classic_active_versions>::_search_tag=table_name;
+ if (&a != this) {
+ id=a.id;
+ ver_major=a.ver_major;
+ ver_minor=a.ver_minor;
+ platformid=a.platformid;
+ file_cksum=a.file_cksum;
+ strcpy(comment,a.comment);
+ strcpy(filename,a.filename);
+ strcpy(md5_cksum,a.md5_cksum);
+ strcpy(sum_cksum,a.sum_cksum);
+ strcpy(cksum_cksum,a.cksum_cksum);
+ }
+ return (*this);
+}
+
+
+std::string classic_versions::update_format() const {
+ std::ostringstream rv("");
+
+ for (int i=2; i<10; i++) {
+ rv << "?,";
+ }
+ rv << "?";
+ return rv.str();
+}
+
+
+std::string classic_versions::insert_format() const {
+ return std::string("?,")+update_format();
+}
+
+std::string classic_versions::select_format() const {
+ std::string rv("");
+ for (int i=0; i<9; i++) {
+ rv+="?,";
+ }
+ rv+="?";
+ return rv;
+}
+
+std::string classic_versions::print(int full_subtables, int show_ids, int no_refs) const {
+ std::ostringstream rv("");
+
+ rv.precision(14);
+ if (show_ids) {
+ rv << id;
+ }
+ rv << ',';
+ rv << ver_major;
+ rv << ',';
+ rv << ver_minor;
+ rv << ',';
+ rv << platformid;
+ rv << ',';
+ rv << "'" << comment << "'";
+ rv << ',';
+ rv << "'" << filename << "'";
+ rv << ',';
+ rv << "'" << md5_cksum << "'";
+ rv << ',';
+ rv << "'" << sum_cksum << "'";
+ rv << ',';
+ rv << "'" << cksum_cksum << "'";
+ rv << ',';
+ rv << file_cksum;
+ return rv.str();
+}
+
+
+std::string classic_versions::print_xml(int full_subtables, int show_ids, int no_refs,const char *tag) const {
+ std::ostringstream rv("");
+
+ rv.precision(14);
+ rv << xml_indent() << '<' << tag << ">\n";
+ xml_indent(2);
+ if (show_ids) {
+ rv << xml_indent() << "<id>" << id << "</id>\n";
+ }
+ rv << xml_indent() << "<ver_major>" << ver_major << "</ver_major>\n";
+ rv << xml_indent() << "<ver_minor>" << ver_minor << "</ver_minor>\n";
+ rv << xml_indent() << "<platformid>" << platformid << "</platformid>\n";
+ {
+ std::string enc_field=xml_encode_string(comment,std::min(strlen(comment),sizeof(comment)));
+ rv << xml_indent() << "<comment>";
+ rv << enc_field << "</comment>\n";
+ }
+ {
+ std::string enc_field=xml_encode_string(filename,std::min(strlen(filename),sizeof(filename)));
+ rv << xml_indent() << "<filename>";
+ rv << enc_field << "</filename>\n";
+ }
+ {
+ std::string enc_field=xml_encode_string(md5_cksum,std::min(strlen(md5_cksum),sizeof(md5_cksum)));
+ rv << xml_indent() << "<md5_cksum>";
+ rv << enc_field << "</md5_cksum>\n";
+ }
+ {
+ std::string enc_field=xml_encode_string(sum_cksum,std::min(strlen(sum_cksum),sizeof(sum_cksum)));
+ rv << xml_indent() << "<sum_cksum>";
+ rv << enc_field << "</sum_cksum>\n";
+ }
+ {
+ std::string enc_field=xml_encode_string(cksum_cksum,std::min(strlen(cksum_cksum),sizeof(cksum_cksum)));
+ rv << xml_indent() << "<cksum_cksum>";
+ rv << enc_field << "</cksum_cksum>\n";
+ }
+ rv << xml_indent() << "<file_cksum>" << file_cksum << "</file_cksum>\n";
+ xml_indent(-2);
+ rv << xml_indent() << "</" << tag << ">\n";
+ return rv.str();
+}
+
+
+void classic_versions::parse_xml(const std::string &s,const char *tag) {
+ std::string field,sub;
+ if (extract_xml_record(s,tag,field)) {
+ std::string::size_type pos=0;
+ if (extract_xml_record(field,"id",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> id;
+ }
+ if (extract_xml_record(field,"ver_major",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> ver_major;
+ }
+ if (extract_xml_record(field,"ver_minor",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> ver_minor;
+ }
+ if (extract_xml_record(field,"platformid",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> platformid;
+ }
+ if (extract_xml_record(field,"comment",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::string::size_type epos=sub.find("<",pos);
+ if (epos==std::string::npos) {
+ epos=sub.find('\n',pos);
+ }
+ if (epos==std::string::npos) {
+ epos=pos+strlen(sub.c_str()+pos);
+ }
+ std::vector<unsigned char> in(xml_decode_string<unsigned char>((const char *)sub.c_str()+pos,epos-pos));
+ strncpy(comment,(const char *)&(in.front()),std::min(in.size(),(size_t)254));
+ comment[std::min(in.size(),(size_t)253)]=0;
+ }
+ if (extract_xml_record(field,"filename",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::string::size_type epos=sub.find("<",pos);
+ if (epos==std::string::npos) {
+ epos=sub.find('\n',pos);
+ }
+ if (epos==std::string::npos) {
+ epos=pos+strlen(sub.c_str()+pos);
+ }
+ std::vector<unsigned char> in(xml_decode_string<unsigned char>((const char *)sub.c_str()+pos,epos-pos));
+ strncpy(filename,(const char *)&(in.front()),std::min(in.size(),(size_t)254));
+ filename[std::min(in.size(),(size_t)253)]=0;
+ }
+ if (extract_xml_record(field,"md5_cksum",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::string::size_type epos=sub.find("<",pos);
+ if (epos==std::string::npos) {
+ epos=sub.find('\n',pos);
+ }
+ if (epos==std::string::npos) {
+ epos=pos+strlen(sub.c_str()+pos);
+ }
+ std::vector<unsigned char> in(xml_decode_string<unsigned char>((const char *)sub.c_str()+pos,epos-pos));
+ strncpy(md5_cksum,(const char *)&(in.front()),std::min(in.size(),(size_t)254));
+ md5_cksum[std::min(in.size(),(size_t)253)]=0;
+ }
+ if (extract_xml_record(field,"sum_cksum",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::string::size_type epos=sub.find("<",pos);
+ if (epos==std::string::npos) {
+ epos=sub.find('\n',pos);
+ }
+ if (epos==std::string::npos) {
+ epos=pos+strlen(sub.c_str()+pos);
+ }
+ std::vector<unsigned char> in(xml_decode_string<unsigned char>((const char *)sub.c_str()+pos,epos-pos));
+ strncpy(sum_cksum,(const char *)&(in.front()),std::min(in.size(),(size_t)254));
+ sum_cksum[std::min(in.size(),(size_t)253)]=0;
+ }
+ if (extract_xml_record(field,"cksum_cksum",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::string::size_type epos=sub.find("<",pos);
+ if (epos==std::string::npos) {
+ epos=sub.find('\n',pos);
+ }
+ if (epos==std::string::npos) {
+ epos=pos+strlen(sub.c_str()+pos);
+ }
+ std::vector<unsigned char> in(xml_decode_string<unsigned char>((const char *)sub.c_str()+pos,epos-pos));
+ strncpy(cksum_cksum,(const char *)&(in.front()),std::min(in.size(),(size_t)254));
+ cksum_cksum[std::min(in.size(),(size_t)253)]=0;
+ }
+ if (extract_xml_record(field,"file_cksum",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> file_cksum;
+ }
+ }
+}
+
+void classic_versions::parse(const SQL_ROW &s) {
+ {
+ std::istringstream row(*(s[0]));
+ row >> id;
+ }
+ {
+ std::istringstream row(*(s[1]));
+ row >> ver_major;
+ }
+ {
+ std::istringstream row(*(s[2]));
+ row >> ver_minor;
+ }
+ {
+ std::istringstream row(*(s[3]));
+ row >> platformid;
+ }
+ {
+ strncpy(comment,s[4]->c_str(),254);
+ comment[253]=0;
+ }
+ {
+ strncpy(filename,s[5]->c_str(),254);
+ filename[253]=0;
+ }
+ {
+ strncpy(md5_cksum,s[6]->c_str(),254);
+ md5_cksum[253]=0;
+ }
+ {
+ strncpy(sum_cksum,s[7]->c_str(),254);
+ sum_cksum[253]=0;
+ }
+ {
+ strncpy(cksum_cksum,s[8]->c_str(),254);
+ cksum_cksum[253]=0;
+ }
+ {
+ std::istringstream row(*(s[9]));
+ row >> file_cksum;
+ }
+}
+
+void classic_versions::parse(const std::string &s) {
+ SQL_ROW row(&s,10);
+ parse(row);
+}
+
+template <> const char *const db_table<classic_active_versions>::table_name="classic_active_versions";
+template <> const char *db_table<classic_active_versions>::_search_tag=table_name;
template <> const int db_table<classic_active_versions>::_nfields=4;
-template <> const char * const db_table<classic_active_versions>::column_names[4]={"id","versionid","ver_major","ver_minor"};
+template <> const char *const db_table<classic_active_versions>::column_names[4]= {"id","versionid","ver_major","ver_minor"};
-classic_active_versions::classic_active_versions() :
- db_table<classic_active_versions>(*this,-1),
- id(0),
- versionid(0),
- ver_major(0),
- ver_minor(0)
-{
- db_open();
+classic_active_versions::classic_active_versions() :
+ db_table<classic_active_versions>(*this,-1),
+ id(0),
+ versionid(0),
+ ver_major(0),
+ ver_minor(0) {
+ db_open();
}
-classic_active_versions::classic_active_versions(const classic_active_versions &a) :
- db_table<classic_active_versions>(*this,-1),
- id(a.id),
- versionid(a.versionid),
- ver_major(a.ver_major),
- ver_minor(a.ver_minor)
-{
- db_open();
+classic_active_versions::classic_active_versions(const classic_active_versions &a) :
+ db_table<classic_active_versions>(*this,-1),
+ id(a.id),
+ versionid(a.versionid),
+ ver_major(a.ver_major),
+ ver_minor(a.ver_minor) {
+ db_open();
}
-classic_active_versions::classic_active_versions(const SQL_ROW &a) :
- db_table<classic_active_versions>(*this,-1)
-{
- db_open();
- parse(a);
+classic_active_versions::classic_active_versions(const SQL_ROW &a) :
+ db_table<classic_active_versions>(*this,-1) {
+ db_open();
+ parse(a);
}
-classic_active_versions::classic_active_versions(const std::string &s,const char *tag) :
- db_table<classic_active_versions>(*this,-1)
-{
- db_open();
- if (xml_match_tag(s,tag)) {
- parse_xml(s,tag);
- } else {
- parse(s);
- }
+classic_active_versions::classic_active_versions(const std::string &s,const char *tag) :
+ db_table<classic_active_versions>(*this,-1) {
+ db_open();
+ if (xml_match_tag(s,tag)) {
+ parse_xml(s,tag);
+ } else {
+ parse(s);
+ }
}
classic_active_versions &classic_active_versions::operator =(const classic_active_versions &a) {
- if (&a != this) {
- id=a.id;
- versionid=a.versionid;
- ver_major=a.ver_major;
- ver_minor=a.ver_minor;
- }
- return (*this);
-}
-
-
-std::string classic_active_versions::update_format() const
-{ std::ostringstream rv("");
-
- for (int i=2;i<4;i++) rv << "?,";
- rv << "?";
- return rv.str();
-}
-
-
-std::string classic_active_versions::insert_format() const
-{ return std::string("?,")+update_format();
-}
-
-std::string classic_active_versions::select_format() const
-{
-std::string rv("");
-for (int i=0; i<3;i++) rv+="?,";
-rv+="?";
-return rv;
-}
-
-std::string classic_active_versions::print(int full_subtables, int show_ids, int no_refs) const
-{ std::ostringstream rv("");
-
- rv.precision(14);
- if (show_ids) rv << id;
- rv << ',';
- rv << versionid;
- rv << ',';
- rv << ver_major;
- rv << ',';
- rv << ver_minor;
- return rv.str();
-}
-
-
-std::string classic_active_versions::print_xml(int full_subtables, int show_ids, int no_refs,const char *tag) const
-{
- std::ostringstream rv("");
-
- rv.precision(14);
- rv << xml_indent() << '<' << tag << ">\n";
- xml_indent(2);
- if (show_ids) rv << xml_indent() << "<id>" << id << "</id>\n";
- rv << xml_indent() << "<versionid>" << versionid << "</versionid>\n";
- rv << xml_indent() << "<ver_major>" << ver_major << "</ver_major>\n";
- rv << xml_indent() << "<ver_minor>" << ver_minor << "</ver_minor>\n";
- xml_indent(-2);
- rv << xml_indent() << "</" << tag << ">\n";
- return rv.str();
-}
-
-
- void classic_active_versions::parse_xml(const std::string &s,const char *tag) {
- std::string field,sub;
- if (extract_xml_record(s,tag,field)) {
- std::string::size_type pos=0;
- if (extract_xml_record(field,"id",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> id;
- }
- if (extract_xml_record(field,"versionid",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> versionid;
- }
- if (extract_xml_record(field,"ver_major",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> ver_major;
- }
- if (extract_xml_record(field,"ver_minor",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> ver_minor;
- }
- }
- }
-
- void classic_active_versions::parse(const SQL_ROW &s) {
- {
- std::istringstream row(*(s[0]));
- row >> id;
- }
- {
- std::istringstream row(*(s[1]));
- row >> versionid;
- }
- {
- std::istringstream row(*(s[2]));
- row >> ver_major;
- }
- {
- std::istringstream row(*(s[3]));
- row >> ver_minor;
- }
- }
-
- void classic_active_versions::parse(const std::string &s) {
- SQL_ROW row(&s,4);
- parse(row);
- }
-
-template <> const char * const db_table<classic_active_versionids>::table_name="classic_active_versionids";
-template <> const char * db_table<classic_active_versionids>::_search_tag=table_name;
+ if (&a != this) {
+ id=a.id;
+ versionid=a.versionid;
+ ver_major=a.ver_major;
+ ver_minor=a.ver_minor;
+ }
+ return (*this);
+}
+
+
+std::string classic_active_versions::update_format() const {
+ std::ostringstream rv("");
+
+ for (int i=2; i<4; i++) {
+ rv << "?,";
+ }
+ rv << "?";
+ return rv.str();
+}
+
+
+std::string classic_active_versions::insert_format() const {
+ return std::string("?,")+update_format();
+}
+
+std::string classic_active_versions::select_format() const {
+ std::string rv("");
+ for (int i=0; i<3; i++) {
+ rv+="?,";
+ }
+ rv+="?";
+ return rv;
+}
+
+std::string classic_active_versions::print(int full_subtables, int show_ids, int no_refs) const {
+ std::ostringstream rv("");
+
+ rv.precision(14);
+ if (show_ids) {
+ rv << id;
+ }
+ rv << ',';
+ rv << versionid;
+ rv << ',';
+ rv << ver_major;
+ rv << ',';
+ rv << ver_minor;
+ return rv.str();
+}
+
+
+std::string classic_active_versions::print_xml(int full_subtables, int show_ids, int no_refs,const char *tag) const {
+ std::ostringstream rv("");
+
+ rv.precision(14);
+ rv << xml_indent() << '<' << tag << ">\n";
+ xml_indent(2);
+ if (show_ids) {
+ rv << xml_indent() << "<id>" << id << "</id>\n";
+ }
+ rv << xml_indent() << "<versionid>" << versionid << "</versionid>\n";
+ rv << xml_indent() << "<ver_major>" << ver_major << "</ver_major>\n";
+ rv << xml_indent() << "<ver_minor>" << ver_minor << "</ver_minor>\n";
+ xml_indent(-2);
+ rv << xml_indent() << "</" << tag << ">\n";
+ return rv.str();
+}
+
+
+void classic_active_versions::parse_xml(const std::string &s,const char *tag) {
+ std::string field,sub;
+ if (extract_xml_record(s,tag,field)) {
+ std::string::size_type pos=0;
+ if (extract_xml_record(field,"id",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> id;
+ }
+ if (extract_xml_record(field,"versionid",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> versionid;
+ }
+ if (extract_xml_record(field,"ver_major",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> ver_major;
+ }
+ if (extract_xml_record(field,"ver_minor",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> ver_minor;
+ }
+ }
+}
+
+void classic_active_versions::parse(const SQL_ROW &s) {
+ {
+ std::istringstream row(*(s[0]));
+ row >> id;
+ }
+ {
+ std::istringstream row(*(s[1]));
+ row >> versionid;
+ }
+ {
+ std::istringstream row(*(s[2]));
+ row >> ver_major;
+ }
+ {
+ std::istringstream row(*(s[3]));
+ row >> ver_minor;
+ }
+}
+
+void classic_active_versions::parse(const std::string &s) {
+ SQL_ROW row(&s,4);
+ parse(row);
+}
+
+template <> const char *const db_table<classic_active_versionids>::table_name="classic_active_versionids";
+template <> const char *db_table<classic_active_versionids>::_search_tag=table_name;
template <> const int db_table<classic_active_versionids>::_nfields=2;
-template <> const char * const db_table<classic_active_versionids>::column_names[2]={"id","versionid"};
+template <> const char *const db_table<classic_active_versionids>::column_names[2]= {"id","versionid"};
-classic_active_versionids::classic_active_versionids() :
- db_table<classic_active_versionids>(*this,-1),
- id(0),
- versionid(0)
-{
- db_open();
+classic_active_versionids::classic_active_versionids() :
+ db_table<classic_active_versionids>(*this,-1),
+ id(0),
+ versionid(0) {
+ db_open();
}
-classic_active_versionids::classic_active_versionids(const classic_active_versionids &a) :
- db_table<classic_active_versionids>(*this,-1),
- id(a.id),
- versionid(a.versionid)
-{
- db_open();
+classic_active_versionids::classic_active_versionids(const classic_active_versionids &a) :
+ db_table<classic_active_versionids>(*this,-1),
+ id(a.id),
+ versionid(a.versionid) {
+ db_open();
}
-classic_active_versionids::classic_active_versionids(const SQL_ROW &a) :
- db_table<classic_active_versionids>(*this,-1)
-{
- db_open();
- parse(a);
+classic_active_versionids::classic_active_versionids(const SQL_ROW &a) :
+ db_table<classic_active_versionids>(*this,-1) {
+ db_open();
+ parse(a);
}
-classic_active_versionids::classic_active_versionids(const std::string &s,const char *tag) :
- db_table<classic_active_versionids>(*this,-1)
-{
- db_open();
- if (xml_match_tag(s,tag)) {
- parse_xml(s,tag);
- } else {
- parse(s);
- }
+classic_active_versionids::classic_active_versionids(const std::string &s,const char *tag) :
+ db_table<classic_active_versionids>(*this,-1) {
+ db_open();
+ if (xml_match_tag(s,tag)) {
+ parse_xml(s,tag);
+ } else {
+ parse(s);
+ }
}
classic_active_versionids &classic_active_versionids::operator =(const classic_active_versionids &a) {
- if (&a != this) {
- id=a.id;
- versionid=a.versionid;
- }
- return (*this);
-}
-
-
-std::string classic_active_versionids::update_format() const
-{ std::ostringstream rv("");
-
- for (int i=2;i<2;i++) rv << "?,";
- rv << "?";
- return rv.str();
-}
-
-
-std::string classic_active_versionids::insert_format() const
-{ return std::string("?,")+update_format();
-}
-
-std::string classic_active_versionids::select_format() const
-{
-std::string rv("");
-for (int i=0; i<1;i++) rv+="?,";
-rv+="?";
-return rv;
-}
-
-std::string classic_active_versionids::print(int full_subtables, int show_ids, int no_refs) const
-{ std::ostringstream rv("");
-
- rv.precision(14);
- if (show_ids) rv << id;
- rv << ',';
- rv << versionid;
- return rv.str();
-}
-
-
-std::string classic_active_versionids::print_xml(int full_subtables, int show_ids, int no_refs,const char *tag) const
-{
- std::ostringstream rv("");
-
- rv.precision(14);
- rv << xml_indent() << '<' << tag << ">\n";
- xml_indent(2);
- if (show_ids) rv << xml_indent() << "<id>" << id << "</id>\n";
- rv << xml_indent() << "<versionid>" << versionid << "</versionid>\n";
- xml_indent(-2);
- rv << xml_indent() << "</" << tag << ">\n";
- return rv.str();
-}
-
-
- void classic_active_versionids::parse_xml(const std::string &s,const char *tag) {
- std::string field,sub;
- if (extract_xml_record(s,tag,field)) {
- std::string::size_type pos=0;
- if (extract_xml_record(field,"id",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> id;
- }
- if (extract_xml_record(field,"versionid",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> versionid;
- }
- }
- }
-
- void classic_active_versionids::parse(const SQL_ROW &s) {
- {
- std::istringstream row(*(s[0]));
- row >> id;
- }
- {
- std::istringstream row(*(s[1]));
- row >> versionid;
- }
- }
-
- void classic_active_versionids::parse(const std::string &s) {
- SQL_ROW row(&s,2);
- parse(row);
- }
-
-template <> const char * const db_table<rfi_zone>::table_name="rfi_zone";
-template <> const char * db_table<rfi_zone>::_search_tag=table_name;
+ if (&a != this) {
+ id=a.id;
+ versionid=a.versionid;
+ }
+ return (*this);
+}
+
+
+std::string classic_active_versionids::update_format() const {
+ std::ostringstream rv("");
+
+ for (int i=2; i<2; i++) {
+ rv << "?,";
+ }
+ rv << "?";
+ return rv.str();
+}
+
+
+std::string classic_active_versionids::insert_format() const {
+ return std::string("?,")+update_format();
+}
+
+std::string classic_active_versionids::select_format() const {
+ std::string rv("");
+ for (int i=0; i<1; i++) {
+ rv+="?,";
+ }
+ rv+="?";
+ return rv;
+}
+
+std::string classic_active_versionids::print(int full_subtables, int show_ids, int no_refs) const {
+ std::ostringstream rv("");
+
+ rv.precision(14);
+ if (show_ids) {
+ rv << id;
+ }
+ rv << ',';
+ rv << versionid;
+ return rv.str();
+}
+
+
+std::string classic_active_versionids::print_xml(int full_subtables, int show_ids, int no_refs,const char *tag) const {
+ std::ostringstream rv("");
+
+ rv.precision(14);
+ rv << xml_indent() << '<' << tag << ">\n";
+ xml_indent(2);
+ if (show_ids) {
+ rv << xml_indent() << "<id>" << id << "</id>\n";
+ }
+ rv << xml_indent() << "<versionid>" << versionid << "</versionid>\n";
+ xml_indent(-2);
+ rv << xml_indent() << "</" << tag << ">\n";
+ return rv.str();
+}
+
+
+void classic_active_versionids::parse_xml(const std::string &s,const char *tag) {
+ std::string field,sub;
+ if (extract_xml_record(s,tag,field)) {
+ std::string::size_type pos=0;
+ if (extract_xml_record(field,"id",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> id;
+ }
+ if (extract_xml_record(field,"versionid",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> versionid;
+ }
+ }
+}
+
+void classic_active_versionids::parse(const SQL_ROW &s) {
+ {
+ std::istringstream row(*(s[0]));
+ row >> id;
+ }
+ {
+ std::istringstream row(*(s[1]));
+ row >> versionid;
+ }
+}
+
+void classic_active_versionids::parse(const std::string &s) {
+ SQL_ROW row(&s,2);
+ parse(row);
+}
+
+template <> const char *const db_table<rfi_zone>::table_name="rfi_zone";
+template <> const char *db_table<rfi_zone>::_search_tag=table_name;
template <> const int db_table<rfi_zone>::_nfields=26;
-template <> const char * const db_table<rfi_zone>::column_names[26]={"id","min_receiver_s4id","max_receiver_s4id","min_splitter_config","max_splitter_config","min_analysis_config","max_analysis_config","min_tape_id","max_tape_id","min_workunit_id","max_workunit_id","min_result_id","max_result_id","min_time","max_time","central_baseband_freq","baseband_freq_width","central_detection_freq","detection_freq_width","central_period","period_width","fft_len_flags","signal_type_flags","ra","dec" [...]
-
-rfi_zone::rfi_zone() :
- db_table<rfi_zone>(*this,-1),
- id(0),
- min_receiver_s4id(0),
- max_receiver_s4id(0),
- min_splitter_config(0),
- max_splitter_config(0),
- min_analysis_config(0),
- max_analysis_config(0),
- min_tape_id(0),
- max_tape_id(0),
- min_workunit_id(0),
- max_workunit_id(0),
- min_result_id(0),
- max_result_id(0),
- min_time(0),
- max_time(0),
- central_baseband_freq(0),
- baseband_freq_width(0),
- central_detection_freq(0),
- detection_freq_width(0),
- central_period(0),
- period_width(0),
- fft_len_flags(0),
- signal_type_flags(0),
- ra(0),
- dec(0),
- angular_distance(0)
-{
- db_open();
-}
-
-
-rfi_zone::rfi_zone(const rfi_zone &a) :
- db_table<rfi_zone>(*this,-1),
- id(a.id),
- min_receiver_s4id(a.min_receiver_s4id),
- max_receiver_s4id(a.max_receiver_s4id),
- min_splitter_config(a.min_splitter_config),
- max_splitter_config(a.max_splitter_config),
- min_analysis_config(a.min_analysis_config),
- max_analysis_config(a.max_analysis_config),
- min_tape_id(a.min_tape_id),
- max_tape_id(a.max_tape_id),
- min_workunit_id(a.min_workunit_id),
- max_workunit_id(a.max_workunit_id),
- min_result_id(a.min_result_id),
- max_result_id(a.max_result_id),
- min_time(a.min_time),
- max_time(a.max_time),
- central_baseband_freq(a.central_baseband_freq),
- baseband_freq_width(a.baseband_freq_width),
- central_detection_freq(a.central_detection_freq),
- detection_freq_width(a.detection_freq_width),
- central_period(a.central_period),
- period_width(a.period_width),
- fft_len_flags(a.fft_len_flags),
- signal_type_flags(a.signal_type_flags),
- ra(a.ra),
- dec(a.dec),
- angular_distance(a.angular_distance)
-{
- db_open();
-}
-
-
-rfi_zone::rfi_zone(const SQL_ROW &a) :
- db_table<rfi_zone>(*this,-1)
-{
- db_open();
- parse(a);
-}
-
-
-rfi_zone::rfi_zone(const std::string &s,const char *tag) :
- db_table<rfi_zone>(*this,-1)
-{
- db_open();
- if (xml_match_tag(s,tag)) {
- parse_xml(s,tag);
- } else {
- parse(s);
- }
+template <> const char *const db_table<rfi_zone>::column_names[26]= {"id","min_receiver_s4id","max_receiver_s4id","min_splitter_config","max_splitter_config","min_analysis_config","max_analysis_config","min_tape_id","max_tape_id","min_workunit_id","max_workunit_id","min_result_id","max_result_id","min_time","max_time","central_baseband_freq","baseband_freq_width","central_detection_freq","detection_freq_width","central_period","period_width","fft_len_flags","signal_type_flags","ra","dec" [...]
+
+rfi_zone::rfi_zone() :
+ db_table<rfi_zone>(*this,-1),
+ id(0),
+ min_receiver_s4id(0),
+ max_receiver_s4id(0),
+ min_splitter_config(0),
+ max_splitter_config(0),
+ min_analysis_config(0),
+ max_analysis_config(0),
+ min_tape_id(0),
+ max_tape_id(0),
+ min_workunit_id(0),
+ max_workunit_id(0),
+ min_result_id(0),
+ max_result_id(0),
+ min_time(0),
+ max_time(0),
+ central_baseband_freq(0),
+ baseband_freq_width(0),
+ central_detection_freq(0),
+ detection_freq_width(0),
+ central_period(0),
+ period_width(0),
+ fft_len_flags(0),
+ signal_type_flags(0),
+ ra(0),
+ dec(0),
+ angular_distance(0) {
+ db_open();
+}
+
+
+rfi_zone::rfi_zone(const rfi_zone &a) :
+ db_table<rfi_zone>(*this,-1),
+ id(a.id),
+ min_receiver_s4id(a.min_receiver_s4id),
+ max_receiver_s4id(a.max_receiver_s4id),
+ min_splitter_config(a.min_splitter_config),
+ max_splitter_config(a.max_splitter_config),
+ min_analysis_config(a.min_analysis_config),
+ max_analysis_config(a.max_analysis_config),
+ min_tape_id(a.min_tape_id),
+ max_tape_id(a.max_tape_id),
+ min_workunit_id(a.min_workunit_id),
+ max_workunit_id(a.max_workunit_id),
+ min_result_id(a.min_result_id),
+ max_result_id(a.max_result_id),
+ min_time(a.min_time),
+ max_time(a.max_time),
+ central_baseband_freq(a.central_baseband_freq),
+ baseband_freq_width(a.baseband_freq_width),
+ central_detection_freq(a.central_detection_freq),
+ detection_freq_width(a.detection_freq_width),
+ central_period(a.central_period),
+ period_width(a.period_width),
+ fft_len_flags(a.fft_len_flags),
+ signal_type_flags(a.signal_type_flags),
+ ra(a.ra),
+ dec(a.dec),
+ angular_distance(a.angular_distance) {
+ db_open();
+}
+
+
+rfi_zone::rfi_zone(const SQL_ROW &a) :
+ db_table<rfi_zone>(*this,-1) {
+ db_open();
+ parse(a);
+}
+
+
+rfi_zone::rfi_zone(const std::string &s,const char *tag) :
+ db_table<rfi_zone>(*this,-1) {
+ db_open();
+ if (xml_match_tag(s,tag)) {
+ parse_xml(s,tag);
+ } else {
+ parse(s);
+ }
}
rfi_zone &rfi_zone::operator =(const rfi_zone &a) {
- if (&a != this) {
- id=a.id;
- min_receiver_s4id=a.min_receiver_s4id;
- max_receiver_s4id=a.max_receiver_s4id;
- min_splitter_config=a.min_splitter_config;
- max_splitter_config=a.max_splitter_config;
- min_analysis_config=a.min_analysis_config;
- max_analysis_config=a.max_analysis_config;
- min_tape_id=a.min_tape_id;
- max_tape_id=a.max_tape_id;
- min_workunit_id=a.min_workunit_id;
- max_workunit_id=a.max_workunit_id;
- min_result_id=a.min_result_id;
- max_result_id=a.max_result_id;
- min_time=a.min_time;
- max_time=a.max_time;
- central_baseband_freq=a.central_baseband_freq;
- baseband_freq_width=a.baseband_freq_width;
- central_detection_freq=a.central_detection_freq;
- detection_freq_width=a.detection_freq_width;
- central_period=a.central_period;
- period_width=a.period_width;
- fft_len_flags=a.fft_len_flags;
- signal_type_flags=a.signal_type_flags;
- ra=a.ra;
- dec=a.dec;
- angular_distance=a.angular_distance;
- }
- return (*this);
-}
-
-
-std::string rfi_zone::update_format() const
-{ std::ostringstream rv("");
-
- for (int i=2;i<26;i++) rv << "?,";
- rv << "?";
- return rv.str();
-}
-
-
-std::string rfi_zone::insert_format() const
-{ return std::string("?,")+update_format();
-}
-
-std::string rfi_zone::select_format() const
-{
-std::string rv("");
-for (int i=0; i<25;i++) rv+="?,";
-rv+="?";
-return rv;
-}
-
-std::string rfi_zone::print(int full_subtables, int show_ids, int no_refs) const
-{ std::ostringstream rv("");
-
- rv.precision(14);
- if (show_ids) rv << id;
- rv << ',';
- rv << min_receiver_s4id;
- rv << ',';
- rv << max_receiver_s4id;
- rv << ',';
- rv << min_splitter_config;
- rv << ',';
- rv << max_splitter_config;
- rv << ',';
- rv << min_analysis_config;
- rv << ',';
- rv << max_analysis_config;
- rv << ',';
- rv << min_tape_id;
- rv << ',';
- rv << max_tape_id;
- rv << ',';
- rv << min_workunit_id;
- rv << ',';
- rv << max_workunit_id;
- rv << ',';
- rv << min_result_id;
- rv << ',';
- rv << max_result_id;
- rv << ',';
- rv << min_time;
- rv << ',';
- rv << max_time;
- rv << ',';
- rv << central_baseband_freq;
- rv << ',';
- rv << baseband_freq_width;
- rv << ',';
- rv << central_detection_freq;
- rv << ',';
- rv << detection_freq_width;
- rv << ',';
- rv << central_period;
- rv << ',';
- rv << period_width;
- rv << ',';
- rv << fft_len_flags;
- rv << ',';
- rv << signal_type_flags;
- rv << ',';
- rv << ra;
- rv << ',';
- rv << dec;
- rv << ',';
- rv << angular_distance;
- return rv.str();
-}
-
-
-std::string rfi_zone::print_xml(int full_subtables, int show_ids, int no_refs,const char *tag) const
-{
- std::ostringstream rv("");
-
- rv.precision(14);
- rv << xml_indent() << '<' << tag << ">\n";
- xml_indent(2);
- if (show_ids) rv << xml_indent() << "<id>" << id << "</id>\n";
- rv << xml_indent() << "<min_receiver_s4id>" << min_receiver_s4id << "</min_receiver_s4id>\n";
- rv << xml_indent() << "<max_receiver_s4id>" << max_receiver_s4id << "</max_receiver_s4id>\n";
- rv << xml_indent() << "<min_splitter_config>" << min_splitter_config << "</min_splitter_config>\n";
- rv << xml_indent() << "<max_splitter_config>" << max_splitter_config << "</max_splitter_config>\n";
- rv << xml_indent() << "<min_analysis_config>" << min_analysis_config << "</min_analysis_config>\n";
- rv << xml_indent() << "<max_analysis_config>" << max_analysis_config << "</max_analysis_config>\n";
- rv << xml_indent() << "<min_tape_id>" << min_tape_id << "</min_tape_id>\n";
- rv << xml_indent() << "<max_tape_id>" << max_tape_id << "</max_tape_id>\n";
- rv << xml_indent() << "<min_workunit_id>" << min_workunit_id << "</min_workunit_id>\n";
- rv << xml_indent() << "<max_workunit_id>" << max_workunit_id << "</max_workunit_id>\n";
- rv << xml_indent() << "<min_result_id>" << min_result_id << "</min_result_id>\n";
- rv << xml_indent() << "<max_result_id>" << max_result_id << "</max_result_id>\n";
- rv << xml_indent() << "<min_time>" << min_time << "</min_time>\n";
- rv << xml_indent() << "<max_time>" << max_time << "</max_time>\n";
- rv << xml_indent() << "<central_baseband_freq>" << central_baseband_freq << "</central_baseband_freq>\n";
- rv << xml_indent() << "<baseband_freq_width>" << baseband_freq_width << "</baseband_freq_width>\n";
- rv << xml_indent() << "<central_detection_freq>" << central_detection_freq << "</central_detection_freq>\n";
- rv << xml_indent() << "<detection_freq_width>" << detection_freq_width << "</detection_freq_width>\n";
- rv << xml_indent() << "<central_period>" << central_period << "</central_period>\n";
- rv << xml_indent() << "<period_width>" << period_width << "</period_width>\n";
- rv << xml_indent() << "<fft_len_flags>" << fft_len_flags << "</fft_len_flags>\n";
- rv << xml_indent() << "<signal_type_flags>" << signal_type_flags << "</signal_type_flags>\n";
- rv << xml_indent() << "<ra>" << ra << "</ra>\n";
- rv << xml_indent() << "<dec>" << dec << "</dec>\n";
- rv << xml_indent() << "<angular_distance>" << angular_distance << "</angular_distance>\n";
- xml_indent(-2);
- rv << xml_indent() << "</" << tag << ">\n";
- return rv.str();
-}
-
-
- void rfi_zone::parse_xml(const std::string &s,const char *tag) {
- std::string field,sub;
- if (extract_xml_record(s,tag,field)) {
- std::string::size_type pos=0;
- if (extract_xml_record(field,"id",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> id;
- }
- if (extract_xml_record(field,"min_receiver_s4id",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> min_receiver_s4id;
- }
- if (extract_xml_record(field,"max_receiver_s4id",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> max_receiver_s4id;
- }
- if (extract_xml_record(field,"min_splitter_config",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> min_splitter_config;
- }
- if (extract_xml_record(field,"max_splitter_config",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> max_splitter_config;
- }
- if (extract_xml_record(field,"min_analysis_config",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> min_analysis_config;
- }
- if (extract_xml_record(field,"max_analysis_config",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> max_analysis_config;
- }
- if (extract_xml_record(field,"min_tape_id",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> min_tape_id;
- }
- if (extract_xml_record(field,"max_tape_id",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> max_tape_id;
- }
- if (extract_xml_record(field,"min_workunit_id",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> min_workunit_id;
- }
- if (extract_xml_record(field,"max_workunit_id",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> max_workunit_id;
- }
- if (extract_xml_record(field,"min_result_id",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> min_result_id;
- }
- if (extract_xml_record(field,"max_result_id",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> max_result_id;
- }
- if (extract_xml_record(field,"min_time",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> min_time;
- }
- if (extract_xml_record(field,"max_time",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> max_time;
- }
- if (extract_xml_record(field,"central_baseband_freq",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> central_baseband_freq;
- }
- if (extract_xml_record(field,"baseband_freq_width",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> baseband_freq_width;
- }
- if (extract_xml_record(field,"central_detection_freq",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> central_detection_freq;
- }
- if (extract_xml_record(field,"detection_freq_width",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> detection_freq_width;
- }
- if (extract_xml_record(field,"central_period",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> central_period;
- }
- if (extract_xml_record(field,"period_width",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> period_width;
- }
- if (extract_xml_record(field,"fft_len_flags",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> fft_len_flags;
- }
- if (extract_xml_record(field,"signal_type_flags",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> signal_type_flags;
- }
- if (extract_xml_record(field,"ra",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> ra;
- }
- if (extract_xml_record(field,"dec",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> dec;
- }
- if (extract_xml_record(field,"angular_distance",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> angular_distance;
- }
- }
- }
-
- void rfi_zone::parse(const SQL_ROW &s) {
- {
- std::istringstream row(*(s[0]));
- row >> id;
- }
- {
- std::istringstream row(*(s[1]));
- row >> min_receiver_s4id;
- }
- {
- std::istringstream row(*(s[2]));
- row >> max_receiver_s4id;
- }
- {
- std::istringstream row(*(s[3]));
- row >> min_splitter_config;
- }
- {
- std::istringstream row(*(s[4]));
- row >> max_splitter_config;
- }
- {
- std::istringstream row(*(s[5]));
- row >> min_analysis_config;
- }
- {
- std::istringstream row(*(s[6]));
- row >> max_analysis_config;
- }
- {
- std::istringstream row(*(s[7]));
- row >> min_tape_id;
- }
- {
- std::istringstream row(*(s[8]));
- row >> max_tape_id;
- }
- {
- std::istringstream row(*(s[9]));
- row >> min_workunit_id;
- }
- {
- std::istringstream row(*(s[10]));
- row >> max_workunit_id;
- }
- {
- std::istringstream row(*(s[11]));
- row >> min_result_id;
- }
- {
- std::istringstream row(*(s[12]));
- row >> max_result_id;
- }
- {
- std::istringstream row(*(s[13]));
- row >> min_time;
- }
- {
- std::istringstream row(*(s[14]));
- row >> max_time;
- }
- {
- std::istringstream row(*(s[15]));
- row >> central_baseband_freq;
- }
- {
- std::istringstream row(*(s[16]));
- row >> baseband_freq_width;
- }
- {
- std::istringstream row(*(s[17]));
- row >> central_detection_freq;
- }
- {
- std::istringstream row(*(s[18]));
- row >> detection_freq_width;
- }
- {
- std::istringstream row(*(s[19]));
- row >> central_period;
- }
- {
- std::istringstream row(*(s[20]));
- row >> period_width;
- }
- {
- std::istringstream row(*(s[21]));
- row >> fft_len_flags;
- }
- {
- std::istringstream row(*(s[22]));
- row >> signal_type_flags;
- }
- {
- std::istringstream row(*(s[23]));
- row >> ra;
- }
- {
- std::istringstream row(*(s[24]));
- row >> dec;
- }
- {
- std::istringstream row(*(s[25]));
- row >> angular_distance;
- }
- }
-
- void rfi_zone::parse(const std::string &s) {
- SQL_ROW row(&s,26);
- parse(row);
- }
-
-template <> const char * const db_table<bad_data>::table_name="bad_data";
-template <> const char * db_table<bad_data>::_search_tag=table_name;
+ if (&a != this) {
+ id=a.id;
+ min_receiver_s4id=a.min_receiver_s4id;
+ max_receiver_s4id=a.max_receiver_s4id;
+ min_splitter_config=a.min_splitter_config;
+ max_splitter_config=a.max_splitter_config;
+ min_analysis_config=a.min_analysis_config;
+ max_analysis_config=a.max_analysis_config;
+ min_tape_id=a.min_tape_id;
+ max_tape_id=a.max_tape_id;
+ min_workunit_id=a.min_workunit_id;
+ max_workunit_id=a.max_workunit_id;
+ min_result_id=a.min_result_id;
+ max_result_id=a.max_result_id;
+ min_time=a.min_time;
+ max_time=a.max_time;
+ central_baseband_freq=a.central_baseband_freq;
+ baseband_freq_width=a.baseband_freq_width;
+ central_detection_freq=a.central_detection_freq;
+ detection_freq_width=a.detection_freq_width;
+ central_period=a.central_period;
+ period_width=a.period_width;
+ fft_len_flags=a.fft_len_flags;
+ signal_type_flags=a.signal_type_flags;
+ ra=a.ra;
+ dec=a.dec;
+ angular_distance=a.angular_distance;
+ }
+ return (*this);
+}
+
+
+std::string rfi_zone::update_format() const {
+ std::ostringstream rv("");
+
+ for (int i=2; i<26; i++) {
+ rv << "?,";
+ }
+ rv << "?";
+ return rv.str();
+}
+
+
+std::string rfi_zone::insert_format() const {
+ return std::string("?,")+update_format();
+}
+
+std::string rfi_zone::select_format() const {
+ std::string rv("");
+ for (int i=0; i<25; i++) {
+ rv+="?,";
+ }
+ rv+="?";
+ return rv;
+}
+
+std::string rfi_zone::print(int full_subtables, int show_ids, int no_refs) const {
+ std::ostringstream rv("");
+
+ rv.precision(14);
+ if (show_ids) {
+ rv << id;
+ }
+ rv << ',';
+ rv << min_receiver_s4id;
+ rv << ',';
+ rv << max_receiver_s4id;
+ rv << ',';
+ rv << min_splitter_config;
+ rv << ',';
+ rv << max_splitter_config;
+ rv << ',';
+ rv << min_analysis_config;
+ rv << ',';
+ rv << max_analysis_config;
+ rv << ',';
+ rv << min_tape_id;
+ rv << ',';
+ rv << max_tape_id;
+ rv << ',';
+ rv << min_workunit_id;
+ rv << ',';
+ rv << max_workunit_id;
+ rv << ',';
+ rv << min_result_id;
+ rv << ',';
+ rv << max_result_id;
+ rv << ',';
+ rv << min_time;
+ rv << ',';
+ rv << max_time;
+ rv << ',';
+ rv << central_baseband_freq;
+ rv << ',';
+ rv << baseband_freq_width;
+ rv << ',';
+ rv << central_detection_freq;
+ rv << ',';
+ rv << detection_freq_width;
+ rv << ',';
+ rv << central_period;
+ rv << ',';
+ rv << period_width;
+ rv << ',';
+ rv << fft_len_flags;
+ rv << ',';
+ rv << signal_type_flags;
+ rv << ',';
+ rv << ra;
+ rv << ',';
+ rv << dec;
+ rv << ',';
+ rv << angular_distance;
+ return rv.str();
+}
+
+
+std::string rfi_zone::print_xml(int full_subtables, int show_ids, int no_refs,const char *tag) const {
+ std::ostringstream rv("");
+
+ rv.precision(14);
+ rv << xml_indent() << '<' << tag << ">\n";
+ xml_indent(2);
+ if (show_ids) {
+ rv << xml_indent() << "<id>" << id << "</id>\n";
+ }
+ rv << xml_indent() << "<min_receiver_s4id>" << min_receiver_s4id << "</min_receiver_s4id>\n";
+ rv << xml_indent() << "<max_receiver_s4id>" << max_receiver_s4id << "</max_receiver_s4id>\n";
+ rv << xml_indent() << "<min_splitter_config>" << min_splitter_config << "</min_splitter_config>\n";
+ rv << xml_indent() << "<max_splitter_config>" << max_splitter_config << "</max_splitter_config>\n";
+ rv << xml_indent() << "<min_analysis_config>" << min_analysis_config << "</min_analysis_config>\n";
+ rv << xml_indent() << "<max_analysis_config>" << max_analysis_config << "</max_analysis_config>\n";
+ rv << xml_indent() << "<min_tape_id>" << min_tape_id << "</min_tape_id>\n";
+ rv << xml_indent() << "<max_tape_id>" << max_tape_id << "</max_tape_id>\n";
+ rv << xml_indent() << "<min_workunit_id>" << min_workunit_id << "</min_workunit_id>\n";
+ rv << xml_indent() << "<max_workunit_id>" << max_workunit_id << "</max_workunit_id>\n";
+ rv << xml_indent() << "<min_result_id>" << min_result_id << "</min_result_id>\n";
+ rv << xml_indent() << "<max_result_id>" << max_result_id << "</max_result_id>\n";
+ rv << xml_indent() << "<min_time>" << min_time << "</min_time>\n";
+ rv << xml_indent() << "<max_time>" << max_time << "</max_time>\n";
+ rv << xml_indent() << "<central_baseband_freq>" << central_baseband_freq << "</central_baseband_freq>\n";
+ rv << xml_indent() << "<baseband_freq_width>" << baseband_freq_width << "</baseband_freq_width>\n";
+ rv << xml_indent() << "<central_detection_freq>" << central_detection_freq << "</central_detection_freq>\n";
+ rv << xml_indent() << "<detection_freq_width>" << detection_freq_width << "</detection_freq_width>\n";
+ rv << xml_indent() << "<central_period>" << central_period << "</central_period>\n";
+ rv << xml_indent() << "<period_width>" << period_width << "</period_width>\n";
+ rv << xml_indent() << "<fft_len_flags>" << fft_len_flags << "</fft_len_flags>\n";
+ rv << xml_indent() << "<signal_type_flags>" << signal_type_flags << "</signal_type_flags>\n";
+ rv << xml_indent() << "<ra>" << ra << "</ra>\n";
+ rv << xml_indent() << "<dec>" << dec << "</dec>\n";
+ rv << xml_indent() << "<angular_distance>" << angular_distance << "</angular_distance>\n";
+ xml_indent(-2);
+ rv << xml_indent() << "</" << tag << ">\n";
+ return rv.str();
+}
+
+
+void rfi_zone::parse_xml(const std::string &s,const char *tag) {
+ std::string field,sub;
+ if (extract_xml_record(s,tag,field)) {
+ std::string::size_type pos=0;
+ if (extract_xml_record(field,"id",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> id;
+ }
+ if (extract_xml_record(field,"min_receiver_s4id",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> min_receiver_s4id;
+ }
+ if (extract_xml_record(field,"max_receiver_s4id",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> max_receiver_s4id;
+ }
+ if (extract_xml_record(field,"min_splitter_config",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> min_splitter_config;
+ }
+ if (extract_xml_record(field,"max_splitter_config",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> max_splitter_config;
+ }
+ if (extract_xml_record(field,"min_analysis_config",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> min_analysis_config;
+ }
+ if (extract_xml_record(field,"max_analysis_config",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> max_analysis_config;
+ }
+ if (extract_xml_record(field,"min_tape_id",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> min_tape_id;
+ }
+ if (extract_xml_record(field,"max_tape_id",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> max_tape_id;
+ }
+ if (extract_xml_record(field,"min_workunit_id",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> min_workunit_id;
+ }
+ if (extract_xml_record(field,"max_workunit_id",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> max_workunit_id;
+ }
+ if (extract_xml_record(field,"min_result_id",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> min_result_id;
+ }
+ if (extract_xml_record(field,"max_result_id",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> max_result_id;
+ }
+ if (extract_xml_record(field,"min_time",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> min_time;
+ }
+ if (extract_xml_record(field,"max_time",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> max_time;
+ }
+ if (extract_xml_record(field,"central_baseband_freq",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> central_baseband_freq;
+ }
+ if (extract_xml_record(field,"baseband_freq_width",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> baseband_freq_width;
+ }
+ if (extract_xml_record(field,"central_detection_freq",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> central_detection_freq;
+ }
+ if (extract_xml_record(field,"detection_freq_width",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> detection_freq_width;
+ }
+ if (extract_xml_record(field,"central_period",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> central_period;
+ }
+ if (extract_xml_record(field,"period_width",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> period_width;
+ }
+ if (extract_xml_record(field,"fft_len_flags",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> fft_len_flags;
+ }
+ if (extract_xml_record(field,"signal_type_flags",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> signal_type_flags;
+ }
+ if (extract_xml_record(field,"ra",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> ra;
+ }
+ if (extract_xml_record(field,"dec",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> dec;
+ }
+ if (extract_xml_record(field,"angular_distance",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> angular_distance;
+ }
+ }
+}
+
+void rfi_zone::parse(const SQL_ROW &s) {
+ {
+ std::istringstream row(*(s[0]));
+ row >> id;
+ }
+ {
+ std::istringstream row(*(s[1]));
+ row >> min_receiver_s4id;
+ }
+ {
+ std::istringstream row(*(s[2]));
+ row >> max_receiver_s4id;
+ }
+ {
+ std::istringstream row(*(s[3]));
+ row >> min_splitter_config;
+ }
+ {
+ std::istringstream row(*(s[4]));
+ row >> max_splitter_config;
+ }
+ {
+ std::istringstream row(*(s[5]));
+ row >> min_analysis_config;
+ }
+ {
+ std::istringstream row(*(s[6]));
+ row >> max_analysis_config;
+ }
+ {
+ std::istringstream row(*(s[7]));
+ row >> min_tape_id;
+ }
+ {
+ std::istringstream row(*(s[8]));
+ row >> max_tape_id;
+ }
+ {
+ std::istringstream row(*(s[9]));
+ row >> min_workunit_id;
+ }
+ {
+ std::istringstream row(*(s[10]));
+ row >> max_workunit_id;
+ }
+ {
+ std::istringstream row(*(s[11]));
+ row >> min_result_id;
+ }
+ {
+ std::istringstream row(*(s[12]));
+ row >> max_result_id;
+ }
+ {
+ std::istringstream row(*(s[13]));
+ row >> min_time;
+ }
+ {
+ std::istringstream row(*(s[14]));
+ row >> max_time;
+ }
+ {
+ std::istringstream row(*(s[15]));
+ row >> central_baseband_freq;
+ }
+ {
+ std::istringstream row(*(s[16]));
+ row >> baseband_freq_width;
+ }
+ {
+ std::istringstream row(*(s[17]));
+ row >> central_detection_freq;
+ }
+ {
+ std::istringstream row(*(s[18]));
+ row >> detection_freq_width;
+ }
+ {
+ std::istringstream row(*(s[19]));
+ row >> central_period;
+ }
+ {
+ std::istringstream row(*(s[20]));
+ row >> period_width;
+ }
+ {
+ std::istringstream row(*(s[21]));
+ row >> fft_len_flags;
+ }
+ {
+ std::istringstream row(*(s[22]));
+ row >> signal_type_flags;
+ }
+ {
+ std::istringstream row(*(s[23]));
+ row >> ra;
+ }
+ {
+ std::istringstream row(*(s[24]));
+ row >> dec;
+ }
+ {
+ std::istringstream row(*(s[25]));
+ row >> angular_distance;
+ }
+}
+
+void rfi_zone::parse(const std::string &s) {
+ SQL_ROW row(&s,26);
+ parse(row);
+}
+
+template <> const char *const db_table<bad_data>::table_name="bad_data";
+template <> const char *db_table<bad_data>::_search_tag=table_name;
template <> const int db_table<bad_data>::_nfields=3;
-template <> const char * const db_table<bad_data>::column_names[3]={"name","beam""reason"};
+template <> const char *const db_table<bad_data>::column_names[3]= {"name","beam""reason"};
-bad_data::bad_data() :
- db_table<bad_data>(*this,-1),
- beam(0)
-{
- db_open();
- name[0]=0;
- reason[0]=0;
+bad_data::bad_data() :
+ db_table<bad_data>(*this,-1),
+ beam(0) {
+ db_open();
+ name[0]=0;
+ reason[0]=0;
}
-bad_data::bad_data(const bad_data &a) :
- db_table<bad_data>(*this,-1),
- beam(a.beam)
-{
- db_open();
- strcpy(name,a.name);
- strcpy(reason,a.reason);
+bad_data::bad_data(const bad_data &a) :
+ db_table<bad_data>(*this,-1),
+ beam(a.beam) {
+ db_open();
+ strcpy(name,a.name);
+ strcpy(reason,a.reason);
}
-bad_data::bad_data(const SQL_ROW &a) :
- db_table<bad_data>(*this,-1)
-{
- db_open();
- parse(a);
+bad_data::bad_data(const SQL_ROW &a) :
+ db_table<bad_data>(*this,-1) {
+ db_open();
+ parse(a);
}
-bad_data::bad_data(const std::string &s,const char *tag) :
- db_table<bad_data>(*this,-1)
-{
- db_open();
- if (xml_match_tag(s,tag)) {
- parse_xml(s,tag);
- } else {
- parse(s);
- }
+bad_data::bad_data(const std::string &s,const char *tag) :
+ db_table<bad_data>(*this,-1) {
+ db_open();
+ if (xml_match_tag(s,tag)) {
+ parse_xml(s,tag);
+ } else {
+ parse(s);
+ }
}
bad_data &bad_data::operator =(const bad_data &a) {
- if (&a != this) {
- beam=a.beam;
- strcpy(name,a.name);
- strcpy(reason,a.reason);
- }
- return (*this);
-}
-
-
-std::string bad_data::update_format() const
-{ std::ostringstream rv("");
-
- for (int i=2;i<3;i++) rv << "?,";
- rv << "?";
- return rv.str();
-}
-
-
-std::string bad_data::insert_format() const
-{ return std::string("?,")+update_format();
-}
-
-std::string bad_data::select_format() const
-{
-std::string rv("");
-for (int i=0; i<2;i++) rv+="?,";
-rv+="?";
-return rv;
-}
-
-std::string bad_data::print(int full_subtables, int show_ids, int no_refs) const
-{ std::ostringstream rv("");
-
- rv.precision(14);
- rv << "'" << name << "'";
- rv << ',';
- rv << beam;
- rv << ',';
- rv << "'" << reason << "'";
- return rv.str();
-}
-
-
-std::string bad_data::print_xml(int full_subtables, int show_ids, int no_refs,const char *tag) const
-{
- std::ostringstream rv("");
-
- rv.precision(14);
- rv << xml_indent() << '<' << tag << ">\n";
- xml_indent(2);
- {
- std::string enc_field=xml_encode_string(name,std::min(strlen(name),sizeof(name)));
- rv << xml_indent() << "<name>";
- rv << enc_field << "</name>\n";
- }
- rv << xml_indent() << "<beam>" << beam << "</beam>\n";
- {
- std::string enc_field=xml_encode_string(reason,std::min(strlen(reason),sizeof(reason)));
- rv << xml_indent() << "<reason>";
- rv << enc_field << "</reason>\n";
- }
- xml_indent(-2);
- rv << xml_indent() << "</" << tag << ">\n";
- return rv.str();
-}
-
-
- void bad_data::parse_xml(const std::string &s,const char *tag) {
- std::string field,sub;
- if (extract_xml_record(s,tag,field)) {
- std::string::size_type pos=0;
- if (extract_xml_record(field,"name",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::string::size_type epos=sub.find("<",pos);
- if (epos==std::string::npos) epos=sub.find('\n',pos);
- if (epos==std::string::npos) epos=pos+strlen(sub.c_str()+pos);
- std::vector<unsigned char> in(xml_decode_string<unsigned char>((const char *)sub.c_str()+pos,epos-pos));
- strncpy(name,(const char *)&(in.front()),std::min(in.size(),(size_t)20));
- name[std::min(in.size(),(size_t)19)]=0;
- }
- if (extract_xml_record(field,"beam",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> beam;
- }
- if (extract_xml_record(field,"reason",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::string::size_type epos=sub.find("<",pos);
- if (epos==std::string::npos) epos=sub.find('\n',pos);
- if (epos==std::string::npos) epos=pos+strlen(sub.c_str()+pos);
- std::vector<unsigned char> in(xml_decode_string<unsigned char>((const char *)sub.c_str()+pos,epos-pos));
- strncpy(reason,(const char *)&(in.front()),std::min(in.size(),(size_t)255));
- reason[std::min(in.size(),(size_t)254)]=0;
- }
- }
- }
-
- void bad_data::parse(const SQL_ROW &s) {
- {
- strncpy(name,s[0]->c_str(),20);
- name[19]=0;
- }
- {
- std::istringstream row(*(s[1]));
- row >> beam;
- }
- {
- strncpy(reason,s[2]->c_str(),255);
- reason[254]=0;
- }
- }
-
- void bad_data::parse(const std::string &s) {
- SQL_ROW row(&s,3);
- parse(row);
- }
-
-template <> const char * const db_table<spike_tinysky>::table_name="spike_tinysky";
-template <> const char * db_table<spike_tinysky>::_search_tag=table_name;
+ if (&a != this) {
+ beam=a.beam;
+ strcpy(name,a.name);
+ strcpy(reason,a.reason);
+ }
+ return (*this);
+}
+
+
+std::string bad_data::update_format() const {
+ std::ostringstream rv("");
+
+ for (int i=2; i<3; i++) {
+ rv << "?,";
+ }
+ rv << "?";
+ return rv.str();
+}
+
+
+std::string bad_data::insert_format() const {
+ return std::string("?,")+update_format();
+}
+
+std::string bad_data::select_format() const {
+ std::string rv("");
+ for (int i=0; i<2; i++) {
+ rv+="?,";
+ }
+ rv+="?";
+ return rv;
+}
+
+std::string bad_data::print(int full_subtables, int show_ids, int no_refs) const {
+ std::ostringstream rv("");
+
+ rv.precision(14);
+ rv << "'" << name << "'";
+ rv << ',';
+ rv << beam;
+ rv << ',';
+ rv << "'" << reason << "'";
+ return rv.str();
+}
+
+
+std::string bad_data::print_xml(int full_subtables, int show_ids, int no_refs,const char *tag) const {
+ std::ostringstream rv("");
+
+ rv.precision(14);
+ rv << xml_indent() << '<' << tag << ">\n";
+ xml_indent(2);
+ {
+ std::string enc_field=xml_encode_string(name,std::min(strlen(name),sizeof(name)));
+ rv << xml_indent() << "<name>";
+ rv << enc_field << "</name>\n";
+ }
+ rv << xml_indent() << "<beam>" << beam << "</beam>\n";
+ {
+ std::string enc_field=xml_encode_string(reason,std::min(strlen(reason),sizeof(reason)));
+ rv << xml_indent() << "<reason>";
+ rv << enc_field << "</reason>\n";
+ }
+ xml_indent(-2);
+ rv << xml_indent() << "</" << tag << ">\n";
+ return rv.str();
+}
+
+
+void bad_data::parse_xml(const std::string &s,const char *tag) {
+ std::string field,sub;
+ if (extract_xml_record(s,tag,field)) {
+ std::string::size_type pos=0;
+ if (extract_xml_record(field,"name",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::string::size_type epos=sub.find("<",pos);
+ if (epos==std::string::npos) {
+ epos=sub.find('\n',pos);
+ }
+ if (epos==std::string::npos) {
+ epos=pos+strlen(sub.c_str()+pos);
+ }
+ std::vector<unsigned char> in(xml_decode_string<unsigned char>((const char *)sub.c_str()+pos,epos-pos));
+ strncpy(name,(const char *)&(in.front()),std::min(in.size(),(size_t)20));
+ name[std::min(in.size(),(size_t)19)]=0;
+ }
+ if (extract_xml_record(field,"beam",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> beam;
+ }
+ if (extract_xml_record(field,"reason",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::string::size_type epos=sub.find("<",pos);
+ if (epos==std::string::npos) {
+ epos=sub.find('\n',pos);
+ }
+ if (epos==std::string::npos) {
+ epos=pos+strlen(sub.c_str()+pos);
+ }
+ std::vector<unsigned char> in(xml_decode_string<unsigned char>((const char *)sub.c_str()+pos,epos-pos));
+ strncpy(reason,(const char *)&(in.front()),std::min(in.size(),(size_t)255));
+ reason[std::min(in.size(),(size_t)254)]=0;
+ }
+ }
+}
+
+void bad_data::parse(const SQL_ROW &s) {
+ {
+ strncpy(name,s[0]->c_str(),20);
+ name[19]=0;
+ }
+ {
+ std::istringstream row(*(s[1]));
+ row >> beam;
+ }
+ {
+ strncpy(reason,s[2]->c_str(),255);
+ reason[254]=0;
+ }
+}
+
+void bad_data::parse(const std::string &s) {
+ SQL_ROW row(&s,3);
+ parse(row);
+}
+
+template <> const char *const db_table<spike_tinysky>::table_name="spike_tinysky";
+template <> const char *db_table<spike_tinysky>::_search_tag=table_name;
template <> const int db_table<spike_tinysky>::_nfields=16;
-template <> const char * const db_table<spike_tinysky>::column_names[16]={"id","result_id","peak_power","mean_power","time","ra","decl","q_pix","freq","detection_freq","barycentric_freq","fft_len","chirp_rate","rfi_checked","rfi_found","reserved"};
-
-spike_tinysky::spike_tinysky() :
- db_table<spike_tinysky>(*this,-1),
- id(0),
- result_id(),
- peak_power(0),
- mean_power(0),
- time(0),
- ra(0),
- decl(0),
- q_pix(0),
- freq(0),
- detection_freq(0),
- barycentric_freq(0),
- fft_len(0),
- chirp_rate(0),
- rfi_checked(0),
- rfi_found(0),
- reserved(0)
-{
- db_open();
-}
-
-
-spike_tinysky::spike_tinysky(const spike_tinysky &a) :
- db_table<spike_tinysky>(*this,-1),
- id(a.id),
- result_id(a.result_id),
- peak_power(a.peak_power),
- mean_power(a.mean_power),
- time(a.time),
- ra(a.ra),
- decl(a.decl),
- q_pix(a.q_pix),
- freq(a.freq),
- detection_freq(a.detection_freq),
- barycentric_freq(a.barycentric_freq),
- fft_len(a.fft_len),
- chirp_rate(a.chirp_rate),
- rfi_checked(a.rfi_checked),
- rfi_found(a.rfi_found),
- reserved(a.reserved)
-{
- db_open();
-}
-
-
-spike_tinysky::spike_tinysky(const SQL_ROW &a) :
- db_table<spike_tinysky>(*this,-1)
-{
- db_open();
- parse(a);
-}
-
-
-spike_tinysky::spike_tinysky(const std::string &s,const char *tag) :
- db_table<spike_tinysky>(*this,-1)
-{
- db_open();
- if (xml_match_tag(s,tag)) {
- parse_xml(s,tag);
- } else {
- parse(s);
- }
+template <> const char *const db_table<spike_tinysky>::column_names[16]= {"id","result_id","peak_power","mean_power","time","ra","decl","q_pix","freq","detection_freq","barycentric_freq","fft_len","chirp_rate","rfi_checked","rfi_found","reserved"};
+
+spike_tinysky::spike_tinysky() :
+ db_table<spike_tinysky>(*this,-1),
+ id(0),
+ result_id(),
+ peak_power(0),
+ mean_power(0),
+ time(0),
+ ra(0),
+ decl(0),
+ q_pix(0),
+ freq(0),
+ detection_freq(0),
+ barycentric_freq(0),
+ fft_len(0),
+ chirp_rate(0),
+ rfi_checked(0),
+ rfi_found(0),
+ reserved(0) {
+ db_open();
+}
+
+
+spike_tinysky::spike_tinysky(const spike_tinysky &a) :
+ db_table<spike_tinysky>(*this,-1),
+ id(a.id),
+ result_id(a.result_id),
+ peak_power(a.peak_power),
+ mean_power(a.mean_power),
+ time(a.time),
+ ra(a.ra),
+ decl(a.decl),
+ q_pix(a.q_pix),
+ freq(a.freq),
+ detection_freq(a.detection_freq),
+ barycentric_freq(a.barycentric_freq),
+ fft_len(a.fft_len),
+ chirp_rate(a.chirp_rate),
+ rfi_checked(a.rfi_checked),
+ rfi_found(a.rfi_found),
+ reserved(a.reserved) {
+ db_open();
+}
+
+
+spike_tinysky::spike_tinysky(const SQL_ROW &a) :
+ db_table<spike_tinysky>(*this,-1) {
+ db_open();
+ parse(a);
+}
+
+
+spike_tinysky::spike_tinysky(const std::string &s,const char *tag) :
+ db_table<spike_tinysky>(*this,-1) {
+ db_open();
+ if (xml_match_tag(s,tag)) {
+ parse_xml(s,tag);
+ } else {
+ parse(s);
+ }
}
spike_tinysky &spike_tinysky::operator =(const spike_tinysky &a) {
- if (&a != this) {
- id=a.id;
- result_id=a.result_id;
- peak_power=a.peak_power;
- mean_power=a.mean_power;
- time=a.time;
- ra=a.ra;
- decl=a.decl;
- q_pix=a.q_pix;
- freq=a.freq;
- detection_freq=a.detection_freq;
- barycentric_freq=a.barycentric_freq;
- fft_len=a.fft_len;
- chirp_rate=a.chirp_rate;
- rfi_checked=a.rfi_checked;
- rfi_found=a.rfi_found;
- reserved=a.reserved;
- }
- return (*this);
-}
-
-
-std::string spike_tinysky::update_format() const
-{ std::ostringstream rv("");
-
- for (int i=2;i<16;i++) rv << "?,";
- rv << "?";
- return rv.str();
-}
-
-
-std::string spike_tinysky::insert_format() const
-{ return std::string("?,")+update_format();
-}
-
-std::string spike_tinysky::select_format() const
-{
-std::string rv("");
-for (int i=0; i<15;i++) rv+="?,";
-rv+="?";
-return rv;
-}
-
-std::string spike_tinysky::print(int full_subtables, int show_ids, int no_refs) const
-{ std::ostringstream rv("");
-
- rv.precision(14);
- if (show_ids) rv << id;
- rv << ',';
- if (!no_refs) {
- if (full_subtables) {
- rv << result_id.print(full_subtables,show_ids,no_refs);
- } else {
- rv << result_id.id;
- }
- }
- rv << ',';
- rv << peak_power;
- rv << ',';
- rv << mean_power;
- rv << ',';
- rv << time;
- rv << ',';
- rv << ra;
- rv << ',';
- rv << decl;
- rv << ',';
- rv << q_pix;
- rv << ',';
- rv << freq;
- rv << ',';
- rv << detection_freq;
- rv << ',';
- rv << barycentric_freq;
- rv << ',';
- rv << fft_len;
- rv << ',';
- rv << chirp_rate;
- rv << ',';
- rv << rfi_checked;
- rv << ',';
- rv << rfi_found;
- rv << ',';
- rv << reserved;
- return rv.str();
-}
-
-
-std::string spike_tinysky::print_xml(int full_subtables, int show_ids, int no_refs,const char *tag) const
-{
- std::ostringstream rv("");
-
- rv.precision(14);
- rv << xml_indent() << '<' << tag << ">\n";
- xml_indent(2);
- if (show_ids) rv << xml_indent() << "<id>" << id << "</id>\n";
- if (!no_refs) {
- if (full_subtables) {
- rv << result_id.print_xml(full_subtables,show_ids,no_refs,"result_id");
- } else {
- rv << xml_indent() << "<result_id><id>" << result_id.id << "</id></result_id>\n";
- }
- }
- rv << xml_indent() << "<peak_power>" << peak_power << "</peak_power>\n";
- rv << xml_indent() << "<mean_power>" << mean_power << "</mean_power>\n";
- rv << xml_indent() << "<time>" << time << "</time>\n";
- rv << xml_indent() << "<ra>" << ra << "</ra>\n";
- rv << xml_indent() << "<decl>" << decl << "</decl>\n";
- rv << xml_indent() << "<q_pix>" << q_pix << "</q_pix>\n";
- rv << xml_indent() << "<freq>" << freq << "</freq>\n";
- rv << xml_indent() << "<detection_freq>" << detection_freq << "</detection_freq>\n";
- rv << xml_indent() << "<barycentric_freq>" << barycentric_freq << "</barycentric_freq>\n";
- rv << xml_indent() << "<fft_len>" << fft_len << "</fft_len>\n";
- rv << xml_indent() << "<chirp_rate>" << chirp_rate << "</chirp_rate>\n";
- rv << xml_indent() << "<rfi_checked>" << rfi_checked << "</rfi_checked>\n";
- rv << xml_indent() << "<rfi_found>" << rfi_found << "</rfi_found>\n";
- rv << xml_indent() << "<reserved>" << reserved << "</reserved>\n";
- xml_indent(-2);
- rv << xml_indent() << "</" << tag << ">\n";
- return rv.str();
-}
-
-
- void spike_tinysky::parse_xml(const std::string &s,const char *tag) {
- std::string field,sub;
- if (extract_xml_record(s,tag,field)) {
- std::string::size_type pos=0;
- if (extract_xml_record(field,"id",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> id;
- }
- if (extract_xml_record(field,"result_id",sub)) {
- result_id.parse_xml(sub,"result_id");
- }
- if (extract_xml_record(field,"peak_power",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> peak_power;
- }
- if (extract_xml_record(field,"mean_power",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> mean_power;
- }
- if (extract_xml_record(field,"time",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> time;
- }
- if (extract_xml_record(field,"ra",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> ra;
- }
- if (extract_xml_record(field,"decl",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> decl;
- }
- if (extract_xml_record(field,"q_pix",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> q_pix;
- }
- if (extract_xml_record(field,"freq",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> freq;
- }
- if (extract_xml_record(field,"detection_freq",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> detection_freq;
- }
- if (extract_xml_record(field,"barycentric_freq",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> barycentric_freq;
- }
- if (extract_xml_record(field,"fft_len",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> fft_len;
- }
- if (extract_xml_record(field,"chirp_rate",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> chirp_rate;
- }
- if (extract_xml_record(field,"rfi_checked",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> rfi_checked;
- }
- if (extract_xml_record(field,"rfi_found",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> rfi_found;
- }
- if (extract_xml_record(field,"reserved",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> reserved;
- }
- }
- }
-
- void spike_tinysky::parse(const SQL_ROW &s) {
- {
- std::istringstream row(*(s[0]));
- row >> id;
- }
- {
- result_id.parse(SQL_ROW(s[1],0));
- }
- {
- std::istringstream row(*(s[2]));
- row >> peak_power;
- }
- {
- std::istringstream row(*(s[3]));
- row >> mean_power;
- }
- {
- std::istringstream row(*(s[4]));
- row >> time;
- }
- {
- std::istringstream row(*(s[5]));
- row >> ra;
- }
- {
- std::istringstream row(*(s[6]));
- row >> decl;
- }
- {
- std::istringstream row(*(s[7]));
- row >> q_pix;
- }
- {
- std::istringstream row(*(s[8]));
- row >> freq;
- }
- {
- std::istringstream row(*(s[9]));
- row >> detection_freq;
- }
- {
- std::istringstream row(*(s[10]));
- row >> barycentric_freq;
- }
- {
- std::istringstream row(*(s[11]));
- row >> fft_len;
- }
- {
- std::istringstream row(*(s[12]));
- row >> chirp_rate;
- }
- {
- std::istringstream row(*(s[13]));
- row >> rfi_checked;
- }
- {
- std::istringstream row(*(s[14]));
- row >> rfi_found;
- }
- {
- std::istringstream row(*(s[15]));
- row >> reserved;
- }
- }
-
- void spike_tinysky::parse(const std::string &s) {
- SQL_ROW row(&s,16);
- parse(row);
- }
-
-template <> const char * const db_table<gaussian_tinysky>::table_name="gaussian_tinysky";
-template <> const char * db_table<gaussian_tinysky>::_search_tag=table_name;
+ if (&a != this) {
+ id=a.id;
+ result_id=a.result_id;
+ peak_power=a.peak_power;
+ mean_power=a.mean_power;
+ time=a.time;
+ ra=a.ra;
+ decl=a.decl;
+ q_pix=a.q_pix;
+ freq=a.freq;
+ detection_freq=a.detection_freq;
+ barycentric_freq=a.barycentric_freq;
+ fft_len=a.fft_len;
+ chirp_rate=a.chirp_rate;
+ rfi_checked=a.rfi_checked;
+ rfi_found=a.rfi_found;
+ reserved=a.reserved;
+ }
+ return (*this);
+}
+
+
+std::string spike_tinysky::update_format() const {
+ std::ostringstream rv("");
+
+ for (int i=2; i<16; i++) {
+ rv << "?,";
+ }
+ rv << "?";
+ return rv.str();
+}
+
+
+std::string spike_tinysky::insert_format() const {
+ return std::string("?,")+update_format();
+}
+
+std::string spike_tinysky::select_format() const {
+ std::string rv("");
+ for (int i=0; i<15; i++) {
+ rv+="?,";
+ }
+ rv+="?";
+ return rv;
+}
+
+std::string spike_tinysky::print(int full_subtables, int show_ids, int no_refs) const {
+ std::ostringstream rv("");
+
+ rv.precision(14);
+ if (show_ids) {
+ rv << id;
+ }
+ rv << ',';
+ if (!no_refs) {
+ if (full_subtables) {
+ rv << result_id.print(full_subtables,show_ids,no_refs);
+ } else {
+ rv << result_id.id;
+ }
+ }
+ rv << ',';
+ rv << peak_power;
+ rv << ',';
+ rv << mean_power;
+ rv << ',';
+ rv << time;
+ rv << ',';
+ rv << ra;
+ rv << ',';
+ rv << decl;
+ rv << ',';
+ rv << q_pix;
+ rv << ',';
+ rv << freq;
+ rv << ',';
+ rv << detection_freq;
+ rv << ',';
+ rv << barycentric_freq;
+ rv << ',';
+ rv << fft_len;
+ rv << ',';
+ rv << chirp_rate;
+ rv << ',';
+ rv << rfi_checked;
+ rv << ',';
+ rv << rfi_found;
+ rv << ',';
+ rv << reserved;
+ return rv.str();
+}
+
+
+std::string spike_tinysky::print_xml(int full_subtables, int show_ids, int no_refs,const char *tag) const {
+ std::ostringstream rv("");
+
+ rv.precision(14);
+ rv << xml_indent() << '<' << tag << ">\n";
+ xml_indent(2);
+ if (show_ids) {
+ rv << xml_indent() << "<id>" << id << "</id>\n";
+ }
+ if (!no_refs) {
+ if (full_subtables) {
+ rv << result_id.print_xml(full_subtables,show_ids,no_refs,"result_id");
+ } else {
+ rv << xml_indent() << "<result_id><id>" << result_id.id << "</id></result_id>\n";
+ }
+ }
+ rv << xml_indent() << "<peak_power>" << peak_power << "</peak_power>\n";
+ rv << xml_indent() << "<mean_power>" << mean_power << "</mean_power>\n";
+ rv << xml_indent() << "<time>" << time << "</time>\n";
+ rv << xml_indent() << "<ra>" << ra << "</ra>\n";
+ rv << xml_indent() << "<decl>" << decl << "</decl>\n";
+ rv << xml_indent() << "<q_pix>" << q_pix << "</q_pix>\n";
+ rv << xml_indent() << "<freq>" << freq << "</freq>\n";
+ rv << xml_indent() << "<detection_freq>" << detection_freq << "</detection_freq>\n";
+ rv << xml_indent() << "<barycentric_freq>" << barycentric_freq << "</barycentric_freq>\n";
+ rv << xml_indent() << "<fft_len>" << fft_len << "</fft_len>\n";
+ rv << xml_indent() << "<chirp_rate>" << chirp_rate << "</chirp_rate>\n";
+ rv << xml_indent() << "<rfi_checked>" << rfi_checked << "</rfi_checked>\n";
+ rv << xml_indent() << "<rfi_found>" << rfi_found << "</rfi_found>\n";
+ rv << xml_indent() << "<reserved>" << reserved << "</reserved>\n";
+ xml_indent(-2);
+ rv << xml_indent() << "</" << tag << ">\n";
+ return rv.str();
+}
+
+
+void spike_tinysky::parse_xml(const std::string &s,const char *tag) {
+ std::string field,sub;
+ if (extract_xml_record(s,tag,field)) {
+ std::string::size_type pos=0;
+ if (extract_xml_record(field,"id",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> id;
+ }
+ if (extract_xml_record(field,"result_id",sub)) {
+ result_id.parse_xml(sub,"result_id");
+ }
+ if (extract_xml_record(field,"peak_power",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> peak_power;
+ }
+ if (extract_xml_record(field,"mean_power",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> mean_power;
+ }
+ if (extract_xml_record(field,"time",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> time;
+ }
+ if (extract_xml_record(field,"ra",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> ra;
+ }
+ if (extract_xml_record(field,"decl",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> decl;
+ }
+ if (extract_xml_record(field,"q_pix",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> q_pix;
+ }
+ if (extract_xml_record(field,"freq",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> freq;
+ }
+ if (extract_xml_record(field,"detection_freq",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> detection_freq;
+ }
+ if (extract_xml_record(field,"barycentric_freq",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> barycentric_freq;
+ }
+ if (extract_xml_record(field,"fft_len",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> fft_len;
+ }
+ if (extract_xml_record(field,"chirp_rate",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> chirp_rate;
+ }
+ if (extract_xml_record(field,"rfi_checked",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> rfi_checked;
+ }
+ if (extract_xml_record(field,"rfi_found",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> rfi_found;
+ }
+ if (extract_xml_record(field,"reserved",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> reserved;
+ }
+ }
+}
+
+void spike_tinysky::parse(const SQL_ROW &s) {
+ {
+ std::istringstream row(*(s[0]));
+ row >> id;
+ }
+ {
+ result_id.parse(SQL_ROW(s[1],0));
+ }
+ {
+ std::istringstream row(*(s[2]));
+ row >> peak_power;
+ }
+ {
+ std::istringstream row(*(s[3]));
+ row >> mean_power;
+ }
+ {
+ std::istringstream row(*(s[4]));
+ row >> time;
+ }
+ {
+ std::istringstream row(*(s[5]));
+ row >> ra;
+ }
+ {
+ std::istringstream row(*(s[6]));
+ row >> decl;
+ }
+ {
+ std::istringstream row(*(s[7]));
+ row >> q_pix;
+ }
+ {
+ std::istringstream row(*(s[8]));
+ row >> freq;
+ }
+ {
+ std::istringstream row(*(s[9]));
+ row >> detection_freq;
+ }
+ {
+ std::istringstream row(*(s[10]));
+ row >> barycentric_freq;
+ }
+ {
+ std::istringstream row(*(s[11]));
+ row >> fft_len;
+ }
+ {
+ std::istringstream row(*(s[12]));
+ row >> chirp_rate;
+ }
+ {
+ std::istringstream row(*(s[13]));
+ row >> rfi_checked;
+ }
+ {
+ std::istringstream row(*(s[14]));
+ row >> rfi_found;
+ }
+ {
+ std::istringstream row(*(s[15]));
+ row >> reserved;
+ }
+}
+
+void spike_tinysky::parse(const std::string &s) {
+ SQL_ROW row(&s,16);
+ parse(row);
+}
+
+template <> const char *const db_table<gaussian_tinysky>::table_name="gaussian_tinysky";
+template <> const char *db_table<gaussian_tinysky>::_search_tag=table_name;
template <> const int db_table<gaussian_tinysky>::_nfields=22;
-template <> const char * const db_table<gaussian_tinysky>::column_names[22]={"id","result_id","peak_power","mean_power","time","ra","decl","q_pix","freq","detection_freq","barycentric_freq","fft_len","chirp_rate","rfi_checked","rfi_found","reserved","sigma","chisqr","null_chisqr","score","max_power","pot"};
-
-gaussian_tinysky::gaussian_tinysky() :
- db_table<gaussian_tinysky>(*this,-1),
- id(0),
- result_id(),
- peak_power(0),
- mean_power(0),
- time(0),
- ra(0),
- decl(0),
- q_pix(0),
- freq(0),
- detection_freq(0),
- barycentric_freq(0),
- fft_len(0),
- chirp_rate(0),
- rfi_checked(0),
- rfi_found(0),
- reserved(0),
- sigma(0),
- chisqr(0),
- null_chisqr(0),
- score(0),
- max_power(0),
- pot((unsigned char *)0,0,_x_csv)
-{
- db_open();
-}
-
-
-gaussian_tinysky::gaussian_tinysky(const gaussian_tinysky &a) :
- db_table<gaussian_tinysky>(*this,-1),
- id(a.id),
- result_id(a.result_id),
- peak_power(a.peak_power),
- mean_power(a.mean_power),
- time(a.time),
- ra(a.ra),
- decl(a.decl),
- q_pix(a.q_pix),
- freq(a.freq),
- detection_freq(a.detection_freq),
- barycentric_freq(a.barycentric_freq),
- fft_len(a.fft_len),
- chirp_rate(a.chirp_rate),
- rfi_checked(a.rfi_checked),
- rfi_found(a.rfi_found),
- reserved(a.reserved),
- sigma(a.sigma),
- chisqr(a.chisqr),
- null_chisqr(a.null_chisqr),
- score(a.score),
- max_power(a.max_power),
- pot(a.pot)
-{
- db_open();
-}
-
-
-gaussian_tinysky::gaussian_tinysky(const SQL_ROW &a) :
- db_table<gaussian_tinysky>(*this,-1)
-{
- db_open();
- parse(a);
-}
-
-
-gaussian_tinysky::gaussian_tinysky(const std::string &s,const char *tag) :
- db_table<gaussian_tinysky>(*this,-1)
-{
- db_open();
- if (xml_match_tag(s,tag)) {
- parse_xml(s,tag);
- } else {
- parse(s);
- }
+template <> const char *const db_table<gaussian_tinysky>::column_names[22]= {"id","result_id","peak_power","mean_power","time","ra","decl","q_pix","freq","detection_freq","barycentric_freq","fft_len","chirp_rate","rfi_checked","rfi_found","reserved","sigma","chisqr","null_chisqr","score","max_power","pot"};
+
+gaussian_tinysky::gaussian_tinysky() :
+ db_table<gaussian_tinysky>(*this,-1),
+ id(0),
+ result_id(),
+ peak_power(0),
+ mean_power(0),
+ time(0),
+ ra(0),
+ decl(0),
+ q_pix(0),
+ freq(0),
+ detection_freq(0),
+ barycentric_freq(0),
+ fft_len(0),
+ chirp_rate(0),
+ rfi_checked(0),
+ rfi_found(0),
+ reserved(0),
+ sigma(0),
+ chisqr(0),
+ null_chisqr(0),
+ score(0),
+ max_power(0),
+ pot((unsigned char *)0,0,_x_csv) {
+ db_open();
+}
+
+
+gaussian_tinysky::gaussian_tinysky(const gaussian_tinysky &a) :
+ db_table<gaussian_tinysky>(*this,-1),
+ id(a.id),
+ result_id(a.result_id),
+ peak_power(a.peak_power),
+ mean_power(a.mean_power),
+ time(a.time),
+ ra(a.ra),
+ decl(a.decl),
+ q_pix(a.q_pix),
+ freq(a.freq),
+ detection_freq(a.detection_freq),
+ barycentric_freq(a.barycentric_freq),
+ fft_len(a.fft_len),
+ chirp_rate(a.chirp_rate),
+ rfi_checked(a.rfi_checked),
+ rfi_found(a.rfi_found),
+ reserved(a.reserved),
+ sigma(a.sigma),
+ chisqr(a.chisqr),
+ null_chisqr(a.null_chisqr),
+ score(a.score),
+ max_power(a.max_power),
+ pot(a.pot) {
+ db_open();
+}
+
+
+gaussian_tinysky::gaussian_tinysky(const SQL_ROW &a) :
+ db_table<gaussian_tinysky>(*this,-1) {
+ db_open();
+ parse(a);
+}
+
+
+gaussian_tinysky::gaussian_tinysky(const std::string &s,const char *tag) :
+ db_table<gaussian_tinysky>(*this,-1) {
+ db_open();
+ if (xml_match_tag(s,tag)) {
+ parse_xml(s,tag);
+ } else {
+ parse(s);
+ }
}
gaussian_tinysky &gaussian_tinysky::operator =(const gaussian_tinysky &a) {
- if (&a != this) {
- id=a.id;
- result_id=a.result_id;
- peak_power=a.peak_power;
- mean_power=a.mean_power;
- time=a.time;
- ra=a.ra;
- decl=a.decl;
- q_pix=a.q_pix;
- freq=a.freq;
- detection_freq=a.detection_freq;
- barycentric_freq=a.barycentric_freq;
- fft_len=a.fft_len;
- chirp_rate=a.chirp_rate;
- rfi_checked=a.rfi_checked;
- rfi_found=a.rfi_found;
- reserved=a.reserved;
- sigma=a.sigma;
- chisqr=a.chisqr;
- null_chisqr=a.null_chisqr;
- score=a.score;
- max_power=a.max_power;
- pot=a.pot;
- }
- return (*this);
-}
-
-
-std::string gaussian_tinysky::update_format() const
-{ std::ostringstream rv("");
-
- for (int i=2;i<22;i++) rv << "?,";
- rv << "?";
- return rv.str();
-}
-
-
-std::string gaussian_tinysky::insert_format() const
-{ return std::string("?,")+update_format();
-}
-
-std::string gaussian_tinysky::select_format() const
-{
-std::string rv("");
-for (int i=0; i<21;i++) rv+="?,";
-rv+="?";
-return rv;
-}
-
-std::string gaussian_tinysky::print(int full_subtables, int show_ids, int no_refs) const
-{ std::ostringstream rv("");
-
- rv.precision(14);
- if (show_ids) rv << id;
- rv << ',';
- if (!no_refs) {
- if (full_subtables) {
- rv << result_id.print(full_subtables,show_ids,no_refs);
- } else {
- rv << result_id.id;
- }
- }
- rv << ',';
- rv << peak_power;
- rv << ',';
- rv << mean_power;
- rv << ',';
- rv << time;
- rv << ',';
- rv << ra;
- rv << ',';
- rv << decl;
- rv << ',';
- rv << q_pix;
- rv << ',';
- rv << freq;
- rv << ',';
- rv << detection_freq;
- rv << ',';
- rv << barycentric_freq;
- rv << ',';
- rv << fft_len;
- rv << ',';
- rv << chirp_rate;
- rv << ',';
- rv << rfi_checked;
- rv << ',';
- rv << rfi_found;
- rv << ',';
- rv << reserved;
- rv << ',';
- rv << sigma;
- rv << ',';
- rv << chisqr;
- rv << ',';
- rv << null_chisqr;
- rv << ',';
- rv << score;
- rv << ',';
- rv << max_power;
- rv << ',';
- rv << "<BYTE len=" << std::max(pot.size()*2,(size_t)1) << ">" << pot.print_hex() ;
- return rv.str();
-}
-
-
-std::string gaussian_tinysky::print_xml(int full_subtables, int show_ids, int no_refs,const char *tag) const
-{
- std::ostringstream rv("");
-
- rv.precision(14);
- rv << xml_indent() << '<' << tag << ">\n";
- xml_indent(2);
- if (show_ids) rv << xml_indent() << "<id>" << id << "</id>\n";
- if (!no_refs) {
- if (full_subtables) {
- rv << result_id.print_xml(full_subtables,show_ids,no_refs,"result_id");
- } else {
- rv << xml_indent() << "<result_id><id>" << result_id.id << "</id></result_id>\n";
- }
- }
- rv << xml_indent() << "<peak_power>" << peak_power << "</peak_power>\n";
- rv << xml_indent() << "<mean_power>" << mean_power << "</mean_power>\n";
- rv << xml_indent() << "<time>" << time << "</time>\n";
- rv << xml_indent() << "<ra>" << ra << "</ra>\n";
- rv << xml_indent() << "<decl>" << decl << "</decl>\n";
- rv << xml_indent() << "<q_pix>" << q_pix << "</q_pix>\n";
- rv << xml_indent() << "<freq>" << freq << "</freq>\n";
- rv << xml_indent() << "<detection_freq>" << detection_freq << "</detection_freq>\n";
- rv << xml_indent() << "<barycentric_freq>" << barycentric_freq << "</barycentric_freq>\n";
- rv << xml_indent() << "<fft_len>" << fft_len << "</fft_len>\n";
- rv << xml_indent() << "<chirp_rate>" << chirp_rate << "</chirp_rate>\n";
- rv << xml_indent() << "<rfi_checked>" << rfi_checked << "</rfi_checked>\n";
- rv << xml_indent() << "<rfi_found>" << rfi_found << "</rfi_found>\n";
- rv << xml_indent() << "<reserved>" << reserved << "</reserved>\n";
- rv << xml_indent() << "<sigma>" << sigma << "</sigma>\n";
- rv << xml_indent() << "<chisqr>" << chisqr << "</chisqr>\n";
- rv << xml_indent() << "<null_chisqr>" << null_chisqr << "</null_chisqr>\n";
- rv << xml_indent() << "<score>" << score << "</score>\n";
- rv << xml_indent() << "<max_power>" << max_power << "</max_power>\n";
- if (pot.size()) {
- std::string enc_field=xml_encode_string(pot,pot.encoding);
- rv << xml_indent() << "<pot length=" << enc_field.size() << " encoding=\"" << xml_encoding_names[pot.encoding] << "\">";
- rv << enc_field << "</pot>\n";
- }
- xml_indent(-2);
- rv << xml_indent() << "</" << tag << ">\n";
- return rv.str();
-}
-
-
- void gaussian_tinysky::parse_xml(const std::string &s,const char *tag) {
- std::string field,sub;
- if (extract_xml_record(s,tag,field)) {
- std::string::size_type pos=0;
- if (extract_xml_record(field,"id",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> id;
- }
- if (extract_xml_record(field,"result_id",sub)) {
- result_id.parse_xml(sub,"result_id");
- }
- if (extract_xml_record(field,"peak_power",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> peak_power;
- }
- if (extract_xml_record(field,"mean_power",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> mean_power;
- }
- if (extract_xml_record(field,"time",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> time;
- }
- if (extract_xml_record(field,"ra",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> ra;
- }
- if (extract_xml_record(field,"decl",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> decl;
- }
- if (extract_xml_record(field,"q_pix",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> q_pix;
- }
- if (extract_xml_record(field,"freq",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> freq;
- }
- if (extract_xml_record(field,"detection_freq",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> detection_freq;
- }
- if (extract_xml_record(field,"barycentric_freq",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> barycentric_freq;
- }
- if (extract_xml_record(field,"fft_len",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> fft_len;
- }
- if (extract_xml_record(field,"chirp_rate",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> chirp_rate;
- }
- if (extract_xml_record(field,"rfi_checked",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> rfi_checked;
- }
- if (extract_xml_record(field,"rfi_found",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> rfi_found;
- }
- if (extract_xml_record(field,"reserved",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> reserved;
- }
- if (extract_xml_record(field,"sigma",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> sigma;
- }
- if (extract_xml_record(field,"chisqr",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> chisqr;
- }
- if (extract_xml_record(field,"null_chisqr",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> null_chisqr;
- }
- if (extract_xml_record(field,"score",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> score;
- }
- if (extract_xml_record(field,"max_power",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> max_power;
- }
- if (extract_xml_record(field,"pot",sub)) {
- std::istringstream in(sub.c_str());
- in >> pot;
- }
- }
- }
-
- void gaussian_tinysky::parse(const SQL_ROW &s) {
- {
- std::istringstream row(*(s[0]));
- row >> id;
- }
- {
- result_id.parse(SQL_ROW(s[1],0));
- }
- {
- std::istringstream row(*(s[2]));
- row >> peak_power;
- }
- {
- std::istringstream row(*(s[3]));
- row >> mean_power;
- }
- {
- std::istringstream row(*(s[4]));
- row >> time;
- }
- {
- std::istringstream row(*(s[5]));
- row >> ra;
- }
- {
- std::istringstream row(*(s[6]));
- row >> decl;
- }
- {
- std::istringstream row(*(s[7]));
- row >> q_pix;
- }
- {
- std::istringstream row(*(s[8]));
- row >> freq;
- }
- {
- std::istringstream row(*(s[9]));
- row >> detection_freq;
- }
- {
- std::istringstream row(*(s[10]));
- row >> barycentric_freq;
- }
- {
- std::istringstream row(*(s[11]));
- row >> fft_len;
- }
- {
- std::istringstream row(*(s[12]));
- row >> chirp_rate;
- }
- {
- std::istringstream row(*(s[13]));
- row >> rfi_checked;
- }
- {
- std::istringstream row(*(s[14]));
- row >> rfi_found;
- }
- {
- std::istringstream row(*(s[15]));
- row >> reserved;
- }
- {
- std::istringstream row(*(s[16]));
- row >> sigma;
- }
- {
- std::istringstream row(*(s[17]));
- row >> chisqr;
- }
- {
- std::istringstream row(*(s[18]));
- row >> null_chisqr;
- }
- {
- std::istringstream row(*(s[19]));
- row >> score;
- }
- {
- std::istringstream row(*(s[20]));
- row >> max_power;
- }
- {
- pot=sqlblob<unsigned char>(*(s[21]));
- }
- }
-
- void gaussian_tinysky::parse(const std::string &s) {
- SQL_ROW row(&s,22);
- parse(row);
- }
-
-template <> const char * const db_table<pulse_tinysky>::table_name="pulse_tinysky";
-template <> const char * db_table<pulse_tinysky>::_search_tag=table_name;
+ if (&a != this) {
+ id=a.id;
+ result_id=a.result_id;
+ peak_power=a.peak_power;
+ mean_power=a.mean_power;
+ time=a.time;
+ ra=a.ra;
+ decl=a.decl;
+ q_pix=a.q_pix;
+ freq=a.freq;
+ detection_freq=a.detection_freq;
+ barycentric_freq=a.barycentric_freq;
+ fft_len=a.fft_len;
+ chirp_rate=a.chirp_rate;
+ rfi_checked=a.rfi_checked;
+ rfi_found=a.rfi_found;
+ reserved=a.reserved;
+ sigma=a.sigma;
+ chisqr=a.chisqr;
+ null_chisqr=a.null_chisqr;
+ score=a.score;
+ max_power=a.max_power;
+ pot=a.pot;
+ }
+ return (*this);
+}
+
+
+std::string gaussian_tinysky::update_format() const {
+ std::ostringstream rv("");
+
+ for (int i=2; i<22; i++) {
+ rv << "?,";
+ }
+ rv << "?";
+ return rv.str();
+}
+
+
+std::string gaussian_tinysky::insert_format() const {
+ return std::string("?,")+update_format();
+}
+
+std::string gaussian_tinysky::select_format() const {
+ std::string rv("");
+ for (int i=0; i<21; i++) {
+ rv+="?,";
+ }
+ rv+="?";
+ return rv;
+}
+
+std::string gaussian_tinysky::print(int full_subtables, int show_ids, int no_refs) const {
+ std::ostringstream rv("");
+
+ rv.precision(14);
+ if (show_ids) {
+ rv << id;
+ }
+ rv << ',';
+ if (!no_refs) {
+ if (full_subtables) {
+ rv << result_id.print(full_subtables,show_ids,no_refs);
+ } else {
+ rv << result_id.id;
+ }
+ }
+ rv << ',';
+ rv << peak_power;
+ rv << ',';
+ rv << mean_power;
+ rv << ',';
+ rv << time;
+ rv << ',';
+ rv << ra;
+ rv << ',';
+ rv << decl;
+ rv << ',';
+ rv << q_pix;
+ rv << ',';
+ rv << freq;
+ rv << ',';
+ rv << detection_freq;
+ rv << ',';
+ rv << barycentric_freq;
+ rv << ',';
+ rv << fft_len;
+ rv << ',';
+ rv << chirp_rate;
+ rv << ',';
+ rv << rfi_checked;
+ rv << ',';
+ rv << rfi_found;
+ rv << ',';
+ rv << reserved;
+ rv << ',';
+ rv << sigma;
+ rv << ',';
+ rv << chisqr;
+ rv << ',';
+ rv << null_chisqr;
+ rv << ',';
+ rv << score;
+ rv << ',';
+ rv << max_power;
+ rv << ',';
+ rv << "<BYTE len=" << std::max(pot.size()*2,(size_t)1) << ">" << pot.print_hex() ;
+ return rv.str();
+}
+
+
+std::string gaussian_tinysky::print_xml(int full_subtables, int show_ids, int no_refs,const char *tag) const {
+ std::ostringstream rv("");
+
+ rv.precision(14);
+ rv << xml_indent() << '<' << tag << ">\n";
+ xml_indent(2);
+ if (show_ids) {
+ rv << xml_indent() << "<id>" << id << "</id>\n";
+ }
+ if (!no_refs) {
+ if (full_subtables) {
+ rv << result_id.print_xml(full_subtables,show_ids,no_refs,"result_id");
+ } else {
+ rv << xml_indent() << "<result_id><id>" << result_id.id << "</id></result_id>\n";
+ }
+ }
+ rv << xml_indent() << "<peak_power>" << peak_power << "</peak_power>\n";
+ rv << xml_indent() << "<mean_power>" << mean_power << "</mean_power>\n";
+ rv << xml_indent() << "<time>" << time << "</time>\n";
+ rv << xml_indent() << "<ra>" << ra << "</ra>\n";
+ rv << xml_indent() << "<decl>" << decl << "</decl>\n";
+ rv << xml_indent() << "<q_pix>" << q_pix << "</q_pix>\n";
+ rv << xml_indent() << "<freq>" << freq << "</freq>\n";
+ rv << xml_indent() << "<detection_freq>" << detection_freq << "</detection_freq>\n";
+ rv << xml_indent() << "<barycentric_freq>" << barycentric_freq << "</barycentric_freq>\n";
+ rv << xml_indent() << "<fft_len>" << fft_len << "</fft_len>\n";
+ rv << xml_indent() << "<chirp_rate>" << chirp_rate << "</chirp_rate>\n";
+ rv << xml_indent() << "<rfi_checked>" << rfi_checked << "</rfi_checked>\n";
+ rv << xml_indent() << "<rfi_found>" << rfi_found << "</rfi_found>\n";
+ rv << xml_indent() << "<reserved>" << reserved << "</reserved>\n";
+ rv << xml_indent() << "<sigma>" << sigma << "</sigma>\n";
+ rv << xml_indent() << "<chisqr>" << chisqr << "</chisqr>\n";
+ rv << xml_indent() << "<null_chisqr>" << null_chisqr << "</null_chisqr>\n";
+ rv << xml_indent() << "<score>" << score << "</score>\n";
+ rv << xml_indent() << "<max_power>" << max_power << "</max_power>\n";
+ if (pot.size()) {
+ std::string enc_field=xml_encode_string(pot,pot.encoding);
+ rv << xml_indent() << "<pot length=" << enc_field.size() << " encoding=\"" << xml_encoding_names[pot.encoding] << "\">";
+ rv << enc_field << "</pot>\n";
+ }
+ xml_indent(-2);
+ rv << xml_indent() << "</" << tag << ">\n";
+ return rv.str();
+}
+
+
+void gaussian_tinysky::parse_xml(const std::string &s,const char *tag) {
+ std::string field,sub;
+ if (extract_xml_record(s,tag,field)) {
+ std::string::size_type pos=0;
+ if (extract_xml_record(field,"id",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> id;
+ }
+ if (extract_xml_record(field,"result_id",sub)) {
+ result_id.parse_xml(sub,"result_id");
+ }
+ if (extract_xml_record(field,"peak_power",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> peak_power;
+ }
+ if (extract_xml_record(field,"mean_power",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> mean_power;
+ }
+ if (extract_xml_record(field,"time",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> time;
+ }
+ if (extract_xml_record(field,"ra",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> ra;
+ }
+ if (extract_xml_record(field,"decl",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> decl;
+ }
+ if (extract_xml_record(field,"q_pix",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> q_pix;
+ }
+ if (extract_xml_record(field,"freq",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> freq;
+ }
+ if (extract_xml_record(field,"detection_freq",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> detection_freq;
+ }
+ if (extract_xml_record(field,"barycentric_freq",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> barycentric_freq;
+ }
+ if (extract_xml_record(field,"fft_len",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> fft_len;
+ }
+ if (extract_xml_record(field,"chirp_rate",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> chirp_rate;
+ }
+ if (extract_xml_record(field,"rfi_checked",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> rfi_checked;
+ }
+ if (extract_xml_record(field,"rfi_found",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> rfi_found;
+ }
+ if (extract_xml_record(field,"reserved",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> reserved;
+ }
+ if (extract_xml_record(field,"sigma",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> sigma;
+ }
+ if (extract_xml_record(field,"chisqr",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> chisqr;
+ }
+ if (extract_xml_record(field,"null_chisqr",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> null_chisqr;
+ }
+ if (extract_xml_record(field,"score",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> score;
+ }
+ if (extract_xml_record(field,"max_power",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> max_power;
+ }
+ if (extract_xml_record(field,"pot",sub)) {
+ std::istringstream in(sub.c_str());
+ in >> pot;
+ }
+ }
+}
+
+void gaussian_tinysky::parse(const SQL_ROW &s) {
+ {
+ std::istringstream row(*(s[0]));
+ row >> id;
+ }
+ {
+ result_id.parse(SQL_ROW(s[1],0));
+ }
+ {
+ std::istringstream row(*(s[2]));
+ row >> peak_power;
+ }
+ {
+ std::istringstream row(*(s[3]));
+ row >> mean_power;
+ }
+ {
+ std::istringstream row(*(s[4]));
+ row >> time;
+ }
+ {
+ std::istringstream row(*(s[5]));
+ row >> ra;
+ }
+ {
+ std::istringstream row(*(s[6]));
+ row >> decl;
+ }
+ {
+ std::istringstream row(*(s[7]));
+ row >> q_pix;
+ }
+ {
+ std::istringstream row(*(s[8]));
+ row >> freq;
+ }
+ {
+ std::istringstream row(*(s[9]));
+ row >> detection_freq;
+ }
+ {
+ std::istringstream row(*(s[10]));
+ row >> barycentric_freq;
+ }
+ {
+ std::istringstream row(*(s[11]));
+ row >> fft_len;
+ }
+ {
+ std::istringstream row(*(s[12]));
+ row >> chirp_rate;
+ }
+ {
+ std::istringstream row(*(s[13]));
+ row >> rfi_checked;
+ }
+ {
+ std::istringstream row(*(s[14]));
+ row >> rfi_found;
+ }
+ {
+ std::istringstream row(*(s[15]));
+ row >> reserved;
+ }
+ {
+ std::istringstream row(*(s[16]));
+ row >> sigma;
+ }
+ {
+ std::istringstream row(*(s[17]));
+ row >> chisqr;
+ }
+ {
+ std::istringstream row(*(s[18]));
+ row >> null_chisqr;
+ }
+ {
+ std::istringstream row(*(s[19]));
+ row >> score;
+ }
+ {
+ std::istringstream row(*(s[20]));
+ row >> max_power;
+ }
+ {
+ pot=sqlblob<unsigned char>(*(s[21]));
+ }
+}
+
+void gaussian_tinysky::parse(const std::string &s) {
+ SQL_ROW row(&s,22);
+ parse(row);
+}
+
+template <> const char *const db_table<pulse_tinysky>::table_name="pulse_tinysky";
+template <> const char *db_table<pulse_tinysky>::_search_tag=table_name;
template <> const int db_table<pulse_tinysky>::_nfields=22;
-template <> const char * const db_table<pulse_tinysky>::column_names[22]={"id","result_id","peak_power","mean_power","time","ra","decl","q_pix","freq","detection_freq","barycentric_freq","fft_len","chirp_rate","rfi_checked","rfi_found","reserved","period","snr","thresh","score","len_prof","pot"};
-
-pulse_tinysky::pulse_tinysky() :
- db_table<pulse_tinysky>(*this,-1),
- id(0),
- result_id(),
- peak_power(0),
- mean_power(0),
- time(0),
- ra(0),
- decl(0),
- q_pix(0),
- freq(0),
- detection_freq(0),
- barycentric_freq(0),
- fft_len(0),
- chirp_rate(0),
- rfi_checked(0),
- rfi_found(0),
- reserved(0),
- period(0),
- snr(0),
- thresh(0),
- score(0),
- len_prof(0),
- pot((unsigned char *)0,0,_x_csv)
-{
- db_open();
-}
-
-
-pulse_tinysky::pulse_tinysky(const pulse_tinysky &a) :
- db_table<pulse_tinysky>(*this,-1),
- id(a.id),
- result_id(a.result_id),
- peak_power(a.peak_power),
- mean_power(a.mean_power),
- time(a.time),
- ra(a.ra),
- decl(a.decl),
- q_pix(a.q_pix),
- freq(a.freq),
- detection_freq(a.detection_freq),
- barycentric_freq(a.barycentric_freq),
- fft_len(a.fft_len),
- chirp_rate(a.chirp_rate),
- rfi_checked(a.rfi_checked),
- rfi_found(a.rfi_found),
- reserved(a.reserved),
- period(a.period),
- snr(a.snr),
- thresh(a.thresh),
- score(a.score),
- len_prof(a.len_prof),
- pot(a.pot)
-{
- db_open();
-}
-
-
-pulse_tinysky::pulse_tinysky(const SQL_ROW &a) :
- db_table<pulse_tinysky>(*this,-1)
-{
- db_open();
- parse(a);
-}
-
-
-pulse_tinysky::pulse_tinysky(const std::string &s,const char *tag) :
- db_table<pulse_tinysky>(*this,-1)
-{
- db_open();
- if (xml_match_tag(s,tag)) {
- parse_xml(s,tag);
- } else {
- parse(s);
- }
+template <> const char *const db_table<pulse_tinysky>::column_names[22]= {"id","result_id","peak_power","mean_power","time","ra","decl","q_pix","freq","detection_freq","barycentric_freq","fft_len","chirp_rate","rfi_checked","rfi_found","reserved","period","snr","thresh","score","len_prof","pot"};
+
+pulse_tinysky::pulse_tinysky() :
+ db_table<pulse_tinysky>(*this,-1),
+ id(0),
+ result_id(),
+ peak_power(0),
+ mean_power(0),
+ time(0),
+ ra(0),
+ decl(0),
+ q_pix(0),
+ freq(0),
+ detection_freq(0),
+ barycentric_freq(0),
+ fft_len(0),
+ chirp_rate(0),
+ rfi_checked(0),
+ rfi_found(0),
+ reserved(0),
+ period(0),
+ snr(0),
+ thresh(0),
+ score(0),
+ len_prof(0),
+ pot((unsigned char *)0,0,_x_csv) {
+ db_open();
+}
+
+
+pulse_tinysky::pulse_tinysky(const pulse_tinysky &a) :
+ db_table<pulse_tinysky>(*this,-1),
+ id(a.id),
+ result_id(a.result_id),
+ peak_power(a.peak_power),
+ mean_power(a.mean_power),
+ time(a.time),
+ ra(a.ra),
+ decl(a.decl),
+ q_pix(a.q_pix),
+ freq(a.freq),
+ detection_freq(a.detection_freq),
+ barycentric_freq(a.barycentric_freq),
+ fft_len(a.fft_len),
+ chirp_rate(a.chirp_rate),
+ rfi_checked(a.rfi_checked),
+ rfi_found(a.rfi_found),
+ reserved(a.reserved),
+ period(a.period),
+ snr(a.snr),
+ thresh(a.thresh),
+ score(a.score),
+ len_prof(a.len_prof),
+ pot(a.pot) {
+ db_open();
+}
+
+
+pulse_tinysky::pulse_tinysky(const SQL_ROW &a) :
+ db_table<pulse_tinysky>(*this,-1) {
+ db_open();
+ parse(a);
+}
+
+
+pulse_tinysky::pulse_tinysky(const std::string &s,const char *tag) :
+ db_table<pulse_tinysky>(*this,-1) {
+ db_open();
+ if (xml_match_tag(s,tag)) {
+ parse_xml(s,tag);
+ } else {
+ parse(s);
+ }
}
pulse_tinysky &pulse_tinysky::operator =(const pulse_tinysky &a) {
- if (&a != this) {
- id=a.id;
- result_id=a.result_id;
- peak_power=a.peak_power;
- mean_power=a.mean_power;
- time=a.time;
- ra=a.ra;
- decl=a.decl;
- q_pix=a.q_pix;
- freq=a.freq;
- detection_freq=a.detection_freq;
- barycentric_freq=a.barycentric_freq;
- fft_len=a.fft_len;
- chirp_rate=a.chirp_rate;
- rfi_checked=a.rfi_checked;
- rfi_found=a.rfi_found;
- reserved=a.reserved;
- period=a.period;
- snr=a.snr;
- thresh=a.thresh;
- score=a.score;
- len_prof=a.len_prof;
- pot=a.pot;
- }
- return (*this);
-}
-
-
-std::string pulse_tinysky::update_format() const
-{ std::ostringstream rv("");
-
- for (int i=2;i<22;i++) rv << "?,";
- rv << "?";
- return rv.str();
-}
-
-
-std::string pulse_tinysky::insert_format() const
-{ return std::string("?,")+update_format();
-}
-
-std::string pulse_tinysky::select_format() const
-{
-std::string rv("");
-for (int i=0; i<21;i++) rv+="?,";
-rv+="?";
-return rv;
-}
-
-std::string pulse_tinysky::print(int full_subtables, int show_ids, int no_refs) const
-{ std::ostringstream rv("");
-
- rv.precision(14);
- if (show_ids) rv << id;
- rv << ',';
- if (!no_refs) {
- if (full_subtables) {
- rv << result_id.print(full_subtables,show_ids,no_refs);
- } else {
- rv << result_id.id;
- }
- }
- rv << ',';
- rv << peak_power;
- rv << ',';
- rv << mean_power;
- rv << ',';
- rv << time;
- rv << ',';
- rv << ra;
- rv << ',';
- rv << decl;
- rv << ',';
- rv << q_pix;
- rv << ',';
- rv << freq;
- rv << ',';
- rv << detection_freq;
- rv << ',';
- rv << barycentric_freq;
- rv << ',';
- rv << fft_len;
- rv << ',';
- rv << chirp_rate;
- rv << ',';
- rv << rfi_checked;
- rv << ',';
- rv << rfi_found;
- rv << ',';
- rv << reserved;
- rv << ',';
- rv << period;
- rv << ',';
- rv << snr;
- rv << ',';
- rv << thresh;
- rv << ',';
- rv << score;
- rv << ',';
- rv << len_prof;
- rv << ',';
- rv << "<BYTE len=" << std::max(pot.size()*2,(size_t)1) << ">" << pot.print_hex() ;
- return rv.str();
-}
-
-
-std::string pulse_tinysky::print_xml(int full_subtables, int show_ids, int no_refs,const char *tag) const
-{
- std::ostringstream rv("");
-
- rv.precision(14);
- rv << xml_indent() << '<' << tag << ">\n";
- xml_indent(2);
- if (show_ids) rv << xml_indent() << "<id>" << id << "</id>\n";
- if (!no_refs) {
- if (full_subtables) {
- rv << result_id.print_xml(full_subtables,show_ids,no_refs,"result_id");
- } else {
- rv << xml_indent() << "<result_id><id>" << result_id.id << "</id></result_id>\n";
- }
- }
- rv << xml_indent() << "<peak_power>" << peak_power << "</peak_power>\n";
- rv << xml_indent() << "<mean_power>" << mean_power << "</mean_power>\n";
- rv << xml_indent() << "<time>" << time << "</time>\n";
- rv << xml_indent() << "<ra>" << ra << "</ra>\n";
- rv << xml_indent() << "<decl>" << decl << "</decl>\n";
- rv << xml_indent() << "<q_pix>" << q_pix << "</q_pix>\n";
- rv << xml_indent() << "<freq>" << freq << "</freq>\n";
- rv << xml_indent() << "<detection_freq>" << detection_freq << "</detection_freq>\n";
- rv << xml_indent() << "<barycentric_freq>" << barycentric_freq << "</barycentric_freq>\n";
- rv << xml_indent() << "<fft_len>" << fft_len << "</fft_len>\n";
- rv << xml_indent() << "<chirp_rate>" << chirp_rate << "</chirp_rate>\n";
- rv << xml_indent() << "<rfi_checked>" << rfi_checked << "</rfi_checked>\n";
- rv << xml_indent() << "<rfi_found>" << rfi_found << "</rfi_found>\n";
- rv << xml_indent() << "<reserved>" << reserved << "</reserved>\n";
- rv << xml_indent() << "<period>" << period << "</period>\n";
- rv << xml_indent() << "<snr>" << snr << "</snr>\n";
- rv << xml_indent() << "<thresh>" << thresh << "</thresh>\n";
- rv << xml_indent() << "<score>" << score << "</score>\n";
- rv << xml_indent() << "<len_prof>" << len_prof << "</len_prof>\n";
- if (pot.size()) {
- std::string enc_field=xml_encode_string(pot,pot.encoding);
- rv << xml_indent() << "<pot length=" << enc_field.size() << " encoding=\"" << xml_encoding_names[pot.encoding] << "\">";
- rv << enc_field << "</pot>\n";
- }
- xml_indent(-2);
- rv << xml_indent() << "</" << tag << ">\n";
- return rv.str();
-}
-
-
- void pulse_tinysky::parse_xml(const std::string &s,const char *tag) {
- std::string field,sub;
- if (extract_xml_record(s,tag,field)) {
- std::string::size_type pos=0;
- if (extract_xml_record(field,"id",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> id;
- }
- if (extract_xml_record(field,"result_id",sub)) {
- result_id.parse_xml(sub,"result_id");
- }
- if (extract_xml_record(field,"peak_power",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> peak_power;
- }
- if (extract_xml_record(field,"mean_power",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> mean_power;
- }
- if (extract_xml_record(field,"time",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> time;
- }
- if (extract_xml_record(field,"ra",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> ra;
- }
- if (extract_xml_record(field,"decl",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> decl;
- }
- if (extract_xml_record(field,"q_pix",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> q_pix;
- }
- if (extract_xml_record(field,"freq",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> freq;
- }
- if (extract_xml_record(field,"detection_freq",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> detection_freq;
- }
- if (extract_xml_record(field,"barycentric_freq",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> barycentric_freq;
- }
- if (extract_xml_record(field,"fft_len",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> fft_len;
- }
- if (extract_xml_record(field,"chirp_rate",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> chirp_rate;
- }
- if (extract_xml_record(field,"rfi_checked",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> rfi_checked;
- }
- if (extract_xml_record(field,"rfi_found",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> rfi_found;
- }
- if (extract_xml_record(field,"reserved",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> reserved;
- }
- if (extract_xml_record(field,"period",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> period;
- }
- if (extract_xml_record(field,"snr",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> snr;
- }
- if (extract_xml_record(field,"thresh",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> thresh;
- }
- if (extract_xml_record(field,"score",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> score;
- }
- if (extract_xml_record(field,"len_prof",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> len_prof;
- }
- if (extract_xml_record(field,"pot",sub)) {
- std::istringstream in(sub.c_str());
- in >> pot;
- }
- }
- }
-
- void pulse_tinysky::parse(const SQL_ROW &s) {
- {
- std::istringstream row(*(s[0]));
- row >> id;
- }
- {
- result_id.parse(SQL_ROW(s[1],0));
- }
- {
- std::istringstream row(*(s[2]));
- row >> peak_power;
- }
- {
- std::istringstream row(*(s[3]));
- row >> mean_power;
- }
- {
- std::istringstream row(*(s[4]));
- row >> time;
- }
- {
- std::istringstream row(*(s[5]));
- row >> ra;
- }
- {
- std::istringstream row(*(s[6]));
- row >> decl;
- }
- {
- std::istringstream row(*(s[7]));
- row >> q_pix;
- }
- {
- std::istringstream row(*(s[8]));
- row >> freq;
- }
- {
- std::istringstream row(*(s[9]));
- row >> detection_freq;
- }
- {
- std::istringstream row(*(s[10]));
- row >> barycentric_freq;
- }
- {
- std::istringstream row(*(s[11]));
- row >> fft_len;
- }
- {
- std::istringstream row(*(s[12]));
- row >> chirp_rate;
- }
- {
- std::istringstream row(*(s[13]));
- row >> rfi_checked;
- }
- {
- std::istringstream row(*(s[14]));
- row >> rfi_found;
- }
- {
- std::istringstream row(*(s[15]));
- row >> reserved;
- }
- {
- std::istringstream row(*(s[16]));
- row >> period;
- }
- {
- std::istringstream row(*(s[17]));
- row >> snr;
- }
- {
- std::istringstream row(*(s[18]));
- row >> thresh;
- }
- {
- std::istringstream row(*(s[19]));
- row >> score;
- }
- {
- std::istringstream row(*(s[20]));
- row >> len_prof;
- }
- {
- pot=sqlblob<unsigned char>(*(s[21]));
- }
- }
-
- void pulse_tinysky::parse(const std::string &s) {
- SQL_ROW row(&s,22);
- parse(row);
- }
-
-template <> const char * const db_table<triplet_tinysky>::table_name="triplet_tinysky";
-template <> const char * db_table<triplet_tinysky>::_search_tag=table_name;
+ if (&a != this) {
+ id=a.id;
+ result_id=a.result_id;
+ peak_power=a.peak_power;
+ mean_power=a.mean_power;
+ time=a.time;
+ ra=a.ra;
+ decl=a.decl;
+ q_pix=a.q_pix;
+ freq=a.freq;
+ detection_freq=a.detection_freq;
+ barycentric_freq=a.barycentric_freq;
+ fft_len=a.fft_len;
+ chirp_rate=a.chirp_rate;
+ rfi_checked=a.rfi_checked;
+ rfi_found=a.rfi_found;
+ reserved=a.reserved;
+ period=a.period;
+ snr=a.snr;
+ thresh=a.thresh;
+ score=a.score;
+ len_prof=a.len_prof;
+ pot=a.pot;
+ }
+ return (*this);
+}
+
+
+std::string pulse_tinysky::update_format() const {
+ std::ostringstream rv("");
+
+ for (int i=2; i<22; i++) {
+ rv << "?,";
+ }
+ rv << "?";
+ return rv.str();
+}
+
+
+std::string pulse_tinysky::insert_format() const {
+ return std::string("?,")+update_format();
+}
+
+std::string pulse_tinysky::select_format() const {
+ std::string rv("");
+ for (int i=0; i<21; i++) {
+ rv+="?,";
+ }
+ rv+="?";
+ return rv;
+}
+
+std::string pulse_tinysky::print(int full_subtables, int show_ids, int no_refs) const {
+ std::ostringstream rv("");
+
+ rv.precision(14);
+ if (show_ids) {
+ rv << id;
+ }
+ rv << ',';
+ if (!no_refs) {
+ if (full_subtables) {
+ rv << result_id.print(full_subtables,show_ids,no_refs);
+ } else {
+ rv << result_id.id;
+ }
+ }
+ rv << ',';
+ rv << peak_power;
+ rv << ',';
+ rv << mean_power;
+ rv << ',';
+ rv << time;
+ rv << ',';
+ rv << ra;
+ rv << ',';
+ rv << decl;
+ rv << ',';
+ rv << q_pix;
+ rv << ',';
+ rv << freq;
+ rv << ',';
+ rv << detection_freq;
+ rv << ',';
+ rv << barycentric_freq;
+ rv << ',';
+ rv << fft_len;
+ rv << ',';
+ rv << chirp_rate;
+ rv << ',';
+ rv << rfi_checked;
+ rv << ',';
+ rv << rfi_found;
+ rv << ',';
+ rv << reserved;
+ rv << ',';
+ rv << period;
+ rv << ',';
+ rv << snr;
+ rv << ',';
+ rv << thresh;
+ rv << ',';
+ rv << score;
+ rv << ',';
+ rv << len_prof;
+ rv << ',';
+ rv << "<BYTE len=" << std::max(pot.size()*2,(size_t)1) << ">" << pot.print_hex() ;
+ return rv.str();
+}
+
+
+std::string pulse_tinysky::print_xml(int full_subtables, int show_ids, int no_refs,const char *tag) const {
+ std::ostringstream rv("");
+
+ rv.precision(14);
+ rv << xml_indent() << '<' << tag << ">\n";
+ xml_indent(2);
+ if (show_ids) {
+ rv << xml_indent() << "<id>" << id << "</id>\n";
+ }
+ if (!no_refs) {
+ if (full_subtables) {
+ rv << result_id.print_xml(full_subtables,show_ids,no_refs,"result_id");
+ } else {
+ rv << xml_indent() << "<result_id><id>" << result_id.id << "</id></result_id>\n";
+ }
+ }
+ rv << xml_indent() << "<peak_power>" << peak_power << "</peak_power>\n";
+ rv << xml_indent() << "<mean_power>" << mean_power << "</mean_power>\n";
+ rv << xml_indent() << "<time>" << time << "</time>\n";
+ rv << xml_indent() << "<ra>" << ra << "</ra>\n";
+ rv << xml_indent() << "<decl>" << decl << "</decl>\n";
+ rv << xml_indent() << "<q_pix>" << q_pix << "</q_pix>\n";
+ rv << xml_indent() << "<freq>" << freq << "</freq>\n";
+ rv << xml_indent() << "<detection_freq>" << detection_freq << "</detection_freq>\n";
+ rv << xml_indent() << "<barycentric_freq>" << barycentric_freq << "</barycentric_freq>\n";
+ rv << xml_indent() << "<fft_len>" << fft_len << "</fft_len>\n";
+ rv << xml_indent() << "<chirp_rate>" << chirp_rate << "</chirp_rate>\n";
+ rv << xml_indent() << "<rfi_checked>" << rfi_checked << "</rfi_checked>\n";
+ rv << xml_indent() << "<rfi_found>" << rfi_found << "</rfi_found>\n";
+ rv << xml_indent() << "<reserved>" << reserved << "</reserved>\n";
+ rv << xml_indent() << "<period>" << period << "</period>\n";
+ rv << xml_indent() << "<snr>" << snr << "</snr>\n";
+ rv << xml_indent() << "<thresh>" << thresh << "</thresh>\n";
+ rv << xml_indent() << "<score>" << score << "</score>\n";
+ rv << xml_indent() << "<len_prof>" << len_prof << "</len_prof>\n";
+ if (pot.size()) {
+ std::string enc_field=xml_encode_string(pot,pot.encoding);
+ rv << xml_indent() << "<pot length=" << enc_field.size() << " encoding=\"" << xml_encoding_names[pot.encoding] << "\">";
+ rv << enc_field << "</pot>\n";
+ }
+ xml_indent(-2);
+ rv << xml_indent() << "</" << tag << ">\n";
+ return rv.str();
+}
+
+
+void pulse_tinysky::parse_xml(const std::string &s,const char *tag) {
+ std::string field,sub;
+ if (extract_xml_record(s,tag,field)) {
+ std::string::size_type pos=0;
+ if (extract_xml_record(field,"id",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> id;
+ }
+ if (extract_xml_record(field,"result_id",sub)) {
+ result_id.parse_xml(sub,"result_id");
+ }
+ if (extract_xml_record(field,"peak_power",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> peak_power;
+ }
+ if (extract_xml_record(field,"mean_power",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> mean_power;
+ }
+ if (extract_xml_record(field,"time",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> time;
+ }
+ if (extract_xml_record(field,"ra",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> ra;
+ }
+ if (extract_xml_record(field,"decl",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> decl;
+ }
+ if (extract_xml_record(field,"q_pix",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> q_pix;
+ }
+ if (extract_xml_record(field,"freq",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> freq;
+ }
+ if (extract_xml_record(field,"detection_freq",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> detection_freq;
+ }
+ if (extract_xml_record(field,"barycentric_freq",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> barycentric_freq;
+ }
+ if (extract_xml_record(field,"fft_len",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> fft_len;
+ }
+ if (extract_xml_record(field,"chirp_rate",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> chirp_rate;
+ }
+ if (extract_xml_record(field,"rfi_checked",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> rfi_checked;
+ }
+ if (extract_xml_record(field,"rfi_found",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> rfi_found;
+ }
+ if (extract_xml_record(field,"reserved",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> reserved;
+ }
+ if (extract_xml_record(field,"period",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> period;
+ }
+ if (extract_xml_record(field,"snr",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> snr;
+ }
+ if (extract_xml_record(field,"thresh",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> thresh;
+ }
+ if (extract_xml_record(field,"score",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> score;
+ }
+ if (extract_xml_record(field,"len_prof",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> len_prof;
+ }
+ if (extract_xml_record(field,"pot",sub)) {
+ std::istringstream in(sub.c_str());
+ in >> pot;
+ }
+ }
+}
+
+void pulse_tinysky::parse(const SQL_ROW &s) {
+ {
+ std::istringstream row(*(s[0]));
+ row >> id;
+ }
+ {
+ result_id.parse(SQL_ROW(s[1],0));
+ }
+ {
+ std::istringstream row(*(s[2]));
+ row >> peak_power;
+ }
+ {
+ std::istringstream row(*(s[3]));
+ row >> mean_power;
+ }
+ {
+ std::istringstream row(*(s[4]));
+ row >> time;
+ }
+ {
+ std::istringstream row(*(s[5]));
+ row >> ra;
+ }
+ {
+ std::istringstream row(*(s[6]));
+ row >> decl;
+ }
+ {
+ std::istringstream row(*(s[7]));
+ row >> q_pix;
+ }
+ {
+ std::istringstream row(*(s[8]));
+ row >> freq;
+ }
+ {
+ std::istringstream row(*(s[9]));
+ row >> detection_freq;
+ }
+ {
+ std::istringstream row(*(s[10]));
+ row >> barycentric_freq;
+ }
+ {
+ std::istringstream row(*(s[11]));
+ row >> fft_len;
+ }
+ {
+ std::istringstream row(*(s[12]));
+ row >> chirp_rate;
+ }
+ {
+ std::istringstream row(*(s[13]));
+ row >> rfi_checked;
+ }
+ {
+ std::istringstream row(*(s[14]));
+ row >> rfi_found;
+ }
+ {
+ std::istringstream row(*(s[15]));
+ row >> reserved;
+ }
+ {
+ std::istringstream row(*(s[16]));
+ row >> period;
+ }
+ {
+ std::istringstream row(*(s[17]));
+ row >> snr;
+ }
+ {
+ std::istringstream row(*(s[18]));
+ row >> thresh;
+ }
+ {
+ std::istringstream row(*(s[19]));
+ row >> score;
+ }
+ {
+ std::istringstream row(*(s[20]));
+ row >> len_prof;
+ }
+ {
+ pot=sqlblob<unsigned char>(*(s[21]));
+ }
+}
+
+void pulse_tinysky::parse(const std::string &s) {
+ SQL_ROW row(&s,22);
+ parse(row);
+}
+
+template <> const char *const db_table<triplet_tinysky>::table_name="triplet_tinysky";
+template <> const char *db_table<triplet_tinysky>::_search_tag=table_name;
template <> const int db_table<triplet_tinysky>::_nfields=17;
-template <> const char * const db_table<triplet_tinysky>::column_names[17]={"id","result_id","peak_power","mean_power","time","ra","decl","q_pix","freq","detection_freq","barycentric_freq","fft_len","chirp_rate","rfi_checked","rfi_found","reserved","period"};
-
-triplet_tinysky::triplet_tinysky() :
- db_table<triplet_tinysky>(*this,-1),
- id(0),
- result_id(),
- peak_power(0),
- mean_power(0),
- time(0),
- ra(0),
- decl(0),
- q_pix(0),
- freq(0),
- detection_freq(0),
- barycentric_freq(0),
- fft_len(0),
- chirp_rate(0),
- rfi_checked(0),
- rfi_found(0),
- reserved(0),
- period(0)
-{
- db_open();
-}
-
-
-triplet_tinysky::triplet_tinysky(const triplet_tinysky &a) :
- db_table<triplet_tinysky>(*this,-1),
- id(a.id),
- result_id(a.result_id),
- peak_power(a.peak_power),
- mean_power(a.mean_power),
- time(a.time),
- ra(a.ra),
- decl(a.decl),
- q_pix(a.q_pix),
- freq(a.freq),
- detection_freq(a.detection_freq),
- barycentric_freq(a.barycentric_freq),
- fft_len(a.fft_len),
- chirp_rate(a.chirp_rate),
- rfi_checked(a.rfi_checked),
- rfi_found(a.rfi_found),
- reserved(a.reserved),
- period(a.period)
-{
- db_open();
-}
-
-
-triplet_tinysky::triplet_tinysky(const SQL_ROW &a) :
- db_table<triplet_tinysky>(*this,-1)
-{
- db_open();
- parse(a);
-}
-
-
-triplet_tinysky::triplet_tinysky(const std::string &s,const char *tag) :
- db_table<triplet_tinysky>(*this,-1)
-{
- db_open();
- if (xml_match_tag(s,tag)) {
- parse_xml(s,tag);
- } else {
- parse(s);
- }
+template <> const char *const db_table<triplet_tinysky>::column_names[17]= {"id","result_id","peak_power","mean_power","time","ra","decl","q_pix","freq","detection_freq","barycentric_freq","fft_len","chirp_rate","rfi_checked","rfi_found","reserved","period"};
+
+triplet_tinysky::triplet_tinysky() :
+ db_table<triplet_tinysky>(*this,-1),
+ id(0),
+ result_id(),
+ peak_power(0),
+ mean_power(0),
+ time(0),
+ ra(0),
+ decl(0),
+ q_pix(0),
+ freq(0),
+ detection_freq(0),
+ barycentric_freq(0),
+ fft_len(0),
+ chirp_rate(0),
+ rfi_checked(0),
+ rfi_found(0),
+ reserved(0),
+ period(0) {
+ db_open();
+}
+
+
+triplet_tinysky::triplet_tinysky(const triplet_tinysky &a) :
+ db_table<triplet_tinysky>(*this,-1),
+ id(a.id),
+ result_id(a.result_id),
+ peak_power(a.peak_power),
+ mean_power(a.mean_power),
+ time(a.time),
+ ra(a.ra),
+ decl(a.decl),
+ q_pix(a.q_pix),
+ freq(a.freq),
+ detection_freq(a.detection_freq),
+ barycentric_freq(a.barycentric_freq),
+ fft_len(a.fft_len),
+ chirp_rate(a.chirp_rate),
+ rfi_checked(a.rfi_checked),
+ rfi_found(a.rfi_found),
+ reserved(a.reserved),
+ period(a.period) {
+ db_open();
+}
+
+
+triplet_tinysky::triplet_tinysky(const SQL_ROW &a) :
+ db_table<triplet_tinysky>(*this,-1) {
+ db_open();
+ parse(a);
+}
+
+
+triplet_tinysky::triplet_tinysky(const std::string &s,const char *tag) :
+ db_table<triplet_tinysky>(*this,-1) {
+ db_open();
+ if (xml_match_tag(s,tag)) {
+ parse_xml(s,tag);
+ } else {
+ parse(s);
+ }
}
triplet_tinysky &triplet_tinysky::operator =(const triplet_tinysky &a) {
- if (&a != this) {
- id=a.id;
- result_id=a.result_id;
- peak_power=a.peak_power;
- mean_power=a.mean_power;
- time=a.time;
- ra=a.ra;
- decl=a.decl;
- q_pix=a.q_pix;
- freq=a.freq;
- detection_freq=a.detection_freq;
- barycentric_freq=a.barycentric_freq;
- fft_len=a.fft_len;
- chirp_rate=a.chirp_rate;
- rfi_checked=a.rfi_checked;
- rfi_found=a.rfi_found;
- reserved=a.reserved;
- period=a.period;
- }
- return (*this);
-}
-
-
-std::string triplet_tinysky::update_format() const
-{ std::ostringstream rv("");
-
- for (int i=2;i<17;i++) rv << "?,";
- rv << "?";
- return rv.str();
-}
-
-
-std::string triplet_tinysky::insert_format() const
-{ return std::string("?,")+update_format();
-}
-
-std::string triplet_tinysky::select_format() const
-{
-std::string rv("");
-for (int i=0; i<16;i++) rv+="?,";
-rv+="?";
-return rv;
-}
-
-std::string triplet_tinysky::print(int full_subtables, int show_ids, int no_refs) const
-{ std::ostringstream rv("");
-
- rv.precision(14);
- if (show_ids) rv << id;
- rv << ',';
- if (!no_refs) {
- if (full_subtables) {
- rv << result_id.print(full_subtables,show_ids,no_refs);
- } else {
- rv << result_id.id;
- }
- }
- rv << ',';
- rv << peak_power;
- rv << ',';
- rv << mean_power;
- rv << ',';
- rv << time;
- rv << ',';
- rv << ra;
- rv << ',';
- rv << decl;
- rv << ',';
- rv << q_pix;
- rv << ',';
- rv << freq;
- rv << ',';
- rv << detection_freq;
- rv << ',';
- rv << barycentric_freq;
- rv << ',';
- rv << fft_len;
- rv << ',';
- rv << chirp_rate;
- rv << ',';
- rv << rfi_checked;
- rv << ',';
- rv << rfi_found;
- rv << ',';
- rv << reserved;
- rv << ',';
- rv << period;
- return rv.str();
-}
-
-
-std::string triplet_tinysky::print_xml(int full_subtables, int show_ids, int no_refs,const char *tag) const
-{
- std::ostringstream rv("");
-
- rv.precision(14);
- rv << xml_indent() << '<' << tag << ">\n";
- xml_indent(2);
- if (show_ids) rv << xml_indent() << "<id>" << id << "</id>\n";
- if (!no_refs) {
- if (full_subtables) {
- rv << result_id.print_xml(full_subtables,show_ids,no_refs,"result_id");
- } else {
- rv << xml_indent() << "<result_id><id>" << result_id.id << "</id></result_id>\n";
- }
- }
- rv << xml_indent() << "<peak_power>" << peak_power << "</peak_power>\n";
- rv << xml_indent() << "<mean_power>" << mean_power << "</mean_power>\n";
- rv << xml_indent() << "<time>" << time << "</time>\n";
- rv << xml_indent() << "<ra>" << ra << "</ra>\n";
- rv << xml_indent() << "<decl>" << decl << "</decl>\n";
- rv << xml_indent() << "<q_pix>" << q_pix << "</q_pix>\n";
- rv << xml_indent() << "<freq>" << freq << "</freq>\n";
- rv << xml_indent() << "<detection_freq>" << detection_freq << "</detection_freq>\n";
- rv << xml_indent() << "<barycentric_freq>" << barycentric_freq << "</barycentric_freq>\n";
- rv << xml_indent() << "<fft_len>" << fft_len << "</fft_len>\n";
- rv << xml_indent() << "<chirp_rate>" << chirp_rate << "</chirp_rate>\n";
- rv << xml_indent() << "<rfi_checked>" << rfi_checked << "</rfi_checked>\n";
- rv << xml_indent() << "<rfi_found>" << rfi_found << "</rfi_found>\n";
- rv << xml_indent() << "<reserved>" << reserved << "</reserved>\n";
- rv << xml_indent() << "<period>" << period << "</period>\n";
- xml_indent(-2);
- rv << xml_indent() << "</" << tag << ">\n";
- return rv.str();
-}
-
-
- void triplet_tinysky::parse_xml(const std::string &s,const char *tag) {
- std::string field,sub;
- if (extract_xml_record(s,tag,field)) {
- std::string::size_type pos=0;
- if (extract_xml_record(field,"id",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> id;
- }
- if (extract_xml_record(field,"result_id",sub)) {
- result_id.parse_xml(sub,"result_id");
- }
- if (extract_xml_record(field,"peak_power",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> peak_power;
- }
- if (extract_xml_record(field,"mean_power",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> mean_power;
- }
- if (extract_xml_record(field,"time",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> time;
- }
- if (extract_xml_record(field,"ra",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> ra;
- }
- if (extract_xml_record(field,"decl",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> decl;
- }
- if (extract_xml_record(field,"q_pix",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> q_pix;
- }
- if (extract_xml_record(field,"freq",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> freq;
- }
- if (extract_xml_record(field,"detection_freq",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> detection_freq;
- }
- if (extract_xml_record(field,"barycentric_freq",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> barycentric_freq;
- }
- if (extract_xml_record(field,"fft_len",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> fft_len;
- }
- if (extract_xml_record(field,"chirp_rate",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> chirp_rate;
- }
- if (extract_xml_record(field,"rfi_checked",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> rfi_checked;
- }
- if (extract_xml_record(field,"rfi_found",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> rfi_found;
- }
- if (extract_xml_record(field,"reserved",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> reserved;
- }
- if (extract_xml_record(field,"period",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> period;
- }
- }
- }
-
- void triplet_tinysky::parse(const SQL_ROW &s) {
- {
- std::istringstream row(*(s[0]));
- row >> id;
- }
- {
- result_id.parse(SQL_ROW(s[1],0));
- }
- {
- std::istringstream row(*(s[2]));
- row >> peak_power;
- }
- {
- std::istringstream row(*(s[3]));
- row >> mean_power;
- }
- {
- std::istringstream row(*(s[4]));
- row >> time;
- }
- {
- std::istringstream row(*(s[5]));
- row >> ra;
- }
- {
- std::istringstream row(*(s[6]));
- row >> decl;
- }
- {
- std::istringstream row(*(s[7]));
- row >> q_pix;
- }
- {
- std::istringstream row(*(s[8]));
- row >> freq;
- }
- {
- std::istringstream row(*(s[9]));
- row >> detection_freq;
- }
- {
- std::istringstream row(*(s[10]));
- row >> barycentric_freq;
- }
- {
- std::istringstream row(*(s[11]));
- row >> fft_len;
- }
- {
- std::istringstream row(*(s[12]));
- row >> chirp_rate;
- }
- {
- std::istringstream row(*(s[13]));
- row >> rfi_checked;
- }
- {
- std::istringstream row(*(s[14]));
- row >> rfi_found;
- }
- {
- std::istringstream row(*(s[15]));
- row >> reserved;
- }
- {
- std::istringstream row(*(s[16]));
- row >> period;
- }
- }
-
- void triplet_tinysky::parse(const std::string &s) {
- SQL_ROW row(&s,17);
- parse(row);
- }
-
-template <> const char * const db_table<autocorr_tinysky>::table_name="autocorr_tinysky";
-template <> const char * db_table<autocorr_tinysky>::_search_tag=table_name;
+ if (&a != this) {
+ id=a.id;
+ result_id=a.result_id;
+ peak_power=a.peak_power;
+ mean_power=a.mean_power;
+ time=a.time;
+ ra=a.ra;
+ decl=a.decl;
+ q_pix=a.q_pix;
+ freq=a.freq;
+ detection_freq=a.detection_freq;
+ barycentric_freq=a.barycentric_freq;
+ fft_len=a.fft_len;
+ chirp_rate=a.chirp_rate;
+ rfi_checked=a.rfi_checked;
+ rfi_found=a.rfi_found;
+ reserved=a.reserved;
+ period=a.period;
+ }
+ return (*this);
+}
+
+
+std::string triplet_tinysky::update_format() const {
+ std::ostringstream rv("");
+
+ for (int i=2; i<17; i++) {
+ rv << "?,";
+ }
+ rv << "?";
+ return rv.str();
+}
+
+
+std::string triplet_tinysky::insert_format() const {
+ return std::string("?,")+update_format();
+}
+
+std::string triplet_tinysky::select_format() const {
+ std::string rv("");
+ for (int i=0; i<16; i++) {
+ rv+="?,";
+ }
+ rv+="?";
+ return rv;
+}
+
+std::string triplet_tinysky::print(int full_subtables, int show_ids, int no_refs) const {
+ std::ostringstream rv("");
+
+ rv.precision(14);
+ if (show_ids) {
+ rv << id;
+ }
+ rv << ',';
+ if (!no_refs) {
+ if (full_subtables) {
+ rv << result_id.print(full_subtables,show_ids,no_refs);
+ } else {
+ rv << result_id.id;
+ }
+ }
+ rv << ',';
+ rv << peak_power;
+ rv << ',';
+ rv << mean_power;
+ rv << ',';
+ rv << time;
+ rv << ',';
+ rv << ra;
+ rv << ',';
+ rv << decl;
+ rv << ',';
+ rv << q_pix;
+ rv << ',';
+ rv << freq;
+ rv << ',';
+ rv << detection_freq;
+ rv << ',';
+ rv << barycentric_freq;
+ rv << ',';
+ rv << fft_len;
+ rv << ',';
+ rv << chirp_rate;
+ rv << ',';
+ rv << rfi_checked;
+ rv << ',';
+ rv << rfi_found;
+ rv << ',';
+ rv << reserved;
+ rv << ',';
+ rv << period;
+ return rv.str();
+}
+
+
+std::string triplet_tinysky::print_xml(int full_subtables, int show_ids, int no_refs,const char *tag) const {
+ std::ostringstream rv("");
+
+ rv.precision(14);
+ rv << xml_indent() << '<' << tag << ">\n";
+ xml_indent(2);
+ if (show_ids) {
+ rv << xml_indent() << "<id>" << id << "</id>\n";
+ }
+ if (!no_refs) {
+ if (full_subtables) {
+ rv << result_id.print_xml(full_subtables,show_ids,no_refs,"result_id");
+ } else {
+ rv << xml_indent() << "<result_id><id>" << result_id.id << "</id></result_id>\n";
+ }
+ }
+ rv << xml_indent() << "<peak_power>" << peak_power << "</peak_power>\n";
+ rv << xml_indent() << "<mean_power>" << mean_power << "</mean_power>\n";
+ rv << xml_indent() << "<time>" << time << "</time>\n";
+ rv << xml_indent() << "<ra>" << ra << "</ra>\n";
+ rv << xml_indent() << "<decl>" << decl << "</decl>\n";
+ rv << xml_indent() << "<q_pix>" << q_pix << "</q_pix>\n";
+ rv << xml_indent() << "<freq>" << freq << "</freq>\n";
+ rv << xml_indent() << "<detection_freq>" << detection_freq << "</detection_freq>\n";
+ rv << xml_indent() << "<barycentric_freq>" << barycentric_freq << "</barycentric_freq>\n";
+ rv << xml_indent() << "<fft_len>" << fft_len << "</fft_len>\n";
+ rv << xml_indent() << "<chirp_rate>" << chirp_rate << "</chirp_rate>\n";
+ rv << xml_indent() << "<rfi_checked>" << rfi_checked << "</rfi_checked>\n";
+ rv << xml_indent() << "<rfi_found>" << rfi_found << "</rfi_found>\n";
+ rv << xml_indent() << "<reserved>" << reserved << "</reserved>\n";
+ rv << xml_indent() << "<period>" << period << "</period>\n";
+ xml_indent(-2);
+ rv << xml_indent() << "</" << tag << ">\n";
+ return rv.str();
+}
+
+
+void triplet_tinysky::parse_xml(const std::string &s,const char *tag) {
+ std::string field,sub;
+ if (extract_xml_record(s,tag,field)) {
+ std::string::size_type pos=0;
+ if (extract_xml_record(field,"id",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> id;
+ }
+ if (extract_xml_record(field,"result_id",sub)) {
+ result_id.parse_xml(sub,"result_id");
+ }
+ if (extract_xml_record(field,"peak_power",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> peak_power;
+ }
+ if (extract_xml_record(field,"mean_power",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> mean_power;
+ }
+ if (extract_xml_record(field,"time",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> time;
+ }
+ if (extract_xml_record(field,"ra",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> ra;
+ }
+ if (extract_xml_record(field,"decl",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> decl;
+ }
+ if (extract_xml_record(field,"q_pix",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> q_pix;
+ }
+ if (extract_xml_record(field,"freq",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> freq;
+ }
+ if (extract_xml_record(field,"detection_freq",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> detection_freq;
+ }
+ if (extract_xml_record(field,"barycentric_freq",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> barycentric_freq;
+ }
+ if (extract_xml_record(field,"fft_len",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> fft_len;
+ }
+ if (extract_xml_record(field,"chirp_rate",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> chirp_rate;
+ }
+ if (extract_xml_record(field,"rfi_checked",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> rfi_checked;
+ }
+ if (extract_xml_record(field,"rfi_found",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> rfi_found;
+ }
+ if (extract_xml_record(field,"reserved",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> reserved;
+ }
+ if (extract_xml_record(field,"period",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> period;
+ }
+ }
+}
+
+void triplet_tinysky::parse(const SQL_ROW &s) {
+ {
+ std::istringstream row(*(s[0]));
+ row >> id;
+ }
+ {
+ result_id.parse(SQL_ROW(s[1],0));
+ }
+ {
+ std::istringstream row(*(s[2]));
+ row >> peak_power;
+ }
+ {
+ std::istringstream row(*(s[3]));
+ row >> mean_power;
+ }
+ {
+ std::istringstream row(*(s[4]));
+ row >> time;
+ }
+ {
+ std::istringstream row(*(s[5]));
+ row >> ra;
+ }
+ {
+ std::istringstream row(*(s[6]));
+ row >> decl;
+ }
+ {
+ std::istringstream row(*(s[7]));
+ row >> q_pix;
+ }
+ {
+ std::istringstream row(*(s[8]));
+ row >> freq;
+ }
+ {
+ std::istringstream row(*(s[9]));
+ row >> detection_freq;
+ }
+ {
+ std::istringstream row(*(s[10]));
+ row >> barycentric_freq;
+ }
+ {
+ std::istringstream row(*(s[11]));
+ row >> fft_len;
+ }
+ {
+ std::istringstream row(*(s[12]));
+ row >> chirp_rate;
+ }
+ {
+ std::istringstream row(*(s[13]));
+ row >> rfi_checked;
+ }
+ {
+ std::istringstream row(*(s[14]));
+ row >> rfi_found;
+ }
+ {
+ std::istringstream row(*(s[15]));
+ row >> reserved;
+ }
+ {
+ std::istringstream row(*(s[16]));
+ row >> period;
+ }
+}
+
+void triplet_tinysky::parse(const std::string &s) {
+ SQL_ROW row(&s,17);
+ parse(row);
+}
+
+template <> const char *const db_table<autocorr_tinysky>::table_name="autocorr_tinysky";
+template <> const char *db_table<autocorr_tinysky>::_search_tag=table_name;
template <> const int db_table<autocorr_tinysky>::_nfields=17;
-template <> const char * const db_table<autocorr_tinysky>::column_names[17]={"id","result_id","peak_power","mean_power","time","ra","decl","q_pix","delay","freq","detection_freq","barycentric_freq","fft_len","chirp_rate","rfi_checked","rfi_found","reserved"};
-
-autocorr_tinysky::autocorr_tinysky() :
- db_table<autocorr_tinysky>(*this,-1),
- id(0),
- result_id(),
- peak_power(0),
- mean_power(0),
- time(0),
- ra(0),
- decl(0),
- q_pix(0),
- delay(0),
- freq(0),
- detection_freq(0),
- barycentric_freq(0),
- fft_len(0),
- chirp_rate(0),
- rfi_checked(0),
- rfi_found(0),
- reserved(0)
-{
- db_open();
-}
-
-
-autocorr_tinysky::autocorr_tinysky(const autocorr_tinysky &a) :
- db_table<autocorr_tinysky>(*this,-1),
- id(a.id),
- result_id(a.result_id),
- peak_power(a.peak_power),
- mean_power(a.mean_power),
- time(a.time),
- ra(a.ra),
- decl(a.decl),
- q_pix(a.q_pix),
- delay(a.delay),
- freq(a.freq),
- detection_freq(a.detection_freq),
- barycentric_freq(a.barycentric_freq),
- fft_len(a.fft_len),
- chirp_rate(a.chirp_rate),
- rfi_checked(a.rfi_checked),
- rfi_found(a.rfi_found),
- reserved(a.reserved)
-{
- db_open();
-}
-
-
-autocorr_tinysky::autocorr_tinysky(const SQL_ROW &a) :
- db_table<autocorr_tinysky>(*this,-1)
-{
- db_open();
- parse(a);
-}
-
-
-autocorr_tinysky::autocorr_tinysky(const std::string &s,const char *tag) :
- db_table<autocorr_tinysky>(*this,-1)
-{
- db_open();
- if (xml_match_tag(s,tag)) {
- parse_xml(s,tag);
- } else {
- parse(s);
- }
+template <> const char *const db_table<autocorr_tinysky>::column_names[17]= {"id","result_id","peak_power","mean_power","time","ra","decl","q_pix","delay","freq","detection_freq","barycentric_freq","fft_len","chirp_rate","rfi_checked","rfi_found","reserved"};
+
+autocorr_tinysky::autocorr_tinysky() :
+ db_table<autocorr_tinysky>(*this,-1),
+ id(0),
+ result_id(),
+ peak_power(0),
+ mean_power(0),
+ time(0),
+ ra(0),
+ decl(0),
+ q_pix(0),
+ delay(0),
+ freq(0),
+ detection_freq(0),
+ barycentric_freq(0),
+ fft_len(0),
+ chirp_rate(0),
+ rfi_checked(0),
+ rfi_found(0),
+ reserved(0) {
+ db_open();
+}
+
+
+autocorr_tinysky::autocorr_tinysky(const autocorr_tinysky &a) :
+ db_table<autocorr_tinysky>(*this,-1),
+ id(a.id),
+ result_id(a.result_id),
+ peak_power(a.peak_power),
+ mean_power(a.mean_power),
+ time(a.time),
+ ra(a.ra),
+ decl(a.decl),
+ q_pix(a.q_pix),
+ delay(a.delay),
+ freq(a.freq),
+ detection_freq(a.detection_freq),
+ barycentric_freq(a.barycentric_freq),
+ fft_len(a.fft_len),
+ chirp_rate(a.chirp_rate),
+ rfi_checked(a.rfi_checked),
+ rfi_found(a.rfi_found),
+ reserved(a.reserved) {
+ db_open();
+}
+
+
+autocorr_tinysky::autocorr_tinysky(const SQL_ROW &a) :
+ db_table<autocorr_tinysky>(*this,-1) {
+ db_open();
+ parse(a);
+}
+
+
+autocorr_tinysky::autocorr_tinysky(const std::string &s,const char *tag) :
+ db_table<autocorr_tinysky>(*this,-1) {
+ db_open();
+ if (xml_match_tag(s,tag)) {
+ parse_xml(s,tag);
+ } else {
+ parse(s);
+ }
}
autocorr_tinysky &autocorr_tinysky::operator =(const autocorr_tinysky &a) {
- if (&a != this) {
- id=a.id;
- result_id=a.result_id;
- peak_power=a.peak_power;
- mean_power=a.mean_power;
- time=a.time;
- ra=a.ra;
- decl=a.decl;
- q_pix=a.q_pix;
- delay=a.delay;
- freq=a.freq;
- detection_freq=a.detection_freq;
- barycentric_freq=a.barycentric_freq;
- fft_len=a.fft_len;
- chirp_rate=a.chirp_rate;
- rfi_checked=a.rfi_checked;
- rfi_found=a.rfi_found;
- reserved=a.reserved;
- }
- return (*this);
-}
-
-
-std::string autocorr_tinysky::update_format() const
-{ std::ostringstream rv("");
-
- for (int i=2;i<17;i++) rv << "?,";
- rv << "?";
- return rv.str();
-}
-
-
-std::string autocorr_tinysky::insert_format() const
-{ return std::string("?,")+update_format();
-}
-
-std::string autocorr_tinysky::select_format() const
-{
-std::string rv("");
-for (int i=0; i<16;i++) rv+="?,";
-rv+="?";
-return rv;
-}
-
-std::string autocorr_tinysky::print(int full_subtables, int show_ids, int no_refs) const
-{ std::ostringstream rv("");
-
- rv.precision(14);
- if (show_ids) rv << id;
- rv << ',';
- if (!no_refs) {
- if (full_subtables) {
- rv << result_id.print(full_subtables,show_ids,no_refs);
- } else {
- rv << result_id.id;
- }
- }
- rv << ',';
- rv << peak_power;
- rv << ',';
- rv << mean_power;
- rv << ',';
- rv << time;
- rv << ',';
- rv << ra;
- rv << ',';
- rv << decl;
- rv << ',';
- rv << q_pix;
- rv << ',';
- rv << delay;
- rv << ',';
- rv << freq;
- rv << ',';
- rv << detection_freq;
- rv << ',';
- rv << barycentric_freq;
- rv << ',';
- rv << fft_len;
- rv << ',';
- rv << chirp_rate;
- rv << ',';
- rv << rfi_checked;
- rv << ',';
- rv << rfi_found;
- rv << ',';
- rv << reserved;
- return rv.str();
-}
-
-
-std::string autocorr_tinysky::print_xml(int full_subtables, int show_ids, int no_refs,const char *tag) const
-{
- std::ostringstream rv("");
-
- rv.precision(14);
- rv << xml_indent() << '<' << tag << ">\n";
- xml_indent(2);
- if (show_ids) rv << xml_indent() << "<id>" << id << "</id>\n";
- if (!no_refs) {
- if (full_subtables) {
- rv << result_id.print_xml(full_subtables,show_ids,no_refs,"result_id");
- } else {
- rv << xml_indent() << "<result_id><id>" << result_id.id << "</id></result_id>\n";
- }
- }
- rv << xml_indent() << "<peak_power>" << peak_power << "</peak_power>\n";
- rv << xml_indent() << "<mean_power>" << mean_power << "</mean_power>\n";
- rv << xml_indent() << "<time>" << time << "</time>\n";
- rv << xml_indent() << "<ra>" << ra << "</ra>\n";
- rv << xml_indent() << "<decl>" << decl << "</decl>\n";
- rv << xml_indent() << "<q_pix>" << q_pix << "</q_pix>\n";
- rv << xml_indent() << "<delay>" << delay << "</delay>\n";
- rv << xml_indent() << "<freq>" << freq << "</freq>\n";
- rv << xml_indent() << "<detection_freq>" << detection_freq << "</detection_freq>\n";
- rv << xml_indent() << "<barycentric_freq>" << barycentric_freq << "</barycentric_freq>\n";
- rv << xml_indent() << "<fft_len>" << fft_len << "</fft_len>\n";
- rv << xml_indent() << "<chirp_rate>" << chirp_rate << "</chirp_rate>\n";
- rv << xml_indent() << "<rfi_checked>" << rfi_checked << "</rfi_checked>\n";
- rv << xml_indent() << "<rfi_found>" << rfi_found << "</rfi_found>\n";
- rv << xml_indent() << "<reserved>" << reserved << "</reserved>\n";
- xml_indent(-2);
- rv << xml_indent() << "</" << tag << ">\n";
- return rv.str();
-}
-
-
- void autocorr_tinysky::parse_xml(const std::string &s,const char *tag) {
- std::string field,sub;
- if (extract_xml_record(s,tag,field)) {
- std::string::size_type pos=0;
- if (extract_xml_record(field,"id",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> id;
- }
- if (extract_xml_record(field,"result_id",sub)) {
- result_id.parse_xml(sub,"result_id");
- }
- if (extract_xml_record(field,"peak_power",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> peak_power;
- }
- if (extract_xml_record(field,"mean_power",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> mean_power;
- }
- if (extract_xml_record(field,"time",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> time;
- }
- if (extract_xml_record(field,"ra",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> ra;
- }
- if (extract_xml_record(field,"decl",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> decl;
- }
- if (extract_xml_record(field,"q_pix",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> q_pix;
- }
- if (extract_xml_record(field,"delay",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> delay;
- }
- if (extract_xml_record(field,"freq",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> freq;
- }
- if (extract_xml_record(field,"detection_freq",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> detection_freq;
- }
- if (extract_xml_record(field,"barycentric_freq",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> barycentric_freq;
- }
- if (extract_xml_record(field,"fft_len",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> fft_len;
- }
- if (extract_xml_record(field,"chirp_rate",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> chirp_rate;
- }
- if (extract_xml_record(field,"rfi_checked",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> rfi_checked;
- }
- if (extract_xml_record(field,"rfi_found",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> rfi_found;
- }
- if (extract_xml_record(field,"reserved",sub)) {
- pos=sub.find(">");
- do { pos++; } while(sub[pos]=='\n');
- std::istringstream in(sub.c_str()+pos);
- in >> reserved;
- }
- }
- }
-
- void autocorr_tinysky::parse(const SQL_ROW &s) {
- {
- std::istringstream row(*(s[0]));
- row >> id;
- }
- {
- result_id.parse(SQL_ROW(s[1],0));
- }
- {
- std::istringstream row(*(s[2]));
- row >> peak_power;
- }
- {
- std::istringstream row(*(s[3]));
- row >> mean_power;
- }
- {
- std::istringstream row(*(s[4]));
- row >> time;
- }
- {
- std::istringstream row(*(s[5]));
- row >> ra;
- }
- {
- std::istringstream row(*(s[6]));
- row >> decl;
- }
- {
- std::istringstream row(*(s[7]));
- row >> q_pix;
- }
- {
- std::istringstream row(*(s[8]));
- row >> delay;
- }
- {
- std::istringstream row(*(s[9]));
- row >> freq;
- }
- {
- std::istringstream row(*(s[10]));
- row >> detection_freq;
- }
- {
- std::istringstream row(*(s[11]));
- row >> barycentric_freq;
- }
- {
- std::istringstream row(*(s[12]));
- row >> fft_len;
- }
- {
- std::istringstream row(*(s[13]));
- row >> chirp_rate;
- }
- {
- std::istringstream row(*(s[14]));
- row >> rfi_checked;
- }
- {
- std::istringstream row(*(s[15]));
- row >> rfi_found;
- }
- {
- std::istringstream row(*(s[16]));
- row >> reserved;
- }
- }
-
- void autocorr_tinysky::parse(const std::string &s) {
- SQL_ROW row(&s,17);
- parse(row);
- }
+ if (&a != this) {
+ id=a.id;
+ result_id=a.result_id;
+ peak_power=a.peak_power;
+ mean_power=a.mean_power;
+ time=a.time;
+ ra=a.ra;
+ decl=a.decl;
+ q_pix=a.q_pix;
+ delay=a.delay;
+ freq=a.freq;
+ detection_freq=a.detection_freq;
+ barycentric_freq=a.barycentric_freq;
+ fft_len=a.fft_len;
+ chirp_rate=a.chirp_rate;
+ rfi_checked=a.rfi_checked;
+ rfi_found=a.rfi_found;
+ reserved=a.reserved;
+ }
+ return (*this);
+}
+
+
+std::string autocorr_tinysky::update_format() const {
+ std::ostringstream rv("");
+
+ for (int i=2; i<17; i++) {
+ rv << "?,";
+ }
+ rv << "?";
+ return rv.str();
+}
+
+
+std::string autocorr_tinysky::insert_format() const {
+ return std::string("?,")+update_format();
+}
+
+std::string autocorr_tinysky::select_format() const {
+ std::string rv("");
+ for (int i=0; i<16; i++) {
+ rv+="?,";
+ }
+ rv+="?";
+ return rv;
+}
+
+std::string autocorr_tinysky::print(int full_subtables, int show_ids, int no_refs) const {
+ std::ostringstream rv("");
+
+ rv.precision(14);
+ if (show_ids) {
+ rv << id;
+ }
+ rv << ',';
+ if (!no_refs) {
+ if (full_subtables) {
+ rv << result_id.print(full_subtables,show_ids,no_refs);
+ } else {
+ rv << result_id.id;
+ }
+ }
+ rv << ',';
+ rv << peak_power;
+ rv << ',';
+ rv << mean_power;
+ rv << ',';
+ rv << time;
+ rv << ',';
+ rv << ra;
+ rv << ',';
+ rv << decl;
+ rv << ',';
+ rv << q_pix;
+ rv << ',';
+ rv << delay;
+ rv << ',';
+ rv << freq;
+ rv << ',';
+ rv << detection_freq;
+ rv << ',';
+ rv << barycentric_freq;
+ rv << ',';
+ rv << fft_len;
+ rv << ',';
+ rv << chirp_rate;
+ rv << ',';
+ rv << rfi_checked;
+ rv << ',';
+ rv << rfi_found;
+ rv << ',';
+ rv << reserved;
+ return rv.str();
+}
+
+
+std::string autocorr_tinysky::print_xml(int full_subtables, int show_ids, int no_refs,const char *tag) const {
+ std::ostringstream rv("");
+
+ rv.precision(14);
+ rv << xml_indent() << '<' << tag << ">\n";
+ xml_indent(2);
+ if (show_ids) {
+ rv << xml_indent() << "<id>" << id << "</id>\n";
+ }
+ if (!no_refs) {
+ if (full_subtables) {
+ rv << result_id.print_xml(full_subtables,show_ids,no_refs,"result_id");
+ } else {
+ rv << xml_indent() << "<result_id><id>" << result_id.id << "</id></result_id>\n";
+ }
+ }
+ rv << xml_indent() << "<peak_power>" << peak_power << "</peak_power>\n";
+ rv << xml_indent() << "<mean_power>" << mean_power << "</mean_power>\n";
+ rv << xml_indent() << "<time>" << time << "</time>\n";
+ rv << xml_indent() << "<ra>" << ra << "</ra>\n";
+ rv << xml_indent() << "<decl>" << decl << "</decl>\n";
+ rv << xml_indent() << "<q_pix>" << q_pix << "</q_pix>\n";
+ rv << xml_indent() << "<delay>" << delay << "</delay>\n";
+ rv << xml_indent() << "<freq>" << freq << "</freq>\n";
+ rv << xml_indent() << "<detection_freq>" << detection_freq << "</detection_freq>\n";
+ rv << xml_indent() << "<barycentric_freq>" << barycentric_freq << "</barycentric_freq>\n";
+ rv << xml_indent() << "<fft_len>" << fft_len << "</fft_len>\n";
+ rv << xml_indent() << "<chirp_rate>" << chirp_rate << "</chirp_rate>\n";
+ rv << xml_indent() << "<rfi_checked>" << rfi_checked << "</rfi_checked>\n";
+ rv << xml_indent() << "<rfi_found>" << rfi_found << "</rfi_found>\n";
+ rv << xml_indent() << "<reserved>" << reserved << "</reserved>\n";
+ xml_indent(-2);
+ rv << xml_indent() << "</" << tag << ">\n";
+ return rv.str();
+}
+
+
+void autocorr_tinysky::parse_xml(const std::string &s,const char *tag) {
+ std::string field,sub;
+ if (extract_xml_record(s,tag,field)) {
+ std::string::size_type pos=0;
+ if (extract_xml_record(field,"id",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> id;
+ }
+ if (extract_xml_record(field,"result_id",sub)) {
+ result_id.parse_xml(sub,"result_id");
+ }
+ if (extract_xml_record(field,"peak_power",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> peak_power;
+ }
+ if (extract_xml_record(field,"mean_power",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> mean_power;
+ }
+ if (extract_xml_record(field,"time",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> time;
+ }
+ if (extract_xml_record(field,"ra",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> ra;
+ }
+ if (extract_xml_record(field,"decl",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> decl;
+ }
+ if (extract_xml_record(field,"q_pix",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> q_pix;
+ }
+ if (extract_xml_record(field,"delay",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> delay;
+ }
+ if (extract_xml_record(field,"freq",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> freq;
+ }
+ if (extract_xml_record(field,"detection_freq",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> detection_freq;
+ }
+ if (extract_xml_record(field,"barycentric_freq",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> barycentric_freq;
+ }
+ if (extract_xml_record(field,"fft_len",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> fft_len;
+ }
+ if (extract_xml_record(field,"chirp_rate",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> chirp_rate;
+ }
+ if (extract_xml_record(field,"rfi_checked",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> rfi_checked;
+ }
+ if (extract_xml_record(field,"rfi_found",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> rfi_found;
+ }
+ if (extract_xml_record(field,"reserved",sub)) {
+ pos=sub.find(">");
+ do {
+ pos++;
+ } while (sub[pos]=='\n');
+ std::istringstream in(sub.c_str()+pos);
+ in >> reserved;
+ }
+ }
+}
+
+void autocorr_tinysky::parse(const SQL_ROW &s) {
+ {
+ std::istringstream row(*(s[0]));
+ row >> id;
+ }
+ {
+ result_id.parse(SQL_ROW(s[1],0));
+ }
+ {
+ std::istringstream row(*(s[2]));
+ row >> peak_power;
+ }
+ {
+ std::istringstream row(*(s[3]));
+ row >> mean_power;
+ }
+ {
+ std::istringstream row(*(s[4]));
+ row >> time;
+ }
+ {
+ std::istringstream row(*(s[5]));
+ row >> ra;
+ }
+ {
+ std::istringstream row(*(s[6]));
+ row >> decl;
+ }
+ {
+ std::istringstream row(*(s[7]));
+ row >> q_pix;
+ }
+ {
+ std::istringstream row(*(s[8]));
+ row >> delay;
+ }
+ {
+ std::istringstream row(*(s[9]));
+ row >> freq;
+ }
+ {
+ std::istringstream row(*(s[10]));
+ row >> detection_freq;
+ }
+ {
+ std::istringstream row(*(s[11]));
+ row >> barycentric_freq;
+ }
+ {
+ std::istringstream row(*(s[12]));
+ row >> fft_len;
+ }
+ {
+ std::istringstream row(*(s[13]));
+ row >> chirp_rate;
+ }
+ {
+ std::istringstream row(*(s[14]));
+ row >> rfi_checked;
+ }
+ {
+ std::istringstream row(*(s[15]));
+ row >> rfi_found;
+ }
+ {
+ std::istringstream row(*(s[16]));
+ row >> reserved;
+ }
+}
+
+void autocorr_tinysky::parse(const std::string &s) {
+ SQL_ROW row(&s,17);
+ parse(row);
+}
diff --git a/db/schema_master.h b/db/schema_master.h
index 3decfc8..7dd70c5 100644
--- a/db/schema_master.h
+++ b/db/schema_master.h
@@ -5,1416 +5,1430 @@ extern const char *db_name;
extern int db_is_open;
#ifndef CLIENT
-inline int db_open() {
- if (!db_is_open) db_is_open=sql_database(db_name);
- return db_is_open; }
-inline int db_close() {
- if (db_is_open) db_is_open=!sql_finish();
- return !db_is_open; }
-inline int db_change(const char *name) {
- if(strcmp(db_name, name) || !db_is_open) {
- db_close();
- db_name=name;
- db_open(); } return(db_is_open); }
+inline int db_open() {
+ if (!db_is_open) {
+ db_is_open=sql_database(db_name);
+ }
+ return db_is_open;
+}
+inline int db_close() {
+ if (db_is_open) {
+ db_is_open=!sql_finish();
+ }
+ return !db_is_open;
+}
+inline int db_change(const char *name) {
+ if (strcmp(db_name, name) || !db_is_open) {
+ db_close();
+ db_name=name;
+ db_open();
+ } return(db_is_open);
+}
#else
-inline int db_open() { return (db_is_open=1); }
-inline int db_close() { return !(db_is_open=0); }
-inline int db_change() { return (db_is_open=1); }
+inline int db_open() {
+ return (db_is_open=1);
+}
+inline int db_close() {
+ return !(db_is_open=0);
+}
+inline int db_change() {
+ return (db_is_open=1);
+}
#endif
class coordinate_t : public db_type<coordinate_t> {
- public:
- double time;
- double ra;
- double dec;
- coordinate_t();
- coordinate_t(const coordinate_t &a);
- coordinate_t(const SQL_ROW &a);
- coordinate_t(const std::string &s,const char *tag="coordinate_t");
- coordinate_t &operator =(const coordinate_t &a);
- std::string update_format() const;
- std::string insert_format() const;
- std::string select_format() const;
- std::string print(int full_subtables=0, int show_ids=1, int no_refs=0) const;
- std::string print_xml(int full_subtables=1, int show_ids=0, int no_refs=0,const char *tag="coordinate_t") const;
- void parse(const SQL_ROW &s);
- void parse(const std::string &s);
- void parse_xml(const std::string &s,const char *tag="coordinate_t");
- private:
+ public:
+ double time;
+ double ra;
+ double dec;
+ coordinate_t();
+ coordinate_t(const coordinate_t &a);
+ coordinate_t(const SQL_ROW &a);
+ coordinate_t(const std::string &s,const char *tag="coordinate_t");
+ coordinate_t &operator =(const coordinate_t &a);
+ std::string update_format() const;
+ std::string insert_format() const;
+ std::string select_format() const;
+ std::string print(int full_subtables=0, int show_ids=1, int no_refs=0) const;
+ std::string print_xml(int full_subtables=1, int show_ids=0, int no_refs=0,const char *tag="coordinate_t") const;
+ void parse(const SQL_ROW &s);
+ void parse(const std::string &s);
+ void parse_xml(const std::string &s,const char *tag="coordinate_t");
+ private:
};
class chirp_parameter_t : public db_type<chirp_parameter_t> {
- public:
- double chirp_limit;
- long fft_len_flags;
- chirp_parameter_t();
- chirp_parameter_t(const chirp_parameter_t &a);
- chirp_parameter_t(const SQL_ROW &a);
- chirp_parameter_t(const std::string &s,const char *tag="chirp_parameter_t");
- chirp_parameter_t &operator =(const chirp_parameter_t &a);
- std::string update_format() const;
- std::string insert_format() const;
- std::string select_format() const;
- std::string print(int full_subtables=0, int show_ids=1, int no_refs=0) const;
- std::string print_xml(int full_subtables=1, int show_ids=0, int no_refs=0,const char *tag="chirp_parameter_t") const;
- void parse(const SQL_ROW &s);
- void parse(const std::string &s);
- void parse_xml(const std::string &s,const char *tag="chirp_parameter_t");
- private:
+ public:
+ double chirp_limit;
+ long fft_len_flags;
+ chirp_parameter_t();
+ chirp_parameter_t(const chirp_parameter_t &a);
+ chirp_parameter_t(const SQL_ROW &a);
+ chirp_parameter_t(const std::string &s,const char *tag="chirp_parameter_t");
+ chirp_parameter_t &operator =(const chirp_parameter_t &a);
+ std::string update_format() const;
+ std::string insert_format() const;
+ std::string select_format() const;
+ std::string print(int full_subtables=0, int show_ids=1, int no_refs=0) const;
+ std::string print_xml(int full_subtables=1, int show_ids=0, int no_refs=0,const char *tag="chirp_parameter_t") const;
+ void parse(const SQL_ROW &s);
+ void parse(const std::string &s);
+ void parse_xml(const std::string &s,const char *tag="chirp_parameter_t");
+ private:
};
class subband_description_t : public db_type<subband_description_t> {
- public:
- long number;
- double center;
- double base;
- double sample_rate;
- subband_description_t();
- subband_description_t(const subband_description_t &a);
- subband_description_t(const SQL_ROW &a);
- subband_description_t(const std::string &s,const char *tag="subband_description_t");
- subband_description_t &operator =(const subband_description_t &a);
- std::string update_format() const;
- std::string insert_format() const;
- std::string select_format() const;
- std::string print(int full_subtables=0, int show_ids=1, int no_refs=0) const;
- std::string print_xml(int full_subtables=1, int show_ids=0, int no_refs=0,const char *tag="subband_description_t") const;
- void parse(const SQL_ROW &s);
- void parse(const std::string &s);
- void parse_xml(const std::string &s,const char *tag="subband_description_t");
- private:
+ public:
+ long number;
+ double center;
+ double base;
+ double sample_rate;
+ subband_description_t();
+ subband_description_t(const subband_description_t &a);
+ subband_description_t(const SQL_ROW &a);
+ subband_description_t(const std::string &s,const char *tag="subband_description_t");
+ subband_description_t &operator =(const subband_description_t &a);
+ std::string update_format() const;
+ std::string insert_format() const;
+ std::string select_format() const;
+ std::string print(int full_subtables=0, int show_ids=1, int no_refs=0) const;
+ std::string print_xml(int full_subtables=1, int show_ids=0, int no_refs=0,const char *tag="subband_description_t") const;
+ void parse(const SQL_ROW &s);
+ void parse(const std::string &s);
+ void parse_xml(const std::string &s,const char *tag="subband_description_t");
+ private:
};
class data_description_t : public db_type<data_description_t> {
- public:
- double start_ra;
- double start_dec;
- double end_ra;
- double end_dec;
- double true_angle_range;
- char time_recorded[255];
- double time_recorded_jd;
- long nsamples;
- sqlblob<coordinate_t> coords ;
- data_description_t();
- data_description_t(const data_description_t &a);
- data_description_t(const SQL_ROW &a);
- data_description_t(const std::string &s,const char *tag="data_description_t");
- data_description_t &operator =(const data_description_t &a);
- std::string update_format() const;
- std::string insert_format() const;
- std::string select_format() const;
- std::string print(int full_subtables=0, int show_ids=1, int no_refs=0) const;
- std::string print_xml(int full_subtables=1, int show_ids=0, int no_refs=0,const char *tag="data_description_t") const;
- void parse(const SQL_ROW &s);
- void parse(const std::string &s);
- void parse_xml(const std::string &s,const char *tag="data_description_t");
- private:
+ public:
+ double start_ra;
+ double start_dec;
+ double end_ra;
+ double end_dec;
+ double true_angle_range;
+ char time_recorded[255];
+ double time_recorded_jd;
+ long nsamples;
+ sqlblob<coordinate_t> coords ;
+ data_description_t();
+ data_description_t(const data_description_t &a);
+ data_description_t(const SQL_ROW &a);
+ data_description_t(const std::string &s,const char *tag="data_description_t");
+ data_description_t &operator =(const data_description_t &a);
+ std::string update_format() const;
+ std::string insert_format() const;
+ std::string select_format() const;
+ std::string print(int full_subtables=0, int show_ids=1, int no_refs=0) const;
+ std::string print_xml(int full_subtables=1, int show_ids=0, int no_refs=0,const char *tag="data_description_t") const;
+ void parse(const SQL_ROW &s);
+ void parse(const std::string &s);
+ void parse_xml(const std::string &s,const char *tag="data_description_t");
+ private:
};
class receiver_config : public db_table<receiver_config> {
- public:
- long id;
- long s4_id;
- char name[255];
- double beam_width;
- double center_freq;
- double latitude;
- double longitude;
- double elevation;
- double diameter;
- double az_orientation;
- sqlblob<float> az_corr_coeff ;
- sqlblob<float> zen_corr_coeff ;
- double array_az_ellipse;
- double array_za_ellipse;
- double array_angle;
- long min_vgc;
- receiver_config();
- receiver_config(const receiver_config &a);
- receiver_config(const SQL_ROW &a);
- receiver_config(const std::string &s,const char *tag="receiver_config");
- receiver_config &operator =(const receiver_config &a);
- std::string update_format() const;
- std::string insert_format() const;
- std::string select_format() const;
- std::string print(int full_subtables=0, int show_ids=1, int no_refs=0) const;
- std::string print_xml(int full_subtables=1, int show_ids=0, int no_refs=0,const char *tag="receiver_config") const;
- void parse(const SQL_ROW &s);
- void parse(const std::string &s);
- void parse_xml(const std::string &s,const char *tag="receiver_config");
- private:
+ public:
+ long id;
+ long s4_id;
+ char name[255];
+ double beam_width;
+ double center_freq;
+ double latitude;
+ double longitude;
+ double elevation;
+ double diameter;
+ double az_orientation;
+ sqlblob<float> az_corr_coeff ;
+ sqlblob<float> zen_corr_coeff ;
+ double array_az_ellipse;
+ double array_za_ellipse;
+ double array_angle;
+ long min_vgc;
+ receiver_config();
+ receiver_config(const receiver_config &a);
+ receiver_config(const SQL_ROW &a);
+ receiver_config(const std::string &s,const char *tag="receiver_config");
+ receiver_config &operator =(const receiver_config &a);
+ std::string update_format() const;
+ std::string insert_format() const;
+ std::string select_format() const;
+ std::string print(int full_subtables=0, int show_ids=1, int no_refs=0) const;
+ std::string print_xml(int full_subtables=1, int show_ids=0, int no_refs=0,const char *tag="receiver_config") const;
+ void parse(const SQL_ROW &s);
+ void parse(const std::string &s);
+ void parse_xml(const std::string &s,const char *tag="receiver_config");
+ private:
};
class recorder_config : public db_table<recorder_config> {
- public:
- long id;
- char name[64];
- long bits_per_sample;
- double sample_rate;
- long beams;
- double version;
- recorder_config();
- recorder_config(const recorder_config &a);
- recorder_config(const SQL_ROW &a);
- recorder_config(const std::string &s,const char *tag="recorder_config");
- recorder_config &operator =(const recorder_config &a);
- std::string update_format() const;
- std::string insert_format() const;
- std::string select_format() const;
- std::string print(int full_subtables=0, int show_ids=1, int no_refs=0) const;
- std::string print_xml(int full_subtables=1, int show_ids=0, int no_refs=0,const char *tag="recorder_config") const;
- void parse(const SQL_ROW &s);
- void parse(const std::string &s);
- void parse_xml(const std::string &s,const char *tag="recorder_config");
- private:
+ public:
+ long id;
+ char name[64];
+ long bits_per_sample;
+ double sample_rate;
+ long beams;
+ double version;
+ recorder_config();
+ recorder_config(const recorder_config &a);
+ recorder_config(const SQL_ROW &a);
+ recorder_config(const std::string &s,const char *tag="recorder_config");
+ recorder_config &operator =(const recorder_config &a);
+ std::string update_format() const;
+ std::string insert_format() const;
+ std::string select_format() const;
+ std::string print(int full_subtables=0, int show_ids=1, int no_refs=0) const;
+ std::string print_xml(int full_subtables=1, int show_ids=0, int no_refs=0,const char *tag="recorder_config") const;
+ void parse(const SQL_ROW &s);
+ void parse(const std::string &s);
+ void parse_xml(const std::string &s,const char *tag="recorder_config");
+ private:
};
class splitter_config : public db_table<splitter_config> {
- public:
- long id;
- double version;
- char data_type[64];
- long fft_len;
- long ifft_len;
- char filter[64];
- char window[64];
- long samples_per_wu;
- double highpass;
- char blanker_filter[64];
- long pfb_ntaps;
- double pfb_width_factor;
- splitter_config();
- splitter_config(const splitter_config &a);
- splitter_config(const SQL_ROW &a);
- splitter_config(const std::string &s,const char *tag="splitter_config");
- splitter_config &operator =(const splitter_config &a);
- std::string update_format() const;
- std::string insert_format() const;
- std::string select_format() const;
- std::string print(int full_subtables=0, int show_ids=1, int no_refs=0) const;
- std::string print_xml(int full_subtables=1, int show_ids=0, int no_refs=0,const char *tag="splitter_config") const;
- void parse(const SQL_ROW &s);
- void parse(const std::string &s);
- void parse_xml(const std::string &s,const char *tag="splitter_config");
- private:
+ public:
+ long id;
+ double version;
+ char data_type[64];
+ long fft_len;
+ long ifft_len;
+ char filter[64];
+ char window[64];
+ long samples_per_wu;
+ double highpass;
+ char blanker_filter[64];
+ long pfb_ntaps;
+ double pfb_width_factor;
+ splitter_config();
+ splitter_config(const splitter_config &a);
+ splitter_config(const SQL_ROW &a);
+ splitter_config(const std::string &s,const char *tag="splitter_config");
+ splitter_config &operator =(const splitter_config &a);
+ std::string update_format() const;
+ std::string insert_format() const;
+ std::string select_format() const;
+ std::string print(int full_subtables=0, int show_ids=1, int no_refs=0) const;
+ std::string print_xml(int full_subtables=1, int show_ids=0, int no_refs=0,const char *tag="splitter_config") const;
+ void parse(const SQL_ROW &s);
+ void parse(const std::string &s);
+ void parse_xml(const std::string &s,const char *tag="splitter_config");
+ private:
};
class analysis_config : public db_table<analysis_config> {
- public:
- long id;
- double spike_thresh;
- long spikes_per_spectrum;
- double autocorr_thresh;
- long autocorr_per_spectrum;
- long autocorr_fftlen;
- double gauss_null_chi_sq_thresh;
- double gauss_chi_sq_thresh;
- double gauss_power_thresh;
- double gauss_peak_power_thresh;
- long gauss_pot_length;
- double pulse_thresh;
- double pulse_display_thresh;
- long pulse_max;
- long pulse_min;
- long pulse_fft_max;
- long pulse_pot_length;
- double triplet_thresh;
- long triplet_max;
- long triplet_min;
- long triplet_pot_length;
- double pot_overlap_factor;
- double pot_t_offset;
- double pot_min_slew;
- double pot_max_slew;
- double chirp_resolution;
- long analysis_fft_lengths;
- long bsmooth_boxcar_length;
- long bsmooth_chunk_size;
- sqlblob<chirp_parameter_t> chirps ;
- double pulse_beams;
- long max_signals;
- long max_spikes;
- long max_autocorr;
- long max_gaussians;
- long max_pulses;
- long max_triplets;
- long keyuniq;
- double credit_rate;
- analysis_config();
- analysis_config(const analysis_config &a);
- analysis_config(const SQL_ROW &a);
- analysis_config(const std::string &s,const char *tag="analysis_config");
- analysis_config &operator =(const analysis_config &a);
- std::string update_format() const;
- std::string insert_format() const;
- std::string select_format() const;
- std::string print(int full_subtables=0, int show_ids=1, int no_refs=0) const;
- std::string print_xml(int full_subtables=1, int show_ids=0, int no_refs=0,const char *tag="analysis_config") const;
- void parse(const SQL_ROW &s);
- void parse(const std::string &s);
- void parse_xml(const std::string &s,const char *tag="analysis_config");
- private:
+ public:
+ long id;
+ double spike_thresh;
+ long spikes_per_spectrum;
+ double autocorr_thresh;
+ long autocorr_per_spectrum;
+ long autocorr_fftlen;
+ double gauss_null_chi_sq_thresh;
+ double gauss_chi_sq_thresh;
+ double gauss_power_thresh;
+ double gauss_peak_power_thresh;
+ long gauss_pot_length;
+ double pulse_thresh;
+ double pulse_display_thresh;
+ long pulse_max;
+ long pulse_min;
+ long pulse_fft_max;
+ long pulse_pot_length;
+ double triplet_thresh;
+ long triplet_max;
+ long triplet_min;
+ long triplet_pot_length;
+ double pot_overlap_factor;
+ double pot_t_offset;
+ double pot_min_slew;
+ double pot_max_slew;
+ double chirp_resolution;
+ long analysis_fft_lengths;
+ long bsmooth_boxcar_length;
+ long bsmooth_chunk_size;
+ sqlblob<chirp_parameter_t> chirps ;
+ double pulse_beams;
+ long max_signals;
+ long max_spikes;
+ long max_autocorr;
+ long max_gaussians;
+ long max_pulses;
+ long max_triplets;
+ long keyuniq;
+ double credit_rate;
+ analysis_config();
+ analysis_config(const analysis_config &a);
+ analysis_config(const SQL_ROW &a);
+ analysis_config(const std::string &s,const char *tag="analysis_config");
+ analysis_config &operator =(const analysis_config &a);
+ std::string update_format() const;
+ std::string insert_format() const;
+ std::string select_format() const;
+ std::string print(int full_subtables=0, int show_ids=1, int no_refs=0) const;
+ std::string print_xml(int full_subtables=1, int show_ids=0, int no_refs=0,const char *tag="analysis_config") const;
+ void parse(const SQL_ROW &s);
+ void parse(const std::string &s);
+ void parse_xml(const std::string &s,const char *tag="analysis_config");
+ private:
};
class science_config : public db_table<science_config> {
- public:
- long id;
- long active;
- char qpix_scheme[16];
- long qpix_nside;
- double fpix_width;
- double total_bandwidth;
- double freq_uncertainty;
- double fwhm_beamwidth;
- double sky_disc_radius;
- double observable_sky;
- long epoch;
- double bary_chirp_window;
- long bary_freq_window;
- long nonbary_freq_window;
- double spike_obs_duration;
- double spike_obs_interval;
- double gauss_obs_duration;
- double gauss_obs_interval;
- double pulse_obs_duration;
- double pulse_obs_interval;
- double triplet_obs_duration;
- double triplet_obs_interval;
- sqlint8_t min_spike_id;
- sqlint8_t min_autocorr_id;
- sqlint8_t min_gaussian_id;
- sqlint8_t min_pulse_id;
- sqlint8_t min_triplet_id;
- double min_app_version;
- char info_xml[255];
- science_config();
- science_config(const science_config &a);
- science_config(const SQL_ROW &a);
- science_config(const std::string &s,const char *tag="science_config");
- science_config &operator =(const science_config &a);
- std::string update_format() const;
- std::string insert_format() const;
- std::string select_format() const;
- std::string print(int full_subtables=0, int show_ids=1, int no_refs=0) const;
- std::string print_xml(int full_subtables=1, int show_ids=0, int no_refs=0,const char *tag="science_config") const;
- void parse(const SQL_ROW &s);
- void parse(const std::string &s);
- void parse_xml(const std::string &s,const char *tag="science_config");
- private:
+ public:
+ long id;
+ long active;
+ char qpix_scheme[16];
+ long qpix_nside;
+ double fpix_width;
+ double total_bandwidth;
+ double freq_uncertainty;
+ double fwhm_beamwidth;
+ double sky_disc_radius;
+ double observable_sky;
+ long epoch;
+ double bary_chirp_window;
+ long bary_freq_window;
+ long nonbary_freq_window;
+ double spike_obs_duration;
+ double spike_obs_interval;
+ double gauss_obs_duration;
+ double gauss_obs_interval;
+ double pulse_obs_duration;
+ double pulse_obs_interval;
+ double triplet_obs_duration;
+ double triplet_obs_interval;
+ sqlint8_t min_spike_id;
+ sqlint8_t min_autocorr_id;
+ sqlint8_t min_gaussian_id;
+ sqlint8_t min_pulse_id;
+ sqlint8_t min_triplet_id;
+ double min_app_version;
+ char info_xml[255];
+ science_config();
+ science_config(const science_config &a);
+ science_config(const SQL_ROW &a);
+ science_config(const std::string &s,const char *tag="science_config");
+ science_config &operator =(const science_config &a);
+ std::string update_format() const;
+ std::string insert_format() const;
+ std::string select_format() const;
+ std::string print(int full_subtables=0, int show_ids=1, int no_refs=0) const;
+ std::string print_xml(int full_subtables=1, int show_ids=0, int no_refs=0,const char *tag="science_config") const;
+ void parse(const SQL_ROW &s);
+ void parse(const std::string &s);
+ void parse_xml(const std::string &s,const char *tag="science_config");
+ private:
};
class candidate_t : public db_type<candidate_t> {
- public:
- long type;
- sqlint8_t id;
- long num_obs;
- double score;
- long is_rfi;
- candidate_t();
- candidate_t(const candidate_t &a);
- candidate_t(const SQL_ROW &a);
- candidate_t(const std::string &s,const char *tag="candidate_t");
- candidate_t &operator =(const candidate_t &a);
- std::string update_format() const;
- std::string insert_format() const;
- std::string select_format() const;
- std::string print(int full_subtables=0, int show_ids=1, int no_refs=0) const;
- std::string print_xml(int full_subtables=1, int show_ids=0, int no_refs=0,const char *tag="candidate_t") const;
- void parse(const SQL_ROW &s);
- void parse(const std::string &s);
- void parse_xml(const std::string &s,const char *tag="candidate_t");
- private:
+ public:
+ long type;
+ sqlint8_t id;
+ long num_obs;
+ double score;
+ long is_rfi;
+ candidate_t();
+ candidate_t(const candidate_t &a);
+ candidate_t(const SQL_ROW &a);
+ candidate_t(const std::string &s,const char *tag="candidate_t");
+ candidate_t &operator =(const candidate_t &a);
+ std::string update_format() const;
+ std::string insert_format() const;
+ std::string select_format() const;
+ std::string print(int full_subtables=0, int show_ids=1, int no_refs=0) const;
+ std::string print_xml(int full_subtables=1, int show_ids=0, int no_refs=0,const char *tag="candidate_t") const;
+ void parse(const SQL_ROW &s);
+ void parse(const std::string &s);
+ void parse_xml(const std::string &s,const char *tag="candidate_t");
+ private:
};
class meta_candidate : public db_table<meta_candidate> {
- public:
- sqlint8_t id;
- long version;
- double time_last_updated;
- long num_spikes;
- long num_spike_b_multiplets;
- double best_spike_b_mp_score;
- long num_spike_nb_multiplets;
- double best_spike_nb_mp_score;
- sqlint8_t spike_high_id;
- long num_gaussians;
- long num_gaussian_b_multiplets;
- double best_gaussian_b_mp_score;
- long num_gaussian_nb_multiplets;
- double best_gaussian_nb_mp_score;
- sqlint8_t gaussian_high_id;
- long num_pulses;
- long num_pulse_b_multiplets;
- double best_pulse_b_mp_score;
- long num_pulse_nb_multiplets;
- double best_pulse_nb_mp_score;
- sqlint8_t pulse_high_id;
- long num_triplets;
- long num_triplet_b_multiplets;
- double best_triplet_b_mp_score;
- long num_triplet_nb_multiplets;
- double best_triplet_nb_mp_score;
- sqlint8_t triplet_high_id;
- long num_stars;
- double best_star_score;
- double meta_score;
- long rfi_clean;
- long state;
- meta_candidate();
- meta_candidate(const meta_candidate &a);
- meta_candidate(const SQL_ROW &a);
- meta_candidate(const std::string &s,const char *tag="meta_candidate");
- meta_candidate &operator =(const meta_candidate &a);
- std::string update_format() const;
- std::string insert_format() const;
- std::string select_format() const;
- std::string print(int full_subtables=0, int show_ids=1, int no_refs=0) const;
- std::string print_xml(int full_subtables=1, int show_ids=0, int no_refs=0,const char *tag="meta_candidate") const;
- void parse(const SQL_ROW &s);
- void parse(const std::string &s);
- void parse_xml(const std::string &s,const char *tag="meta_candidate");
- private:
+ public:
+ sqlint8_t id;
+ long version;
+ double time_last_updated;
+ long num_spikes;
+ long num_spike_b_multiplets;
+ double best_spike_b_mp_score;
+ long num_spike_nb_multiplets;
+ double best_spike_nb_mp_score;
+ sqlint8_t spike_high_id;
+ long num_gaussians;
+ long num_gaussian_b_multiplets;
+ double best_gaussian_b_mp_score;
+ long num_gaussian_nb_multiplets;
+ double best_gaussian_nb_mp_score;
+ sqlint8_t gaussian_high_id;
+ long num_pulses;
+ long num_pulse_b_multiplets;
+ double best_pulse_b_mp_score;
+ long num_pulse_nb_multiplets;
+ double best_pulse_nb_mp_score;
+ sqlint8_t pulse_high_id;
+ long num_triplets;
+ long num_triplet_b_multiplets;
+ double best_triplet_b_mp_score;
+ long num_triplet_nb_multiplets;
+ double best_triplet_nb_mp_score;
+ sqlint8_t triplet_high_id;
+ long num_stars;
+ double best_star_score;
+ double meta_score;
+ long rfi_clean;
+ long state;
+ meta_candidate();
+ meta_candidate(const meta_candidate &a);
+ meta_candidate(const SQL_ROW &a);
+ meta_candidate(const std::string &s,const char *tag="meta_candidate");
+ meta_candidate &operator =(const meta_candidate &a);
+ std::string update_format() const;
+ std::string insert_format() const;
+ std::string select_format() const;
+ std::string print(int full_subtables=0, int show_ids=1, int no_refs=0) const;
+ std::string print_xml(int full_subtables=1, int show_ids=0, int no_refs=0,const char *tag="meta_candidate") const;
+ void parse(const SQL_ROW &s);
+ void parse(const std::string &s);
+ void parse_xml(const std::string &s,const char *tag="meta_candidate");
+ private:
};
class multiplet : public db_table<multiplet> {
- public:
- long id;
- long version;
- long signal_type;
- long mp_type;
- long qpix;
- double freq_win;
- double mean_ra;
- double mean_decl;
- double ra_stddev;
- double decl_stddev;
- double mean_angular_distance;
- double angular_distance_stddev;
- double mean_frequency;
- double frequency_stddev;
- double mean_chirp;
- double chirp_stddev;
- double mean_period;
- double period_stddev;
- double mean_snr;
- double snr_stddev;
- double mean_threshold;
- double threshold_stddev;
- double score;
- long num_detections;
- sqlblob<sqlint8_t> signal_ids ;
- multiplet();
- multiplet(const multiplet &a);
- multiplet(const SQL_ROW &a);
- multiplet(const std::string &s,const char *tag="multiplet");
- multiplet &operator =(const multiplet &a);
- std::string update_format() const;
- std::string insert_format() const;
- std::string select_format() const;
- std::string print(int full_subtables=0, int show_ids=1, int no_refs=0) const;
- std::string print_xml(int full_subtables=1, int show_ids=0, int no_refs=0,const char *tag="multiplet") const;
- void parse(const SQL_ROW &s);
- void parse(const std::string &s);
- void parse_xml(const std::string &s,const char *tag="multiplet");
- private:
+ public:
+ long id;
+ long version;
+ long signal_type;
+ long mp_type;
+ long qpix;
+ double freq_win;
+ double mean_ra;
+ double mean_decl;
+ double ra_stddev;
+ double decl_stddev;
+ double mean_angular_distance;
+ double angular_distance_stddev;
+ double mean_frequency;
+ double frequency_stddev;
+ double mean_chirp;
+ double chirp_stddev;
+ double mean_period;
+ double period_stddev;
+ double mean_snr;
+ double snr_stddev;
+ double mean_threshold;
+ double threshold_stddev;
+ double score;
+ long num_detections;
+ sqlblob<sqlint8_t> signal_ids ;
+ multiplet();
+ multiplet(const multiplet &a);
+ multiplet(const SQL_ROW &a);
+ multiplet(const std::string &s,const char *tag="multiplet");
+ multiplet &operator =(const multiplet &a);
+ std::string update_format() const;
+ std::string insert_format() const;
+ std::string select_format() const;
+ std::string print(int full_subtables=0, int show_ids=1, int no_refs=0) const;
+ std::string print_xml(int full_subtables=1, int show_ids=0, int no_refs=0,const char *tag="multiplet") const;
+ void parse(const SQL_ROW &s);
+ void parse(const std::string &s);
+ void parse_xml(const std::string &s,const char *tag="multiplet");
+ private:
};
class star : public db_table<star> {
- public:
- long id;
- char object_type[16];
- char catalog_name[64];
- long catalog_number;
- char object_name[64];
- double ra;
- double decl;
- long qpix;
- double v_mag;
- double b_minus_v;
- double parallax;
- char stellar_type[32];
- long planets;
- double score;
- star();
- star(const star &a);
- star(const SQL_ROW &a);
- star(const std::string &s,const char *tag="star");
- star &operator =(const star &a);
- std::string update_format() const;
- std::string insert_format() const;
- std::string select_format() const;
- std::string print(int full_subtables=0, int show_ids=1, int no_refs=0) const;
- std::string print_xml(int full_subtables=1, int show_ids=0, int no_refs=0,const char *tag="star") const;
- void parse(const SQL_ROW &s);
- void parse(const std::string &s);
- void parse_xml(const std::string &s,const char *tag="star");
- private:
+ public:
+ long id;
+ char object_type[16];
+ char catalog_name[64];
+ long catalog_number;
+ char object_name[64];
+ double ra;
+ double decl;
+ long qpix;
+ double v_mag;
+ double b_minus_v;
+ double parallax;
+ char stellar_type[32];
+ long planets;
+ double score;
+ star();
+ star(const star &a);
+ star(const SQL_ROW &a);
+ star(const std::string &s,const char *tag="star");
+ star &operator =(const star &a);
+ std::string update_format() const;
+ std::string insert_format() const;
+ std::string select_format() const;
+ std::string print(int full_subtables=0, int show_ids=1, int no_refs=0) const;
+ std::string print_xml(int full_subtables=1, int show_ids=0, int no_refs=0,const char *tag="star") const;
+ void parse(const SQL_ROW &s);
+ void parse(const std::string &s);
+ void parse_xml(const std::string &s,const char *tag="star");
+ private:
};
class candidate_count : public db_table<candidate_count> {
- public:
- long id;
- sqlint8_t spikes;
- sqlint8_t gaussians;
- sqlint8_t pulses;
- sqlint8_t triplets;
- sqlint8_t spike_barycentric_multiplets;
- sqlint8_t gaussian_barycentric_multiplets;
- sqlint8_t pulse_barycentric_multiplets;
- sqlint8_t triplet_barycentric_multiplets;
- sqlint8_t spike_nonbarycentric_multiplets;
- sqlint8_t gaussian_nonbarycentric_multiplets;
- sqlint8_t pulse_nonbarycentric_multiplets;
- sqlint8_t triplet_nonbarycentric_multiplets;
- sqlint8_t stars;
- long time_last_updated;
- candidate_count();
- candidate_count(const candidate_count &a);
- candidate_count(const SQL_ROW &a);
- candidate_count(const std::string &s,const char *tag="candidate_count");
- candidate_count &operator =(const candidate_count &a);
- std::string update_format() const;
- std::string insert_format() const;
- std::string select_format() const;
- std::string print(int full_subtables=0, int show_ids=1, int no_refs=0) const;
- std::string print_xml(int full_subtables=1, int show_ids=0, int no_refs=0,const char *tag="candidate_count") const;
- void parse(const SQL_ROW &s);
- void parse(const std::string &s);
- void parse_xml(const std::string &s,const char *tag="candidate_count");
- private:
+ public:
+ long id;
+ sqlint8_t spikes;
+ sqlint8_t gaussians;
+ sqlint8_t pulses;
+ sqlint8_t triplets;
+ sqlint8_t spike_barycentric_multiplets;
+ sqlint8_t gaussian_barycentric_multiplets;
+ sqlint8_t pulse_barycentric_multiplets;
+ sqlint8_t triplet_barycentric_multiplets;
+ sqlint8_t spike_nonbarycentric_multiplets;
+ sqlint8_t gaussian_nonbarycentric_multiplets;
+ sqlint8_t pulse_nonbarycentric_multiplets;
+ sqlint8_t triplet_nonbarycentric_multiplets;
+ sqlint8_t stars;
+ long time_last_updated;
+ candidate_count();
+ candidate_count(const candidate_count &a);
+ candidate_count(const SQL_ROW &a);
+ candidate_count(const std::string &s,const char *tag="candidate_count");
+ candidate_count &operator =(const candidate_count &a);
+ std::string update_format() const;
+ std::string insert_format() const;
+ std::string select_format() const;
+ std::string print(int full_subtables=0, int show_ids=1, int no_refs=0) const;
+ std::string print_xml(int full_subtables=1, int show_ids=0, int no_refs=0,const char *tag="candidate_count") const;
+ void parse(const SQL_ROW &s);
+ void parse(const std::string &s);
+ void parse_xml(const std::string &s,const char *tag="candidate_count");
+ private:
};
class tape : public db_table<tape> {
- public:
- long id;
- char name[20];
- double start_time;
- double last_block_time;
- long last_block_done;
- long missed;
- long tape_quality;
- long beam;
- tape();
- tape(const tape &a);
- tape(const SQL_ROW &a);
- tape(const std::string &s,const char *tag="tape");
- tape &operator =(const tape &a);
- std::string update_format() const;
- std::string insert_format() const;
- std::string select_format() const;
- std::string print(int full_subtables=0, int show_ids=1, int no_refs=0) const;
- std::string print_xml(int full_subtables=1, int show_ids=0, int no_refs=0,const char *tag="tape") const;
- void parse(const SQL_ROW &s);
- void parse(const std::string &s);
- void parse_xml(const std::string &s,const char *tag="tape");
- private:
+ public:
+ long id;
+ char name[20];
+ double start_time;
+ double last_block_time;
+ long last_block_done;
+ long missed;
+ long tape_quality;
+ long beam;
+ tape();
+ tape(const tape &a);
+ tape(const SQL_ROW &a);
+ tape(const std::string &s,const char *tag="tape");
+ tape &operator =(const tape &a);
+ std::string update_format() const;
+ std::string insert_format() const;
+ std::string select_format() const;
+ std::string print(int full_subtables=0, int show_ids=1, int no_refs=0) const;
+ std::string print_xml(int full_subtables=1, int show_ids=0, int no_refs=0,const char *tag="tape") const;
+ void parse(const SQL_ROW &s);
+ void parse(const std::string &s);
+ void parse_xml(const std::string &s,const char *tag="tape");
+ private:
};
class settings : public db_table<settings> {
- public:
- long id;
- long active;
- db_reference<recorder_config,long> recorder_cfg;
- db_reference<splitter_config,long> splitter_cfg;
- db_reference<analysis_config,long> analysis_cfg;
- db_reference<receiver_config,long> receiver_cfg;
- settings();
- settings(const settings &a);
- settings(const SQL_ROW &a);
- settings(const std::string &s,const char *tag="settings");
- settings &operator =(const settings &a);
- std::string update_format() const;
- std::string insert_format() const;
- std::string select_format() const;
- std::string print(int full_subtables=0, int show_ids=1, int no_refs=0) const;
- std::string print_xml(int full_subtables=1, int show_ids=0, int no_refs=0,const char *tag="settings") const;
- void parse(const SQL_ROW &s);
- void parse(const std::string &s);
- void parse_xml(const std::string &s,const char *tag="settings");
- private:
+ public:
+ long id;
+ long active;
+ db_reference<recorder_config,long> recorder_cfg;
+ db_reference<splitter_config,long> splitter_cfg;
+ db_reference<analysis_config,long> analysis_cfg;
+ db_reference<receiver_config,long> receiver_cfg;
+ settings();
+ settings(const settings &a);
+ settings(const SQL_ROW &a);
+ settings(const std::string &s,const char *tag="settings");
+ settings &operator =(const settings &a);
+ std::string update_format() const;
+ std::string insert_format() const;
+ std::string select_format() const;
+ std::string print(int full_subtables=0, int show_ids=1, int no_refs=0) const;
+ std::string print_xml(int full_subtables=1, int show_ids=0, int no_refs=0,const char *tag="settings") const;
+ void parse(const SQL_ROW &s);
+ void parse(const std::string &s);
+ void parse_xml(const std::string &s,const char *tag="settings");
+ private:
};
class workunit_grp : public db_table<workunit_grp> {
- public:
- long id;
- db_reference<tape,long> tape_info;
- char name[64];
- data_description_t data_desc;
- db_reference<receiver_config,long> receiver_cfg;
- db_reference<recorder_config,long> recorder_cfg;
- db_reference<splitter_config,long> splitter_cfg;
- db_reference<analysis_config,long> analysis_cfg;
- long sb_id;
- long iq_modified;
- long alfa_filter_bank;
- workunit_grp();
- workunit_grp(const workunit_grp &a);
- workunit_grp(const SQL_ROW &a);
- workunit_grp(const std::string &s,const char *tag="workunit_grp");
- workunit_grp &operator =(const workunit_grp &a);
- std::string update_format() const;
- std::string insert_format() const;
- std::string select_format() const;
- std::string print(int full_subtables=0, int show_ids=1, int no_refs=0) const;
- std::string print_xml(int full_subtables=1, int show_ids=0, int no_refs=0,const char *tag="workunit_grp") const;
- void parse(const SQL_ROW &s);
- void parse(const std::string &s);
- void parse_xml(const std::string &s,const char *tag="workunit_grp");
- private:
+ public:
+ long id;
+ db_reference<tape,long> tape_info;
+ char name[64];
+ data_description_t data_desc;
+ db_reference<receiver_config,long> receiver_cfg;
+ db_reference<recorder_config,long> recorder_cfg;
+ db_reference<splitter_config,long> splitter_cfg;
+ db_reference<analysis_config,long> analysis_cfg;
+ long sb_id;
+ long iq_modified;
+ long alfa_filter_bank;
+ workunit_grp();
+ workunit_grp(const workunit_grp &a);
+ workunit_grp(const SQL_ROW &a);
+ workunit_grp(const std::string &s,const char *tag="workunit_grp");
+ workunit_grp &operator =(const workunit_grp &a);
+ std::string update_format() const;
+ std::string insert_format() const;
+ std::string select_format() const;
+ std::string print(int full_subtables=0, int show_ids=1, int no_refs=0) const;
+ std::string print_xml(int full_subtables=1, int show_ids=0, int no_refs=0,const char *tag="workunit_grp") const;
+ void parse(const SQL_ROW &s);
+ void parse(const std::string &s);
+ void parse_xml(const std::string &s,const char *tag="workunit_grp");
+ private:
};
class workunit_header : public db_table<workunit_header> {
- public:
- sqlint8_t id;
- char name[64];
- db_reference<workunit_grp,long> group_info;
- subband_description_t subband_desc;
- sqlint8_t sb_id;
- workunit_header();
- workunit_header(const workunit_header &a);
- workunit_header(const SQL_ROW &a);
- workunit_header(const std::string &s,const char *tag="workunit_header");
- workunit_header &operator =(const workunit_header &a);
- std::string update_format() const;
- std::string insert_format() const;
- std::string select_format() const;
- std::string print(int full_subtables=0, int show_ids=1, int no_refs=0) const;
- std::string print_xml(int full_subtables=1, int show_ids=0, int no_refs=0,const char *tag="workunit_header") const;
- void parse(const SQL_ROW &s);
- void parse(const std::string &s);
- void parse_xml(const std::string &s,const char *tag="workunit_header");
- private:
+ public:
+ sqlint8_t id;
+ char name[64];
+ db_reference<workunit_grp,long> group_info;
+ subband_description_t subband_desc;
+ sqlint8_t sb_id;
+ workunit_header();
+ workunit_header(const workunit_header &a);
+ workunit_header(const SQL_ROW &a);
+ workunit_header(const std::string &s,const char *tag="workunit_header");
+ workunit_header &operator =(const workunit_header &a);
+ std::string update_format() const;
+ std::string insert_format() const;
+ std::string select_format() const;
+ std::string print(int full_subtables=0, int show_ids=1, int no_refs=0) const;
+ std::string print_xml(int full_subtables=1, int show_ids=0, int no_refs=0,const char *tag="workunit_header") const;
+ void parse(const SQL_ROW &s);
+ void parse(const std::string &s);
+ void parse_xml(const std::string &s,const char *tag="workunit_header");
+ private:
};
typedef workunit_header workunit;
class result : public db_table<result> {
- public:
- sqlint8_t id;
- sqlint8_t boinc_result;
- db_reference<workunit_header,sqlint8_t> wuid;
- double received;
- long hostid;
- long versionid;
- long return_code;
- long overflow;
- long reserved;
- sqlint8_t sb_id;
- result();
- result(const result &a);
- result(const SQL_ROW &a);
- result(const std::string &s,const char *tag="result");
- result &operator =(const result &a);
- std::string update_format() const;
- std::string insert_format() const;
- std::string select_format() const;
- std::string print(int full_subtables=0, int show_ids=1, int no_refs=0) const;
- std::string print_xml(int full_subtables=1, int show_ids=0, int no_refs=0,const char *tag="result") const;
- void parse(const SQL_ROW &s);
- void parse(const std::string &s);
- void parse_xml(const std::string &s,const char *tag="result");
- private:
+ public:
+ sqlint8_t id;
+ sqlint8_t boinc_result;
+ db_reference<workunit_header,sqlint8_t> wuid;
+ double received;
+ long hostid;
+ long versionid;
+ long return_code;
+ long overflow;
+ long reserved;
+ sqlint8_t sb_id;
+ result();
+ result(const result &a);
+ result(const SQL_ROW &a);
+ result(const std::string &s,const char *tag="result");
+ result &operator =(const result &a);
+ std::string update_format() const;
+ std::string insert_format() const;
+ std::string select_format() const;
+ std::string print(int full_subtables=0, int show_ids=1, int no_refs=0) const;
+ std::string print_xml(int full_subtables=1, int show_ids=0, int no_refs=0,const char *tag="result") const;
+ void parse(const SQL_ROW &s);
+ void parse(const std::string &s);
+ void parse_xml(const std::string &s,const char *tag="result");
+ private:
};
class triplet : public db_table<triplet> {
- public:
- sqlint8_t id;
- db_reference<result,sqlint8_t> result_id;
- double peak_power;
- double mean_power;
- double time;
- double ra;
- double decl;
- sqlint8_t q_pix;
- double freq;
- double detection_freq;
- double barycentric_freq;
- long fft_len;
- double chirp_rate;
- long rfi_checked;
- long rfi_found;
- long reserved;
- double period;
- triplet();
- triplet(const triplet &a);
- triplet(const SQL_ROW &a);
- triplet(const std::string &s,const char *tag="triplet");
- triplet &operator =(const triplet &a);
- std::string update_format() const;
- std::string insert_format() const;
- std::string select_format() const;
- std::string print(int full_subtables=0, int show_ids=1, int no_refs=0) const;
- std::string print_xml(int full_subtables=1, int show_ids=0, int no_refs=0,const char *tag="triplet") const;
- void parse(const SQL_ROW &s);
- void parse(const std::string &s);
- void parse_xml(const std::string &s,const char *tag="triplet");
- private:
+ public:
+ sqlint8_t id;
+ db_reference<result,sqlint8_t> result_id;
+ double peak_power;
+ double mean_power;
+ double time;
+ double ra;
+ double decl;
+ sqlint8_t q_pix;
+ double freq;
+ double detection_freq;
+ double barycentric_freq;
+ long fft_len;
+ double chirp_rate;
+ long rfi_checked;
+ long rfi_found;
+ long reserved;
+ double period;
+ triplet();
+ triplet(const triplet &a);
+ triplet(const SQL_ROW &a);
+ triplet(const std::string &s,const char *tag="triplet");
+ triplet &operator =(const triplet &a);
+ std::string update_format() const;
+ std::string insert_format() const;
+ std::string select_format() const;
+ std::string print(int full_subtables=0, int show_ids=1, int no_refs=0) const;
+ std::string print_xml(int full_subtables=1, int show_ids=0, int no_refs=0,const char *tag="triplet") const;
+ void parse(const SQL_ROW &s);
+ void parse(const std::string &s);
+ void parse_xml(const std::string &s,const char *tag="triplet");
+ private:
};
class triplet_small : public db_table<triplet_small> {
- public:
- sqlint8_t id;
- db_reference<result,sqlint8_t> result_id;
- double peak_power;
- double mean_power;
- double time;
- double ra;
- double decl;
- sqlint8_t q_pix;
- double freq;
- double detection_freq;
- double barycentric_freq;
- long fft_len;
- double chirp_rate;
- long rfi_checked;
- long rfi_found;
- long reserved;
- double period;
- triplet_small();
- triplet_small(const triplet_small &a);
- triplet_small(const SQL_ROW &a);
- triplet_small(const std::string &s,const char *tag="triplet_small");
- triplet_small &operator =(const triplet_small &a);
- std::string update_format() const;
- std::string insert_format() const;
- std::string select_format() const;
- std::string print(int full_subtables=0, int show_ids=1, int no_refs=0) const;
- std::string print_xml(int full_subtables=1, int show_ids=0, int no_refs=0,const char *tag="triplet_small") const;
- void parse(const SQL_ROW &s);
- void parse(const std::string &s);
- void parse_xml(const std::string &s,const char *tag="triplet_small");
- private:
+ public:
+ sqlint8_t id;
+ db_reference<result,sqlint8_t> result_id;
+ double peak_power;
+ double mean_power;
+ double time;
+ double ra;
+ double decl;
+ sqlint8_t q_pix;
+ double freq;
+ double detection_freq;
+ double barycentric_freq;
+ long fft_len;
+ double chirp_rate;
+ long rfi_checked;
+ long rfi_found;
+ long reserved;
+ double period;
+ triplet_small();
+ triplet_small(const triplet_small &a);
+ triplet_small(const SQL_ROW &a);
+ triplet_small(const std::string &s,const char *tag="triplet_small");
+ triplet_small &operator =(const triplet_small &a);
+ std::string update_format() const;
+ std::string insert_format() const;
+ std::string select_format() const;
+ std::string print(int full_subtables=0, int show_ids=1, int no_refs=0) const;
+ std::string print_xml(int full_subtables=1, int show_ids=0, int no_refs=0,const char *tag="triplet_small") const;
+ void parse(const SQL_ROW &s);
+ void parse(const std::string &s);
+ void parse_xml(const std::string &s,const char *tag="triplet_small");
+ private:
};
class gaussian : public db_table<gaussian> {
- public:
- sqlint8_t id;
- db_reference<result,sqlint8_t> result_id;
- double peak_power;
- double mean_power;
- double time;
- double ra;
- double decl;
- sqlint8_t q_pix;
- double freq;
- double detection_freq;
- double barycentric_freq;
- long fft_len;
- double chirp_rate;
- long rfi_checked;
- long rfi_found;
- long reserved;
- double sigma;
- double chisqr;
- double null_chisqr;
- double score;
- double max_power;
- sqlblob<unsigned char> pot;
- gaussian();
- gaussian(const gaussian &a);
- gaussian(const SQL_ROW &a);
- gaussian(const std::string &s,const char *tag="gaussian");
- gaussian &operator =(const gaussian &a);
- std::string update_format() const;
- std::string insert_format() const;
- std::string select_format() const;
- std::string print(int full_subtables=0, int show_ids=1, int no_refs=0) const;
- std::string print_xml(int full_subtables=1, int show_ids=0, int no_refs=0,const char *tag="gaussian") const;
- void parse(const SQL_ROW &s);
- void parse(const std::string &s);
- void parse_xml(const std::string &s,const char *tag="gaussian");
- private:
+ public:
+ sqlint8_t id;
+ db_reference<result,sqlint8_t> result_id;
+ double peak_power;
+ double mean_power;
+ double time;
+ double ra;
+ double decl;
+ sqlint8_t q_pix;
+ double freq;
+ double detection_freq;
+ double barycentric_freq;
+ long fft_len;
+ double chirp_rate;
+ long rfi_checked;
+ long rfi_found;
+ long reserved;
+ double sigma;
+ double chisqr;
+ double null_chisqr;
+ double score;
+ double max_power;
+ sqlblob<unsigned char> pot;
+ gaussian();
+ gaussian(const gaussian &a);
+ gaussian(const SQL_ROW &a);
+ gaussian(const std::string &s,const char *tag="gaussian");
+ gaussian &operator =(const gaussian &a);
+ std::string update_format() const;
+ std::string insert_format() const;
+ std::string select_format() const;
+ std::string print(int full_subtables=0, int show_ids=1, int no_refs=0) const;
+ std::string print_xml(int full_subtables=1, int show_ids=0, int no_refs=0,const char *tag="gaussian") const;
+ void parse(const SQL_ROW &s);
+ void parse(const std::string &s);
+ void parse_xml(const std::string &s,const char *tag="gaussian");
+ private:
};
class gaussian_small : public db_table<gaussian_small> {
- public:
- sqlint8_t id;
- db_reference<result,sqlint8_t> result_id;
- double peak_power;
- double mean_power;
- double time;
- double ra;
- double decl;
- sqlint8_t q_pix;
- double freq;
- double detection_freq;
- double barycentric_freq;
- long fft_len;
- double chirp_rate;
- long rfi_checked;
- long rfi_found;
- long reserved;
- double sigma;
- double chisqr;
- double null_chisqr;
- double score;
- double max_power;
- gaussian_small();
- gaussian_small(const gaussian_small &a);
- gaussian_small(const SQL_ROW &a);
- gaussian_small(const std::string &s,const char *tag="gaussian_small");
- gaussian_small &operator =(const gaussian_small &a);
- std::string update_format() const;
- std::string insert_format() const;
- std::string select_format() const;
- std::string print(int full_subtables=0, int show_ids=1, int no_refs=0) const;
- std::string print_xml(int full_subtables=1, int show_ids=0, int no_refs=0,const char *tag="gaussian_small") const;
- void parse(const SQL_ROW &s);
- void parse(const std::string &s);
- void parse_xml(const std::string &s,const char *tag="gaussian_small");
- private:
+ public:
+ sqlint8_t id;
+ db_reference<result,sqlint8_t> result_id;
+ double peak_power;
+ double mean_power;
+ double time;
+ double ra;
+ double decl;
+ sqlint8_t q_pix;
+ double freq;
+ double detection_freq;
+ double barycentric_freq;
+ long fft_len;
+ double chirp_rate;
+ long rfi_checked;
+ long rfi_found;
+ long reserved;
+ double sigma;
+ double chisqr;
+ double null_chisqr;
+ double score;
+ double max_power;
+ gaussian_small();
+ gaussian_small(const gaussian_small &a);
+ gaussian_small(const SQL_ROW &a);
+ gaussian_small(const std::string &s,const char *tag="gaussian_small");
+ gaussian_small &operator =(const gaussian_small &a);
+ std::string update_format() const;
+ std::string insert_format() const;
+ std::string select_format() const;
+ std::string print(int full_subtables=0, int show_ids=1, int no_refs=0) const;
+ std::string print_xml(int full_subtables=1, int show_ids=0, int no_refs=0,const char *tag="gaussian_small") const;
+ void parse(const SQL_ROW &s);
+ void parse(const std::string &s);
+ void parse_xml(const std::string &s,const char *tag="gaussian_small");
+ private:
};
class pulse : public db_table<pulse> {
- public:
- sqlint8_t id;
- db_reference<result,sqlint8_t> result_id;
- double peak_power;
- double mean_power;
- double time;
- double ra;
- double decl;
- sqlint8_t q_pix;
- double freq;
- double detection_freq;
- double barycentric_freq;
- long fft_len;
- double chirp_rate;
- long rfi_checked;
- long rfi_found;
- long reserved;
- double period;
- double snr;
- double thresh;
- double score;
- long len_prof;
- sqlblob<unsigned char> pot;
- pulse();
- pulse(const pulse &a);
- pulse(const SQL_ROW &a);
- pulse(const std::string &s,const char *tag="pulse");
- pulse &operator =(const pulse &a);
- std::string update_format() const;
- std::string insert_format() const;
- std::string select_format() const;
- std::string print(int full_subtables=0, int show_ids=1, int no_refs=0) const;
- std::string print_xml(int full_subtables=1, int show_ids=0, int no_refs=0,const char *tag="pulse") const;
- void parse(const SQL_ROW &s);
- void parse(const std::string &s);
- void parse_xml(const std::string &s,const char *tag="pulse");
- private:
+ public:
+ sqlint8_t id;
+ db_reference<result,sqlint8_t> result_id;
+ double peak_power;
+ double mean_power;
+ double time;
+ double ra;
+ double decl;
+ sqlint8_t q_pix;
+ double freq;
+ double detection_freq;
+ double barycentric_freq;
+ long fft_len;
+ double chirp_rate;
+ long rfi_checked;
+ long rfi_found;
+ long reserved;
+ double period;
+ double snr;
+ double thresh;
+ double score;
+ long len_prof;
+ sqlblob<unsigned char> pot;
+ pulse();
+ pulse(const pulse &a);
+ pulse(const SQL_ROW &a);
+ pulse(const std::string &s,const char *tag="pulse");
+ pulse &operator =(const pulse &a);
+ std::string update_format() const;
+ std::string insert_format() const;
+ std::string select_format() const;
+ std::string print(int full_subtables=0, int show_ids=1, int no_refs=0) const;
+ std::string print_xml(int full_subtables=1, int show_ids=0, int no_refs=0,const char *tag="pulse") const;
+ void parse(const SQL_ROW &s);
+ void parse(const std::string &s);
+ void parse_xml(const std::string &s,const char *tag="pulse");
+ private:
};
class pulse_small : public db_table<pulse_small> {
- public:
- sqlint8_t id;
- db_reference<result,sqlint8_t> result_id;
- double peak_power;
- double mean_power;
- double time;
- double ra;
- double decl;
- sqlint8_t q_pix;
- double freq;
- double detection_freq;
- double barycentric_freq;
- long fft_len;
- double chirp_rate;
- long rfi_checked;
- long rfi_found;
- long reserved;
- double period;
- double snr;
- double thresh;
- double score;
- pulse_small();
- pulse_small(const pulse_small &a);
- pulse_small(const SQL_ROW &a);
- pulse_small(const std::string &s,const char *tag="pulse_small");
- pulse_small &operator =(const pulse_small &a);
- std::string update_format() const;
- std::string insert_format() const;
- std::string select_format() const;
- std::string print(int full_subtables=0, int show_ids=1, int no_refs=0) const;
- std::string print_xml(int full_subtables=1, int show_ids=0, int no_refs=0,const char *tag="pulse_small") const;
- void parse(const SQL_ROW &s);
- void parse(const std::string &s);
- void parse_xml(const std::string &s,const char *tag="pulse_small");
- private:
+ public:
+ sqlint8_t id;
+ db_reference<result,sqlint8_t> result_id;
+ double peak_power;
+ double mean_power;
+ double time;
+ double ra;
+ double decl;
+ sqlint8_t q_pix;
+ double freq;
+ double detection_freq;
+ double barycentric_freq;
+ long fft_len;
+ double chirp_rate;
+ long rfi_checked;
+ long rfi_found;
+ long reserved;
+ double period;
+ double snr;
+ double thresh;
+ double score;
+ pulse_small();
+ pulse_small(const pulse_small &a);
+ pulse_small(const SQL_ROW &a);
+ pulse_small(const std::string &s,const char *tag="pulse_small");
+ pulse_small &operator =(const pulse_small &a);
+ std::string update_format() const;
+ std::string insert_format() const;
+ std::string select_format() const;
+ std::string print(int full_subtables=0, int show_ids=1, int no_refs=0) const;
+ std::string print_xml(int full_subtables=1, int show_ids=0, int no_refs=0,const char *tag="pulse_small") const;
+ void parse(const SQL_ROW &s);
+ void parse(const std::string &s);
+ void parse_xml(const std::string &s,const char *tag="pulse_small");
+ private:
};
class sah_pointing : public db_table<sah_pointing> {
- public:
- long time_id;
- double time;
- double ra;
- double dec;
- long q_pix;
- double angle_range;
- long bad;
- sah_pointing();
- sah_pointing(const sah_pointing &a);
- sah_pointing(const SQL_ROW &a);
- sah_pointing(const std::string &s,const char *tag="sah_pointing");
- sah_pointing &operator =(const sah_pointing &a);
- std::string update_format() const;
- std::string insert_format() const;
- std::string select_format() const;
- std::string print(int full_subtables=0, int show_ids=1, int no_refs=0) const;
- std::string print_xml(int full_subtables=1, int show_ids=0, int no_refs=0,const char *tag="sah_pointing") const;
- void parse(const SQL_ROW &s);
- void parse(const std::string &s);
- void parse_xml(const std::string &s,const char *tag="sah_pointing");
- private:
+ public:
+ long time_id;
+ double time;
+ double ra;
+ double dec;
+ long q_pix;
+ double angle_range;
+ long bad;
+ sah_pointing();
+ sah_pointing(const sah_pointing &a);
+ sah_pointing(const SQL_ROW &a);
+ sah_pointing(const std::string &s,const char *tag="sah_pointing");
+ sah_pointing &operator =(const sah_pointing &a);
+ std::string update_format() const;
+ std::string insert_format() const;
+ std::string select_format() const;
+ std::string print(int full_subtables=0, int show_ids=1, int no_refs=0) const;
+ std::string print_xml(int full_subtables=1, int show_ids=0, int no_refs=0,const char *tag="sah_pointing") const;
+ void parse(const SQL_ROW &s);
+ void parse(const std::string &s);
+ void parse_xml(const std::string &s,const char *tag="sah_pointing");
+ private:
};
class sky_map : public db_table<sky_map> {
- public:
- sqlint8_t npix;
- long qpix;
- long fpix;
- sqlint8_t spike_max_id;
- sqlint8_t gaussian_max_id;
- sqlint8_t pulse_max_id;
- sqlint8_t triplet_max_id;
- long spike_count;
- long gaussian_count;
- long pulse_count;
- long triplet_count;
- long new_data;
- double score;
- sky_map();
- sky_map(const sky_map &a);
- sky_map(const SQL_ROW &a);
- sky_map(const std::string &s,const char *tag="sky_map");
- sky_map &operator =(const sky_map &a);
- std::string update_format() const;
- std::string insert_format() const;
- std::string select_format() const;
- std::string print(int full_subtables=0, int show_ids=1, int no_refs=0) const;
- std::string print_xml(int full_subtables=1, int show_ids=0, int no_refs=0,const char *tag="sky_map") const;
- void parse(const SQL_ROW &s);
- void parse(const std::string &s);
- void parse_xml(const std::string &s,const char *tag="sky_map");
- private:
+ public:
+ sqlint8_t npix;
+ long qpix;
+ long fpix;
+ sqlint8_t spike_max_id;
+ sqlint8_t gaussian_max_id;
+ sqlint8_t pulse_max_id;
+ sqlint8_t triplet_max_id;
+ long spike_count;
+ long gaussian_count;
+ long pulse_count;
+ long triplet_count;
+ long new_data;
+ double score;
+ sky_map();
+ sky_map(const sky_map &a);
+ sky_map(const SQL_ROW &a);
+ sky_map(const std::string &s,const char *tag="sky_map");
+ sky_map &operator =(const sky_map &a);
+ std::string update_format() const;
+ std::string insert_format() const;
+ std::string select_format() const;
+ std::string print(int full_subtables=0, int show_ids=1, int no_refs=0) const;
+ std::string print_xml(int full_subtables=1, int show_ids=0, int no_refs=0,const char *tag="sky_map") const;
+ void parse(const SQL_ROW &s);
+ void parse(const std::string &s);
+ void parse_xml(const std::string &s,const char *tag="sky_map");
+ private:
};
class hotpix : public db_table<hotpix> {
- public:
- long id;
- long last_hit_time;
- hotpix();
- hotpix(const hotpix &a);
- hotpix(const SQL_ROW &a);
- hotpix(const std::string &s,const char *tag="hotpix");
- hotpix &operator =(const hotpix &a);
- std::string update_format() const;
- std::string insert_format() const;
- std::string select_format() const;
- std::string print(int full_subtables=0, int show_ids=1, int no_refs=0) const;
- std::string print_xml(int full_subtables=1, int show_ids=0, int no_refs=0,const char *tag="hotpix") const;
- void parse(const SQL_ROW &s);
- void parse(const std::string &s);
- void parse_xml(const std::string &s,const char *tag="hotpix");
- private:
+ public:
+ long id;
+ long last_hit_time;
+ hotpix();
+ hotpix(const hotpix &a);
+ hotpix(const SQL_ROW &a);
+ hotpix(const std::string &s,const char *tag="hotpix");
+ hotpix &operator =(const hotpix &a);
+ std::string update_format() const;
+ std::string insert_format() const;
+ std::string select_format() const;
+ std::string print(int full_subtables=0, int show_ids=1, int no_refs=0) const;
+ std::string print_xml(int full_subtables=1, int show_ids=0, int no_refs=0,const char *tag="hotpix") const;
+ void parse(const SQL_ROW &s);
+ void parse(const std::string &s);
+ void parse_xml(const std::string &s,const char *tag="hotpix");
+ private:
};
class spike : public db_table<spike> {
- public:
- sqlint8_t id;
- db_reference<result,sqlint8_t> result_id;
- double peak_power;
- double mean_power;
- double time;
- double ra;
- double decl;
- sqlint8_t q_pix;
- double freq;
- double detection_freq;
- double barycentric_freq;
- long fft_len;
- double chirp_rate;
- long rfi_checked;
- long rfi_found;
- long reserved;
- spike();
- spike(const spike &a);
- spike(const SQL_ROW &a);
- spike(const std::string &s,const char *tag="spike");
- spike &operator =(const spike &a);
- std::string update_format() const;
- std::string insert_format() const;
- std::string select_format() const;
- std::string print(int full_subtables=0, int show_ids=1, int no_refs=0) const;
- std::string print_xml(int full_subtables=1, int show_ids=0, int no_refs=0,const char *tag="spike") const;
- void parse(const SQL_ROW &s);
- void parse(const std::string &s);
- void parse_xml(const std::string &s,const char *tag="spike");
- private:
+ public:
+ sqlint8_t id;
+ db_reference<result,sqlint8_t> result_id;
+ double peak_power;
+ double mean_power;
+ double time;
+ double ra;
+ double decl;
+ sqlint8_t q_pix;
+ double freq;
+ double detection_freq;
+ double barycentric_freq;
+ long fft_len;
+ double chirp_rate;
+ long rfi_checked;
+ long rfi_found;
+ long reserved;
+ spike();
+ spike(const spike &a);
+ spike(const SQL_ROW &a);
+ spike(const std::string &s,const char *tag="spike");
+ spike &operator =(const spike &a);
+ std::string update_format() const;
+ std::string insert_format() const;
+ std::string select_format() const;
+ std::string print(int full_subtables=0, int show_ids=1, int no_refs=0) const;
+ std::string print_xml(int full_subtables=1, int show_ids=0, int no_refs=0,const char *tag="spike") const;
+ void parse(const SQL_ROW &s);
+ void parse(const std::string &s);
+ void parse_xml(const std::string &s,const char *tag="spike");
+ private:
};
class spike_small : public db_table<spike_small> {
- public:
- sqlint8_t id;
- db_reference<result,sqlint8_t> result_id;
- double peak_power;
- double mean_power;
- double time;
- double ra;
- double decl;
- sqlint8_t q_pix;
- double freq;
- double detection_freq;
- double barycentric_freq;
- long fft_len;
- double chirp_rate;
- long rfi_checked;
- long rfi_found;
- long reserved;
- spike_small();
- spike_small(const spike_small &a);
- spike_small(const SQL_ROW &a);
- spike_small(const std::string &s,const char *tag="spike_small");
- spike_small &operator =(const spike_small &a);
- std::string update_format() const;
- std::string insert_format() const;
- std::string select_format() const;
- std::string print(int full_subtables=0, int show_ids=1, int no_refs=0) const;
- std::string print_xml(int full_subtables=1, int show_ids=0, int no_refs=0,const char *tag="spike_small") const;
- void parse(const SQL_ROW &s);
- void parse(const std::string &s);
- void parse_xml(const std::string &s,const char *tag="spike_small");
- private:
+ public:
+ sqlint8_t id;
+ db_reference<result,sqlint8_t> result_id;
+ double peak_power;
+ double mean_power;
+ double time;
+ double ra;
+ double decl;
+ sqlint8_t q_pix;
+ double freq;
+ double detection_freq;
+ double barycentric_freq;
+ long fft_len;
+ double chirp_rate;
+ long rfi_checked;
+ long rfi_found;
+ long reserved;
+ spike_small();
+ spike_small(const spike_small &a);
+ spike_small(const SQL_ROW &a);
+ spike_small(const std::string &s,const char *tag="spike_small");
+ spike_small &operator =(const spike_small &a);
+ std::string update_format() const;
+ std::string insert_format() const;
+ std::string select_format() const;
+ std::string print(int full_subtables=0, int show_ids=1, int no_refs=0) const;
+ std::string print_xml(int full_subtables=1, int show_ids=0, int no_refs=0,const char *tag="spike_small") const;
+ void parse(const SQL_ROW &s);
+ void parse(const std::string &s);
+ void parse_xml(const std::string &s,const char *tag="spike_small");
+ private:
};
class autocorr : public db_table<autocorr> {
- public:
- sqlint8_t id;
- db_reference<result,sqlint8_t> result_id;
- double peak_power;
- double mean_power;
- double time;
- double ra;
- double decl;
- sqlint8_t q_pix;
- double delay;
- double freq;
- double detection_freq;
- double barycentric_freq;
- long fft_len;
- double chirp_rate;
- long rfi_checked;
- long rfi_found;
- long reserved;
- autocorr();
- autocorr(const autocorr &a);
- autocorr(const SQL_ROW &a);
- autocorr(const std::string &s,const char *tag="autocorr");
- autocorr &operator =(const autocorr &a);
- std::string update_format() const;
- std::string insert_format() const;
- std::string select_format() const;
- std::string print(int full_subtables=0, int show_ids=1, int no_refs=0) const;
- std::string print_xml(int full_subtables=1, int show_ids=0, int no_refs=0,const char *tag="autocorr") const;
- void parse(const SQL_ROW &s);
- void parse(const std::string &s);
- void parse_xml(const std::string &s,const char *tag="autocorr");
- private:
+ public:
+ sqlint8_t id;
+ db_reference<result,sqlint8_t> result_id;
+ double peak_power;
+ double mean_power;
+ double time;
+ double ra;
+ double decl;
+ sqlint8_t q_pix;
+ double delay;
+ double freq;
+ double detection_freq;
+ double barycentric_freq;
+ long fft_len;
+ double chirp_rate;
+ long rfi_checked;
+ long rfi_found;
+ long reserved;
+ autocorr();
+ autocorr(const autocorr &a);
+ autocorr(const SQL_ROW &a);
+ autocorr(const std::string &s,const char *tag="autocorr");
+ autocorr &operator =(const autocorr &a);
+ std::string update_format() const;
+ std::string insert_format() const;
+ std::string select_format() const;
+ std::string print(int full_subtables=0, int show_ids=1, int no_refs=0) const;
+ std::string print_xml(int full_subtables=1, int show_ids=0, int no_refs=0,const char *tag="autocorr") const;
+ void parse(const SQL_ROW &s);
+ void parse(const std::string &s);
+ void parse_xml(const std::string &s,const char *tag="autocorr");
+ private:
};
class autocorr_small : public db_table<autocorr_small> {
- public:
- sqlint8_t id;
- db_reference<result,sqlint8_t> result_id;
- double peak_power;
- double mean_power;
- double time;
- double ra;
- double decl;
- sqlint8_t q_pix;
- double delay;
- double freq;
- double detection_freq;
- double barycentric_freq;
- long fft_len;
- double chirp_rate;
- long rfi_checked;
- long rfi_found;
- long reserved;
- autocorr_small();
- autocorr_small(const autocorr_small &a);
- autocorr_small(const SQL_ROW &a);
- autocorr_small(const std::string &s,const char *tag="autocorr_small");
- autocorr_small &operator =(const autocorr_small &a);
- std::string update_format() const;
- std::string insert_format() const;
- std::string select_format() const;
- std::string print(int full_subtables=0, int show_ids=1, int no_refs=0) const;
- std::string print_xml(int full_subtables=1, int show_ids=0, int no_refs=0,const char *tag="autocorr_small") const;
- void parse(const SQL_ROW &s);
- void parse(const std::string &s);
- void parse_xml(const std::string &s,const char *tag="autocorr_small");
- private:
+ public:
+ sqlint8_t id;
+ db_reference<result,sqlint8_t> result_id;
+ double peak_power;
+ double mean_power;
+ double time;
+ double ra;
+ double decl;
+ sqlint8_t q_pix;
+ double delay;
+ double freq;
+ double detection_freq;
+ double barycentric_freq;
+ long fft_len;
+ double chirp_rate;
+ long rfi_checked;
+ long rfi_found;
+ long reserved;
+ autocorr_small();
+ autocorr_small(const autocorr_small &a);
+ autocorr_small(const SQL_ROW &a);
+ autocorr_small(const std::string &s,const char *tag="autocorr_small");
+ autocorr_small &operator =(const autocorr_small &a);
+ std::string update_format() const;
+ std::string insert_format() const;
+ std::string select_format() const;
+ std::string print(int full_subtables=0, int show_ids=1, int no_refs=0) const;
+ std::string print_xml(int full_subtables=1, int show_ids=0, int no_refs=0,const char *tag="autocorr_small") const;
+ void parse(const SQL_ROW &s);
+ void parse(const std::string &s);
+ void parse_xml(const std::string &s,const char *tag="autocorr_small");
+ private:
};
class classic_versions : public db_table<classic_versions> {
- public:
- long id;
- long ver_major;
- long ver_minor;
- long platformid;
- char comment[254];
- char filename[254];
- char md5_cksum[254];
- char sum_cksum[254];
- char cksum_cksum[254];
- long file_cksum;
- classic_versions();
- classic_versions(const classic_versions &a);
- classic_versions(const SQL_ROW &a);
- classic_versions(const std::string &s,const char *tag="classic_versions");
- classic_versions &operator =(const classic_versions &a);
- std::string update_format() const;
- std::string insert_format() const;
- std::string select_format() const;
- std::string print(int full_subtables=0, int show_ids=1, int no_refs=0) const;
- std::string print_xml(int full_subtables=1, int show_ids=0, int no_refs=0,const char *tag="classic_versions") const;
- void parse(const SQL_ROW &s);
- void parse(const std::string &s);
- void parse_xml(const std::string &s,const char *tag="classic_versions");
- private:
+ public:
+ long id;
+ long ver_major;
+ long ver_minor;
+ long platformid;
+ char comment[254];
+ char filename[254];
+ char md5_cksum[254];
+ char sum_cksum[254];
+ char cksum_cksum[254];
+ long file_cksum;
+ classic_versions();
+ classic_versions(const classic_versions &a);
+ classic_versions(const SQL_ROW &a);
+ classic_versions(const std::string &s,const char *tag="classic_versions");
+ classic_versions &operator =(const classic_versions &a);
+ std::string update_format() const;
+ std::string insert_format() const;
+ std::string select_format() const;
+ std::string print(int full_subtables=0, int show_ids=1, int no_refs=0) const;
+ std::string print_xml(int full_subtables=1, int show_ids=0, int no_refs=0,const char *tag="classic_versions") const;
+ void parse(const SQL_ROW &s);
+ void parse(const std::string &s);
+ void parse_xml(const std::string &s,const char *tag="classic_versions");
+ private:
};
class classic_active_versions : public db_table<classic_active_versions> {
- public:
- long id;
- long versionid;
- long ver_major;
- long ver_minor;
- classic_active_versions();
- classic_active_versions(const classic_active_versions &a);
- classic_active_versions(const SQL_ROW &a);
- classic_active_versions(const std::string &s,const char *tag="classic_active_versions");
- classic_active_versions &operator =(const classic_active_versions &a);
- std::string update_format() const;
- std::string insert_format() const;
- std::string select_format() const;
- std::string print(int full_subtables=0, int show_ids=1, int no_refs=0) const;
- std::string print_xml(int full_subtables=1, int show_ids=0, int no_refs=0,const char *tag="classic_active_versions") const;
- void parse(const SQL_ROW &s);
- void parse(const std::string &s);
- void parse_xml(const std::string &s,const char *tag="classic_active_versions");
- private:
+ public:
+ long id;
+ long versionid;
+ long ver_major;
+ long ver_minor;
+ classic_active_versions();
+ classic_active_versions(const classic_active_versions &a);
+ classic_active_versions(const SQL_ROW &a);
+ classic_active_versions(const std::string &s,const char *tag="classic_active_versions");
+ classic_active_versions &operator =(const classic_active_versions &a);
+ std::string update_format() const;
+ std::string insert_format() const;
+ std::string select_format() const;
+ std::string print(int full_subtables=0, int show_ids=1, int no_refs=0) const;
+ std::string print_xml(int full_subtables=1, int show_ids=0, int no_refs=0,const char *tag="classic_active_versions") const;
+ void parse(const SQL_ROW &s);
+ void parse(const std::string &s);
+ void parse_xml(const std::string &s,const char *tag="classic_active_versions");
+ private:
};
class classic_active_versionids : public db_table<classic_active_versionids> {
- public:
- long id;
- long versionid;
- classic_active_versionids();
- classic_active_versionids(const classic_active_versionids &a);
- classic_active_versionids(const SQL_ROW &a);
- classic_active_versionids(const std::string &s,const char *tag="classic_active_versionids");
- classic_active_versionids &operator =(const classic_active_versionids &a);
- std::string update_format() const;
- std::string insert_format() const;
- std::string select_format() const;
- std::string print(int full_subtables=0, int show_ids=1, int no_refs=0) const;
- std::string print_xml(int full_subtables=1, int show_ids=0, int no_refs=0,const char *tag="classic_active_versionids") const;
- void parse(const SQL_ROW &s);
- void parse(const std::string &s);
- void parse_xml(const std::string &s,const char *tag="classic_active_versionids");
- private:
+ public:
+ long id;
+ long versionid;
+ classic_active_versionids();
+ classic_active_versionids(const classic_active_versionids &a);
+ classic_active_versionids(const SQL_ROW &a);
+ classic_active_versionids(const std::string &s,const char *tag="classic_active_versionids");
+ classic_active_versionids &operator =(const classic_active_versionids &a);
+ std::string update_format() const;
+ std::string insert_format() const;
+ std::string select_format() const;
+ std::string print(int full_subtables=0, int show_ids=1, int no_refs=0) const;
+ std::string print_xml(int full_subtables=1, int show_ids=0, int no_refs=0,const char *tag="classic_active_versionids") const;
+ void parse(const SQL_ROW &s);
+ void parse(const std::string &s);
+ void parse_xml(const std::string &s,const char *tag="classic_active_versionids");
+ private:
};
class rfi_zone : public db_table<rfi_zone> {
- public:
- long id;
- long min_receiver_s4id;
- long max_receiver_s4id;
- long min_splitter_config;
- long max_splitter_config;
- long min_analysis_config;
- long max_analysis_config;
- long min_tape_id;
- long max_tape_id;
- sqlint8_t min_workunit_id;
- sqlint8_t max_workunit_id;
- sqlint8_t min_result_id;
- sqlint8_t max_result_id;
- double min_time;
- double max_time;
- double central_baseband_freq;
- double baseband_freq_width;
- double central_detection_freq;
- double detection_freq_width;
- double central_period;
- double period_width;
- long fft_len_flags;
- long signal_type_flags;
- double ra;
- double dec;
- double angular_distance;
- rfi_zone();
- rfi_zone(const rfi_zone &a);
- rfi_zone(const SQL_ROW &a);
- rfi_zone(const std::string &s,const char *tag="rfi_zone");
- rfi_zone &operator =(const rfi_zone &a);
- std::string update_format() const;
- std::string insert_format() const;
- std::string select_format() const;
- std::string print(int full_subtables=0, int show_ids=1, int no_refs=0) const;
- std::string print_xml(int full_subtables=1, int show_ids=0, int no_refs=0,const char *tag="rfi_zone") const;
- void parse(const SQL_ROW &s);
- void parse(const std::string &s);
- void parse_xml(const std::string &s,const char *tag="rfi_zone");
- private:
+ public:
+ long id;
+ long min_receiver_s4id;
+ long max_receiver_s4id;
+ long min_splitter_config;
+ long max_splitter_config;
+ long min_analysis_config;
+ long max_analysis_config;
+ long min_tape_id;
+ long max_tape_id;
+ sqlint8_t min_workunit_id;
+ sqlint8_t max_workunit_id;
+ sqlint8_t min_result_id;
+ sqlint8_t max_result_id;
+ double min_time;
+ double max_time;
+ double central_baseband_freq;
+ double baseband_freq_width;
+ double central_detection_freq;
+ double detection_freq_width;
+ double central_period;
+ double period_width;
+ long fft_len_flags;
+ long signal_type_flags;
+ double ra;
+ double dec;
+ double angular_distance;
+ rfi_zone();
+ rfi_zone(const rfi_zone &a);
+ rfi_zone(const SQL_ROW &a);
+ rfi_zone(const std::string &s,const char *tag="rfi_zone");
+ rfi_zone &operator =(const rfi_zone &a);
+ std::string update_format() const;
+ std::string insert_format() const;
+ std::string select_format() const;
+ std::string print(int full_subtables=0, int show_ids=1, int no_refs=0) const;
+ std::string print_xml(int full_subtables=1, int show_ids=0, int no_refs=0,const char *tag="rfi_zone") const;
+ void parse(const SQL_ROW &s);
+ void parse(const std::string &s);
+ void parse_xml(const std::string &s,const char *tag="rfi_zone");
+ private:
};
class bad_data : public db_table<bad_data> {
- public:
- char name[20];
- long beam;
- char reason[255];
- bad_data();
- bad_data(const bad_data &a);
- bad_data(const SQL_ROW &a);
- bad_data(const std::string &s,const char *tag="bad_data");
- bad_data &operator =(const bad_data &a);
- std::string update_format() const;
- std::string insert_format() const;
- std::string select_format() const;
- std::string print(int full_subtables=0, int show_ids=1, int no_refs=0) const;
- std::string print_xml(int full_subtables=1, int show_ids=0, int no_refs=0,const char *tag="bad_data") const;
- void parse(const SQL_ROW &s);
- void parse(const std::string &s);
- void parse_xml(const std::string &s,const char *tag="bad_data");
- private:
+ public:
+ char name[20];
+ long beam;
+ char reason[255];
+ bad_data();
+ bad_data(const bad_data &a);
+ bad_data(const SQL_ROW &a);
+ bad_data(const std::string &s,const char *tag="bad_data");
+ bad_data &operator =(const bad_data &a);
+ std::string update_format() const;
+ std::string insert_format() const;
+ std::string select_format() const;
+ std::string print(int full_subtables=0, int show_ids=1, int no_refs=0) const;
+ std::string print_xml(int full_subtables=1, int show_ids=0, int no_refs=0,const char *tag="bad_data") const;
+ void parse(const SQL_ROW &s);
+ void parse(const std::string &s);
+ void parse_xml(const std::string &s,const char *tag="bad_data");
+ private:
};
class spike_tinysky : public db_table<spike_tinysky> {
- public:
- sqlint8_t id;
- db_reference<result,sqlint8_t> result_id;
- double peak_power;
- double mean_power;
- double time;
- double ra;
- double decl;
- sqlint8_t q_pix;
- double freq;
- double detection_freq;
- double barycentric_freq;
- long fft_len;
- double chirp_rate;
- long rfi_checked;
- long rfi_found;
- long reserved;
- spike_tinysky();
- spike_tinysky(const spike_tinysky &a);
- spike_tinysky(const SQL_ROW &a);
- spike_tinysky(const std::string &s,const char *tag="spike_tinysky");
- spike_tinysky &operator =(const spike_tinysky &a);
- std::string update_format() const;
- std::string insert_format() const;
- std::string select_format() const;
- std::string print(int full_subtables=0, int show_ids=1, int no_refs=0) const;
- std::string print_xml(int full_subtables=1, int show_ids=0, int no_refs=0,const char *tag="spike_tinysky") const;
- void parse(const SQL_ROW &s);
- void parse(const std::string &s);
- void parse_xml(const std::string &s,const char *tag="spike_tinysky");
- private:
+ public:
+ sqlint8_t id;
+ db_reference<result,sqlint8_t> result_id;
+ double peak_power;
+ double mean_power;
+ double time;
+ double ra;
+ double decl;
+ sqlint8_t q_pix;
+ double freq;
+ double detection_freq;
+ double barycentric_freq;
+ long fft_len;
+ double chirp_rate;
+ long rfi_checked;
+ long rfi_found;
+ long reserved;
+ spike_tinysky();
+ spike_tinysky(const spike_tinysky &a);
+ spike_tinysky(const SQL_ROW &a);
+ spike_tinysky(const std::string &s,const char *tag="spike_tinysky");
+ spike_tinysky &operator =(const spike_tinysky &a);
+ std::string update_format() const;
+ std::string insert_format() const;
+ std::string select_format() const;
+ std::string print(int full_subtables=0, int show_ids=1, int no_refs=0) const;
+ std::string print_xml(int full_subtables=1, int show_ids=0, int no_refs=0,const char *tag="spike_tinysky") const;
+ void parse(const SQL_ROW &s);
+ void parse(const std::string &s);
+ void parse_xml(const std::string &s,const char *tag="spike_tinysky");
+ private:
};
class gaussian_tinysky : public db_table<gaussian_tinysky> {
- public:
- sqlint8_t id;
- db_reference<result,sqlint8_t> result_id;
- double peak_power;
- double mean_power;
- double time;
- double ra;
- double decl;
- sqlint8_t q_pix;
- double freq;
- double detection_freq;
- double barycentric_freq;
- long fft_len;
- double chirp_rate;
- long rfi_checked;
- long rfi_found;
- long reserved;
- double sigma;
- double chisqr;
- double null_chisqr;
- double score;
- double max_power;
- sqlblob<unsigned char> pot;
- gaussian_tinysky();
- gaussian_tinysky(const gaussian_tinysky &a);
- gaussian_tinysky(const SQL_ROW &a);
- gaussian_tinysky(const std::string &s,const char *tag="gaussian_tinysky");
- gaussian_tinysky &operator =(const gaussian_tinysky &a);
- std::string update_format() const;
- std::string insert_format() const;
- std::string select_format() const;
- std::string print(int full_subtables=0, int show_ids=1, int no_refs=0) const;
- std::string print_xml(int full_subtables=1, int show_ids=0, int no_refs=0,const char *tag="gaussian_tinysky") const;
- void parse(const SQL_ROW &s);
- void parse(const std::string &s);
- void parse_xml(const std::string &s,const char *tag="gaussian_tinysky");
- private:
+ public:
+ sqlint8_t id;
+ db_reference<result,sqlint8_t> result_id;
+ double peak_power;
+ double mean_power;
+ double time;
+ double ra;
+ double decl;
+ sqlint8_t q_pix;
+ double freq;
+ double detection_freq;
+ double barycentric_freq;
+ long fft_len;
+ double chirp_rate;
+ long rfi_checked;
+ long rfi_found;
+ long reserved;
+ double sigma;
+ double chisqr;
+ double null_chisqr;
+ double score;
+ double max_power;
+ sqlblob<unsigned char> pot;
+ gaussian_tinysky();
+ gaussian_tinysky(const gaussian_tinysky &a);
+ gaussian_tinysky(const SQL_ROW &a);
+ gaussian_tinysky(const std::string &s,const char *tag="gaussian_tinysky");
+ gaussian_tinysky &operator =(const gaussian_tinysky &a);
+ std::string update_format() const;
+ std::string insert_format() const;
+ std::string select_format() const;
+ std::string print(int full_subtables=0, int show_ids=1, int no_refs=0) const;
+ std::string print_xml(int full_subtables=1, int show_ids=0, int no_refs=0,const char *tag="gaussian_tinysky") const;
+ void parse(const SQL_ROW &s);
+ void parse(const std::string &s);
+ void parse_xml(const std::string &s,const char *tag="gaussian_tinysky");
+ private:
};
class pulse_tinysky : public db_table<pulse_tinysky> {
- public:
- sqlint8_t id;
- db_reference<result,sqlint8_t> result_id;
- double peak_power;
- double mean_power;
- double time;
- double ra;
- double decl;
- sqlint8_t q_pix;
- double freq;
- double detection_freq;
- double barycentric_freq;
- long fft_len;
- double chirp_rate;
- long rfi_checked;
- long rfi_found;
- long reserved;
- double period;
- double snr;
- double thresh;
- double score;
- long len_prof;
- sqlblob<unsigned char> pot;
- pulse_tinysky();
- pulse_tinysky(const pulse_tinysky &a);
- pulse_tinysky(const SQL_ROW &a);
- pulse_tinysky(const std::string &s,const char *tag="pulse_tinysky");
- pulse_tinysky &operator =(const pulse_tinysky &a);
- std::string update_format() const;
- std::string insert_format() const;
- std::string select_format() const;
- std::string print(int full_subtables=0, int show_ids=1, int no_refs=0) const;
- std::string print_xml(int full_subtables=1, int show_ids=0, int no_refs=0,const char *tag="pulse_tinysky") const;
- void parse(const SQL_ROW &s);
- void parse(const std::string &s);
- void parse_xml(const std::string &s,const char *tag="pulse_tinysky");
- private:
+ public:
+ sqlint8_t id;
+ db_reference<result,sqlint8_t> result_id;
+ double peak_power;
+ double mean_power;
+ double time;
+ double ra;
+ double decl;
+ sqlint8_t q_pix;
+ double freq;
+ double detection_freq;
+ double barycentric_freq;
+ long fft_len;
+ double chirp_rate;
+ long rfi_checked;
+ long rfi_found;
+ long reserved;
+ double period;
+ double snr;
+ double thresh;
+ double score;
+ long len_prof;
+ sqlblob<unsigned char> pot;
+ pulse_tinysky();
+ pulse_tinysky(const pulse_tinysky &a);
+ pulse_tinysky(const SQL_ROW &a);
+ pulse_tinysky(const std::string &s,const char *tag="pulse_tinysky");
+ pulse_tinysky &operator =(const pulse_tinysky &a);
+ std::string update_format() const;
+ std::string insert_format() const;
+ std::string select_format() const;
+ std::string print(int full_subtables=0, int show_ids=1, int no_refs=0) const;
+ std::string print_xml(int full_subtables=1, int show_ids=0, int no_refs=0,const char *tag="pulse_tinysky") const;
+ void parse(const SQL_ROW &s);
+ void parse(const std::string &s);
+ void parse_xml(const std::string &s,const char *tag="pulse_tinysky");
+ private:
};
class triplet_tinysky : public db_table<triplet_tinysky> {
- public:
- sqlint8_t id;
- db_reference<result,sqlint8_t> result_id;
- double peak_power;
- double mean_power;
- double time;
- double ra;
- double decl;
- sqlint8_t q_pix;
- double freq;
- double detection_freq;
- double barycentric_freq;
- long fft_len;
- double chirp_rate;
- long rfi_checked;
- long rfi_found;
- long reserved;
- double period;
- triplet_tinysky();
- triplet_tinysky(const triplet_tinysky &a);
- triplet_tinysky(const SQL_ROW &a);
- triplet_tinysky(const std::string &s,const char *tag="triplet_tinysky");
- triplet_tinysky &operator =(const triplet_tinysky &a);
- std::string update_format() const;
- std::string insert_format() const;
- std::string select_format() const;
- std::string print(int full_subtables=0, int show_ids=1, int no_refs=0) const;
- std::string print_xml(int full_subtables=1, int show_ids=0, int no_refs=0,const char *tag="triplet_tinysky") const;
- void parse(const SQL_ROW &s);
- void parse(const std::string &s);
- void parse_xml(const std::string &s,const char *tag="triplet_tinysky");
- private:
+ public:
+ sqlint8_t id;
+ db_reference<result,sqlint8_t> result_id;
+ double peak_power;
+ double mean_power;
+ double time;
+ double ra;
+ double decl;
+ sqlint8_t q_pix;
+ double freq;
+ double detection_freq;
+ double barycentric_freq;
+ long fft_len;
+ double chirp_rate;
+ long rfi_checked;
+ long rfi_found;
+ long reserved;
+ double period;
+ triplet_tinysky();
+ triplet_tinysky(const triplet_tinysky &a);
+ triplet_tinysky(const SQL_ROW &a);
+ triplet_tinysky(const std::string &s,const char *tag="triplet_tinysky");
+ triplet_tinysky &operator =(const triplet_tinysky &a);
+ std::string update_format() const;
+ std::string insert_format() const;
+ std::string select_format() const;
+ std::string print(int full_subtables=0, int show_ids=1, int no_refs=0) const;
+ std::string print_xml(int full_subtables=1, int show_ids=0, int no_refs=0,const char *tag="triplet_tinysky") const;
+ void parse(const SQL_ROW &s);
+ void parse(const std::string &s);
+ void parse_xml(const std::string &s,const char *tag="triplet_tinysky");
+ private:
};
class autocorr_tinysky : public db_table<autocorr_tinysky> {
- public:
- sqlint8_t id;
- db_reference<result,sqlint8_t> result_id;
- double peak_power;
- double mean_power;
- double time;
- double ra;
- double decl;
- sqlint8_t q_pix;
- double delay;
- double freq;
- double detection_freq;
- double barycentric_freq;
- long fft_len;
- double chirp_rate;
- long rfi_checked;
- long rfi_found;
- long reserved;
- autocorr_tinysky();
- autocorr_tinysky(const autocorr_tinysky &a);
- autocorr_tinysky(const SQL_ROW &a);
- autocorr_tinysky(const std::string &s,const char *tag="autocorr_tinysky");
- autocorr_tinysky &operator =(const autocorr_tinysky &a);
- std::string update_format() const;
- std::string insert_format() const;
- std::string select_format() const;
- std::string print(int full_subtables=0, int show_ids=1, int no_refs=0) const;
- std::string print_xml(int full_subtables=1, int show_ids=0, int no_refs=0,const char *tag="autocorr_tinysky") const;
- void parse(const SQL_ROW &s);
- void parse(const std::string &s);
- void parse_xml(const std::string &s,const char *tag="autocorr_tinysky");
- private:
+ public:
+ sqlint8_t id;
+ db_reference<result,sqlint8_t> result_id;
+ double peak_power;
+ double mean_power;
+ double time;
+ double ra;
+ double decl;
+ sqlint8_t q_pix;
+ double delay;
+ double freq;
+ double detection_freq;
+ double barycentric_freq;
+ long fft_len;
+ double chirp_rate;
+ long rfi_checked;
+ long rfi_found;
+ long reserved;
+ autocorr_tinysky();
+ autocorr_tinysky(const autocorr_tinysky &a);
+ autocorr_tinysky(const SQL_ROW &a);
+ autocorr_tinysky(const std::string &s,const char *tag="autocorr_tinysky");
+ autocorr_tinysky &operator =(const autocorr_tinysky &a);
+ std::string update_format() const;
+ std::string insert_format() const;
+ std::string select_format() const;
+ std::string print(int full_subtables=0, int show_ids=1, int no_refs=0) const;
+ std::string print_xml(int full_subtables=1, int show_ids=0, int no_refs=0,const char *tag="autocorr_tinysky") const;
+ void parse(const SQL_ROW &s);
+ void parse(const std::string &s);
+ void parse_xml(const std::string &s,const char *tag="autocorr_tinysky");
+ private:
};
diff --git a/db/tools/analysis_configs.xml b/db/tools/analysis_configs.xml
index 00c8ff2..564db4c 100644
--- a/db/tools/analysis_configs.xml
+++ b/db/tools/analysis_configs.xml
@@ -44,6 +44,6 @@
<max_gaussians>0</max_gaussians>
<max_pulses>0</max_pulses>
<max_triplets>0</max_triplets>
- <keyuniq>31</keyuniq>
+ <keyuniq>34</keyuniq>
<credit_rate>2.85</credit_rate>
</analysis_config>
diff --git a/db/tools/insert_splitter_config.cpp b/db/tools/insert_splitter_config.cpp
index 1afa32e..efd8c15 100644
--- a/db/tools/insert_splitter_config.cpp
+++ b/db/tools/insert_splitter_config.cpp
@@ -28,13 +28,14 @@ int main(int argc, char **argv) {
exit(1);
}
- db_change("sah2b at sci_master_tcp");
+ db_change("sah2b at sah_master_tcp");
while (!f.eof()) {
f >> cfg;
if (!f.eof()) {
i++;
cfg.insert();
+ if (!cfg.id) std::cout << sql_error_message() << " " << sql_error_code();
}
}
diff --git a/db/tools/settings.sql b/db/tools/settings.sql
index f216e54..58ebc20 100644
--- a/db/tools/settings.sql
+++ b/db/tools/settings.sql
@@ -1,6 +1,6 @@
-database sah2b at sah_master_tcp;
+database sah2 at sah_master_tcp;
-update settings set active=0 where 1 = 1 ;
+-- update settings set active=0 where 1 = 1 ;
-insert into settings values(0,8,3,4,1294,10);
+insert into settings values(0,11,2,6,9197,7);
diff --git a/db/tools/splitter_configs.xml b/db/tools/splitter_configs.xml
index e6c619a..c592fdd 100644
--- a/db/tools/splitter_configs.xml
+++ b/db/tools/splitter_configs.xml
@@ -1,11 +1,11 @@
<splitter_config>
- <version>0.20</version>
+ <version>0.30</version>
<data_type>encoded</data_type>
<fft_len>2048</fft_len>
- <ifft_len>8</ifft_len>
+ <ifft_len>16</ifft_len>
<filter>fft</filter>
<window>welsh</window>
- <samples_per_wu>1048576</samples_per_wu>
+ <samples_per_wu>4194304</samples_per_wu>
<highpass>0.0</highpass>
<blanker_filter>randomize</blanker_filter>
</splitter_config>
diff --git a/db/xml_util.h b/db/xml_util.h
index f999c99..7da2e94 100644
--- a/db/xml_util.h
+++ b/db/xml_util.h
@@ -275,7 +275,7 @@ std::string base64_encode(const T *tbin, size_t n_elements) {
c[1] = (bin[offset]<<4) & 0x3f | ((bin[offset+1]>>4)&0xf); // 2+4
c[2] = ((bin[offset+1]<<2)&0x3f) | ((bin[offset+2]>>6)&0x3);// 4+2
c[3] = bin[offset+2]&0x3f; // 6
- for (i=0;i<((nleft>3)?4:(nleft+1));i++) c[i]=encode_arr[c[i]];
+ for (i=0;i<((nleft>3)?4:(nleft+1));i++) c[i]=encode_arr[(int)c[i]];
for (;i<4;i++) c[i]='=';
c[4]=0;
rv+=c;
@@ -300,7 +300,7 @@ std::vector<T> base64_decode(const char *data, size_t nbytes) {
rv.reserve(nbytes*3/4);
while (p<(data+nbytes)) {
while (*p && (p<(data+nbytes)) && !isencchar(*p)) {
- *p++;
+ p++;
}
if (!(*p) || (p>=(data+nbytes))) break;
eol=strchr(p,cr);
@@ -370,7 +370,7 @@ std::string base85_encode(const T *tbin, size_t n_elements) {
if (c[0]==83) { // need to change a high order 'z' into
c[0]=84; // an "_" so it won't look like a zero word.
}
- for (i=0;i<5;i++) c[i]=encode_arr85[c[i]];
+ for (i=0;i<5;i++) c[i]=encode_arr85[(int)c[i]];
for (i=5-n_pads;i<5;i++) c[i]='_'; // add pad characters
c[5]=0;
}
@@ -395,7 +395,7 @@ std::vector<T> base85_decode(const char *data, size_t nbytes) {
rv.reserve(nbytes*4/5);
while (p<(data+nbytes)) {
while (*p && (p<(data+nbytes)) && !isencchar85(*p)) {
- *p++;
+ p++;
}
if (!(*p) || (p>=(data+nbytes))) break;
eol=strchr(p,cr);
@@ -499,7 +499,7 @@ std::vector<T> x_setiathome_decode(const char *data, size_t nbytes) {
rv.reserve(nbytes*3/4);
while (p<(data+nbytes)) {
while ((*p<0x20) || (*p>0x60)) {
- *p++;
+ p++;
}
eol=strchr(p,'\n');
eol2=strchr(p,'\r');
diff --git a/m4/sah_avx.m4 b/m4/sah_avx.m4
index b856743..10f8515 100644
--- a/m4/sah_avx.m4
+++ b/m4/sah_avx.m4
@@ -12,8 +12,9 @@ AC_DEFUN([SAH_AVX],[
AC_MSG_RESULT($have_avx)
if test "$have_avx" = "yes" ; then
AC_MSG_CHECKING([type of arg 2 of _mm256_maskstore_ps()])
- for type in __m256d __m256i __m256 ; do
+ for type in __m256d __m256i __m256 _m256d _m256i _m256 ; do
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+#define __AVX__ 1
#if defined(HAVE_IMMINTRIN_H)
#include <immintrin.h>
#elif defined(HAVE_AVXINTRIN_H)
@@ -23,6 +24,9 @@ AC_DEFUN([SAH_AVX],[
#elif defined(HAVE_INTRIN_H)
#include <intrin.h>
#endif
+#if !defined(HAVE___M256)
+#define __m256 _m256
+#endif
float *a1;
$type a2;
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-boinc/boinc-app-seti.git
More information about the pkg-boinc-commits
mailing list