20 #ifndef PROPERTY_INTERFACE_H 
   21 #define PROPERTY_INTERFACE_H 
   27 #include <tulip/tulipconf.h> 
   28 #include <tulip/Observable.h> 
   29 #include <tulip/Edge.h> 
   30 #include <tulip/TlpTools.h> 
   38 template <
class itType>
 
   60   friend class PropertyManager;
 
   95                     bool ifNotDefault = 
false) = 0;
 
  106                     bool ifNotDefault = 
false) = 0;
 
  143 #define DEFINE_GET_CPP_CLASS_NAME                                                                  \ 
  144   const std::string &getCppClassName() const override {                                            \ 
  145     static std::string className;                                                                  \ 
  146     if (className.empty()) {                                                                       \ 
  147       std::string dcn(demangleClassName(typeid(this).name(), false));                              \ 
  148       className = dcn.substr(0, dcn.find(' '));                                                    \ 
  224     std::string getStringValue()
 const {
 
  257     operator std::string() {
 
  258       return getStringValue();
 
  296     std::string getStringValue()
 const {
 
  329     operator std::string() {
 
  330       return getStringValue();
 
  345     return getEdgeStringValue(e);
 
  673     return metaValueCalculator;
 
  684     metaValueCalculator = calculator;
 
  709   void notifyBeforeSetNodeValue(
const node n);
 
  710   void notifyAfterSetNodeValue(
const node n);
 
  711   void notifyBeforeSetEdgeValue(
const edge e);
 
  712   void notifyAfterSetEdgeValue(
const edge e);
 
  713   void notifyBeforeSetAllNodeValue();
 
  714   void notifyAfterSetAllNodeValue();
 
  715   void notifyBeforeSetAllEdgeValue();
 
  716   void notifyAfterSetAllEdgeValue();
 
  717   void notifyDestroy();
 
  718   void notifyRename(
const std::string &newName);
 
  744   virtual bool tokenize(
const std::string &str, std::vector<std::string> &vect, 
char openChar = 
'(',
 
  745                         char sepChar = 
',', 
char closeChar = 
')') = 0;
 
  780                                           char openChar = 
'(', 
char sepChar = 
',',
 
  781                                           char closeChar = 
')') = 0;
 
  796                                           char openChar = 
'(', 
char sepChar = 
',',
 
  797                                           char closeChar = 
')') = 0;
 
  810   enum PropertyEventType {
 
  811     TLP_BEFORE_SET_NODE_VALUE = 0,
 
  812     TLP_AFTER_SET_NODE_VALUE,
 
  813     TLP_BEFORE_SET_ALL_NODE_VALUE,
 
  814     TLP_AFTER_SET_ALL_NODE_VALUE,
 
  815     TLP_BEFORE_SET_ALL_EDGE_VALUE,
 
  816     TLP_AFTER_SET_ALL_EDGE_VALUE,
 
  817     TLP_BEFORE_SET_EDGE_VALUE,
 
  818     TLP_AFTER_SET_EDGE_VALUE
 
  821                 Event::EventType evtType = Event::TLP_MODIFICATION, 
unsigned int id = UINT_MAX)
 
  822       : 
Event(prop, evtType), evtType(propEvtType), eltId(
id) {}
 
  828   node getNode()
 const {
 
  829     assert(evtType < TLP_BEFORE_SET_ALL_NODE_VALUE);
 
  833   edge getEdge()
 const {
 
  834     assert(evtType > TLP_AFTER_SET_ALL_EDGE_VALUE);
 
  838   PropertyEventType getType()
 const {
 
  843   PropertyEventType evtType;
 
  856 struct TLP_SCOPE hash<const 
tlp::PropertyInterface *> {
 
  862 struct TLP_SCOPE hash<
tlp::PropertyInterface *> {
 
Event is the base class for all events used in the Observation mechanism.
 
The Observable class is the base of Tulip's observation system.
 
Contains additional information about events on a property, such as the property it happened on,...
 
inner class used to overload the operator[] to set an edge string value
 
edgeStringValueRef & operator=(const edgeStringValueRef &ref) noexcept
overloading of operator= to assign a edge string value which allows to write: prop1[e1] = prop2[e2]
 
edgeStringValueRef & operator=(std::string val) noexcept
overloading of operator= to assign a edge string value which allows to write: prop[e] = strval
 
bool operator==(std::string str) noexcept
overloading of operator== which allows to write: prop1[e1] == prop2[e2]
 
inner class used to overload the operator[] to set a node string value
 
nodeStringValueRef & operator=(const nodeStringValueRef &ref) noexcept
overloading of operator= to assign a node string value which allows to write: prop1[n] = prop2[m]
 
nodeStringValueRef & operator=(std::string val) noexcept
overloading of operator= to assign a node string value which allows to write: prop[n] = strval
 
bool operator==(std::string str) noexcept
overloading of operator== which allows to write: prop1[n] == prop2[m]
 
PropertyInterface describes the interface of a graph property.
 
virtual void writeEdgeValue(std::ostream &, edge) const =0
Writes the value of an edge.
 
virtual std::string getNodeStringValue(const node n) const =0
Gets a string representation of the node value.
 
virtual bool readEdgeValue(std::istream &, edge)=0
Reads the value of an edge.
 
virtual tlp::Iterator< node > * getNonDefaultValuatedNodes(const Graph *=nullptr) const =0
Gets an Iterator on all non-default valuated nodes. When given a Graph as parameter,...
 
constexpr nodeStringValueRef operator[](node n)
overloading of operator[] to set a node string value
 
virtual DataMem * getEdgeDefaultDataMemValue() const =0
Gets a pointer to the tlp::DataMem structure that contains the edge default value.
 
virtual unsigned int numberOfNonDefaultValuatedNodes(const Graph *=nullptr) const =0
Returns the number of nodes with a non default value. When given a Graph as parameter,...
 
virtual void writeNodeDefaultValue(std::ostream &) const =0
Writes the nodes default value.
 
virtual std::string getNodeDefaultStringValue() const =0
Gets a string representation of the node default value.
 
virtual void setAllEdgeDataMemValue(const DataMem *v)=0
Sets all the edges value to the value contained in the given DataMem structure. All previous values a...
 
virtual bool setAllEdgeStringValue(const std::string &value)=0
Sets all the edges value to the value represented by the string. For some types, some parsing will be...
 
const std::string & getName() const
Gets the name of the property (e.g. viewLayout).
 
MetaValueCalculator * getMetaValueCalculator()
Gets the MetaValueCalculator of this property.
 
virtual bool setNodeDefaultStringValue(const std::string &value)=0
Sets the value assigned as the default one to the future added nodes from a string representation.
 
virtual unsigned int edgeValueSize() const =0
Returns the size in bytes of an edge's value.
 
virtual void writeEdgeDefaultValue(std::ostream &) const =0
Writes the edges default value.
 
virtual void setAllNodeDataMemValue(const DataMem *value)=0
Sets all the nodes value to the value contained in the given DataMem structure. All previous values a...
 
virtual bool setStringValueToGraphEdges(const std::string &value, const Graph *graph)=0
Sets all the edges value to the value represented by the string for a graph. For some types,...
 
virtual bool hasNonDefaultValuatedEdges(const Graph *=nullptr) const =0
Returns whether the property has edges with a non default value. When given a Graph as parameter,...
 
virtual void setMetaValueCalculator(MetaValueCalculator *calculator)
Sets the Calculator for meta nodes and edges.
 
virtual void computeMetaValue(node metaNode, Graph *subgraph, Graph *metaGraph)=0
Sets the value of the metanode to a computed value.
 
virtual DataMem * getEdgeDataMemValue(const edge e) const =0
Gets the edge value, contained in a tlp::DataMem structure.
 
virtual void erase(const node)=0
Erases the value stored for the given node. The new value for the node is the default value.
 
virtual void setNodeDataMemValue(const node n, const DataMem *value)=0
Sets the node value.
 
virtual const std::string & getTypename() const =0
Gets a string describing the type of the property value (e.g. "graph", "double", "layout",...
 
virtual DataMem * getNodeDataMemValue(const node n) const =0
Gets the node value, contained in a tlp::DataMem structure.
 
virtual bool setEdgeDefaultStringValue(const std::string &value)=0
Sets the value assigned as the default one to the future added edges from a string representation.
 
virtual void writeNodeValue(std::ostream &, node) const =0
Writes the value of a node.
 
virtual bool setStringValueToGraphNodes(const std::string &value, const Graph *graph)=0
Sets all the nodes value to the value represented by the string for a graph. For some types,...
 
virtual bool setEdgeStringValue(const edge e, const std::string &value)=0
Sets a new value on the edge, represented by the string parameter.
 
virtual bool readEdgeDefaultValue(std::istream &)=0
Reads the edges default value.
 
virtual unsigned int nodeValueSize() const =0
Returns the size in bytes of a node's value.
 
virtual tlp::Iterator< edge > * getNonDefaultValuatedEdges(const Graph *=nullptr) const =0
Gets an Iterator on all non-default valuated edges. When given a Graph as parameter,...
 
virtual const std::string & getCppClassName() const =0
Gets a string giving the name of a the PropertyInterface subclass (e.g "tlp::BooleanProperty",...
 
virtual DataMem * getNonDefaultDataMemValue(const node n) const =0
Returns the value in a DataMem if it is not default, otherwise returns nullptr.
 
virtual DataMem * getNonDefaultDataMemValue(const edge e) const =0
Returns the value in a DataMem if it is not default, otherwise returns nullptr.
 
virtual std::string getEdgeDefaultStringValue() const =0
Gets a string representation of the edge default value.
 
virtual bool readNodeValue(std::istream &, node)=0
Reads the value of a node.
 
virtual bool copy(const edge destination, const edge source, PropertyInterface *property, bool ifNotDefault=false)=0
Copies the value of an edge in another property to an edge in this property.
 
virtual unsigned int numberOfNonDefaultValuatedEdges(const Graph *=nullptr) const =0
Returns the number of edges with a non default value.
 
virtual std::string getEdgeStringValue(const edge e) const =0
Gets a string representation of the edge value.
 
virtual int compare(const edge e1, const edge e2) const =0
Compares the value this property holds for the two given edges.
 
virtual PropertyInterface * clonePrototype(Graph *graph, const std::string &name) const =0
Creates a property of the same type (e.g. tlp::DoubleProperty) in the graph. The new property will no...
 
virtual void setEdgeDataMemValue(const edge e, const DataMem *v)=0
Sets the edge value.
 
virtual DataMem * getNodeDefaultDataMemValue() const =0
Gets a pointer to the tlp::DataMem structure that contains the node default value.
 
virtual void computeMetaValue(edge metaEdge, tlp::Iterator< edge > *it, Graph *metaGraph)=0
Sets the value of the metaedge to a computed value.
 
virtual void copy(PropertyInterface *source)=0
Copies the values of the source property to this property.
 
virtual void erase(const edge)=0
Erases the value stored for the given edge. The new value for the edge is the default value.
 
bool rename(const std::string &newName)
Rename a property.
 
virtual bool setAllNodeStringValue(const std::string &value)=0
Sets all the nodes value to the value represented by the string. For some types, some parsing will be...
 
virtual bool hasNonDefaultValuatedNodes(const Graph *=nullptr) const =0
Returns whether the property has nodes with a non default value. When given a Graph as parameter,...
 
virtual bool copy(const node destination, const node source, PropertyInterface *property, bool ifNotDefault=false)=0
Copies the value of a node in another property to a node in this property.
 
virtual bool setNodeStringValue(const node n, const std::string &value)=0
Sets a new value on the node, represented by the string parameter.
 
virtual int compare(const node n1, const node n2) const =0
Compares the value this property holds for the two given nodes.
 
std::string operator[](edge e) const
overloading of operator[] to get the edge string value
 
virtual bool readNodeDefaultValue(std::istream &)=0
Reads the nodes default value.
 
constexpr edgeStringValueRef operator[](edge e)
overloading of operator[] to set a edge string value value
 
VectorPropertyInterface describes the interface of a graph property whose holded value is a vector (s...
 
virtual bool setEdgeStringValueAsVector(const edge e, const std::vector< std::string > &values)=0
Sets a new vector represented by the vector of string parameter as the edge value.
 
virtual bool tokenize(const std::string &str, std::vector< std::string > &vect, char openChar='(', char sepChar=',', char closeChar=')')=0
split an input string into a vector of strings
 
virtual bool setNodeStringValueAsVector(const node n, const std::string &value, char openChar='(', char sepChar=',', char closeChar=')')=0
Sets a new vector represented by the string parameter as the node value.
 
virtual bool setNodeStringValueAsVector(const node n, const std::vector< std::string > &values)=0
Sets a new vector represented by the vector of string parameter as the node value.
 
virtual bool setEdgeStringValueAsVector(const edge e, const std::string &value, char openChar='(', char sepChar=',', char closeChar=')')=0
Sets a new vector represented by the string parameter as the edge value.
 
Interface for Tulip iterators. Allows basic iteration operations only.
 
The edge struct represents an edge in a Graph object.
 
The node struct represents a node in a Graph object.