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;
118 virtual const std::string& getTypename()
const = 0;
134 bool rename(
const std::string& newName);
168 virtual std::string getNodeStringValue(
const node n )
const = 0;
175 virtual std::string getEdgeStringValue(
const edge e )
const = 0;
183 virtual bool setNodeStringValue(
const node n,
const std::string & value ) = 0;
191 virtual bool setEdgeStringValue(
const edge e,
const std::string & value ) = 0;
197 virtual std::string getNodeDefaultStringValue()
const = 0;
203 virtual std::string getEdgeDefaultStringValue()
const = 0;
211 virtual bool setAllNodeStringValue(
const std::string & value ) = 0;
219 virtual bool setAllEdgeStringValue(
const std::string & value ) = 0;
226 virtual DataMem* getNodeDefaultDataMemValue()
const = 0;
233 virtual DataMem* getEdgeDefaultDataMemValue()
const = 0;
240 virtual void setAllNodeDataMemValue(
const DataMem* value) = 0;
247 virtual void setAllEdgeDataMemValue(
const DataMem* v ) = 0;
256 virtual DataMem* getNodeDataMemValue(
const node n )
const = 0;
265 virtual DataMem* getEdgeDataMemValue(
const edge e )
const = 0;
274 virtual DataMem* getNonDefaultDataMemValue(
const node n )
const = 0;
283 virtual DataMem* getNonDefaultDataMemValue(
const edge e )
const = 0;
290 virtual void setNodeDataMemValue(
const node n,
const DataMem* value) = 0;
297 virtual void setEdgeDataMemValue(
const edge e,
const DataMem* v) = 0;
306 virtual tlp::Iterator<node>* getNonDefaultValuatedNodes(
const Graph* = NULL)
const = 0;
313 virtual unsigned int numberOfNonDefaultValuatedNodes()
const = 0;
322 virtual tlp::Iterator<edge>* getNonDefaultValuatedEdges(
const Graph* = NULL)
const = 0;
329 virtual unsigned int numberOfNonDefaultValuatedEdges()
const = 0;
336 virtual unsigned int nodeValueSize()
const = 0;
342 virtual void writeNodeDefaultValue(std::ostream&)
const = 0;
348 virtual void writeNodeValue(std::ostream&, node)
const = 0;
354 virtual bool readNodeDefaultValue(std::istream&) = 0;
360 virtual bool readNodeValue(std::istream&, node) = 0;
367 virtual unsigned int edgeValueSize()
const = 0;
373 virtual void writeEdgeDefaultValue(std::ostream&)
const = 0;
379 virtual void writeEdgeValue(std::ostream&, edge)
const = 0;
385 virtual bool readEdgeDefaultValue(std::istream&) = 0;
391 virtual bool readEdgeValue(std::istream&, edge) = 0;
401 virtual void computeMetaValue(node metaNode, Graph* subgraph, Graph* metaGraph)=0;
409 virtual void computeMetaValue(edge metaEdge, tlp::Iterator<edge>* it, Graph* metaGraph)=0;
424 return metaValueCalculator;
434 metaValueCalculator = calculator;
443 virtual int compare(
const node n1,
const node n2)
const = 0;
451 virtual int compare(
const edge e1,
const edge e2)
const = 0;
454 MetaValueCalculator* metaValueCalculator;
457 void notifyBeforeSetNodeValue(
const node n);
458 void notifyAfterSetNodeValue(
const node n);
459 void notifyBeforeSetEdgeValue(
const edge e);
460 void notifyAfterSetEdgeValue(
const edge e);
461 void notifyBeforeSetAllNodeValue();
462 void notifyAfterSetAllNodeValue();
463 void notifyBeforeSetAllEdgeValue();
464 void notifyAfterSetAllEdgeValue();
465 void notifyDestroy();
466 void notifyRename(
const std::string& newName);
489 virtual bool setNodeStringValueAsVector(
const node n,
const std::string & value,
char openChar =
'(',
char sepChar =
',',
char closeChar =
')') = 0;
500 virtual bool setEdgeStringValueAsVector(
const edge e,
const std::string & value,
char openChar =
'(',
char sepChar =
',',
char closeChar =
')') = 0;
514 enum PropertyEventType {TLP_BEFORE_SET_NODE_VALUE = 0,
515 TLP_AFTER_SET_NODE_VALUE,
516 TLP_BEFORE_SET_ALL_NODE_VALUE,
517 TLP_AFTER_SET_ALL_NODE_VALUE,
518 TLP_BEFORE_SET_ALL_EDGE_VALUE,
519 TLP_AFTER_SET_ALL_EDGE_VALUE,
520 TLP_BEFORE_SET_EDGE_VALUE,
521 TLP_AFTER_SET_EDGE_VALUE
524 Event::EventType evtType = Event::TLP_MODIFICATION,
525 unsigned int id = UINT_MAX)
526 :
Event(prop, evtType), evtType(propEvtType), eltId(
id) {}
532 node getNode()
const {
533 assert(evtType < TLP_BEFORE_SET_ALL_NODE_VALUE);
537 edge getEdge()
const {
538 assert(evtType > TLP_AFTER_SET_ALL_EDGE_VALUE);
542 PropertyEventType getType()
const {
547 PropertyEventType evtType;
555 #ifndef DOXYGEN_NOTFOR_DEVEL
557 TLP_BEGIN_HASH_NAMESPACE {
559 struct TLP_SCOPE hash<const tlp::PropertyInterface *> {
563 struct TLP_SCOPE hash<tlp::PropertyInterface *> {
566 } TLP_END_HASH_NAMESPACE
568 #endif // DOXYGEN_NOTFOR_DEVEL
570 #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.