Tulip  5.7.0
Large graphs analysis and drawing
AbstractProperty.h
1 /*
2  *
3  * This file is part of Tulip (https://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 ABSTRACT_PROPERTY_H
21 #define ABSTRACT_PROPERTY_H
22 
23 #include <typeinfo>
24 #include <string>
25 #include <cstdlib>
26 #include <tulip/tulipconf.h>
27 #include <tulip/StoredType.h>
28 #include <tulip/MutableContainer.h>
29 #include <tulip/PropertyInterface.h>
30 #include <tulip/Iterator.h>
31 #include <tulip/DataSet.h>
32 #include <tulip/Graph.h>
33 
34 namespace tlp {
35 
36 class GraphView;
37 
38 //==============================================================
39 
40 /**
41  * @ingroup Graph
42  * @brief This class extends upon PropertyInterface, and adds type-safe methods to
43  * get and set the node and edge values, through the magic of template programming.
44  *
45  * Nodes and Edges can have different types (e.g. tlp::LayoutProperty has tlp::PointType as node
46  * type and tlp::LineType as edge type),
47  * but most of the time they have the same type (e.g. tlp::DoubleProperty, tlp::IntegerProperty).
48  *
49  * Some of the pure virtual functions of PropertyInterface are implemented in this class (e.g.
50  * erase()).
51  *
52  * The actual data is stored in this class, and it manages the default values.
53  */
54 template <class Tnode, class Tedge, class Tprop = PropertyInterface>
55 class TLP_SCOPE AbstractProperty : public Tprop {
56  friend class Graph;
57  friend class GraphView;
58 
59 public:
60  AbstractProperty(Graph *, const std::string &n = "");
61 
62  /**
63  * @brief Gets the default node value of the property.
64  * @return The default value of nodes.
65  */
66  typename Tnode::RealType getNodeDefaultValue() const;
67 
68  /**
69  * @brief Gets the default edge value of the property.
70  * @return The default value of edges.
71  **/
72  typename Tedge::RealType getEdgeDefaultValue() const;
73 
74  /**
75  * @brief Returns the value associated with the node n in this property.
76  * If there is no value, it returns the default node value.
77  *
78  * @param n The node for which we want to get the value of the property.
79  * @return :StoredType< Tnode::RealType >::ReturnedConstValue The value of the property for this
80  *node.
81  **/
82  typename tlp::StoredType<typename Tnode::RealType>::ReturnedConstValue
83  getNodeValue(const node n) const;
84 
85  /**
86  * @brief Returns the value associated to the edge e in this property.
87  * If there is no value, it returns the default edge value.
88  *
89  * @param e The edge for which we want to get the value of the property.
90  * @return :StoredType< Tedge::RealType >::ReturnedConstValue The value of the property for this
91  *edge.
92  **/
93  typename tlp::StoredType<typename Tedge::RealType>::ReturnedConstValue
94  getEdgeValue(const edge e) const;
95 
96  /**
97  * Returns an iterator through all nodes belonging to g
98  * whose associated value is equal to val.
99  * If g is nullptr, the graph given when creating the property is considered.
100  */
101  virtual tlp::Iterator<node> *
102  getNodesEqualTo(typename tlp::StoredType<typename Tnode::RealType>::ReturnedConstValue v,
103  const Graph *g = nullptr) const;
104 
105  /**
106  * Returns an iterator through all edges belonging to g
107  * whose associated value is equal to val.
108  * If g is nullptr, the graph given when creating the property is considered.
109  */
110  virtual tlp::Iterator<edge> *
111  getEdgesEqualTo(typename tlp::StoredType<typename Tedge::RealType>::ReturnedConstValue v,
112  const Graph *g = nullptr) const;
113 
114  /**
115  * @brief Sets the value of a node and notify the observers of a modification.
116  *
117  * @param n The node to set the value of.
118  * @param v The value to affect for this node.
119  **/
120  virtual void
121  setNodeValue(const node n,
122  typename tlp::StoredType<typename Tnode::RealType>::ReturnedConstValue v);
123 
124  /**
125  * @brief Set the value of an edge and notify the observers of a modification.
126  *
127  * @param e The edge to set the value of.
128  * @param v The value to affect for this edge.
129  **/
130  virtual void
131  setEdgeValue(const edge e,
132  typename tlp::StoredType<typename Tedge::RealType>::ReturnedConstValue v);
133 
134  /**
135  * @brief Sets the value of all nodes and notify the observers.
136  * All previous values are lost and the given value is assigned as the default one to the future
137  *added nodes.
138  *
139  * @param v The value to set to all nodes.
140  *
141  **/
142  virtual void
143  setAllNodeValue(typename tlp::StoredType<typename Tnode::RealType>::ReturnedConstValue v);
144 
145  /**
146  * @brief Sets the value of all nodes to the default one
147  * and notify the observers.
148  * All previous values are lost.
149  *
150  **/
151  virtual void resetAllNodeValue();
152 
153  /**
154  * @brief Sets the value assigned as the default one to the future added nodes.
155  *
156  * @since Tulip 5.0
157  *
158  * @param v the new value to set on future added nodes.
159  *
160  * @return Whether the given string was a correct representation for this property's type. If not,
161  * the default value is not set.
162  */
163  virtual void
164  setNodeDefaultValue(typename tlp::StoredType<typename Tnode::RealType>::ReturnedConstValue v);
165 
166  /**
167  * @brief Sets the value of all nodes in a graph and notify the observers.
168  * Only the nodes from that graph will have their value modified in the property
169  * and the default node value will not be modified.
170  *
171  * @since Tulip 5.0
172  *
173  * @param v The value to set to all nodes.
174  * @param graph A graph that defines the set of nodes
175  *
176  *
177  * @warning If the provided graph is not a descendant of the one associated to that property
178  *(including itself),
179  * no node value will be modified.
180  *
181  **/
182  virtual void
183  setValueToGraphNodes(typename tlp::StoredType<typename Tnode::RealType>::ReturnedConstValue v,
184  const Graph *graph);
185 
186  /**
187  * @brief Sets the value assigned as the default one to the future added edges.
188  *
189  * @since Tulip 5.0
190  *
191  * @param value the new value to set on future added edges.
192  *
193  * @return Whether the given string was a correct representation for this property's type. If not,
194  * the default value is not set.
195  */
196  virtual void
197  setEdgeDefaultValue(typename tlp::StoredType<typename Tedge::RealType>::ReturnedConstValue v);
198 
199  /**
200  * @brief Sets the value of all edges and notify the observers.
201  * All previous values are lost and the given value is assigned as the default one to the future
202  *added edges.
203  *
204  * @param v The value to set to all edges.
205  *
206  **/
207  virtual void
208  setAllEdgeValue(typename tlp::StoredType<typename Tedge::RealType>::ReturnedConstValue v);
209 
210  /**
211  * @brief Sets the value of all edges to the default one
212  * and notify the observers.
213  * All previous values are lost.
214  *
215  **/
216  virtual void resetAllEdgeValue();
217 
218  /**
219  * @brief Sets the value of all edges in a graph and notify the observers.
220  * Only the edges from that graph will have their value modified in the property
221  * and the default edge value will not be modified.
222  *
223  * @since Tulip 5.0
224  *
225  * @param v The value to set to all edges.
226  * @param graph A graph on which to modify
227  *
228  *
229  * @warning If the provided graph is not a descendant of the one associated to that property
230  *(including itself),
231  * no edge value will be modified.
232  *
233  **/
234  virtual void
235  setValueToGraphEdges(typename tlp::StoredType<typename Tedge::RealType>::ReturnedConstValue v,
236  const Graph *graph);
237  //=================================================================================
238 
239  /**
240  * @brief Resets the value of a node to the default value.
241  *
242  * @param n The node to reset the value of.
243  *
244  **/
245  inline void erase(const node n) override {
246  setNodeValue(n, nodeDefaultValue);
247  }
248  //=================================================================================
249 
250  /**
251  * @brief Resets the value of an edge to the default value.
252  *
253  * @param e The edge to reset the value of.
254  *
255  **/
256  inline void erase(const edge e) override {
257  setEdgeValue(e, edgeDefaultValue);
258  }
259  //=================================================================================
260  /**
261  * @brief This operator overload allows to copy a property using the following syntax :
262  *
263  * @code
264  * IntegerProperty* shape = graph->getProperty<IntegerProperty>("viewShape");
265  * IntegerProperty* backup = graph->getProperty<IntegerProperty>("shapeBackup");
266  * *backup = *shape; // all the values from 'shape' will be copied into 'backup'.
267  * @endcode
268  * @param prop The property to copy the values from.
269  * @return This property with the values copied.
270  */
273  if (this != &prop) {
274  if (Tprop::graph == nullptr)
275  Tprop::graph = prop.Tprop::graph;
276 
277  if (Tprop::graph == prop.Tprop::graph) {
278  setAllNodeValue(prop.getNodeDefaultValue());
279  setAllEdgeValue(prop.getEdgeDefaultValue());
280 
281  for (auto itn : prop.getNonDefaultValuatedNodes()) {
282  setNodeValue(itn, prop.getNodeValue(itn));
283  }
284 
285  for (auto ite : prop.getNonDefaultValuatedEdges()) {
286  setEdgeValue(ite, prop.getEdgeValue(ite));
287  }
288 
289  } else {
290  //==============================================================*
291  for (auto n : Tprop::graph->nodes()) {
292  if (prop.Tprop::graph->isElement(n))
293  setNodeValue(n, prop.getNodeValue(n));
294  }
295 
296  for (auto e : Tprop::graph->edges()) {
297  if (prop.Tprop::graph->isElement(e))
298  setEdgeValue(e, prop.getEdgeValue(e));
299  }
300  }
301 
302  clone_handler(prop);
303  }
304 
305  return *this;
306  }
307  //=================================================================================
308  // Untyped accessors inherited from PropertyInterface, documentation is inherited
309  std::string getNodeDefaultStringValue() const override {
310  typename Tnode::RealType v = getNodeDefaultValue();
311  return Tnode::toString(v);
312  }
313  std::string getEdgeDefaultStringValue() const override {
314  typename Tedge::RealType v = getEdgeDefaultValue();
315  return Tedge::toString(v);
316  }
317  std::string getNodeStringValue(const node n) const override {
318  typename Tnode::RealType v = getNodeValue(n);
319  return Tnode::toString(v);
320  }
321  std::string getEdgeStringValue(const edge e) const override {
322  typename Tedge::RealType v = getEdgeValue(e);
323  return Tedge::toString(v);
324  }
325  bool setNodeStringValue(const node inN, const std::string &inV) override {
326  typename Tnode::RealType v;
327 
328  if (!Tnode::fromString(v, inV))
329  return false;
330 
331  setNodeValue(inN, v);
332  return true;
333  }
334  bool setEdgeStringValue(const edge inE, const std::string &inV) override {
335  typename Tedge::RealType v;
336 
337  if (!Tedge::fromString(v, inV))
338  return false;
339 
340  setEdgeValue(inE, v);
341  return true;
342  }
343  bool setNodeDefaultStringValue(const std::string &inV) override {
344  typename Tnode::RealType v;
345 
346  if (!Tnode::fromString(v, inV))
347  return false;
348 
349  setNodeDefaultValue(v);
350  return true;
351  }
352  bool setAllNodeStringValue(const std::string &inV) override {
353  typename Tnode::RealType v;
354 
355  if (!Tnode::fromString(v, inV))
356  return false;
357 
358  setAllNodeValue(v);
359  return true;
360  }
361  bool setStringValueToGraphNodes(const std::string &inV, const Graph *graph) override {
362  typename Tnode::RealType v;
363 
364  if (!Tnode::fromString(v, inV))
365  return false;
366 
367  setValueToGraphNodes(v, graph);
368  return true;
369  }
370  bool setEdgeDefaultStringValue(const std::string &inV) override {
371  typename Tedge::RealType v;
372 
373  if (!Tedge::fromString(v, inV))
374  return false;
375 
376  setEdgeDefaultValue(v);
377  return true;
378  }
379  bool setAllEdgeStringValue(const std::string &inV) override {
380  typename Tedge::RealType v;
381 
382  if (!Tedge::fromString(v, inV))
383  return false;
384 
385  setAllEdgeValue(v);
386  return true;
387  }
388  bool setStringValueToGraphEdges(const std::string &inV, const Graph *graph) override {
389  typename Tedge::RealType v;
390 
391  if (!Tedge::fromString(v, inV))
392  return false;
393 
394  setValueToGraphEdges(v, graph);
395  return true;
396  }
397  tlp::Iterator<node> *getNonDefaultValuatedNodes(const Graph *g = nullptr) const override;
398  bool hasNonDefaultValuatedNodes(const Graph *g = nullptr) const override;
399  unsigned int numberOfNonDefaultValuatedNodes(const Graph *g = nullptr) const override;
400  unsigned int nodeValueSize() const override;
401  void writeNodeDefaultValue(std::ostream &) const override;
402  void writeNodeValue(std::ostream &, node) const override;
403  bool readNodeDefaultValue(std::istream &) override;
404  bool readNodeValue(std::istream &, node) override;
405  tlp::Iterator<edge> *getNonDefaultValuatedEdges(const Graph *g = nullptr) const override;
406  bool hasNonDefaultValuatedEdges(const Graph *g = nullptr) const override;
407  unsigned int numberOfNonDefaultValuatedEdges(const Graph * = nullptr) const override;
408  unsigned int edgeValueSize() const override;
409  void writeEdgeDefaultValue(std::ostream &) const override;
410  void writeEdgeValue(std::ostream &, edge) const override;
411  bool readEdgeDefaultValue(std::istream &) override;
412  bool readEdgeValue(std::istream &, edge) override;
413  bool copy(const node destination, const node source, PropertyInterface *property,
414  bool ifNotDefault = false) override {
415  if (property == nullptr)
416  return false;
417 
419  dynamic_cast<tlp::AbstractProperty<Tnode, Tedge, Tprop> *>(property);
420  assert(tp);
421  bool notDefault;
422  typename StoredType<typename Tnode::RealType>::ReturnedValue value =
423  tp->nodeProperties.get(source.id, notDefault);
424 
425  if (ifNotDefault && !notDefault)
426  return false;
427 
428  setNodeValue(destination, value);
429  return true;
430  }
431  bool copy(const edge destination, const edge source, PropertyInterface *property,
432  bool ifNotDefault = false) override {
433  if (property == nullptr)
434  return false;
435 
437  dynamic_cast<tlp::AbstractProperty<Tnode, Tedge, Tprop> *>(property);
438  assert(tp);
439  bool notDefault;
440  typename StoredType<typename Tedge::RealType>::ReturnedValue value =
441  tp->edgeProperties.get(source.id, notDefault);
442 
443  if (ifNotDefault && !notDefault)
444  return false;
445 
446  setEdgeValue(destination, value);
447  return true;
448  }
449  void copy(PropertyInterface *property) override {
451  dynamic_cast<typename tlp::AbstractProperty<Tnode, Tedge, Tprop> *>(property);
452  assert(prop != nullptr);
453  *this = *prop;
454  }
455  // for performance reason and use in GraphUpdatesRecorder
456  DataMem *getNodeDefaultDataMemValue() const override {
457  return new TypedValueContainer<typename Tnode::RealType>(getNodeDefaultValue());
458  }
459  DataMem *getEdgeDefaultDataMemValue() const override {
460  return new TypedValueContainer<typename Tedge::RealType>(getEdgeDefaultValue());
461  }
462  DataMem *getNodeDataMemValue(const node n) const override {
463  return new TypedValueContainer<typename Tnode::RealType>(getNodeValue(n));
464  }
465  DataMem *getEdgeDataMemValue(const edge e) const override {
466  return new TypedValueContainer<typename Tedge::RealType>(getEdgeValue(e));
467  }
468  DataMem *getNonDefaultDataMemValue(const node n) const override {
469  bool notDefault;
470  typename StoredType<typename Tnode::RealType>::ReturnedValue value =
471  nodeProperties.get(n.id, notDefault);
472 
473  if (notDefault)
474  return new TypedValueContainer<typename Tnode::RealType>(value);
475 
476  return nullptr;
477  }
478  DataMem *getNonDefaultDataMemValue(const edge e) const override {
479  bool notDefault;
480  typename StoredType<typename Tedge::RealType>::ReturnedValue value =
481  edgeProperties.get(e.id, notDefault);
482 
483  if (notDefault)
484  return new TypedValueContainer<typename Tedge::RealType>(value);
485 
486  return nullptr;
487  }
488  void setNodeDataMemValue(const node n, const DataMem *v) override {
489  setNodeValue(n, static_cast<const TypedValueContainer<typename Tnode::RealType> *>(v)->value);
490  }
491  void setEdgeDataMemValue(const edge e, const DataMem *v) override {
492  setEdgeValue(e, static_cast<const TypedValueContainer<typename Tedge::RealType> *>(v)->value);
493  }
494  void setAllNodeDataMemValue(const DataMem *v) override {
495  setAllNodeValue(static_cast<const TypedValueContainer<typename Tnode::RealType> *>(v)->value);
496  }
497  void setAllEdgeDataMemValue(const DataMem *v) override {
498  setAllEdgeValue(static_cast<const TypedValueContainer<typename Tedge::RealType> *>(v)->value);
499  }
500 
501  // PropertyInterface methods
502  // mN is the meta node, sg is the corresponding subgraph
503  // and mg is the graph owning mN
504  void computeMetaValue(node n, Graph *sg, Graph *mg) override {
505  if (Tprop::metaValueCalculator)
507  Tprop::metaValueCalculator)
508  ->computeMetaValue(this, n, sg, mg);
509  }
510  // mE is the meta edge, itE is an iterator on the underlying edges
511  // mg is the graph owning mE
512  void computeMetaValue(edge e, tlp::Iterator<edge> *itE, Graph *mg) override {
513  if (Tprop::metaValueCalculator)
515  Tprop::metaValueCalculator)
516  ->computeMetaValue(this, e, itE, mg);
517  }
519  if (mvCalc &&
521  mvCalc)) {
522  tlp::warning()
523  << "Warning : " << __PRETTY_FUNCTION__ << " ... invalid conversion of "
524  << typeid(mvCalc).name() << "into "
526  .name()
527  << std::endl;
528  abort();
529  }
530 
531  Tprop::metaValueCalculator = mvCalc;
532  }
533 
534  int compare(const node n1, const node n2) const override;
535  int compare(const edge e1, const edge e2) const override;
536 
537  /**
538  * @brief This class is used to delegate the computation of the values associated to meta nodes or
539  *edges.
540  **/
542  public:
543  // computes the value of the meta node mN of the graph mg
544  // for the property prop, according to the values associated
545  // to the underlying nodes i.e the nodes of the subgraph sg.
546  virtual void computeMetaValue(AbstractProperty<Tnode, Tedge, Tprop> *, node, Graph *, Graph *) {
547  }
548  // computes the value of the meta node mE of the graph mg
549  // for the property prop, according to the values associated
550  // to the underlying edges given by the iterator itE.
551  // The method do not have to delete the iterator
552  virtual void computeMetaValue(AbstractProperty<Tnode, Tedge, Tprop> *, edge,
553  tlp::Iterator<edge> *, Graph *) {}
554  };
555 
556 protected:
557  //=================================================================================
558  /// Enable to clone part of sub_class
560 
561  MutableContainer<typename Tnode::RealType> nodeProperties;
562  MutableContainer<typename Tedge::RealType> edgeProperties;
563  typename Tnode::RealType nodeDefaultValue;
564  typename Tedge::RealType edgeDefaultValue;
565 };
566 
567 template <typename vectType, typename eltType, typename propType = VectorPropertyInterface>
568 class TLP_SCOPE AbstractVectorProperty : public AbstractProperty<vectType, vectType, propType> {
569 public:
570  AbstractVectorProperty(Graph *, const std::string &name = "");
571 
572  // 5 methods inherited from VectorPropertyInterface
573  bool tokenize(const std::string &str, std::vector<std::string> &vect, char openChar = '(',
574  char sepChar = ',', char closeChar = ')') override;
575 
576  bool setNodeStringValueAsVector(const node n, const std::vector<std::string> &values) override;
577 
578  bool setNodeStringValueAsVector(const node, const std::string &, char, char, char) override;
579 
580  bool setEdgeStringValueAsVector(const edge e, const std::vector<std::string> &values) override;
581 
582  bool setEdgeStringValueAsVector(const edge, const std::string &, char, char, char) override;
583 
584  /**
585  * @brief Sets the value for node n, at index i, to v, and notify the observers of a modification.
586  *
587  * @param n The node to set a value of.
588  * @param i The index at which the value should be set.
589  * @param v The value to set.
590  *
591  **/
592  void setNodeEltValue(const node n, unsigned int i,
593  typename tlp::StoredType<typename eltType::RealType>::ReturnedConstValue v);
594  /**
595  * @brief Gets the value associated to node n, at index i.
596  *
597  * @param n The node to set a value of.
598  * @param i The index at which to set the value.
599  * @return const eltType& The value at index i in the vector for node n.
600  **/
601  typename tlp::StoredType<typename eltType::RealType>::ReturnedConstValue
602  getNodeEltValue(const node n, unsigned int i) const;
603  /**
604  * @brief Appends a new value at the end of the vector associated to node n, and notify the
605  *observers of a modification.
606  *
607  * @param n The node to add a value to.
608  * @param v The value to append at the end of the vector.
609  *
610  **/
611  void
612  pushBackNodeEltValue(const node n,
613  typename tlp::StoredType<typename eltType::RealType>::ReturnedConstValue v);
614  /**
615  * @brief Removes the value at the end of the vector associated to node n, and notify the
616  *observers of a modification.
617  *
618  * @param n The node to remove a value from.
619  *
620  **/
621  void popBackNodeEltValue(const node n);
622  /**
623  * @brief Resizes the vector associated to node n, and notify the observers of a modification.
624  *
625  * @param n The node associated to the vector to resize.
626  * @param size The new size of the vector.
627  * @param elt The default value to set at indices where there was no value before. Defaults to
628  *eltType().
629  *
630  **/
631  void resizeNodeValue(const node n, size_t size,
632  typename eltType::RealType elt = eltType::defaultValue());
633  /**
634  * @brief Sets the value for edge e, at index i, to v, and notify the observers of a modification.
635  *
636  * @param e The edge to set the value of.
637  * @param i The index at which the value should be set.
638  * @param v The value to set.
639  *
640  **/
641  void setEdgeEltValue(const edge e, unsigned int i,
642  typename tlp::StoredType<typename eltType::RealType>::ReturnedConstValue v);
643  /**
644  * @brief Gets the value associated to edge e, at index i.
645  *
646  * @param e The edge to set a value of.
647  * @param i The index at which to set the value.
648  * @return const eltType& The value at index i in the vector for node n.
649  **/
650  typename tlp::StoredType<typename eltType::RealType>::ReturnedConstValue
651  getEdgeEltValue(const edge n, unsigned int i) const;
652  /**
653  * @brief Appends a new value at the end of the vector associated to edge e, and notify the
654  *observers of a modification.
655  *
656  * @param e The node to add a value to.
657  * @param v The value to append at the end of the vector.
658  *
659  **/
660  void
661  pushBackEdgeEltValue(const edge e,
662  typename tlp::StoredType<typename eltType::RealType>::ReturnedConstValue v);
663  /**
664  * @brief Removes the value at the end of the vector associated to edge e, and notify the
665  *observers of a modification.
666  *
667  * @param e The edge to remove a value from.
668  *
669  **/
670  void popBackEdgeEltValue(const edge e);
671  /**
672  * @brief Resizes the vector associated to edge e, and notify the observers of a modification.
673  *
674  * @param e The edge associated to the vector to resize.
675  * @param size The new size of the vector.
676  * @param elt The default value to set at indices where there was no value before. Defaults to
677  *eltType().
678  *
679  **/
680  void resizeEdgeValue(const edge e, size_t size,
681  typename eltType::RealType elt = eltType::defaultValue());
682 };
683 } // namespace tlp
684 #if !defined(_MSC_VER) || defined(DLL_TULIP) // When using VC++, we only want to include this when
685  // we are in the TULIP dll. With any other compiler,
686  // include it all the time
687 #include "cxx/AbstractProperty.cxx"
688 #endif
689 #endif
tlp::AbstractProperty::erase
void erase(const node n) override
Resets the value of a node to the default value.
Definition: AbstractProperty.h:245
tlp::AbstractProperty::getNonDefaultDataMemValue
DataMem * getNonDefaultDataMemValue(const edge e) const override
Returns the value in a DataMem if it is not default, otherwise returns nullptr.
Definition: AbstractProperty.h:478
tlp::AbstractProperty::getNodeDefaultDataMemValue
DataMem * getNodeDefaultDataMemValue() const override
Gets a pointer to the tlp::DataMem structure that contains the node default value.
Definition: AbstractProperty.h:456
tlp::PropertyInterface::MetaValueCalculator
Base class for computing values on meta nodes and edges.
Definition: PropertyInterface.h:545
tlp::AbstractProperty::setMetaValueCalculator
void setMetaValueCalculator(PropertyInterface::MetaValueCalculator *mvCalc) override
Sets the Calculator for meta nodes and edges.
Definition: AbstractProperty.h:518
tlp::AbstractProperty::getEdgeValue
tlp::StoredType< typename Tedge::RealType >::ReturnedConstValue getEdgeValue(const edge e) const
Returns the value associated to the edge e in this property. If there is no value,...
Definition: AbstractProperty.cxx:54
tlp::AbstractProperty::setEdgeDataMemValue
void setEdgeDataMemValue(const edge e, const DataMem *v) override
Sets the edge value.
Definition: AbstractProperty.h:491
tlp::Graph
Definition: Graph.h:234
tlp::AbstractProperty::getNodeDataMemValue
DataMem * getNodeDataMemValue(const node n) const override
Gets the node value, contained in a tlp::DataMem structure.
Definition: AbstractProperty.h:462
tlp::AbstractProperty::copy
bool copy(const node destination, const node source, PropertyInterface *property, bool ifNotDefault=false) override
Copies the value of a node in another property to a node in this property.
Definition: AbstractProperty.h:413
tlp::AbstractProperty::copy
void copy(PropertyInterface *property) override
Copies the values of the source property to this property.
Definition: AbstractProperty.h:449
tlp::AbstractProperty::getEdgeDefaultValue
Tedge::RealType getEdgeDefaultValue() const
Gets the default edge value of the property.
Definition: AbstractProperty.cxx:41
tlp::AbstractProperty::getEdgeDefaultStringValue
std::string getEdgeDefaultStringValue() const override
Gets a string representation of the edge default value.
Definition: AbstractProperty.h:313
tlp::AbstractProperty::setAllEdgeDataMemValue
void setAllEdgeDataMemValue(const DataMem *v) override
Sets all the edges value to the value contained in the given DataMem structure. All previous values a...
Definition: AbstractProperty.h:497
tlp::AbstractProperty::erase
void erase(const edge e) override
Resets the value of an edge to the default value.
Definition: AbstractProperty.h:256
tlp::AbstractProperty::getEdgeStringValue
std::string getEdgeStringValue(const edge e) const override
Gets a string representation of the edge value.
Definition: AbstractProperty.h:321
tlp::AbstractProperty::setEdgeDefaultStringValue
bool setEdgeDefaultStringValue(const std::string &inV) override
Sets the value assigned as the default one to the future added edges from a string representation.
Definition: AbstractProperty.h:370
tlp::AbstractProperty::getEdgeDefaultDataMemValue
DataMem * getEdgeDefaultDataMemValue() const override
Gets a pointer to the tlp::DataMem structure that contains the edge default value.
Definition: AbstractProperty.h:459
tlp::AbstractProperty::computeMetaValue
void computeMetaValue(edge e, tlp::Iterator< edge > *itE, Graph *mg) override
Sets the value of the metaedge to a computed value.
Definition: AbstractProperty.h:512
tlp::AbstractProperty::setNodeDataMemValue
void setNodeDataMemValue(const node n, const DataMem *v) override
Sets the node value.
Definition: AbstractProperty.h:488
tlp::AbstractProperty::operator=
virtual AbstractProperty< Tnode, Tedge, Tprop > & operator=(AbstractProperty< Tnode, Tedge, Tprop > &prop)
This operator overload allows to copy a property using the following syntax :
Definition: AbstractProperty.h:272
tlp::node::id
unsigned int id
id The identifier of the node.
Definition: Node.h:44
tlp::PropertyInterface
PropertyInterface describes the interface of a graph property.
Definition: PropertyInterface.h:60
tlp::AbstractProperty::setAllNodeDataMemValue
void setAllNodeDataMemValue(const DataMem *v) override
Sets all the nodes value to the value contained in the given DataMem structure. All previous values a...
Definition: AbstractProperty.h:494
tlp::AbstractProperty::MetaValueCalculator
This class is used to delegate the computation of the values associated to meta nodes or edges.
Definition: AbstractProperty.h:541
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::AbstractProperty::getNodeValue
tlp::StoredType< typename Tnode::RealType >::ReturnedConstValue getNodeValue(const node n) const
Returns the value associated with the node n in this property. If there is no value,...
Definition: AbstractProperty.cxx:47
tlp::AbstractProperty::setEdgeStringValue
bool setEdgeStringValue(const edge inE, const std::string &inV) override
Sets a new value on the edge, represented by the string parameter.
Definition: AbstractProperty.h:334
tlp::AbstractProperty::setAllEdgeStringValue
bool setAllEdgeStringValue(const std::string &inV) override
Sets all the edges value to the value represented by the string. For some types, some parsing will be...
Definition: AbstractProperty.h:379
tlp::edge::id
unsigned int id
id The identifier of the edge.
Definition: Edge.h:44
tlp::AbstractProperty::getEdgeDataMemValue
DataMem * getEdgeDataMemValue(const edge e) const override
Gets the edge value, contained in a tlp::DataMem structure.
Definition: AbstractProperty.h:465
tlp::AbstractProperty::getNodeStringValue
std::string getNodeStringValue(const node n) const override
Gets a string representation of the node value.
Definition: AbstractProperty.h:317
tlp::AbstractProperty::copy
bool copy(const edge destination, const edge source, PropertyInterface *property, bool ifNotDefault=false) override
Copies the value of an edge in another property to an edge in this property.
Definition: AbstractProperty.h:431
tlp::AbstractProperty::setAllNodeStringValue
bool setAllNodeStringValue(const std::string &inV) override
Sets all the nodes value to the value represented by the string. For some types, some parsing will be...
Definition: AbstractProperty.h:352
tlp::AbstractProperty::computeMetaValue
void computeMetaValue(node n, Graph *sg, Graph *mg) override
Sets the value of the metanode to a computed value.
Definition: AbstractProperty.h:504
tlp::AbstractProperty::setNodeDefaultStringValue
bool setNodeDefaultStringValue(const std::string &inV) override
Sets the value assigned as the default one to the future added nodes from a string representation.
Definition: AbstractProperty.h:343
tlp::AbstractProperty::setNodeStringValue
bool setNodeStringValue(const node inN, const std::string &inV) override
Sets a new value on the node, represented by the string parameter.
Definition: AbstractProperty.h:325
tlp::Iterator
Interface for Tulip iterators. Allows basic iteration operations only.
Definition: Graph.h:43
tlp
Definition: AbstractProperty.h:34
tlp::AbstractProperty::setStringValueToGraphEdges
bool setStringValueToGraphEdges(const std::string &inV, const Graph *graph) override
Sets all the edges value to the value represented by the string for a graph. For some types,...
Definition: AbstractProperty.h:388
tlp::AbstractProperty::getNonDefaultDataMemValue
DataMem * getNonDefaultDataMemValue(const node n) const override
Returns the value in a DataMem if it is not default, otherwise returns nullptr.
Definition: AbstractProperty.h:468
tlp::AbstractProperty::setStringValueToGraphNodes
bool setStringValueToGraphNodes(const std::string &inV, const Graph *graph) override
Sets all the nodes value to the value represented by the string for a graph. For some types,...
Definition: AbstractProperty.h:361
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::AbstractProperty::getNodeDefaultValue
Tnode::RealType getNodeDefaultValue() const
Gets the default node value of the property.
Definition: AbstractProperty.cxx:35
tlp::AbstractProperty::getNonDefaultValuatedNodes
tlp::Iterator< node > * getNonDefaultValuatedNodes(const Graph *g=nullptr) const override
Gets an Iterator on all non-default valuated nodes. When given a Graph as parameter,...
Definition: AbstractProperty.cxx:381
tlp::AbstractProperty::clone_handler
virtual void clone_handler(AbstractProperty< Tnode, Tedge, Tprop > &)
Enable to clone part of sub_class.
Definition: AbstractProperty.h:559
tlp::AbstractProperty::getNodeDefaultStringValue
std::string getNodeDefaultStringValue() const override
Gets a string representation of the node default value.
Definition: AbstractProperty.h:309
tlp::AbstractProperty::getNonDefaultValuatedEdges
tlp::Iterator< edge > * getNonDefaultValuatedEdges(const Graph *g=nullptr) const override
Gets an Iterator on all non-default valuated edges. When given a Graph as parameter,...
Definition: AbstractProperty.cxx:463