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;
216 virtual bool setAllNodeStringValue(
const std::string & value,
const Graph *graph = NULL ) = 0;
228 virtual bool setAllEdgeStringValue(
const std::string & value,
const Graph *graph = NULL ) = 0;
235 virtual DataMem* getNodeDefaultDataMemValue()
const = 0;
242 virtual DataMem* getEdgeDefaultDataMemValue()
const = 0;
249 virtual void setAllNodeDataMemValue(
const DataMem* value) = 0;
256 virtual void setAllEdgeDataMemValue(
const DataMem* v ) = 0;
265 virtual DataMem* getNodeDataMemValue(
const node n )
const = 0;
274 virtual DataMem* getEdgeDataMemValue(
const edge e )
const = 0;
283 virtual DataMem* getNonDefaultDataMemValue(
const node n )
const = 0;
292 virtual DataMem* getNonDefaultDataMemValue(
const edge e )
const = 0;
299 virtual void setNodeDataMemValue(
const node n,
const DataMem* value) = 0;
306 virtual void setEdgeDataMemValue(
const edge e,
const DataMem* v) = 0;
315 virtual tlp::Iterator<node>* getNonDefaultValuatedNodes(
const Graph* = NULL)
const = 0;
323 virtual unsigned int numberOfNonDefaultValuatedNodes(
const Graph* = NULL)
const = 0;
332 virtual tlp::Iterator<edge>* getNonDefaultValuatedEdges(
const Graph* = NULL)
const = 0;
339 virtual unsigned int numberOfNonDefaultValuatedEdges(
const Graph* = NULL)
const = 0;
346 virtual unsigned int nodeValueSize()
const = 0;
352 virtual void writeNodeDefaultValue(std::ostream&)
const = 0;
358 virtual void writeNodeValue(std::ostream&,
node)
const = 0;
364 virtual bool readNodeDefaultValue(std::istream&) = 0;
370 virtual bool readNodeValue(std::istream&,
node) = 0;
377 virtual unsigned int edgeValueSize()
const = 0;
383 virtual void writeEdgeDefaultValue(std::ostream&)
const = 0;
389 virtual void writeEdgeValue(std::ostream&,
edge)
const = 0;
395 virtual bool readEdgeDefaultValue(std::istream&) = 0;
401 virtual bool readEdgeValue(std::istream&,
edge) = 0;
411 virtual void computeMetaValue(
node metaNode,
const Graph* subgraph,
const Graph* metaGraph)=0;
419 virtual void computeMetaValue(
edge metaEdge, tlp::Iterator<edge>* it,
const Graph* metaGraph)=0;
434 return metaValueCalculator;
444 metaValueCalculator = calculator;
453 virtual int compare(
const node n1,
const node n2)
const = 0;
461 virtual int compare(
const edge e1,
const edge e2)
const = 0;
467 void notifyBeforeSetNodeValue(
const node n);
468 void notifyAfterSetNodeValue(
const node n);
469 void notifyBeforeSetEdgeValue(
const edge e);
470 void notifyAfterSetEdgeValue(
const edge e);
471 void notifyBeforeSetAllNodeValue();
472 void notifyAfterSetAllNodeValue();
473 void notifyBeforeSetAllEdgeValue();
474 void notifyAfterSetAllEdgeValue();
475 void notifyDestroy();
476 void notifyRename(
const std::string& newName);
499 virtual bool setNodeStringValueAsVector(
const node n,
const std::string & value,
char openChar =
'(',
char sepChar =
',',
char closeChar =
')') = 0;
510 virtual bool setEdgeStringValueAsVector(
const edge e,
const std::string & value,
char openChar =
'(',
char sepChar =
',',
char closeChar =
')') = 0;
524 enum PropertyEventType {TLP_BEFORE_SET_NODE_VALUE = 0,
525 TLP_AFTER_SET_NODE_VALUE,
526 TLP_BEFORE_SET_ALL_NODE_VALUE,
527 TLP_AFTER_SET_ALL_NODE_VALUE,
528 TLP_BEFORE_SET_ALL_EDGE_VALUE,
529 TLP_AFTER_SET_ALL_EDGE_VALUE,
530 TLP_BEFORE_SET_EDGE_VALUE,
531 TLP_AFTER_SET_EDGE_VALUE
534 Event::EventType evtType = Event::TLP_MODIFICATION,
535 unsigned int id = UINT_MAX)
536 :
Event(prop, evtType), evtType(propEvtType), eltId(
id) {}
542 node getNode()
const {
543 assert(evtType < TLP_BEFORE_SET_ALL_NODE_VALUE);
547 edge getEdge()
const {
548 assert(evtType > TLP_AFTER_SET_ALL_EDGE_VALUE);
552 PropertyEventType getType()
const {
557 PropertyEventType evtType;
567 TLP_BEGIN_HASH_NAMESPACE {
576 } TLP_END_HASH_NAMESPACE
579 #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.