graph_analysis
NWeightedVertex.hpp
Go to the documentation of this file.
1 #ifndef GRAPH_ANALYSIS_NWEIGHTED_VERTEX_HPP
2 #define GRAPH_ANALYSIS_NWEIGHTED_VERTEX_HPP
3 
4 #include <iostream>
5 #include "NWeighted.hpp"
6 #include "Vertex.hpp"
7 #include "VertexRegistration.hpp"
8 
9 namespace graph_analysis {
10 
15 template<typename T, size_t Dim = 2>
16 class NWeightedVertex : public NWeighted<T,Dim,Vertex>
17 {
18 public:
19  typedef shared_ptr< NWeightedVertex > Ptr;
20 
21  NWeightedVertex(const T& weight = T())
22  : NWeighted<T,Dim,Vertex>(weight)
23  {}
24 
25  virtual ~NWeightedVertex() {}
26 
27  void registerAttributes(VertexTypeManager* vManager) const override
28  {
29  vManager->registerAttribute(getClassName(), "weights",
33  }
34 
35  // Get class name
36  // \return class name
37  virtual std::string getClassName() const { return
38  "graph_analysis::NWeightedVertex_" + std::string(typeid(T).name()) + "_" + std::to_string(Dim); }
39 
40 protected:
41  virtual Vertex* getClone() const { return new NWeightedVertex<T,Dim>(*this); }
42 
44 };
45 
46 template<typename T, size_t Dim>
47 const VertexRegistration< NWeightedVertex<T,Dim> > NWeightedVertex<T,Dim>::msRegistration;
48 
49 } // end namespace graph_analysis
50 #endif // GRAPH_ANALYSIS_NWEIGHTED_VERTEX_HPP
graph_analysis::io::AttributeSerializationCallbacks::print_func_t
std::string(graph_analysis::GraphElement::* print_func_t)()
Definition: Serialization.hpp:34
graph_analysis::NWeightedVertex::Ptr
shared_ptr< NWeightedVertex > Ptr
Definition: NWeightedVertex.hpp:19
graph_analysis::NWeighted< T, 2, Vertex >::serializeWeights
std::string serializeWeights()
Definition: NWeighted.hpp:126
graph_analysis::io::AttributeSerializationCallbacks::deserialize_func_t
void(graph_analysis::GraphElement::* deserialize_func_t)(const std::string &)
Definition: Serialization.hpp:33
graph_analysis::Vertex
A vertex inherited to allow storing data of any type.
Definition: Vertex.hpp:19
Vertex.hpp
graph_analysis::NWeighted< T, 2, Vertex >::deserializeWeights
void deserializeWeights(const std::string &s)
Definition: NWeighted.hpp:134
graph_analysis::NWeightedVertex::getClone
virtual Vertex * getClone() const
Definition: NWeightedVertex.hpp:41
graph_analysis
Main namespace of the graph analysis library.
Definition: BFS.cpp:3
NWeighted.hpp
graph_analysis::AttributeManager::registerAttribute
void registerAttribute(const std::string &typeName, const std::string &attributeName, io::AttributeSerializationCallbacks::serialize_func_t sF, io::AttributeSerializationCallbacks::deserialize_func_t dF, io::AttributeSerializationCallbacks::print_func_t pF)
register a new attribute for serialization and deserialization
Definition: AttributeManager.cpp:5
graph_analysis::algorithms::msRegistration
const VertexRegistration< MultiCommodityVertex > msRegistration
Definition: MultiCommodityVertex.cpp:13
graph_analysis::NWeightedVertex::getClassName
virtual std::string getClassName() const
Definition: NWeightedVertex.hpp:37
graph_analysis::NWeightedVertex::NWeightedVertex
NWeightedVertex(const T &weight=T())
Definition: NWeightedVertex.hpp:21
graph_analysis::NWeighted< T, 2, Vertex >::stringifyWeights
std::string stringifyWeights() const
Definition: NWeighted.hpp:142
graph_analysis::NWeighted
NWeighted is a template to associate N-weights with either a vertex or an edge, i....
Definition: NWeighted.hpp:26
graph_analysis::NWeightedVertex
NWeightedVertex is an Vertex which can be associated with N-weights, i.e., a vector of weights.
Definition: NWeightedVertex.hpp:16
graph_analysis::NWeightedVertex::__attribute__
static const VertexRegistration< NWeightedVertex< T, Dim > > __attribute__((used)) msRegistration
graph_analysis::VertexTypeManager
Factory for Vertex subclasses.
Definition: VertexTypeManager.hpp:29
graph_analysis::VertexRegistration
Definition: VertexRegistration.hpp:14
graph_analysis::io::AttributeSerializationCallbacks::serialize_func_t
std::string(graph_analysis::GraphElement::* serialize_func_t)()
Definition: Serialization.hpp:32
graph_analysis::NWeightedVertex::~NWeightedVertex
virtual ~NWeightedVertex()
Definition: NWeightedVertex.hpp:25
VertexRegistration.hpp
graph_analysis::NWeightedVertex::registerAttributes
void registerAttributes(VertexTypeManager *vManager) const override
Definition: NWeightedVertex.hpp:27