Tulip  4.7.0
Better Visualization Through Research
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Properties Groups Pages
PropertyManager.h
1 /*
2  *
3  * This file is part of Tulip (www.tulip-software.org)
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 
22 #ifndef DOXYGEN_NOTFOR_DEVEL
23 #ifndef TLP_PROPERTYMANAGER_H
24 #define TLP_PROPERTYMANAGER_H
25 
26 #include <map>
27 #include <string>
28 
29 namespace tlp {
30 
31 template<class itType >
32 struct Iterator;
33 
34 class PropertyInterface;
35 class Graph;
36 
37 class PropertyManager {
38 
39 private:
40  std::map<std::string, PropertyInterface*> localProperties;
41  std::map<std::string, PropertyInterface*> inheritedProperties;
42 
43 public:
44  Graph *graph;
45  explicit PropertyManager(Graph*);
46  ~PropertyManager();
47  //======================================================================================
48  bool existProperty(const std::string&) const;
49  bool existLocalProperty(const std::string&) const;
50  bool existInheritedProperty(const std::string&) const;
51  void setLocalProperty(const std::string&, PropertyInterface *);
52  bool renameLocalProperty(PropertyInterface *, const std::string&);
53  PropertyInterface* getProperty(const std::string&) const;
54  PropertyInterface* getLocalProperty(const std::string&) const;
55  PropertyInterface* getInheritedProperty(const std::string&) const;
56  void delLocalProperty(const std::string&);
57  void notifyBeforeDelInheritedProperty(const std::string&);
58  void erase(const node );
59  void erase(const edge );
60  //======================================================================================
61  Iterator<std::string>* getLocalProperties();
62  Iterator<std::string>* getInheritedProperties();
63  Iterator<PropertyInterface*>* getLocalObjectProperties();
64  Iterator<PropertyInterface*>* getInheritedObjectProperties();
65 
66 protected:
67  void setInheritedProperty(const std::string&, PropertyInterface *);
68 };
69 
70 }
71 
72 #endif
73 #endif //DOXYGEN_NOTFOR_DEVEL
74 ///@endcond