LLVM 23.0.0git
CASNodeSchema.h
Go to the documentation of this file.
1//===- llvm/CAS/CASNodeSchema.h ---------------------------------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef LLVM_CAS_CASNODESCHEMA_H
10#define LLVM_CAS_CASNODESCHEMA_H
11
15
16namespace llvm::cas {
17
18class ObjectProxy;
19
20/// A base class for schemas built on top of CAS nodes.
21class LLVM_ABI NodeSchema : public RTTIExtends<NodeSchema, RTTIRoot> {
22 void anchor() override;
23
24public:
25 static char ID;
26
27 /// Check if \a Node is a root (entry node) for the schema. This is a strong
28 /// check, since it requires that the first reference matches a complete
29 /// type-id DAG.
30 virtual bool isRootNode(const cas::ObjectProxy &Node) const = 0;
31
32 /// Check if \a Node is a node for the schema. This can be any node that
33 /// belongs to the schema.
34 virtual bool isNode(const cas::ObjectProxy &Node) const = 0;
35
37
38protected:
40
41public:
42 virtual ~NodeSchema() = default;
43};
44
45} // namespace llvm::cas
46
47#endif // LLVM_CAS_CASNODESCHEMA_H
#define LLVM_ABI
Definition Compiler.h:213
Inheritance utility for extensible RTTI.
NodeSchema(cas::ObjectStore &CAS)
virtual bool isNode(const cas::ObjectProxy &Node) const =0
Check if Node is a node for the schema.
virtual ~NodeSchema()=default
cas::ObjectStore & CAS
virtual bool isRootNode(const cas::ObjectProxy &Node) const =0
Check if Node is a root (entry node) for the schema.
Reference to an abstract hierarchical node, with data and references.
Content-addressable storage for objects.
Definition ObjectStore.h:90