/[smarc]/smarc/src/vmachine/circuit.h
ViewVC logotype

Diff of /smarc/src/vmachine/circuit.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.3 by misto, Tue Dec 3 15:36:16 2002 UTC revision 1.4 by misto, Sat Dec 28 12:45:29 2002 UTC
# Line 27  Line 27 
27  #include <vector>  #include <vector>
28  #include "exception.h"  #include "exception.h"
29    
30    class vmachine;
31    
32  class circuit {  class circuit {
33          private:          private:
34                  int nin,  nout;                  int nin,  nout;
# Line 35  class circuit { Line 37  class circuit {
37          public:          public:
38                  circuit(int nin, int nout )                  circuit(int nin, int nout )
39                          : nin(nin), nout(nout), in(nin), out(nout) {}                          : nin(nin), nout(nout), in(nin), out(nout) {}
40                  unsigned long get_in( int n ) {                  unsigned long get_in( int n );
41                          if ( n < nin )                  void set_out_all( unsigned long val );
42                                  return in[n];                  void set_out( int n, unsigned long val );
43                          else                  void link( int n, circuit c, int m );
                                 throw ex<circuit>("circuit::get_in: "  
                                         "getting invalid input");  
                 }  
                 void set_out( int n, unsigned long val ) {  
                         if ( n < nout )  
                                 *(out[n]) = val;  
                         else  
                                 throw ex<circuit>("circuit::set_out: "  
                                         "setting invalid output");  
                 }  
                 void link( int n, circuit c, int m ) {  
                         if ( n < nout || m < c.nin )  
                                 out[n] = &(c.in[m]);  
                         else  
                                 throw ex<circuit>("circuit::link: "  
                                         "linking to invalid output");  
                 }  
44                  int num_in( void ) {return nin;}                  int num_in( void ) {return nin;}
45                  int num_out( void ) {return nout;}                  int num_out( void ) {return nout;}
46  };  };

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.4

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26