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>
57 friend class PropertyManager;
74 virtual void erase(
const node) = 0;
80 virtual void erase(
const edge) = 0;
92 bool ifNotDefault =
false) = 0;
103 bool ifNotDefault =
false) = 0;
128 virtual const std::string &getTypename()
const = 0;
144 bool rename(
const std::string &newName);
178 virtual std::string getNodeStringValue(
const node n)
const = 0;
185 virtual std::string getEdgeStringValue(
const edge e)
const = 0;
194 virtual bool setNodeStringValue(
const node n,
const std::string &value) = 0;
203 virtual bool setEdgeStringValue(
const edge e,
const std::string &value) = 0;
209 virtual std::string getNodeDefaultStringValue()
const = 0;
215 virtual std::string getEdgeDefaultStringValue()
const = 0;
228 virtual bool setNodeDefaultStringValue(
const std::string &value) = 0;
241 virtual bool setAllNodeStringValue(
const std::string &value) = 0;
263 _DEPRECATED
virtual bool setAllNodeStringValue(
const std::string &value,
const Graph *graph) = 0;
282 virtual bool setStringValueToGraphNodes(
const std::string &value,
const Graph *graph) = 0;
295 virtual bool setEdgeDefaultStringValue(
const std::string &value) = 0;
308 virtual bool setAllEdgeStringValue(
const std::string &value) = 0;
330 _DEPRECATED
virtual bool setAllEdgeStringValue(
const std::string &value,
const Graph *graph) = 0;
349 virtual bool setStringValueToGraphEdges(
const std::string &value,
const Graph *graph) = 0;
356 virtual DataMem *getNodeDefaultDataMemValue()
const = 0;
363 virtual DataMem *getEdgeDefaultDataMemValue()
const = 0;
370 virtual void setAllNodeDataMemValue(
const DataMem *value) = 0;
377 virtual void setAllEdgeDataMemValue(
const DataMem *v) = 0;
386 virtual DataMem *getNodeDataMemValue(
const node n)
const = 0;
395 virtual DataMem *getEdgeDataMemValue(
const edge e)
const = 0;
404 virtual DataMem *getNonDefaultDataMemValue(
const node n)
const = 0;
413 virtual DataMem *getNonDefaultDataMemValue(
const edge e)
const = 0;
420 virtual void setNodeDataMemValue(
const node n,
const DataMem *value) = 0;
427 virtual void setEdgeDataMemValue(
const edge e,
const DataMem *v) = 0;
445 virtual bool hasNonDefaultValuatedNodes(
const Graph * =
nullptr)
const = 0;
454 virtual unsigned int numberOfNonDefaultValuatedNodes(
const Graph * =
nullptr)
const = 0;
472 virtual bool hasNonDefaultValuatedEdges(
const Graph * =
nullptr)
const = 0;
479 virtual unsigned int numberOfNonDefaultValuatedEdges(
const Graph * =
nullptr)
const = 0;
486 virtual unsigned int nodeValueSize()
const = 0;
492 virtual void writeNodeDefaultValue(std::ostream &)
const = 0;
498 virtual void writeNodeValue(std::ostream &,
node)
const = 0;
504 virtual bool readNodeDefaultValue(std::istream &) = 0;
510 virtual bool readNodeValue(std::istream &,
node) = 0;
517 virtual unsigned int edgeValueSize()
const = 0;
523 virtual void writeEdgeDefaultValue(std::ostream &)
const = 0;
529 virtual void writeEdgeValue(std::ostream &,
edge)
const = 0;
535 virtual bool readEdgeDefaultValue(std::istream &) = 0;
541 virtual bool readEdgeValue(std::istream &,
edge) = 0;
551 virtual void computeMetaValue(
node metaNode,
Graph *subgraph,
Graph *metaGraph) = 0;
574 return metaValueCalculator;
585 metaValueCalculator = calculator;
595 virtual int compare(
const node n1,
const node n2)
const = 0;
604 virtual int compare(
const edge e1,
const edge e2)
const = 0;
610 void notifyBeforeSetNodeValue(
const node n);
611 void notifyAfterSetNodeValue(
const node n);
612 void notifyBeforeSetEdgeValue(
const edge e);
613 void notifyAfterSetEdgeValue(
const edge e);
614 void notifyBeforeSetAllNodeValue();
615 void notifyAfterSetAllNodeValue();
616 void notifyBeforeSetAllEdgeValue();
617 void notifyAfterSetAllEdgeValue();
618 void notifyDestroy();
619 void notifyRename(
const std::string &newName);
645 virtual bool tokenize(
const std::string &str, std::vector<std::string> &vect,
char openChar =
'(',
646 char sepChar =
',',
char closeChar =
')') = 0;
656 virtual bool setNodeStringValueAsVector(
const node n,
const std::vector<std::string> &values) = 0;
666 virtual bool setEdgeStringValueAsVector(
const edge e,
const std::vector<std::string> &values) = 0;
680 virtual bool setNodeStringValueAsVector(
const node n,
const std::string &value,
681 char openChar =
'(',
char sepChar =
',',
682 char closeChar =
')') = 0;
696 virtual bool setEdgeStringValueAsVector(
const edge e,
const std::string &value,
697 char openChar =
'(',
char sepChar =
',',
698 char closeChar =
')') = 0;
711 enum PropertyEventType {
712 TLP_BEFORE_SET_NODE_VALUE = 0,
713 TLP_AFTER_SET_NODE_VALUE,
714 TLP_BEFORE_SET_ALL_NODE_VALUE,
715 TLP_AFTER_SET_ALL_NODE_VALUE,
716 TLP_BEFORE_SET_ALL_EDGE_VALUE,
717 TLP_AFTER_SET_ALL_EDGE_VALUE,
718 TLP_BEFORE_SET_EDGE_VALUE,
719 TLP_AFTER_SET_EDGE_VALUE
722 Event::EventType evtType = Event::TLP_MODIFICATION,
unsigned int id = UINT_MAX)
723 :
Event(prop, evtType), evtType(propEvtType), eltId(
id) {}
729 node getNode()
const {
730 assert(evtType < TLP_BEFORE_SET_ALL_NODE_VALUE);
734 edge getEdge()
const {
735 assert(evtType > TLP_AFTER_SET_ALL_EDGE_VALUE);
739 PropertyEventType getType()
const {
744 PropertyEventType evtType;
755 TLP_BEGIN_HASH_NAMESPACE {
769 TLP_END_HASH_NAMESPACE
772 #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.