Generator.h
Go to the documentation of this file.00001
00018 #ifndef GENERATOR_H
00019 #define GENERATOR_H
00020 #include <iomanip>
00021 #include <iostream>
00022 #include <fstream>
00023 #include <sstream>
00024 #include <list>
00025 #include <string>
00026 #include <vector>
00027 #include <time.h>
00028 #include <stdio.h>
00029 #include <math.h>
00030 #include <stdlib.h>
00031
00032 #include "../../lib/StringUtils.h"
00033 #include "GNode.h"
00034
00035 #define INPUT_START 990 //Our input nodes start at 990 (see the node list: nodes.csv)
00036
00037 using namespace std;
00038
00042 static inline string IntToString(int x)
00043 {
00044 ostringstream o;
00045 if (!(o << x))
00046 printf("Error in conversion from int to string \n");
00047 return o.str();
00048 }
00049
00053 static inline string FltToString(float x)
00054 {
00055 ostringstream o;
00056 if (!(o << x))
00057 printf("Error in conversion from float to string \n");
00058 return o.str();
00059 }
00060
00065 class Generator
00066 {
00067 friend class GNode;
00068 public:
00070 Generator( void ) {}
00072 ~Generator( void ) {}
00073 void cchain( const string &, const string &, const bool &, const bool & );
00074 void egen( const string &, const string &, const bool & );
00075 void cchainToTables( const string &, const string & );
00076 void set_tablesPath( const string & );
00077 void printNodesList(string &, string &, string &);
00078 string get_tablesPath( );
00079
00080 private:
00081 int getWord(FILE *, char *, int &, string &, char, bool);
00082 list<GNode> gnodes;
00083 string tablesPath;
00084 list<Input> control_inputs;
00085 int find_id( const string & );
00086 string find_name( const int & );
00087 void print_gnodes( void );
00088 void show_tables( void );
00089 bool read_gnodes( const string & );
00090 bool read_tables( const bool & );
00091 void err_exit( void );
00092 vector<string> get_states( GNode &, const bool & );
00093 string get_function( GNode & );
00094 bool is_gnode( const string & );
00095 int num_1( GNode & );
00096 int num_lines( void );
00097 int num_0( GNode & );
00098 void decToBin( int, string & );
00099 };
00100 #endif