GNode.h

Go to the documentation of this file.
00001 
00018 #include <iostream>
00019 #include <iomanip>
00020 #include <string>
00021 #include <math.h>
00022 #include <list>
00023 
00024 using namespace std;
00025 #ifndef GNODE_H
00026 #define GNODE_H
00027 
00031 struct Input
00032 {
00033     string iname;
00034     int iid;
00035 };
00036 
00040 class GNode
00041 {
00042     friend class Generator;
00043 
00045     friend ostream &operator<<( ostream & os, const GNode & n )
00046     {
00047         return os << n.name << " - " << n.id << " init: " << n.init << " table: " << n.COLS << " by " << n.ROWS << endl;
00048     }
00049 
00050     public:
00052     GNode( )
00053     {
00054         COLS = 0;
00055         ROWS = 0;
00056     }
00058     ~GNode( )
00059     {
00061         /*   for( int i = 0; i < ROWS; ++i)   //When uncommented gives the following error:
00062              free(table[i]);                // *** glibc detected *** double free or corruption (fasttop): 0x09b24c48 ***
00063         //   Aborted
00064 
00065         free(table);*/
00066     };
00068     int nrows( void )
00069     {  return ROWS; }
00071     int ncols( void )
00072     {  return COLS; }
00074     string get_name(void)
00075     {  return name; }
00077     void set( const string & n, const int & i, const int & _init )
00078     {
00079         name = n;
00080         id = i;
00081         init = _init;
00082     }
00083     bool table_init( const int & );
00084     void print_table( void );
00086     void new_input( const Input & n )
00087     {
00088         inputs.push_back(n);
00089     }
00090     void print_inputs( void );        
00092     int get_id( void )
00093     {   return id;  }
00095     int get_init( void )
00096     {   return init; }
00097     
00098     private:
00099     int COLS;
00100     int ROWS;
00101     int init;
00102     string name;
00103     int id;
00104     bool **table;
00105     list<Input> inputs;
00106 };
00107 #endif

Generated on Fri May 7 00:40:41 2010 for ChemChains by  doxygen 1.6.1