cmGraphAdjacencyList.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
  2. file Copyright.txt or https://cmake.org/licensing for details. */
  3. #ifndef cmGraphAdjacencyList_h
  4. #define cmGraphAdjacencyList_h
  5. #include "cmConfigure.h" // IWYU pragma: keep
  6. #include <utility>
  7. #include <vector>
  8. #include "cmListFileCache.h"
  9. /**
  10. * Graph edge representation. Most use cases just need the
  11. * destination vertex, so we support conversion to/from an int. We
  12. * also store boolean to indicate whether an edge is "strong".
  13. */
  14. class cmGraphEdge
  15. {
  16. public:
  17. cmGraphEdge(int n, bool s, bool c, cmListFileBacktrace bt)
  18. : Dest(n)
  19. , Strong(s)
  20. , Cross(c)
  21. , Backtrace(std::move(bt))
  22. {
  23. }
  24. operator int() const { return this->Dest; }
  25. bool IsStrong() const { return this->Strong; }
  26. bool IsCross() const { return this->Cross; }
  27. cmListFileBacktrace const& GetBacktrace() const { return this->Backtrace; }
  28. private:
  29. int Dest;
  30. bool Strong;
  31. bool Cross;
  32. cmListFileBacktrace Backtrace;
  33. };
  34. struct cmGraphEdgeList : public std::vector<cmGraphEdge>
  35. {
  36. };
  37. struct cmGraphNodeList : public std::vector<int>
  38. {
  39. };
  40. struct cmGraphAdjacencyList : public std::vector<cmGraphEdgeList>
  41. {
  42. };
  43. #endif