20 #ifndef PROPERTY_INTERFACE_H 21 #define PROPERTY_INTERFACE_H 27 #include <tulip/tulipconf.h> 28 #include <tulip/Observable.h> 30 #include <tulip/Edge.h> 38 template <
class itType>
60 friend class PropertyManager;
77 virtual void erase(
const node) = 0;
83 virtual void erase(
const edge) = 0;
95 bool ifNotDefault =
false) = 0;
106 bool ifNotDefault =
false) = 0;
131 virtual const std::string &getTypename()
const = 0;
147 bool rename(
const std::string &newName);
181 virtual std::string getNodeStringValue(
const node n)
const = 0;
188 virtual std::string getEdgeStringValue(
const edge e)
const = 0;
197 virtual bool setNodeStringValue(
const node n,
const std::string &value) = 0;
206 virtual bool setEdgeStringValue(
const edge e,
const std::string &value) = 0;
212 virtual std::string getNodeDefaultStringValue()
const = 0;
218 virtual std::string getEdgeDefaultStringValue()
const = 0;
231 virtual bool setNodeDefaultStringValue(
const std::string &value) = 0;
244 virtual bool setAllNodeStringValue(
const std::string &value) = 0;
263 virtual bool setStringValueToGraphNodes(
const std::string &value,
const Graph *graph) = 0;
276 virtual bool setEdgeDefaultStringValue(
const std::string &value) = 0;
289 virtual bool setAllEdgeStringValue(
const std::string &value) = 0;
308 virtual bool setStringValueToGraphEdges(
const std::string &value,
const Graph *graph) = 0;
315 virtual DataMem *getNodeDefaultDataMemValue()
const = 0;
322 virtual DataMem *getEdgeDefaultDataMemValue()
const = 0;
329 virtual void setAllNodeDataMemValue(
const DataMem *value) = 0;
336 virtual void setAllEdgeDataMemValue(
const DataMem *v) = 0;
345 virtual DataMem *getNodeDataMemValue(
const node n)
const = 0;
354 virtual DataMem *getEdgeDataMemValue(
const edge e)
const = 0;
363 virtual DataMem *getNonDefaultDataMemValue(
const node n)
const = 0;
372 virtual DataMem *getNonDefaultDataMemValue(
const edge e)
const = 0;
379 virtual void setNodeDataMemValue(
const node n,
const DataMem *value) = 0;
386 virtual void setEdgeDataMemValue(
const edge e,
const DataMem *v) = 0;
404 virtual bool hasNonDefaultValuatedNodes(
const Graph * =
nullptr)
const = 0;
413 virtual unsigned int numberOfNonDefaultValuatedNodes(
const Graph * =
nullptr)
const = 0;
431 virtual bool hasNonDefaultValuatedEdges(
const Graph * =
nullptr)
const = 0;
438 virtual unsigned int numberOfNonDefaultValuatedEdges(
const Graph * =
nullptr)
const = 0;
445 virtual unsigned int nodeValueSize()
const = 0;
451 virtual void writeNodeDefaultValue(std::ostream &)
const = 0;
457 virtual void writeNodeValue(std::ostream &,
node)
const = 0;
463 virtual bool readNodeDefaultValue(std::istream &) = 0;
469 virtual bool readNodeValue(std::istream &,
node) = 0;
476 virtual unsigned int edgeValueSize()
const = 0;
482 virtual void writeEdgeDefaultValue(std::ostream &)
const = 0;
488 virtual void writeEdgeValue(std::ostream &,
edge)
const = 0;
494 virtual bool readEdgeDefaultValue(std::istream &) = 0;
500 virtual bool readEdgeValue(std::istream &,
edge) = 0;
510 virtual void computeMetaValue(
node metaNode,
Graph *subgraph,
Graph *metaGraph) = 0;
533 return metaValueCalculator;
544 metaValueCalculator = calculator;
554 virtual int compare(
const node n1,
const node n2)
const = 0;
563 virtual int compare(
const edge e1,
const edge e2)
const = 0;
569 void notifyBeforeSetNodeValue(
const node n);
570 void notifyAfterSetNodeValue(
const node n);
571 void notifyBeforeSetEdgeValue(
const edge e);
572 void notifyAfterSetEdgeValue(
const edge e);
573 void notifyBeforeSetAllNodeValue();
574 void notifyAfterSetAllNodeValue();
575 void notifyBeforeSetAllEdgeValue();
576 void notifyAfterSetAllEdgeValue();
577 void notifyDestroy();
578 void notifyRename(
const std::string &newName);
604 virtual bool tokenize(
const std::string &str, std::vector<std::string> &vect,
char openChar =
'(',
605 char sepChar =
',',
char closeChar =
')') = 0;
615 virtual bool setNodeStringValueAsVector(
const node n,
const std::vector<std::string> &values) = 0;
625 virtual bool setEdgeStringValueAsVector(
const edge e,
const std::vector<std::string> &values) = 0;
639 virtual bool setNodeStringValueAsVector(
const node n,
const std::string &value,
640 char openChar =
'(',
char sepChar =
',',
641 char closeChar =
')') = 0;
655 virtual bool setEdgeStringValueAsVector(
const edge e,
const std::string &value,
656 char openChar =
'(',
char sepChar =
',',
657 char closeChar =
')') = 0;
670 enum PropertyEventType {
671 TLP_BEFORE_SET_NODE_VALUE = 0,
672 TLP_AFTER_SET_NODE_VALUE,
673 TLP_BEFORE_SET_ALL_NODE_VALUE,
674 TLP_AFTER_SET_ALL_NODE_VALUE,
675 TLP_BEFORE_SET_ALL_EDGE_VALUE,
676 TLP_AFTER_SET_ALL_EDGE_VALUE,
677 TLP_BEFORE_SET_EDGE_VALUE,
678 TLP_AFTER_SET_EDGE_VALUE
681 Event::EventType evtType = Event::TLP_MODIFICATION,
unsigned int id = UINT_MAX)
682 :
Event(prop, evtType), evtType(propEvtType), eltId(
id) {}
688 node getNode()
const {
689 assert(evtType < TLP_BEFORE_SET_ALL_NODE_VALUE);
693 edge getEdge()
const {
694 assert(evtType > TLP_AFTER_SET_ALL_EDGE_VALUE);
698 PropertyEventType getType()
const {
703 PropertyEventType evtType;
730 #endif // PROPERTY_INTERFACE_H
Interface for Tulip iterators. Allows basic iteration operations only.
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.
const std::string & getName() const
Gets the name of the property (e.g. viewLayout).
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.
virtual void setMetaValueCalculator(MetaValueCalculator *calculator)
Sets the Calculator for meta nodes and edges.
The Observable class is the base of Tulip's observation system.