/[ascend]/trunk/pygtk/interface/instance.cpp
ViewVC logotype

Diff of /trunk/pygtk/interface/instance.cpp

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

revision 214 by johnpye, Mon Jan 23 06:47:06 2006 UTC revision 215 by johnpye, Wed Jan 25 02:08:29 2006 UTC
# Line 377  Instanc::getSymbolValue() const{ Line 377  Instanc::getSymbolValue() const{
377      return SCP(GetSymbolAtomValue(i));      return SCP(GetSymbolAtomValue(i));
378  }  }
379    
380    const string
381    Instanc::getRelationAsString(const Instanc &relative_to) const{
382        stringstream ss;
383        if(isRelation()){
384            int len;
385            char *str = WriteRelationString(i,relative_to.getInternalType()
386                    ,NULL,NULL,relio_ascend,&len);
387            ss << str;
388            ascfree(str);
389        }else{
390            throw runtime_error("getRelationString: Instance is not a relation");
391        }
392        return ss.str();
393    }
394            
395  /**  /**
396      Return the numerical value of an instance if it is an assigned atom.      Return the numerical value of an instance if it is an assigned atom.
397      If it is a relation, return the string form of the relation (ie the equation)      If it is a relation, return the string form of the relation (ie the equation)
# Line 386  const string Line 401  const string
401  Instanc::getValueAsString() const{  Instanc::getValueAsString() const{
402      stringstream ss;      stringstream ss;
403    
404      if(isRelation()){      if(isAssigned()){
         int len;  
         char *str = WriteRelationString(i,NULL,NULL,NULL,relio_ascend,&len);  
         ss << str;  
         ascfree(str);  
     }else if(isAssigned()){  
405          if(isReal()){          if(isReal()){
406              ss << getRealValue();              ss << getRealValue();
407          }else if(isInt()){          }else if(isInt()){

Legend:
Removed from v.214  
changed lines
  Added in v.215

john.pye@anu.edu.au
ViewVC Help
Powered by ViewVC 1.1.22