-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgraphattributetranslator.cpp
More file actions
51 lines (45 loc) · 1.49 KB
/
graphattributetranslator.cpp
File metadata and controls
51 lines (45 loc) · 1.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#include "graphattributetranslator.hpp"
/*
id is simple integer, that increments with each new attribute
*/
Vertex::AttributeId GraphAttributeTranslator::addVertexAttribute(const Vertex::AttributeName &attrName)
{
Vertex::AttributeId newId = vertexAttrNameTranslator.size();
vertexAttrNameTranslator[attrName] = newId;
return newId;
}
/*
id is simple integer, that increments with each new attribute
*/
Edge::AttributeId GraphAttributeTranslator::addEdgeAttribute(const Edge::AttributeName &attrName)
{
Edge::AttributeId newId = edgeAttrNameTranslator.size();
edgeAttrNameTranslator[attrName] = newId;
return newId;
}
Vertex::AttributeId GraphAttributeTranslator::getVertexAttributeIdByName(const Vertex::AttributeName& attrName) const
{
return vertexAttrNameTranslator.at(attrName);
}
Edge::AttributeId GraphAttributeTranslator::getEdgeAttributeIdByName(const Edge::AttributeName& attrName) const
{
return edgeAttrNameTranslator.at(attrName);
}
bool GraphAttributeTranslator::isVertexAttributeIdRegistered(const Vertex::AttributeName& attrName) const
{
auto findIter = vertexAttrNameTranslator.find(attrName);
if(findIter == vertexAttrNameTranslator.end())
{
return false;
}
return true;
}
bool GraphAttributeTranslator::isEdgeAttributeIdRegistered(const Edge::AttributeName& attrName) const
{
auto findIter = edgeAttrNameTranslator.find(attrName);
if(findIter == edgeAttrNameTranslator.end())
{
return false;
}
return true;
}