Changeset 327 for trunk/src


Ignore:
Timestamp:
Mar 11, 2006 7:58:30 PM (18 years ago)
Author:
cxsong
Message:

added clear() and assignment operator.

Location:
trunk/src/mesh
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/mesh/field.cc

    r318 r327  
    133133
    134134        // clear input string
    135         textString.erase();
     135        textString.clear();
    136136
    137137        sprintf(cstr, "<field id=\"%s\">\n", m_name.c_str());
     
    187187}
    188188
     189void RpField::clear()
     190{
     191        RpGrid1d::clear();
     192        m_meshName.clear();
     193}
     194
     195RpField RpField::operator=(const RpField& f)
     196{
     197        (RpGrid1d&)*this = f;
     198        m_meshName = f.m_meshName;
     199
     200        return (*this);
     201}
  • trunk/src/mesh/field.h

    r319 r327  
    3939        virtual RP_ERROR doDeserialize(const char* buf);
    4040
     41        // remove all data
     42        virtual void clear();
     43
     44        // serialize object content to an XML text string
    4145        virtual void xmlString(std::string& str);
     46
     47        // print content of object to stdout
    4248        virtual void print();
     49
     50        // assignment operator
     51        virtual RpField operator=(const RpField& f);
     52
    4353
    4454        // destructor
  • trunk/src/mesh/grid1d.cc

    r322 r327  
    229229
    230230        // clear input string
    231         textString.erase();
     231        textString.clear();
    232232
    233233        textString.append("<points>");
     
    295295}
    296296
     297//
     298// Remove all points
     299//
     300void RpGrid1d::clear()
     301{
     302        m_data.clear();
     303        m_name.clear();
     304}
     305
     306//
     307// override operator =
     308//
     309RpGrid1d RpGrid1d::operator=(const RpGrid1d& g)
     310{
     311        m_data = g.m_data;
     312        m_name = g.m_name;
     313
     314        return (*this);
     315}
     316
  • trunk/src/mesh/grid1d.h

    r320 r327  
    7070        virtual void print();
    7171
     72        // delete all points
     73        virtual void clear();
     74
    7275        // destructor
    7376        virtual ~RpGrid1d() { };
     77
     78        virtual RpGrid1d operator=(const RpGrid1d& g);
    7479
    7580protected:
Note: See TracChangeset for help on using the changeset viewer.