All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties 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...
 
virtual te::graph::GraphMetadatagetMetadata ()
 Function used to access the graph metadata. More...
 
 Graph ()
 constructor. More...
 
 Graph (GraphMetadata *metadata)
 Constructor. More...
 
 Graph (AbstractCachePolicy *cp, AbstractGraphLoaderStrategy *ls)
 Constructor. 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...
 

Public Attributes

GraphDatam_graphData
 This class has the graph data and properties. 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...
 
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 ( GraphMetadata metadata)

Constructor.

Parameters
metadataA pointer to a graph metadata implementation

Definition at line 60 of file Graph.cpp.

References m_graphData, te::graph::GraphMetadata::m_memoryGraph, and m_metadata.

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 72 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 90 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 98 of file Graph.cpp.

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 194 of file Graph.cpp.

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 254 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 158 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 295 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 234 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 270 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 280 of file Graph.cpp.

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 290 of file Graph.cpp.

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 138 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 174 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 184 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 216 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 262 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 120 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 166 of file Graph.cpp.

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 113 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 209 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 290 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 292 of file Graph.h.

Referenced by Graph().

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

This class has the graph data and properties.

Definition at line 298 of file Graph.h.

Referenced by Graph(), and te::graph::MemoryIterator::MemoryIterator().

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

Graph Data loader strategy.

Definition at line 294 of file Graph.h.

Referenced by Graph().


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