void pcl::BivariatePolynomialT<real>::deepCopy (const pcl::BivariatePolynomialT<real>& other) { if (this == &other) return; if (degree != other.degree) { memoryCleanUp (); degree = other.degree; parameters = new real[getNoOfParameters ()]; } if (other.gradient_x == NULL) { delete gradient_x; gradient_x=NULL; delete gradient_y; gradient_y=NULL; } else if (gradient_x==NULL) { gradient_x = new pcl::BivariatePolynomialT<real> (); gradient_y = new pcl::BivariatePolynomialT<real> (); } real* tmpParameters1 = parameters; const real* tmpParameters2 = other.parameters; unsigned int noOfParameters = getNoOfParameters (); for (unsigned int i=0; i<noOfParameters; i++) *tmpParameters1++ = *tmpParameters2++; if (other.gradient_x != NULL) { gradient_x->deepCopy (*other.gradient_x); gradient_y->deepCopy (*other.gradient_y); } }
void pcl::BivariatePolynomialT<real>::readBinary (std::istream& os) { memoryCleanUp (); os.read ( (char*)& (this->degree), sizeof (int)); unsigned int paramCnt = getNoOfParametersFromDegree (this->degree); parameters = new real[paramCnt]; os.read ( (char*)& (*this->parameters), paramCnt * sizeof (real)); }
template<typename real> void pcl::BivariatePolynomialT<real>::readBinary (std::istream& os) { memoryCleanUp (); os.read (reinterpret_cast<char*> (&this->degree), sizeof (int)); unsigned int paramCnt = getNoOfParametersFromDegree (this->degree); parameters = new real[paramCnt]; os.read (reinterpret_cast<char*> (&(*this->parameters)), paramCnt * sizeof (real)); }
void pcl::BivariatePolynomialT<real>::setDegree (int newDegree) { if (newDegree <= 0) { degree = -1; memoryCleanUp(); return; } int oldDegree = degree; degree = newDegree; if (oldDegree != degree) { delete[] parameters; parameters = new real[getNoOfParameters ()]; } delete gradient_x; gradient_x = NULL; delete gradient_y; gradient_y = NULL; }
pcl::BivariatePolynomialT<real>::~BivariatePolynomialT () { memoryCleanUp (); }