node.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. // Copyright 2019 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef COMPONENTS_PERFORMANCE_MANAGER_PUBLIC_GRAPH_NODE_H_
  5. #define COMPONENTS_PERFORMANCE_MANAGER_PUBLIC_GRAPH_NODE_H_
  6. #include <cstdint>
  7. #include "components/performance_manager/public/graph/node_state.h"
  8. namespace performance_manager {
  9. class Graph;
  10. // Interface that all nodes must implement.
  11. // TODO(chrisha): Move NodeTypeEnum to the public interface and expose it here,
  12. // then add FromNode casts on the public node interfaces.
  13. class Node {
  14. public:
  15. Node();
  16. Node(const Node&) = delete;
  17. Node& operator=(const Node&) = delete;
  18. virtual ~Node();
  19. // Returns the graph to which this node belongs.
  20. virtual Graph* GetGraph() const = 0;
  21. // Returns the state of this node.
  22. virtual NodeState GetNodeState() const = 0;
  23. // The following functions are implementation detail and should not need to be
  24. // used by external clients. They provide the ability to safely downcast to
  25. // the underlying implementation.
  26. virtual uintptr_t GetImplType() const = 0;
  27. virtual const void* GetImpl() const = 0;
  28. };
  29. } // namespace performance_manager
  30. #endif // COMPONENTS_PERFORMANCE_MANAGER_PUBLIC_GRAPH_NODE_H_