X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FGeomAPI%2FGeomAPI_DataMapOfShapeMapOfShapes.h;h=395abae3444c6cba1c40305d8be7a2d38a3d6da8;hb=b06cf1477fb1ee46d7ae260c234cac5d0000abf2;hp=5dd4dbd4d67fc3cb9c487841a7b98ef6bc5ab6fc;hpb=952efeb621c89406b5b4b2a7173ad42de4034fa8;p=modules%2Fshaper.git diff --git a/src/GeomAPI/GeomAPI_DataMapOfShapeMapOfShapes.h b/src/GeomAPI/GeomAPI_DataMapOfShapeMapOfShapes.h index 5dd4dbd4d..395abae34 100644 --- a/src/GeomAPI/GeomAPI_DataMapOfShapeMapOfShapes.h +++ b/src/GeomAPI/GeomAPI_DataMapOfShapeMapOfShapes.h @@ -1,39 +1,51 @@ -// Copyright (C) 2014-20xx CEA/DEN, EDF R&D - -// File: GeomAPI_DataMapOfShapeMapOfShapes.h -// Created: 4 September 2015 -// Author: Dmitry Bobylev +// Copyright (C) 2014-2017 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or +// email : webmaster.salome@opencascade.com +// #ifndef GeomAPI_DataMapOfShapeMapOfShapes_H_ #define GeomAPI_DataMapOfShapeMapOfShapes_H_ -#include +#include "GeomAPI_Interface.h" -#include +#include "GeomAPI_Shape.h" -/**\class GeomAPI_DataMapOfShapeMapOfShapes - * \ingroup DataModel - * \brief DataMap of Shape - Map of Shapes defined by TopoDS_Shapes - */ +/// \class GeomAPI_DataMapOfShapeMapOfShapes +/// \ingroup DataModel +/// \brief DataMap of Shape - Map of Shapes defined by TopoDS_Shapes class GeomAPI_DataMapOfShapeMapOfShapes : public GeomAPI_Interface { public: /// Constructor.Creates empty map. GEOMAPI_EXPORT GeomAPI_DataMapOfShapeMapOfShapes(); - /** \brief Binds list of shapes to the key shape. - \param[in] theKey key shape. - \param[in] theItems list of shapes. If shapes have duplications in list only one will be stored. - \returns true if items bound successfully. - */ + /// \brief Binds list of shapes to the key shape. + /// \param[in] theKey key shape. + /// \param[in] theItems list of shapes. + /// If shapes have duplications in list only one will be stored. + /// \returns true if items bound successfully. GEOMAPI_EXPORT bool bind(const std::shared_ptr theKey, const ListOfShape& theItems); - /** \brief Adds item to the map bounded to the key. - \param[in] theKey key shape. - \param[in] theItem item shape. - \returns true if item bounded successfully. False if it is already bound. - */ + /// \brief Adds item to the map bounded to the key. + /// \param[in] theKey key shape. + /// \param[in] theItem item shape. + /// \returns true if item bounded successfully. False if it is already bound. GEOMAPI_EXPORT bool add(const std::shared_ptr theKey, const std::shared_ptr theItem); @@ -47,8 +59,45 @@ public: /// Undinds shapes from theKey. GEOMAPI_EXPORT bool unBind(const std::shared_ptr theKey); + /// Clears map. + GEOMAPI_EXPORT void clear(); + /// \return size of map. GEOMAPI_EXPORT int size() const; + +public: + class iterator + { + public: + typedef GeomShapePtr key_type; + typedef ListOfShape mapped_type; + typedef std::pair value_type; + + public: + GEOMAPI_EXPORT iterator(); + GEOMAPI_EXPORT iterator(const iterator&); + GEOMAPI_EXPORT const iterator& operator=(const iterator&); + + GEOMAPI_EXPORT bool operator==(const iterator&) const; + GEOMAPI_EXPORT bool operator!=(const iterator&) const; + + GEOMAPI_EXPORT virtual iterator& operator++(); + GEOMAPI_EXPORT virtual iterator operator++(int); + + GEOMAPI_EXPORT virtual key_type first() const; + GEOMAPI_EXPORT virtual mapped_type second() const; + + protected: + std::shared_ptr mySelf; + }; + + typedef iterator const_iterator; + + GEOMAPI_EXPORT iterator begin(); + GEOMAPI_EXPORT const_iterator begin() const; + + GEOMAPI_EXPORT iterator end(); + GEOMAPI_EXPORT const_iterator end() const; }; #endif