Mutator.h
Go to the documentation of this file.00001 #ifndef MUTATOR_H
00002 #define MUTATOR_H
00003
00004 #include <iomanip>
00005 #include <errno.h>
00006 #include <iostream>
00007 #include <fstream>
00008 #include <sstream>
00009 #include <list>
00010 #include <string>
00011 #include <map>
00012 #include <vector>
00013 #include <time.h>
00014 #include <stdio.h>
00015 #include <math.h>
00016 #include <stdlib.h>
00017 #include "../../lib/StringUtils.h"
00018 #include "Ttable.h"
00019
00020
00021
00023 static inline string IntToStr(int x)
00024 {
00025 ostringstream o;
00026 if (!(o << x))
00027 printf("Error in conversion from int to string \n");
00028 return o.str();
00029 }
00030
00032 static inline string FltToStr(float x)
00033 {
00034 ostringstream o;
00035 if (!(o << x))
00036 printf("Error in conversion from float to string \n");
00037 return o.str();
00038 }
00039
00043 class Mutator
00044 {
00045 friend class Ttable;
00046 public:
00048 Mutator( void ){};
00050 ~Mutator( void ) {};
00051
00052
00053
00054
00055
00056
00057 void randomizeInputs( const string &, const string &, const float & );
00058 void randomizeInputs2( const string &, const string &, const float & );
00059 void mutateTables( const string &, const string &, const float & );
00060 private:
00061 vector<Ttable*> tables;
00062
00063 map<string,vector<int> > nodeLst;
00064 int numOfLines( void );
00065 int numOfNodeInputs( void );
00066 bool cchainToTables( const string & );
00067 bool tablesToCChain( const string & );
00068 void addNodes( const vector<string> & );
00069 void addNode( const string &, const int & );
00070 void adjustOutDegree( const vector<string> & );
00071 vector<string> nodesWithOutDeg( const int & );
00072 void printNodes( );
00074 int find_id( const string & );
00076 string find_name( const int & );
00078 void print_nodes( void );
00079
00080 void show_tables( void );
00081
00083 bool read_nodes( const string & );
00085 bool read_tables( const bool & );
00086 void err_exit( const string & );
00087 vector<string> get_states( Ttable &, const bool & );
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00100 void decToBin( int, string & );
00101 };
00102 #endif