From: Anthony Geay Date: Mon, 25 Apr 2016 12:50:13 +0000 (+0200) Subject: A useful method for global vars. X-Git-Tag: V7_8_0a2~1 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=9bdb86c7ad7cc02556f9f77882713e00cea8e114;p=tools%2Fmedcoupling.git A useful method for global vars. --- diff --git a/src/MEDCoupling/MEDCouplingRefCountObject.cxx b/src/MEDCoupling/MEDCouplingRefCountObject.cxx index de8160c0c..73be12819 100644 --- a/src/MEDCoupling/MEDCouplingRefCountObject.cxx +++ b/src/MEDCoupling/MEDCouplingRefCountObject.cxx @@ -305,6 +305,14 @@ std::string GlobalDict::value(const std::string& key) const return (*it).second; } +std::vector GlobalDict::keys() const +{ + std::vector ret; + for(std::map::const_iterator it=_my_map.begin();it!=_my_map.end();it++) + ret.push_back((*it).first); + return ret; +} + void GlobalDict::erase(const std::string& key) { std::map::iterator it(_my_map.find(key)); diff --git a/src/MEDCoupling/MEDCouplingRefCountObject.hxx b/src/MEDCoupling/MEDCouplingRefCountObject.hxx index b46525573..202f25b77 100644 --- a/src/MEDCoupling/MEDCouplingRefCountObject.hxx +++ b/src/MEDCoupling/MEDCouplingRefCountObject.hxx @@ -111,6 +111,7 @@ namespace ParaMEDMEM MEDCOUPLING_EXPORT static GlobalDict *GetInstance(); MEDCOUPLING_EXPORT bool hasKey(const std::string& key) const; MEDCOUPLING_EXPORT std::string value(const std::string& key) const; + MEDCOUPLING_EXPORT std::vector keys() const; MEDCOUPLING_EXPORT void erase(const std::string& key); MEDCOUPLING_EXPORT void clear(); MEDCOUPLING_EXPORT void setKeyValue(const std::string& key, const std::string& value); diff --git a/src/MEDCoupling_Swig/MEDCouplingRefCountObject.i b/src/MEDCoupling_Swig/MEDCouplingRefCountObject.i index bb56a329a..780d52e83 100644 --- a/src/MEDCoupling_Swig/MEDCouplingRefCountObject.i +++ b/src/MEDCoupling_Swig/MEDCouplingRefCountObject.i @@ -122,6 +122,7 @@ namespace ParaMEDMEM static GlobalDict *GetInstance() throw(INTERP_KERNEL::Exception); bool hasKey(const std::string& key) const throw(INTERP_KERNEL::Exception); std::string value(const std::string& key) const throw(INTERP_KERNEL::Exception); + std::vector keys() const throw(INTERP_KERNEL::Exception); void erase(const std::string& key) throw(INTERP_KERNEL::Exception); void clear() throw(INTERP_KERNEL::Exception); void setKeyValue(const std::string& key, const std::string& value) throw(INTERP_KERNEL::Exception);