/[escript]/branches/schroedinger/escript/src/Data.cpp
ViewVC logotype

Diff of /branches/schroedinger/escript/src/Data.cpp

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

revision 1864 by jfenwick, Thu Oct 9 03:09:30 2008 UTC revision 1865 by jfenwick, Thu Oct 9 03:53:57 2008 UTC
# Line 524  Data::isLazy() const Line 524  Data::isLazy() const
524    return m_data->isLazy();    return m_data->isLazy();
525  }  }
526    
527    // at the moment this is synonymous with !isLazy() but that could change
528    bool
529    Data::isReady() const
530    {
531      return (dynamic_cast<DataReady*>(m_data.get())!=0);
532    }
533    
534    
535  void  void
536  Data::setProtection()  Data::setProtection()
# Line 559  Data::expand() Line 566  Data::expand()
566      // do nothing      // do nothing
567    } else if (isEmpty()) {    } else if (isEmpty()) {
568      throw DataException("Error - Expansion of DataEmpty not possible.");      throw DataException("Error - Expansion of DataEmpty not possible.");
569      } else if (isLazy()) {
570        DataReady_ptr res=m_data->resolve();
571        m_data=res;
572    } else {    } else {
573      throw DataException("Error - Expansion not implemented for this Data type.");      throw DataException("Error - Expansion not implemented for this Data type.");
574    }    }
# Line 2408  Data::borrowData() const Line 2418  Data::borrowData() const
2418    return m_data.get();    return m_data.get();
2419  }  }
2420    
   
2421  std::string  std::string
2422  Data::toString() const  Data::toString() const
2423  {  {
# Line 2448  Data::getDataAtOffset(DataTypes::ValueTy Line 2457  Data::getDataAtOffset(DataTypes::ValueTy
2457  DataTypes::ValueType::const_reference  DataTypes::ValueType::const_reference
2458  Data::getDataPoint(int sampleNo, int dataPointNo) const  Data::getDataPoint(int sampleNo, int dataPointNo) const
2459  {  {
2460    if (isLazy())    if (!isReady())
2461    {    {
2462      throw DataException("Programmer error - getDataPoint() not permitted on Lazy Data.");      throw DataException("Programmer error - getDataPoint() not permitted on Lazy Data.");
2463    }    }
# Line 2463  Data::getDataPoint(int sampleNo, int dat Line 2472  Data::getDataPoint(int sampleNo, int dat
2472  DataTypes::ValueType::reference  DataTypes::ValueType::reference
2473  Data::getDataPoint(int sampleNo, int dataPointNo)  Data::getDataPoint(int sampleNo, int dataPointNo)
2474  {  {
2475    if (isLazy())    if (!isReady())
2476    {    {
2477      throw DataException("Programmer error - getDataPoint() not permitted on Lazy Data.");      throw DataException("Programmer error - getDataPoint() not permitted on Lazy Data.");
2478    }    }

Legend:
Removed from v.1864  
changed lines
  Added in v.1865

  ViewVC Help
Powered by ViewVC 1.1.26