20 #ifndef PROPERTY_INTERFACE_H
21 #define PROPERTY_INTERFACE_H
24 #include <tulip/tulipconf.h>
25 #include <tulip/Observable.h>
26 #include <tulip/Node.h>
27 #include <tulip/Edge.h>
34 template<
class itType >
36 class PropertyObserver;
54 friend class PropertyManager;
70 virtual void erase(
const node) = 0;
76 virtual void erase(
const edge) = 0;
87 bool ifNotDefault =
false) =0;
97 bool ifNotDefault =
false) =0;
119 virtual std::string getTypename()
const = 0;
162 virtual std::string getNodeStringValue(
const node n )
const = 0;
169 virtual std::string getEdgeStringValue(
const edge e )
const = 0;
177 virtual bool setNodeStringValue(
const node n,
const std::string & value ) = 0;
185 virtual bool setEdgeStringValue(
const edge e,
const std::string & value ) = 0;
191 virtual std::string getNodeDefaultStringValue()
const = 0;
197 virtual std::string getEdgeDefaultStringValue()
const = 0;
205 virtual bool setAllNodeStringValue(
const std::string & value ) = 0;
213 virtual bool setAllEdgeStringValue(
const std::string & value ) = 0;
220 virtual DataMem* getNodeDefaultDataMemValue()
const = 0;
227 virtual DataMem* getEdgeDefaultDataMemValue()
const = 0;
234 virtual void setAllNodeDataMemValue(
const DataMem* value) = 0;
241 virtual void setAllEdgeDataMemValue(
const DataMem* v ) = 0;
250 virtual DataMem* getNodeDataMemValue(
const node n )
const = 0;
259 virtual DataMem* getEdgeDataMemValue(
const edge e )
const = 0;
268 virtual DataMem* getNonDefaultDataMemValue(
const node n )
const = 0;
277 virtual DataMem* getNonDefaultDataMemValue(
const edge e )
const = 0;
284 virtual void setNodeDataMemValue(
const node n,
const DataMem* value) = 0;
291 virtual void setEdgeDataMemValue(
const edge e,
const DataMem* v) = 0;
300 virtual tlp::Iterator<node>* getNonDefaultValuatedNodes(
const Graph* = NULL)
const = 0;
309 virtual tlp::Iterator<edge>* getNonDefaultValuatedEdges(
const Graph* = NULL)
const = 0;
319 virtual void computeMetaValue(node metaNode, Graph* subgraph, Graph* metaGraph)=0;
327 virtual void computeMetaValue(edge metaEdge, tlp::Iterator<edge>* it, Graph* metaGraph)=0;
342 return metaValueCalculator;
352 metaValueCalculator = calculator;
368 removeListener(pObs);
377 virtual int compare(
const node n1,
const node n2)
const = 0;
385 virtual int compare(
const edge e1,
const edge e2)
const = 0;
388 MetaValueCalculator* metaValueCalculator;
391 void notifyBeforeSetNodeValue(
const node n);
392 void notifyAfterSetNodeValue(
const node n);
393 void notifyBeforeSetEdgeValue(
const edge e);
394 void notifyAfterSetEdgeValue(
const edge e);
395 void notifyBeforeSetAllNodeValue();
396 void notifyAfterSetAllNodeValue();
397 void notifyBeforeSetAllEdgeValue();
398 void notifyAfterSetAllEdgeValue();
399 void notifyDestroy();
413 enum PropertyEventType {TLP_BEFORE_SET_NODE_VALUE = 0,
414 TLP_AFTER_SET_NODE_VALUE,
415 TLP_BEFORE_SET_ALL_NODE_VALUE,
416 TLP_AFTER_SET_ALL_NODE_VALUE,
417 TLP_BEFORE_SET_ALL_EDGE_VALUE,
418 TLP_AFTER_SET_ALL_EDGE_VALUE,
419 TLP_BEFORE_SET_EDGE_VALUE,
420 TLP_AFTER_SET_EDGE_VALUE
423 Event::EventType evtType = Event::TLP_MODIFICATION,
424 unsigned int id = UINT_MAX)
425 :
Event(prop, evtType), evtType(propEvtType), eltId(
id) {}
431 node getNode()
const {
432 assert(evtType < TLP_BEFORE_SET_ALL_NODE_VALUE);
436 edge getEdge()
const {
437 assert(evtType > TLP_AFTER_SET_ALL_EDGE_VALUE);
441 PropertyEventType getType()
const {
446 PropertyEventType evtType;
454 #ifndef DOXYGEN_NOTFOR_DEVEL
456 TLP_BEGIN_HASH_NAMESPACE {
458 struct TLP_SCOPE hash<const tlp::PropertyInterface *> {
462 struct TLP_SCOPE hash<tlp::PropertyInterface *> {
465 } TLP_END_HASH_NAMESPACE
467 #endif // DOXYGEN_NOTFOR_DEVEL
469 #endif // PROPERTY_INTERFACE_H