Back to home page

EIC code displayed by LXR

 
 

    


Warning, /include/Geant4/toolx/raxml is written in an unsupported language. File is not indexed.

0001 // Copyright (C) 2010, Guy Barrand. All rights reserved.
0002 // See the file tools.license for terms.
0003 
0004 #ifndef toolx_raxml
0005 #define toolx_raxml
0006 
0007 #include <tools/xml/aidas>
0008 
0009 #include "xml/loader"
0010 
0011 namespace toolx {
0012 
0013 class raxml : public tools::xml::aidas, public xml::loader {
0014   typedef tools::xml::aidas parent_aidas;
0015   typedef xml::loader parent;
0016 public:
0017   raxml(tools::xml::factory& a_fac,std::ostream& a_out,bool a_verbose = false)
0018   :parent_aidas()
0019   ,parent(a_fac,a_out,a_verbose)
0020   ,m_read_tag(0)
0021   {
0022     set_default_tags(parent::m_tags);
0023   }
0024   virtual ~raxml() {}
0025 public:
0026   void set_read_tag(void* a_tag) {m_read_tag = a_tag;}
0027 protected:
0028   raxml(const raxml& a_from)
0029   :parent_aidas(a_from)
0030   ,parent(a_from)
0031   {}
0032   raxml& operator=(const raxml& a_from){
0033     parent_aidas::operator=(a_from);
0034     parent::operator=(a_from);
0035     return *this;
0036   }
0037 public:
0038   bool load_file(const std::string& a_file,bool a_compressed){
0039     m_objects.clear();
0040     if(!parent::load_file(a_file,a_compressed)) return false;
0041     tools::xml::tree* top = top_item();
0042     if(!top) return false;
0043     const std::string& tag_name = top->tag_name();
0044     if(tag_name!=s_aida()) return false;
0045 
0046    {tools::xml::looper _for(*top);
0047     while(tools::xml::tree* _tree = _for.next_tree()) {
0048 
0049       const std::string& _tag_name = _tree->tag_name();
0050       reader rder = find_reader(_tag_name);
0051       if(!rder) {
0052         m_out << "toolx::raxml::load_file :"
0053               << " reader not found for " << tools::sout(_tag_name)
0054               << std::endl;
0055         //m_objects.clear(); //keep already loaded objects.
0056         return false;
0057       } else {
0058         tools::raxml_out ro = rder(*_tree,m_out,m_verbose,m_read_tag);
0059         if(ro.object()) m_objects.push_back(ro);
0060       }
0061 
0062     }}
0063 
0064     return true;
0065   }
0066 protected:
0067   void* m_read_tag;
0068 };
0069 
0070 }
0071 
0072 #endif