2018-08-21 00:25:44 +02:00
|
|
|
/** A graph vertex.
|
|
|
|
*
|
|
|
|
* @file
|
|
|
|
* @author Daniel Krebs <github@daniel-krebs.net>
|
2022-03-15 09:05:42 -04:00
|
|
|
* @copyright 2014-2022, Institute for Automation of Complex Power Systems, EONERC
|
2022-05-19 17:40:10 +02:00
|
|
|
* @license Apache License 2.0
|
2018-08-21 00:25:44 +02:00
|
|
|
*********************************************************************************/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
namespace villas {
|
|
|
|
namespace graph {
|
|
|
|
|
|
|
|
class Vertex {
|
|
|
|
template<typename VertexType, typename EdgeType>
|
|
|
|
friend class DirectedGraph;
|
|
|
|
|
|
|
|
public:
|
|
|
|
using Identifier = std::size_t;
|
|
|
|
|
2023-01-09 11:33:30 +01:00
|
|
|
Vertex() :
|
|
|
|
id(0)
|
|
|
|
{ }
|
|
|
|
|
2022-12-02 17:16:44 +01:00
|
|
|
const Identifier& getIdentifier() const
|
|
|
|
{
|
|
|
|
return id;
|
|
|
|
}
|
|
|
|
|
|
|
|
friend
|
2023-01-09 11:33:30 +01:00
|
|
|
std::ostream& operator<<(std::ostream &stream, const Vertex &vertex)
|
2022-12-02 17:16:44 +01:00
|
|
|
{
|
|
|
|
return stream << vertex.id;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool operator==(const Vertex &other)
|
|
|
|
{
|
|
|
|
return this->id == other.id;
|
|
|
|
}
|
2018-08-21 00:25:44 +02:00
|
|
|
|
|
|
|
private:
|
2023-01-09 11:33:30 +01:00
|
|
|
Identifier id;
|
2018-08-21 00:25:44 +02:00
|
|
|
// HACK: how to resolve this circular type dependency?
|
|
|
|
std::list<std::size_t> edges;
|
|
|
|
};
|
|
|
|
|
2022-12-02 17:16:44 +01:00
|
|
|
} // namespace graph
|
|
|
|
} // namespace villas
|