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 #include <votpp.hh> 00027 using namespace votpp; 00028 00029 00030 //-------------- A T T R I B U T E S ------------------------- 00031 00032 // data.addField(new mcs::Data(value)); 00033 // data[data.count()-1].setName(name.c_str()); 00034 00035 // -------------------- C H I L D S ------------------------------------- 00036 //#define S_CHILD_IMPL(CLNAME, NAME) // NAME * CLNAME::child_ ## NAME() { return _ch_ ## NAME; } 00037 00038 // 00039 // 00040 //#define M_CHILD_IMPL(CLNAME, NAME) // NAME * CLNAME::child_ ## NAME(unsigned int i ) { // if (i >= _ch_ ## NAME ## _count) // throw MCS_ERROR( MSG_VOT_INVALID_INDEX, "", i); // else // return (_ch_ ## NAME [i]); //} // //unsigned int CLNAME::child_ ## NAME ## _count() { return _ch_ ## NAME ## _count; } 00041 00042 /* 00043 * * ***** ******* 00044 ** ** * * * * 00045 * * * * * ** 00046 * * * * * *** 00047 * * * * ** 00048 * * * * * * 00049 * * ***** ******* 00050 */ 00051 00052 /* 00053 Template 00054 00055 CLASS(Classname, Nodename, , , , , , , , , , , , , , , , , , , , , , , , ); 00056 ); 00057 */ 00058 00059 00060 Description::Description() { 00061 lnodetype = DESCRIPTION; 00062 lclassname = "Description" ; 00063 constructor = true; 00064 reset(); 00065 constructor = false; 00066 } 00067 Description::~Description() { 00068 reset(); 00069 } 00070 string Description::sta_className() { 00071 return "Description" ; 00072 } 00073 string Description::sta_nodeName() { 00074 return "DESCRIPTION" ; 00075 } 00076 enum Nodetype Description::sta_nodeType() { 00077 return DESCRIPTION; 00078 } 00079 string Description::value() { 00080 return _value; 00081 } 00082 bool Description::value_isNull() { 00083 return _value_isnull; 00084 } 00085 void Description::print(bool verbose) { 00086 cout << space_indent(depth()) << "NODE " << sta_className() << " (" << ord() << ")" << endl; 00087 if (verbose) { 00088 cout << space_indent(depth()) << "ATTR " << "value" << ": "; 00089 if (! _value_isnull) cout << _value; 00090 cout << "|" << endl; 00091 } 00092 else if (! _value_isnull) cout << space_indent(depth()) << "ATTR " << "value" << endl; 00093 } 00094 void Description::reset() { 00095 lparent = NULL; 00096 lnext = NULL; 00097 lprev = NULL; 00098 _value_isnull = true; 00099 hk_reset(); 00100 } 00101 bool Description::setAttribute(string name, string value) { 00102 bool found = false; 00103 if (0) ; 00104 else if (strcmp(name.c_str(), "value") == 0) { 00105 _value = string(value); 00106 _value_isnull = false; 00107 ; found = true; 00108 } 00109 hk_setAttribute(name, value); 00110 return found; 00111 } 00112 bool Description::setChild(Element* child) { 00113 bool found = false; 00114 if (0) ; 00115 hk_setChild(child); 00116 return found; 00117 }; 00118 00119 00120 ; 00121 00122 00123 Coosys::Coosys() { 00124 lnodetype = COOSYS; 00125 lclassname = "Coosys" ; 00126 constructor = true; 00127 reset(); 00128 constructor = false; 00129 } 00130 Coosys::~Coosys() { 00131 reset(); 00132 } 00133 string Coosys::sta_className() { 00134 return "Coosys" ; 00135 } 00136 string Coosys::sta_nodeName() { 00137 return "COOSYS" ; 00138 } 00139 enum Nodetype Coosys::sta_nodeType() { 00140 return COOSYS; 00141 } 00142 string Coosys::ID() { 00143 return _ID; 00144 } 00145 bool Coosys::ID_isNull() { 00146 return _ID_isnull; 00147 } 00148 string Coosys::equinox() { 00149 return _equinox; 00150 } 00151 bool Coosys::equinox_isNull() { 00152 return _equinox_isnull; 00153 } 00154 string Coosys::epoch() { 00155 return _epoch; 00156 } 00157 bool Coosys::epoch_isNull() { 00158 return _epoch_isnull; 00159 } 00160 enum Coosys_system Coosys::system() { 00161 return _system; 00162 } 00163 bool Coosys::system_isNull() { 00164 return _system_isnull; 00165 } 00166 void Coosys::print(bool verbose) { 00167 cout << space_indent(depth()) << "NODE " << sta_className() << " (" << ord() << ")" << endl; 00168 if (verbose) { 00169 cout << space_indent(depth()) << "ATTR " << "ID" << ": "; 00170 if (! _ID_isnull) cout << _ID; 00171 cout << "|" << endl; 00172 } 00173 else if (! _ID_isnull) cout << space_indent(depth()) << "ATTR " << "ID" << endl; 00174 if (verbose) { 00175 cout << space_indent(depth()) << "ATTR " << "equinox" << ": "; 00176 if (! _equinox_isnull) cout << _equinox; 00177 cout << "|" << endl; 00178 } 00179 else if (! _equinox_isnull) cout << space_indent(depth()) << "ATTR " << "equinox" << endl; 00180 if (verbose) { 00181 cout << space_indent(depth()) << "ATTR " << "epoch" << ": "; 00182 if (! _epoch_isnull) cout << _epoch; 00183 cout << "|" << endl; 00184 } 00185 else if (! _epoch_isnull) cout << space_indent(depth()) << "ATTR " << "epoch" << endl; 00186 if (verbose) { 00187 cout << space_indent(depth()) << "ATTR " << "system" << ": "; 00188 if (! _system_isnull) cout << _system; 00189 cout << "|" << endl; 00190 } 00191 else if (! _system_isnull) cout << space_indent(depth()) << "ATTR " << "system" << endl; 00192 } 00193 void Coosys::reset() { 00194 lparent = NULL; 00195 lnext = NULL; 00196 lprev = NULL; 00197 _ID_isnull = true; 00198 _equinox_isnull = true; 00199 _epoch_isnull = true; 00200 _system_isnull = true; 00201 hk_reset(); 00202 } 00203 bool Coosys::setAttribute(string name, string value) { 00204 bool found = false; 00205 if (0) ; 00206 else if (strcmp(name.c_str(), "ID") == 0) { 00207 _ID = string(value); 00208 _ID_isnull = false; 00209 ; found = true; 00210 } 00211 else if (strcmp(name.c_str(), "equinox") == 0) { 00212 _equinox = string(value); 00213 _equinox_isnull = false; 00214 ; found = true; 00215 } 00216 else if (strcmp(name.c_str(), "epoch") == 0) { 00217 _epoch = string(value); 00218 _epoch_isnull = false; 00219 ; found = true; 00220 } 00221 else if (strcmp(name.c_str(), "system") == 0) { 00222 _system = Element::sto_Coosys_system(value); 00223 _system_isnull = false; 00224 ; found = true; 00225 } 00226 hk_setAttribute(name, value); 00227 return found; 00228 } 00229 bool Coosys::setChild(Element* child) { 00230 bool found = false; 00231 if (0) ; 00232 hk_setChild(child); 00233 return found; 00234 }; 00235 00236 00237 ; 00238 00239 Info::Info() { 00240 lnodetype = INFO; 00241 lclassname = "Info" ; 00242 constructor = true; 00243 reset(); 00244 constructor = false; 00245 } 00246 Info::~Info() { 00247 reset(); 00248 } 00249 string Info::sta_className() { 00250 return "Info" ; 00251 } 00252 string Info::sta_nodeName() { 00253 return "INFO" ; 00254 } 00255 enum Nodetype Info::sta_nodeType() { 00256 return INFO; 00257 } 00258 string Info::ID() { 00259 return _ID; 00260 } 00261 bool Info::ID_isNull() { 00262 return _ID_isnull; 00263 } 00264 string Info::name() { 00265 return _name; 00266 } 00267 bool Info::name_isNull() { 00268 return _name_isnull; 00269 } 00270 string Info::value() { 00271 return _value; 00272 } 00273 bool Info::value_isNull() { 00274 return _value_isnull; 00275 } 00276 void Info::print(bool verbose) { 00277 cout << space_indent(depth()) << "NODE " << sta_className() << " (" << ord() << ")" << endl; 00278 if (verbose) { 00279 cout << space_indent(depth()) << "ATTR " << "ID" << ": "; 00280 if (! _ID_isnull) cout << _ID; 00281 cout << "|" << endl; 00282 } 00283 else if (! _ID_isnull) cout << space_indent(depth()) << "ATTR " << "ID" << endl; 00284 if (verbose) { 00285 cout << space_indent(depth()) << "ATTR " << "name" << ": "; 00286 if (! _name_isnull) cout << _name; 00287 cout << "|" << endl; 00288 } 00289 else if (! _name_isnull) cout << space_indent(depth()) << "ATTR " << "name" << endl; 00290 if (verbose) { 00291 cout << space_indent(depth()) << "ATTR " << "value" << ": "; 00292 if (! _value_isnull) cout << _value; 00293 cout << "|" << endl; 00294 } 00295 else if (! _value_isnull) cout << space_indent(depth()) << "ATTR " << "value" << endl; 00296 } 00297 void Info::reset() { 00298 lparent = NULL; 00299 lnext = NULL; 00300 lprev = NULL; 00301 _ID_isnull = true; 00302 _name_isnull = true; 00303 _value_isnull = true; 00304 hk_reset(); 00305 } 00306 bool Info::setAttribute(string name, string value) { 00307 bool found = false; 00308 if (0) ; 00309 else if (strcmp(name.c_str(), "ID") == 0) { 00310 _ID = string(value); 00311 _ID_isnull = false; 00312 ; found = true; 00313 } 00314 else if (strcmp(name.c_str(), "name") == 0) { 00315 _name = string(value); 00316 _name_isnull = false; 00317 ; found = true; 00318 } 00319 else if (strcmp(name.c_str(), "value") == 0) { 00320 _value = string(value); 00321 _value_isnull = false; 00322 ; found = true; 00323 } 00324 hk_setAttribute(name, value); 00325 return found; 00326 } 00327 bool Info::setChild(Element* child) { 00328 bool found = false; 00329 if (0) ; 00330 hk_setChild(child); 00331 return found; 00332 }; 00333 00334 00335 ; 00336 00337 Link::Link() { 00338 lnodetype = LINK; 00339 lclassname = "Link" ; 00340 constructor = true; 00341 reset(); 00342 constructor = false; 00343 } 00344 Link::~Link() { 00345 reset(); 00346 } 00347 string Link::sta_className() { 00348 return "Link" ; 00349 } 00350 string Link::sta_nodeName() { 00351 return "LINK" ; 00352 } 00353 enum Nodetype Link::sta_nodeType() { 00354 return LINK; 00355 } 00356 string Link::ID() { 00357 return _ID; 00358 } 00359 bool Link::ID_isNull() { 00360 return _ID_isnull; 00361 } 00362 enum Link_content_role Link::content_role() { 00363 return _content_role; 00364 } 00365 bool Link::content_role_isNull() { 00366 return _content_role_isnull; 00367 } 00368 string Link::content_type() { 00369 return _content_type; 00370 } 00371 bool Link::content_type_isNull() { 00372 return _content_type_isnull; 00373 } 00374 string Link::title() { 00375 return _title; 00376 } 00377 bool Link::title_isNull() { 00378 return _title_isnull; 00379 } 00380 string Link::value() { 00381 return _value; 00382 } 00383 bool Link::value_isNull() { 00384 return _value_isnull; 00385 } 00386 string Link::href() { 00387 return _href; 00388 } 00389 bool Link::href_isNull() { 00390 return _href_isnull; 00391 } 00392 string Link::gref() { 00393 return _gref; 00394 } 00395 bool Link::gref_isNull() { 00396 return _gref_isnull; 00397 } 00398 string Link::action() { 00399 return _action; 00400 } 00401 bool Link::action_isNull() { 00402 return _action_isnull; 00403 } 00404 void Link::print(bool verbose) { 00405 cout << space_indent(depth()) << "NODE " << sta_className() << " (" << ord() << ")" << endl; 00406 if (verbose) { 00407 cout << space_indent(depth()) << "ATTR " << "ID" << ": "; 00408 if (! _ID_isnull) cout << _ID; 00409 cout << "|" << endl; 00410 } 00411 else if (! _ID_isnull) cout << space_indent(depth()) << "ATTR " << "ID" << endl; 00412 if (verbose) { 00413 cout << space_indent(depth()) << "ATTR " << "content_role" << ": "; 00414 if (! _content_role_isnull) cout << _content_role; 00415 cout << "|" << endl; 00416 } 00417 else if (! _content_role_isnull) cout << space_indent(depth()) << "ATTR " << "content_role" << endl; 00418 if (verbose) { 00419 cout << space_indent(depth()) << "ATTR " << "content_type" << ": "; 00420 if (! _content_type_isnull) cout << _content_type; 00421 cout << "|" << endl; 00422 } 00423 else if (! _content_type_isnull) cout << space_indent(depth()) << "ATTR " << "content_type" << endl; 00424 if (verbose) { 00425 cout << space_indent(depth()) << "ATTR " << "title" << ": "; 00426 if (! _title_isnull) cout << _title; 00427 cout << "|" << endl; 00428 } 00429 else if (! _title_isnull) cout << space_indent(depth()) << "ATTR " << "title" << endl; 00430 if (verbose) { 00431 cout << space_indent(depth()) << "ATTR " << "value" << ": "; 00432 if (! _value_isnull) cout << _value; 00433 cout << "|" << endl; 00434 } 00435 else if (! _value_isnull) cout << space_indent(depth()) << "ATTR " << "value" << endl; 00436 if (verbose) { 00437 cout << space_indent(depth()) << "ATTR " << "href" << ": "; 00438 if (! _href_isnull) cout << _href; 00439 cout << "|" << endl; 00440 } 00441 else if (! _href_isnull) cout << space_indent(depth()) << "ATTR " << "href" << endl; 00442 if (verbose) { 00443 cout << space_indent(depth()) << "ATTR " << "gref" << ": "; 00444 if (! _gref_isnull) cout << _gref; 00445 cout << "|" << endl; 00446 } 00447 else if (! _gref_isnull) cout << space_indent(depth()) << "ATTR " << "gref" << endl; 00448 if (verbose) { 00449 cout << space_indent(depth()) << "ATTR " << "action" << ": "; 00450 if (! _action_isnull) cout << _action; 00451 cout << "|" << endl; 00452 } 00453 else if (! _action_isnull) cout << space_indent(depth()) << "ATTR " << "action" << endl; 00454 } 00455 void Link::reset() { 00456 lparent = NULL; 00457 lnext = NULL; 00458 lprev = NULL; 00459 _ID_isnull = true; 00460 _content_role_isnull = true; 00461 _content_type_isnull = true; 00462 _title_isnull = true; 00463 _value_isnull = true; 00464 _href_isnull = true; 00465 _gref_isnull = true; 00466 _action_isnull = true; 00467 hk_reset(); 00468 } 00469 bool Link::setAttribute(string name, string value) { 00470 bool found = false; 00471 if (0) ; 00472 else if (strcmp(name.c_str(), "ID") == 0) { 00473 _ID = string(value); 00474 _ID_isnull = false; 00475 ; found = true; 00476 } 00477 else if (strcmp(name.c_str(), "content-role") == 0) { 00478 _content_role = Element::sto_Link_content_role(value); 00479 _content_role_isnull = false; 00480 ; found = true; 00481 } 00482 else if (strcmp(name.c_str(), "content-type") == 0) { 00483 _content_type = string(value); 00484 _content_type_isnull = false; 00485 ; found = true; 00486 } 00487 else if (strcmp(name.c_str(), "title") == 0) { 00488 _title = string(value); 00489 _title_isnull = false; 00490 ; found = true; 00491 } 00492 else if (strcmp(name.c_str(), "value") == 0) { 00493 _value = string(value); 00494 _value_isnull = false; 00495 ; found = true; 00496 } 00497 else if (strcmp(name.c_str(), "href") == 0) { 00498 _href = string(value); 00499 _href_isnull = false; 00500 ; found = true; 00501 } 00502 else if (strcmp(name.c_str(), "gref") == 0) { 00503 _gref = string(value); 00504 _gref_isnull = false; 00505 ; found = true; 00506 } 00507 else if (strcmp(name.c_str(), "action") == 0) { 00508 _action = string(value); 00509 _action_isnull = false; 00510 ; found = true; 00511 } 00512 hk_setAttribute(name, value); 00513 return found; 00514 } 00515 bool Link::setChild(Element* child) { 00516 bool found = false; 00517 if (0) ; 00518 hk_setChild(child); 00519 return found; 00520 }; 00521 00522 00523 ; 00524 00525 FieldRef::FieldRef() { 00526 lnodetype = FIELDref; 00527 lclassname = "FieldRef" ; 00528 constructor = true; 00529 reset(); 00530 constructor = false; 00531 } 00532 FieldRef::~FieldRef() { 00533 reset(); 00534 } 00535 string FieldRef::sta_className() { 00536 return "FieldRef" ; 00537 } 00538 string FieldRef::sta_nodeName() { 00539 return "FIELDref" ; 00540 } 00541 enum Nodetype FieldRef::sta_nodeType() { 00542 return FIELDref; 00543 } 00544 string FieldRef::ref() { 00545 return _ref; 00546 } 00547 bool FieldRef::ref_isNull() { 00548 return _ref_isnull; 00549 } 00550 void FieldRef::print(bool verbose) { 00551 cout << space_indent(depth()) << "NODE " << sta_className() << " (" << ord() << ")" << endl; 00552 if (verbose) { 00553 cout << space_indent(depth()) << "ATTR " << "ref" << ": "; 00554 if (! _ref_isnull) cout << _ref; 00555 cout << "|" << endl; 00556 } 00557 else if (! _ref_isnull) cout << space_indent(depth()) << "ATTR " << "ref" << endl; 00558 } 00559 void FieldRef::reset() { 00560 lparent = NULL; 00561 lnext = NULL; 00562 lprev = NULL; 00563 _ref_isnull = true; 00564 hk_reset(); 00565 } 00566 bool FieldRef::setAttribute(string name, string value) { 00567 bool found = false; 00568 if (0) ; 00569 else if (strcmp(name.c_str(), "ref") == 0) { 00570 _ref = string(value); 00571 _ref_isnull = false; 00572 ; found = true; 00573 } 00574 hk_setAttribute(name, value); 00575 return found; 00576 } 00577 bool FieldRef::setChild(Element* child) { 00578 bool found = false; 00579 if (0) ; 00580 hk_setChild(child); 00581 return found; 00582 }; 00583 00584 00585 ; 00586 00587 ParamRef::ParamRef() { 00588 lnodetype = PARAMref; 00589 lclassname = "ParamRef" ; 00590 constructor = true; 00591 reset(); 00592 constructor = false; 00593 } 00594 ParamRef::~ParamRef() { 00595 reset(); 00596 } 00597 string ParamRef::sta_className() { 00598 return "ParamRef" ; 00599 } 00600 string ParamRef::sta_nodeName() { 00601 return "PARAMref" ; 00602 } 00603 enum Nodetype ParamRef::sta_nodeType() { 00604 return PARAMref; 00605 } 00606 string ParamRef::ref() { 00607 return _ref; 00608 } 00609 bool ParamRef::ref_isNull() { 00610 return _ref_isnull; 00611 } 00612 void ParamRef::print(bool verbose) { 00613 cout << space_indent(depth()) << "NODE " << sta_className() << " (" << ord() << ")" << endl; 00614 if (verbose) { 00615 cout << space_indent(depth()) << "ATTR " << "ref" << ": "; 00616 if (! _ref_isnull) cout << _ref; 00617 cout << "|" << endl; 00618 } 00619 else if (! _ref_isnull) cout << space_indent(depth()) << "ATTR " << "ref" << endl; 00620 } 00621 void ParamRef::reset() { 00622 lparent = NULL; 00623 lnext = NULL; 00624 lprev = NULL; 00625 _ref_isnull = true; 00626 hk_reset(); 00627 } 00628 bool ParamRef::setAttribute(string name, string value) { 00629 bool found = false; 00630 if (0) ; 00631 else if (strcmp(name.c_str(), "ref") == 0) { 00632 _ref = string(value); 00633 _ref_isnull = false; 00634 ; found = true; 00635 } 00636 hk_setAttribute(name, value); 00637 return found; 00638 } 00639 bool ParamRef::setChild(Element* child) { 00640 bool found = false; 00641 if (0) ; 00642 hk_setChild(child); 00643 return found; 00644 }; 00645 00646 00647 ; 00648 00649 Stream::Stream() { 00650 lnodetype = STREAM; 00651 lclassname = "Stream" ; 00652 constructor = true; 00653 reset(); 00654 constructor = false; 00655 } 00656 Stream::~Stream() { 00657 reset(); 00658 } 00659 string Stream::sta_className() { 00660 return "Stream" ; 00661 } 00662 string Stream::sta_nodeName() { 00663 return "STREAM" ; 00664 } 00665 enum Nodetype Stream::sta_nodeType() { 00666 return STREAM; 00667 } 00668 enum Stream_type Stream::type() { 00669 return _type; 00670 } 00671 bool Stream::type_isNull() { 00672 return _type_isnull; 00673 } 00674 string Stream::href() { 00675 return _href; 00676 } 00677 bool Stream::href_isNull() { 00678 return _href_isnull; 00679 } 00680 enum Stream_actuate Stream::actuate() { 00681 return _actuate; 00682 } 00683 bool Stream::actuate_isNull() { 00684 return _actuate_isnull; 00685 } 00686 enum EncodingType Stream::encoding() { 00687 return _encoding; 00688 } 00689 bool Stream::encoding_isNull() { 00690 return _encoding_isnull; 00691 } 00692 string Stream::expires() { 00693 return _expires; 00694 } 00695 bool Stream::expires_isNull() { 00696 return _expires_isnull; 00697 } 00698 string Stream::rights() { 00699 return _rights; 00700 } 00701 bool Stream::rights_isNull() { 00702 return _rights_isnull; 00703 } 00704 void Stream::print(bool verbose) { 00705 cout << space_indent(depth()) << "NODE " << sta_className() << " (" << ord() << ")" << endl; 00706 if (verbose) { 00707 cout << space_indent(depth()) << "ATTR " << "type" << ": "; 00708 if (! _type_isnull) cout << _type; 00709 cout << "|" << endl; 00710 } 00711 else if (! _type_isnull) cout << space_indent(depth()) << "ATTR " << "type" << endl; 00712 if (verbose) { 00713 cout << space_indent(depth()) << "ATTR " << "href" << ": "; 00714 if (! _href_isnull) cout << _href; 00715 cout << "|" << endl; 00716 } 00717 else if (! _href_isnull) cout << space_indent(depth()) << "ATTR " << "href" << endl; 00718 if (verbose) { 00719 cout << space_indent(depth()) << "ATTR " << "actuate" << ": "; 00720 if (! _actuate_isnull) cout << _actuate; 00721 cout << "|" << endl; 00722 } 00723 else if (! _actuate_isnull) cout << space_indent(depth()) << "ATTR " << "actuate" << endl; 00724 if (verbose) { 00725 cout << space_indent(depth()) << "ATTR " << "encoding" << ": "; 00726 if (! _encoding_isnull) cout << _encoding; 00727 cout << "|" << endl; 00728 } 00729 else if (! _encoding_isnull) cout << space_indent(depth()) << "ATTR " << "encoding" << endl; 00730 if (verbose) { 00731 cout << space_indent(depth()) << "ATTR " << "expires" << ": "; 00732 if (! _expires_isnull) cout << _expires; 00733 cout << "|" << endl; 00734 } 00735 else if (! _expires_isnull) cout << space_indent(depth()) << "ATTR " << "expires" << endl; 00736 if (verbose) { 00737 cout << space_indent(depth()) << "ATTR " << "rights" << ": "; 00738 if (! _rights_isnull) cout << _rights; 00739 cout << "|" << endl; 00740 } 00741 else if (! _rights_isnull) cout << space_indent(depth()) << "ATTR " << "rights" << endl; 00742 } 00743 void Stream::reset() { 00744 lparent = NULL; 00745 lnext = NULL; 00746 lprev = NULL; 00747 _type_isnull = true; 00748 _href_isnull = true; 00749 _actuate_isnull = true; 00750 _encoding_isnull = true; 00751 _expires_isnull = true; 00752 _rights_isnull = true; 00753 hk_reset(); 00754 } 00755 bool Stream::setAttribute(string name, string value) { 00756 bool found = false; 00757 if (0) ; 00758 else if (strcmp(name.c_str(), "type") == 0) { 00759 _type = Element::sto_Stream_type(value); 00760 _type_isnull = false; 00761 ; found = true; 00762 } 00763 else if (strcmp(name.c_str(), "href") == 0) { 00764 _href = string(value); 00765 _href_isnull = false; 00766 ; found = true; 00767 } 00768 else if (strcmp(name.c_str(), "actuate") == 0) { 00769 _actuate = Element::sto_Stream_actuate(value); 00770 _actuate_isnull = false; 00771 ; found = true; 00772 } 00773 else if (strcmp(name.c_str(), "encoding") == 0) { 00774 _encoding = Element::sto_EncodingType(value); 00775 _encoding_isnull = false; 00776 ; found = true; 00777 } 00778 else if (strcmp(name.c_str(), "expires") == 0) { 00779 _expires = string(value); 00780 _expires_isnull = false; 00781 ; found = true; 00782 } 00783 else if (strcmp(name.c_str(), "rights") == 0) { 00784 _rights = string(value); 00785 _rights_isnull = false; 00786 ; found = true; 00787 } 00788 hk_setAttribute(name, value); 00789 return found; 00790 } 00791 bool Stream::setChild(Element* child) { 00792 bool found = false; 00793 if (0) ; 00794 hk_setChild(child); 00795 return found; 00796 }; 00797 00798 00799 ; 00800 00801 Column::Column() { 00802 lnodetype = TD; 00803 lclassname = "Column" ; 00804 constructor = true; 00805 reset(); 00806 constructor = false; 00807 } 00808 Column::~Column() { 00809 reset(); 00810 } 00811 string Column::sta_className() { 00812 return "Column" ; 00813 } 00814 string Column::sta_nodeName() { 00815 return "TD" ; 00816 } 00817 enum Nodetype Column::sta_nodeType() { 00818 return TD; 00819 } 00820 enum EncodingType Column::encoding() { 00821 return _encoding; 00822 } 00823 bool Column::encoding_isNull() { 00824 return _encoding_isnull; 00825 } 00826 string Column::value() { 00827 return _value; 00828 } 00829 bool Column::value_isNull() { 00830 return _value_isnull; 00831 } 00832 void Column::print(bool verbose) { 00833 cout << space_indent(depth()) << "NODE " << sta_className() << " (" << ord() << ")" << endl; 00834 if (verbose) { 00835 cout << space_indent(depth()) << "ATTR " << "encoding" << ": "; 00836 if (! _encoding_isnull) cout << _encoding; 00837 cout << "|" << endl; 00838 } 00839 else if (! _encoding_isnull) cout << space_indent(depth()) << "ATTR " << "encoding" << endl; 00840 if (verbose) { 00841 cout << space_indent(depth()) << "ATTR " << "value" << ": "; 00842 if (! _value_isnull) cout << _value; 00843 cout << "|" << endl; 00844 } 00845 else if (! _value_isnull) cout << space_indent(depth()) << "ATTR " << "value" << endl; 00846 } 00847 void Column::reset() { 00848 lparent = NULL; 00849 lnext = NULL; 00850 lprev = NULL; 00851 _encoding_isnull = true; 00852 _value_isnull = true; 00853 hk_reset(); 00854 } 00855 bool Column::setAttribute(string name, string value) { 00856 bool found = false; 00857 if (0) ; 00858 else if (strcmp(name.c_str(), "encoding") == 0) { 00859 _encoding = Element::sto_EncodingType(value); 00860 _encoding_isnull = false; 00861 ; found = true; 00862 } 00863 else if (strcmp(name.c_str(), "value") == 0) { 00864 _value = string(value); 00865 _value_isnull = false; 00866 ; found = true; 00867 } 00868 hk_setAttribute(name, value); 00869 return found; 00870 } 00871 bool Column::setChild(Element* child) { 00872 bool found = false; 00873 if (0) ; 00874 hk_setChild(child); 00875 return found; 00876 }; 00877 00878 00879 00880 // void done(); 00881 // Record data; 00882 ; 00883 00884 00885 Min::Min() { 00886 lnodetype = MIN; 00887 lclassname = "Min" ; 00888 constructor = true; 00889 reset(); 00890 constructor = false; 00891 } 00892 Min::~Min() { 00893 reset(); 00894 } 00895 string Min::sta_className() { 00896 return "Min" ; 00897 } 00898 string Min::sta_nodeName() { 00899 return "MIN" ; 00900 } 00901 enum Nodetype Min::sta_nodeType() { 00902 return MIN; 00903 } 00904 string Min::value() { 00905 return _value; 00906 } 00907 bool Min::value_isNull() { 00908 return _value_isnull; 00909 } 00910 bool Min::inclusive() { 00911 return _inclusive; 00912 } 00913 bool Min::inclusive_isNull() { 00914 return _inclusive_isnull; 00915 } 00916 void Min::print(bool verbose) { 00917 cout << space_indent(depth()) << "NODE " << sta_className() << " (" << ord() << ")" << endl; 00918 if (verbose) { 00919 cout << space_indent(depth()) << "ATTR " << "value" << ": "; 00920 if (! _value_isnull) cout << _value; 00921 cout << "|" << endl; 00922 } 00923 else if (! _value_isnull) cout << space_indent(depth()) << "ATTR " << "value" << endl; 00924 if (verbose) { 00925 cout << space_indent(depth()) << "ATTR " << "inclusive" << ": "; 00926 if (! _inclusive_isnull) cout << _inclusive; 00927 cout << "|" << endl; 00928 } 00929 else if (! _inclusive_isnull) cout << space_indent(depth()) << "ATTR " << "inclusive" << endl; 00930 } 00931 void Min::reset() { 00932 lparent = NULL; 00933 lnext = NULL; 00934 lprev = NULL; 00935 _value_isnull = true; 00936 _inclusive_isnull = true; 00937 hk_reset(); 00938 } 00939 bool Min::setAttribute(string name, string value) { 00940 bool found = false; 00941 if (0) ; 00942 else if (strcmp(name.c_str(), "value") == 0) { 00943 _value = string(value); 00944 _value_isnull = false; 00945 ; found = true; 00946 } 00947 else if (strcmp(name.c_str(), "inclusive") == 0) { 00948 _inclusive = Element::sto_bool(value); 00949 _inclusive_isnull = false; 00950 ; found = true; 00951 } 00952 hk_setAttribute(name, value); 00953 return found; 00954 } 00955 bool Min::setChild(Element* child) { 00956 bool found = false; 00957 if (0) ; 00958 hk_setChild(child); 00959 return found; 00960 }; 00961 00962 00963 ; 00964 00965 Max::Max() { 00966 lnodetype = MAX; 00967 lclassname = "Max" ; 00968 constructor = true; 00969 reset(); 00970 constructor = false; 00971 } 00972 Max::~Max() { 00973 reset(); 00974 } 00975 string Max::sta_className() { 00976 return "Max" ; 00977 } 00978 string Max::sta_nodeName() { 00979 return "MAX" ; 00980 } 00981 enum Nodetype Max::sta_nodeType() { 00982 return MAX; 00983 } 00984 string Max::value() { 00985 return _value; 00986 } 00987 bool Max::value_isNull() { 00988 return _value_isnull; 00989 } 00990 bool Max::inclusive() { 00991 return _inclusive; 00992 } 00993 bool Max::inclusive_isNull() { 00994 return _inclusive_isnull; 00995 } 00996 void Max::print(bool verbose) { 00997 cout << space_indent(depth()) << "NODE " << sta_className() << " (" << ord() << ")" << endl; 00998 if (verbose) { 00999 cout << space_indent(depth()) << "ATTR " << "value" << ": "; 01000 if (! _value_isnull) cout << _value; 01001 cout << "|" << endl; 01002 } 01003 else if (! _value_isnull) cout << space_indent(depth()) << "ATTR " << "value" << endl; 01004 if (verbose) { 01005 cout << space_indent(depth()) << "ATTR " << "inclusive" << ": "; 01006 if (! _inclusive_isnull) cout << _inclusive; 01007 cout << "|" << endl; 01008 } 01009 else if (! _inclusive_isnull) cout << space_indent(depth()) << "ATTR " << "inclusive" << endl; 01010 } 01011 void Max::reset() { 01012 lparent = NULL; 01013 lnext = NULL; 01014 lprev = NULL; 01015 _value_isnull = true; 01016 _inclusive_isnull = true; 01017 hk_reset(); 01018 } 01019 bool Max::setAttribute(string name, string value) { 01020 bool found = false; 01021 if (0) ; 01022 else if (strcmp(name.c_str(), "value") == 0) { 01023 _value = string(value); 01024 _value_isnull = false; 01025 ; found = true; 01026 } 01027 else if (strcmp(name.c_str(), "inclusive") == 0) { 01028 _inclusive = Element::sto_bool(value); 01029 _inclusive_isnull = false; 01030 ; found = true; 01031 } 01032 hk_setAttribute(name, value); 01033 return found; 01034 } 01035 bool Max::setChild(Element* child) { 01036 bool found = false; 01037 if (0) ; 01038 hk_setChild(child); 01039 return found; 01040 }; 01041 01042 01043 ; 01044 01045 Option::Option() { 01046 lnodetype = OPTION; 01047 lclassname = "Option" ; 01048 constructor = true; 01049 reset(); 01050 constructor = false; 01051 } 01052 Option::~Option() { 01053 reset(); 01054 } 01055 string Option::sta_className() { 01056 return "Option" ; 01057 } 01058 string Option::sta_nodeName() { 01059 return "OPTION" ; 01060 } 01061 enum Nodetype Option::sta_nodeType() { 01062 return OPTION; 01063 } 01064 string Option::name() { 01065 return _name; 01066 } 01067 bool Option::name_isNull() { 01068 return _name_isnull; 01069 } 01070 string Option::value() { 01071 return _value; 01072 } 01073 bool Option::value_isNull() { 01074 return _value_isnull; 01075 } 01076 Option * Option::option(unsigned int i ) { 01077 if (i >= _ch_Option_count) throw MCS_ERROR( MSG_VOT_INVALID_INDEX, "", i); 01078 else return (_ch_Option [i]); 01079 } 01080 unsigned int Option::option_count() { 01081 return _ch_Option_count; 01082 } 01083 void Option::print(bool verbose) { 01084 cout << space_indent(depth()) << "NODE " << sta_className() << " (" << ord() << ")" << endl; 01085 if (verbose) { 01086 cout << space_indent(depth()) << "ATTR " << "name" << ": "; 01087 if (! _name_isnull) cout << _name; 01088 cout << "|" << endl; 01089 } 01090 else if (! _name_isnull) cout << space_indent(depth()) << "ATTR " << "name" << endl; 01091 if (verbose) { 01092 cout << space_indent(depth()) << "ATTR " << "value" << ": "; 01093 if (! _value_isnull) cout << _value; 01094 cout << "|" << endl; 01095 } 01096 else if (! _value_isnull) cout << space_indent(depth()) << "ATTR " << "value" << endl; 01097 if ((verbose) || (_ch_Option_count)) { 01098 cout << space_indent(depth()) << "CHILD " << "Option" << " elements: " << _ch_Option_count << endl; 01099 for (unsigned int i=0; 01100 i < _ch_Option_count; 01101 i++) _ch_Option[i]->print(verbose); 01102 } 01103 } void Option::reset() { 01104 lparent = NULL; 01105 lnext = NULL; 01106 lprev = NULL; 01107 _name_isnull = true; 01108 _value_isnull = true; 01109 if (constructor) _ch_Option = NULL; 01110 else if (_ch_Option_count) { 01111 for (unsigned int i=0; 01112 i < _ch_Option_count; 01113 i++) delete (_ch_Option [i]); 01114 free(_ch_Option); 01115 _ch_Option = NULL; 01116 } 01117 _ch_Option_count = 0; 01118 hk_reset(); 01119 } 01120 bool Option::setAttribute(string name, string value) { 01121 bool found = false; 01122 if (0) ; 01123 else if (strcmp(name.c_str(), "name") == 0) { 01124 _name = string(value); 01125 _name_isnull = false; 01126 ; found = true; 01127 } 01128 else if (strcmp(name.c_str(), "value") == 0) { 01129 _value = string(value); 01130 _value_isnull = false; 01131 ; found = true; 01132 } 01133 hk_setAttribute(name, value); 01134 return found; 01135 } 01136 bool Option::setChild(Element* child) { 01137 bool found = false; 01138 if (0) ; 01139 else if (child->nodeType() == Option::sta_nodeType()) { 01140 int dim = sizeof( Option *) * (_ch_Option_count + 1); 01141 if (_ch_Option_count == 0) _ch_Option = ( Option **) malloc(dim); 01142 else _ch_Option = ( Option **) realloc(_ch_Option, dim); 01143 _ch_Option [_ch_Option_count] = ( Option *) child; 01144 _ch_Option_count++; 01145 setParentInChild(child); 01146 found = true; 01147 } 01148 hk_setChild(child); 01149 return found; 01150 }; 01151 01152 01153 ; 01154 01155 01156 Row::Row() { 01157 lnodetype = TR; 01158 lclassname = "Row" ; 01159 constructor = true; 01160 reset(); 01161 constructor = false; 01162 } 01163 Row::~Row() { 01164 reset(); 01165 } 01166 string Row::sta_className() { 01167 return "Row" ; 01168 } 01169 string Row::sta_nodeName() { 01170 return "TR" ; 01171 } 01172 enum Nodetype Row::sta_nodeType() { 01173 return TR; 01174 } 01175 Column * Row::column(unsigned int i ) { 01176 if (i >= _ch_Column_count) throw MCS_ERROR( MSG_VOT_INVALID_INDEX, "", i); 01177 else return (_ch_Column [i]); 01178 } 01179 unsigned int Row::column_count() { 01180 return _ch_Column_count; 01181 } 01182 void Row::print(bool verbose) { 01183 cout << space_indent(depth()) << "NODE " << sta_className() << " (" << ord() << ")" << endl; 01184 if ((verbose) || (_ch_Column_count)) { 01185 cout << space_indent(depth()) << "CHILD " << "Column" << " elements: " << _ch_Column_count << endl; 01186 for (unsigned int i=0; 01187 i < _ch_Column_count; 01188 i++) _ch_Column[i]->print(verbose); 01189 } 01190 } void Row::reset() { 01191 lparent = NULL; 01192 lnext = NULL; 01193 lprev = NULL; 01194 if (constructor) _ch_Column = NULL; 01195 else if (_ch_Column_count) { 01196 for (unsigned int i=0; 01197 i < _ch_Column_count; 01198 i++) delete (_ch_Column [i]); 01199 free(_ch_Column); 01200 _ch_Column = NULL; 01201 } 01202 _ch_Column_count = 0; 01203 hk_reset(); 01204 } 01205 bool Row::setAttribute(string name, string value) { 01206 bool found = false; 01207 if (0) ; 01208 hk_setAttribute(name, value); 01209 return found; 01210 } 01211 bool Row::setChild(Element* child) { 01212 bool found = false; 01213 if (0) ; 01214 else if (child->nodeType() == Column::sta_nodeType()) { 01215 int dim = sizeof( Column *) * (_ch_Column_count + 1); 01216 if (_ch_Column_count == 0) _ch_Column = ( Column **) malloc(dim); 01217 else _ch_Column = ( Column **) realloc(_ch_Column, dim); 01218 _ch_Column [_ch_Column_count] = ( Column *) child; 01219 _ch_Column_count++; 01220 setParentInChild(child); 01221 found = true; 01222 } 01223 hk_setChild(child); 01224 return found; 01225 }; 01226 01227 01228 ; 01229 01230 01231 Tabledata::Tabledata() { 01232 lnodetype = TABLEDATA; 01233 lclassname = "Tabledata" ; 01234 constructor = true; 01235 reset(); 01236 constructor = false; 01237 } 01238 Tabledata::~Tabledata() { 01239 reset(); 01240 } 01241 string Tabledata::sta_className() { 01242 return "Tabledata" ; 01243 } 01244 string Tabledata::sta_nodeName() { 01245 return "TABLEDATA" ; 01246 } 01247 enum Nodetype Tabledata::sta_nodeType() { 01248 return TABLEDATA; 01249 } 01250 Row * Tabledata::row(unsigned int i ) { 01251 if (i >= _ch_Row_count) throw MCS_ERROR( MSG_VOT_INVALID_INDEX, "", i); 01252 else return (_ch_Row [i]); 01253 } 01254 unsigned int Tabledata::row_count() { 01255 return _ch_Row_count; 01256 } 01257 void Tabledata::print(bool verbose) { 01258 cout << space_indent(depth()) << "NODE " << sta_className() << " (" << ord() << ")" << endl; 01259 if ((verbose) || (_ch_Row_count)) { 01260 cout << space_indent(depth()) << "CHILD " << "Row" << " elements: " << _ch_Row_count << endl; 01261 for (unsigned int i=0; 01262 i < _ch_Row_count; 01263 i++) _ch_Row[i]->print(verbose); 01264 } 01265 } void Tabledata::reset() { 01266 lparent = NULL; 01267 lnext = NULL; 01268 lprev = NULL; 01269 if (constructor) _ch_Row = NULL; 01270 else if (_ch_Row_count) { 01271 for (unsigned int i=0; 01272 i < _ch_Row_count; 01273 i++) delete (_ch_Row [i]); 01274 free(_ch_Row); 01275 _ch_Row = NULL; 01276 } 01277 _ch_Row_count = 0; 01278 hk_reset(); 01279 } 01280 bool Tabledata::setAttribute(string name, string value) { 01281 bool found = false; 01282 if (0) ; 01283 hk_setAttribute(name, value); 01284 return found; 01285 } 01286 bool Tabledata::setChild(Element* child) { 01287 bool found = false; 01288 if (0) ; 01289 else if (child->nodeType() == Row::sta_nodeType()) { 01290 int dim = sizeof( Row *) * (_ch_Row_count + 1); 01291 if (_ch_Row_count == 0) _ch_Row = ( Row **) malloc(dim); 01292 else _ch_Row = ( Row **) realloc(_ch_Row, dim); 01293 _ch_Row [_ch_Row_count] = ( Row *) child; 01294 _ch_Row_count++; 01295 setParentInChild(child); 01296 found = true; 01297 } 01298 hk_setChild(child); 01299 return found; 01300 }; 01301 01302 01303 ; 01304 01305 01306 Fits::Fits() { 01307 lnodetype = FITS; 01308 lclassname = "Fits" ; 01309 constructor = true; 01310 reset(); 01311 constructor = false; 01312 } 01313 Fits::~Fits() { 01314 reset(); 01315 } 01316 string Fits::sta_className() { 01317 return "Fits" ; 01318 } 01319 string Fits::sta_nodeName() { 01320 return "FITS" ; 01321 } 01322 enum Nodetype Fits::sta_nodeType() { 01323 return FITS; 01324 } 01325 int Fits::extnum() { 01326 return _extnum; 01327 } 01328 bool Fits::extnum_isNull() { 01329 return _extnum_isnull; 01330 } 01331 Stream * Fits::stream() { 01332 return _ch_Stream; 01333 } 01334 void Fits::print(bool verbose) { 01335 cout << space_indent(depth()) << "NODE " << sta_className() << " (" << ord() << ")" << endl; 01336 if (verbose) { 01337 cout << space_indent(depth()) << "ATTR " << "extnum" << ": "; 01338 if (! _extnum_isnull) cout << _extnum; 01339 cout << "|" << endl; 01340 } 01341 else if (! _extnum_isnull) cout << space_indent(depth()) << "ATTR " << "extnum" << endl; 01342 if ((verbose) || (_ch_Stream)) { 01343 cout << space_indent(depth()) << "CHILD " << "Stream"; 01344 if (! _ch_Stream) cout << "0" << endl; 01345 else { 01346 cout << endl; 01347 _ch_Stream->print(verbose); 01348 } 01349 } } 01350 void Fits::reset() { 01351 lparent = NULL; 01352 lnext = NULL; 01353 lprev = NULL; 01354 _extnum_isnull = true; 01355 if (constructor) _ch_Stream = NULL; 01356 else if (_ch_Stream) { 01357 delete _ch_Stream; 01358 _ch_Stream = NULL; 01359 } 01360 hk_reset(); 01361 } 01362 bool Fits::setAttribute(string name, string value) { 01363 bool found = false; 01364 if (0) ; 01365 else if (strcmp(name.c_str(), "extnum") == 0) { 01366 _extnum = mcs::stoi(value); 01367 _extnum_isnull = false; 01368 ; found = true; 01369 } 01370 hk_setAttribute(name, value); 01371 return found; 01372 } 01373 bool Fits::setChild(Element* child) { 01374 bool found = false; 01375 if (0) ; 01376 else if (child->nodeType() == Stream::sta_nodeType()) { 01377 if (_ch_Stream) delete _ch_Stream; 01378 _ch_Stream = ( Stream *) child; 01379 setParentInChild(child); 01380 found = true; 01381 } 01382 hk_setChild(child); 01383 return found; 01384 }; 01385 01386 01387 ; 01388 01389 01390 Binary::Binary() { 01391 lnodetype = BINARY; 01392 lclassname = "Binary" ; 01393 constructor = true; 01394 reset(); 01395 constructor = false; 01396 } 01397 Binary::~Binary() { 01398 reset(); 01399 } 01400 string Binary::sta_className() { 01401 return "Binary" ; 01402 } 01403 string Binary::sta_nodeName() { 01404 return "BINARY" ; 01405 } 01406 enum Nodetype Binary::sta_nodeType() { 01407 return BINARY; 01408 } 01409 Stream * Binary::stream() { 01410 return _ch_Stream; 01411 } 01412 void Binary::print(bool verbose) { 01413 cout << space_indent(depth()) << "NODE " << sta_className() << " (" << ord() << ")" << endl; 01414 if ((verbose) || (_ch_Stream)) { 01415 cout << space_indent(depth()) << "CHILD " << "Stream"; 01416 if (! _ch_Stream) cout << "0" << endl; 01417 else { 01418 cout << endl; 01419 _ch_Stream->print(verbose); 01420 } 01421 } } 01422 void Binary::reset() { 01423 lparent = NULL; 01424 lnext = NULL; 01425 lprev = NULL; 01426 if (constructor) _ch_Stream = NULL; 01427 else if (_ch_Stream) { 01428 delete _ch_Stream; 01429 _ch_Stream = NULL; 01430 } 01431 hk_reset(); 01432 } 01433 bool Binary::setAttribute(string name, string value) { 01434 bool found = false; 01435 if (0) ; 01436 hk_setAttribute(name, value); 01437 return found; 01438 } 01439 bool Binary::setChild(Element* child) { 01440 bool found = false; 01441 if (0) ; 01442 else if (child->nodeType() == Stream::sta_nodeType()) { 01443 if (_ch_Stream) delete _ch_Stream; 01444 _ch_Stream = ( Stream *) child; 01445 setParentInChild(child); 01446 found = true; 01447 } 01448 hk_setChild(child); 01449 return found; 01450 }; 01451 01452 01453 ; 01454 01455 01456 Values::Values() { 01457 lnodetype = VALUES; 01458 lclassname = "Values" ; 01459 constructor = true; 01460 reset(); 01461 constructor = false; 01462 } 01463 Values::~Values() { 01464 reset(); 01465 } 01466 string Values::sta_className() { 01467 return "Values" ; 01468 } 01469 string Values::sta_nodeName() { 01470 return "VALUES" ; 01471 } 01472 enum Nodetype Values::sta_nodeType() { 01473 return VALUES; 01474 } 01475 string Values::ID() { 01476 return _ID; 01477 } 01478 bool Values::ID_isNull() { 01479 return _ID_isnull; 01480 } 01481 enum Values_Type Values::type() { 01482 return _type; 01483 } 01484 bool Values::type_isNull() { 01485 return _type_isnull; 01486 } 01487 string Values::null() { 01488 return _null; 01489 } 01490 bool Values::null_isNull() { 01491 return _null_isnull; 01492 } 01493 string Values::ref() { 01494 return _ref; 01495 } 01496 bool Values::ref_isNull() { 01497 return _ref_isnull; 01498 } 01499 Min * Values::min() { 01500 return _ch_Min; 01501 } 01502 Max * Values::max() { 01503 return _ch_Max; 01504 } 01505 Option * Values::option(unsigned int i ) { 01506 if (i >= _ch_Option_count) throw MCS_ERROR( MSG_VOT_INVALID_INDEX, "", i); 01507 else return (_ch_Option [i]); 01508 } 01509 unsigned int Values::option_count() { 01510 return _ch_Option_count; 01511 } 01512 void Values::print(bool verbose) { 01513 cout << space_indent(depth()) << "NODE " << sta_className() << " (" << ord() << ")" << endl; 01514 if (verbose) { 01515 cout << space_indent(depth()) << "ATTR " << "ID" << ": "; 01516 if (! _ID_isnull) cout << _ID; 01517 cout << "|" << endl; 01518 } 01519 else if (! _ID_isnull) cout << space_indent(depth()) << "ATTR " << "ID" << endl; 01520 if (verbose) { 01521 cout << space_indent(depth()) << "ATTR " << "type" << ": "; 01522 if (! _type_isnull) cout << _type; 01523 cout << "|" << endl; 01524 } 01525 else if (! _type_isnull) cout << space_indent(depth()) << "ATTR " << "type" << endl; 01526 if (verbose) { 01527 cout << space_indent(depth()) << "ATTR " << "null" << ": "; 01528 if (! _null_isnull) cout << _null; 01529 cout << "|" << endl; 01530 } 01531 else if (! _null_isnull) cout << space_indent(depth()) << "ATTR " << "null" << endl; 01532 if (verbose) { 01533 cout << space_indent(depth()) << "ATTR " << "ref" << ": "; 01534 if (! _ref_isnull) cout << _ref; 01535 cout << "|" << endl; 01536 } 01537 else if (! _ref_isnull) cout << space_indent(depth()) << "ATTR " << "ref" << endl; 01538 if ((verbose) || (_ch_Min)) { 01539 cout << space_indent(depth()) << "CHILD " << "Min"; 01540 if (! _ch_Min) cout << "0" << endl; 01541 else { 01542 cout << endl; 01543 _ch_Min->print(verbose); 01544 } 01545 } if ((verbose) || (_ch_Max)) { 01546 cout << space_indent(depth()) << "CHILD " << "Max"; 01547 if (! _ch_Max) cout << "0" << endl; 01548 else { 01549 cout << endl; 01550 _ch_Max->print(verbose); 01551 } 01552 } if ((verbose) || (_ch_Option_count)) { 01553 cout << space_indent(depth()) << "CHILD " << "Option" << " elements: " << _ch_Option_count << endl; 01554 for (unsigned int i=0; 01555 i < _ch_Option_count; 01556 i++) _ch_Option[i]->print(verbose); 01557 } 01558 } void Values::reset() { 01559 lparent = NULL; 01560 lnext = NULL; 01561 lprev = NULL; 01562 _ID_isnull = true; 01563 _type_isnull = true; 01564 _null_isnull = true; 01565 _ref_isnull = true; 01566 if (constructor) _ch_Min = NULL; 01567 else if (_ch_Min) { 01568 delete _ch_Min; 01569 _ch_Min = NULL; 01570 } 01571 if (constructor) _ch_Max = NULL; 01572 else if (_ch_Max) { 01573 delete _ch_Max; 01574 _ch_Max = NULL; 01575 } 01576 if (constructor) _ch_Option = NULL; 01577 else if (_ch_Option_count) { 01578 for (unsigned int i=0; 01579 i < _ch_Option_count; 01580 i++) delete (_ch_Option [i]); 01581 free(_ch_Option); 01582 _ch_Option = NULL; 01583 } 01584 _ch_Option_count = 0; 01585 hk_reset(); 01586 } 01587 bool Values::setAttribute(string name, string value) { 01588 bool found = false; 01589 if (0) ; 01590 else if (strcmp(name.c_str(), "ID") == 0) { 01591 _ID = string(value); 01592 _ID_isnull = false; 01593 ; found = true; 01594 } 01595 else if (strcmp(name.c_str(), "type") == 0) { 01596 _type = Element::sto_Values_type(value); 01597 _type_isnull = false; 01598 ; found = true; 01599 } 01600 else if (strcmp(name.c_str(), "null") == 0) { 01601 _null = string(value); 01602 _null_isnull = false; 01603 ; found = true; 01604 } 01605 else if (strcmp(name.c_str(), "ref") == 0) { 01606 _ref = string(value); 01607 _ref_isnull = false; 01608 ; found = true; 01609 } 01610 hk_setAttribute(name, value); 01611 return found; 01612 } 01613 bool Values::setChild(Element* child) { 01614 bool found = false; 01615 if (0) ; 01616 else if (child->nodeType() == Min::sta_nodeType()) { 01617 if (_ch_Min) delete _ch_Min; 01618 _ch_Min = ( Min *) child; 01619 setParentInChild(child); 01620 found = true; 01621 } 01622 else if (child->nodeType() == Max::sta_nodeType()) { 01623 if (_ch_Max) delete _ch_Max; 01624 _ch_Max = ( Max *) child; 01625 setParentInChild(child); 01626 found = true; 01627 } 01628 else if (child->nodeType() == Option::sta_nodeType()) { 01629 int dim = sizeof( Option *) * (_ch_Option_count + 1); 01630 if (_ch_Option_count == 0) _ch_Option = ( Option **) malloc(dim); 01631 else _ch_Option = ( Option **) realloc(_ch_Option, dim); 01632 _ch_Option [_ch_Option_count] = ( Option *) child; 01633 _ch_Option_count++; 01634 setParentInChild(child); 01635 found = true; 01636 } 01637 hk_setChild(child); 01638 return found; 01639 }; 01640 01641 01642 ; 01643 01644 01645 Field::Field() { 01646 lnodetype = FIELD; 01647 lclassname = "Field" ; 01648 constructor = true; 01649 reset(); 01650 constructor = false; 01651 } 01652 Field::~Field() { 01653 reset(); 01654 } 01655 string Field::sta_className() { 01656 return "Field" ; 01657 } 01658 string Field::sta_nodeName() { 01659 return "FIELD" ; 01660 } 01661 enum Nodetype Field::sta_nodeType() { 01662 return FIELD; 01663 } 01664 string Field::ID() { 01665 return _ID; 01666 } 01667 bool Field::ID_isNull() { 01668 return _ID_isnull; 01669 } 01670 string Field::unit() { 01671 return _unit; 01672 } 01673 bool Field::unit_isNull() { 01674 return _unit_isnull; 01675 } 01676 enum Datatype Field::datatype() { 01677 return _datatype; 01678 } 01679 bool Field::datatype_isNull() { 01680 return _datatype_isnull; 01681 } 01682 string Field::precision() { 01683 return _precision; 01684 } 01685 bool Field::precision_isNull() { 01686 return _precision_isnull; 01687 } 01688 int Field::width() { 01689 return _width; 01690 } 01691 bool Field::width_isNull() { 01692 return _width_isnull; 01693 } 01694 string Field::ref() { 01695 return _ref; 01696 } 01697 bool Field::ref_isNull() { 01698 return _ref_isnull; 01699 } 01700 string Field::name() { 01701 return _name; 01702 } 01703 bool Field::name_isNull() { 01704 return _name_isnull; 01705 } 01706 string Field::ucd() { 01707 return _ucd; 01708 } 01709 bool Field::ucd_isNull() { 01710 return _ucd_isnull; 01711 } 01712 string Field::utype() { 01713 return _utype; 01714 } 01715 bool Field::utype_isNull() { 01716 return _utype_isnull; 01717 } 01718 string Field::arraysize() { 01719 return _arraysize; 01720 } 01721 bool Field::arraysize_isNull() { 01722 return _arraysize_isnull; 01723 } 01724 enum Field_type Field::type() { 01725 return _type; 01726 } 01727 bool Field::type_isNull() { 01728 return _type_isnull; 01729 } 01730 Description * Field::description() { 01731 return _ch_Description; 01732 } 01733 Values * Field::values() { 01734 return _ch_Values; 01735 } 01736 Link * Field::link(unsigned int i ) { 01737 if (i >= _ch_Link_count) throw MCS_ERROR( MSG_VOT_INVALID_INDEX, "", i); 01738 else return (_ch_Link [i]); 01739 } 01740 unsigned int Field::link_count() { 01741 return _ch_Link_count; 01742 } 01743 void Field::print(bool verbose) { 01744 cout << space_indent(depth()) << "NODE " << sta_className() << " (" << ord() << ")" << endl; 01745 if (verbose) { 01746 cout << space_indent(depth()) << "ATTR " << "ID" << ": "; 01747 if (! _ID_isnull) cout << _ID; 01748 cout << "|" << endl; 01749 } 01750 else if (! _ID_isnull) cout << space_indent(depth()) << "ATTR " << "ID" << endl; 01751 if (verbose) { 01752 cout << space_indent(depth()) << "ATTR " << "unit" << ": "; 01753 if (! _unit_isnull) cout << _unit; 01754 cout << "|" << endl; 01755 } 01756 else if (! _unit_isnull) cout << space_indent(depth()) << "ATTR " << "unit" << endl; 01757 if (verbose) { 01758 cout << space_indent(depth()) << "ATTR " << "datatype" << ": "; 01759 if (! _datatype_isnull) cout << _datatype; 01760 cout << "|" << endl; 01761 } 01762 else if (! _datatype_isnull) cout << space_indent(depth()) << "ATTR " << "datatype" << endl; 01763 if (verbose) { 01764 cout << space_indent(depth()) << "ATTR " << "precision" << ": "; 01765 if (! _precision_isnull) cout << _precision; 01766 cout << "|" << endl; 01767 } 01768 else if (! _precision_isnull) cout << space_indent(depth()) << "ATTR " << "precision" << endl; 01769 if (verbose) { 01770 cout << space_indent(depth()) << "ATTR " << "width" << ": "; 01771 if (! _width_isnull) cout << _width; 01772 cout << "|" << endl; 01773 } 01774 else if (! _width_isnull) cout << space_indent(depth()) << "ATTR " << "width" << endl; 01775 if (verbose) { 01776 cout << space_indent(depth()) << "ATTR " << "ref" << ": "; 01777 if (! _ref_isnull) cout << _ref; 01778 cout << "|" << endl; 01779 } 01780 else if (! _ref_isnull) cout << space_indent(depth()) << "ATTR " << "ref" << endl; 01781 if (verbose) { 01782 cout << space_indent(depth()) << "ATTR " << "name" << ": "; 01783 if (! _name_isnull) cout << _name; 01784 cout << "|" << endl; 01785 } 01786 else if (! _name_isnull) cout << space_indent(depth()) << "ATTR " << "name" << endl; 01787 if (verbose) { 01788 cout << space_indent(depth()) << "ATTR " << "ucd" << ": "; 01789 if (! _ucd_isnull) cout << _ucd; 01790 cout << "|" << endl; 01791 } 01792 else if (! _ucd_isnull) cout << space_indent(depth()) << "ATTR " << "ucd" << endl; 01793 if (verbose) { 01794 cout << space_indent(depth()) << "ATTR " << "utype" << ": "; 01795 if (! _utype_isnull) cout << _utype; 01796 cout << "|" << endl; 01797 } 01798 else if (! _utype_isnull) cout << space_indent(depth()) << "ATTR " << "utype" << endl; 01799 if (verbose) { 01800 cout << space_indent(depth()) << "ATTR " << "arraysize" << ": "; 01801 if (! _arraysize_isnull) cout << _arraysize; 01802 cout << "|" << endl; 01803 } 01804 else if (! _arraysize_isnull) cout << space_indent(depth()) << "ATTR " << "arraysize" << endl; 01805 if (verbose) { 01806 cout << space_indent(depth()) << "ATTR " << "type" << ": "; 01807 if (! _type_isnull) cout << _type; 01808 cout << "|" << endl; 01809 } 01810 else if (! _type_isnull) cout << space_indent(depth()) << "ATTR " << "type" << endl; 01811 if ((verbose) || (_ch_Description)) { 01812 cout << space_indent(depth()) << "CHILD " << "Description"; 01813 if (! _ch_Description) cout << "0" << endl; 01814 else { 01815 cout << endl; 01816 _ch_Description->print(verbose); 01817 } 01818 } if ((verbose) || (_ch_Values)) { 01819 cout << space_indent(depth()) << "CHILD " << "Values"; 01820 if (! _ch_Values) cout << "0" << endl; 01821 else { 01822 cout << endl; 01823 _ch_Values->print(verbose); 01824 } 01825 } if ((verbose) || (_ch_Link_count)) { 01826 cout << space_indent(depth()) << "CHILD " << "Link" << " elements: " << _ch_Link_count << endl; 01827 for (unsigned int i=0; 01828 i < _ch_Link_count; 01829 i++) _ch_Link[i]->print(verbose); 01830 } 01831 } void Field::reset() { 01832 lparent = NULL; 01833 lnext = NULL; 01834 lprev = NULL; 01835 _ID_isnull = true; 01836 _unit_isnull = true; 01837 _datatype_isnull = true; 01838 _precision_isnull = true; 01839 _width_isnull = true; 01840 _ref_isnull = true; 01841 _name_isnull = true; 01842 _ucd_isnull = true; 01843 _utype_isnull = true; 01844 _arraysize_isnull = true; 01845 _type_isnull = true; 01846 if (constructor) _ch_Description = NULL; 01847 else if (_ch_Description) { 01848 delete _ch_Description; 01849 _ch_Description = NULL; 01850 } 01851 if (constructor) _ch_Values = NULL; 01852 else if (_ch_Values) { 01853 delete _ch_Values; 01854 _ch_Values = NULL; 01855 } 01856 if (constructor) _ch_Link = NULL; 01857 else if (_ch_Link_count) { 01858 for (unsigned int i=0; 01859 i < _ch_Link_count; 01860 i++) delete (_ch_Link [i]); 01861 free(_ch_Link); 01862 _ch_Link = NULL; 01863 } 01864 _ch_Link_count = 0; 01865 hk_reset(); 01866 } 01867 bool Field::setAttribute(string name, string value) { 01868 bool found = false; 01869 if (0) ; 01870 else if (strcmp(name.c_str(), "ID") == 0) { 01871 _ID = string(value); 01872 _ID_isnull = false; 01873 ; found = true; 01874 } 01875 else if (strcmp(name.c_str(), "unit") == 0) { 01876 _unit = string(value); 01877 _unit_isnull = false; 01878 ; found = true; 01879 } 01880 else if (strcmp(name.c_str(), "datatype") == 0) { 01881 _datatype = Element::sto_Datatype(value); 01882 _datatype_isnull = false; 01883 ; found = true; 01884 } 01885 else if (strcmp(name.c_str(), "precision") == 0) { 01886 _precision = string(value); 01887 _precision_isnull = false; 01888 ; found = true; 01889 } 01890 else if (strcmp(name.c_str(), "width") == 0) { 01891 _width = mcs::stoi(value); 01892 _width_isnull = false; 01893 ; found = true; 01894 } 01895 else if (strcmp(name.c_str(), "ref") == 0) { 01896 _ref = string(value); 01897 _ref_isnull = false; 01898 ; found = true; 01899 } 01900 else if (strcmp(name.c_str(), "name") == 0) { 01901 _name = string(value); 01902 _name_isnull = false; 01903 ; found = true; 01904 } 01905 else if (strcmp(name.c_str(), "ucd") == 0) { 01906 _ucd = string(value); 01907 _ucd_isnull = false; 01908 ; found = true; 01909 } 01910 else if (strcmp(name.c_str(), "utype") == 0) { 01911 _utype = string(value); 01912 _utype_isnull = false; 01913 ; found = true; 01914 } 01915 else if (strcmp(name.c_str(), "arraysize") == 0) { 01916 _arraysize = string(value); 01917 _arraysize_isnull = false; 01918 ; found = true; 01919 } 01920 else if (strcmp(name.c_str(), "type") == 0) { 01921 _type = Element::sto_Field_type(value); 01922 _type_isnull = false; 01923 ; found = true; 01924 } 01925 hk_setAttribute(name, value); 01926 return found; 01927 } 01928 bool Field::setChild(Element* child) { 01929 bool found = false; 01930 if (0) ; 01931 else if (child->nodeType() == Description::sta_nodeType()) { 01932 if (_ch_Description) delete _ch_Description; 01933 _ch_Description = ( Description *) child; 01934 setParentInChild(child); 01935 found = true; 01936 } 01937 else if (child->nodeType() == Values::sta_nodeType()) { 01938 if (_ch_Values) delete _ch_Values; 01939 _ch_Values = ( Values *) child; 01940 setParentInChild(child); 01941 found = true; 01942 } 01943 else if (child->nodeType() == Link::sta_nodeType()) { 01944 int dim = sizeof( Link *) * (_ch_Link_count + 1); 01945 if (_ch_Link_count == 0) _ch_Link = ( Link **) malloc(dim); 01946 else _ch_Link = ( Link **) realloc(_ch_Link, dim); 01947 _ch_Link [_ch_Link_count] = ( Link *) child; 01948 _ch_Link_count++; 01949 setParentInChild(child); 01950 found = true; 01951 } 01952 hk_setChild(child); 01953 return found; 01954 }; 01955 01956 01957 01958 // void done(); 01959 01960 ; 01961 01962 01963 Param::Param() { 01964 lnodetype = PARAM; 01965 lclassname = "Param" ; 01966 constructor = true; 01967 reset(); 01968 constructor = false; 01969 } 01970 Param::~Param() { 01971 reset(); 01972 } 01973 string Param::sta_className() { 01974 return "Param" ; 01975 } 01976 string Param::sta_nodeName() { 01977 return "PARAM" ; 01978 } 01979 enum Nodetype Param::sta_nodeType() { 01980 return PARAM; 01981 } 01982 string Param::ID() { 01983 return _ID; 01984 } 01985 bool Param::ID_isNull() { 01986 return _ID_isnull; 01987 } 01988 string Param::unit() { 01989 return _unit; 01990 } 01991 bool Param::unit_isNull() { 01992 return _unit_isnull; 01993 } 01994 enum Datatype Param::datatype() { 01995 return _datatype; 01996 } 01997 bool Param::datatype_isNull() { 01998 return _datatype_isnull; 01999 } 02000 string Param::precision() { 02001 return _precision; 02002 } 02003 bool Param::precision_isNull() { 02004 return _precision_isnull; 02005 } 02006 int Param::width() { 02007 return _width; 02008 } 02009 bool Param::width_isNull() { 02010 return _width_isnull; 02011 } 02012 string Param::ref() { 02013 return _ref; 02014 } 02015 bool Param::ref_isNull() { 02016 return _ref_isnull; 02017 } 02018 string Param::name() { 02019 return _name; 02020 } 02021 bool Param::name_isNull() { 02022 return _name_isnull; 02023 } 02024 string Param::ucd() { 02025 return _ucd; 02026 } 02027 bool Param::ucd_isNull() { 02028 return _ucd_isnull; 02029 } 02030 string Param::utype() { 02031 return _utype; 02032 } 02033 bool Param::utype_isNull() { 02034 return _utype_isnull; 02035 } 02036 string Param::value() { 02037 return _value; 02038 } 02039 bool Param::value_isNull() { 02040 return _value_isnull; 02041 } 02042 string Param::arraysize() { 02043 return _arraysize; 02044 } 02045 bool Param::arraysize_isNull() { 02046 return _arraysize_isnull; 02047 } 02048 Description * Param::description() { 02049 return _ch_Description; 02050 } 02051 Values * Param::values() { 02052 return _ch_Values; 02053 } 02054 Link * Param::link(unsigned int i ) { 02055 if (i >= _ch_Link_count) throw MCS_ERROR( MSG_VOT_INVALID_INDEX, "", i); 02056 else return (_ch_Link [i]); 02057 } 02058 unsigned int Param::link_count() { 02059 return _ch_Link_count; 02060 } 02061 void Param::print(bool verbose) { 02062 cout << space_indent(depth()) << "NODE " << sta_className() << " (" << ord() << ")" << endl; 02063 if (verbose) { 02064 cout << space_indent(depth()) << "ATTR " << "ID" << ": "; 02065 if (! _ID_isnull) cout << _ID; 02066 cout << "|" << endl; 02067 } 02068 else if (! _ID_isnull) cout << space_indent(depth()) << "ATTR " << "ID" << endl; 02069 if (verbose) { 02070 cout << space_indent(depth()) << "ATTR " << "unit" << ": "; 02071 if (! _unit_isnull) cout << _unit; 02072 cout << "|" << endl; 02073 } 02074 else if (! _unit_isnull) cout << space_indent(depth()) << "ATTR " << "unit" << endl; 02075 if (verbose) { 02076 cout << space_indent(depth()) << "ATTR " << "datatype" << ": "; 02077 if (! _datatype_isnull) cout << _datatype; 02078 cout << "|" << endl; 02079 } 02080 else if (! _datatype_isnull) cout << space_indent(depth()) << "ATTR " << "datatype" << endl; 02081 if (verbose) { 02082 cout << space_indent(depth()) << "ATTR " << "precision" << ": "; 02083 if (! _precision_isnull) cout << _precision; 02084 cout << "|" << endl; 02085 } 02086 else if (! _precision_isnull) cout << space_indent(depth()) << "ATTR " << "precision" << endl; 02087 if (verbose) { 02088 cout << space_indent(depth()) << "ATTR " << "width" << ": "; 02089 if (! _width_isnull) cout << _width; 02090 cout << "|" << endl; 02091 } 02092 else if (! _width_isnull) cout << space_indent(depth()) << "ATTR " << "width" << endl; 02093 if (verbose) { 02094 cout << space_indent(depth()) << "ATTR " << "ref" << ": "; 02095 if (! _ref_isnull) cout << _ref; 02096 cout << "|" << endl; 02097 } 02098 else if (! _ref_isnull) cout << space_indent(depth()) << "ATTR " << "ref" << endl; 02099 if (verbose) { 02100 cout << space_indent(depth()) << "ATTR " << "name" << ": "; 02101 if (! _name_isnull) cout << _name; 02102 cout << "|" << endl; 02103 } 02104 else if (! _name_isnull) cout << space_indent(depth()) << "ATTR " << "name" << endl; 02105 if (verbose) { 02106 cout << space_indent(depth()) << "ATTR " << "ucd" << ": "; 02107 if (! _ucd_isnull) cout << _ucd; 02108 cout << "|" << endl; 02109 } 02110 else if (! _ucd_isnull) cout << space_indent(depth()) << "ATTR " << "ucd" << endl; 02111 if (verbose) { 02112 cout << space_indent(depth()) << "ATTR " << "utype" << ": "; 02113 if (! _utype_isnull) cout << _utype; 02114 cout << "|" << endl; 02115 } 02116 else if (! _utype_isnull) cout << space_indent(depth()) << "ATTR " << "utype" << endl; 02117 if (verbose) { 02118 cout << space_indent(depth()) << "ATTR " << "value" << ": "; 02119 if (! _value_isnull) cout << _value; 02120 cout << "|" << endl; 02121 } 02122 else if (! _value_isnull) cout << space_indent(depth()) << "ATTR " << "value" << endl; 02123 if (verbose) { 02124 cout << space_indent(depth()) << "ATTR " << "arraysize" << ": "; 02125 if (! _arraysize_isnull) cout << _arraysize; 02126 cout << "|" << endl; 02127 } 02128 else if (! _arraysize_isnull) cout << space_indent(depth()) << "ATTR " << "arraysize" << endl; 02129 if ((verbose) || (_ch_Description)) { 02130 cout << space_indent(depth()) << "CHILD " << "Description"; 02131 if (! _ch_Description) cout << "0" << endl; 02132 else { 02133 cout << endl; 02134 _ch_Description->print(verbose); 02135 } 02136 } if ((verbose) || (_ch_Values)) { 02137 cout << space_indent(depth()) << "CHILD " << "Values"; 02138 if (! _ch_Values) cout << "0" << endl; 02139 else { 02140 cout << endl; 02141 _ch_Values->print(verbose); 02142 } 02143 } if ((verbose) || (_ch_Link_count)) { 02144 cout << space_indent(depth()) << "CHILD " << "Link" << " elements: " << _ch_Link_count << endl; 02145 for (unsigned int i=0; 02146 i < _ch_Link_count; 02147 i++) _ch_Link[i]->print(verbose); 02148 } 02149 } void Param::reset() { 02150 lparent = NULL; 02151 lnext = NULL; 02152 lprev = NULL; 02153 _ID_isnull = true; 02154 _unit_isnull = true; 02155 _datatype_isnull = true; 02156 _precision_isnull = true; 02157 _width_isnull = true; 02158 _ref_isnull = true; 02159 _name_isnull = true; 02160 _ucd_isnull = true; 02161 _utype_isnull = true; 02162 _value_isnull = true; 02163 _arraysize_isnull = true; 02164 if (constructor) _ch_Description = NULL; 02165 else if (_ch_Description) { 02166 delete _ch_Description; 02167 _ch_Description = NULL; 02168 } 02169 if (constructor) _ch_Values = NULL; 02170 else if (_ch_Values) { 02171 delete _ch_Values; 02172 _ch_Values = NULL; 02173 } 02174 if (constructor) _ch_Link = NULL; 02175 else if (_ch_Link_count) { 02176 for (unsigned int i=0; 02177 i < _ch_Link_count; 02178 i++) delete (_ch_Link [i]); 02179 free(_ch_Link); 02180 _ch_Link = NULL; 02181 } 02182 _ch_Link_count = 0; 02183 hk_reset(); 02184 } 02185 bool Param::setAttribute(string name, string value) { 02186 bool found = false; 02187 if (0) ; 02188 else if (strcmp(name.c_str(), "ID") == 0) { 02189 _ID = string(value); 02190 _ID_isnull = false; 02191 ; found = true; 02192 } 02193 else if (strcmp(name.c_str(), "unit") == 0) { 02194 _unit = string(value); 02195 _unit_isnull = false; 02196 ; found = true; 02197 } 02198 else if (strcmp(name.c_str(), "datatype") == 0) { 02199 _datatype = Element::sto_Datatype(value); 02200 _datatype_isnull = false; 02201 ; found = true; 02202 } 02203 else if (strcmp(name.c_str(), "precision") == 0) { 02204 _precision = string(value); 02205 _precision_isnull = false; 02206 ; found = true; 02207 } 02208 else if (strcmp(name.c_str(), "width") == 0) { 02209 _width = mcs::stoi(value); 02210 _width_isnull = false; 02211 ; found = true; 02212 } 02213 else if (strcmp(name.c_str(), "ref") == 0) { 02214 _ref = string(value); 02215 _ref_isnull = false; 02216 ; found = true; 02217 } 02218 else if (strcmp(name.c_str(), "name") == 0) { 02219 _name = string(value); 02220 _name_isnull = false; 02221 ; found = true; 02222 } 02223 else if (strcmp(name.c_str(), "ucd") == 0) { 02224 _ucd = string(value); 02225 _ucd_isnull = false; 02226 ; found = true; 02227 } 02228 else if (strcmp(name.c_str(), "utype") == 0) { 02229 _utype = string(value); 02230 _utype_isnull = false; 02231 ; found = true; 02232 } 02233 else if (strcmp(name.c_str(), "value") == 0) { 02234 _value = string(value); 02235 _value_isnull = false; 02236 ; found = true; 02237 } 02238 else if (strcmp(name.c_str(), "arraysize") == 0) { 02239 _arraysize = string(value); 02240 _arraysize_isnull = false; 02241 ; found = true; 02242 } 02243 hk_setAttribute(name, value); 02244 return found; 02245 } 02246 bool Param::setChild(Element* child) { 02247 bool found = false; 02248 if (0) ; 02249 else if (child->nodeType() == Description::sta_nodeType()) { 02250 if (_ch_Description) delete _ch_Description; 02251 _ch_Description = ( Description *) child; 02252 setParentInChild(child); 02253 found = true; 02254 } 02255 else if (child->nodeType() == Values::sta_nodeType()) { 02256 if (_ch_Values) delete _ch_Values; 02257 _ch_Values = ( Values *) child; 02258 setParentInChild(child); 02259 found = true; 02260 } 02261 else if (child->nodeType() == Link::sta_nodeType()) { 02262 int dim = sizeof( Link *) * (_ch_Link_count + 1); 02263 if (_ch_Link_count == 0) _ch_Link = ( Link **) malloc(dim); 02264 else _ch_Link = ( Link **) realloc(_ch_Link, dim); 02265 _ch_Link [_ch_Link_count] = ( Link *) child; 02266 _ch_Link_count++; 02267 setParentInChild(child); 02268 found = true; 02269 } 02270 hk_setChild(child); 02271 return found; 02272 }; 02273 02274 02275 ; 02276 02277 02278 Group::Group() { 02279 lnodetype = GROUP; 02280 lclassname = "Group" ; 02281 constructor = true; 02282 reset(); 02283 constructor = false; 02284 } 02285 Group::~Group() { 02286 reset(); 02287 } 02288 string Group::sta_className() { 02289 return "Group" ; 02290 } 02291 string Group::sta_nodeName() { 02292 return "GROUP" ; 02293 } 02294 enum Nodetype Group::sta_nodeType() { 02295 return GROUP; 02296 } 02297 string Group::ID() { 02298 return _ID; 02299 } 02300 bool Group::ID_isNull() { 02301 return _ID_isnull; 02302 } 02303 string Group::name() { 02304 return _name; 02305 } 02306 bool Group::name_isNull() { 02307 return _name_isnull; 02308 } 02309 string Group::ref() { 02310 return _ref; 02311 } 02312 bool Group::ref_isNull() { 02313 return _ref_isnull; 02314 } 02315 string Group::ucd() { 02316 return _ucd; 02317 } 02318 bool Group::ucd_isNull() { 02319 return _ucd_isnull; 02320 } 02321 string Group::utype() { 02322 return _utype; 02323 } 02324 bool Group::utype_isNull() { 02325 return _utype_isnull; 02326 } 02327 Description * Group::description() { 02328 return _ch_Description; 02329 } 02330 FieldRef * Group::fieldref(unsigned int i ) { 02331 if (i >= _ch_FieldRef_count) throw MCS_ERROR( MSG_VOT_INVALID_INDEX, "", i); 02332 else return (_ch_FieldRef [i]); 02333 } 02334 unsigned int Group::fieldref_count() { 02335 return _ch_FieldRef_count; 02336 } 02337 Param * Group::param(unsigned int i ) { 02338 if (i >= _ch_Param_count) throw MCS_ERROR( MSG_VOT_INVALID_INDEX, "", i); 02339 else return (_ch_Param [i]); 02340 } 02341 unsigned int Group::param_count() { 02342 return _ch_Param_count; 02343 } 02344 ParamRef * Group::paramref(unsigned int i ) { 02345 if (i >= _ch_ParamRef_count) throw MCS_ERROR( MSG_VOT_INVALID_INDEX, "", i); 02346 else return (_ch_ParamRef [i]); 02347 } 02348 unsigned int Group::paramref_count() { 02349 return _ch_ParamRef_count; 02350 } 02351 Group * Group::group(unsigned int i ) { 02352 if (i >= _ch_Group_count) throw MCS_ERROR( MSG_VOT_INVALID_INDEX, "", i); 02353 else return (_ch_Group [i]); 02354 } 02355 unsigned int Group::group_count() { 02356 return _ch_Group_count; 02357 } 02358 void Group::print(bool verbose) { 02359 cout << space_indent(depth()) << "NODE " << sta_className() << " (" << ord() << ")" << endl; 02360 if (verbose) { 02361 cout << space_indent(depth()) << "ATTR " << "ID" << ": "; 02362 if (! _ID_isnull) cout << _ID; 02363 cout << "|" << endl; 02364 } 02365 else if (! _ID_isnull) cout << space_indent(depth()) << "ATTR " << "ID" << endl; 02366 if (verbose) { 02367 cout << space_indent(depth()) << "ATTR " << "name" << ": "; 02368 if (! _name_isnull) cout << _name; 02369 cout << "|" << endl; 02370 } 02371 else if (! _name_isnull) cout << space_indent(depth()) << "ATTR " << "name" << endl; 02372 if (verbose) { 02373 cout << space_indent(depth()) << "ATTR " << "ref" << ": "; 02374 if (! _ref_isnull) cout << _ref; 02375 cout << "|" << endl; 02376 } 02377 else if (! _ref_isnull) cout << space_indent(depth()) << "ATTR " << "ref" << endl; 02378 if (verbose) { 02379 cout << space_indent(depth()) << "ATTR " << "ucd" << ": "; 02380 if (! _ucd_isnull) cout << _ucd; 02381 cout << "|" << endl; 02382 } 02383 else if (! _ucd_isnull) cout << space_indent(depth()) << "ATTR " << "ucd" << endl; 02384 if (verbose) { 02385 cout << space_indent(depth()) << "ATTR " << "utype" << ": "; 02386 if (! _utype_isnull) cout << _utype; 02387 cout << "|" << endl; 02388 } 02389 else if (! _utype_isnull) cout << space_indent(depth()) << "ATTR " << "utype" << endl; 02390 if ((verbose) || (_ch_Description)) { 02391 cout << space_indent(depth()) << "CHILD " << "Description"; 02392 if (! _ch_Description) cout << "0" << endl; 02393 else { 02394 cout << endl; 02395 _ch_Description->print(verbose); 02396 } 02397 } if ((verbose) || (_ch_FieldRef_count)) { 02398 cout << space_indent(depth()) << "CHILD " << "FieldRef" << " elements: " << _ch_FieldRef_count << endl; 02399 for (unsigned int i=0; 02400 i < _ch_FieldRef_count; 02401 i++) _ch_FieldRef[i]->print(verbose); 02402 } 02403 if ((verbose) || (_ch_Param_count)) { 02404 cout << space_indent(depth()) << "CHILD " << "Param" << " elements: " << _ch_Param_count << endl; 02405 for (unsigned int i=0; 02406 i < _ch_Param_count; 02407 i++) _ch_Param[i]->print(verbose); 02408 } 02409 if ((verbose) || (_ch_ParamRef_count)) { 02410 cout << space_indent(depth()) << "CHILD " << "ParamRef" << " elements: " << _ch_ParamRef_count << endl; 02411 for (unsigned int i=0; 02412 i < _ch_ParamRef_count; 02413 i++) _ch_ParamRef[i]->print(verbose); 02414 } 02415 if ((verbose) || (_ch_Group_count)) { 02416 cout << space_indent(depth()) << "CHILD " << "Group" << " elements: " << _ch_Group_count << endl; 02417 for (unsigned int i=0; 02418 i < _ch_Group_count; 02419 i++) _ch_Group[i]->print(verbose); 02420 } 02421 } void Group::reset() { 02422 lparent = NULL; 02423 lnext = NULL; 02424 lprev = NULL; 02425 _ID_isnull = true; 02426 _name_isnull = true; 02427 _ref_isnull = true; 02428 _ucd_isnull = true; 02429 _utype_isnull = true; 02430 if (constructor) _ch_Description = NULL; 02431 else if (_ch_Description) { 02432 delete _ch_Description; 02433 _ch_Description = NULL; 02434 } 02435 if (constructor) _ch_FieldRef = NULL; 02436 else if (_ch_FieldRef_count) { 02437 for (unsigned int i=0; 02438 i < _ch_FieldRef_count; 02439 i++) delete (_ch_FieldRef [i]); 02440 free(_ch_FieldRef); 02441 _ch_FieldRef = NULL; 02442 } 02443 _ch_FieldRef_count = 0; 02444 if (constructor) _ch_Param = NULL; 02445 else if (_ch_Param_count) { 02446 for (unsigned int i=0; 02447 i < _ch_Param_count; 02448 i++) delete (_ch_Param [i]); 02449 free(_ch_Param); 02450 _ch_Param = NULL; 02451 } 02452 _ch_Param_count = 0; 02453 if (constructor) _ch_ParamRef = NULL; 02454 else if (_ch_ParamRef_count) { 02455 for (unsigned int i=0; 02456 i < _ch_ParamRef_count; 02457 i++) delete (_ch_ParamRef [i]); 02458 free(_ch_ParamRef); 02459 _ch_ParamRef = NULL; 02460 } 02461 _ch_ParamRef_count = 0; 02462 if (constructor) _ch_Group = NULL; 02463 else if (_ch_Group_count) { 02464 for (unsigned int i=0; 02465 i < _ch_Group_count; 02466 i++) delete (_ch_Group [i]); 02467 free(_ch_Group); 02468 _ch_Group = NULL; 02469 } 02470 _ch_Group_count = 0; 02471 hk_reset(); 02472 } 02473 bool Group::setAttribute(string name, string value) { 02474 bool found = false; 02475 if (0) ; 02476 else if (strcmp(name.c_str(), "ID") == 0) { 02477 _ID = string(value); 02478 _ID_isnull = false; 02479 ; found = true; 02480 } 02481 else if (strcmp(name.c_str(), "name") == 0) { 02482 _name = string(value); 02483 _name_isnull = false; 02484 ; found = true; 02485 } 02486 else if (strcmp(name.c_str(), "ref") == 0) { 02487 _ref = string(value); 02488 _ref_isnull = false; 02489 ; found = true; 02490 } 02491 else if (strcmp(name.c_str(), "ucd") == 0) { 02492 _ucd = string(value); 02493 _ucd_isnull = false; 02494 ; found = true; 02495 } 02496 else if (strcmp(name.c_str(), "utype") == 0) { 02497 _utype = string(value); 02498 _utype_isnull = false; 02499 ; found = true; 02500 } 02501 hk_setAttribute(name, value); 02502 return found; 02503 } 02504 bool Group::setChild(Element* child) { 02505 bool found = false; 02506 if (0) ; 02507 else if (child->nodeType() == Description::sta_nodeType()) { 02508 if (_ch_Description) delete _ch_Description; 02509 _ch_Description = ( Description *) child; 02510 setParentInChild(child); 02511 found = true; 02512 } 02513 else if (child->nodeType() == FieldRef::sta_nodeType()) { 02514 int dim = sizeof( FieldRef *) * (_ch_FieldRef_count + 1); 02515 if (_ch_FieldRef_count == 0) _ch_FieldRef = ( FieldRef **) malloc(dim); 02516 else _ch_FieldRef = ( FieldRef **) realloc(_ch_FieldRef, dim); 02517 _ch_FieldRef [_ch_FieldRef_count] = ( FieldRef *) child; 02518 _ch_FieldRef_count++; 02519 setParentInChild(child); 02520 found = true; 02521 } 02522 else if (child->nodeType() == Param::sta_nodeType()) { 02523 int dim = sizeof( Param *) * (_ch_Param_count + 1); 02524 if (_ch_Param_count == 0) _ch_Param = ( Param **) malloc(dim); 02525 else _ch_Param = ( Param **) realloc(_ch_Param, dim); 02526 _ch_Param [_ch_Param_count] = ( Param *) child; 02527 _ch_Param_count++; 02528 setParentInChild(child); 02529 found = true; 02530 } 02531 else if (child->nodeType() == ParamRef::sta_nodeType()) { 02532 int dim = sizeof( ParamRef *) * (_ch_ParamRef_count + 1); 02533 if (_ch_ParamRef_count == 0) _ch_ParamRef = ( ParamRef **) malloc(dim); 02534 else _ch_ParamRef = ( ParamRef **) realloc(_ch_ParamRef, dim); 02535 _ch_ParamRef [_ch_ParamRef_count] = ( ParamRef *) child; 02536 _ch_ParamRef_count++; 02537 setParentInChild(child); 02538 found = true; 02539 } 02540 else if (child->nodeType() == Group::sta_nodeType()) { 02541 int dim = sizeof( Group *) * (_ch_Group_count + 1); 02542 if (_ch_Group_count == 0) _ch_Group = ( Group **) malloc(dim); 02543 else _ch_Group = ( Group **) realloc(_ch_Group, dim); 02544 _ch_Group [_ch_Group_count] = ( Group *) child; 02545 _ch_Group_count++; 02546 setParentInChild(child); 02547 found = true; 02548 } 02549 hk_setChild(child); 02550 return found; 02551 }; 02552 02553 02554 ; 02555 02556 02557 Data::Data() { 02558 lnodetype = DATA; 02559 lclassname = "Data" ; 02560 constructor = true; 02561 reset(); 02562 constructor = false; 02563 } 02564 Data::~Data() { 02565 reset(); 02566 } 02567 string Data::sta_className() { 02568 return "Data" ; 02569 } 02570 string Data::sta_nodeName() { 02571 return "DATA" ; 02572 } 02573 enum Nodetype Data::sta_nodeType() { 02574 return DATA; 02575 } 02576 Tabledata * Data::tabledata() { 02577 return _ch_Tabledata; 02578 } 02579 Binary * Data::binary() { 02580 return _ch_Binary; 02581 } 02582 Fits * Data::fits() { 02583 return _ch_Fits; 02584 } 02585 void Data::print(bool verbose) { 02586 cout << space_indent(depth()) << "NODE " << sta_className() << " (" << ord() << ")" << endl; 02587 if ((verbose) || (_ch_Tabledata)) { 02588 cout << space_indent(depth()) << "CHILD " << "Tabledata"; 02589 if (! _ch_Tabledata) cout << "0" << endl; 02590 else { 02591 cout << endl; 02592 _ch_Tabledata->print(verbose); 02593 } 02594 } if ((verbose) || (_ch_Binary)) { 02595 cout << space_indent(depth()) << "CHILD " << "Binary"; 02596 if (! _ch_Binary) cout << "0" << endl; 02597 else { 02598 cout << endl; 02599 _ch_Binary->print(verbose); 02600 } 02601 } if ((verbose) || (_ch_Fits)) { 02602 cout << space_indent(depth()) << "CHILD " << "Fits"; 02603 if (! _ch_Fits) cout << "0" << endl; 02604 else { 02605 cout << endl; 02606 _ch_Fits->print(verbose); 02607 } 02608 } } 02609 void Data::reset() { 02610 lparent = NULL; 02611 lnext = NULL; 02612 lprev = NULL; 02613 if (constructor) _ch_Tabledata = NULL; 02614 else if (_ch_Tabledata) { 02615 delete _ch_Tabledata; 02616 _ch_Tabledata = NULL; 02617 } 02618 if (constructor) _ch_Binary = NULL; 02619 else if (_ch_Binary) { 02620 delete _ch_Binary; 02621 _ch_Binary = NULL; 02622 } 02623 if (constructor) _ch_Fits = NULL; 02624 else if (_ch_Fits) { 02625 delete _ch_Fits; 02626 _ch_Fits = NULL; 02627 } 02628 hk_reset(); 02629 } 02630 bool Data::setAttribute(string name, string value) { 02631 bool found = false; 02632 if (0) ; 02633 hk_setAttribute(name, value); 02634 return found; 02635 } 02636 bool Data::setChild(Element* child) { 02637 bool found = false; 02638 if (0) ; 02639 else if (child->nodeType() == Tabledata::sta_nodeType()) { 02640 if (_ch_Tabledata) delete _ch_Tabledata; 02641 _ch_Tabledata = ( Tabledata *) child; 02642 setParentInChild(child); 02643 found = true; 02644 } 02645 else if (child->nodeType() == Binary::sta_nodeType()) { 02646 if (_ch_Binary) delete _ch_Binary; 02647 _ch_Binary = ( Binary *) child; 02648 setParentInChild(child); 02649 found = true; 02650 } 02651 else if (child->nodeType() == Fits::sta_nodeType()) { 02652 if (_ch_Fits) delete _ch_Fits; 02653 _ch_Fits = ( Fits *) child; 02654 setParentInChild(child); 02655 found = true; 02656 } 02657 hk_setChild(child); 02658 return found; 02659 }; 02660 02661 02662 ; 02663 02664 02665 02666 //The Table class is used by Parser_Data to read table's data 02667 Table::Table() { 02668 lnodetype = TABLE; 02669 lclassname = "Table" ; 02670 constructor = true; 02671 reset(); 02672 constructor = false; 02673 } 02674 Table::~Table() { 02675 reset(); 02676 } 02677 string Table::sta_className() { 02678 return "Table" ; 02679 } 02680 string Table::sta_nodeName() { 02681 return "TABLE" ; 02682 } 02683 enum Nodetype Table::sta_nodeType() { 02684 return TABLE; 02685 } 02686 string Table::ID() { 02687 return _ID; 02688 } 02689 bool Table::ID_isNull() { 02690 return _ID_isnull; 02691 } 02692 string Table::name() { 02693 return _name; 02694 } 02695 bool Table::name_isNull() { 02696 return _name_isnull; 02697 } 02698 string Table::ref() { 02699 return _ref; 02700 } 02701 bool Table::ref_isNull() { 02702 return _ref_isnull; 02703 } 02704 string Table::ucd() { 02705 return _ucd; 02706 } 02707 bool Table::ucd_isNull() { 02708 return _ucd_isnull; 02709 } 02710 string Table::utype() { 02711 return _utype; 02712 } 02713 bool Table::utype_isNull() { 02714 return _utype_isnull; 02715 } 02716 int Table::nrows() { 02717 return _nrows; 02718 } 02719 bool Table::nrows_isNull() { 02720 return _nrows_isnull; 02721 } 02722 Description * Table::description() { 02723 return _ch_Description; 02724 } 02725 Data * Table::data() { 02726 return _ch_Data; 02727 } 02728 Field * Table::field(unsigned int i ) { 02729 if (i >= _ch_Field_count) throw MCS_ERROR( MSG_VOT_INVALID_INDEX, "", i); 02730 else return (_ch_Field [i]); 02731 } 02732 unsigned int Table::field_count() { 02733 return _ch_Field_count; 02734 } 02735 Param * Table::param(unsigned int i ) { 02736 if (i >= _ch_Param_count) throw MCS_ERROR( MSG_VOT_INVALID_INDEX, "", i); 02737 else return (_ch_Param [i]); 02738 } 02739 unsigned int Table::param_count() { 02740 return _ch_Param_count; 02741 } 02742 Group * Table::group(unsigned int i ) { 02743 if (i >= _ch_Group_count) throw MCS_ERROR( MSG_VOT_INVALID_INDEX, "", i); 02744 else return (_ch_Group [i]); 02745 } 02746 unsigned int Table::group_count() { 02747 return _ch_Group_count; 02748 } 02749 Link * Table::link(unsigned int i ) { 02750 if (i >= _ch_Link_count) throw MCS_ERROR( MSG_VOT_INVALID_INDEX, "", i); 02751 else return (_ch_Link [i]); 02752 } 02753 unsigned int Table::link_count() { 02754 return _ch_Link_count; 02755 } 02756 void Table::print(bool verbose) { 02757 cout << space_indent(depth()) << "NODE " << sta_className() << " (" << ord() << ")" << endl; 02758 if (verbose) { 02759 cout << space_indent(depth()) << "ATTR " << "ID" << ": "; 02760 if (! _ID_isnull) cout << _ID; 02761 cout << "|" << endl; 02762 } 02763 else if (! _ID_isnull) cout << space_indent(depth()) << "ATTR " << "ID" << endl; 02764 if (verbose) { 02765 cout << space_indent(depth()) << "ATTR " << "name" << ": "; 02766 if (! _name_isnull) cout << _name; 02767 cout << "|" << endl; 02768 } 02769 else if (! _name_isnull) cout << space_indent(depth()) << "ATTR " << "name" << endl; 02770 if (verbose) { 02771 cout << space_indent(depth()) << "ATTR " << "ref" << ": "; 02772 if (! _ref_isnull) cout << _ref; 02773 cout << "|" << endl; 02774 } 02775 else if (! _ref_isnull) cout << space_indent(depth()) << "ATTR " << "ref" << endl; 02776 if (verbose) { 02777 cout << space_indent(depth()) << "ATTR " << "ucd" << ": "; 02778 if (! _ucd_isnull) cout << _ucd; 02779 cout << "|" << endl; 02780 } 02781 else if (! _ucd_isnull) cout << space_indent(depth()) << "ATTR " << "ucd" << endl; 02782 if (verbose) { 02783 cout << space_indent(depth()) << "ATTR " << "utype" << ": "; 02784 if (! _utype_isnull) cout << _utype; 02785 cout << "|" << endl; 02786 } 02787 else if (! _utype_isnull) cout << space_indent(depth()) << "ATTR " << "utype" << endl; 02788 if (verbose) { 02789 cout << space_indent(depth()) << "ATTR " << "nrows" << ": "; 02790 if (! _nrows_isnull) cout << _nrows; 02791 cout << "|" << endl; 02792 } 02793 else if (! _nrows_isnull) cout << space_indent(depth()) << "ATTR " << "nrows" << endl; 02794 if ((verbose) || (_ch_Description)) { 02795 cout << space_indent(depth()) << "CHILD " << "Description"; 02796 if (! _ch_Description) cout << "0" << endl; 02797 else { 02798 cout << endl; 02799 _ch_Description->print(verbose); 02800 } 02801 } if ((verbose) || (_ch_Data)) { 02802 cout << space_indent(depth()) << "CHILD " << "Data"; 02803 if (! _ch_Data) cout << "0" << endl; 02804 else { 02805 cout << endl; 02806 _ch_Data->print(verbose); 02807 } 02808 } if ((verbose) || (_ch_Field_count)) { 02809 cout << space_indent(depth()) << "CHILD " << "Field" << " elements: " << _ch_Field_count << endl; 02810 for (unsigned int i=0; 02811 i < _ch_Field_count; 02812 i++) _ch_Field[i]->print(verbose); 02813 } 02814 if ((verbose) || (_ch_Param_count)) { 02815 cout << space_indent(depth()) << "CHILD " << "Param" << " elements: " << _ch_Param_count << endl; 02816 for (unsigned int i=0; 02817 i < _ch_Param_count; 02818 i++) _ch_Param[i]->print(verbose); 02819 } 02820 if ((verbose) || (_ch_Group_count)) { 02821 cout << space_indent(depth()) << "CHILD " << "Group" << " elements: " << _ch_Group_count << endl; 02822 for (unsigned int i=0; 02823 i < _ch_Group_count; 02824 i++) _ch_Group[i]->print(verbose); 02825 } 02826 if ((verbose) || (_ch_Link_count)) { 02827 cout << space_indent(depth()) << "CHILD " << "Link" << " elements: " << _ch_Link_count << endl; 02828 for (unsigned int i=0; 02829 i < _ch_Link_count; 02830 i++) _ch_Link[i]->print(verbose); 02831 } 02832 } void Table::reset() { 02833 lparent = NULL; 02834 lnext = NULL; 02835 lprev = NULL; 02836 _ID_isnull = true; 02837 _name_isnull = true; 02838 _ref_isnull = true; 02839 _ucd_isnull = true; 02840 _utype_isnull = true; 02841 _nrows_isnull = true; 02842 if (constructor) _ch_Description = NULL; 02843 else if (_ch_Description) { 02844 delete _ch_Description; 02845 _ch_Description = NULL; 02846 } 02847 if (constructor) _ch_Data = NULL; 02848 else if (_ch_Data) { 02849 delete _ch_Data; 02850 _ch_Data = NULL; 02851 } 02852 if (constructor) _ch_Field = NULL; 02853 else if (_ch_Field_count) { 02854 for (unsigned int i=0; 02855 i < _ch_Field_count; 02856 i++) delete (_ch_Field [i]); 02857 free(_ch_Field); 02858 _ch_Field = NULL; 02859 } 02860 _ch_Field_count = 0; 02861 if (constructor) _ch_Param = NULL; 02862 else if (_ch_Param_count) { 02863 for (unsigned int i=0; 02864 i < _ch_Param_count; 02865 i++) delete (_ch_Param [i]); 02866 free(_ch_Param); 02867 _ch_Param = NULL; 02868 } 02869 _ch_Param_count = 0; 02870 if (constructor) _ch_Group = NULL; 02871 else if (_ch_Group_count) { 02872 for (unsigned int i=0; 02873 i < _ch_Group_count; 02874 i++) delete (_ch_Group [i]); 02875 free(_ch_Group); 02876 _ch_Group = NULL; 02877 } 02878 _ch_Group_count = 0; 02879 if (constructor) _ch_Link = NULL; 02880 else if (_ch_Link_count) { 02881 for (unsigned int i=0; 02882 i < _ch_Link_count; 02883 i++) delete (_ch_Link [i]); 02884 free(_ch_Link); 02885 _ch_Link = NULL; 02886 } 02887 _ch_Link_count = 0; 02888 hk_reset(); 02889 } 02890 bool Table::setAttribute(string name, string value) { 02891 bool found = false; 02892 if (0) ; 02893 else if (strcmp(name.c_str(), "ID") == 0) { 02894 _ID = string(value); 02895 _ID_isnull = false; 02896 ; found = true; 02897 } 02898 else if (strcmp(name.c_str(), "name") == 0) { 02899 _name = string(value); 02900 _name_isnull = false; 02901 ; found = true; 02902 } 02903 else if (strcmp(name.c_str(), "ref") == 0) { 02904 _ref = string(value); 02905 _ref_isnull = false; 02906 ; found = true; 02907 } 02908 else if (strcmp(name.c_str(), "ucd") == 0) { 02909 _ucd = string(value); 02910 _ucd_isnull = false; 02911 ; found = true; 02912 } 02913 else if (strcmp(name.c_str(), "utype") == 0) { 02914 _utype = string(value); 02915 _utype_isnull = false; 02916 ; found = true; 02917 } 02918 else if (strcmp(name.c_str(), "nrows") == 0) { 02919 _nrows = mcs::stoi(value); 02920 _nrows_isnull = false; 02921 ; found = true; 02922 } 02923 hk_setAttribute(name, value); 02924 return found; 02925 } 02926 bool Table::setChild(Element* child) { 02927 bool found = false; 02928 if (0) ; 02929 else if (child->nodeType() == Description::sta_nodeType()) { 02930 if (_ch_Description) delete _ch_Description; 02931 _ch_Description = ( Description *) child; 02932 setParentInChild(child); 02933 found = true; 02934 } 02935 else if (child->nodeType() == Data::sta_nodeType()) { 02936 if (_ch_Data) delete _ch_Data; 02937 _ch_Data = ( Data *) child; 02938 setParentInChild(child); 02939 found = true; 02940 } 02941 else if (child->nodeType() == Field::sta_nodeType()) { 02942 int dim = sizeof( Field *) * (_ch_Field_count + 1); 02943 if (_ch_Field_count == 0) _ch_Field = ( Field **) malloc(dim); 02944 else _ch_Field = ( Field **) realloc(_ch_Field, dim); 02945 _ch_Field [_ch_Field_count] = ( Field *) child; 02946 _ch_Field_count++; 02947 setParentInChild(child); 02948 found = true; 02949 } 02950 else if (child->nodeType() == Param::sta_nodeType()) { 02951 int dim = sizeof( Param *) * (_ch_Param_count + 1); 02952 if (_ch_Param_count == 0) _ch_Param = ( Param **) malloc(dim); 02953 else _ch_Param = ( Param **) realloc(_ch_Param, dim); 02954 _ch_Param [_ch_Param_count] = ( Param *) child; 02955 _ch_Param_count++; 02956 setParentInChild(child); 02957 found = true; 02958 } 02959 else if (child->nodeType() == Group::sta_nodeType()) { 02960 int dim = sizeof( Group *) * (_ch_Group_count + 1); 02961 if (_ch_Group_count == 0) _ch_Group = ( Group **) malloc(dim); 02962 else _ch_Group = ( Group **) realloc(_ch_Group, dim); 02963 _ch_Group [_ch_Group_count] = ( Group *) child; 02964 _ch_Group_count++; 02965 setParentInChild(child); 02966 found = true; 02967 } 02968 else if (child->nodeType() == Link::sta_nodeType()) { 02969 int dim = sizeof( Link *) * (_ch_Link_count + 1); 02970 if (_ch_Link_count == 0) _ch_Link = ( Link **) malloc(dim); 02971 else _ch_Link = ( Link **) realloc(_ch_Link, dim); 02972 _ch_Link [_ch_Link_count] = ( Link *) child; 02973 _ch_Link_count++; 02974 setParentInChild(child); 02975 found = true; 02976 } 02977 hk_setChild(child); 02978 return found; 02979 }; 02980 02981 02982 02983 // void hk_reset(); 02984 string filename; 02985 02986 ; 02987 02988 02989 Resource::Resource() { 02990 lnodetype = RESOURCE; 02991 lclassname = "Resource" ; 02992 constructor = true; 02993 reset(); 02994 constructor = false; 02995 } 02996 Resource::~Resource() { 02997 reset(); 02998 } 02999 string Resource::sta_className() { 03000 return "Resource" ; 03001 } 03002 string Resource::sta_nodeName() { 03003 return "RESOURCE" ; 03004 } 03005 enum Nodetype Resource::sta_nodeType() { 03006 return RESOURCE; 03007 } 03008 string Resource::ID() { 03009 return _ID; 03010 } 03011 bool Resource::ID_isNull() { 03012 return _ID_isnull; 03013 } 03014 string Resource::name() { 03015 return _name; 03016 } 03017 bool Resource::name_isNull() { 03018 return _name_isnull; 03019 } 03020 string Resource::utype() { 03021 return _utype; 03022 } 03023 bool Resource::utype_isNull() { 03024 return _utype_isnull; 03025 } 03026 enum Resource_type Resource::type() { 03027 return _type; 03028 } 03029 bool Resource::type_isNull() { 03030 return _type_isnull; 03031 } 03032 Description * Resource::description() { 03033 return _ch_Description; 03034 } 03035 Info * Resource::info(unsigned int i ) { 03036 if (i >= _ch_Info_count) throw MCS_ERROR( MSG_VOT_INVALID_INDEX, "", i); 03037 else return (_ch_Info [i]); 03038 } 03039 unsigned int Resource::info_count() { 03040 return _ch_Info_count; 03041 } 03042 Coosys * Resource::coosys(unsigned int i ) { 03043 if (i >= _ch_Coosys_count) throw MCS_ERROR( MSG_VOT_INVALID_INDEX, "", i); 03044 else return (_ch_Coosys [i]); 03045 } 03046 unsigned int Resource::coosys_count() { 03047 return _ch_Coosys_count; 03048 } 03049 Param * Resource::param(unsigned int i ) { 03050 if (i >= _ch_Param_count) throw MCS_ERROR( MSG_VOT_INVALID_INDEX, "", i); 03051 else return (_ch_Param [i]); 03052 } 03053 unsigned int Resource::param_count() { 03054 return _ch_Param_count; 03055 } 03056 Link * Resource::link(unsigned int i ) { 03057 if (i >= _ch_Link_count) throw MCS_ERROR( MSG_VOT_INVALID_INDEX, "", i); 03058 else return (_ch_Link [i]); 03059 } 03060 unsigned int Resource::link_count() { 03061 return _ch_Link_count; 03062 } 03063 Table * Resource::table(unsigned int i ) { 03064 if (i >= _ch_Table_count) throw MCS_ERROR( MSG_VOT_INVALID_INDEX, "", i); 03065 else return (_ch_Table [i]); 03066 } 03067 unsigned int Resource::table_count() { 03068 return _ch_Table_count; 03069 } 03070 Resource * Resource::resource(unsigned int i ) { 03071 if (i >= _ch_Resource_count) throw MCS_ERROR( MSG_VOT_INVALID_INDEX, "", i); 03072 else return (_ch_Resource [i]); 03073 } 03074 unsigned int Resource::resource_count() { 03075 return _ch_Resource_count; 03076 } 03077 void Resource::print(bool verbose) { 03078 cout << space_indent(depth()) << "NODE " << sta_className() << " (" << ord() << ")" << endl; 03079 if (verbose) { 03080 cout << space_indent(depth()) << "ATTR " << "ID" << ": "; 03081 if (! _ID_isnull) cout << _ID; 03082 cout << "|" << endl; 03083 } 03084 else if (! _ID_isnull) cout << space_indent(depth()) << "ATTR " << "ID" << endl; 03085 if (verbose) { 03086 cout << space_indent(depth()) << "ATTR " << "name" << ": "; 03087 if (! _name_isnull) cout << _name; 03088 cout << "|" << endl; 03089 } 03090 else if (! _name_isnull) cout << space_indent(depth()) << "ATTR " << "name" << endl; 03091 if (verbose) { 03092 cout << space_indent(depth()) << "ATTR " << "utype" << ": "; 03093 if (! _utype_isnull) cout << _utype; 03094 cout << "|" << endl; 03095 } 03096 else if (! _utype_isnull) cout << space_indent(depth()) << "ATTR " << "utype" << endl; 03097 if (verbose) { 03098 cout << space_indent(depth()) << "ATTR " << "type" << ": "; 03099 if (! _type_isnull) cout << _type; 03100 cout << "|" << endl; 03101 } 03102 else if (! _type_isnull) cout << space_indent(depth()) << "ATTR " << "type" << endl; 03103 if ((verbose) || (_ch_Description)) { 03104 cout << space_indent(depth()) << "CHILD " << "Description"; 03105 if (! _ch_Description) cout << "0" << endl; 03106 else { 03107 cout << endl; 03108 _ch_Description->print(verbose); 03109 } 03110 } if ((verbose) || (_ch_Info_count)) { 03111 cout << space_indent(depth()) << "CHILD " << "Info" << " elements: " << _ch_Info_count << endl; 03112 for (unsigned int i=0; 03113 i < _ch_Info_count; 03114 i++) _ch_Info[i]->print(verbose); 03115 } 03116 if ((verbose) || (_ch_Coosys_count)) { 03117 cout << space_indent(depth()) << "CHILD " << "Coosys" << " elements: " << _ch_Coosys_count << endl; 03118 for (unsigned int i=0; 03119 i < _ch_Coosys_count; 03120 i++) _ch_Coosys[i]->print(verbose); 03121 } 03122 if ((verbose) || (_ch_Param_count)) { 03123 cout << space_indent(depth()) << "CHILD " << "Param" << " elements: " << _ch_Param_count << endl; 03124 for (unsigned int i=0; 03125 i < _ch_Param_count; 03126 i++) _ch_Param[i]->print(verbose); 03127 } 03128 if ((verbose) || (_ch_Link_count)) { 03129 cout << space_indent(depth()) << "CHILD " << "Link" << " elements: " << _ch_Link_count << endl; 03130 for (unsigned int i=0; 03131 i < _ch_Link_count; 03132 i++) _ch_Link[i]->print(verbose); 03133 } 03134 if ((verbose) || (_ch_Table_count)) { 03135 cout << space_indent(depth()) << "CHILD " << "Table" << " elements: " << _ch_Table_count << endl; 03136 for (unsigned int i=0; 03137 i < _ch_Table_count; 03138 i++) _ch_Table[i]->print(verbose); 03139 } 03140 if ((verbose) || (_ch_Resource_count)) { 03141 cout << space_indent(depth()) << "CHILD " << "Resource" << " elements: " << _ch_Resource_count << endl; 03142 for (unsigned int i=0; 03143 i < _ch_Resource_count; 03144 i++) _ch_Resource[i]->print(verbose); 03145 } 03146 } void Resource::reset() { 03147 lparent = NULL; 03148 lnext = NULL; 03149 lprev = NULL; 03150 _ID_isnull = true; 03151 _name_isnull = true; 03152 _utype_isnull = true; 03153 _type_isnull = true; 03154 if (constructor) _ch_Description = NULL; 03155 else if (_ch_Description) { 03156 delete _ch_Description; 03157 _ch_Description = NULL; 03158 } 03159 if (constructor) _ch_Info = NULL; 03160 else if (_ch_Info_count) { 03161 for (unsigned int i=0; 03162 i < _ch_Info_count; 03163 i++) delete (_ch_Info [i]); 03164 free(_ch_Info); 03165 _ch_Info = NULL; 03166 } 03167 _ch_Info_count = 0; 03168 if (constructor) _ch_Coosys = NULL; 03169 else if (_ch_Coosys_count) { 03170 for (unsigned int i=0; 03171 i < _ch_Coosys_count; 03172 i++) delete (_ch_Coosys [i]); 03173 free(_ch_Coosys); 03174 _ch_Coosys = NULL; 03175 } 03176 _ch_Coosys_count = 0; 03177 if (constructor) _ch_Param = NULL; 03178 else if (_ch_Param_count) { 03179 for (unsigned int i=0; 03180 i < _ch_Param_count; 03181 i++) delete (_ch_Param [i]); 03182 free(_ch_Param); 03183 _ch_Param = NULL; 03184 } 03185 _ch_Param_count = 0; 03186 if (constructor) _ch_Link = NULL; 03187 else if (_ch_Link_count) { 03188 for (unsigned int i=0; 03189 i < _ch_Link_count; 03190 i++) delete (_ch_Link [i]); 03191 free(_ch_Link); 03192 _ch_Link = NULL; 03193 } 03194 _ch_Link_count = 0; 03195 if (constructor) _ch_Table = NULL; 03196 else if (_ch_Table_count) { 03197 for (unsigned int i=0; 03198 i < _ch_Table_count; 03199 i++) delete (_ch_Table [i]); 03200 free(_ch_Table); 03201 _ch_Table = NULL; 03202 } 03203 _ch_Table_count = 0; 03204 if (constructor) _ch_Resource = NULL; 03205 else if (_ch_Resource_count) { 03206 for (unsigned int i=0; 03207 i < _ch_Resource_count; 03208 i++) delete (_ch_Resource [i]); 03209 free(_ch_Resource); 03210 _ch_Resource = NULL; 03211 } 03212 _ch_Resource_count = 0; 03213 hk_reset(); 03214 } 03215 bool Resource::setAttribute(string name, string value) { 03216 bool found = false; 03217 if (0) ; 03218 else if (strcmp(name.c_str(), "ID") == 0) { 03219 _ID = string(value); 03220 _ID_isnull = false; 03221 ; found = true; 03222 } 03223 else if (strcmp(name.c_str(), "name") == 0) { 03224 _name = string(value); 03225 _name_isnull = false; 03226 ; found = true; 03227 } 03228 else if (strcmp(name.c_str(), "utype") == 0) { 03229 _utype = string(value); 03230 _utype_isnull = false; 03231 ; found = true; 03232 } 03233 else if (strcmp(name.c_str(), "type") == 0) { 03234 _type = Element::sto_Resource_type(value); 03235 _type_isnull = false; 03236 ; found = true; 03237 } 03238 hk_setAttribute(name, value); 03239 return found; 03240 } 03241 bool Resource::setChild(Element* child) { 03242 bool found = false; 03243 if (0) ; 03244 else if (child->nodeType() == Description::sta_nodeType()) { 03245 if (_ch_Description) delete _ch_Description; 03246 _ch_Description = ( Description *) child; 03247 setParentInChild(child); 03248 found = true; 03249 } 03250 else if (child->nodeType() == Info::sta_nodeType()) { 03251 int dim = sizeof( Info *) * (_ch_Info_count + 1); 03252 if (_ch_Info_count == 0) _ch_Info = ( Info **) malloc(dim); 03253 else _ch_Info = ( Info **) realloc(_ch_Info, dim); 03254 _ch_Info [_ch_Info_count] = ( Info *) child; 03255 _ch_Info_count++; 03256 setParentInChild(child); 03257 found = true; 03258 } 03259 else if (child->nodeType() == Coosys::sta_nodeType()) { 03260 int dim = sizeof( Coosys *) * (_ch_Coosys_count + 1); 03261 if (_ch_Coosys_count == 0) _ch_Coosys = ( Coosys **) malloc(dim); 03262 else _ch_Coosys = ( Coosys **) realloc(_ch_Coosys, dim); 03263 _ch_Coosys [_ch_Coosys_count] = ( Coosys *) child; 03264 _ch_Coosys_count++; 03265 setParentInChild(child); 03266 found = true; 03267 } 03268 else if (child->nodeType() == Param::sta_nodeType()) { 03269 int dim = sizeof( Param *) * (_ch_Param_count + 1); 03270 if (_ch_Param_count == 0) _ch_Param = ( Param **) malloc(dim); 03271 else _ch_Param = ( Param **) realloc(_ch_Param, dim); 03272 _ch_Param [_ch_Param_count] = ( Param *) child; 03273 _ch_Param_count++; 03274 setParentInChild(child); 03275 found = true; 03276 } 03277 else if (child->nodeType() == Link::sta_nodeType()) { 03278 int dim = sizeof( Link *) * (_ch_Link_count + 1); 03279 if (_ch_Link_count == 0) _ch_Link = ( Link **) malloc(dim); 03280 else _ch_Link = ( Link **) realloc(_ch_Link, dim); 03281 _ch_Link [_ch_Link_count] = ( Link *) child; 03282 _ch_Link_count++; 03283 setParentInChild(child); 03284 found = true; 03285 } 03286 else if (child->nodeType() == Table::sta_nodeType()) { 03287 int dim = sizeof( Table *) * (_ch_Table_count + 1); 03288 if (_ch_Table_count == 0) _ch_Table = ( Table **) malloc(dim); 03289 else _ch_Table = ( Table **) realloc(_ch_Table, dim); 03290 _ch_Table [_ch_Table_count] = ( Table *) child; 03291 _ch_Table_count++; 03292 setParentInChild(child); 03293 found = true; 03294 } 03295 else if (child->nodeType() == Resource::sta_nodeType()) { 03296 int dim = sizeof( Resource *) * (_ch_Resource_count + 1); 03297 if (_ch_Resource_count == 0) _ch_Resource = ( Resource **) malloc(dim); 03298 else _ch_Resource = ( Resource **) realloc(_ch_Resource, dim); 03299 _ch_Resource [_ch_Resource_count] = ( Resource *) child; 03300 _ch_Resource_count++; 03301 setParentInChild(child); 03302 found = true; 03303 } 03304 hk_setChild(child); 03305 return found; 03306 }; 03307 03308 03309 ; 03310 03311 03312 Definitions::Definitions() { 03313 lnodetype = DEFINITIONS; 03314 lclassname = "Definitions" ; 03315 constructor = true; 03316 reset(); 03317 constructor = false; 03318 } 03319 Definitions::~Definitions() { 03320 reset(); 03321 } 03322 string Definitions::sta_className() { 03323 return "Definitions" ; 03324 } 03325 string Definitions::sta_nodeName() { 03326 return "DEFINITIONS" ; 03327 } 03328 enum Nodetype Definitions::sta_nodeType() { 03329 return DEFINITIONS; 03330 } 03331 Coosys * Definitions::coosys(unsigned int i ) { 03332 if (i >= _ch_Coosys_count) throw MCS_ERROR( MSG_VOT_INVALID_INDEX, "", i); 03333 else return (_ch_Coosys [i]); 03334 } 03335 unsigned int Definitions::coosys_count() { 03336 return _ch_Coosys_count; 03337 } 03338 void Definitions::print(bool verbose) { 03339 cout << space_indent(depth()) << "NODE " << sta_className() << " (" << ord() << ")" << endl; 03340 if ((verbose) || (_ch_Coosys_count)) { 03341 cout << space_indent(depth()) << "CHILD " << "Coosys" << " elements: " << _ch_Coosys_count << endl; 03342 for (unsigned int i=0; 03343 i < _ch_Coosys_count; 03344 i++) _ch_Coosys[i]->print(verbose); 03345 } 03346 } void Definitions::reset() { 03347 lparent = NULL; 03348 lnext = NULL; 03349 lprev = NULL; 03350 if (constructor) _ch_Coosys = NULL; 03351 else if (_ch_Coosys_count) { 03352 for (unsigned int i=0; 03353 i < _ch_Coosys_count; 03354 i++) delete (_ch_Coosys [i]); 03355 free(_ch_Coosys); 03356 _ch_Coosys = NULL; 03357 } 03358 _ch_Coosys_count = 0; 03359 hk_reset(); 03360 } 03361 bool Definitions::setAttribute(string name, string value) { 03362 bool found = false; 03363 if (0) ; 03364 hk_setAttribute(name, value); 03365 return found; 03366 } 03367 bool Definitions::setChild(Element* child) { 03368 bool found = false; 03369 if (0) ; 03370 else if (child->nodeType() == Coosys::sta_nodeType()) { 03371 int dim = sizeof( Coosys *) * (_ch_Coosys_count + 1); 03372 if (_ch_Coosys_count == 0) _ch_Coosys = ( Coosys **) malloc(dim); 03373 else _ch_Coosys = ( Coosys **) realloc(_ch_Coosys, dim); 03374 _ch_Coosys [_ch_Coosys_count] = ( Coosys *) child; 03375 _ch_Coosys_count++; 03376 setParentInChild(child); 03377 found = true; 03378 } 03379 hk_setChild(child); 03380 return found; 03381 }; 03382 03383 03384 ; 03385 03386 03387 VOTable::VOTable() { 03388 lnodetype = VOTABLE; 03389 lclassname = "VOTable" ; 03390 constructor = true; 03391 reset(); 03392 constructor = false; 03393 } 03394 VOTable::~VOTable() { 03395 reset(); 03396 } 03397 string VOTable::sta_className() { 03398 return "VOTable" ; 03399 } 03400 string VOTable::sta_nodeName() { 03401 return "VOTABLE" ; 03402 } 03403 enum Nodetype VOTable::sta_nodeType() { 03404 return VOTABLE; 03405 } 03406 string VOTable::xmlns() { 03407 return _xmlns; 03408 } 03409 bool VOTable::xmlns_isNull() { 03410 return _xmlns_isnull; 03411 } 03412 string VOTable::ID() { 03413 return _ID; 03414 } 03415 bool VOTable::ID_isNull() { 03416 return _ID_isnull; 03417 } 03418 string VOTable::version() { 03419 return _version; 03420 } 03421 bool VOTable::version_isNull() { 03422 return _version_isnull; 03423 } 03424 Description * VOTable::description() { 03425 return _ch_Description; 03426 } 03427 Definitions * VOTable::definitions() { 03428 return _ch_Definitions; 03429 } 03430 Coosys * VOTable::coosys(unsigned int i ) { 03431 if (i >= _ch_Coosys_count) throw MCS_ERROR( MSG_VOT_INVALID_INDEX, "", i); 03432 else return (_ch_Coosys [i]); 03433 } 03434 unsigned int VOTable::coosys_count() { 03435 return _ch_Coosys_count; 03436 } 03437 Param * VOTable::param(unsigned int i ) { 03438 if (i >= _ch_Param_count) throw MCS_ERROR( MSG_VOT_INVALID_INDEX, "", i); 03439 else return (_ch_Param [i]); 03440 } 03441 unsigned int VOTable::param_count() { 03442 return _ch_Param_count; 03443 } 03444 Info * VOTable::info(unsigned int i ) { 03445 if (i >= _ch_Info_count) throw MCS_ERROR( MSG_VOT_INVALID_INDEX, "", i); 03446 else return (_ch_Info [i]); 03447 } 03448 unsigned int VOTable::info_count() { 03449 return _ch_Info_count; 03450 } 03451 Resource * VOTable::resource(unsigned int i ) { 03452 if (i >= _ch_Resource_count) throw MCS_ERROR( MSG_VOT_INVALID_INDEX, "", i); 03453 else return (_ch_Resource [i]); 03454 } 03455 unsigned int VOTable::resource_count() { 03456 return _ch_Resource_count; 03457 } 03458 void VOTable::print(bool verbose) { 03459 cout << space_indent(depth()) << "NODE " << sta_className() << " (" << ord() << ")" << endl; 03460 if (verbose) { 03461 cout << space_indent(depth()) << "ATTR " << "xmlns" << ": "; 03462 if (! _xmlns_isnull) cout << _xmlns; 03463 cout << "|" << endl; 03464 } 03465 else if (! _xmlns_isnull) cout << space_indent(depth()) << "ATTR " << "xmlns" << endl; 03466 if (verbose) { 03467 cout << space_indent(depth()) << "ATTR " << "ID" << ": "; 03468 if (! _ID_isnull) cout << _ID; 03469 cout << "|" << endl; 03470 } 03471 else if (! _ID_isnull) cout << space_indent(depth()) << "ATTR " << "ID" << endl; 03472 if (verbose) { 03473 cout << space_indent(depth()) << "ATTR " << "version" << ": "; 03474 if (! _version_isnull) cout << _version; 03475 cout << "|" << endl; 03476 } 03477 else if (! _version_isnull) cout << space_indent(depth()) << "ATTR " << "version" << endl; 03478 if ((verbose) || (_ch_Description)) { 03479 cout << space_indent(depth()) << "CHILD " << "Description"; 03480 if (! _ch_Description) cout << "0" << endl; 03481 else { 03482 cout << endl; 03483 _ch_Description->print(verbose); 03484 } 03485 } if ((verbose) || (_ch_Definitions)) { 03486 cout << space_indent(depth()) << "CHILD " << "Definitions"; 03487 if (! _ch_Definitions) cout << "0" << endl; 03488 else { 03489 cout << endl; 03490 _ch_Definitions->print(verbose); 03491 } 03492 } if ((verbose) || (_ch_Coosys_count)) { 03493 cout << space_indent(depth()) << "CHILD " << "Coosys" << " elements: " << _ch_Coosys_count << endl; 03494 for (unsigned int i=0; 03495 i < _ch_Coosys_count; 03496 i++) _ch_Coosys[i]->print(verbose); 03497 } 03498 if ((verbose) || (_ch_Param_count)) { 03499 cout << space_indent(depth()) << "CHILD " << "Param" << " elements: " << _ch_Param_count << endl; 03500 for (unsigned int i=0; 03501 i < _ch_Param_count; 03502 i++) _ch_Param[i]->print(verbose); 03503 } 03504 if ((verbose) || (_ch_Info_count)) { 03505 cout << space_indent(depth()) << "CHILD " << "Info" << " elements: " << _ch_Info_count << endl; 03506 for (unsigned int i=0; 03507 i < _ch_Info_count; 03508 i++) _ch_Info[i]->print(verbose); 03509 } 03510 if ((verbose) || (_ch_Resource_count)) { 03511 cout << space_indent(depth()) << "CHILD " << "Resource" << " elements: " << _ch_Resource_count << endl; 03512 for (unsigned int i=0; 03513 i < _ch_Resource_count; 03514 i++) _ch_Resource[i]->print(verbose); 03515 } 03516 } void VOTable::reset() { 03517 lparent = NULL; 03518 lnext = NULL; 03519 lprev = NULL; 03520 _xmlns_isnull = true; 03521 _ID_isnull = true; 03522 _version_isnull = true; 03523 if (constructor) _ch_Description = NULL; 03524 else if (_ch_Description) { 03525 delete _ch_Description; 03526 _ch_Description = NULL; 03527 } 03528 if (constructor) _ch_Definitions = NULL; 03529 else if (_ch_Definitions) { 03530 delete _ch_Definitions; 03531 _ch_Definitions = NULL; 03532 } 03533 if (constructor) _ch_Coosys = NULL; 03534 else if (_ch_Coosys_count) { 03535 for (unsigned int i=0; 03536 i < _ch_Coosys_count; 03537 i++) delete (_ch_Coosys [i]); 03538 free(_ch_Coosys); 03539 _ch_Coosys = NULL; 03540 } 03541 _ch_Coosys_count = 0; 03542 if (constructor) _ch_Param = NULL; 03543 else if (_ch_Param_count) { 03544 for (unsigned int i=0; 03545 i < _ch_Param_count; 03546 i++) delete (_ch_Param [i]); 03547 free(_ch_Param); 03548 _ch_Param = NULL; 03549 } 03550 _ch_Param_count = 0; 03551 if (constructor) _ch_Info = NULL; 03552 else if (_ch_Info_count) { 03553 for (unsigned int i=0; 03554 i < _ch_Info_count; 03555 i++) delete (_ch_Info [i]); 03556 free(_ch_Info); 03557 _ch_Info = NULL; 03558 } 03559 _ch_Info_count = 0; 03560 if (constructor) _ch_Resource = NULL; 03561 else if (_ch_Resource_count) { 03562 for (unsigned int i=0; 03563 i < _ch_Resource_count; 03564 i++) delete (_ch_Resource [i]); 03565 free(_ch_Resource); 03566 _ch_Resource = NULL; 03567 } 03568 _ch_Resource_count = 0; 03569 hk_reset(); 03570 } 03571 bool VOTable::setAttribute(string name, string value) { 03572 bool found = false; 03573 if (0) ; 03574 else if (strcmp(name.c_str(), "xmlns") == 0) { 03575 _xmlns = string(value); 03576 _xmlns_isnull = false; 03577 ; found = true; 03578 } 03579 else if (strcmp(name.c_str(), "ID") == 0) { 03580 _ID = string(value); 03581 _ID_isnull = false; 03582 ; found = true; 03583 } 03584 else if (strcmp(name.c_str(), "version") == 0) { 03585 _version = string(value); 03586 _version_isnull = false; 03587 ; found = true; 03588 } 03589 hk_setAttribute(name, value); 03590 return found; 03591 } 03592 bool VOTable::setChild(Element* child) { 03593 bool found = false; 03594 if (0) ; 03595 else if (child->nodeType() == Description::sta_nodeType()) { 03596 if (_ch_Description) delete _ch_Description; 03597 _ch_Description = ( Description *) child; 03598 setParentInChild(child); 03599 found = true; 03600 } 03601 else if (child->nodeType() == Definitions::sta_nodeType()) { 03602 if (_ch_Definitions) delete _ch_Definitions; 03603 _ch_Definitions = ( Definitions *) child; 03604 setParentInChild(child); 03605 found = true; 03606 } 03607 else if (child->nodeType() == Coosys::sta_nodeType()) { 03608 int dim = sizeof( Coosys *) * (_ch_Coosys_count + 1); 03609 if (_ch_Coosys_count == 0) _ch_Coosys = ( Coosys **) malloc(dim); 03610 else _ch_Coosys = ( Coosys **) realloc(_ch_Coosys, dim); 03611 _ch_Coosys [_ch_Coosys_count] = ( Coosys *) child; 03612 _ch_Coosys_count++; 03613 setParentInChild(child); 03614 found = true; 03615 } 03616 else if (child->nodeType() == Param::sta_nodeType()) { 03617 int dim = sizeof( Param *) * (_ch_Param_count + 1); 03618 if (_ch_Param_count == 0) _ch_Param = ( Param **) malloc(dim); 03619 else _ch_Param = ( Param **) realloc(_ch_Param, dim); 03620 _ch_Param [_ch_Param_count] = ( Param *) child; 03621 _ch_Param_count++; 03622 setParentInChild(child); 03623 found = true; 03624 } 03625 else if (child->nodeType() == Info::sta_nodeType()) { 03626 int dim = sizeof( Info *) * (_ch_Info_count + 1); 03627 if (_ch_Info_count == 0) _ch_Info = ( Info **) malloc(dim); 03628 else _ch_Info = ( Info **) realloc(_ch_Info, dim); 03629 _ch_Info [_ch_Info_count] = ( Info *) child; 03630 _ch_Info_count++; 03631 setParentInChild(child); 03632 found = true; 03633 } 03634 else if (child->nodeType() == Resource::sta_nodeType()) { 03635 int dim = sizeof( Resource *) * (_ch_Resource_count + 1); 03636 if (_ch_Resource_count == 0) _ch_Resource = ( Resource **) malloc(dim); 03637 else _ch_Resource = ( Resource **) realloc(_ch_Resource, dim); 03638 _ch_Resource [_ch_Resource_count] = ( Resource *) child; 03639 _ch_Resource_count++; 03640 setParentInChild(child); 03641 found = true; 03642 } 03643 hk_setChild(child); 03644 return found; 03645 }; 03646 03647 03648 ; 03649 03650 03651 typedef union NodePointer { 03652 votpp::Element *element; 03653 votpp::VOTable *votable; 03654 votpp::Resource *resource; 03655 votpp::Description *description; 03656 votpp::Definitions *definitions; 03657 votpp::Info *info; 03658 votpp::Param *param; 03659 votpp::Table *table; 03660 votpp::Field *field; 03661 votpp::Group *group; 03662 votpp::FieldRef *fieldref; 03663 votpp::ParamRef *paramref; 03664 votpp::Values *values; 03665 votpp::Min *min; 03666 votpp::Max *max; 03667 votpp::Option *option; 03668 votpp::Link *link; 03669 votpp::Data *data; 03670 votpp::Tabledata *tabledata; 03671 votpp::Column *column; 03672 votpp::Row *row; 03673 votpp::Fits *fits; 03674 votpp::Binary *binary; 03675 votpp::Stream *stream; 03676 votpp::Coosys *coosys; 03677 };
VOTPP (VOTable C++ Parser) ver. 0.3.2-alpha1
|