Changeset 342 for trunk


Ignore:
Timestamp:
Mar 13, 2006 8:38:26 PM (18 years ago)
Author:
cxsong
Message:

added doSerialization(), removed serialization()

Location:
trunk/src/mesh
Files:
2 edited

Legend:

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

    r336 r342  
    5353//      expand points and add them to m_data
    5454//
    55 RpGrid2d::RpGrid2d(DataValType x_min, DataValType x_max, int x_delta,
    56                    DataValType y_min, DataValType y_max, int y_delta)
     55RpGrid2d::RpGrid2d(DataValType x_min, DataValType x_max, DataValType x_delta,
     56                   DataValType y_min, DataValType y_max, DataValType y_delta)
    5757{
    5858        setUniformGrid(x_min, x_max, x_delta, y_min, y_max, y_delta);
     
    6060
    6161RP_ERROR
    62 RpGrid2d::setUniformGrid(DataValType x_min, DataValType x_max, int x_delta,
    63                    DataValType y_min, DataValType y_max, int y_delta)
     62RpGrid2d::setUniformGrid(DataValType x_min, DataValType x_max, DataValType x_delta,
     63           DataValType y_min, DataValType y_max, DataValType y_delta)
    6464{
    6565        // expand array, inclusive of origin and max
     
    154154}
    155155
    156 //
    157 // serialize object to a byte stream
    158 // Output:
    159 //      nbytes: total number of bytes in the byte stream
    160 //      return pointer to buffer holding the byte stream
    161 //
    162 char*
    163 RpGrid2d::serialize(int& nbytes)
    164 {
    165         // call base class serialize()
    166         char* buf = RpGrid1d::serialize(nbytes);
    167 
    168         // now, override the header with correct object type
    169         writeRpHeader(buf, RpCurrentVersion[GRID2D], nbytes);
    170 
    171         return buf;     
     156//
     157// serialization
     158//
     159RP_ERROR
     160RpGrid2d::doSerialize(char* buf, int nbytes)
     161{
     162        RP_ERROR err;
     163
     164        // call base class doSerialize()
     165        err = RpGrid1d::doSerialize(buf, nbytes);
     166
     167        if (err == RP_SUCCESS) {
     168                // now, override the header with correct object type
     169                writeRpHeader(buf, RpCurrentVersion[GRID2D], nbytes);
     170        }
     171
     172        return err;
     173
    172174}
    173175
  • trunk/src/mesh/grid2d.h

    r336 r342  
    2727        // constructor - uniform 2d grid, data expanded inclusive of
    2828        //              origin and max
    29         RpGrid2d(DataValType x_min, DataValType x_max, int x_delta,
    30                  DataValType y_min, DataValType y_max, int y_delta);
     29        RpGrid2d(DataValType x_min, DataValType x_max, DataValType x_delta,
     30                 DataValType y_min, DataValType y_max, DataValType y_delta);
    3131
    3232        // constructor - 2d rectilinear grid
     
    4343        RP_ERROR addAllPoints(DataValType* points, int npoints);
    4444
    45         RP_ERROR setUniformGrid(DataValType xmin, DataValType xmax, int xdelta,
    46                                 DataValType ymin, DataValType ymax, int ydelta);
     45        RP_ERROR setUniformGrid(DataValType xmin, DataValType xmax,
     46                        DataValType xdelta,
     47                        DataValType ymin, DataValType ymax, DataValType ydelta);
    4748
    4849        // add points of a rectilinear grid
     
    5960
    6061        // serialize data
    61         virtual char * serialize(int& nbytes);
     62        //virtual char * serialize(int& nbytes);
     63        virtual RP_ERROR doSerialize(char* buf, int nbytes);
     64
    6265        virtual RP_ERROR deserialize(const char* buf);
    6366
Note: See TracChangeset for help on using the changeset viewer.