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) > 38 template<
typename nodeType,
typename edgeType,
typename propType=PropertyInterface>
52 typename nodeType::RealType NodeMax,
typename edgeType::RealType EdgeMin,
typename edgeType::RealType EdgeMax);
127 MINMAX_MAP(nodeType) minMaxNode;
128 MINMAX_MAP(edgeType) minMaxEdge;
130 typename nodeType::RealType _nodeMin;
131 typename nodeType::RealType _nodeMax;
132 typename edgeType::RealType _edgeMin;
133 typename edgeType::RealType _edgeMax;
136 bool needGraphListener;
138 MINMAX_PAIR(nodeType) computeMinMaxNode(
const Graph* graph);
139 MINMAX_PAIR(edgeType) computeMinMaxEdge(
const Graph* graph);
140 void removeListenersAndClearNodeMap();
141 void removeListenersAndClearEdgeMap();
146 #include "cxx/minmaxproperty.cxx" 148 #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.
nodeType::RealType getNodeMin(const Graph *graph=NULL)
Gets the minimum value on the nodes. It is only computed if it has never been retrieved before...
nodeType::RealType getNodeMax(const Graph *graph=NULL)
Computes the maximum 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.
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.
edgeType::RealType getEdgeMin(const Graph *graph=NULL)
Computes the minimum value on the edges. It is only computed if it has never been retrieved before...
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.
edgeType::RealType getEdgeMax(const Graph *graph=NULL)
Computes the maximum value on the edges. It is only computed if it has never been retrieved before...