From: Anthony Geay Date: Thu, 20 Dec 2018 07:18:55 +0000 (+0100) Subject: An another pair of methods X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=089989e83e10c05f3a671cba019df95703486cf4;p=tools%2Fmedcoupling.git An another pair of methods --- diff --git a/src/MEDCoupling/MEDCouplingMemArray.cxx b/src/MEDCoupling/MEDCouplingMemArray.cxx index 5651e374a..3d4d0d2a9 100644 --- a/src/MEDCoupling/MEDCouplingMemArray.cxx +++ b/src/MEDCoupling/MEDCouplingMemArray.cxx @@ -884,27 +884,6 @@ bool DataArrayDouble::isMonotonic(bool increasing, double eps) const } } -/*! - * Returns a textual and human readable representation of \a this instance of - * DataArrayDouble. This text is shown when a DataArrayDouble is printed in Python. - * \return std::string - text describing \a this DataArrayDouble. - * - * \sa reprNotTooLong, reprZip - */ -std::string DataArrayDouble::repr() const -{ - std::ostringstream ret; - reprStream(ret); - return ret.str(); -} - -std::string DataArrayDouble::reprZip() const -{ - std::ostringstream ret; - reprZipStream(ret); - return ret.str(); -} - void DataArrayDouble::writeVTK(std::ostream& ofs, int indent, const std::string& nameInFile, DataArrayByte *byteArr) const { static const char SPACE[4]={' ',' ',' ',' '}; @@ -3709,27 +3688,6 @@ DataArrayInt32 *DataArrayInt32::deepCopy() const return new DataArrayInt32(*this); } -/*! - * Returns a textual and human readable representation of \a this instance of - * DataArrayInt. This text is shown when a DataArrayInt is printed in Python. - * \return std::string - text describing \a this DataArrayInt. - * - * \sa reprNotTooLong, reprZip - */ -std::string DataArrayInt::repr() const -{ - std::ostringstream ret; - reprStream(ret); - return ret.str(); -} - -std::string DataArrayInt::reprZip() const -{ - std::ostringstream ret; - reprZipStream(ret); - return ret.str(); -} - void DataArrayInt::writeVTK(std::ostream& ofs, int indent, const std::string& type, const std::string& nameInFile, DataArrayByte *byteArr) const { static const char SPACE[4]={' ',' ',' ',' '}; diff --git a/src/MEDCoupling/MEDCouplingMemArray.hxx b/src/MEDCoupling/MEDCouplingMemArray.hxx index 9e405bf18..0ecb0583b 100644 --- a/src/MEDCoupling/MEDCouplingMemArray.hxx +++ b/src/MEDCoupling/MEDCouplingMemArray.hxx @@ -415,8 +415,6 @@ namespace MEDCoupling MEDCOUPLING_EXPORT DataArrayDouble *buildNewEmptyInstance() const { return DataArrayDouble::New(); } MEDCOUPLING_EXPORT void checkMonotonic(bool increasing, double eps) const; MEDCOUPLING_EXPORT bool isMonotonic(bool increasing, double eps) const; - MEDCOUPLING_EXPORT std::string repr() const; - MEDCOUPLING_EXPORT std::string reprZip() const; MEDCOUPLING_EXPORT void writeVTK(std::ostream& ofs, int indent, const std::string& nameInFile, DataArrayByte *byteArr) const; MEDCOUPLING_EXPORT void reprCppStream(const std::string& varName, std::ostream& stream) const; MEDCOUPLING_EXPORT void reprQuickOverview(std::ostream& stream) const; @@ -542,6 +540,8 @@ namespace MEDCoupling MEDCOUPLING_EXPORT void checkStrictlyMonotonic(bool increasing) const; MEDCOUPLING_EXPORT bool isStrictlyMonotonic(bool increasing) const; MEDCOUPLING_EXPORT int getHashCode() const; + MEDCOUPLING_EXPORT std::string repr() const; + MEDCOUPLING_EXPORT std::string reprZip() const; protected: template void switchOnTupleAlg(T val, std::vector& vec, ALG algo) const; @@ -567,8 +567,6 @@ namespace MEDCoupling MEDCOUPLING_EXPORT int intValue() const; MEDCOUPLING_EXPORT DataArrayInt32 *deepCopy() const;//ok MEDCOUPLING_EXPORT DataArrayInt32 *buildNewEmptyInstance() const { return DataArrayInt32::New(); }//ok - MEDCOUPLING_EXPORT std::string repr() const; - MEDCOUPLING_EXPORT std::string reprZip() const; MEDCOUPLING_EXPORT void writeVTK(std::ostream& ofs, int indent, const std::string& type, const std::string& nameInFile, DataArrayByte *byteArr) const; MEDCOUPLING_EXPORT void reprCppStream(const std::string& varName, std::ostream& stream) const; MEDCOUPLING_EXPORT void reprQuickOverview(std::ostream& stream) const; diff --git a/src/MEDCoupling/MEDCouplingMemArray.txx b/src/MEDCoupling/MEDCouplingMemArray.txx index 7f6731e94..0d2de8913 100644 --- a/src/MEDCoupling/MEDCouplingMemArray.txx +++ b/src/MEDCoupling/MEDCouplingMemArray.txx @@ -3752,6 +3752,29 @@ struct NotInRange return ret+ret0; } + /*! + * Returns a textual and human readable representation of \a this instance of + * DataArrayInt. This text is shown when a DataArrayInt is printed in Python. + * \return std::string - text describing \a this DataArrayInt. + * + * \sa reprNotTooLong, reprZip + */ + template + std::string DataArrayDiscrete::repr() const + { + std::ostringstream ret; + DataArrayTemplateClassic::reprStream(ret); + return ret.str(); + } + + template + std::string DataArrayDiscrete::reprZip() const + { + std::ostringstream ret; + DataArrayTemplateClassic::reprZipStream(ret); + return ret.str(); + } + //////////////////////////////////// /*!