33 #include "../../common/STLUtils.h"
34 #include "../../common/StringUtils.h"
35 #include "../../common/Translator.h"
36 #include "../core/Edge.h"
37 #include "../core/EdgeProperty.h"
38 #include "../core/GraphData.h"
39 #include "../core/GraphDataManager.h"
40 #include "../core/GraphCache.h"
41 #include "../core/GraphMetadata.h"
42 #include "../core/Vertex.h"
43 #include "../core/VertexProperty.h"
44 #include "../loader/AbstractGraphLoaderStrategy.h"
45 #include "../Config.h"
46 #include "../Exception.h"
90 m_graphData = m_graphCache->getGraphData();
93 m_graphData->getVertexMap().insert(te::graph::GraphData::VertexMap::value_type(v->
getId(), v));
97 m_graphData->setDirty(
true);
100 if(m_graphData->getVertexMap().size() >= m_metadata->m_maxCacheSize)
110 m_graphData->setDirty(
true);
115 te::graph::GraphData::VertexMap::iterator it = m_graphData->getVertexMap().find(
id);
117 if(it != m_graphData->getVertexMap().end())
119 m_graphData->getVertexMap().erase(it);
123 m_graphData = m_graphCache->getGraphDataByVertexId(
id);
127 it = m_graphData->getVertexMap().find(
id);
129 if(it != m_graphData->getVertexMap().end())
131 m_graphData->getVertexMap().erase(it);
138 m_dataManager->removeVertex(
id);
146 te::graph::GraphData::VertexMap::iterator it = m_graphData->getVertexMap().find(
id);
148 if(it != m_graphData->getVertexMap().end())
154 m_graphData = m_graphCache->getGraphDataByVertexId(
id);
158 te::graph::GraphData::VertexMap::iterator it = m_graphData->getVertexMap().find(
id);
160 if(it != m_graphData->getVertexMap().end())
173 m_metadata->addVertexProperty(p);
181 m_metadata->removeVertexProperty(idx);
189 return m_metadata->getVertexProperty(idx);
199 return m_metadata->getVertexPropertySize();
209 m_graphData = m_graphCache->getGraphData();
212 m_graphData->getEdgeMap().insert(te::graph::GraphData::EdgeMap::value_type(e->
getId(), e));
216 m_graphData->setDirty(
true);
219 if(m_graphData->getEdgeMap().size() >= m_metadata->m_maxCacheSize)
229 m_graphData->setDirty(
true);
234 te::graph::GraphData::EdgeMap::iterator it = m_graphData->getEdgeMap().find(
id);
236 if(it != m_graphData->getEdgeMap().end())
238 m_graphData->getEdgeMap().erase(it);
242 m_graphData = m_graphCache->getGraphDataByEdgeId(
id);
246 it = m_graphData->getEdgeMap().find(
id);
248 if(it != m_graphData->getEdgeMap().end())
250 m_graphData->getEdgeMap().erase(it);
257 m_dataManager->removeEdge(
id);
265 te::graph::GraphData::EdgeMap::iterator it = m_graphData->getEdgeMap().find(
id);
267 if(it != m_graphData->getEdgeMap().end())
273 m_graphData = m_graphCache->getGraphDataByEdgeId(
id);
277 te::graph::GraphData::EdgeMap::iterator it = m_graphData->getEdgeMap().find(
id);
279 if(it != m_graphData->getEdgeMap().end())
292 m_metadata->addEdgeProperty(p);
300 m_metadata->removeEdgeProperty(idx);
308 return m_metadata->getEdgeProperty(idx);
318 return m_metadata->getEdgePropertySize();
333 m_graphCache->clearCache();
GraphDataManager * m_dataManager
Used to load and save GraphData information from a DataSource.
Abstract class used to define the main functions of graph struct. All graph implementations must used...
void setDirty(bool flag)
Flag used to indicate that this element was changed.
Class used to define the edge struct of a graph. Its compose with a identifier, the vertex origin and...
This class define the main functions necessary to save and load the graph data and metadata informati...
bool isDirty()
Used to verify the vertex state.
virtual int getEdgePropertySize()
Used to verify the number of properties associated to edge elements.
Class used to manager the graph data elements. This class uses a cache policy to control the elements...
bool isNew()
Flag used to indicate that this element was a new one.
From the point of view of graph theory, vertices are treated as featureless and indivisible objects...
virtual te::dt::Property * getEdgeProperty(int idx)
Get a edge property given a index.
bool isDirty()
Used to verify the edge state.
virtual void removeVertexProperty(int idx)
Remove a property associated to the vertex element.
~Graph()
Virtual destructor.
virtual void removeVertex(int id)
This function removes the vertex element from graph, also was removed in data source.
bool isNew()
Flag used to indicate that this element was a new one.
te::graph::GraphMetadata * getMetadata()
It returns a pointer to a class that describes the graph metadata.
GraphCache * m_graphCache
Class used to keep all graph data loaded.
This is the main graph implementation, that uses a cache policy anda graph loader to get all elements...
virtual int getVertexPropertySize()
Used to verify the number of properties associated to vertex elements.
virtual te::graph::GraphMetadata * getMetadata()
Function used to access the graph metadata.
void setLoaderStrategy(AbstractGraphLoaderStrategy *loaderStrategy)
Function used to set a current loader strategy.
int getId()
It returns the vertex id.
virtual te::dt::Property * getVertexProperty(int idx)
Get a vertex property given a index.
int getId()
It returns the edge identification.
virtual void removeEdgeProperty(int idx)
Remove a property associated to the edge element.
virtual te::graph::Edge * getEdge(int id)
It returns the edge element if it's exist.
It models a property definition.
This class is used to set the main functions of a cache policy.
virtual void addEdgeProperty(te::dt::Property *p)
Add a new property associated to the edge element.
Class used to define the graph metadata informations.
void setDirty(bool flag)
Flag used to indicate that this element was changed.
virtual void addVertexProperty(te::dt::Property *p)
Add a new property associated to the vertex element.
virtual void removeEdge(int id)
This function removes the edge element from graph, also was removed in data source.
virtual void flush()
Function used to clear the memory cache, all elements was released from memory, if any element was ch...
virtual te::graph::Vertex * getVertex(int id)
It returns the vertex element if it's exist.
virtual void add(Vertex *v)
Add a new vertex element to a graph.
GraphMetadata * m_metadata
Graph Data loader strategy.
virtual void update(Vertex *v)
Update the vertex element.