Tulip  5.3.0
Large graphs analysis and drawing
PropertyManager.h
1 /*
2  *
3  * This file is part of Tulip (http://tulip.labri.fr)
4  *
5  * Authors: David Auber and the Tulip development Team
6  * from LaBRI, University of Bordeaux
7  *
8  * Tulip is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU Lesser General Public License
10  * as published by the Free Software Foundation, either version 3
11  * of the License, or (at your option) any later version.
12  *
13  * Tulip is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16  * See the GNU General Public License for more details.
17  *
18  */
19 ///@cond DOXYGEN_HIDDEN
20 
21 #ifndef TLP_PROPERTYMANAGER_H
22 #define TLP_PROPERTYMANAGER_H
23 
24 #include <map>
25 #include <string>
26 
27 namespace tlp {
28 
29 template <class itType>
30 struct Iterator;
31 
32 class PropertyInterface;
33 class Graph;
34 
35 class PropertyManager {
36 
37 private:
38  std::map<std::string, PropertyInterface *> localProperties;
39  std::map<std::string, PropertyInterface *> inheritedProperties;
40 
41 public:
42  Graph *graph;
43  explicit PropertyManager(Graph *);
44  ~PropertyManager();
45  //======================================================================================
46  bool existProperty(const std::string &) const;
47  bool existLocalProperty(const std::string &) const;
48  bool existInheritedProperty(const std::string &) const;
49  void setLocalProperty(const std::string &, PropertyInterface *);
50  bool renameLocalProperty(PropertyInterface *, const std::string &);
51  PropertyInterface *getProperty(const std::string &) const;
52  PropertyInterface *getLocalProperty(const std::string &) const;
53  PropertyInterface *getInheritedProperty(const std::string &) const;
54  void delLocalProperty(const std::string &);
55  void notifyBeforeDelInheritedProperty(const std::string &);
56  void erase(const node);
57  void erase(const edge);
58  //======================================================================================
59  Iterator<std::string> *getLocalProperties();
60  Iterator<std::string> *getInheritedProperties();
61  Iterator<PropertyInterface *> *getLocalObjectProperties();
62  Iterator<PropertyInterface *> *getInheritedObjectProperties();
63 
64 protected:
65  void setInheritedProperty(const std::string &, PropertyInterface *);
66 };
67 } // namespace tlp
68 
69 #endif
70 
71 ///@endcond