cmake/Source/cmGraphAdjacencyList.h

51 lines
1.1 KiB
C
Raw Normal View History

2016-10-30 18:24:19 +01:00
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
2021-09-14 00:13:48 +02:00
#pragma once
2017-07-20 19:35:53 +02:00
#include "cmConfigure.h" // IWYU pragma: keep
2016-10-30 18:24:19 +01:00
2023-05-23 16:38:00 +02:00
#include <cstddef>
2019-11-11 23:01:05 +01:00
#include <utility>
2017-04-14 19:02:05 +02:00
#include <vector>
2020-02-01 23:06:01 +01:00
#include "cmListFileCache.h"
2010-11-13 01:00:53 +02:00
/**
* Graph edge representation. Most use cases just need the
* destination vertex, so we support conversion to/from an int. We
* also store boolean to indicate whether an edge is "strong".
*/
class cmGraphEdge
{
public:
2023-05-23 16:38:00 +02:00
cmGraphEdge(size_t n, bool s, bool c, cmListFileBacktrace bt)
2016-07-09 11:21:54 +02:00
: Dest(n)
, Strong(s)
2020-08-30 11:54:41 +02:00
, Cross(c)
2019-11-11 23:01:05 +01:00
, Backtrace(std::move(bt))
2016-07-09 11:21:54 +02:00
{
}
2023-05-23 16:38:00 +02:00
operator size_t() const { return this->Dest; }
2010-11-13 01:00:53 +02:00
bool IsStrong() const { return this->Strong; }
2018-08-09 18:06:22 +02:00
2020-08-30 11:54:41 +02:00
bool IsCross() const { return this->Cross; }
2019-11-11 23:01:05 +01:00
cmListFileBacktrace const& GetBacktrace() const { return this->Backtrace; }
2010-11-13 01:00:53 +02:00
private:
2023-05-23 16:38:00 +02:00
size_t Dest;
2010-11-13 01:00:53 +02:00
bool Strong;
2020-08-30 11:54:41 +02:00
bool Cross;
2019-11-11 23:01:05 +01:00
cmListFileBacktrace Backtrace;
2010-11-13 01:00:53 +02:00
};
2016-07-09 11:21:54 +02:00
struct cmGraphEdgeList : public std::vector<cmGraphEdge>
{
};
2023-05-23 16:38:00 +02:00
struct cmGraphNodeList : public std::vector<size_t>
2016-07-09 11:21:54 +02:00
{
};
struct cmGraphAdjacencyList : public std::vector<cmGraphEdgeList>
{
};