20 #ifndef PROPERTY_INTERFACE_H
21 #define PROPERTY_INTERFACE_H
25 #include <tulip/tulipconf.h>
26 #include <tulip/Observable.h>
27 #include <tulip/Node.h>
28 #include <tulip/Edge.h>
35 template<
class itType >
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 const std::string& getTypename()
const = 0;
135 bool rename(
const std::string& newName);
169 virtual std::string getNodeStringValue(
const node n )
const = 0;
176 virtual std::string getEdgeStringValue(
const edge e )
const = 0;
184 virtual bool setNodeStringValue(
const node n,
const std::string & value ) = 0;
192 virtual bool setEdgeStringValue(
const edge e,
const std::string & value ) = 0;
198 virtual std::string getNodeDefaultStringValue()
const = 0;
204 virtual std::string getEdgeDefaultStringValue()
const = 0;
212 virtual bool setAllNodeStringValue(
const std::string & value ) = 0;
220 virtual bool setAllEdgeStringValue(
const std::string & value ) = 0;
227 virtual DataMem* getNodeDefaultDataMemValue()
const = 0;
234 virtual DataMem* getEdgeDefaultDataMemValue()
const = 0;
241 virtual void setAllNodeDataMemValue(
const DataMem* value) = 0;
248 virtual void setAllEdgeDataMemValue(
const DataMem* v ) = 0;
257 virtual DataMem* getNodeDataMemValue(
const node n )
const = 0;
266 virtual DataMem* getEdgeDataMemValue(
const edge e )
const = 0;
275 virtual DataMem* getNonDefaultDataMemValue(
const node n )
const = 0;
284 virtual DataMem* getNonDefaultDataMemValue(
const edge e )
const = 0;
291 virtual void setNodeDataMemValue(
const node n,
const DataMem* value) = 0;
298 virtual void setEdgeDataMemValue(
const edge e,
const DataMem* v) = 0;
307 virtual tlp::Iterator<node>* getNonDefaultValuatedNodes(
const Graph* = NULL)
const = 0;
314 virtual unsigned int numberOfNonDefaultValuatedNodes()
const = 0;
323 virtual tlp::Iterator<edge>* getNonDefaultValuatedEdges(
const Graph* = NULL)
const = 0;
330 virtual unsigned int numberOfNonDefaultValuatedEdges()
const = 0;
337 virtual unsigned int nodeValueSize()
const = 0;
343 virtual void writeNodeDefaultValue(std::ostream&)
const = 0;
349 virtual void writeNodeValue(std::ostream&, node)
const = 0;
355 virtual bool readNodeDefaultValue(std::istream&) = 0;
361 virtual bool readNodeValue(std::istream&, node) = 0;
368 virtual unsigned int edgeValueSize()
const = 0;
374 virtual void writeEdgeDefaultValue(std::ostream&)
const = 0;
380 virtual void writeEdgeValue(std::ostream&, edge)
const = 0;
386 virtual bool readEdgeDefaultValue(std::istream&) = 0;
392 virtual bool readEdgeValue(std::istream&, edge) = 0;
402 virtual void computeMetaValue(node metaNode, Graph* subgraph, Graph* metaGraph)=0;
410 virtual void computeMetaValue(edge metaEdge, tlp::Iterator<edge>* it, Graph* metaGraph)=0;
425 return metaValueCalculator;
435 metaValueCalculator = calculator;
444 virtual int compare(
const node n1,
const node n2)
const = 0;
452 virtual int compare(
const edge e1,
const edge e2)
const = 0;
455 MetaValueCalculator* metaValueCalculator;
458 void notifyBeforeSetNodeValue(
const node n);
459 void notifyAfterSetNodeValue(
const node n);
460 void notifyBeforeSetEdgeValue(
const edge e);
461 void notifyAfterSetEdgeValue(
const edge e);
462 void notifyBeforeSetAllNodeValue();
463 void notifyAfterSetAllNodeValue();
464 void notifyBeforeSetAllEdgeValue();
465 void notifyAfterSetAllEdgeValue();
466 void notifyDestroy();
467 void notifyRename(
const std::string& newName);
490 virtual bool setNodeStringValueAsVector(
const node n,
const std::string & value,
char openChar =
'(',
char sepChar =
',',
char closeChar =
')') = 0;
501 virtual bool setEdgeStringValueAsVector(
const edge e,
const std::string & value,
char openChar =
'(',
char sepChar =
',',
char closeChar =
')') = 0;
515 enum PropertyEventType {TLP_BEFORE_SET_NODE_VALUE = 0,
516 TLP_AFTER_SET_NODE_VALUE,
517 TLP_BEFORE_SET_ALL_NODE_VALUE,
518 TLP_AFTER_SET_ALL_NODE_VALUE,
519 TLP_BEFORE_SET_ALL_EDGE_VALUE,
520 TLP_AFTER_SET_ALL_EDGE_VALUE,
521 TLP_BEFORE_SET_EDGE_VALUE,
522 TLP_AFTER_SET_EDGE_VALUE
525 Event::EventType evtType = Event::TLP_MODIFICATION,
526 unsigned int id = UINT_MAX)
527 :
Event(prop, evtType), evtType(propEvtType), eltId(
id) {}
533 node getNode()
const {
534 assert(evtType < TLP_BEFORE_SET_ALL_NODE_VALUE);
538 edge getEdge()
const {
539 assert(evtType > TLP_AFTER_SET_ALL_EDGE_VALUE);
543 PropertyEventType getType()
const {
548 PropertyEventType evtType;
556 #ifndef DOXYGEN_NOTFOR_DEVEL
558 TLP_BEGIN_HASH_NAMESPACE {
560 struct TLP_SCOPE hash<const tlp::PropertyInterface *> {
564 struct TLP_SCOPE hash<tlp::PropertyInterface *> {
567 } TLP_END_HASH_NAMESPACE
569 #endif // DOXYGEN_NOTFOR_DEVEL
571 #endif // PROPERTY_INTERFACE_H
PropertyInterface describes the interface of a graph property.
Contains additional information about events on a property, such as the property it happened on...
MetaValueCalculator * getMetaValueCalculator()
Gets the MetaValueCalculator of this property.
The edge struct represents an edge in a Graph object.
The node struct represents a node in a Graph object.
VectorPropertyInterface describes the interface of a graph property whose holded value is a vector (s...
Event is the base class for all events used in the Observation mechanism.
const std::string & getName() const
Gets the name of the property (e.g. viewLayout).
virtual void setMetaValueCalculator(MetaValueCalculator *calculator)
Sets the Calculator for meta nodes and edges.
The Observable class is the base of Tulip's observation system.