[Bio] / RecoElemSBW / RecoElemSBWSampleClient.cc Repository:
ViewVC logotype

Diff of /RecoElemSBW/RecoElemSBWSampleClient.cc

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

revision 1.1, Fri Mar 7 23:27:24 2003 UTC revision 1.2, Fri Apr 11 22:47:50 2003 UTC
# Line 29  Line 29 
29  void usage( void );  void usage( void );
30  RecoElem* sbwToRecoElem( DataBlockReader& r );  RecoElem* sbwToRecoElem( DataBlockReader& r );
31  void unpackRx( DataBlockReader& r, vector<Reaction>& rxns );  void unpackRx( DataBlockReader& r, vector<Reaction>& rxns );
32    void printList (RecoElem& elem);
33    
34    
35  //************************************************************************  //************************************************************************
# Line 62  Line 62 
62    args << topNodeId;    args << topNodeId;
63    result=RecoMethod.call( args );    result=RecoMethod.call( args );
64    
65    
66    RecoElem* elem = sbwToRecoElem( result );    RecoElem* elem = sbwToRecoElem( result );
67    
68    // now we actually have the recoElem, transfered from the server.  do    // now we actually have the recoElem, transfered from the server.  do
69    // something with it..    // something with it..
70    
   
71    std::string path="";    std::string path="";
72    xduGen( *elem, path );    xduGen( *elem, path );
73    
74    // clean up    cout << "************************" << endl;
75      printList(*elem);
76      cout << "************************" << endl;
77    
78    
79    recoElemReadModule.shutdown();    recoElemReadModule.shutdown();
80    SBW::disconnect();    SBW::disconnect();
# Line 79  Line 82 
82    return 0;    return 0;
83  }  }
84    
85    void printList (RecoElem& elem)
86    
87    {
88    
89      vector<RecoElem>& subElem   = elem.getSubElements();
90      vector<Reaction>& rxns      = elem.getReactions();
91    
92    
93    
94      int nrxns= rxns.size ();
95    
96    
97    
98      cout << "No. of reactions " << nrxns << endl;
99      cout << " &&&&&&&&&&" <<endl;
100      cout << "MY NAME: " << elem.getName() << endl;
101    
102    
103      if (0 !=nrxns)
104        {
105    
106          for (int l=0; l< nrxns ; l++){
107    
108          cout << elem.getReactions()[l].asString() << endl; }
109        }
110      else {
111    
112        int nkids= subElem.size ();
113        cout << "no. of kids: " << nkids << endl;
114    
115        if (0==nkids) { cout << "no kids" << endl; return; }
116    
117    
118        for (int i=0; i<nkids; i++){
119    
120          int nrxns2=elem.getSubElements()[i].getReactions().size();
121          cout << " &&&" <<  endl;
122          cout << "In SubElements:: my name  "
123               << elem.getSubElements()[i].getName() << endl;
124          cout << "In SubElements:: reaction size"  << nrxns2 << endl;
125    
126    
127          for (int j=0; j < nrxns2; j++){
128    
129               cout << elem.getSubElements()[i].getReactions()[j].asString()
130               << endl;
131    
132          }
133    
134            cout << "in deeper  ****  " << endl;
135            printList(elem.getSubElements()[i]);
136        }
137      }
138    
139    }
140    
141    
142  //************************************************************************  //************************************************************************
143  void  void
144  usage( void ) {  usage( void ) {
# Line 114  Line 174 
174    r >> nrx;    r >> nrx;
175    for( int i=0; i<nrx; i++ ) {    for( int i=0; i<nrx; i++ ) {
176      unpackRx( r, rxns);      unpackRx( r, rxns);
177    
178    }    }
179    
180    
181    int nKid;    int nKid;
182    r >> nKid;    r >> nKid;
183    RecoElem* aKid;    RecoElem* aKid;
# Line 124  Line 186 
186      subElems.push_back( *aKid );      subElems.push_back( *aKid );
187    }    }
188    
189    
190    return elem;    return elem;
191  }  }
192    
# Line 131  Line 194 
194  //************************************************************************  //************************************************************************
195  void  void
196  unpackRx( DataBlockReader& rIn, vector<Reaction>& rxns ) {  unpackRx( DataBlockReader& rIn, vector<Reaction>& rxns ) {
197    
198    int             id;    int             id;
199    int             dir;    int             dir;
200    DataBlockReader inMetabL, outMetabL, enzymeL;    DataBlockReader inMetabL, outMetabL, enzymeL;
201    DataBlockReader r;    DataBlockReader r;
202    
203    
204    // The passed in DataBlockReader, rIn, begins with a List...shove it    // The passed in DataBlockReader, rIn, begins with a List...shove it
205    // into r and pull the rx info out of it.    // into r and pull the rx info out of it.
206    
# Line 143  Line 208 
208    
209    r >> id;    r >> id;
210    r >> dir;    r >> dir;
   Reaction rxn( id, (Reaction::Direction) dir );  
   rxns.push_back( rxn );  
211    
212    
213      Reaction rxn( id, (Reaction::Direction) dir );
214    
215    vector<string>& inMetab   = rxn.getInputMetaboliteNames();    vector<string>& inMetab   = rxn.getInputMetaboliteNames();
216    vector<int>&    inMetabN  = rxn.getInputStoich();    vector<int>&    inMetabN  = rxn.getInputStoich();
217    vector<string>& outMetab  = rxn.getOutputMetaboliteNames();    vector<string>& outMetab  = rxn.getOutputMetaboliteNames();
# Line 158  Line 223 
223    string          name;    string          name;
224    int             stoich;    int             stoich;
225    
226    
227    r >> inMetabL;    r >> inMetabL;
228    inMetabL >> nIn;    inMetabL >> nIn;
229    for ( int i=0; i<nIn; i++ ) {    for ( int i=0; i<nIn; i++ ) {
230      inMetabL >> name;      inMetabL >> name;
231      inMetabL >> stoich;      inMetabL >> stoich;
232    
233    
234      inMetab.push_back( name);      inMetab.push_back( name);
235      inMetabN.push_back( stoich );      inMetabN.push_back( stoich );
236    
237    
238    }    }
239    
240    
241    r >> outMetabL;    r >> outMetabL;
242    outMetabL >> nOut;    outMetabL >> nOut;
243    for ( int i=0; i<nOut; i++ ) {    for ( int i=0; i<nOut; i++ ) {
# Line 183  Line 254 
254      enzymes.push_back( name );      enzymes.push_back( name );
255    }    }
256    
257    
258    
259      rxns.push_back( rxn );
260    
261    
262    return;    return;
263  }  }

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3