-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgraphattributetranslator.hpp
More file actions
27 lines (25 loc) · 1.24 KB
/
graphattributetranslator.hpp
File metadata and controls
27 lines (25 loc) · 1.24 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
#pragma once
#include "edges.hpp"
// Deletion of attributes is not needed, is it?
/*
Helper class.
Registers attributes by its names.
Than we can get numeric ID to access this attribute in graph.
*/
class GraphAttributeTranslator
{
public:
typedef std::unordered_map<Vertex::AttributeName, Vertex::AttributeId> VertexAttributeNameTranslator;
typedef std::unordered_map<Edge::AttributeName, Edge::AttributeId> EdgeAttributeNameTranslator;
Vertex::AttributeId addVertexAttribute(const Vertex::AttributeName& attrName);
Edge::AttributeId addEdgeAttribute(const Edge::AttributeName& attrName);
Vertex::AttributeId getVertexAttributeIdByName(const Vertex::AttributeName& attrName) const;
Edge::AttributeId getEdgeAttributeIdByName(const Edge::AttributeName& attrName) const;
bool isVertexAttributeIdRegistered(const Vertex::AttributeName& attrName) const;
bool isEdgeAttributeIdRegistered(const Edge::AttributeName& attrName) const;
size_t getVertexAttributesCount() const{return vertexAttrNameTranslator.size();}
size_t getEdgeAttributesCount() const{return edgeAttrNameTranslator.size();}
private:
VertexAttributeNameTranslator vertexAttrNameTranslator;
EdgeAttributeNameTranslator edgeAttrNameTranslator;
};