// This file is automatically generated.  Do not edit
#ifndef _H_ap_schema_H
#define _H_ap_schema_H
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); }
#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); }
#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:
};


class  threshold_t  : public db_type<threshold_t> {
  public:
	long  coadds;
	double  threshold;
	threshold_t();
	threshold_t(const threshold_t &a);
	threshold_t(const SQL_ROW &a);
	threshold_t(const std::string &s,const char *tag="threshold_t");
	threshold_t &operator =(const threshold_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="threshold_t") const;
	void parse(const SQL_ROW &s);
	void parse(const std::string &s);
	void parse_xml(const std::string &s,const char *tag="threshold_t");
  private:
};


class  data_description_t  : public db_type<data_description_t> {
  public:
	coordinate_t start;
	coordinate_t end;
	long  block_num;
	long  nsamples;
	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  tape  : public db_table<tape> {
  public:
	long  id;
	char  name[20];
	double  start_time;
	double  last_block_time;
	long  last_block_done;
	long  wu_count;
	long  beam;
	long  polarization;
	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  analysis_config  : public db_table<analysis_config> {
  public:
	long  id;
	long  dm_low;
	long  dm_high;
	long  dm_chunk_small;
	long  dm_chunk_large;
	long  fold_buf_bytes_short;
	long  max_coadd;
	long  fft_len;
	long  remove_radar;
	double  high_pass;
	double  ffa_threshold;
	sqlblob<threshold_t>  thresholds ;
	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  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:
};


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;
	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  splitter_config  : public db_table<splitter_config> {
  public:
	long  id;
	long  version;
	long  blocks_per_wu;
	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  settings  : public db_table<settings> {
  public:
	long  id;
	long  active;
	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;
	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_header  : public db_table<workunit_header> {
  public:
	sqlint8_t  id;
	char  name[128];
	db_reference<tape,long> tape_info;
	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;
	data_description_t data_desc;
	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;
	double  fraction_blanked;
	long  return_code;
	long  overflow;
	long  reserved;
	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  ap_signal  : public db_table<ap_signal> {
  public:
	sqlint8_t  id;
	db_reference<result,sqlint8_t> resultid;
	long  fft_num;
	long  peak_bin;
	double  peak_power;
	long  scale;
	long  dm;
	double  period;
	long  ffa_scale;
	double  num_std_devs;
	double  ra;
	double  decl;
	double  time;
	long  qpix;
	long  rfi_found;
	long  reserved;
	long  time_series_len;
	long  raw_data_len;
	sqlblob<unsigned char>  time_series;
	sqlblob<unsigned char>  raw_data;
	ap_signal();
	ap_signal(const ap_signal &a);
	ap_signal(const SQL_ROW &a);
	ap_signal(const std::string &s,const char *tag="ap_signal");
	ap_signal &operator =(const ap_signal &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="ap_signal") const;
	void parse(const SQL_ROW &s);
	void parse(const std::string &s);
	void parse_xml(const std::string &s,const char *tag="ap_signal");
  private:
};


class  rfi  : public db_table<rfi> {
  public:
	sqlint8_t  id;
	db_reference<ap_signal,sqlint8_t> ap_signalid;
	double  chisq;
	double  log_prob;
	double  chisq_time;
	long  rep_at_dm;
	double  rep_at_dm_time;
	double  fraction_blanked;
	long  user_marked;
	double  user_marked_time;
	double  edge_pulse_diff;
	double  edge_pulse_time;
	long  multi_beams;
	double  multi_beams_time;
	rfi();
	rfi(const rfi &a);
	rfi(const SQL_ROW &a);
	rfi(const std::string &s,const char *tag="rfi");
	rfi &operator =(const rfi &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") const;
	void parse(const SQL_ROW &s);
	void parse(const std::string &s);
	void parse_xml(const std::string &s,const char *tag="rfi");
  private:
};


#endif
