WoMax Documentation

# Oracle_classes.hpp

Go to the documentation of this file.

    00001 /*---------------------------------
    00002  * Oracle_classes.hpp
    00003  * Created on 09/03/09 by BenCello
    00004  *---------------------------------*/
    00005
    00007
    00008 #ifndef __ORACLE_CLASSES_HPP__
    00009 #define __ORACLE_CLASSES_HPP__
    00010
    00011 #include <list>
    00012 #include <vector>
    00013 #include <iostream>
    00014 #include <utility>
    00015 #include <algorithm>
    00016 using namespace std;
    00017
    00018 /* class annonce */ // needed for friendship
    00019 class O_learner;
    00020
    00024 /* FO states class */
    00027 class O_state
    00028 {
    00029 protected:
    00031         int statenb;
    00034         list<O_state*> trans;
    00037         pair<O_state*,int> suff;
    00040         list<pair<O_state*,int> > rsuff;
    00041 public:
    00043
    00044
    00045         O_state();
    00047         O_state(int);
    00049         O_state(const O_state &);
    00051         ~O_state(){};
    00053
    00055
    00056
    00057         int get_statenb();
    00059         void set_statenb(int);
    00061         list<O_state*> get_trans();
    00063         pair<O_state*,int> get_suffix();
    00065         void set_suffix(O_state*,int);
    00067         list<pair<O_state*,int> > get_rsuff();
    00069
    00071
    00072
    00073         void add_trans(O_state*);
    00075         void add_rsuff(const pair<O_state*,int> & rsuffin);
    00077
    00079
    00080
    00081         O_state* rec_upSLT(list<O_state*>*, int = 0);
    00083         list<pair<O_state*,int> >* rec_downSLT(list<pair<O_state*,int> >*, int = 0);
    00085         list<pair<O_state*,int> >* rec_sortSLT(list<pair<O_state*,int> >*, int = 0, int = INT_MAX);
    00087         list<pair<O_state*,int> >* sortedSLT(int = 0, int = INT_MAX);
    00089
    00090
    00092
    00093
    00094         friend ostream & operator<< (ostream &, O_state &);
    00096 };
    00097
    00098 // Sorting function based on @e  lrs
    00099 bool sort_rsuff (pair<O_state*,int>, pair<O_state*,int>);
    00100
    00101 /* FO class */
    00104 class O_oracle
    00105 {
    00106 protected:
    00108         int size;
    00110         vector<O_state*> state_vect;
    00111 public:
    00113
    00114
    00115         O_oracle();
    00117         O_oracle(const O_oracle &);
    00119         ~O_oracle();
    00121
    00123         void freestates();
    00124
    00126
    00127
    00128         int get_size();
    00130
    00132         void start();
    00133
    00135
    00136
    00137         O_state * operator[] (int) const;
    00139         friend ostream & operator<< (ostream &, const O_oracle &);
    00141
    00142         // friends
    00143         friend class O_learner;
    00144 };
    00145
    00148 #endif