Changeset 71:15933528431e in rrlib_geometry


Ignore:
Timestamp:
04.12.2013 12:20:10 (6 years ago)
Author:
Patrick Fleischmann <fleischmann@…>
Branch:
13.10
Phase:
public
Message:

Adds copy constructor and assignment operator to tShape, replaces NULL with nullptr

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • tShape.h

    r60 r71  
    9191  tShape(); 
    9292 
     93  tShape(const tShape &other); 
     94 
     95  tShape &operator= (const tShape &other); 
     96 
    9397  virtual ~tShape() = 0; 
    9498 
  • tShape.hpp

    r60 r71  
    6868tShape<Tdimension, TElement>::tShape() 
    6969  : changed(false), 
    70     bounding_box(NULL), 
    71     center_of_gravity(NULL) 
     70    bounding_box(nullptr), 
     71    center_of_gravity(nullptr) 
    7272{} 
     73 
     74//---------------------------------------------------------------------- 
     75// tShape copy constructor 
     76//---------------------------------------------------------------------- 
     77template <size_t Tdimension, typename TElement> 
     78tShape<Tdimension, TElement>::tShape(const tShape &other) 
     79  : changed(false), 
     80    bounding_box(nullptr), 
     81    center_of_gravity(nullptr) 
     82{} 
     83 
     84//---------------------------------------------------------------------- 
     85// tShape assignment operator 
     86//---------------------------------------------------------------------- 
     87template <size_t Tdimension, typename TElement> 
     88tShape<Tdimension, TElement> &tShape<Tdimension, TElement>::operator= (const tShape &other) 
     89{ 
     90  this->changed = false; 
     91  this->bounding_box = nullptr; 
     92  this->center_of_gravity = nullptr; 
     93  return *this; 
     94} 
    7395 
    7496//---------------------------------------------------------------------- 
     
    134156  this->changed = false; 
    135157  delete this->bounding_box; 
    136   this->bounding_box = NULL; 
     158  this->bounding_box = nullptr; 
    137159  delete this->center_of_gravity; 
    138   this->center_of_gravity = NULL; 
     160  this->center_of_gravity = nullptr; 
    139161} 
    140162 
Note: See TracChangeset for help on using the changeset viewer.