Tulip  4.0.0
Better Visualization Through Research
 All Classes 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 1 and Inria Bordeaux - Sud Ouest
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 #include <tulip/Node.h>
29 #include <tulip/Edge.h>
30 
31 namespace tlp {
32 
33 template<class itType >
34 struct Iterator;
35 
36 class PropertyInterface;
37 class Graph;
38 
39 class PropertyManager {
40 
41 private:
42  std::map<std::string, PropertyInterface*> localProperties;
43  std::map<std::string, PropertyInterface*> inheritedProperties;
44 
45 public:
46  Graph *graph;
47  explicit PropertyManager(Graph*);
48  ~PropertyManager();
49  //======================================================================================
50  bool existProperty(const std::string&) const;
51  bool existLocalProperty(const std::string&) const;
52  bool existInheritedProperty(const std::string&) const;
53  void setLocalProperty(const std::string&, PropertyInterface *);
54  PropertyInterface* getProperty(const std::string&) const;
55  PropertyInterface* getLocalProperty(const std::string&) const;
56  PropertyInterface* getInheritedProperty(const std::string&) const;
57  void delLocalProperty(const std::string&);
58  void notifyBeforeDelInheritedProperty(const std::string&);
59  void erase(const node );
60  void erase(const edge );
61  //======================================================================================
62  Iterator<std::string>* getLocalProperties();
63  Iterator<std::string>* getInheritedProperties();
64  Iterator<PropertyInterface*>* getLocalObjectProperties();
65  Iterator<PropertyInterface*>* getInheritedObjectProperties();
66 
67 protected:
68  void setInheritedProperty(const std::string&, PropertyInterface *);
69 };
70 
71 }
72 
73 #endif
74 #endif //DOXYGEN_NOTFOR_DEVEL
75 ///@endcond