blob: b3a95d4f3c131b4f73bbcdcab1c4a410d4e6a07f [file] [log] [blame]
Chris Hamilton77da59d2019-06-04 15:59:321// 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
Sigurdur Asgeirsson51d9d242019-10-07 20:38:345#ifndef COMPONENTS_PERFORMANCE_MANAGER_PUBLIC_GRAPH_NODE_H_
6#define COMPONENTS_PERFORMANCE_MANAGER_PUBLIC_GRAPH_NODE_H_
Chris Hamilton77da59d2019-06-04 15:59:327
8#include <cstdint>
9
10#include "base/macros.h"
Chris Hamiltonf86f6342021-03-30 16:42:3411#include "components/performance_manager/public/graph/node_state.h"
Chris Hamilton77da59d2019-06-04 15:59:3212
13namespace performance_manager {
14
15class Graph;
16
17// Interface that all nodes must implement.
18// TODO(chrisha): Move NodeTypeEnum to the public interface and expose it here,
19// then add FromNode casts on the public node interfaces.
20class Node {
21 public:
22 Node();
23 virtual ~Node();
24
25 // Returns the graph to which this node belongs.
26 virtual Graph* GetGraph() const = 0;
27
Chris Hamiltonf86f6342021-03-30 16:42:3428 // Returns the state of this node.
29 virtual NodeState GetNodeState() const = 0;
30
Chris Hamilton77da59d2019-06-04 15:59:3231 // The following functions are implementation detail and should not need to be
32 // used by external clients. They provide the ability to safely downcast to
33 // the underlying implementation.
34 virtual uintptr_t GetImplType() const = 0;
35 virtual const void* GetImpl() const = 0;
36
Chris Hamilton77da59d2019-06-04 15:59:3237 private:
38 DISALLOW_COPY_AND_ASSIGN(Node);
39};
40
41} // namespace performance_manager
42
Sigurdur Asgeirsson51d9d242019-10-07 20:38:3443#endif // COMPONENTS_PERFORMANCE_MANAGER_PUBLIC_GRAPH_NODE_H_