votpp.hh

00001 
00002 
00003 
00004 
00005 // ----------------------------------------------------------------------^
00006 // Copyright (C) 2004, 2005, 2006, 2007 Giorgio Calderone <gcalderone@ifc.inaf.it>
00007 // 
00008 // This file is part of VOTPP.
00009 // 
00010 // VOTPP is free software; you can redistribute it and/or modify
00011 // it under the terms of the GNU General Public License as published by
00012 // the Free Software Foundation; either version 2 of the License, or
00013 // (at your option) any later version.
00014 // 
00015 // VOTPP is distributed in the hope that it will be useful,
00016 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00017 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018 // GNU General Public License for more details.
00019 // 
00020 // You should have received a copy of the GNU General Public License
00021 // along with VOTPP; if not, write to the Free Software
00022 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00023 // 
00024 // ----------------------------------------------------------------------$
00025 
00026 
00027 
00028 
00029 
00038 #ifndef DEF_VOTPPVO_HH
00039 #define DEF_VOTPPVO_HH
00040 #include <mcs.hh>
00041 
00052 namespace votpp {
00053 
00059 enum Nodetype {
00060   VOTABLE,
00061   RESOURCE,
00062   DESCRIPTION,
00063   DEFINITIONS,
00064   INFO,
00065   PARAM,
00066   TABLE,
00067   FIELD,
00068   GROUP,
00069   FIELDref,
00070   PARAMref,
00071   VALUES,
00072   MIN,
00073   MAX,
00074   OPTION,
00075   LINK,
00076   DATA,
00077   TABLEDATA,
00078   TD,
00079   TR,
00080   FITS,
00081   BINARY,
00082   STREAM,
00083   COOSYS
00084 };
00085 
00086 
00087 enum Datatype {
00088   BOOLEAN,
00089   BIT,
00090   UNSIGNEDBYTE,
00091   SHORT,
00092   INT,
00093   LONG,
00094   CHAR,
00095   UNICODECHAR,
00096   FLOAT,
00097   DOUBLE,
00098   FLOATCOMPLEX,
00099   DOUBLECOMPLEX
00100 };
00101 
00102 
00103 enum EncodingType {
00104   ENCODING_GZIP,
00105   ENCODING_BASE64,
00106   ENCODING_DYNAMIC,
00107   ENCODING_NONE
00108 };
00109 
00110 
00111 enum Field_type {
00112 //Deprecated in VOTable specification vers. 1.1
00113   FIELD_HIDDEN,
00114   FIELD_NO_QUERY,
00115   FIELD_TRIGGER,
00116   FIELD_LOCATION
00117 };
00118 
00119 
00120 enum Resource_type {
00121   RESOURCE_RESULTS,
00122   RESOURCE_META
00123 };
00124 
00125 
00126 enum Values_Type {
00127   VALUES_LEGAL,
00128   VALUES_ACTUAL
00129 };
00130 
00131 
00132 enum Link_content_role {
00133   LINK_QUERY,
00134   LINK_HINTS,
00135   LINK_DOC,
00136   LINK_LOCATION
00137 };
00138 
00139 
00140 enum Stream_type {
00141   STREAM_TYPE_LOCATOR,
00142   STREAM_TYPE_OTHER
00143 };
00144 
00145 
00146 enum Stream_actuate {
00147   STREAM_ACTUATE_ONLOAD,
00148   STREAM_ACTUATE_ONREQUEST,
00149   STREAM_ACTUATE_OTHER,
00150   STREAM_ACTUATE_NONE
00151 };
00152 
00153 
00154 enum Coosys_system {
00155   COOSYS_EQ_FK4,
00156   COOSYS_EQ_FK5,
00157   COOSYS_ICRS,
00158   COOSYS_ECL_FK4,
00159   COOSYS_ECL_FK5,
00160   COOSYS_GALACTIC,
00161   COOSYS_SUPERGALACTIC,
00162   COOSYS_XY,
00163   COOSYS_BARYCENTRIC,
00164   COOSYS_GEO_APP
00165 };
00166 
00167 
00168 
00169 enum Data_format {
00170   DATA_TABLEDATA,
00171   DATA_FITS,
00172   DATA_BINARY
00173 };
00174 
00175 
00176 
00177 
00178 
00179 //Forward declaration
00180 class Field;
00181 class Parser_Stream;
00182 
00183 
00297 class Element {
00298 protected:
00299   static const std::string def_empty;
00300 
00302   static const enum Resource_type def_Resource_type;
00303 
00305   static const enum Values_Type def_Values_type;
00306 
00308   static const bool def_inclusive;
00309 
00311   static const enum Stream_type def_Stream_type;
00312 
00314   static const enum Stream_actuate def_Stream_actuate;
00315 
00317   static const enum EncodingType def_encoding;
00318 
00319   virtual void hk_reset();
00320   virtual void hk_setAttribute(std::string name, std::string value);
00321   virtual void hk_setChild(Element* child);
00322 
00324   enum Nodetype lnodetype;
00325 
00327   string lclassname;
00328 
00330   Element* lnext;
00331 
00333   Element* lprev;
00334 
00336   Element* lparent;
00337 
00338 
00339   unsigned int ldepth;
00340 
00341   unsigned int lord;
00342 
00343   friend class Parser_Stream;
00344 
00345   void setParentInChild(Element* child);
00346 
00347 public:
00349   virtual ~Element();
00350 
00352   enum Nodetype nodeType();
00353 
00355   string className();
00356 
00367   virtual void print(bool verbose);
00368 
00370   virtual void reset();
00371 
00372   virtual void done();
00373 
00375   virtual bool setAttribute(std::string name, std::string value);
00376 
00378   virtual bool setChild(Element* child);
00379 
00381   bool setNext(Element* next);
00382 
00384   Element* next();
00385 
00387   Element* prev();
00388 
00390   Element* parent();
00391 
00393   Element* makeCopy();
00394 
00400   unsigned int depth();
00401 
00408   unsigned int ord();
00409 
00411   static enum Nodetype sto_Nodetype(std::string s);
00412 
00414   static enum Datatype sto_Datatype(std::string s);
00415 
00417   static enum EncodingType sto_EncodingType(std::string s);
00418 
00420   static enum Resource_type sto_Resource_type(std::string s);
00421 
00423   static enum Field_type sto_Field_type(std::string s);
00424 
00426   static enum Values_Type sto_Values_type(std::string s);
00427 
00429   static enum Link_content_role sto_Link_content_role(std::string s);
00430 
00432   static enum Stream_type sto_Stream_type(std::string s);
00433 
00435   static enum Stream_actuate sto_Stream_actuate(std::string s);
00436 
00438   static enum Coosys_system sto_Coosys_system(std::string s);
00439 
00441   static bool sto_bool(std::string s);
00442 
00453   static std::string space_indent(int d);
00454 };
00455 
00456 //#define S_CHILD_DEF(NAME)                           //private:  NAME *_ch_ ## NAME;                       //public:   NAME * child_ ## NAME();
00457 
00458 
00459 //
00460 //
00461 //#define M_CHILD_DEF(NAME)                           //private:  NAME **_ch_ ## NAME;                      //private: unsigned int _ch_ ## NAME ## _count;       //public:   NAME * child_ ## NAME(unsigned int i);    //public:  unsigned int child_ ## NAME ## _count();
00462 
00463 //-------------------------------------------------------------------------------------
00464 
00465 /*
00466   Template
00467 
00468   CLASS(Classname, Nodename, , , , , , , , , , , , , , , ,          , , ,          , , , , , );
00469  );
00470 */
00471 
00472 
00473 class Description : public Element {
00474 private: bool constructor;
00475 private: string _value;
00476 private: bool _value_isnull;
00477 public: string value();
00478 public: bool value_isNull();
00479 public: Description();
00480 virtual ~Description();
00481 static string sta_className();
00482 static string sta_nodeName();
00483 static enum Nodetype sta_nodeType();
00484 void print(bool verbose);
00485 void reset();
00486 bool setAttribute(string name, string value);
00487 bool setChild(Element* child);
00488 Element* makeCopy();
00489 ;
00490 
00491 
00492 };
00493 
00494 
00495 class Coosys : public Element {
00496 private: bool constructor;
00497 private: string _ID;
00498 private: bool _ID_isnull;
00499 public: string ID();
00500 public: bool ID_isNull();
00501 private: string _equinox;
00502 private: bool _equinox_isnull;
00503 public: string equinox();
00504 public: bool equinox_isNull();
00505 private: string _epoch;
00506 private: bool _epoch_isnull;
00507 public: string epoch();
00508 public: bool epoch_isNull();
00509 private: enum Coosys_system _system;
00510 private: bool _system_isnull;
00511 public: enum Coosys_system system();
00512 public: bool system_isNull();
00513 public: Coosys();
00514 virtual ~Coosys();
00515 static string sta_className();
00516 static string sta_nodeName();
00517 static enum Nodetype sta_nodeType();
00518 void print(bool verbose);
00519 void reset();
00520 bool setAttribute(string name, string value);
00521 bool setChild(Element* child);
00522 Element* makeCopy();
00523 ;
00524 
00525 
00526 };
00527 
00528 class Info : public Element {
00529 private: bool constructor;
00530 private: string _ID;
00531 private: bool _ID_isnull;
00532 public: string ID();
00533 public: bool ID_isNull();
00534 private: string _name;
00535 private: bool _name_isnull;
00536 public: string name();
00537 public: bool name_isNull();
00538 private: string _value;
00539 private: bool _value_isnull;
00540 public: string value();
00541 public: bool value_isNull();
00542 public: Info();
00543 virtual ~Info();
00544 static string sta_className();
00545 static string sta_nodeName();
00546 static enum Nodetype sta_nodeType();
00547 void print(bool verbose);
00548 void reset();
00549 bool setAttribute(string name, string value);
00550 bool setChild(Element* child);
00551 Element* makeCopy();
00552 ;
00553 
00554 
00555 };
00556 
00557 class Link : public Element {
00558 private: bool constructor;
00559 private: string _ID;
00560 private: bool _ID_isnull;
00561 public: string ID();
00562 public: bool ID_isNull();
00563 private: enum Link_content_role _content_role;
00564 private: bool _content_role_isnull;
00565 public: enum Link_content_role content_role();
00566 public: bool content_role_isNull();
00567 private: string _content_type;
00568 private: bool _content_type_isnull;
00569 public: string content_type();
00570 public: bool content_type_isNull();
00571 private: string _title;
00572 private: bool _title_isnull;
00573 public: string title();
00574 public: bool title_isNull();
00575 private: string _value;
00576 private: bool _value_isnull;
00577 public: string value();
00578 public: bool value_isNull();
00579 private: string _href;
00580 private: bool _href_isnull;
00581 public: string href();
00582 public: bool href_isNull();
00583 private: string _gref;
00584 private: bool _gref_isnull;
00585 public: string gref();
00586 public: bool gref_isNull();
00587 private: string _action;
00588 private: bool _action_isnull;
00589 public: string action();
00590 public: bool action_isNull();
00591 public: Link();
00592 virtual ~Link();
00593 static string sta_className();
00594 static string sta_nodeName();
00595 static enum Nodetype sta_nodeType();
00596 void print(bool verbose);
00597 void reset();
00598 bool setAttribute(string name, string value);
00599 bool setChild(Element* child);
00600 Element* makeCopy();
00601 ;
00602 
00603 
00604 };
00605 
00606 class FieldRef : public Element {
00607 private: bool constructor;
00608 private: string _ref;
00609 private: bool _ref_isnull;
00610 public: string ref();
00611 public: bool ref_isNull();
00612 public: FieldRef();
00613 virtual ~FieldRef();
00614 static string sta_className();
00615 static string sta_nodeName();
00616 static enum Nodetype sta_nodeType();
00617 void print(bool verbose);
00618 void reset();
00619 bool setAttribute(string name, string value);
00620 bool setChild(Element* child);
00621 Element* makeCopy();
00622 ;
00623 
00624 
00625 };
00626 
00627 class ParamRef : public Element {
00628 private: bool constructor;
00629 private: string _ref;
00630 private: bool _ref_isnull;
00631 public: string ref();
00632 public: bool ref_isNull();
00633 public: ParamRef();
00634 virtual ~ParamRef();
00635 static string sta_className();
00636 static string sta_nodeName();
00637 static enum Nodetype sta_nodeType();
00638 void print(bool verbose);
00639 void reset();
00640 bool setAttribute(string name, string value);
00641 bool setChild(Element* child);
00642 Element* makeCopy();
00643 ;
00644 
00645 
00646 };
00647 
00648 class Stream : public Element {
00649 private: bool constructor;
00650 private: enum Stream_type _type;
00651 private: bool _type_isnull;
00652 public: enum Stream_type type();
00653 public: bool type_isNull();
00654 private: string _href;
00655 private: bool _href_isnull;
00656 public: string href();
00657 public: bool href_isNull();
00658 private: enum Stream_actuate _actuate;
00659 private: bool _actuate_isnull;
00660 public: enum Stream_actuate actuate();
00661 public: bool actuate_isNull();
00662 private: enum EncodingType _encoding;
00663 private: bool _encoding_isnull;
00664 public: enum EncodingType encoding();
00665 public: bool encoding_isNull();
00666 private: string _expires;
00667 private: bool _expires_isnull;
00668 public: string expires();
00669 public: bool expires_isNull();
00670 private: string _rights;
00671 private: bool _rights_isnull;
00672 public: string rights();
00673 public: bool rights_isNull();
00674 public: Stream();
00675 virtual ~Stream();
00676 static string sta_className();
00677 static string sta_nodeName();
00678 static enum Nodetype sta_nodeType();
00679 void print(bool verbose);
00680 void reset();
00681 bool setAttribute(string name, string value);
00682 bool setChild(Element* child);
00683 Element* makeCopy();
00684 ;
00685 
00686 
00687 };
00688 
00689 class Column : public Element {
00690 private: bool constructor;
00691 private: enum EncodingType _encoding;
00692 private: bool _encoding_isnull;
00693 public: enum EncodingType encoding();
00694 public: bool encoding_isNull();
00695 private: string _value;
00696 private: bool _value_isnull;
00697 public: string value();
00698 public: bool value_isNull();
00699 public: Column();
00700 virtual ~Column();
00701 static string sta_className();
00702 static string sta_nodeName();
00703 static enum Nodetype sta_nodeType();
00704 void print(bool verbose);
00705 void reset();
00706 bool setAttribute(string name, string value);
00707 bool setChild(Element* child);
00708 Element* makeCopy();
00709 ;
00710 
00711 
00712 
00713 //  void done();
00714 //  Record data;
00715 };
00716 
00717 
00718 class Min : public Element {
00719 private: bool constructor;
00720 private: string _value;
00721 private: bool _value_isnull;
00722 public: string value();
00723 public: bool value_isNull();
00724 private: bool _inclusive;
00725 private: bool _inclusive_isnull;
00726 public: bool inclusive();
00727 public: bool inclusive_isNull();
00728 public: Min();
00729 virtual ~Min();
00730 static string sta_className();
00731 static string sta_nodeName();
00732 static enum Nodetype sta_nodeType();
00733 void print(bool verbose);
00734 void reset();
00735 bool setAttribute(string name, string value);
00736 bool setChild(Element* child);
00737 Element* makeCopy();
00738 ;
00739 
00740 
00741 };
00742 
00743 class Max : public Element {
00744 private: bool constructor;
00745 private: string _value;
00746 private: bool _value_isnull;
00747 public: string value();
00748 public: bool value_isNull();
00749 private: bool _inclusive;
00750 private: bool _inclusive_isnull;
00751 public: bool inclusive();
00752 public: bool inclusive_isNull();
00753 public: Max();
00754 virtual ~Max();
00755 static string sta_className();
00756 static string sta_nodeName();
00757 static enum Nodetype sta_nodeType();
00758 void print(bool verbose);
00759 void reset();
00760 bool setAttribute(string name, string value);
00761 bool setChild(Element* child);
00762 Element* makeCopy();
00763 ;
00764 
00765 
00766 };
00767 
00768 class Option : public Element {
00769 private: bool constructor;
00770 private: string _name;
00771 private: bool _name_isnull;
00772 public: string name();
00773 public: bool name_isNull();
00774 private: string _value;
00775 private: bool _value_isnull;
00776 public: string value();
00777 public: bool value_isNull();
00778 private: Option **_ch_Option;
00779 private: unsigned int _ch_Option_count;
00780 public: Option * option(unsigned int i);
00781 public: unsigned int option_count();
00782 public: Option();
00783 virtual ~Option();
00784 static string sta_className();
00785 static string sta_nodeName();
00786 static enum Nodetype sta_nodeType();
00787 void print(bool verbose);
00788 void reset();
00789 bool setAttribute(string name, string value);
00790 bool setChild(Element* child);
00791 Element* makeCopy();
00792 ;
00793 
00794 
00795 };
00796 
00797 
00798 class Row : public Element {
00799 private: bool constructor;
00800 private: Column **_ch_Column;
00801 private: unsigned int _ch_Column_count;
00802 public: Column * column(unsigned int i);
00803 public: unsigned int column_count();
00804 public: Row();
00805 virtual ~Row();
00806 static string sta_className();
00807 static string sta_nodeName();
00808 static enum Nodetype sta_nodeType();
00809 void print(bool verbose);
00810 void reset();
00811 bool setAttribute(string name, string value);
00812 bool setChild(Element* child);
00813 Element* makeCopy();
00814 ;
00815 
00816 
00817 };
00818 
00819 
00820 class Tabledata : public Element {
00821 private: bool constructor;
00822 private: Row **_ch_Row;
00823 private: unsigned int _ch_Row_count;
00824 public: Row * row(unsigned int i);
00825 public: unsigned int row_count();
00826 public: Tabledata();
00827 virtual ~Tabledata();
00828 static string sta_className();
00829 static string sta_nodeName();
00830 static enum Nodetype sta_nodeType();
00831 void print(bool verbose);
00832 void reset();
00833 bool setAttribute(string name, string value);
00834 bool setChild(Element* child);
00835 Element* makeCopy();
00836 ;
00837 
00838 
00839 };
00840 
00841 
00842 class Fits : public Element {
00843 private: bool constructor;
00844 private: int _extnum;
00845 private: bool _extnum_isnull;
00846 public: int extnum();
00847 public: bool extnum_isNull();
00848 private: Stream *_ch_Stream;
00849 public: Stream * stream();
00850 public: Fits();
00851 virtual ~Fits();
00852 static string sta_className();
00853 static string sta_nodeName();
00854 static enum Nodetype sta_nodeType();
00855 void print(bool verbose);
00856 void reset();
00857 bool setAttribute(string name, string value);
00858 bool setChild(Element* child);
00859 Element* makeCopy();
00860 ;
00861 
00862 
00863 };
00864 
00865 
00866 class Binary : public Element {
00867 private: bool constructor;
00868 private: Stream *_ch_Stream;
00869 public: Stream * stream();
00870 public: Binary();
00871 virtual ~Binary();
00872 static string sta_className();
00873 static string sta_nodeName();
00874 static enum Nodetype sta_nodeType();
00875 void print(bool verbose);
00876 void reset();
00877 bool setAttribute(string name, string value);
00878 bool setChild(Element* child);
00879 Element* makeCopy();
00880 ;
00881 
00882 
00883 };
00884 
00885 
00886 class Values : public Element {
00887 private: bool constructor;
00888 private: string _ID;
00889 private: bool _ID_isnull;
00890 public: string ID();
00891 public: bool ID_isNull();
00892 private: enum Values_Type _type;
00893 private: bool _type_isnull;
00894 public: enum Values_Type type();
00895 public: bool type_isNull();
00896 private: string _null;
00897 private: bool _null_isnull;
00898 public: string null();
00899 public: bool null_isNull();
00900 private: string _ref;
00901 private: bool _ref_isnull;
00902 public: string ref();
00903 public: bool ref_isNull();
00904 private: Min *_ch_Min;
00905 public: Min * min();
00906 private: Max *_ch_Max;
00907 public: Max * max();
00908 private: Option **_ch_Option;
00909 private: unsigned int _ch_Option_count;
00910 public: Option * option(unsigned int i);
00911 public: unsigned int option_count();
00912 public: Values();
00913 virtual ~Values();
00914 static string sta_className();
00915 static string sta_nodeName();
00916 static enum Nodetype sta_nodeType();
00917 void print(bool verbose);
00918 void reset();
00919 bool setAttribute(string name, string value);
00920 bool setChild(Element* child);
00921 Element* makeCopy();
00922 ;
00923 
00924 
00925 };
00926 
00927 
00928 class Field : public Element {
00929 private: bool constructor;
00930 private: string _ID;
00931 private: bool _ID_isnull;
00932 public: string ID();
00933 public: bool ID_isNull();
00934 private: string _unit;
00935 private: bool _unit_isnull;
00936 public: string unit();
00937 public: bool unit_isNull();
00938 private: enum Datatype _datatype;
00939 private: bool _datatype_isnull;
00940 public: enum Datatype datatype();
00941 public: bool datatype_isNull();
00942 private: string _precision;
00943 private: bool _precision_isnull;
00944 public: string precision();
00945 public: bool precision_isNull();
00946 private: int _width;
00947 private: bool _width_isnull;
00948 public: int width();
00949 public: bool width_isNull();
00950 private: string _ref;
00951 private: bool _ref_isnull;
00952 public: string ref();
00953 public: bool ref_isNull();
00954 private: string _name;
00955 private: bool _name_isnull;
00956 public: string name();
00957 public: bool name_isNull();
00958 private: string _ucd;
00959 private: bool _ucd_isnull;
00960 public: string ucd();
00961 public: bool ucd_isNull();
00962 private: string _utype;
00963 private: bool _utype_isnull;
00964 public: string utype();
00965 public: bool utype_isNull();
00966 private: string _arraysize;
00967 private: bool _arraysize_isnull;
00968 public: string arraysize();
00969 public: bool arraysize_isNull();
00970 private: enum Field_type _type;
00971 private: bool _type_isnull;
00972 public: enum Field_type type();
00973 public: bool type_isNull();
00974 private: Description *_ch_Description;
00975 public: Description * description();
00976 private: Values *_ch_Values;
00977 public: Values * values();
00978 private: Link **_ch_Link;
00979 private: unsigned int _ch_Link_count;
00980 public: Link * link(unsigned int i);
00981 public: unsigned int link_count();
00982 public: Field();
00983 virtual ~Field();
00984 static string sta_className();
00985 static string sta_nodeName();
00986 static enum Nodetype sta_nodeType();
00987 void print(bool verbose);
00988 void reset();
00989 bool setAttribute(string name, string value);
00990 bool setChild(Element* child);
00991 Element* makeCopy();
00992 ;
00993 
00994 
00995 
00996   //  void done();
00997 
00998 };
00999 
01000 
01001 class Param : public Element {
01002 private: bool constructor;
01003 private: string _ID;
01004 private: bool _ID_isnull;
01005 public: string ID();
01006 public: bool ID_isNull();
01007 private: string _unit;
01008 private: bool _unit_isnull;
01009 public: string unit();
01010 public: bool unit_isNull();
01011 private: enum Datatype _datatype;
01012 private: bool _datatype_isnull;
01013 public: enum Datatype datatype();
01014 public: bool datatype_isNull();
01015 private: string _precision;
01016 private: bool _precision_isnull;
01017 public: string precision();
01018 public: bool precision_isNull();
01019 private: int _width;
01020 private: bool _width_isnull;
01021 public: int width();
01022 public: bool width_isNull();
01023 private: string _ref;
01024 private: bool _ref_isnull;
01025 public: string ref();
01026 public: bool ref_isNull();
01027 private: string _name;
01028 private: bool _name_isnull;
01029 public: string name();
01030 public: bool name_isNull();
01031 private: string _ucd;
01032 private: bool _ucd_isnull;
01033 public: string ucd();
01034 public: bool ucd_isNull();
01035 private: string _utype;
01036 private: bool _utype_isnull;
01037 public: string utype();
01038 public: bool utype_isNull();
01039 private: string _value;
01040 private: bool _value_isnull;
01041 public: string value();
01042 public: bool value_isNull();
01043 private: string _arraysize;
01044 private: bool _arraysize_isnull;
01045 public: string arraysize();
01046 public: bool arraysize_isNull();
01047 private: Description *_ch_Description;
01048 public: Description * description();
01049 private: Values *_ch_Values;
01050 public: Values * values();
01051 private: Link **_ch_Link;
01052 private: unsigned int _ch_Link_count;
01053 public: Link * link(unsigned int i);
01054 public: unsigned int link_count();
01055 public: Param();
01056 virtual ~Param();
01057 static string sta_className();
01058 static string sta_nodeName();
01059 static enum Nodetype sta_nodeType();
01060 void print(bool verbose);
01061 void reset();
01062 bool setAttribute(string name, string value);
01063 bool setChild(Element* child);
01064 Element* makeCopy();
01065 ;
01066 
01067 
01068 };
01069 
01070 
01071 class Group : public Element {
01072 private: bool constructor;
01073 private: string _ID;
01074 private: bool _ID_isnull;
01075 public: string ID();
01076 public: bool ID_isNull();
01077 private: string _name;
01078 private: bool _name_isnull;
01079 public: string name();
01080 public: bool name_isNull();
01081 private: string _ref;
01082 private: bool _ref_isnull;
01083 public: string ref();
01084 public: bool ref_isNull();
01085 private: string _ucd;
01086 private: bool _ucd_isnull;
01087 public: string ucd();
01088 public: bool ucd_isNull();
01089 private: string _utype;
01090 private: bool _utype_isnull;
01091 public: string utype();
01092 public: bool utype_isNull();
01093 private: Description *_ch_Description;
01094 public: Description * description();
01095 private: FieldRef **_ch_FieldRef;
01096 private: unsigned int _ch_FieldRef_count;
01097 public: FieldRef * fieldref(unsigned int i);
01098 public: unsigned int fieldref_count();
01099 private: Param **_ch_Param;
01100 private: unsigned int _ch_Param_count;
01101 public: Param * param(unsigned int i);
01102 public: unsigned int param_count();
01103 private: ParamRef **_ch_ParamRef;
01104 private: unsigned int _ch_ParamRef_count;
01105 public: ParamRef * paramref(unsigned int i);
01106 public: unsigned int paramref_count();
01107 private: Group **_ch_Group;
01108 private: unsigned int _ch_Group_count;
01109 public: Group * group(unsigned int i);
01110 public: unsigned int group_count();
01111 public: Group();
01112 virtual ~Group();
01113 static string sta_className();
01114 static string sta_nodeName();
01115 static enum Nodetype sta_nodeType();
01116 void print(bool verbose);
01117 void reset();
01118 bool setAttribute(string name, string value);
01119 bool setChild(Element* child);
01120 Element* makeCopy();
01121 ;
01122 
01123 
01124 };
01125 
01126 
01127 class Data : public Element {
01128 private: bool constructor;
01129 private: Tabledata *_ch_Tabledata;
01130 public: Tabledata * tabledata();
01131 private: Binary *_ch_Binary;
01132 public: Binary * binary();
01133 private: Fits *_ch_Fits;
01134 public: Fits * fits();
01135 public: Data();
01136 virtual ~Data();
01137 static string sta_className();
01138 static string sta_nodeName();
01139 static enum Nodetype sta_nodeType();
01140 void print(bool verbose);
01141 void reset();
01142 bool setAttribute(string name, string value);
01143 bool setChild(Element* child);
01144 Element* makeCopy();
01145 ;
01146 
01147 
01148 };
01149 
01150 
01151 
01152 //The Table class is used by Parser_Data to read table's data
01153 class Table : public Element {
01154 private: bool constructor;
01155 private: string _ID;
01156 private: bool _ID_isnull;
01157 public: string ID();
01158 public: bool ID_isNull();
01159 private: string _name;
01160 private: bool _name_isnull;
01161 public: string name();
01162 public: bool name_isNull();
01163 private: string _ref;
01164 private: bool _ref_isnull;
01165 public: string ref();
01166 public: bool ref_isNull();
01167 private: string _ucd;
01168 private: bool _ucd_isnull;
01169 public: string ucd();
01170 public: bool ucd_isNull();
01171 private: string _utype;
01172 private: bool _utype_isnull;
01173 public: string utype();
01174 public: bool utype_isNull();
01175 private: int _nrows;
01176 private: bool _nrows_isnull;
01177 public: int nrows();
01178 public: bool nrows_isNull();
01179 private: Description *_ch_Description;
01180 public: Description * description();
01181 private: Data *_ch_Data;
01182 public: Data * data();
01183 private: Field **_ch_Field;
01184 private: unsigned int _ch_Field_count;
01185 public: Field * field(unsigned int i);
01186 public: unsigned int field_count();
01187 private: Param **_ch_Param;
01188 private: unsigned int _ch_Param_count;
01189 public: Param * param(unsigned int i);
01190 public: unsigned int param_count();
01191 private: Group **_ch_Group;
01192 private: unsigned int _ch_Group_count;
01193 public: Group * group(unsigned int i);
01194 public: unsigned int group_count();
01195 private: Link **_ch_Link;
01196 private: unsigned int _ch_Link_count;
01197 public: Link * link(unsigned int i);
01198 public: unsigned int link_count();
01199 public: Table();
01200 virtual ~Table();
01201 static string sta_className();
01202 static string sta_nodeName();
01203 static enum Nodetype sta_nodeType();
01204 void print(bool verbose);
01205 void reset();
01206 bool setAttribute(string name, string value);
01207 bool setChild(Element* child);
01208 Element* makeCopy();
01209 ;
01210 
01211 
01212 
01213   //  void hk_reset();
01214   string filename;
01215 
01216 };
01217 
01218 
01219 class Resource : public Element {
01220 private: bool constructor;
01221 private: string _ID;
01222 private: bool _ID_isnull;
01223 public: string ID();
01224 public: bool ID_isNull();
01225 private: string _name;
01226 private: bool _name_isnull;
01227 public: string name();
01228 public: bool name_isNull();
01229 private: string _utype;
01230 private: bool _utype_isnull;
01231 public: string utype();
01232 public: bool utype_isNull();
01233 private: enum Resource_type _type;
01234 private: bool _type_isnull;
01235 public: enum Resource_type type();
01236 public: bool type_isNull();
01237 private: Description *_ch_Description;
01238 public: Description * description();
01239 private: Info **_ch_Info;
01240 private: unsigned int _ch_Info_count;
01241 public: Info * info(unsigned int i);
01242 public: unsigned int info_count();
01243 private: Coosys **_ch_Coosys;
01244 private: unsigned int _ch_Coosys_count;
01245 public: Coosys * coosys(unsigned int i);
01246 public: unsigned int coosys_count();
01247 private: Param **_ch_Param;
01248 private: unsigned int _ch_Param_count;
01249 public: Param * param(unsigned int i);
01250 public: unsigned int param_count();
01251 private: Link **_ch_Link;
01252 private: unsigned int _ch_Link_count;
01253 public: Link * link(unsigned int i);
01254 public: unsigned int link_count();
01255 private: Table **_ch_Table;
01256 private: unsigned int _ch_Table_count;
01257 public: Table * table(unsigned int i);
01258 public: unsigned int table_count();
01259 private: Resource **_ch_Resource;
01260 private: unsigned int _ch_Resource_count;
01261 public: Resource * resource(unsigned int i);
01262 public: unsigned int resource_count();
01263 public: Resource();
01264 virtual ~Resource();
01265 static string sta_className();
01266 static string sta_nodeName();
01267 static enum Nodetype sta_nodeType();
01268 void print(bool verbose);
01269 void reset();
01270 bool setAttribute(string name, string value);
01271 bool setChild(Element* child);
01272 Element* makeCopy();
01273 ;
01274 
01275 
01276 };
01277 
01278 
01279 class Definitions : public Element {
01280 private: bool constructor;
01281 private: Coosys **_ch_Coosys;
01282 private: unsigned int _ch_Coosys_count;
01283 public: Coosys * coosys(unsigned int i);
01284 public: unsigned int coosys_count();
01285 public: Definitions();
01286 virtual ~Definitions();
01287 static string sta_className();
01288 static string sta_nodeName();
01289 static enum Nodetype sta_nodeType();
01290 void print(bool verbose);
01291 void reset();
01292 bool setAttribute(string name, string value);
01293 bool setChild(Element* child);
01294 Element* makeCopy();
01295 ;
01296 
01297 
01298 };
01299 
01300 
01301 class VOTable : public Element {
01302 private: bool constructor;
01303 private: string _xmlns;
01304 private: bool _xmlns_isnull;
01305 public: string xmlns();
01306 public: bool xmlns_isNull();
01307 private: string _ID;
01308 private: bool _ID_isnull;
01309 public: string ID();
01310 public: bool ID_isNull();
01311 private: string _version;
01312 private: bool _version_isnull;
01313 public: string version();
01314 public: bool version_isNull();
01315 private: Description *_ch_Description;
01316 public: Description * description();
01317 private: Definitions *_ch_Definitions;
01318 public: Definitions * definitions();
01319 private: Coosys **_ch_Coosys;
01320 private: unsigned int _ch_Coosys_count;
01321 public: Coosys * coosys(unsigned int i);
01322 public: unsigned int coosys_count();
01323 private: Param **_ch_Param;
01324 private: unsigned int _ch_Param_count;
01325 public: Param * param(unsigned int i);
01326 public: unsigned int param_count();
01327 private: Info **_ch_Info;
01328 private: unsigned int _ch_Info_count;
01329 public: Info * info(unsigned int i);
01330 public: unsigned int info_count();
01331 private: Resource **_ch_Resource;
01332 private: unsigned int _ch_Resource_count;
01333 public: Resource * resource(unsigned int i);
01334 public: unsigned int resource_count();
01335 public: VOTable();
01336 virtual ~VOTable();
01337 static string sta_className();
01338 static string sta_nodeName();
01339 static enum Nodetype sta_nodeType();
01340 void print(bool verbose);
01341 void reset();
01342 bool setAttribute(string name, string value);
01343 bool setChild(Element* child);
01344 Element* makeCopy();
01345 ;
01346 
01347 
01348 };
01349 
01350 
01351 typedef union NodePointer {
01352   votpp::Element *element;
01353   votpp::VOTable *votable;
01354   votpp::Resource *resource;
01355   votpp::Description *description;
01356   votpp::Definitions *definitions;
01357   votpp::Info *info;
01358   votpp::Param *param;
01359   votpp::Table *table;
01360   votpp::Field *field;
01361   votpp::Group *group;
01362   votpp::FieldRef *fieldref;
01363   votpp::ParamRef *paramref;
01364   votpp::Values *values;
01365   votpp::Min *min;
01366   votpp::Max *max;
01367   votpp::Option *option;
01368   votpp::Link *link;
01369   votpp::Data *data;
01370   votpp::Tabledata *tabledata;
01371   votpp::Column *column;
01372   votpp::Row *row;
01373   votpp::Fits *fits;
01374   votpp::Binary *binary;
01375   votpp::Stream *stream;
01376   votpp::Coosys *coosys;
01377 };
01378 
01379 class VOTableReaderSplit : public mcs::URLReader
01380 {
01381 private:
01382   static char* NodeStream[2];
01383 
01384   mcs::B64_Codec b64;
01385   char* pMatch[2];
01386   int pMatchLen[2];
01387   int sel, nse;
01388 
01389   unsigned int writeSplit(char* buf, unsigned int len);
01390   unsigned int Write(void *ptr, unsigned int size, unsigned int nmemb);
01391 
01392   int bin_filecount;
01393   int bin_outfd;
01394   string bin_file_prefix;
01395 
01397   mcs::Synchro synchro;
01398   bool consumerReady;
01399   mcs::Pipe* lbinpipe;
01400 
01401 public:
01402   void saveBinaryStream(string fn = "");
01403 
01404   mcs::Pipe* binpipe();
01405 
01406   VOTableReaderSplit();
01407   ~VOTableReaderSplit();
01408 };
01409 
01410 
01472 class Parser_Stream
01473 {
01474 private:
01475   //Object used for reading input file.
01476   VOTableReaderSplit input;
01477 
01479   std::string lfilename;
01480 
01482   enum Nodetype lnodetype;
01483 
01485   unsigned int nodeord;
01486 
01488   void* pReader;
01489 
01490   void* pInput;
01491 
01493   bool flopen;
01494 
01496   bool flnewinfo;
01497 
01498   //bool fleof;
01499 
01500   int next_xmlnode(bool skipSubTree);
01501 
01502   int parse();
01503 
01504   bool continue_read;
01505 
01506   unsigned int ldepth;
01507 
01508   mcs::RecordSet* lbinstream;
01509 
01510   Element* lnode;
01511 
01512   VOTable votable;
01513   Resource resource;
01514   Description description;
01515   Definitions definitions;
01516   Info info;
01517   Param param;
01518   Table table;
01519   Field field;
01520   Group group;
01521   FieldRef fieldref;
01522   ParamRef paramref;
01523   Values values;
01524   Min min;
01525   Max max;
01526   Option option;
01527   Link link;
01528   Data data;
01529   Tabledata tabledata;
01530   Column column;
01531   Row row;
01532   Fits fits;
01533   Binary binary;
01534   Stream stream;
01535   Coosys coosys;
01536 
01537 public:
01541   Parser_Stream();
01542 
01544   ~Parser_Stream();
01545 
01551   void open(std::string filename);
01552 
01556   void close();
01557 
01559   std::string filename();
01560 
01562   enum Nodetype nodeType();
01563 
01565   unsigned int depth();
01566 
01573   NodePointer node();
01574 
01585   NodePointer next(bool skipSubTree = false);
01586 
01588   NodePointer skip(unsigned int n = 1);
01589 
01590   mcs::RecordSet* binstream();
01591   void saveBinaryStream(string fn = "");
01592 };
01593 
01594 
01595 
01596 
01597 
01653 class Parser_Tree {
01654 private:
01656   bool flmodified;
01657 
01659   bool smartmode;
01660 
01662   Parser_Stream stream;
01663 
01665   VOTable* lroot;
01666 
01667   void addNodes(Element* node, unsigned int d);
01668 
01669 public:
01673   Parser_Tree(bool smartmode = true);
01674 
01676   ~Parser_Tree();
01677 
01689   void open(std::string filename);
01690 
01694   void free();
01695 
01696   //Return a pointer to the root node in the tree.
01697   VOTable* root();
01698 };
01699 
01700 //class Parser_Table : public mcs::RecordSet {
01701 //private:
01702 //  Parser_Stream stream;
01703 //  Element* node;
01704 //
01705 //  Data_format type;
01706 //  mcs::Record meta;
01707 //
01708 //  vector<string> arrsizes;
01709 //
01710 //  string fn;
01711 //  unsigned int ord_nodeTable;
01712 //
01713 //  void searchStartData();
01714 //
01715 //  bool fetch_tabledata(unsigned int newpos, bool random);
01716 //  bool fetch_binary(unsigned int newpos, bool random);
01717 //  bool fetch_fits(unsigned int newpos, bool random);
01718 //
01719 //  bool fetch(unsigned int newpos, bool random);
01720 //
01721 //  void addMeta(Field& field);
01722 //
01723 //
01724 //public:
01725 //  Parser_Table(Table& nodeTable);
01726 //  Parser_Table(string fn, int tableOrd = 1);
01727 //
01728 //  ~Parser_Table();
01729 //};
01730 //
01731 //
01732 //
01733 //
01734 //
01735 //
01736 //
01737 //
01738 //
01739 //#define VOT_WRI_TABLEDATA
01740 //#define VOT_WRI_FITS
01741 //#define VOT_WRI_BINARY
01742 //
01743 //
01744 //#define VOT_ENDNODE 1
01745 //
01746 //class Writer_Stream {
01747 //private:
01748 //  //!True if a file is open
01749 //  bool flopen;
01750 //
01751 //  int level;
01752 //
01753 //  //!The writer used to do the job.
01754 //  void* pWriter;
01755 //
01756 //
01757 //public:
01758 //  //!Constructor
01759 //  Writer_Stream();
01760 //
01761 //  //!Destructor, automatically calls close().
01762 //  ~Writer_Stream();
01763 //
01764 //  //!Open a new file for writing.
01765 //  void open(string resource, enum Data_format format, bool include = false);
01766 //
01767 //  //!Finalize writing to a file.
01768 //  void close();
01769 //
01770 //  //!Actual node
01771 //  Element* node;
01772 //
01773 //  const Writer_Stream& operator<<(Element* newnode);
01774 //  const Writer_Stream& operator<<(const int& endnode);
01775 //};
01776 
01777 
01778 
01779 
01780 }
01781 //namespace votpp
01782 #endif 

VOTPP (VOTable C++ Parser) ver. 0.3.2-alpha1
Documentation generated on Sun Nov 18 12:06:20 UTC 2007