All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
te::graph::Graph Class Reference

This is the main graph implementation, that uses a cache policy anda graph loader to get all elements inside a data source. More...

#include <Graph.h>

Inheritance diagram for te::graph::Graph:
te::graph::AbstractGraph te::graph::BidirectionalGraph te::graph::DirectedGraph te::graph::UndirectedGraph

Public Member Functions

virtual void flush ()
 Function used to clear the memory cache, all elements was released from memory, if any element was changes it will be saved. More...
 
te::graph::AbstractIteratorgetIterator ()
 Used to get a iterator associated to graph. More...
 
virtual te::graph::GraphMetadatagetMetadata ()
 Function used to access the graph metadata. More...
 
 Graph ()
 constructor. More...
 
 Graph (AbstractCachePolicy *cp, AbstractGraphLoaderStrategy *ls)
 Constructor. More...
 
void setIterator (te::graph::AbstractIterator *i)
 Used to associate a iterator to graph. More...
 
 ~Graph ()
 Virtual destructor. More...
 
Vertex Access Methods

Method used to access vertex elements from a graph.

virtual void add (Vertex *v)
 Add a new vertex element to a graph. More...
 
virtual void update (Vertex *v)
 Update the vertex element. More...
 
virtual void removeVertex (int id)
 This function removes the vertex element from graph, also was removed in data source. More...
 
virtual te::graph::VertexgetVertex (int id)
 It returns the vertex element if it's exist. More...
 
virtual void addVertexProperty (te::dt::Property *p)
 Add a new property associated to the vertex element. More...
 
virtual void removeVertexProperty (int idx)
 Remove a property associated to the vertex element. More...
 
virtual te::dt::PropertygetVertexProperty (int idx)
 Get a vertex property given a index. More...
 
virtual int getVertexPropertySize ()
 Used to verify the number of properties associated to vertex elements. More...
 
Edge Access Methods

Method used to access edge elements from a graph.

virtual void add (Edge *e)
 Add a new edge element to a graph. More...
 
virtual void update (Edge *e)
 Update the edge element. More...
 
virtual void removeEdge (int id)
 This function removes the edge element from graph, also was removed in data source. More...
 
virtual te::graph::EdgegetEdge (int id)
 It returns the edge element if it's exist. More...
 
virtual void addEdgeProperty (te::dt::Property *p)
 Add a new property associated to the edge element. More...
 
virtual void removeEdgeProperty (int idx)
 Remove a property associated to the edge element. More...
 
virtual te::dt::PropertygetEdgeProperty (int idx)
 Get a edge property given a index. More...
 
virtual int getEdgePropertySize ()
 Used to verify the number of properties associated to edge elements. More...
 
Vertex Access Methods

Method used to access vertex elements from a graph.

virtual te::graph::VertexgetFirstVertex ()
 It returns a pointer to the first vertex element of a graph. More...
 
virtual te::graph::VertexgetNextVertex ()
 It returns a pointer to the next vertex element of a graph. More...
 
virtual te::graph::VertexgetPreviousVertex ()
 It returns a pointer to the previous vertex element of a graph. More...
 
Edge Access Methods

Method used to access edge elements from a graph.

te::graph::EdgegetFirstEdge ()
 It returns a pointer to the first edge element of a graph. More...
 
te::graph::EdgegetNextEdge ()
 It returns a pointer to the next edge element of a graph. More...
 
te::graph::EdgegetPreviousEdge ()
 It returns a pointer to the previous edge element of a graph. More...
 

Protected Attributes

GraphDataManagerm_dataManager
 Used to load and save GraphData information from a DataSource. More...
 
GraphCachem_graphCache
 Class used to keep all graph data loaded. More...
 
GraphDatam_graphData
 This class has the graph data and properties. More...
 
te::graph::AbstractIteratorm_iterator
 Iterator attribute. More...
 
GraphMetadatam_metadata
 Graph Data loader strategy. More...
 

Detailed Description

This is the main graph implementation, that uses a cache policy anda graph loader to get all elements inside a data source.

All methods to access a graph element (vertex or edge) 
will use the GraphData instance, if not found the element, 
the class GraphCache will be consulted.
See Also
AbstractGraph, GraphData, GraphCache

Definition at line 72 of file Graph.h.

Constructor & Destructor Documentation

te::graph::Graph::Graph ( )

constructor.

Definition at line 52 of file Graph.cpp.

te::graph::Graph::Graph ( AbstractCachePolicy cp,
AbstractGraphLoaderStrategy ls 
)

Constructor.

Parameters
cpA pointer to a cache policy implementation
lsA pointer to a loader strategy implementation

Definition at line 60 of file Graph.cpp.

References te::graph::AbstractGraphLoaderStrategy::getMetadata(), m_dataManager, m_graphCache, m_metadata, and te::graph::GraphDataManager::setLoaderStrategy().

te::graph::Graph::~Graph ( )

Virtual destructor.

Definition at line 78 of file Graph.cpp.

Member Function Documentation

void te::graph::Graph::add ( Vertex v)
virtual

Add a new vertex element to a graph.

Parameters
vVertex element
Note
This function turns the dirty flag of current GraphData to true, the new flag of the vertex turns to true.

Implements te::graph::AbstractGraph.

Definition at line 86 of file Graph.cpp.

References te::graph::Vertex::getId(), te::graph::Vertex::isDirty(), and te::graph::Vertex::isNew().

Referenced by te::graph::DirectedGraph::add(), te::graph::UndirectedGraph::add(), and te::graph::BidirectionalGraph::add().

void te::graph::Graph::add ( Edge e)
virtual

Add a new edge element to a graph.

Parameters
eEdge element
Note
This function turns the dirty flag of current GraphData to true, the new flag of the edge turns to true.

Implements te::graph::AbstractGraph.

Reimplemented in te::graph::BidirectionalGraph, te::graph::UndirectedGraph, and te::graph::DirectedGraph.

Definition at line 205 of file Graph.cpp.

References te::graph::Edge::getId(), te::graph::Edge::isDirty(), and te::graph::Edge::isNew().

void te::graph::Graph::addEdgeProperty ( te::dt::Property p)
virtual

Add a new property associated to the edge element.

param p New property to be associated with edge elements.

Note
It's important before using this function call the flush() function, its necessary to force the memory clear and the elements will be loaded with the right size of properties.

Implements te::graph::AbstractGraph.

Definition at line 288 of file Graph.cpp.

void te::graph::Graph::addVertexProperty ( te::dt::Property p)
virtual

Add a new property associated to the vertex element.

param p New property to be associated with vertex elements.

Note
It's important before using this function call the flush() function, its necessary to force the memory clear and the elements will be loaded with the right size of properties.

Implements te::graph::AbstractGraph.

Definition at line 169 of file Graph.cpp.

Referenced by te::graph::AddDeepAttribute::AddDeepAttribute().

void te::graph::Graph::flush ( )
virtual

Function used to clear the memory cache, all elements was released from memory, if any element was changes it will be saved.

Returns

Implements te::graph::AbstractGraph.

Definition at line 329 of file Graph.cpp.

Referenced by te::graph::AddDeepAttribute::AddDeepAttribute().

te::graph::Edge * te::graph::Graph::getEdge ( int  id)
virtual

It returns the edge element if it's exist.

Parameters
idVertex identification
Returns
A valid vertex point if the element was found and a null pointer in other case.

Implements te::graph::AbstractGraph.

Definition at line 261 of file Graph.cpp.

Referenced by te::graph::AddDeepAttribute::calculateDeepValue(), te::graph::GetSubGraph::getPredecessor(), and te::graph::GetSubGraph::GetSubGraph().

te::dt::Property * te::graph::Graph::getEdgeProperty ( int  idx)
virtual

Get a edge property given a index.

Parameters
idxIndex of the property
Returns
A property associated to the edge element if the index is right and a null pointer in other case.

Implements te::graph::AbstractGraph.

Definition at line 304 of file Graph.cpp.

int te::graph::Graph::getEdgePropertySize ( )
virtual

Used to verify the number of properties associated to edge elements.

Returns
Integer value with the number of properties.

Implements te::graph::AbstractGraph.

Definition at line 314 of file Graph.cpp.

te::graph::Edge * te::graph::AbstractGraph::getFirstEdge ( )
inherited

It returns a pointer to the first edge element of a graph.

Note
This function is not implemented here, it's just a call to a iterator function.
Returns
A valid edge point if the element was found and a null pointer in other case.

Definition at line 73 of file AbstractGraph.cpp.

References TR_GRAPH.

Referenced by te::graph::QueryGraphBuilder::build(), and te::graph::LayerRenderer::draw().

te::graph::Vertex * te::graph::AbstractGraph::getFirstVertex ( )
virtualinherited

It returns a pointer to the first vertex element of a graph.

Note
This function is not implemented here, it's just a call to a iterator function.
Returns
A valid vertex point if the element was found and a null pointer in other case.

Definition at line 43 of file AbstractGraph.cpp.

References TR_GRAPH.

Referenced by te::graph::AddDeepAttribute::AddDeepAttribute(), te::graph::AddRasterAttribute::AddRasterAttribute(), and te::graph::QueryGraphBuilder::build().

te::graph::AbstractIterator * te::graph::AbstractGraph::getIterator ( )
inherited

Used to get a iterator associated to graph.

Returns
Valid pointer to a iterator if exist and null pointer in other case

Definition at line 108 of file AbstractGraph.cpp.

Referenced by te::graph::AddDeepAttribute::AddDeepAttribute(), te::graph::AddRasterAttribute::AddRasterAttribute(), te::graph::QueryGraphBuilder::build(), and te::graph::LayerRenderer::draw().

te::graph::GraphMetadata * te::graph::Graph::getMetadata ( )
virtual

Function used to access the graph metadata.

Returns
A pointer to a class that defines the graph metadata

Implements te::graph::AbstractGraph.

Definition at line 324 of file Graph.cpp.

te::graph::Edge * te::graph::AbstractGraph::getNextEdge ( )
inherited

It returns a pointer to the next edge element of a graph.

Note
This function is not implemented here, it's just a call to a iterator function.
Returns
A valid edge point if the element was found and a null pointer in other case.

Definition at line 83 of file AbstractGraph.cpp.

References TR_GRAPH.

Referenced by te::graph::QueryGraphBuilder::build(), and te::graph::LayerRenderer::draw().

te::graph::Vertex * te::graph::AbstractGraph::getNextVertex ( )
virtualinherited

It returns a pointer to the next vertex element of a graph.

Note
This function is not implemented here, it's just a call to a iterator function.
Returns
A valid vertex point if the element was found and a null pointer in other case.

Definition at line 53 of file AbstractGraph.cpp.

References TR_GRAPH.

Referenced by te::graph::AddDeepAttribute::AddDeepAttribute(), te::graph::AddRasterAttribute::AddRasterAttribute(), and te::graph::QueryGraphBuilder::build().

te::graph::Edge * te::graph::AbstractGraph::getPreviousEdge ( )
inherited

It returns a pointer to the previous edge element of a graph.

Note
This function is not implemented here, it's just a call to a iterator function.
Returns
A valid edge point if the element was found and a null pointer in other case.

Definition at line 93 of file AbstractGraph.cpp.

References TR_GRAPH.

te::graph::Vertex * te::graph::AbstractGraph::getPreviousVertex ( )
virtualinherited

It returns a pointer to the previous vertex element of a graph.

Note
This function is not implemented here, it's just a call to a iterator function.
Returns
A valid vertex point if the element was found and a null pointer in other case.

Definition at line 63 of file AbstractGraph.cpp.

References TR_GRAPH.

te::graph::Vertex * te::graph::Graph::getVertex ( int  id)
virtual

It returns the vertex element if it's exist.

Parameters
idVertex identification
Returns
A valid vertex point if the element was found and a null pointer in other case.

Implements te::graph::AbstractGraph.

Definition at line 142 of file Graph.cpp.

Referenced by te::graph::AddDeepAttribute::calculateDeepValue(), te::graph::GetSubGraph::getPredecessor(), and te::graph::GetSubGraph::GetSubGraph().

te::dt::Property * te::graph::Graph::getVertexProperty ( int  idx)
virtual

Get a vertex property given a index.

Parameters
idxIndex of the property
Returns
A property associated to the vertex element if the index is right and a null pointer in other case.

Implements te::graph::AbstractGraph.

Definition at line 185 of file Graph.cpp.

Referenced by te::graph::AddDeepAttribute::AddDeepAttribute().

int te::graph::Graph::getVertexPropertySize ( )
virtual

Used to verify the number of properties associated to vertex elements.

Returns
Integer value with the number of properties.

Implements te::graph::AbstractGraph.

Definition at line 195 of file Graph.cpp.

Referenced by te::graph::AddDeepAttribute::AddDeepAttribute().

void te::graph::Graph::removeEdge ( int  id)
virtual

This function removes the edge element from graph, also was removed in data source.

Parameters
idEdge identification

Implements te::graph::AbstractGraph.

Reimplemented in te::graph::BidirectionalGraph, te::graph::UndirectedGraph, and te::graph::DirectedGraph.

Definition at line 232 of file Graph.cpp.

Referenced by te::graph::DirectedGraph::removeEdge(), te::graph::UndirectedGraph::removeEdge(), and te::graph::BidirectionalGraph::removeEdge().

void te::graph::Graph::removeEdgeProperty ( int  idx)
virtual

Remove a property associated to the edge element.

Parameters
idxIndex of the property

Implements te::graph::AbstractGraph.

Definition at line 296 of file Graph.cpp.

void te::graph::Graph::removeVertex ( int  id)
virtual

This function removes the vertex element from graph, also was removed in data source.

Parameters
idVertex identification

Implements te::graph::AbstractGraph.

Definition at line 113 of file Graph.cpp.

void te::graph::Graph::removeVertexProperty ( int  idx)
virtual

Remove a property associated to the vertex element.

Parameters
idxIndex of the property

Implements te::graph::AbstractGraph.

Definition at line 177 of file Graph.cpp.

void te::graph::AbstractGraph::setIterator ( te::graph::AbstractIterator i)
inherited

Used to associate a iterator to graph.

Parameters
iValid pointer to a iterator

Definition at line 103 of file AbstractGraph.cpp.

Referenced by te::graph::AddDeepAttribute::AddDeepAttribute(), te::graph::AddRasterAttribute::AddRasterAttribute(), te::graph::QueryGraphBuilder::build(), and te::graph::LayerRenderer::draw().

void te::graph::Graph::update ( Vertex v)
virtual

Update the vertex element.

Parameters
vVertex element
Note
This function turns the dirty flag of current GraphData to true and also the dirty flag of the vertex.

Implements te::graph::AbstractGraph.

Definition at line 106 of file Graph.cpp.

References te::graph::Vertex::setDirty().

Referenced by te::graph::AddDeepAttribute::AddDeepAttribute().

void te::graph::Graph::update ( Edge e)
virtual

Update the edge element.

Parameters
eEdge element
Note
This function turns the dirty flag of current GraphData to true and also the dirty flag of the edge.

Implements te::graph::AbstractGraph.

Definition at line 225 of file Graph.cpp.

References te::graph::Edge::setDirty().

Member Data Documentation

GraphDataManager* te::graph::Graph::m_dataManager
protected

Used to load and save GraphData information from a DataSource.

Definition at line 284 of file Graph.h.

Referenced by Graph().

GraphCache* te::graph::Graph::m_graphCache
protected

Class used to keep all graph data loaded.

Definition at line 286 of file Graph.h.

Referenced by Graph().

GraphData* te::graph::Graph::m_graphData
protected

This class has the graph data and properties.

Definition at line 282 of file Graph.h.

te::graph::AbstractIterator* te::graph::AbstractGraph::m_iterator
protectedinherited

Iterator attribute.

Definition at line 322 of file AbstractGraph.h.

GraphMetadata* te::graph::Graph::m_metadata
protected

Graph Data loader strategy.

Definition at line 288 of file Graph.h.

Referenced by Graph().


The documentation for this class was generated from the following files: