Tulip  5.4.0
Large graphs analysis and drawing
tlp::PropertyInterface Class Referenceabstract

#include <PropertyInterface.h>

+ Inheritance diagram for tlp::PropertyInterface:
+ Collaboration diagram for tlp::PropertyInterface:

Classes

class  MetaValueCalculator
 

Public Member Functions

virtual PropertyInterfaceclonePrototype (Graph *graph, const std::string &name) const =0
 
virtual int compare (const node n1, const node n2) const =0
 
virtual int compare (const edge e1, const edge e2) const =0
 
virtual void computeMetaValue (node metaNode, Graph *subgraph, Graph *metaGraph)=0
 
virtual void computeMetaValue (edge metaEdge, tlp::Iterator< edge > *it, Graph *metaGraph)=0
 
virtual bool copy (const node destination, const node source, PropertyInterface *property, bool ifNotDefault=false)=0
 
virtual bool copy (const edge destination, const edge source, PropertyInterface *property, bool ifNotDefault=false)=0
 
virtual void copy (PropertyInterface *source)=0
 
virtual unsigned int edgeValueSize () const =0
 
virtual void erase (const node)=0
 
virtual void erase (const edge)=0
 
virtual DataMem * getEdgeDataMemValue (const edge e) const =0
 
virtual DataMem * getEdgeDefaultDataMemValue () const =0
 
virtual std::string getEdgeDefaultStringValue () const =0
 
virtual std::string getEdgeStringValue (const edge e) const =0
 
tlp::GraphgetGraph () const
 
MetaValueCalculatorgetMetaValueCalculator ()
 
const std::string & getName () const
 
virtual DataMem * getNodeDataMemValue (const node n) const =0
 
virtual DataMem * getNodeDefaultDataMemValue () const =0
 
virtual std::string getNodeDefaultStringValue () const =0
 
virtual std::string getNodeStringValue (const node n) const =0
 
virtual DataMem * getNonDefaultDataMemValue (const node n) const =0
 
virtual DataMem * getNonDefaultDataMemValue (const edge e) const =0
 
virtual tlp::Iterator< edge > * getNonDefaultValuatedEdges (const Graph *=nullptr) const =0
 
virtual tlp::Iterator< node > * getNonDefaultValuatedNodes (const Graph *=nullptr) const =0
 
virtual const std::string & getTypename () const =0
 
virtual bool hasNonDefaultValuatedEdges (const Graph *=nullptr) const =0
 
virtual bool hasNonDefaultValuatedNodes (const Graph *=nullptr) const =0
 
virtual unsigned int nodeValueSize () const =0
 
virtual unsigned int numberOfNonDefaultValuatedEdges (const Graph *=nullptr) const =0
 
virtual unsigned int numberOfNonDefaultValuatedNodes (const Graph *=nullptr) const =0
 
virtual bool readEdgeDefaultValue (std::istream &)=0
 
virtual bool readEdgeValue (std::istream &, edge)=0
 
virtual bool readNodeDefaultValue (std::istream &)=0
 
virtual bool readNodeValue (std::istream &, node)=0
 
bool rename (const std::string &newName)
 
virtual void setAllEdgeDataMemValue (const DataMem *v)=0
 
virtual bool setAllEdgeStringValue (const std::string &value)=0
 
virtual void setAllNodeDataMemValue (const DataMem *value)=0
 
virtual bool setAllNodeStringValue (const std::string &value)=0
 
virtual void setEdgeDataMemValue (const edge e, const DataMem *v)=0
 
virtual bool setEdgeDefaultStringValue (const std::string &value)=0
 
virtual bool setEdgeStringValue (const edge e, const std::string &value)=0
 
virtual void setMetaValueCalculator (MetaValueCalculator *calculator)
 
virtual void setNodeDataMemValue (const node n, const DataMem *value)=0
 
virtual bool setNodeDefaultStringValue (const std::string &value)=0
 
virtual bool setNodeStringValue (const node n, const std::string &value)=0
 
virtual bool setStringValueToGraphEdges (const std::string &value, const Graph *graph)=0
 
virtual bool setStringValueToGraphNodes (const std::string &value, const Graph *graph)=0
 
virtual void writeEdgeDefaultValue (std::ostream &) const =0
 
virtual void writeEdgeValue (std::ostream &, edge) const =0
 
virtual void writeNodeDefaultValue (std::ostream &) const =0
 
virtual void writeNodeValue (std::ostream &, node) const =0
 
- Public Member Functions inherited from tlp::Observable
void addListener (Observable *const listener) const
 
void addListener (Observable &listener) const
 
void addObserver (Observable *const observer) const
 
void addObserver (Observable &observer) const
 
unsigned int countListeners () const
 
unsigned int countObservers () const
 
unsigned int getReceived () const
 
unsigned int getSent () const
 
void removeListener (Observable *const listener) const
 
void removeListener (Observable &listener) const
 
void removeObserver (Observable *const observer) const
 
void removeObserver (Observable &observer) const
 

Protected Member Functions

void notifyAfterSetAllEdgeValue ()
 
void notifyAfterSetAllNodeValue ()
 
void notifyAfterSetEdgeValue (const edge e)
 
void notifyAfterSetNodeValue (const node n)
 
void notifyBeforeSetAllEdgeValue ()
 
void notifyBeforeSetAllNodeValue ()
 
void notifyBeforeSetEdgeValue (const edge e)
 
void notifyBeforeSetNodeValue (const node n)
 
void notifyDestroy ()
 
void notifyRename (const std::string &newName)
 
- Protected Member Functions inherited from tlp::Observable
 Observable (const Observable &)
 
bool hasOnlookers () const
 
void observableDeleted ()
 
Observableoperator= (const Observable &)
 
void sendEvent (const Event &message)
 
virtual void treatEvent (const Event &message)
 
virtual void treatEvents (const std::vector< Event > &events)
 

Protected Attributes

Graphgraph
 
MetaValueCalculatormetaValueCalculator
 
std::string name
 

Friends

class PropertyManager
 

Additional Inherited Members

- Static Public Member Functions inherited from tlp::Observable
static void disableEventNotification ()
 
static void enableEventNotification ()
 
static tlp::node getNode (const tlp::Observable *obs)
 
static ObservablegetObject (tlp::node n)
 
static const tlp::VectorGraph & getObservableGraph ()
 
static unsigned int getScheduled (tlp::node n)
 
static void holdObservers ()
 
static bool isAlive (tlp::node n)
 
static unsigned int observersHoldCounter ()
 
static void unholdObservers ()
 

Detailed Description

PropertyInterface describes the interface of a graph property.

The intent of a property is to hold a value for each node and edge (e.g. the degree of the nodes).

A property can be used in two different ways : Either it is attached to a graph; and in this case creating and deleting the property is handled by the graph (

See also
Graph::getProperty()).

Either is is detached from a graph, and you have to handle creation and deletion yourself. This is most useful for some algorithms that need a temporary property, but do not want the property to appear on the graph after the computation.

Definition at line 59 of file PropertyInterface.h.

Member Function Documentation

◆ clonePrototype()

virtual PropertyInterface* tlp::PropertyInterface::clonePrototype ( Graph graph,
const std::string &  name 
) const
pure virtual

Creates a property of the same type (e.g. tlp::DoubleProperty) in the graph. The new property will not contain a copy of this property's values.

Parameters
graphThe Graph in which to create the new property.
nameThe name of the new property.
Returns
The newly created property.

Implemented in tlp::BooleanProperty.

◆ compare() [1/2]

virtual int tlp::PropertyInterface::compare ( const node  n1,
const node  n2 
) const
pure virtual

Compares the value this property holds for the two given nodes.

Parameters
n1The first node to compare the value of.
n2The second node to compare the value of.
Returns
0 if the values are identical, a positive value if n1 is greater than n2, and a negative value if n1 is less than n2.

◆ compare() [2/2]

virtual int tlp::PropertyInterface::compare ( const edge  e1,
const edge  e2 
) const
pure virtual

Compares the value this property holds for the two given edges.

Parameters
e1The first edge to compare the value of.
e2The second edge to compare the value of.
Returns
0 if the values are identical, a positive value if e1 is greater than e2, and a negative value if e1 is less than e2.

◆ computeMetaValue() [1/2]

virtual void tlp::PropertyInterface::computeMetaValue ( node  metaNode,
Graph subgraph,
Graph metaGraph 
)
pure virtual

Sets the value of the metanode to a computed value.

The value is computed by this property's MetaValueCalculator.

Parameters
metaNodeThe metanode to compute a value on.
subgraphThe subgraph pointed by the metanode.
metaGraphThe graph who owns the meta node.

◆ computeMetaValue() [2/2]

virtual void tlp::PropertyInterface::computeMetaValue ( edge  metaEdge,
tlp::Iterator< edge > *  it,
Graph metaGraph 
)
pure virtual

Sets the value of the metaedge to a computed value.

Parameters
metaEdgeThe meta edge to compute a value on.
itThe edges represented by the meta edge.
metaGraphThe graph who owns the meta edge.

◆ copy() [1/3]

virtual bool tlp::PropertyInterface::copy ( const node  destination,
const node  source,
PropertyInterface property,
bool  ifNotDefault = false 
)
pure virtual

Copies the value of a node in another property to a node in this property.

Parameters
destinationThe node whose value will be set.
sourceThe node whose value to copy.
propertyThe property from which to copy the source node value.
ifNotDefaultIf true, the copy will only be performed if the source node's value is not the default value.
Returns
True if the copy was performed, false otherwise.

◆ copy() [2/3]

virtual bool tlp::PropertyInterface::copy ( const edge  destination,
const edge  source,
PropertyInterface property,
bool  ifNotDefault = false 
)
pure virtual

Copies the value of an edge in another property to an edge in this property.

Parameters
destinationThe edge whose value will be set.
sourceThe edge whose value to copy.
propertyThe property from which to copy the source edge value.
ifNotDefaultIf true, the copy will only be performed if the source edge's value is not the default value.
Returns
True if the copy was performed, false otherwise.

◆ copy() [3/3]

virtual void tlp::PropertyInterface::copy ( PropertyInterface source)
pure virtual

Copies the values of the source property to this property.

Parameters
sourceThe property from which to copy values.
Warning
Be careful when using this method, if you are interested by observing the updates of the values of the current property, because no event is sent for nodes/edges whose value is the default value of the source property.

◆ edgeValueSize()

virtual unsigned int tlp::PropertyInterface::edgeValueSize ( ) const
pure virtual

Returns the size in bytes of an edge's value.

Returns
the size of a node's value (0 means the size is not fixed)

◆ erase() [1/2]

◆ erase() [2/2]

◆ getEdgeDataMemValue()

virtual DataMem* tlp::PropertyInterface::getEdgeDataMemValue ( const edge  e) const
pure virtual

Gets the edge value, contained in a tlp::DataMem structure.

Parameters
nThe edge to get the value of.
Returns
The value of the edge, in a tlp::DataMem.
Warning
The ownership of this pointer is given to the caller.

◆ getEdgeDefaultDataMemValue()

virtual DataMem* tlp::PropertyInterface::getEdgeDefaultDataMemValue ( ) const
pure virtual

Gets a pointer to the tlp::DataMem structure that contains the edge default value.

Returns
The DataMem structure containing the edge default value.
Warning
The ownership of this pointer is given to the caller.

◆ getEdgeDefaultStringValue()

virtual std::string tlp::PropertyInterface::getEdgeDefaultStringValue ( ) const
pure virtual

Gets a string representation of the edge default value.

Returns
A string representation of the edge default value.

◆ getEdgeStringValue()

virtual std::string tlp::PropertyInterface::getEdgeStringValue ( const edge  e) const
pure virtual

Gets a string representation of the edge value.

Parameters
eThe edge to get the value of.
Returns
A string representation of the edge value.

◆ getMetaValueCalculator()

MetaValueCalculator* tlp::PropertyInterface::getMetaValueCalculator ( )
inline

Gets the MetaValueCalculator of this property.

Returns
The MetaValueCalculator of this property

Definition at line 532 of file PropertyInterface.h.

◆ getName()

const std::string& tlp::PropertyInterface::getName ( ) const
inline

Gets the name of the property (e.g. viewLayout).

Returns
The name of this property.

Definition at line 137 of file PropertyInterface.h.

◆ getNodeDataMemValue()

virtual DataMem* tlp::PropertyInterface::getNodeDataMemValue ( const node  n) const
pure virtual

Gets the node value, contained in a tlp::DataMem structure.

Parameters
nThe node to get the value of.
Returns
The value of the node, in a tlp::DataMem.
Warning
The ownership of this pointer is given to the caller.

◆ getNodeDefaultDataMemValue()

virtual DataMem* tlp::PropertyInterface::getNodeDefaultDataMemValue ( ) const
pure virtual

Gets a pointer to the tlp::DataMem structure that contains the node default value.

Returns
The DataMem structure containing the node default value.
Warning
The ownership of this pointer is given to the caller.

◆ getNodeDefaultStringValue()

virtual std::string tlp::PropertyInterface::getNodeDefaultStringValue ( ) const
pure virtual

Gets a string representation of the node default value.

Returns
A string representation of the node default value.

◆ getNodeStringValue()

virtual std::string tlp::PropertyInterface::getNodeStringValue ( const node  n) const
pure virtual

Gets a string representation of the node value.

Parameters
nThe node to get the value of.
Returns
A string representation of the node value.

◆ getNonDefaultDataMemValue() [1/2]

virtual DataMem* tlp::PropertyInterface::getNonDefaultDataMemValue ( const node  n) const
pure virtual

Returns the value in a DataMem if it is not default, otherwise returns nullptr.

Parameters
nThe node to get the value of.
Returns
The value of the node if it is not default, or nullptr.
Warning
The ownership of this pointer is given to the caller.

◆ getNonDefaultDataMemValue() [2/2]

virtual DataMem* tlp::PropertyInterface::getNonDefaultDataMemValue ( const edge  e) const
pure virtual

Returns the value in a DataMem if it is not default, otherwise returns nullptr.

Parameters
eThe edge to get the value of.
Returns
The value of the edge if it is not default, or nullptr.
Warning
The ownership of this pointer is given to the caller.

◆ getNonDefaultValuatedEdges()

virtual tlp::Iterator<edge>* tlp::PropertyInterface::getNonDefaultValuatedEdges ( const Graph = nullptr) const
pure virtual

Gets an Iterator on all non-default valuated edges. When given a Graph as parameter, only edges belonging to this graph are iterated over.

Returns
An Iterator over edges whose value is not default.
Warning
The ownership of the iterator is given to the caller.

◆ getNonDefaultValuatedNodes()

virtual tlp::Iterator<node>* tlp::PropertyInterface::getNonDefaultValuatedNodes ( const Graph = nullptr) const
pure virtual

Gets an Iterator on all non-default valuated nodes. When given a Graph as parameter, only nodes belonging to this graph are iterated over.

Returns
An Iterator over nodes whose value is not default.
Warning
The ownership of the iterator is given to the caller.

◆ getTypename()

virtual const std::string& tlp::PropertyInterface::getTypename ( ) const
pure virtual

Gets a string describing the type of the property (e.g. "graph", "double", "layout", "string", "integer", "color", "size").

Returns
The name of this property's type.

Implemented in tlp::BooleanProperty.

+ Here is the caller graph for this function:

◆ hasNonDefaultValuatedEdges()

virtual bool tlp::PropertyInterface::hasNonDefaultValuatedEdges ( const Graph = nullptr) const
pure virtual

Returns whether the property has edges with a non default value. When given a Graph as parameter, only the edges with a non default value belonging to this graph are taken into account.

Returns
false if all edges has the default value, true if not.

◆ hasNonDefaultValuatedNodes()

virtual bool tlp::PropertyInterface::hasNonDefaultValuatedNodes ( const Graph = nullptr) const
pure virtual

Returns whether the property has nodes with a non default value. When given a Graph as parameter, only the nodes with a non default value belonging to this graph are taken into account.

Returns
false if all nodes has the default value, true if not.

◆ nodeValueSize()

virtual unsigned int tlp::PropertyInterface::nodeValueSize ( ) const
pure virtual

Returns the size in bytes of a node's value.

Returns
the size of a node's value (0 means the size is not fixed)

◆ numberOfNonDefaultValuatedEdges()

virtual unsigned int tlp::PropertyInterface::numberOfNonDefaultValuatedEdges ( const Graph = nullptr) const
pure virtual

Returns the number of edges with a non default value.

Returns
the number of edges with a non default value.

◆ numberOfNonDefaultValuatedNodes()

virtual unsigned int tlp::PropertyInterface::numberOfNonDefaultValuatedNodes ( const Graph = nullptr) const
pure virtual

Returns the number of nodes with a non default value. When given a Graph as parameter, only the number of nodes with a non default value belonging to this graph is returned.

Returns
the number of nodes with a non default value.

◆ readEdgeDefaultValue()

virtual bool tlp::PropertyInterface::readEdgeDefaultValue ( std::istream &  )
pure virtual

Reads the edges default value.

◆ readEdgeValue()

virtual bool tlp::PropertyInterface::readEdgeValue ( std::istream &  ,
edge   
)
pure virtual

Reads the value of an edge.

◆ readNodeDefaultValue()

virtual bool tlp::PropertyInterface::readNodeDefaultValue ( std::istream &  )
pure virtual

Reads the nodes default value.

◆ readNodeValue()

virtual bool tlp::PropertyInterface::readNodeValue ( std::istream &  ,
node   
)
pure virtual

Reads the value of a node.

◆ rename()

bool tlp::PropertyInterface::rename ( const std::string &  newName)

Rename a property.

Parameters
thenew name
Returns
returns true if the renaming succeeded. It may fails if a property with the given name already exists

◆ setAllEdgeDataMemValue()

virtual void tlp::PropertyInterface::setAllEdgeDataMemValue ( const DataMem *  v)
pure virtual

Sets all the edges value to the value contained in the given DataMem structure. All previous values are lost.

Parameters
valueThe value to set on all the edges.

◆ setAllEdgeStringValue()

virtual bool tlp::PropertyInterface::setAllEdgeStringValue ( const std::string &  value)
pure virtual

Sets all the edges value to the value represented by the string. For some types, some parsing will be necessary (e.g. LayoutProperty). All previous values are lost and the represented value is assigned as the default one to the future added edges.

Parameters
valueA string representing the new value to set on all the edges.
Returns
Whether the given string was a correct representation for this property's type. If not, the values are not set.

◆ setAllNodeDataMemValue()

virtual void tlp::PropertyInterface::setAllNodeDataMemValue ( const DataMem *  value)
pure virtual

Sets all the nodes value to the value contained in the given DataMem structure. All previous values are lost.

Parameters
valueThe value to set on all the nodes.

◆ setAllNodeStringValue()

virtual bool tlp::PropertyInterface::setAllNodeStringValue ( const std::string &  value)
pure virtual

Sets all the nodes value to the value represented by the string. For some types, some parsing will be necessary (e.g. LayoutProperty). All previous values are lost and the represented value is assigned as the default one to the future added nodes.

Parameters
valueA string representing the new value to set on all the nodes.
Returns
Whether the given string was a correct representation for this property's type. If not, the values are not set.

◆ setEdgeDataMemValue()

virtual void tlp::PropertyInterface::setEdgeDataMemValue ( const edge  e,
const DataMem *  v 
)
pure virtual

Sets the edge value.

Parameters
eThe edge to set the value of.
valueThe value to set to this edge.

◆ setEdgeDefaultStringValue()

virtual bool tlp::PropertyInterface::setEdgeDefaultStringValue ( const std::string &  value)
pure virtual

Sets the value assigned as the default one to the future added edges from a string representation.

Since
Tulip 5.0
Parameters
valueA string representing the new value to set on future added edges.
Returns
Whether the given string was a correct representation for this property's type. If not, the default value is not set.

◆ setEdgeStringValue()

virtual bool tlp::PropertyInterface::setEdgeStringValue ( const edge  e,
const std::string &  value 
)
pure virtual

Sets a new value on the edge, represented by the string parameter.

Parameters
eThe edge on which to set value on.
valueA string representing the value to set on the edge.
Returns
Whether the string was a correct representation for this property's type. If not, the value is not set.

◆ setMetaValueCalculator()

virtual void tlp::PropertyInterface::setMetaValueCalculator ( MetaValueCalculator calculator)
inlinevirtual

Sets the Calculator for meta nodes and edges.

Parameters
calculatorThe object containing the logic for computing the meta values for the nodes and edges.
Warning
The ownership of the MetaValueCalculator is not taken by the property.

Definition at line 543 of file PropertyInterface.h.

◆ setNodeDataMemValue()

virtual void tlp::PropertyInterface::setNodeDataMemValue ( const node  n,
const DataMem *  value 
)
pure virtual

Sets the node value.

Parameters
nThe node to set the value of.
valueThe value to set to this node.

◆ setNodeDefaultStringValue()

virtual bool tlp::PropertyInterface::setNodeDefaultStringValue ( const std::string &  value)
pure virtual

Sets the value assigned as the default one to the future added nodes from a string representation.

Since
Tulip 5.0
Parameters
valueA string representing the new value to set on future added nodes.
Returns
Whether the given string was a correct representation for this property's type. If not, the default value is not set.

◆ setNodeStringValue()

virtual bool tlp::PropertyInterface::setNodeStringValue ( const node  n,
const std::string &  value 
)
pure virtual

Sets a new value on the node, represented by the string parameter.

Parameters
nThe node on which to set the new value.
valueA string representing the value to set on the node.
Returns
Whether the string was a correct representation for this property's type. If not, the value is not set.

◆ setStringValueToGraphEdges()

virtual bool tlp::PropertyInterface::setStringValueToGraphEdges ( const std::string &  value,
const Graph graph 
)
pure virtual

Sets all the edges value to the value represented by the string for a graph. For some types, some parsing will be necessary (e.g. LayoutProperty). Only the edges from that graph will have their value modified in the property and the default edge value will not be modified.

Since
Tulip 5.0
Parameters
valueA string representing the new value to set on all the edges.
graphA graph that defines the set of edges.
Warning
If the provided graph is not a descendant of the one associated to that property (including itself), no edge value will be modified in it.
Returns
Whether the given string was a correct representation for this property's type. If not, the values are not set.

◆ setStringValueToGraphNodes()

virtual bool tlp::PropertyInterface::setStringValueToGraphNodes ( const std::string &  value,
const Graph graph 
)
pure virtual

Sets all the nodes value to the value represented by the string for a graph. For some types, some parsing will be necessary (e.g. LayoutProperty). Only the nodes from that graph will have their value modified in the property and the default node value will not be modified.

Since
Tulip 5.0
Parameters
valueA string representing the new value to set on all the nodes.
graphA graph that defines the set of nodes.
Warning
If the provided graph is not a descendant of the one associated to that property (including itself), no node value will be modified in it.
Returns
Whether the given string was a correct representation for this property's type. If not, the values are not set.

◆ writeEdgeDefaultValue()

virtual void tlp::PropertyInterface::writeEdgeDefaultValue ( std::ostream &  ) const
pure virtual

Writes the edges default value.

◆ writeEdgeValue()

virtual void tlp::PropertyInterface::writeEdgeValue ( std::ostream &  ,
edge   
) const
pure virtual

Writes the value of an edge.

◆ writeNodeDefaultValue()

virtual void tlp::PropertyInterface::writeNodeDefaultValue ( std::ostream &  ) const
pure virtual

Writes the nodes default value.

◆ writeNodeValue()

virtual void tlp::PropertyInterface::writeNodeValue ( std::ostream &  ,
node   
) const
pure virtual

Writes the value of a node.