P4C
The P4 Compiler
Loading...
Searching...
No Matches
formulae.h
1
/*
2
* SPDX-FileCopyrightText: 2022 The P4 Language Consortium
3
*
4
* SPDX-License-Identifier: Apache-2.0
5
*/
6
7
#ifndef BACKENDS_P4TOOLS_COMMON_LIB_FORMULAE_H_
8
#define BACKENDS_P4TOOLS_COMMON_LIB_FORMULAE_H_
9
10
#include <functional>
11
#include <string>
12
13
#include "ir/ir.h"
14
#include "ir/node.h"
15
#include "lib/exceptions.h"
16
17
namespace
P4::P4Tools
{
18
22
template
<
class
Self,
class
Node = IR::Expression>
23
class
AbstractRepCheckedNode
:
public
ICastable
{
24
protected
:
25
std::reference_wrapper<const Node> node;
26
27
// Implicit conversions to allow implementations to be treated like a Node*.
28
operator
const
Node *()
const
{
return
&node.get(); }
29
const
Node &operator*()
const
{
return
node.get(); }
30
const
Node *operator->()
const
{
return
&node.get(); }
31
34
explicit
AbstractRepCheckedNode
(
const
Node *node, std::string classDesc) : node(*node) {
35
BUG_CHECK(Self::repOk(node),
"%1%: Not a valid %2%."
, node, classDesc);
36
}
37
38
DECLARE_TYPEINFO(
AbstractRepCheckedNode
);
39
};
40
41
}
// namespace P4::P4Tools
42
43
#endif
/* BACKENDS_P4TOOLS_COMMON_LIB_FORMULAE_H_ */
P4::ICastable
Definition
castable.h:27
P4::P4Tools::AbstractRepCheckedNode
Definition
formulae.h:23
P4::P4Tools::AbstractRepCheckedNode::AbstractRepCheckedNode
AbstractRepCheckedNode(const Node *node, std::string classDesc)
Definition
formulae.h:34
P4::P4Tools
Definition
common/compiler/compiler_result.cpp:7
backends
p4tools
common
lib
formulae.h
Generated by
1.13.2