Overview     Modules     Class Hierarchy     Classes     Members  
tlp::NodeProperty< TYPE > Class Template Reference

That class enables to define a property/attribute on nodes on a VectorGraph. More...

#include <vectorgraphproperty.h>

Inheritance diagram for tlp::NodeProperty< TYPE >:
Collaboration diagram for tlp::NodeProperty< TYPE >:

List of all members.

Public Member Functions

 NodeProperty ()
 NodeProperty (const NodeProperty &obj)
bool isValid () const
- Public Member Functions inherited from tlp::VectorGraphProperty< TYPE >
std::vector< TYPE >
::const_reference 
operator[] (const size_t id) const
 read accessor
std::vector< TYPE >::reference operator[] (const size_t id)
 read/write accessor
void setAll (const TYPE &obj)
void set (const size_t id, const TYPE &obj)
 write accessor
std::vector< TYPE >
::const_reference 
get (const size_t id) const
 read accessor

Friends

class VectorGraph

Additional Inherited Members

- Protected Member Functions inherited from tlp::VectorGraphProperty< TYPE >
 VectorGraphProperty ()
 VectorGraphProperty (const VectorGraphProperty &obj)
 VectorGraphProperty (ValArray< TYPE > *array, VectorGraph *graph)
- Protected Attributes inherited from tlp::VectorGraphProperty< TYPE >
ValArray< TYPE > * _array
VectorGraph_graph

Detailed Description

template<typename TYPE>
class tlp::NodeProperty< TYPE >

That class enables to define a property/attribute on nodes on a VectorGraph.

Using NodeProperty you can assign any kind of attribute to nodes. To use that class you must first create an instance of NodeProperty and then connect it to your graph. NodeProperty can be copied in another NodeProperty, however the to NodeProperty will share the same content. You can consider that NodeProperty is just a pointer on a stl:vector. to free memory used by a NodeProperty connected to a graph you must use the free function.

Warning:
After the call to free all The copy of the orignal NodeProperty are no more valid

Using NodeProperty you can store and access to values with the same efficiency as if you created manually a vector. NodeProperty manage for you the resize, etc... when the graph is modified.

Furthemrore, in DEBUG mode, operator[] check if one try to access outside of the Array Bound. in DEBUG mode, the validy of the Property is also checked (if it has been free/alloc etc...)

NodeProperty<double> weight;
g.alloc(weight); //connect weight to g, g allocate memory for that attribute
node n;
forEach(n, g.getNodes()) {
weight[n] = g.deg(n);
}
NodeProperty<double> weight2 = weight; //weight2 and weight are pointing on the same memory addres
weight2[g[0]] = 3;
cout << weight[g[0]]; //output 3
g.free(weight2); //free the memory, weight and weight2 are no more valid.
See also:
VectorGraph alloc(NodeProperty)
VectorGraph free(NodeProperty)

Constructor & Destructor Documentation

template<typename TYPE>
tlp::NodeProperty< TYPE >::NodeProperty ( )
inline
template<typename TYPE>
tlp::NodeProperty< TYPE >::NodeProperty ( const NodeProperty< TYPE > &  obj)
inline

Member Function Documentation

template<typename TYPE >
bool tlp::NodeProperty< TYPE >::isValid ( ) const
virtual

Friends And Related Function Documentation

template<typename TYPE>
friend class VectorGraph
friend

Reimplemented from tlp::VectorGraphProperty< TYPE >.



Tulip Software by LaBRI Visualization Team    2001 - 2012