20 #ifndef MINMAXPROPERTY_H 21 #define MINMAXPROPERTY_H 23 #include <tulip/tuliphash.h> 24 #include <tulip/Observable.h> 25 #include <tulip/AbstractProperty.h> 27 #define MINMAX_PAIR(TYPE) std::pair<typename TYPE::RealType, typename TYPE::RealType> 28 #define MINMAX_MAP(TYPE) typename TLP_HASH_MAP<unsigned int, MINMAX_PAIR(TYPE)> 39 template <
typename nodeType,
typename edgeType,
typename propType = PropertyInterface>
53 typename nodeType::RealType NodeMax,
typename edgeType::RealType EdgeMin,
54 typename edgeType::RealType EdgeMax);
56 void treatEvent(
const tlp::Event &ev)
override;
134 MINMAX_MAP(nodeType) minMaxNode;
135 MINMAX_MAP(edgeType) minMaxEdge;
137 typename nodeType::RealType _nodeMin;
138 typename nodeType::RealType _nodeMax;
139 typename edgeType::RealType _edgeMin;
140 typename edgeType::RealType _edgeMax;
143 bool needGraphListener;
145 MINMAX_PAIR(nodeType) computeMinMaxNode(
const Graph *graph);
146 MINMAX_PAIR(edgeType) computeMinMaxEdge(
const Graph *graph);
147 void removeListenersAndClearNodeMap();
148 void removeListenersAndClearEdgeMap();
152 #include "cxx/minmaxproperty.cxx" 154 #endif // MINMAXPROPERTY_H This class extends upon PropertyInterface, and adds type-safe methods to get and set the node and edg...
Abstracts the computation of minimal and maximal values on node and edge values of properties...
void updateAllNodesValues(typename nodeType::RealType newValue)
Updates the value of all nodes, setting the maximum and minimum values to this. Should be called by s...
MinMaxProperty(tlp::Graph *graph, const std::string &name, typename nodeType::RealType NodeMin, typename nodeType::RealType NodeMax, typename edgeType::RealType EdgeMin, typename edgeType::RealType EdgeMax)
Constructs a MinMaxProperty.
edgeType::RealType getEdgeMax(const Graph *graph=nullptr)
Computes the maximum value on the edges. It is only computed if it has never been retrieved before...
nodeType::RealType getNodeMin(const Graph *graph=nullptr)
Gets the minimum value on the nodes. It is only computed if it has never been retrieved before...
The edge struct represents an edge in a Graph object.
The node struct represents a node in a Graph object.
nodeType::RealType getNodeMax(const Graph *graph=nullptr)
Computes the maximum value on the nodes. It is only computed if it has never been retrieved before...
edgeType::RealType getEdgeMin(const Graph *graph=nullptr)
Computes the minimum value on the edges. It is only computed if it has never been retrieved before...
Event is the base class for all events used in the Observation mechanism.
void updateAllEdgesValues(typename edgeType::RealType newValue)
Updates the value of all edges, setting the maximum and minimum values to this. Should be called by s...
void updateEdgeValue(tlp::edge e, typename edgeType::RealType newValue)
Updates the value on an edge, and updates the minimal/maximal cached values if necessary. Should be called by subclasses in order to keep the cache up to date.
void updateNodeValue(tlp::node n, typename nodeType::RealType newValue)
Updates the value on a node, and updates the minimal/maximal cached values if necessary. Should be called by subclasses in order to keep the cache up to date.