Version 4.1.5
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 
00080   int tell_current_visit() const{
00081     return _curr_visit;
00082   }
00084   void set_current_visit(int curr_visit){
00085     _curr_visit = curr_visit;
00086   }
00088   void add_current_visit(){
00089     _curr_visit++;
00090   }
00091 
00092 
00093   // displays the id of a node 
00094   // and a status true whether it has been saved
00095   class status_node{
00096   public:
00097     bool status;
00098     string id_node;
00099     status_node(){
00100       status=false;
00101       id_node="";
00102     }
00103     status_node(const status_node & s){
00104       status=s.status;
00105       id_node=s.id_node;
00106     }
00107 
00108     ~status_node(){};
00109     bool operator==(const status_node & s) const{
00110       return( (status==s.status) && (id_node==s.id_node) );
00111     } 
00112     status_node& operator=(const status_node & s){
00113       status=s.status;
00114       id_node=s.id_node;
00115       return *this;
00116     } 
00117   };
00118 
00119   #ifdef HAVE_LIBXML2
00120   virtual void save_r( const Translator & trans, 
00121                        const vector< vector<short> > & synonymous,
00122                        const vector< vector<short> > & list,  
00123                        xmlNodePtr, 
00124                        map< node_base*, status_node > & catalog, 
00125                        int & current_id, int level ) = 0;
00126   #endif
00127 
00128   virtual void pmm_to_matrix_r( double* mat, 
00129                                 const vector< vector<short> > & synonymous,
00130                                 const vector< vector<short> > & list,  
00131                                 short extended_phase, 
00132                                 vector<long > & vect_code,
00133                                 long bound ) = 0;  
00134   
00135 
00136  protected:
00137   int _motif ; 
00138 
00139   vector<int> _vpath; 
00140   node_base * _father ; 
00141 
00142   int _alphabet_size;
00143 
00144   int _curr_visit;
00145 };
00146 #endif 
00147 



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


Generated on Thu Aug 4 18:34:04 2005 for seqpp by doxygen 1.3.9.1