Tulip  5.6.0
Large graphs analysis and drawing
StringProperty.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 
20 #ifndef TULIP_STRING_H
21 #define TULIP_STRING_H
22 
23 #include <tulip/PropertyTypes.h>
24 #include <tulip/AbstractProperty.h>
25 
26 namespace tlp {
27 
28 class PropertyContext;
29 
30 typedef AbstractProperty<tlp::StringType, tlp::StringType> AbstractStringProperty;
31 
32 /**
33  * @ingroup Graph
34  * @brief A graph property that maps a std::string value to graph elements.
35  */
36 class TLP_SCOPE StringProperty : public AbstractStringProperty {
37 public:
38  StringProperty(Graph *g, const std::string &n = "");
39 
40  // redefinition of some PropertyInterface methods
41  PropertyInterface *clonePrototype(Graph *, const std::string &) const override;
42  static const std::string propertyTypename;
43  const std::string &getTypename() const override {
44  return propertyTypename;
45  }
46  DEFINE_GET_CPP_CLASS_NAME;
47  // the value size of a StringVectorProperty is not fixed
48  unsigned int nodeValueSize() const override {
49  return 0;
50  }
51  unsigned int edgeValueSize() const override {
52  return 0;
53  }
54  int compare(const node n1, const node n2) const override;
55  int compare(const edge e1, const edge e2) const override;
56 };
57 
58 /**
59  * @ingroup Graph
60  * @brief A graph property that maps a std::vector<std::string> value to graph elements.
61  */
62 class TLP_SCOPE StringVectorProperty
63  : public AbstractVectorProperty<tlp::StringVectorType, tlp::StringType> {
64 public:
65  StringVectorProperty(Graph *g, const std::string &n = "")
66  : AbstractVectorProperty<StringVectorType, tlp::StringType>(g, n) {}
67 
68  // redefinition of some PropertyInterface methods
69  PropertyInterface *clonePrototype(Graph *, const std::string &) const override;
70  static const std::string propertyTypename;
71  const std::string &getTypename() const override {
72  return propertyTypename;
73  }
74  DEFINE_GET_CPP_CLASS_NAME;
75  // the value size of a StringVectorProperty is not fixed
76  unsigned int nodeValueSize() const override {
77  return 0;
78  }
79  unsigned int edgeValueSize() const override {
80  return 0;
81  }
82 };
83 /*\@}*/
84 } // namespace tlp
85 #endif
tlp::StringProperty::edgeValueSize
unsigned int edgeValueSize() const override
Returns the size in bytes of an edge's value.
Definition: StringProperty.h:51
tlp::Graph
Definition: Graph.h:234
tlp::StringProperty::nodeValueSize
unsigned int nodeValueSize() const override
Returns the size in bytes of a node's value.
Definition: StringProperty.h:48
tlp::StringProperty
A graph property that maps a std::string value to graph elements.
Definition: StringProperty.h:36
tlp::StringVectorProperty::edgeValueSize
unsigned int edgeValueSize() const override
Returns the size in bytes of an edge's value.
Definition: StringProperty.h:79
tlp::StringVectorProperty
A graph property that maps a std::vector<std::string> value to graph elements.
Definition: StringProperty.h:62
tlp::StringVectorProperty::nodeValueSize
unsigned int nodeValueSize() const override
Returns the size in bytes of a node's value.
Definition: StringProperty.h:76
tlp::PropertyInterface
PropertyInterface describes the interface of a graph property.
Definition: PropertyInterface.h:60
tlp::AbstractProperty
This class extends upon PropertyInterface, and adds type-safe methods to get and set the node and edg...
Definition: AbstractProperty.h:55
tlp::StringProperty::getTypename
const std::string & getTypename() const override
Gets a string describing the type of the property value (e.g. "graph", "double", "layout",...
Definition: StringProperty.h:43
tlp
Definition: AbstractProperty.h:34
tlp::edge
The edge struct represents an edge in a Graph object.
Definition: Edge.h:40
tlp::node
The node struct represents a node in a Graph object.
Definition: Node.h:40
tlp::StringVectorProperty::getTypename
const std::string & getTypename() const override
Gets a string describing the type of the property value (e.g. "graph", "double", "layout",...
Definition: StringProperty.h:71