/[escript]/trunk/escript/src/Data.cpp
ViewVC logotype

Diff of /trunk/escript/src/Data.cpp

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

revision 1796 by jfenwick, Wed Sep 17 01:45:46 2008 UTC revision 1799 by jfenwick, Wed Sep 17 06:33:18 2008 UTC
# Line 413  Data::getShapeTuple() const Line 413  Data::getShapeTuple() const
413          throw DataException("Error - illegal Data rank.");          throw DataException("Error - illegal Data rank.");
414    }    }
415  }  }
416    
417    
418    // The different name is needed because boost has trouble with overloaded functions.
419    // It can't work out what type the function is based soley on its name.
420    // There are ways to fix this involving creating function pointer variables for each form
421    // but there doesn't seem to be a need given that the methods have the same name from the python point of view
422    Data*
423    Data::copySelf()
424    {
425       DataAbstract* temp=m_data->deepCopy();
426       return new Data(temp);
427    }
428    
429  void  void
430  Data::copy(const Data& other)  Data::copy(const Data& other)
431  {  {
432    //    DataAbstract* temp=other.m_data->deepCopy();
433    // Perform a deep copy    shared_ptr<DataAbstract> temp_data(temp);
434    {    m_data=temp_data;
     DataExpanded* temp=dynamic_cast<DataExpanded*>(other.m_data.get());  
     if (temp!=0) {  
       //  
       // Construct a DataExpanded copy  
       DataAbstract* newData=new DataExpanded(*temp);  
       shared_ptr<DataAbstract> temp_data(newData);  
       m_data=temp_data;  
       return;  
     }  
   }  
   {  
     DataTagged* temp=dynamic_cast<DataTagged*>(other.m_data.get());  
     if (temp!=0) {  
       //  
       // Construct a DataTagged copy  
       DataAbstract* newData=new DataTagged(*temp);  
       shared_ptr<DataAbstract> temp_data(newData);  
       m_data=temp_data;  
       return;  
     }  
   }  
   {  
     DataConstant* temp=dynamic_cast<DataConstant*>(other.m_data.get());  
     if (temp!=0) {  
       //  
       // Construct a DataConstant copy  
       DataAbstract* newData=new DataConstant(*temp);  
       shared_ptr<DataAbstract> temp_data(newData);  
       m_data=temp_data;  
       return;  
     }  
   }  
   {  
     DataEmpty* temp=dynamic_cast<DataEmpty*>(other.m_data.get());  
     if (temp!=0) {  
       //  
       // Construct a DataEmpty copy  
       DataAbstract* newData=new DataEmpty();  
       shared_ptr<DataAbstract> temp_data(newData);  
       m_data=temp_data;  
       return;  
     }  
   }  
   throw DataException("Error - Copy not implemented for this Data type.");  
435  }  }
436    
437    

Legend:
Removed from v.1796  
changed lines
  Added in v.1799

  ViewVC Help
Powered by ViewVC 1.1.26