/* * Multiindex container for selection * * Authors: * Adrian Boguszewski * * Copyright (C) 2016 Adrian Boguszewski * * Released under GNU GPL, read the file 'COPYING' for more information */ #ifndef INKSCAPE_PROTOTYPE_OBJECTSET_H #define INKSCAPE_PROTOTYPE_OBJECTSET_H #include #include #include #include #include #include #include #include "sp-object.h" struct hashed{}; typedef boost::multi_index_container< SPObject*, boost::multi_index::indexed_by< boost::multi_index::sequenced<>, boost::multi_index::hashed_unique< boost::multi_index::tag, boost::multi_index::identity> >> multi_index_container; class ObjectSet { public: ObjectSet() {}; ~ObjectSet(); bool add(SPObject* object); bool remove(SPObject* object); bool contains(SPObject* object); void clear(); int size(); multi_index_container::iterator begin(); multi_index_container::iterator end(); private: void _add(SPObject* object); void _remove(SPObject* object); bool _anyAncestorIsInSet(SPObject *object); void _removeDescendantsFromSet(SPObject *object); void _removeAncestorsFromSet(SPObject *object); SPObject *_getMutualAncestor(SPObject *object); multi_index_container container; std::unordered_map releaseConnections; }; #endif //INKSCAPE_PROTOTYPE_OBJECTSET_H