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;
215 virtual bool setNodeDefaultStringValue(
const std::string & value ) = 0;
225 virtual bool setAllNodeStringValue(
const std::string & value ) = 0;
243 _DEPRECATED
virtual bool setAllNodeStringValue(
const std::string & value,
const Graph *graph ) = 0;
259 virtual bool setStringValueToGraphNodes(
const std::string & value,
const Graph *graph ) = 0;
270 virtual bool setEdgeDefaultStringValue(
const std::string & value ) = 0;
280 virtual bool setAllEdgeStringValue(
const std::string & value ) = 0;
298 _DEPRECATED
virtual bool setAllEdgeStringValue(
const std::string & value,
const Graph *graph ) = 0;
314 virtual bool setStringValueToGraphEdges(
const std::string & value,
const Graph *graph ) = 0;
321 virtual DataMem* getNodeDefaultDataMemValue()
const = 0;
328 virtual DataMem* getEdgeDefaultDataMemValue()
const = 0;
335 virtual void setAllNodeDataMemValue(
const DataMem* value) = 0;
342 virtual void setAllEdgeDataMemValue(
const DataMem* v ) = 0;
351 virtual DataMem* getNodeDataMemValue(
const node n )
const = 0;
360 virtual DataMem* getEdgeDataMemValue(
const edge e )
const = 0;
369 virtual DataMem* getNonDefaultDataMemValue(
const node n )
const = 0;
378 virtual DataMem* getNonDefaultDataMemValue(
const edge e )
const = 0;
385 virtual void setNodeDataMemValue(
const node n,
const DataMem* value) = 0;
392 virtual void setEdgeDataMemValue(
const edge e,
const DataMem* v) = 0;
401 virtual tlp::Iterator<node>* getNonDefaultValuatedNodes(
const Graph* = NULL)
const = 0;
409 virtual unsigned int numberOfNonDefaultValuatedNodes(
const Graph* = NULL)
const = 0;
418 virtual tlp::Iterator<edge>* getNonDefaultValuatedEdges(
const Graph* = NULL)
const = 0;
425 virtual unsigned int numberOfNonDefaultValuatedEdges(
const Graph* = NULL)
const = 0;
432 virtual unsigned int nodeValueSize()
const = 0;
438 virtual void writeNodeDefaultValue(std::ostream&)
const = 0;
444 virtual void writeNodeValue(std::ostream&,
node)
const = 0;
450 virtual bool readNodeDefaultValue(std::istream&) = 0;
456 virtual bool readNodeValue(std::istream&,
node) = 0;
463 virtual unsigned int edgeValueSize()
const = 0;
469 virtual void writeEdgeDefaultValue(std::ostream&)
const = 0;
475 virtual void writeEdgeValue(std::ostream&,
edge)
const = 0;
481 virtual bool readEdgeDefaultValue(std::istream&) = 0;
487 virtual bool readEdgeValue(std::istream&,
edge) = 0;
497 virtual void computeMetaValue(
node metaNode,
Graph* subgraph,
Graph* metaGraph)=0;
505 virtual void computeMetaValue(
edge metaEdge, tlp::Iterator<edge>* it,
Graph* metaGraph)=0;
520 return metaValueCalculator;
530 metaValueCalculator = calculator;
539 virtual int compare(
const node n1,
const node n2)
const = 0;
547 virtual int compare(
const edge e1,
const edge e2)
const = 0;
553 void notifyBeforeSetNodeValue(
const node n);
554 void notifyAfterSetNodeValue(
const node n);
555 void notifyBeforeSetEdgeValue(
const edge e);
556 void notifyAfterSetEdgeValue(
const edge e);
557 void notifyBeforeSetAllNodeValue();
558 void notifyAfterSetAllNodeValue();
559 void notifyBeforeSetAllEdgeValue();
560 void notifyAfterSetAllEdgeValue();
561 void notifyDestroy();
562 void notifyRename(
const std::string& newName);
585 virtual bool setNodeStringValueAsVector(
const node n,
const std::string & value,
char openChar =
'(',
char sepChar =
',',
char closeChar =
')') = 0;
596 virtual bool setEdgeStringValueAsVector(
const edge e,
const std::string & value,
char openChar =
'(',
char sepChar =
',',
char closeChar =
')') = 0;
610 enum PropertyEventType {TLP_BEFORE_SET_NODE_VALUE = 0,
611 TLP_AFTER_SET_NODE_VALUE,
612 TLP_BEFORE_SET_ALL_NODE_VALUE,
613 TLP_AFTER_SET_ALL_NODE_VALUE,
614 TLP_BEFORE_SET_ALL_EDGE_VALUE,
615 TLP_AFTER_SET_ALL_EDGE_VALUE,
616 TLP_BEFORE_SET_EDGE_VALUE,
617 TLP_AFTER_SET_EDGE_VALUE
620 Event::EventType evtType = Event::TLP_MODIFICATION,
621 unsigned int id = UINT_MAX)
622 :
Event(prop, evtType), evtType(propEvtType), eltId(
id) {}
628 node getNode()
const {
629 assert(evtType < TLP_BEFORE_SET_ALL_NODE_VALUE);
633 edge getEdge()
const {
634 assert(evtType > TLP_AFTER_SET_ALL_EDGE_VALUE);
638 PropertyEventType getType()
const {
643 PropertyEventType evtType;
653 TLP_BEGIN_HASH_NAMESPACE {
662 } TLP_END_HASH_NAMESPACE
665 #endif // PROPERTY_INTERFACE_H
PropertyInterface describes the interface of a graph property.
Interface for Tulip iterators. Allows basic iteration operations only.
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.