From: Anthony Geay Date: Tue, 18 Dec 2018 15:46:10 +0000 (+0100) Subject: One method X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=d4962fc85eb4782da89311e0c50bc46aba09c10f;p=tools%2Fmedcoupling.git One method --- diff --git a/src/MEDCoupling/MEDCouplingMemArray.cxx b/src/MEDCoupling/MEDCouplingMemArray.cxx index aaa55d3bc..cbf0576d3 100644 --- a/src/MEDCoupling/MEDCouplingMemArray.cxx +++ b/src/MEDCoupling/MEDCouplingMemArray.cxx @@ -3678,15 +3678,6 @@ DataArrayDouble *DataArrayDoubleTuple::buildDADouble(int nbOfTuples, int nbOfCom return this->buildDA(nbOfTuples,nbOfCompo); } -/*! - * Returns a new instance of DataArrayInt. The caller is to delete this array - * using decrRef() as it is no more needed. - */ -DataArrayInt *DataArrayInt::New() -{ - return new DataArrayInt; -} - /*! * Returns the only one value in \a this, if and only if number of elements * (nb of tuples * nb of components) is equal to 1, and that \a this is allocated. diff --git a/src/MEDCoupling/MEDCouplingMemArray.hxx b/src/MEDCoupling/MEDCouplingMemArray.hxx index 3887de629..0f42721e5 100644 --- a/src/MEDCoupling/MEDCouplingMemArray.hxx +++ b/src/MEDCoupling/MEDCouplingMemArray.hxx @@ -528,6 +528,7 @@ namespace MEDCoupling class DataArrayDiscrete : public DataArrayTemplateClassic { public: + MEDCOUPLING_EXPORT static typename Traits::ArrayType *New(); MEDCOUPLING_EXPORT bool isEqual(const DataArrayDiscrete& other) const; MEDCOUPLING_EXPORT bool isEqualIfNotWhy(const DataArrayDiscrete& other, std::string& reason) const; MEDCOUPLING_EXPORT bool isEqualWithoutConsideringStr(const DataArrayDiscrete& other) const; @@ -560,8 +561,8 @@ namespace MEDCoupling class DataArrayInt32 : public DataArrayDiscreteSigned { + friend class DataArrayDiscrete; public: - MEDCOUPLING_EXPORT static DataArrayInt32 *New(); MEDCOUPLING_EXPORT int intValue() const; MEDCOUPLING_EXPORT int getHashCode() const; MEDCOUPLING_EXPORT DataArrayInt32 *deepCopy() const;//ok @@ -574,7 +575,7 @@ namespace MEDCoupling MEDCOUPLING_EXPORT void reprQuickOverviewData(std::ostream& stream, std::size_t maxNbOfByteInRepr) const; MEDCOUPLING_EXPORT void transformWithIndArr(const int *indArrBg, const int *indArrEnd); MEDCOUPLING_EXPORT void transformWithIndArr(const MapKeyVal& m); - MEDCOUPLING_EXPORT DataArrayInt32 *transformWithIndArrR(const int *indArrBg, const int *indArrEnd) const; + MEDCOUPLING_EXPORT DataArrayInt32 *transformWithIndArrR(const int *indArr2Bg, const int *indArrEnd) const; MEDCOUPLING_EXPORT void splitByValueRange(const int *arrBg, const int *arrEnd, DataArrayInt32 *& castArr, DataArrayInt32 *& rankInsideCast, DataArrayInt32 *& castsPresent) const; MEDCOUPLING_EXPORT bool isRange(int& strt, int& sttoopp, int& stteepp) const; @@ -678,6 +679,10 @@ namespace MEDCoupling class DataArrayInt64 : public DataArrayDiscrete { + friend class DataArrayDiscrete; + private: + ~DataArrayInt64() { } + DataArrayInt64() { } }; template diff --git a/src/MEDCoupling/MEDCouplingMemArray.txx b/src/MEDCoupling/MEDCouplingMemArray.txx index f2c2f4690..a9d0a697a 100644 --- a/src/MEDCoupling/MEDCouplingMemArray.txx +++ b/src/MEDCoupling/MEDCouplingMemArray.txx @@ -3438,7 +3438,17 @@ struct NotInRange std::string tmp; return isEqualIfNotWhy(other,tmp); } - + + /*! + * Returns a new instance of DataArrayInt. The caller is to delete this array + * using decrRef() as it is no more needed. + */ + template + typename Traits::ArrayType *DataArrayDiscrete::New() + { + return new typename Traits::ArrayType; + } + /*! * Checks if values of \a this and another DataArrayInt are equal. For more info see * \ref MEDCouplingArrayBasicsCompare.