Version 4.0.0
Main Page | Class Hierarchy | Class List | File List | Class Members | Related Pages

node_base.h

00001 /* seqpp/node_base.h
00002  *
00003  * Copyright (C) 2003 Laboratoire Statistique & Génome
00004  *
00005  * This program is free software; you can redistribute it and/or modify
00006  * it under the terms of the GNU General Public License as published by
00007  * the Free Software Foundation; either version 2 of the License, or (at
00008  * your option) any later version.
00009  *
00010  * This program is distributed in the hope that it will be useful, but
00011  * WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013  * General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU General Public License
00016  * along with this program; if not, write to the Free Software
00017  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00018  */
00019 
00020 
00029 #ifndef SEQPP_NODE_BASE_H
00030 #define SEQPP_NODE_BASE_H
00031 
00032 #include <vector>
00033 #include <map>
00034 #include <string>
00035 #include <sstream>
00036 #include <fstream>
00037 #include <iostream>
00038 #include <seqpp/Translator.h>
00039 
00040 #include <config.h>
00041 #ifdef HAVE_LIBXML2
00042 #include <libxml/tree.h>
00043 #endif
00044 using namespace std ;
00045 
00046 
00054 class node_base {
00055  public:
00057   node_base(int motif, node_base * father, short alphabet_size) ;
00058  
00060   virtual ~node_base(){
00061     //cout<<"node_base destry"<<endl;
00062   };
00063 
00065   vector<int> & tellPath() ;
00066 
00068   inline node_base * tellFather() { return _father ; } ;
00069 
00071   inline int tellMotif() { return _motif ; } ;
00072 
00074   int tellLevel() ;
00076   virtual bool isLeaf() = 0 ;
00077 
00078   // displays the id of a node 
00079   // and a status true whether it has been saved
00080   class status_node{
00081   public:
00082     bool status;
00083     string id_node;
00084     status_node(){
00085       status=false;
00086       id_node="";
00087     }
00088     status_node(const status_node & s){
00089       status=s.status;
00090       id_node=s.id_node;
00091     }
00092 
00093     ~status_node(){};
00094     bool operator==(const status_node & s) const{
00095       return( (status==s.status) && (id_node==s.id_node) );
00096     } 
00097     status_node& operator=(const status_node & s){
00098       status=s.status;
00099       id_node=s.id_node;
00100       return *this;
00101     } 
00102   };
00103 
00104   #ifdef HAVE_LIBXML2
00105   virtual void save_r( const Translator & trans, 
00106                        const vector< vector<short> > & synonymous,
00107                        const vector< vector<short> > & list,  
00108                        xmlNodePtr, 
00109                        map< node_base*, status_node > & catalog, 
00110                        int & current_id, int level ) = 0;
00111   #endif
00112 
00113   virtual void pmm_to_matrix_r( double* mat, 
00114                                 const vector< vector<short> > & synonymous,
00115                                 const vector< vector<short> > & list,  
00116                                 short extended_phase, 
00117                                 vector<long > & vect_code,
00118                                 long bound ) = 0;  
00119   
00120 
00121  protected:
00122   int _motif ; 
00123   
00124   vector<int> _vpath; 
00125 
00126   node_base * _father ; 
00127 
00128 
00129   int _alphabet_size;
00130 };
00131 #endif 
00132 



Download seq++ 4.0.0
Download previous versions
Statistique & Genome Home


Generated on Sun Apr 3 14:16:10 2005 for seqpp by doxygen 1.3.9.1