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;
315 virtual unsigned int numberOfNonDefaultValuatedNodes(
const Graph* = NULL)
const = 0;
324 virtual tlp::Iterator<edge>* getNonDefaultValuatedEdges(
const Graph* = NULL)
const = 0;
331 virtual unsigned int numberOfNonDefaultValuatedEdges(
const Graph* = NULL)
const = 0;
338 virtual unsigned int nodeValueSize()
const = 0;
344 virtual void writeNodeDefaultValue(std::ostream&)
const = 0;
350 virtual void writeNodeValue(std::ostream&, node)
const = 0;
356 virtual bool readNodeDefaultValue(std::istream&) = 0;
362 virtual bool readNodeValue(std::istream&, node) = 0;
369 virtual unsigned int edgeValueSize()
const = 0;
375 virtual void writeEdgeDefaultValue(std::ostream&)
const = 0;
381 virtual void writeEdgeValue(std::ostream&, edge)
const = 0;
387 virtual bool readEdgeDefaultValue(std::istream&) = 0;
393 virtual bool readEdgeValue(std::istream&, edge) = 0;
403 virtual void computeMetaValue(node metaNode, Graph* subgraph, Graph* metaGraph)=0;
411 virtual void computeMetaValue(edge metaEdge, tlp::Iterator<edge>* it, Graph* metaGraph)=0;
426 return metaValueCalculator;
436 metaValueCalculator = calculator;
445 virtual int compare(
const node n1,
const node n2)
const = 0;
453 virtual int compare(
const edge e1,
const edge e2)
const = 0;
456 MetaValueCalculator* metaValueCalculator;
459 void notifyBeforeSetNodeValue(
const node n);
460 void notifyAfterSetNodeValue(
const node n);
461 void notifyBeforeSetEdgeValue(
const edge e);
462 void notifyAfterSetEdgeValue(
const edge e);
463 void notifyBeforeSetAllNodeValue();
464 void notifyAfterSetAllNodeValue();
465 void notifyBeforeSetAllEdgeValue();
466 void notifyAfterSetAllEdgeValue();
467 void notifyDestroy();
468 void notifyRename(
const std::string& newName);
491 virtual bool setNodeStringValueAsVector(
const node n,
const std::string & value,
char openChar =
'(',
char sepChar =
',',
char closeChar =
')') = 0;
502 virtual bool setEdgeStringValueAsVector(
const edge e,
const std::string & value,
char openChar =
'(',
char sepChar =
',',
char closeChar =
')') = 0;
516 enum PropertyEventType {TLP_BEFORE_SET_NODE_VALUE = 0,
517 TLP_AFTER_SET_NODE_VALUE,
518 TLP_BEFORE_SET_ALL_NODE_VALUE,
519 TLP_AFTER_SET_ALL_NODE_VALUE,
520 TLP_BEFORE_SET_ALL_EDGE_VALUE,
521 TLP_AFTER_SET_ALL_EDGE_VALUE,
522 TLP_BEFORE_SET_EDGE_VALUE,
523 TLP_AFTER_SET_EDGE_VALUE
526 Event::EventType evtType = Event::TLP_MODIFICATION,
527 unsigned int id = UINT_MAX)
528 :
Event(prop, evtType), evtType(propEvtType), eltId(
id) {}
534 node getNode()
const {
535 assert(evtType < TLP_BEFORE_SET_ALL_NODE_VALUE);
539 edge getEdge()
const {
540 assert(evtType > TLP_AFTER_SET_ALL_EDGE_VALUE);
544 PropertyEventType getType()
const {
549 PropertyEventType evtType;
557 #ifndef DOXYGEN_NOTFOR_DEVEL
559 TLP_BEGIN_HASH_NAMESPACE {
561 struct TLP_SCOPE hash<const tlp::PropertyInterface *> {
565 struct TLP_SCOPE hash<tlp::PropertyInterface *> {
568 } TLP_END_HASH_NAMESPACE
570 #endif // DOXYGEN_NOTFOR_DEVEL
572 #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.