23 #include <tulip/PropertyTypes.h> 
   24 #include <tulip/AbstractProperty.h> 
   25 #include <tulip/minmaxproperty.h> 
   26 #include <tulip/NumericProperty.h> 
   31 class PropertyContext;
 
   33 typedef MinMaxProperty<tlp::IntegerType, tlp::IntegerType, tlp::NumericProperty>
 
   34     IntegerMinMaxProperty;
 
   44   using IntegerMinMaxProperty::operator=;
 
   46   static const std::string propertyTypename;
 
   48     return propertyTypename;
 
   50   DEFINE_GET_CPP_CLASS_NAME;
 
   51   void setNodeValue(
const node n, tlp::StoredType<int>::ReturnedConstValue v) 
override;
 
   55   class nodeValueRef : 
public AbstractProperty<tlp::IntegerType, tlp::IntegerType,
 
   56                                                tlp::NumericProperty>::nodeValueRef {
 
   62     nodeValueRef &operator=(
 
   63         typename tlp::StoredType<typename IntegerType::RealType>::ReturnedConstValue val) noexcept {
 
   64       _prop->setNodeValue(_n, val);
 
   69     nodeValueRef &operator++() {
 
   70       _prop->setNodeValue(_n, getValue() + 1);
 
   75     auto operator++(
int) {
 
   76       auto val = getValue();
 
   77       _prop->setNodeValue(_n, val + 1);
 
   82     nodeValueRef &operator+=(
int val) {
 
   83       _prop->setNodeValue(_n, getValue() + val);
 
   88     nodeValueRef &operator--() {
 
   89       _prop->setNodeValue(_n, getValue() - 1);
 
   94     auto operator--(
int) {
 
   95       auto val = getValue();
 
   96       _prop->setNodeValue(_n, val - 1);
 
  101     nodeValueRef &operator-=(
int val) {
 
  102       _prop->setNodeValue(_n, getValue() - val);
 
  108   constexpr nodeValueRef operator[](node n) {
 
  109     return nodeValueRef(
this, n);
 
  112   void setEdgeValue(
const edge e, tlp::StoredType<int>::ReturnedConstValue v) 
override;
 
  116   class edgeValueRef : 
public AbstractProperty<tlp::IntegerType, tlp::IntegerType,
 
  117                                                tlp::NumericProperty>::edgeValueRef {
 
  119     constexpr edgeValueRef(IntegerProperty *prop, edge e)
 
  120         : AbstractProperty<
tlp::IntegerType, 
tlp::IntegerType, 
tlp::NumericProperty>::edgeValueRef(
 
  123     edgeValueRef &operator=(
 
  124         typename tlp::StoredType<typename IntegerType::RealType>::ReturnedConstValue val) noexcept {
 
  125       _prop->setEdgeValue(_e, val);
 
  130     edgeValueRef &operator++() {
 
  131       _prop->setEdgeValue(_e, getValue() + 1);
 
  136     auto operator++(
int) {
 
  137       auto val = getValue();
 
  138       _prop->setEdgeValue(_e, val + 1);
 
  143     edgeValueRef &operator+=(
int val) {
 
  144       _prop->setEdgeValue(_e, getValue() + val);
 
  149     edgeValueRef &operator--() {
 
  150       _prop->setEdgeValue(_e, getValue() - 1);
 
  155     auto operator--(
int) {
 
  156       auto val = getValue();
 
  157       _prop->setEdgeValue(_e, val - 1);
 
  162     edgeValueRef &operator-=(
int val) {
 
  163       _prop->setEdgeValue(_e, getValue() - val);
 
  169   constexpr edgeValueRef operator[](edge e) {
 
  170     return edgeValueRef(
this, e);
 
  173   void setAllNodeValue(tlp::StoredType<int>::ReturnedConstValue v) 
override;
 
  175   void setValueToGraphNodes(tlp::StoredType<int>::ReturnedConstValue v,
 
  176                             const Graph *graph) 
override;
 
  177   void setAllEdgeValue(tlp::StoredType<int>::ReturnedConstValue v) 
override;
 
  178   void setValueToGraphEdges(tlp::StoredType<int>::ReturnedConstValue v,
 
  179                             const Graph *graph) 
override;
 
  185   double getNodeDoubleValue(
const node n)
 const override {
 
  186     return getNodeValue(n);
 
  188   double getNodeDoubleDefaultValue()
 const override {
 
  189     return getNodeDefaultValue();
 
  191   double getNodeDoubleMin(
const Graph *g = 
nullptr)
 override {
 
  192     return getNodeMin(g);
 
  194   double getNodeDoubleMax(
const Graph *g = 
nullptr)
 override {
 
  195     return getNodeMax(g);
 
  197   double getEdgeDoubleValue(
const edge e)
 const override {
 
  198     return getEdgeValue(e);
 
  200   double getEdgeDoubleDefaultValue()
 const override {
 
  201     return getEdgeDefaultValue();
 
  203   double getEdgeDoubleMin(
const Graph *g = 
nullptr)
 override {
 
  204     return getEdgeMin(g);
 
  206   double getEdgeDoubleMax(
const Graph *g = 
nullptr)
 override {
 
  207     return getEdgeMax(g);
 
  210   void nodesUniformQuantification(
unsigned int) 
override;
 
  212   void edgesUniformQuantification(
unsigned int) 
override;
 
  214   NumericProperty *copyProperty(Graph *g)
 override {
 
  215     IntegerProperty *newProp = 
new IntegerProperty(g);
 
  223       AbstractProperty<tlp::IntegerType, tlp::IntegerType, tlp::NumericProperty> &) 
override;
 
  227   void treatEvent(
const Event &) 
override;
 
  235     : 
public AbstractVectorProperty<tlp::IntegerVectorType, tlp::IntegerType> {
 
  237   using AbstractVectorProperty<tlp::IntegerVectorType, tlp::IntegerType>::operator=;
 
  239       : AbstractVectorProperty<IntegerVectorType, tlp::IntegerType>(g, n) {}
 
  242   static const std::string propertyTypename;
 
  244     return propertyTypename;
 
  246   DEFINE_GET_CPP_CLASS_NAME;
 
This class extends upon PropertyInterface, and adds type-safe methods to get and set the node and edg...
 
A graph property that maps an integer value to graph elements.
 
const std::string & getTypename() const override
Gets a string describing the type of the property value (e.g. "graph", "double", "layout",...
 
int compare(const node n1, const node n2) const override
Compares the value this property holds for the two given nodes.
 
PropertyInterface * clonePrototype(Graph *, const std::string &) const override
Creates a property of the same type (e.g. tlp::DoubleProperty) in the graph. The new property will no...
 
int compare(const edge e1, const edge e2) const override
Compares the value this property holds for the two given edges.
 
A graph property that maps a std::vector<int> value to graph elements.
 
const std::string & getTypename() const override
Gets a string describing the type of the property value (e.g. "graph", "double", "layout",...
 
PropertyInterface * clonePrototype(Graph *, const std::string &) const override
Creates a property of the same type (e.g. tlp::DoubleProperty) in the graph. The new property will no...
 
Abstracts the computation of minimal and maximal values on node and edge values of properties.
 
Interface all numerical properties. Property values are always returned as double.
 
PropertyInterface describes the interface of a graph property.
 
The edge struct represents an edge in a Graph object.
 
The node struct represents a node in a Graph object.